You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
| 2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
| 2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:57
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot
In directory usw-pr-cvs1:/tmp/cvs-serv9090/vax/boot
Modified Files:
head.S
Added Files:
default_command_line
Log Message:
synch 2.4.15 commit 14
--- NEW FILE ---
root=/dev/nfs nfsroot=/tftpboot/vaxroot rw debug
Index: head.S
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/head.S,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- head.S 16 Sep 2001 15:19:27 -0000 1.14
+++ head.S 9 Apr 2002 13:50:55 -0000 1.15
@@ -215,6 +215,7 @@
#
# swapper_pg_dir is actually a pgd_t. The spt is the third entry.
# see include/asm-vax/mm/pagelet.h for details of the pgd_t structure.
+# If you change the SPT, change the offsets in asm/pgtable.h.
#
# First find a suitable start position for the SPT. This must be
# longword aligned
@@ -224,7 +225,8 @@
addl3 $0x200, r9, r5 # R9 holds kernel end
bicl2 $0x1ff, r5 # R5 is R9 rounded up to page aligned
moval swapper_pg_dir, r0
- movl r5, 48(r0) # save address of base of system page table
+# This is (pgd_t)swapper_pg_dir[2].br
+ movl r5, ASM_SBR_OFFSET(r0) # save address of base of system page table
# Fill in the main part of the SPT (the entries that map physical
# memory)
@@ -273,8 +275,8 @@
blssu sparefill2
# system page table is setup. Save SPT length and zap processor registers
moval swapper_pg_dir, r0
- movl r7, 52(r0)
- mtpr 48(r0), $PR_SBR # set SBR
+ movl r7, ASM_SLR_OFFSET(r0)
+ mtpr ASM_SBR_OFFSET(r0), $PR_SBR # set SBR
mtpr r7, $PR_SLR # set SLR
# PCBB
# set up the process control block. Some machines need a valid PCB for
@@ -293,7 +295,7 @@
calls $0, VAX_start_mm # do that ole black magic
# made it
moval swapper_pg_dir, r0
- addl2 $PAGE_OFFSET, 48(r0) # fix up our reference to the system page tbl.
+ addl2 $PAGE_OFFSET, ASM_SBR_OFFSET(r0) # fix up our reference to the system page tbl.
addl2 $PAGE_OFFSET, iomap_base # ... and the IOMAP PTEs
addl2 $PAGE_OFFSET, vmallocmap_base # ... and the IOMAP PTEs
addl2 $PAGE_OFFSET, mv # fix up machine vector pointer
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:57
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/mbx In directory usw-pr-cvs1:/tmp/cvs-serv22477/arch/ppc/boot/mbx Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/mbx added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:55
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax In directory usw-pr-cvs1:/tmp/cvs-serv9090/vax Modified Files: Makefile config.in defconfig Added Files: 460.config defconfig.old defconfig.old.m30 m76.config Log Message: synch 2.4.15 commit 14 --- NEW FILE --- # # Automatically generated make config: don't edit # CONFIG_VAX=y CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y # # Loadable module support # # CONFIG_MODULES is not set # # Processor type and features # # CONFIG_SMP is not set # CONFIG_SMP is not set # # General setup # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set CONFIG_ELF_KERNEL=y # CONFIG_EXTRA_ELF_COMPILER is not set CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set CONFIG_PROC_FS=y # # Bus support # # CONFIG_QBUS is not set # CONFIG_UNIBUS is not set # CONFIG_VAXBI is not set CONFIG_VSBUS=y CONFIG_VAX_4000HC=y # # Mass storage support # # CONFIG_MSCP is not set # CONFIG_TMSCP is not set # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BLK_DEV_INITRD is not set # # Networking options # CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set # CONFIG_NETLINK is not set # CONFIG_NETFILTER is not set # CONFIG_FILTER is not set CONFIG_UNIX=y CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # # # # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # SCSI support # CONFIG_SCSI=y # # SCSI support type (disk, tape, CDrom) # CONFIG_BLK_DEV_SD=y CONFIG_CHR_DEV_ST=y CONFIG_BLK_DEV_SR=y CONFIG_CHR_DEV_SG=y # # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y CONFIG_SCSI_CONSTANTS=y # # SCSI low-level drivers # # CONFIG_SCSI_VAX_5380 is not set # # Network device support # CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_SLIP is not set CONFIG_PPP=y # # CCP compressors for PPP are only built as modules. # CONFIG_VAX_LANCE=y # CONFIG_SGEC is not set # # File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set CONFIG_REISERFS_FS=y # CONFIG_REISERFS_CHECK is not set # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y CONFIG_JOLIET=y # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_UDF_FS is not set CONFIG_UFS_FS=y # CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set # CONFIG_OSF_PARTITION is not set # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y CONFIG_BSD_DISKLABEL=y # CONFIG_MINIX_SUBPARTITION is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set CONFIG_ULTRIX_PARTITION=y # CONFIG_SUN_PARTITION is not set # CONFIG_SMB_NLS is not set CONFIG_NLS=y # # Native Language Support # CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_CODEPAGE_852 is not set # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set # CONFIG_NLS_CODEPAGE_861 is not set # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_CODEPAGE_932 is not set # CONFIG_NLS_CODEPAGE_936 is not set # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set # CONFIG_NLS_ISO8859_5 is not set # CONFIG_NLS_ISO8859_6 is not set # CONFIG_NLS_ISO8859_7 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_ISO8859_9 is not set # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_UTF8 is not set # # VAX Character devices # # CONFIG_VT is not set CONFIG_SERIAL=y CONFIG_DZ=y CONFIG_SERIAL_MTPR=y CONFIG_SERIAL_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 # # Kernel hacking # CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 --- NEW FILE --- # # Automatically generated by make menuconfig: don't edit # CONFIG_VAX=y CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y # # Loadable module support # # CONFIG_MODULES is not set # # Processor type and features # # CONFIG_SMP is not set # CONFIG_SMP is not set # # General setup # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set CONFIG_ELF_KERNEL=y # CONFIG_EXTRA_ELF_COMPILER is not set CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set CONFIG_PROC_FS=y # # Bus support # CONFIG_QBUS=y CONFIG_UNIBUS=y CONFIG_VAXBI=y CONFIG_VSBUS=y # # Mass storage support # CONFIG_MSCP=y CONFIG_TMSCP=y # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # # Networking options # # CONFIG_PACKET is not set # CONFIG_NETLINK is not set # CONFIG_NETFILTER is not set # CONFIG_FILTER is not set CONFIG_UNIX=y CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set CONFIG_DECNET=y # CONFIG_DECNET_SIOCGIFCONF is not set # CONFIG_DECNET_ROUTER is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # SCSI support # # CONFIG_SCSI is not set # # Network device support # CONFIG_NETDEVICES=y CONFIG_DUMMY=y CONFIG_SLIP=y # CONFIG_SLIP_COMPRESSED is not set # CONFIG_SLIP_SMART is not set CONFIG_PPP=y CONFIG_VAX_LANCE=y # # File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set # CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set # CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set # CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set # CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set # CONFIG_NCPFS_STRONG is not set # CONFIG_NCPFS_NFS_NS is not set # CONFIG_NCPFS_OS2_NS is not set # CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_EXTRAS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set CONFIG_OSF_PARTITION=y # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set CONFIG_ULTRIX_PARTITION=y # CONFIG_SUN_PARTITION is not set # CONFIG_SMB_NLS is not set # CONFIG_NLS is not set # # VAX Character devices # # CONFIG_VT is not set CONFIG_SERIAL=y CONFIG_DZ=y CONFIG_SERIAL_MTPR=y CONFIG_SERIAL_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 # # Kernel hacking # This appears to be missing bits... #CONFIG_DEBUG_MALLOC=n CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 --- NEW FILE --- # # Automatically generated by make menuconfig: don't edit # CONFIG_VAX=y CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y # # Loadable module support # # CONFIG_MODULES is not set # # Processor type and features # # CONFIG_SMP is not set # CONFIG_SMP is not set # # General setup # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set CONFIG_ELF_KERNEL=y # CONFIG_EXTRA_ELF_COMPILER is not set CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set CONFIG_PROC_FS=y # # Bus support # CONFIG_QBUS=y CONFIG_UNIBUS=y CONFIG_VAXBI=y CONFIG_VSBUS=y # # Mass storage support # CONFIG_MSCP=y CONFIG_TMSCP=y # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BLK_DEV_INITRD=y # # Networking options # # CONFIG_PACKET is not set # CONFIG_NETLINK is not set # CONFIG_NETFILTER is not set # CONFIG_FILTER is not set CONFIG_UNIX=y CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set CONFIG_DECNET=y # CONFIG_DECNET_SIOCGIFCONF is not set # CONFIG_DECNET_ROUTER is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # SCSI support # # CONFIG_SCSI is not set # # Network device support # CONFIG_NETDEVICES=y CONFIG_DUMMY=y CONFIG_SLIP=y # CONFIG_SLIP_COMPRESSED is not set # CONFIG_SLIP_SMART is not set CONFIG_PPP=y CONFIG_VAX_LANCE=y # # File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set # CONFIG_JOLIET is not set # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS is not set # CONFIG_QNX4FS_FS is not set # CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set # CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set # CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set # CONFIG_NFSD_V3 is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # CONFIG_NCPFS_PACKET_SIGNING is not set # CONFIG_NCPFS_IOCTL_LOCKING is not set # CONFIG_NCPFS_STRONG is not set # CONFIG_NCPFS_NFS_NS is not set # CONFIG_NCPFS_OS2_NS is not set # CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_EXTRAS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set CONFIG_OSF_PARTITION=y # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set CONFIG_ULTRIX_PARTITION=y # CONFIG_SUN_PARTITION is not set # CONFIG_SMB_NLS is not set # CONFIG_NLS is not set # # VAX Character devices # # CONFIG_VT is not set CONFIG_SERIAL=y CONFIG_DZ=y CONFIG_SERIAL_MTPR=y CONFIG_SERIAL_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 # # Kernel hacking # This appears to be missing bits... #CONFIG_DEBUG_MALLOC=n CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 --- NEW FILE --- # # Automatically generated make config: don't edit # CONFIG_VAX=y CONFIG_UID16=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y # # Loadable module support # # CONFIG_MODULES is not set # # Processor type and features # # CONFIG_SMP is not set # CONFIG_SMP is not set # # General setup # CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set CONFIG_ELF_KERNEL=y # CONFIG_EXTRA_ELF_COMPILER is not set CONFIG_NET=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y CONFIG_KCORE_ELF=y # CONFIG_KCORE_AOUT is not set # CONFIG_BINFMT_AOUT is not set CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_MISC is not set CONFIG_PROC_FS=y # # Bus support # # CONFIG_QBUS is not set # CONFIG_UNIBUS is not set # CONFIG_VAXBI is not set CONFIG_VSBUS=y CONFIG_VAX_4000HC=y # # Mass storage support # # CONFIG_MSCP is not set # CONFIG_TMSCP is not set # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_XD is not set # CONFIG_PARIDE is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BLK_DEV_INITRD is not set # # Networking options # CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set # CONFIG_NETLINK is not set # CONFIG_NETFILTER is not set # CONFIG_FILTER is not set CONFIG_UNIX=y CONFIG_INET=y # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set # # # # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_DECNET is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_LLC is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # SCSI support # CONFIG_SCSI=y # # SCSI support type (disk, tape, CDrom) # CONFIG_BLK_DEV_SD=y CONFIG_CHR_DEV_ST=y CONFIG_BLK_DEV_SR=y CONFIG_CHR_DEV_SG=y # # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y CONFIG_SCSI_CONSTANTS=y # # SCSI low-level drivers # CONFIG_SCSI_VAX_5380=y # # Network device support # CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_SLIP is not set CONFIG_PPP=y # # CCP compressors for PPP are only built as modules. # CONFIG_VAX_LANCE=y # CONFIG_SGEC is not set # # File systems # # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set CONFIG_REISERFS_FS=y # CONFIG_REISERFS_CHECK is not set # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=y # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y CONFIG_JOLIET=y # CONFIG_MINIX_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_HPFS_FS is not set CONFIG_PROC_FS=y # CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set # CONFIG_UDF_FS is not set CONFIG_UFS_FS=y # CONFIG_UFS_FS_WRITE is not set # # Network File Systems # # CONFIG_CODA_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set CONFIG_ROOT_NFS=y # CONFIG_NFSD is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y # CONFIG_SMB_FS is not set # CONFIG_NCP_FS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set # CONFIG_OSF_PARTITION is not set # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y CONFIG_BSD_DISKLABEL=y # CONFIG_MINIX_SUBPARTITION is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_SGI_PARTITION is not set CONFIG_ULTRIX_PARTITION=y # CONFIG_SUN_PARTITION is not set # CONFIG_SMB_NLS is not set CONFIG_NLS=y # # Native Language Support # CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_CODEPAGE_852 is not set # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set # CONFIG_NLS_CODEPAGE_861 is not set # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_CODEPAGE_932 is not set # CONFIG_NLS_CODEPAGE_936 is not set # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_ISO8859_1 is not set # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set # CONFIG_NLS_ISO8859_5 is not set # CONFIG_NLS_ISO8859_6 is not set # CONFIG_NLS_ISO8859_7 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_ISO8859_9 is not set # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_UTF8 is not set # # VAX Character devices # # CONFIG_VT is not set CONFIG_SERIAL=y CONFIG_DZ=y CONFIG_SERIAL_MTPR=y CONFIG_SERIAL_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_UNIX98_PTY_COUNT=256 # # Kernel hacking # CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile 16 Sep 2001 15:18:12 -0000 1.10 +++ Makefile 9 Apr 2002 13:50:55 -0000 1.11 @@ -47,7 +47,7 @@ LIBS := $(ARCHLIBS) $(LIBS) MKBOOTBLK := $(TOPDIR)/arch/vax/boot/tools/mkbootblk -DEFAULT_CMDLINE := "root=/dev/nfs nfsroot=/tftpboot/vaxroot rw debug" +DEFAULT_CMDLINE := "root=/dev/nfs nfsroot=/home/disk_vax/vaxroot ip=bootp rw debug" SETCMDLINE := $(TOPDIR)/arch/vax/boot/tools/setcmdline SHOWCMDLINE := $(TOPDIR)/arch/vax/boot/tools/showcmdline Index: config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/config.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- config.in 15 Dec 2001 12:29:30 -0000 1.10 +++ config.in 9 Apr 2002 13:50:55 -0000 1.11 @@ -8,8 +8,12 @@ # Use this in the arch-independent sources to conditionally compile # in VAX-specific stuff (for example, in serial_console_init()) define_bool CONFIG_VAX y - define_bool CONFIG_UID16 y +# stuff needed by include/linux/rwsem.h - includes generic routines if +# you have no asm/rwsem.h - which we dont. +define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y +define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n + mainmenu_option next_comment comment 'Code maturity level options' @@ -45,6 +49,7 @@ define_bool CONFIG_BINFMT_ELF y define_bool CONFIG_BINFMT_AOUT n define_bool CONFIG_ELF_KERNEL y +define_bool CONFIG_KCORE_ELF y define_bool CONFIG_EXTRA_ELF_COMPILER n bool 'Networking support' CONFIG_NET Index: defconfig =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/defconfig,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- defconfig 14 Sep 2001 21:52:15 -0000 1.8 +++ defconfig 9 Apr 2002 13:50:55 -0000 1.9 @@ -1,8 +1,10 @@ # -# Automatically generated by make menuconfig: don't edit +# Automatically generated make config: don't edit # CONFIG_VAX=y CONFIG_UID16=y +CONFIG_RWSEM_GENERIC_SPINLOCK=y +# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set # # Code maturity level options @@ -26,6 +28,7 @@ CONFIG_BINFMT_ELF=y # CONFIG_BINFMT_AOUT is not set CONFIG_ELF_KERNEL=y +CONFIG_KCORE_ELF=y # CONFIG_EXTRA_ELF_COMPILER is not set CONFIG_NET=y CONFIG_SYSVIPC=y @@ -45,6 +48,7 @@ CONFIG_UNIBUS=y CONFIG_VAXBI=y CONFIG_VSBUS=y +# CONFIG_VAX_4000HC is not set # # Mass storage support @@ -79,6 +83,7 @@ # CONFIG_IP_MULTICAST is not set # CONFIG_IP_ADVANCED_ROUTER is not set CONFIG_IP_PNP=y +# CONFIG_IP_PNP_DHCP is not set CONFIG_IP_PNP_BOOTP=y # CONFIG_IP_PNP_RARP is not set # CONFIG_NET_IPIP is not set @@ -88,11 +93,14 @@ # CONFIG_IPV6 is not set # CONFIG_KHTTPD is not set # CONFIG_ATM is not set +# CONFIG_VLAN_8021Q is not set + +# +# +# # CONFIG_IPX is not set # CONFIG_ATALK is not set -CONFIG_DECNET=y -# CONFIG_DECNET_SIOCGIFCONF is not set -# CONFIG_DECNET_ROUTER is not set +# CONFIG_DECNET is not set # CONFIG_BRIDGE is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set @@ -111,7 +119,27 @@ # # SCSI support # -# CONFIG_SCSI is not set +CONFIG_SCSI=y + +# +# SCSI support type (disk, tape, CDrom) +# +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_ST=y +CONFIG_BLK_DEV_SR=y +CONFIG_CHR_DEV_SG=y + +# +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs +# +# CONFIG_SCSI_MULTI_LUN is not set +CONFIG_SCSI_CONSTANTS=y + +# +# SCSI low-level drivers +# +CONFIG_SCSI_VAX_5380=y +# CONFIG_SCSI_VAX_53C94 is not set # # Network device support @@ -122,7 +150,12 @@ # CONFIG_SLIP_COMPRESSED is not set # CONFIG_SLIP_SMART is not set CONFIG_PPP=y + +# +# CCP compressors for PPP are only built as modules. +# CONFIG_VAX_LANCE=y +# CONFIG_SGEC is not set # # File systems @@ -130,22 +163,32 @@ # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set +CONFIG_REISERFS_FS=y +CONFIG_REISERFS_CHECK=y +# CONFIG_REISERFS_PROC_INFO is not set # CONFIG_ADFS_FS is not set # CONFIG_ADFS_FS_RW is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_BFS_FS is not set +# CONFIG_EXT3_FS is not set +# CONFIG_JBD is not set +# CONFIG_JBD_DEBUG is not set # CONFIG_FAT_FS is not set # CONFIG_MSDOS_FS is not set # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set # CONFIG_JFFS_FS is not set +# CONFIG_JFFS2_FS is not set # CONFIG_CRAMFS is not set +CONFIG_TMPFS=y # CONFIG_RAMFS is not set -# CONFIG_ISO9660_FS is not set -# CONFIG_JOLIET is not set +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +# CONFIG_ZISOFS is not set # CONFIG_MINIX_FS is not set +# CONFIG_VXFS_FS is not set # CONFIG_NTFS_FS is not set # CONFIG_NTFS_RW is not set # CONFIG_HPFS_FS is not set @@ -153,13 +196,12 @@ # CONFIG_DEVFS_FS is not set # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set -# CONFIG_DEVPTS_FS is not set +CONFIG_DEVPTS_FS=y # CONFIG_QNX4FS_FS is not set # CONFIG_QNX4FS_RW is not set # CONFIG_ROMFS_FS is not set CONFIG_EXT2_FS=y # CONFIG_SYSV_FS is not set -# CONFIG_SYSV_FS_WRITE is not set # CONFIG_UDF_FS is not set # CONFIG_UDF_RW is not set # CONFIG_UFS_FS is not set @@ -169,6 +211,7 @@ # Network File Systems # # CONFIG_CODA_FS is not set +# CONFIG_INTERMEZZO_FS is not set CONFIG_NFS_FS=y # CONFIG_NFS_V3 is not set CONFIG_ROOT_NFS=y @@ -186,6 +229,8 @@ # CONFIG_NCPFS_SMALLDOS is not set # CONFIG_NCPFS_NLS is not set # CONFIG_NCPFS_EXTRAS is not set +# CONFIG_ZISOFS_FS is not set +# CONFIG_ZLIB_FS_INFLATE is not set # # Partition Types @@ -198,13 +243,56 @@ # CONFIG_MAC_PARTITION is not set CONFIG_MSDOS_PARTITION=y # CONFIG_BSD_DISKLABEL is not set +# CONFIG_MINIX_SUBPARTITION is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set +# CONFIG_LDM_PARTITION is not set # CONFIG_SGI_PARTITION is not set CONFIG_ULTRIX_PARTITION=y # CONFIG_SUN_PARTITION is not set # CONFIG_SMB_NLS is not set -# CONFIG_NLS is not set +CONFIG_NLS=y + +# +# Native Language Support +# +CONFIG_NLS_DEFAULT="iso8859-1" +# CONFIG_NLS_CODEPAGE_437 is not set +# CONFIG_NLS_CODEPAGE_737 is not set +# CONFIG_NLS_CODEPAGE_775 is not set +# CONFIG_NLS_CODEPAGE_850 is not set +# CONFIG_NLS_CODEPAGE_852 is not set +# CONFIG_NLS_CODEPAGE_855 is not set +# CONFIG_NLS_CODEPAGE_857 is not set +# CONFIG_NLS_CODEPAGE_860 is not set +# CONFIG_NLS_CODEPAGE_861 is not set +# CONFIG_NLS_CODEPAGE_862 is not set +# CONFIG_NLS_CODEPAGE_863 is not set +# CONFIG_NLS_CODEPAGE_864 is not set +# CONFIG_NLS_CODEPAGE_865 is not set +# CONFIG_NLS_CODEPAGE_866 is not set +# CONFIG_NLS_CODEPAGE_869 is not set +# CONFIG_NLS_CODEPAGE_936 is not set +# CONFIG_NLS_CODEPAGE_950 is not set +# CONFIG_NLS_CODEPAGE_932 is not set +# CONFIG_NLS_CODEPAGE_949 is not set +# CONFIG_NLS_CODEPAGE_874 is not set +# CONFIG_NLS_ISO8859_8 is not set +# CONFIG_NLS_CODEPAGE_1251 is not set +# CONFIG_NLS_ISO8859_1 is not set +# CONFIG_NLS_ISO8859_2 is not set +# CONFIG_NLS_ISO8859_3 is not set +# CONFIG_NLS_ISO8859_4 is not set +# CONFIG_NLS_ISO8859_5 is not set +# CONFIG_NLS_ISO8859_6 is not set +# CONFIG_NLS_ISO8859_7 is not set +# CONFIG_NLS_ISO8859_9 is not set +# CONFIG_NLS_ISO8859_13 is not set +# CONFIG_NLS_ISO8859_14 is not set +# CONFIG_NLS_ISO8859_15 is not set +# CONFIG_NLS_KOI8_R is not set +# CONFIG_NLS_KOI8_U is not set +# CONFIG_NLS_UTF8 is not set # # VAX Character devices @@ -219,8 +307,7 @@ # # Kernel hacking -# This appears to be missing bits... -#CONFIG_DEBUG_MALLOC=n +# CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:54
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/input In directory usw-pr-cvs1:/tmp/cvs-serv22828/Documentation/input Log Message: Directory /cvsroot/linux-vax/kernel-2.4/Documentation/input added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:51
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi
In directory usw-pr-cvs1:/tmp/cvs-serv12544/acorn/scsi
Modified Files:
acornscsi.c acornscsi.h arxescsi.c cumana_1.c cumana_2.c
ecoscsi.c eesox.c fas216.c msgqueue.c oak.c powertec.c queue.c
Removed Files:
cumana_1.h cumana_2.h ecoscsi.h eesox.h oak.h powertec.h
Log Message:
synch 2.4.15 commit 16
Index: acornscsi.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/acornscsi.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- acornscsi.c 14 Jan 2001 18:58:50 -0000 1.1.1.1
+++ acornscsi.c 9 Apr 2002 14:00:57 -0000 1.2
@@ -144,6 +144,7 @@
#include <linux/ioport.h>
#include <linux/blk.h>
#include <linux/delay.h>
+#include <linux/init.h>
#include <asm/bitops.h>
#include <asm/system.h>
@@ -157,6 +158,8 @@
#include "acornscsi.h"
#include "msgqueue.h"
+#include <scsi/scsicam.h>
+
#define VER_MAJOR 2
#define VER_MINOR 0
#define VER_PATCH 6
@@ -206,24 +209,24 @@
static inline void
sbic_arm_write(unsigned int io_port, int reg, int value)
{
- outb_t(reg, io_port);
- outb_t(value, io_port + 4);
+ __raw_writeb(reg, io_port);
+ __raw_writeb(value, io_port + 4);
}
#define sbic_arm_writenext(io,val) \
- outb_t((val), (io) + 4)
+ __raw_writeb((val), (io) + 4)
static inline
int sbic_arm_read(unsigned int io_port, int reg)
{
if(reg == ASR)
- return inl_t(io_port) & 255;
- outb_t(reg, io_port);
- return inl_t(io_port + 4) & 255;
+ return __raw_readl(io_port) & 255;
+ __raw_writeb(reg, io_port);
+ return __raw_readl(io_port + 4) & 255;
}
#define sbic_arm_readnext(io) \
- inb_t((io) + 4)
+ __raw_readb((io) + 4)
#ifdef USE_DMAC
#define dmac_read(io_port,reg) \
@@ -1056,7 +1059,7 @@
/*
* Allocate some buffer space, limited to half the buffer size
*/
- length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
+ length = min_t(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
if (length) {
host->dma.start_addr = address = host->dma.free_addr;
host->dma.free_addr = (host->dma.free_addr + length) &
@@ -1184,7 +1187,7 @@
/*
* Allocate some buffer space, limited to half the on-board RAM size
*/
- length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
+ length = min_t(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
if (length) {
host->dma.start_addr = address = host->dma.free_addr;
host->dma.free_addr = (host->dma.free_addr + length) &
@@ -1248,7 +1251,7 @@
/*
* Function: void acornscsi_dma_adjust(AS_Host *host)
- * Purpose : adjust DMA pointers & count for bytes transfered to
+ * Purpose : adjust DMA pointers & count for bytes transferred to
* SBIC but not SCSI bus.
* Params : host - host to adjust DMA count for
*/
@@ -1653,8 +1656,8 @@
* to be in operation AFTER the target leaves message out phase.
*/
acornscsi_sbic_issuecmd(host, CMND_ASSERTATN);
- period = max(message[3], sdtr_period / 4);
- length = min(message[4], sdtr_size);
+ period = max_t(unsigned int, message[3], sdtr_period / 4);
+ length = min_t(unsigned int, message[4], sdtr_size);
msgqueue_addmsg(&host->scsi.msgs, 5, EXTENDED_MESSAGE, 3,
EXTENDED_SDTR, period, length);
host->device[host->SCpnt->target].sync_xfer =
@@ -2858,7 +2861,7 @@
* Params : host - host to setup
*/
static
-void acornscsi_init(AS_Host *host)
+void acornscsi_host_init(AS_Host *host)
{
memset(&host->stats, 0, sizeof (host->stats));
queue_initialise(&host->queues.issue);
@@ -2926,7 +2929,7 @@
host->scsi.irq = NO_IRQ;
}
- acornscsi_init(host);
+ acornscsi_host_init(host);
++count;
}
@@ -3118,9 +3121,45 @@
return pos;
}
-#ifdef MODULE
+static Scsi_Host_Template acornscsi_template = {
+ module: THIS_MODULE,
+ proc_info: acornscsi_proc_info,
+ name: "AcornSCSI",
+ detect: acornscsi_detect,
+ release: acornscsi_release,
+ info: acornscsi_info,
+ queuecommand: acornscsi_queuecmd,
+ abort: acornscsi_abort,
+ reset: acornscsi_reset,
+ bios_param: scsicam_bios_param,
+ can_queue: 16,
+ this_id: 7,
+ sg_tablesize: SG_ALL,
+ cmd_per_lun: 2,
+ unchecked_isa_dma: 0,
+ use_clustering: DISABLE_CLUSTERING
+};
-Scsi_Host_Template driver_template = ACORNSCSI_3;
+static int __init acornscsi_init(void)
+{
+ acornscsi_template.module = THIS_MODULE;
+ scsi_register_module(MODULE_SCSI_HA, &acornscsi_template);
+ if (acornscsi_template.present)
+ return 0;
-#include "../../scsi/scsi_module.c"
-#endif
+ scsi_unregister_module(MODULE_SCSI_HA, &acornscsi_template);
+ return -ENODEV;
+}
+
+static void __exit acornscsi_exit(void)
+{
+ scsi_unregister_module(MODULE_SCSI_HA, &acornscsi_template);
+}
+
+module_init(acornscsi_init);
+module_exit(acornscsi_exit);
+
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("AcornSCSI driver");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: acornscsi.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/acornscsi.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- acornscsi.h 14 Jan 2001 18:58:52 -0000 1.1.1.1
+++ acornscsi.h 9 Apr 2002 14:00:58 -0000 1.2
@@ -12,52 +12,6 @@
#ifndef ACORNSCSI_H
#define ACORNSCSI_H
-#ifndef ASM
-extern int acornscsi_detect (Scsi_Host_Template *);
-extern int acornscsi_release (struct Scsi_Host *);
-extern const char *acornscsi_info (struct Scsi_Host *);
-extern int acornscsi_queuecmd (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
-extern int acornscsi_abort (Scsi_Cmnd *);
-extern int acornscsi_reset (Scsi_Cmnd *, unsigned int);
-extern int acornscsi_proc_info (char *, char **, off_t, int, int, int);
-extern int acornscsi_biosparam (Disk *, kdev_t, int []);
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef CMD_PER_LUN
-#define CMD_PER_LUN 2
-#endif
-
-#ifndef CAN_QUEUE
-#define CAN_QUEUE 16
-#endif
-
-#include "linux/proc_fs.h"
-
-#include <scsi/scsicam.h>
-
-#define ACORNSCSI_3 { \
-proc_info: acornscsi_proc_info, \
-name: "AcornSCSI", \
-detect: acornscsi_detect, \
-release: acornscsi_release, /* Release */ \
-info: acornscsi_info, \
-queuecommand: acornscsi_queuecmd, \
-abort: acornscsi_abort, \
-reset: acornscsi_reset, \
-bios_param: scsicam_bios_param, \
-can_queue: CAN_QUEUE, /* can_queue */ \
-this_id: 7, /* this id */ \
-sg_tablesize: SG_ALL, /* sg_tablesize */ \
-cmd_per_lun: CMD_PER_LUN, /* cmd_per_lun */ \
-unchecked_isa_dma: 0, /* unchecked isa dma */ \
-use_clustering: DISABLE_CLUSTERING \
- }
-
-#ifndef HOSTS_C
-
/* SBIC registers */
#define OWNID 0
#define OWNID_FS1 (1<<7)
@@ -229,9 +183,6 @@
#define MASK_ON (MASKREG_M3|MASKREG_M2|MASKREG_M1|MASKREG_M0)
#define MASK_OFF (MASKREG_M3|MASKREG_M2|MASKREG_M1)
-#define min(x,y) ((x) < (y) ? (x) : (y))
-#define max(x,y) ((x) < (y) ? (y) : (x))
-
/*
* SCSI driver phases
*/
@@ -405,7 +356,4 @@
struct status_entry status[9][STATUS_BUFFER_SIZE];
} AS_Host;
-#endif /* ndef HOSTS_C */
-
-#endif /* ndef ASM */
#endif /* ACORNSCSI_H */
Index: arxescsi.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/arxescsi.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- arxescsi.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ arxescsi.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -439,3 +439,7 @@
module_init(init_arxe_scsi_driver);
module_exit(exit_arxe_scsi_driver);
+MODULE_AUTHOR("Stefan Hanske");
+MODULE_DESCRIPTION("ARXESCSI driver for Acorn machines");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: cumana_1.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/cumana_1.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- cumana_1.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ cumana_1.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -34,8 +34,8 @@
/*
* $Log$
- * Revision 1.1.1.2 2001/02/25 23:15:12 kenn
- * Import official 2.4.2 Linus tree
+ * Revision 1.2 2002/04/09 14:00:58 atp
+ * synch 2.4.15 commit 16
*
* Revision 1.3 1998/05/03 20:45:32 alan
* ARM SCSI update. This adds the eesox driver and massively updates the
@@ -427,3 +427,6 @@
module_init(cumanascsi_init);
module_exit(cumanascsi_exit);
+
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: cumana_2.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/cumana_2.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- cumana_2.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ cumana_2.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -82,15 +82,10 @@
static struct expansion_card *ecs[MAX_ECARDS];
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("Cumana SCSI II driver");
-MODULE_PARM(term, "1-8i");
-MODULE_PARM_DESC(term, "SCSI bus termination");
-
/*
* Use term=0,1,0,0,0 to turn terminators on/off
*/
-int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+static int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
#define NR_SG 256
@@ -200,6 +195,7 @@
memcpy(info->sg + 1, SCp->buffer + 1,
sizeof(struct scatterlist) * bufs);
info->sg[0].address = SCp->ptr;
+ info->sg[0].page = NULL;
info->sg[0].length = SCp->this_residual;
if (direction == DMA_OUT)
@@ -599,3 +595,10 @@
module_init(cumanascsi2_init);
module_exit(cumanascsi2_exit);
+
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines");
+MODULE_PARM(term, "1-8i");
+MODULE_PARM_DESC(term, "SCSI bus termination");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: ecoscsi.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/ecoscsi.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- ecoscsi.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ ecoscsi.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -33,8 +33,8 @@
/*
* $Log$
- * Revision 1.1.1.2 2001/02/25 23:15:12 kenn
- * Import official 2.4.2 Linus tree
+ * Revision 1.2 2002/04/09 14:00:58 atp
+ * synch 2.4.15 commit 16
*
* Revision 1.2 1998/03/08 05:49:47 davem
* Merge to 2.1.89
@@ -235,7 +235,6 @@
#endif
#undef STAT
-#ifndef HOSTS_C
#define NCR5380_implementation_fields \
int port, ctrl
@@ -295,3 +294,8 @@
module_init(ecoscsi_init);
module_exit(ecoscsi_exit);
+
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("Econet-SCSI driver for Acorn machines");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: eesox.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/eesox.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- eesox.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ eesox.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -80,15 +80,10 @@
static struct expansion_card *ecs[MAX_ECARDS];
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("EESOX SCSI driver");
-MODULE_PARM(term, "1-8i");
-MODULE_PARM_DESC(term, "SCSI bus termination");
-
/*
* Use term=0,1,0,0,0 to turn terminators on/off
*/
-int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+static int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
#define NR_SG 256
@@ -204,7 +199,8 @@
memcpy(info->sg + 1, SCp->buffer + 1,
sizeof(struct scatterlist) * bufs);
info->sg[0].address = SCp->ptr;
- info->sg[0].length = SCp->this_residual;
+ info->sg[0].page = NULL;
+ info->sg[0].length = SCp->this_residual;
if (direction == DMA_OUT)
pci_dir = PCI_DMA_TODEVICE,
@@ -602,3 +598,9 @@
module_init(eesox_init);
module_exit(eesox_exit);
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines");
+MODULE_PARM(term, "1-8i");
+MODULE_PARM_DESC(term, "SCSI bus termination");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: fas216.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/fas216.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- fas216.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ fas216.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -60,9 +60,6 @@
#include "../../scsi/hosts.h"
#include "fas216.h"
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("Generic FAS216/NCR53C9x driver");
-
#define VER_MAJOR 0
#define VER_MINOR 0
#define VER_PATCH 5
@@ -2767,13 +2764,6 @@
EXPORT_SYMBOL(fas216_print_stats);
EXPORT_SYMBOL(fas216_print_device);
-#ifdef MODULE
-int __init init_module(void)
-{
- return 0;
-}
-
-void __exit cleanup_module(void)
-{
-}
-#endif
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("Generic FAS216/NCR53C9x driver core");
+MODULE_LICENSE("GPL");
Index: msgqueue.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/msgqueue.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- msgqueue.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ msgqueue.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -16,9 +16,6 @@
#include "msgqueue.h"
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("SCSI message queue handling");
-
/*
* Function: struct msgqueue_entry *mqe_alloc(MsgQueue_t *msgq)
* Purpose : Allocate a message queue entry
@@ -169,13 +166,6 @@
EXPORT_SYMBOL(msgqueue_addmsg);
EXPORT_SYMBOL(msgqueue_flush);
-#ifdef MODULE
-int __init init_module(void)
-{
- return 0;
-}
-
-void __exit cleanup_module(void)
-{
-}
-#endif
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("SCSI message queue handling");
+MODULE_LICENSE("GPL");
Index: oak.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/oak.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- oak.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ oak.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -33,8 +33,8 @@
/*
* $Log$
- * Revision 1.1.1.2 2001/02/25 23:15:12 kenn
- * Import official 2.4.2 Linus tree
+ * Revision 1.2 2002/04/09 14:00:58 atp
+ * synch 2.4.15 commit 16
*
* Revision 1.3 1998/05/03 20:45:37 alan
* ARM SCSI update. This adds the eesox driver and massively updates the
@@ -288,3 +288,8 @@
module_init(oakscsi_init);
module_exit(oakscsi_exit);
+
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("Oak SCSI driver");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: powertec.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/powertec.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- powertec.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ powertec.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -77,17 +77,12 @@
#define VER_MINOR 0
#define VER_PATCH 5
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("Powertec SCSI driver");
-MODULE_PARM(term, "1-8i");
-MODULE_PARM_DESC(term, "SCSI bus termination");
-
static struct expansion_card *ecs[MAX_ECARDS];
/*
* Use term=0,1,0,0,0 to turn terminators on/off
*/
-int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
+static int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
#define NR_SG 256
@@ -192,7 +187,8 @@
memcpy(info->sg + 1, SCp->buffer + 1,
sizeof(struct scatterlist) * bufs);
info->sg[0].address = SCp->ptr;
- info->sg[0].length = SCp->this_residual;
+ info->sg[0].page = NULL;
+ info->sg[0].length = SCp->this_residual;
if (direction == DMA_OUT)
pci_dir = PCI_DMA_TODEVICE,
@@ -501,3 +497,10 @@
module_init(powertecscsi_init);
module_exit(powertecscsi_exit);
+
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("Powertec SCSI driver");
+MODULE_PARM(term, "1-8i");
+MODULE_PARM_DESC(term, "SCSI bus termination");
+MODULE_LICENSE("GPL");
+EXPORT_NO_SYMBOLS;
Index: queue.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/scsi/queue.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- queue.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ queue.c 9 Apr 2002 14:00:58 -0000 1.2
@@ -25,9 +25,6 @@
#include "../../scsi/scsi.h"
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("SCSI command queueing");
-
#define DEBUG
typedef struct queue_entry {
@@ -295,13 +292,6 @@
EXPORT_SYMBOL(queue_remove_cmd);
EXPORT_SYMBOL(queue_probetgtlun);
-#ifdef MODULE
-int __init init_module (void)
-{
- return 0;
-}
-
-void __exit cleanup_module (void)
-{
-}
-#endif
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("SCSI command queueing");
+MODULE_LICENSE("GPL");
--- cumana_1.h DELETED ---
--- cumana_2.h DELETED ---
--- ecoscsi.h DELETED ---
--- eesox.h DELETED ---
--- oak.h DELETED ---
--- powertec.h DELETED ---
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:51
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/romfs
In directory usw-pr-cvs1:/tmp/cvs-serv32005/romfs
Modified Files:
inode.c
Log Message:
synch 2.4.15 commit 14
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/romfs/inode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- inode.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ inode.c 9 Apr 2002 13:30:19 -0000 1.2
@@ -76,11 +76,6 @@
#include <asm/uaccess.h>
-static int inline min(int a, int b)
-{
- return a<b ? a : b;
-}
-
static __s32
romfs_checksum(void *data, int size)
{
@@ -110,6 +105,9 @@
set_blocksize(dev, ROMBSIZE);
s->s_blocksize = ROMBSIZE;
s->s_blocksize_bits = ROMBSBITS;
+ s->u.generic_sbp = (void *) 0;
+ s->s_maxbytes = 0xFFFFFFFF;
+
bh = bread(dev, 0, ROMBSIZE);
if (!bh) {
/* XXX merge with other printk? */
@@ -126,7 +124,7 @@
"%s.\n", kdevname(dev));
goto out;
}
- if (romfs_checksum(rsb, min(sz,512))) {
+ if (romfs_checksum(rsb, min_t(int, sz, 512))) {
printk ("romfs: bad initial checksum on dev "
"%s.\n", kdevname(dev));
goto out;
@@ -195,7 +193,7 @@
return -1; /* error */
avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(count, avail);
+ maxsize = min_t(unsigned long, count, avail);
res = strnlen(((char *)bh->b_data)+(offset&ROMBMASK), maxsize);
brelse(bh);
@@ -208,7 +206,7 @@
bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
if (!bh)
return -1;
- maxsize = min(count-res, ROMBSIZE);
+ maxsize = min_t(unsigned long, count - res, ROMBSIZE);
avail = strnlen(bh->b_data, maxsize);
res += avail;
brelse(bh);
@@ -233,7 +231,7 @@
return -1; /* error */
avail = ROMBSIZE - (offset & ROMBMASK);
- maxsize = min(count, avail);
+ maxsize = min_t(unsigned long, count, avail);
memcpy(dest, ((char *)bh->b_data) + (offset & ROMBMASK), maxsize);
brelse(bh);
@@ -246,7 +244,7 @@
bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
if (!bh)
return -1;
- maxsize = min(count-res, ROMBSIZE);
+ maxsize = min_t(unsigned long, count - res, ROMBSIZE);
memcpy(dest, bh->b_data, maxsize);
brelse(bh);
res += maxsize;
@@ -400,15 +398,17 @@
void *buf;
int result = -EIO;
+ page_cache_get(page);
lock_kernel();
- get_page(page);
- buf = page_address(page);
+ buf = kmap(page);
+ if (!buf)
+ goto err_out;
/* 32 bit warning -- but not for us :) */
offset = page->index << PAGE_CACHE_SHIFT;
if (offset < inode->i_size) {
avail = inode->i_size-offset;
- readlen = min(avail, PAGE_SIZE);
+ readlen = min_t(unsigned long, avail, PAGE_SIZE);
if (romfs_copyfrom(inode, buf, inode->u.romfs_i.i_dataoffset+offset, readlen) == readlen) {
if (readlen < PAGE_SIZE) {
memset(buf + readlen,0,PAGE_SIZE-readlen);
@@ -425,7 +425,9 @@
UnlockPage(page);
- __free_page(page);
+ kunmap(page);
+err_out:
+ page_cache_release(page);
unlock_kernel();
return result;
@@ -546,3 +548,4 @@
module_init(init_romfs_fs)
module_exit(exit_romfs_fs)
+MODULE_LICENSE("GPL");
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:44
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/qnx4
In directory usw-pr-cvs1:/tmp/cvs-serv29245/qnx4
Modified Files:
README file.c inode.c
Log Message:
synch 2.4.15 commit 13
Index: README
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/qnx4/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- README 14 Jan 2001 16:30:13 -0000 1.1.1.1
+++ README 9 Apr 2002 13:19:37 -0000 1.2
@@ -5,5 +5,5 @@
Credits :
Richard "Scuba" A. Frowijn <sc...@wx...>
-Frank "Jedi/Sector One" Denis <j...@4u...>
+Frank "Jedi/Sector One" Denis <j...@pu...>
Anders Larsen <al...@al...> (Maintainer)
Index: file.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/qnx4/file.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- file.c 14 Jan 2001 16:30:14 -0000 1.1.1.1
+++ file.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -24,6 +24,7 @@
*/
struct file_operations qnx4_file_operations =
{
+ llseek: generic_file_llseek,
read: generic_file_read,
#ifdef CONFIG_QNX4FS_RW
write: generic_file_write,
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/qnx4/inode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- inode.c 25 Feb 2001 23:14:47 -0000 1.1.1.2
+++ inode.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -396,7 +396,6 @@
goto outi;
brelse(bh);
- s->s_dirt = 1;
return s;
@@ -512,3 +511,5 @@
module_init(init_qnx4_fs)
module_exit(exit_qnx4_fs)
+MODULE_LICENSE("GPL");
+
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:43
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/proc
In directory usw-pr-cvs1:/tmp/cvs-serv29245/proc
Modified Files:
Makefile array.c base.c generic.c inode.c kcore.c kmsg.c
proc_misc.c root.c
Removed Files:
procfs_syms.c
Log Message:
synch 2.4.15 commit 13
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- Makefile 14 Jan 2001 16:25:47 -0000 1.1.1.1
+++ Makefile 9 Apr 2002 13:19:36 -0000 1.2
@@ -9,10 +9,10 @@
O_TARGET := proc.o
-export-objs := procfs_syms.o
+export-objs := root.o
obj-y := inode.o root.o base.o generic.o array.o \
- kmsg.o proc_tty.o proc_misc.o kcore.o procfs_syms.o
+ kmsg.o proc_tty.o proc_misc.o kcore.o
ifeq ($(CONFIG_PROC_DEVICETREE),y)
obj-y += proc_devtree.o
Index: array.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/array.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- array.c 14 Jan 2001 16:25:56 -0000 1.1.1.1
+++ array.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -151,13 +151,14 @@
read_lock(&tasklist_lock);
buffer += sprintf(buffer,
"State:\t%s\n"
+ "Tgid:\t%d\n"
"Pid:\t%d\n"
"PPid:\t%d\n"
"TracerPid:\t%d\n"
"Uid:\t%d\t%d\t%d\t%d\n"
"Gid:\t%d\t%d\t%d\t%d\n",
- get_task_state(p),
- p->pid, p->p_opptr->pid, p->p_pptr->pid != p->p_opptr->pid ? p->p_pptr->pid : 0,
+ get_task_state(p), p->tgid,
+ p->pid, p->pid ? p->p_opptr->pid : 0, 0,
p->uid, p->euid, p->suid, p->fsuid,
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
@@ -181,7 +182,7 @@
unsigned long data = 0, stack = 0;
unsigned long exec = 0, lib = 0;
- down(&mm->mmap_sem);
+ down_read(&mm->mmap_sem);
for (vma = mm->mmap; vma; vma = vma->vm_next) {
unsigned long len = (vma->vm_end - vma->vm_start) >> 10;
if (!vma->vm_file) {
@@ -212,7 +213,7 @@
mm->rss << (PAGE_SHIFT-10),
data - stack, stack,
exec - lib, lib);
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
return buffer;
}
@@ -258,7 +259,7 @@
return buffer;
}
-extern inline char *task_cap(struct task_struct *p, char *buffer)
+static inline char *task_cap(struct task_struct *p, char *buffer)
{
return buffer + sprintf(buffer, "CapInh:\t%016x\n"
"CapPrm:\t%016x\n"
@@ -273,9 +274,6 @@
{
char * orig = buffer;
struct mm_struct *mm;
-#if defined(CONFIG_ARCH_S390)
- int line,len;
-#endif
buffer = task_name(task, buffer);
buffer = task_state(task, buffer);
@@ -291,8 +289,7 @@
buffer = task_sig(task, buffer);
buffer = task_cap(task, buffer);
#if defined(CONFIG_ARCH_S390)
- for(line=0;(len=sprintf_regs(line,buffer,task,NULL,NULL))!=0;line++)
- buffer+=len;
+ buffer = task_show_regs(task, buffer);
#endif
return buffer - orig;
}
@@ -321,7 +318,7 @@
task_unlock(task);
if (mm) {
struct vm_area_struct *vma;
- down(&mm->mmap_sem);
+ down_read(&mm->mmap_sem);
vma = mm->mmap;
while (vma) {
vsize += vma->vm_end - vma->vm_start;
@@ -329,7 +326,7 @@
}
eip = KSTK_EIP(task);
esp = KSTK_ESP(task);
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
}
wchan = get_wchan(task);
@@ -343,7 +340,7 @@
nice = task->nice;
read_lock(&tasklist_lock);
- ppid = task->p_opptr->pid;
+ ppid = task->pid ? task->p_opptr->pid : 0;
read_unlock(&tasklist_lock);
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
@@ -425,13 +422,12 @@
++*total;
if (!pte_present(page))
continue;
+ ptpage = pte_page(page);
+ if ((!VALID_PAGE(ptpage)) || PageReserved(ptpage))
+ continue;
++*pages;
if (pte_dirty(page))
++*dirty;
- ptpage = pte_page(page);
- if ((!VALID_PAGE(ptpage)) ||
- PageReserved(ptpage))
- continue;
if (page_count(pte_page(page)) > 1)
++*shared;
} while (address < end);
@@ -484,7 +480,7 @@
task_unlock(task);
if (mm) {
struct vm_area_struct * vma;
- down(&mm->mmap_sem);
+ down_read(&mm->mmap_sem);
vma = mm->mmap;
while (vma) {
pgd_t *pgd = pgd_offset(mm, vma->vm_start);
@@ -505,7 +501,7 @@
drs += pages;
vma = vma->vm_next;
}
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
mmput(mm);
}
return sprintf(buffer,"%d %d %d %d %d %d %d\n",
@@ -527,11 +523,8 @@
/*
* For the /proc/<pid>/maps file, we use fixed length records, each containing
* a single line.
- */
-#define MAPS_LINE_LENGTH 4096
-#define MAPS_LINE_SHIFT 12
-/*
- * f_pos = (number of the vma in the task->mm->mmap list) * MAPS_LINE_LENGTH
+ *
+ * f_pos = (number of the vma in the task->mm->mmap list) * PAGE_SIZE
* + (index into the line)
*/
/* for systems with sizeof(void*) == 4: */
@@ -542,138 +535,142 @@
#define MAPS_LINE_FORMAT8 "%016lx-%016lx %s %016lx %s %lu"
#define MAPS_LINE_MAX8 73 /* sum of 16 1 16 1 4 1 16 1 5 1 10 1 */
-#define MAPS_LINE_MAX MAPS_LINE_MAX8
+#define MAPS_LINE_FORMAT (sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8)
+#define MAPS_LINE_MAX (sizeof(void*) == 4 ? MAPS_LINE_MAX4 : MAPS_LINE_MAX8)
+static int proc_pid_maps_get_line (char *buf, struct vm_area_struct *map)
+{
+ /* produce the next line */
+ char *line;
+ char str[5];
+ int flags;
+ kdev_t dev;
+ unsigned long ino;
+ int len;
+
+ flags = map->vm_flags;
+
+ str[0] = flags & VM_READ ? 'r' : '-';
+ str[1] = flags & VM_WRITE ? 'w' : '-';
+ str[2] = flags & VM_EXEC ? 'x' : '-';
+ str[3] = flags & VM_MAYSHARE ? 's' : 'p';
+ str[4] = 0;
+
+ dev = 0;
+ ino = 0;
+ if (map->vm_file != NULL) {
+ dev = map->vm_file->f_dentry->d_inode->i_dev;
+ ino = map->vm_file->f_dentry->d_inode->i_ino;
+ line = d_path(map->vm_file->f_dentry,
+ map->vm_file->f_vfsmnt,
+ buf, PAGE_SIZE);
+ buf[PAGE_SIZE-1] = '\n';
+ line -= MAPS_LINE_MAX;
+ if(line < buf)
+ line = buf;
+ } else
+ line = buf;
+
+ len = sprintf(line,
+ MAPS_LINE_FORMAT,
+ map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
+ kdevname(dev), ino);
+
+ if(map->vm_file) {
+ int i;
+ for(i = len; i < MAPS_LINE_MAX; i++)
+ line[i] = ' ';
+ len = buf + PAGE_SIZE - line;
+ memmove(buf, line, len);
+ } else
+ line[len++] = '\n';
+ return len;
+}
ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char * buf,
size_t count, loff_t *ppos)
{
struct mm_struct *mm;
- struct vm_area_struct * map, * next;
- char * destptr = buf, * buffer;
- loff_t lineno;
- ssize_t column, i;
- int volatile_task;
+ struct vm_area_struct * map;
+ char *tmp, *kbuf;
long retval;
+ int off, lineno, loff;
+ /* reject calls with out of range parameters immediately */
+ retval = 0;
+ if (*ppos > LONG_MAX)
+ goto out;
+ if (count == 0)
+ goto out;
+ off = (long)*ppos;
/*
* We might sleep getting the page, so get it first.
*/
retval = -ENOMEM;
- buffer = (char*)__get_free_page(GFP_KERNEL);
- if (!buffer)
+ kbuf = (char*)__get_free_page(GFP_KERNEL);
+ if (!kbuf)
goto out;
- if (count == 0)
- goto getlen_out;
+ tmp = (char*)__get_free_page(GFP_KERNEL);
+ if (!tmp)
+ goto out_free1;
+
task_lock(task);
mm = task->mm;
if (mm)
atomic_inc(&mm->mm_users);
task_unlock(task);
+ retval = 0;
if (!mm)
- goto getlen_out;
-
- /* Check whether the mmaps could change if we sleep */
- volatile_task = (task != current || atomic_read(&mm->mm_users) > 2);
+ goto out_free2;
- /* decode f_pos */
- lineno = *ppos >> MAPS_LINE_SHIFT;
- column = *ppos & (MAPS_LINE_LENGTH-1);
-
- /* quickly go to line lineno */
- down(&mm->mmap_sem);
- for (map = mm->mmap, i = 0; map && (i < lineno); map = map->vm_next, i++)
- continue;
-
- for ( ; map ; map = next ) {
- /* produce the next line */
- char *line;
- char str[5], *cp = str;
- int flags;
- kdev_t dev;
- unsigned long ino;
- int maxlen = (sizeof(void*) == 4) ?
- MAPS_LINE_MAX4 : MAPS_LINE_MAX8;
+ down_read(&mm->mmap_sem);
+ map = mm->mmap;
+ lineno = 0;
+ loff = 0;
+ if (count > PAGE_SIZE)
+ count = PAGE_SIZE;
+ while (map) {
int len;
-
- /*
- * Get the next vma now (but it won't be used if we sleep).
- */
- next = map->vm_next;
- flags = map->vm_flags;
-
- *cp++ = flags & VM_READ ? 'r' : '-';
- *cp++ = flags & VM_WRITE ? 'w' : '-';
- *cp++ = flags & VM_EXEC ? 'x' : '-';
- *cp++ = flags & VM_MAYSHARE ? 's' : 'p';
- *cp++ = 0;
-
- dev = 0;
- ino = 0;
- if (map->vm_file != NULL) {
- dev = map->vm_file->f_dentry->d_inode->i_dev;
- ino = map->vm_file->f_dentry->d_inode->i_ino;
- line = d_path(map->vm_file->f_dentry,
- map->vm_file->f_vfsmnt,
- buffer, PAGE_SIZE);
- buffer[PAGE_SIZE-1] = '\n';
- line -= maxlen;
- if(line < buffer)
- line = buffer;
- } else
- line = buffer;
-
- len = sprintf(line,
- sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8,
- map->vm_start, map->vm_end, str, map->vm_pgoff << PAGE_SHIFT,
- kdevname(dev), ino);
-
- if(map->vm_file) {
- for(i = len; i < maxlen; i++)
- line[i] = ' ';
- len = buffer + PAGE_SIZE - line;
- } else
- line[len++] = '\n';
- if (column >= len) {
- column = 0; /* continue with next line at column 0 */
- lineno++;
- continue; /* we haven't slept */
+ if (off > PAGE_SIZE) {
+ off -= PAGE_SIZE;
+ goto next;
}
-
- i = len-column;
- if (i > count)
- i = count;
- up(&mm->mmap_sem);
- copy_to_user(destptr, line+column, i); /* may have slept */
- down(&mm->mmap_sem);
- destptr += i;
- count -= i;
- column += i;
- if (column >= len) {
- column = 0; /* next time: next line at column 0 */
- lineno++;
+ len = proc_pid_maps_get_line(tmp, map);
+ len -= off;
+ if (len > 0) {
+ if (retval+len > count) {
+ /* only partial line transfer possible */
+ len = count - retval;
+ /* save the offset where the next read
+ * must start */
+ loff = len+off;
+ }
+ memcpy(kbuf+retval, tmp+off, len);
+ retval += len;
}
-
- /* done? */
- if (count == 0)
- break;
-
- /* By writing to user space, we might have slept.
- * Stop the loop, to avoid a race condition.
- */
- if (volatile_task)
+ off = 0;
+next:
+ if (!loff)
+ lineno++;
+ if (retval >= count)
break;
+ if (loff) BUG();
+ map = map->vm_next;
}
- up(&mm->mmap_sem);
-
- /* encode f_pos */
- *ppos = (lineno << MAPS_LINE_SHIFT) + column;
+ up_read(&mm->mmap_sem);
mmput(mm);
-getlen_out:
- retval = destptr - buf;
- free_page((unsigned long)buffer);
+ if (retval > count) BUG();
+ if (copy_to_user(buf, kbuf, retval))
+ retval = -EFAULT;
+ else
+ *ppos = (lineno << PAGE_SHIFT) + loff;
+
+out_free2:
+ free_page((unsigned long)tmp);
+out_free1:
+ free_page((unsigned long)kbuf);
out:
return retval;
}
Index: base.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/base.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- base.c 14 Jan 2001 16:25:51 -0000 1.1.1.1
+++ base.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -64,7 +64,7 @@
task_unlock(task);
if (!mm)
goto out;
- down(&mm->mmap_sem);
+ down_read(&mm->mmap_sem);
vma = mm->mmap;
while (vma) {
if ((vma->vm_flags & VM_EXECUTABLE) &&
@@ -76,7 +76,7 @@
}
vma = vma->vm_next;
}
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
mmput(mm);
out:
return result;
@@ -184,29 +184,6 @@
/* permission checks */
-static int standard_permission(struct inode *inode, int mask)
-{
- int mode = inode->i_mode;
-
- if ((mask & S_IWOTH) && IS_RDONLY(inode) &&
- (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
- return -EROFS; /* Nobody gets write access to a read-only fs */
- else if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
- return -EACCES; /* Nobody gets write access to an immutable file */
- else if (current->fsuid == inode->i_uid)
- mode >>= 6;
- else if (in_group_p(inode->i_gid))
- mode >>= 3;
- if (((mode & mask & S_IRWXO) == mask) || capable(CAP_DAC_OVERRIDE))
- return 0;
- /* read and search access */
- if ((mask == S_IROTH) ||
- (S_ISDIR(mode) && !(mask & ~(S_IROTH | S_IXOTH))))
- if (capable(CAP_DAC_READ_SEARCH))
- return 0;
- return -EACCES;
-}
-
static int proc_check_root(struct inode *inode)
{
struct dentry *de, *base, *root;
@@ -249,7 +226,7 @@
static int proc_permission(struct inode *inode, int mask)
{
- if (standard_permission(inode, mask) != 0)
+ if (vfs_permission(inode, mask) != 0)
return -EACCES;
return proc_check_root(inode);
}
@@ -312,6 +289,13 @@
#define MAY_PTRACE(p) \
(p==current||(p->p_pptr==current&&(p->ptrace & PT_PTRACED)&&p->state==TASK_STOPPED))
+
+static int mem_open(struct inode* inode, struct file* file)
+{
+ file->private_data = (void*)((long)current->self_exec_id);
+ return 0;
+}
+
static ssize_t mem_read(struct file * file, char * buf,
size_t count, loff_t *ppos)
{
@@ -319,6 +303,8 @@
char *page;
unsigned long src = *ppos;
int copied = 0;
+ struct mm_struct *mm;
+
if (!MAY_PTRACE(task))
return -ESRCH;
@@ -327,6 +313,20 @@
if (!page)
return -ENOMEM;
+ task_lock(task);
+ mm = task->mm;
+ if (mm)
+ atomic_inc(&mm->mm_users);
+ task_unlock(task);
+ if (!mm)
+ return 0;
+
+ if (file->private_data != (void*)((long)current->self_exec_id) ) {
+ mmput(mm);
+ return -EIO;
+ }
+
+
while (count > 0) {
int this_len, retval;
@@ -347,6 +347,7 @@
count -= retval;
}
*ppos = src;
+ mmput(mm);
free_page((unsigned long) page);
return copied;
}
@@ -398,6 +399,7 @@
static struct file_operations proc_mem_operations = {
read: mem_read,
write: mem_write,
+ open: mem_open,
};
static struct inode_operations proc_mem_inode_operations = {
@@ -586,7 +588,7 @@
struct pid_entry *p;
pid = inode->u.proc_i.task->pid;
- if (!inode->u.proc_i.task->p_pptr)
+ if (!pid)
return -ENOENT;
i = filp->f_pos;
switch (i) {
@@ -620,6 +622,20 @@
/* building an inode */
+static int task_dumpable(struct task_struct *task)
+{
+ int dumpable = 0;
+ struct mm_struct *mm;
+
+ task_lock(task);
+ mm = task->mm;
+ if (mm)
+ dumpable = mm->dumpable;
+ task_unlock(task);
+ return dumpable;
+}
+
+
static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task, int ino)
{
struct inode * inode;
@@ -635,18 +651,17 @@
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_ino = fake_ino(task->pid, ino);
- inode->u.proc_i.file = NULL;
+ if (!task->pid)
+ goto out_unlock;
+
/*
* grab the reference to task.
*/
- inode->u.proc_i.task = task;
get_task_struct(task);
- if (!task->p_pptr)
- goto out_unlock;
-
+ inode->u.proc_i.task = task;
inode->i_uid = 0;
inode->i_gid = 0;
- if (ino == PROC_PID_INO || task->dumpable) {
+ if (ino == PROC_PID_INO || task_dumpable(task)) {
inode->i_uid = task->euid;
inode->i_gid = task->egid;
}
@@ -673,7 +688,7 @@
*/
static int pid_base_revalidate(struct dentry * dentry, int flags)
{
- if (dentry->d_inode->u.proc_i.task->p_pptr)
+ if (dentry->d_inode->u.proc_i.task->pid)
return 1;
d_drop(dentry);
return 0;
Index: generic.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/generic.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- generic.c 14 Jan 2001 16:26:00 -0000 1.1.1.1
+++ generic.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -190,15 +190,24 @@
return 0;
}
-static unsigned char proc_alloc_map[PROC_NDYNAMIC / 8];
+static unsigned long proc_alloc_map[(PROC_NDYNAMIC + BITS_PER_LONG - 1) / BITS_PER_LONG];
+
+spinlock_t proc_alloc_map_lock = SPIN_LOCK_UNLOCKED;
static int make_inode_number(void)
{
- int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC);
- if (i<0 || i>=PROC_NDYNAMIC)
- return -1;
- set_bit(i, (void *) proc_alloc_map);
- return PROC_DYNAMIC_FIRST + i;
+ int i;
+ spin_lock(&proc_alloc_map_lock);
+ i = find_first_zero_bit(proc_alloc_map, PROC_NDYNAMIC);
+ if (i < 0 || i >= PROC_NDYNAMIC) {
+ i = -1;
+ goto out;
+ }
+ set_bit(i, proc_alloc_map);
+ i += PROC_DYNAMIC_FIRST;
+out:
+ spin_unlock(&proc_alloc_map_lock);
+ return i;
}
static int proc_readlink(struct dentry *dentry, char *buffer, int buflen)
@@ -388,149 +397,126 @@
file_list_lock();
for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
struct file * filp = list_entry(p, struct file, f_list);
- struct dentry * dentry;
+ struct dentry * dentry = filp->f_dentry;
struct inode * inode;
+ struct file_operations *fops;
- dentry = filp->f_dentry;
- if (!dentry)
- continue;
if (dentry->d_op != &proc_dentry_operations)
continue;
inode = dentry->d_inode;
if (inode->u.generic_ip != de)
continue;
- fops_put(filp->f_op);
+ fops = filp->f_op;
filp->f_op = NULL;
+ fops_put(fops);
}
file_list_unlock();
}
-struct proc_dir_entry *proc_symlink(const char *name,
- struct proc_dir_entry *parent, const char *dest)
+static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
+ const char *name,
+ mode_t mode,
+ nlink_t nlink)
{
struct proc_dir_entry *ent = NULL;
const char *fn = name;
int len;
- if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
+ /* make sure name is valid */
+ if (!name || !strlen(name)) goto out;
+
+ if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0)
goto out;
len = strlen(fn);
ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
- if (!ent)
- goto out;
+ if (!ent) goto out;
+
memset(ent, 0, sizeof(struct proc_dir_entry));
- memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
+ memcpy(((char *) ent) + sizeof(struct proc_dir_entry), fn, len + 1);
ent->name = ((char *) ent) + sizeof(*ent);
ent->namelen = len;
- ent->nlink = 1;
- ent->mode = S_IFLNK|S_IRUGO|S_IWUGO|S_IXUGO;
- ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
- if (!ent->data) {
- kfree(ent);
- goto out;
- }
- strcpy((char*)ent->data,dest);
+ ent->mode = mode;
+ ent->nlink = nlink;
+ out:
+ return ent;
+}
- proc_register(parent, ent);
-
-out:
+struct proc_dir_entry *proc_symlink(const char *name,
+ struct proc_dir_entry *parent, const char *dest)
+{
+ struct proc_dir_entry *ent;
+
+ ent = proc_create(&parent,name,
+ (S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO),1);
+
+ if (ent) {
+ ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
+ if (ent->data) {
+ strcpy((char*)ent->data,dest);
+ proc_register(parent, ent);
+ } else {
+ kfree(ent);
+ ent = NULL;
+ }
+ }
return ent;
}
struct proc_dir_entry *proc_mknod(const char *name, mode_t mode,
struct proc_dir_entry *parent, kdev_t rdev)
{
- struct proc_dir_entry *ent = NULL;
- const char *fn = name;
- int len;
-
- if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
- goto out;
- len = strlen(fn);
-
- ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
- if (!ent)
- goto out;
- memset(ent, 0, sizeof(struct proc_dir_entry));
- memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
- ent->name = ((char *) ent) + sizeof(*ent);
- ent->namelen = len;
- ent->nlink = 1;
- ent->mode = mode;
- ent->rdev = rdev;
+ struct proc_dir_entry *ent;
- proc_register(parent, ent);
-
-out:
+ ent = proc_create(&parent,name,mode,1);
+ if (ent) {
+ ent->rdev = rdev;
+ proc_register(parent, ent);
+ }
return ent;
}
struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent)
{
- struct proc_dir_entry *ent = NULL;
- const char *fn = name;
- int len;
-
- if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
- goto out;
- len = strlen(fn);
+ struct proc_dir_entry *ent;
- ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
- if (!ent)
- goto out;
- memset(ent, 0, sizeof(struct proc_dir_entry));
- memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
- ent->name = ((char *) ent) + sizeof(*ent);
- ent->namelen = len;
- ent->proc_fops = &proc_dir_operations;
- ent->proc_iops = &proc_dir_inode_operations;
- ent->nlink = 2;
- ent->mode = S_IFDIR | S_IRUGO | S_IXUGO;
+ ent = proc_create(&parent,name,
+ (S_IFDIR | S_IRUGO | S_IXUGO),2);
+ if (ent) {
+ ent->proc_fops = &proc_dir_operations;
+ ent->proc_iops = &proc_dir_inode_operations;
- proc_register(parent, ent);
-
-out:
+ proc_register(parent, ent);
+ }
return ent;
}
struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
struct proc_dir_entry *parent)
{
- struct proc_dir_entry *ent = NULL;
- const char *fn = name;
- int len;
-
- if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
- goto out;
- len = strlen(fn);
-
- ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
- if (!ent)
- goto out;
- memset(ent, 0, sizeof(struct proc_dir_entry));
- memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
- ent->name = ((char *) ent) + sizeof(*ent);
- ent->namelen = len;
+ struct proc_dir_entry *ent;
+ nlink_t nlink;
if (S_ISDIR(mode)) {
if ((mode & S_IALLUGO) == 0)
- mode |= S_IRUGO | S_IXUGO;
- ent->proc_fops = &proc_dir_operations;
- ent->proc_iops = &proc_dir_inode_operations;
- ent->nlink = 2;
+ mode |= S_IRUGO | S_IXUGO;
+ nlink = 2;
} else {
if ((mode & S_IFMT) == 0)
mode |= S_IFREG;
if ((mode & S_IALLUGO) == 0)
mode |= S_IRUGO;
- ent->nlink = 1;
+ nlink = 1;
}
- ent->mode = mode;
- proc_register(parent, ent);
-
-out:
+ ent = proc_create(&parent,name,mode,nlink);
+ if (ent) {
+ if (S_ISDIR(mode)) {
+ ent->proc_fops = &proc_dir_operations;
+ ent->proc_iops = &proc_dir_inode_operations;
+ }
+ proc_register(parent, ent);
+ }
return ent;
}
@@ -568,8 +554,8 @@
de->next = NULL;
if (S_ISDIR(de->mode))
parent->nlink--;
- clear_bit(de->low_ino-PROC_DYNAMIC_FIRST,
- (void *) proc_alloc_map);
+ clear_bit(de->low_ino - PROC_DYNAMIC_FIRST,
+ proc_alloc_map);
proc_kill_inodes(de);
de->nlink = 0;
if (!atomic_read(&de->count))
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/inode.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- inode.c 14 Jan 2001 16:25:54 -0000 1.1.1.1
+++ inode.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -160,14 +160,12 @@
inode->i_nlink = de->nlink;
if (de->owner)
__MOD_INC_USE_COUNT(de->owner);
- if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode))
+ if (de->proc_iops)
+ inode->i_op = de->proc_iops;
+ if (de->proc_fops)
+ inode->i_fop = de->proc_fops;
+ else if (S_ISBLK(de->mode)||S_ISCHR(de->mode)||S_ISFIFO(de->mode))
init_special_inode(inode,de->mode,kdev_t_to_nr(de->rdev));
- else {
- if (de->proc_iops)
- inode->i_op = de->proc_iops;
- if (de->proc_fops)
- inode->i_fop = de->proc_fops;
- }
}
out:
@@ -188,6 +186,7 @@
s->s_blocksize_bits = 10;
s->s_magic = PROC_SUPER_MAGIC;
s->s_op = &proc_sops;
+
root_inode = proc_get_inode(s, PROC_ROOT_INO, &proc_root);
if (!root_inode)
goto out_no_root;
@@ -208,3 +207,4 @@
iput(root_inode);
return NULL;
}
+MODULE_LICENSE("GPL");
Index: kcore.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/kcore.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- kcore.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ kcore.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -42,7 +42,7 @@
ssize_t count1;
char * pnt;
struct user dump;
-#if defined (__i386__) || defined (__mc68000__)
+#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
# define FIRST_MAPPED PAGE_SIZE /* we don't have page 0 mapped on x86.. */
#else
# define FIRST_MAPPED 0
@@ -51,7 +51,7 @@
memset(&dump, 0, sizeof(struct user));
dump.magic = CMAGIC;
dump.u_dsize = (virt_to_phys(high_memory) >> PAGE_SHIFT);
-#if defined (__i386__)
+#if defined (__i386__) || defined(__x86_64__)
dump.start_code = PAGE_OFFSET;
#endif
#ifdef __alpha__
@@ -361,7 +361,7 @@
read_unlock(&vmlist_lock);
/* where page 0 not mapped, write zeros into buffer */
-#if defined (__i386__) || defined (__mc68000__)
+#if defined (__i386__) || defined (__mc68000__) || defined(__x86_64__)
if (*fpos < PAGE_SIZE + elf_buflen) {
/* work out how much to clear */
tsz = PAGE_SIZE + elf_buflen - *fpos;
Index: kmsg.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/kmsg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- kmsg.c 14 Jan 2001 16:25:58 -0000 1.1.1.1
+++ kmsg.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -14,7 +14,6 @@
#include <asm/uaccess.h>
#include <asm/io.h>
-extern unsigned long log_size;
extern wait_queue_head_t log_wait;
extern int do_syslog(int type, char * bug, int count);
@@ -39,7 +38,7 @@
static unsigned int kmsg_poll(struct file *file, poll_table * wait)
{
poll_wait(file, &log_wait, wait);
- if (log_size)
+ if (do_syslog(9, 0, 0))
return POLLIN | POLLRDNORM;
return 0;
}
Index: proc_misc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/proc_misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- proc_misc.c 14 Jan 2001 16:25:53 -0000 1.1.1.1
+++ proc_misc.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -35,6 +35,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
+#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
@@ -49,20 +50,12 @@
* have a way to deal with that gracefully. Right now I used straightforward
* wrappers, but this needs further analysis wrt potential overflows.
*/
-extern int get_cpuinfo(char *);
-extern int get_hardware_list(char *);
-extern int get_stram_list(char *);
-#ifdef CONFIG_DEBUG_MALLOC
-extern int get_malloc(char * buffer);
-#endif
#ifdef CONFIG_MODULES
extern int get_module_list(char *);
-extern int get_ksyms_list(char *, char **, off_t, int);
#endif
extern int get_device_list(char *);
extern int get_partition_list(char *, char **, off_t, int);
extern int get_filesystem_list(char *);
-extern int get_filesystem_info(char *);
extern int get_exec_domain_list(char *);
extern int get_irq_list(char *);
extern int get_dma_list(char *);
@@ -140,57 +133,58 @@
{
struct sysinfo i;
int len;
+ int pg_size ;
/*
* display in kilobytes.
*/
#define K(x) ((x) << (PAGE_SHIFT - 10))
-#define B(x) ((x) << PAGE_SHIFT)
- si_meminfo(&i);
- si_swapinfo(&i);
- len = sprintf(page, " total: used: free: shared: buffers: cached:\n"
- "Mem: %8lu %8lu %8lu %8lu %8lu %8u\n"
- "Swap: %8lu %8lu %8lu\n",
- B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
- B(i.sharedram), B(i.bufferram),
- B(atomic_read(&page_cache_size)), B(i.totalswap),
- B(i.totalswap-i.freeswap), B(i.freeswap));
- /*
- * Tagged format, for easy grepping and expansion.
- * The above will go away eventually, once the tools
- * have been updated.
- */
- len += sprintf(page+len,
- "MemTotal: %8lu kB\n"
- "MemFree: %8lu kB\n"
- "MemShared: %8lu kB\n"
- "Buffers: %8lu kB\n"
- "Cached: %8u kB\n"
+#define B(x) ((unsigned long long)(x) << PAGE_SHIFT)
+ si_meminfo(&i);
+ si_swapinfo(&i);
+ pg_size = atomic_read(&page_cache_size) - i.bufferram ;
+
+ len = sprintf(page, " total: used: free: shared: buffers: cached:\n"
+ "Mem: %8Lu %8Lu %8Lu %8Lu %8Lu %8Lu\n"
+ "Swap: %8Lu %8Lu %8Lu\n",
+ B(i.totalram), B(i.totalram-i.freeram), B(i.freeram),
+ B(i.sharedram), B(i.bufferram),
+ B(pg_size), B(i.totalswap),
+ B(i.totalswap-i.freeswap), B(i.freeswap));
+ /*
+ * Tagged format, for easy grepping and expansion.
+ * The above will go away eventually, once the tools
+ * have been updated.
+ */
+ len += sprintf(page+len,
+ "MemTotal: %8lu kB\n"
+ "MemFree: %8lu kB\n"
+ "MemShared: %8lu kB\n"
+ "Buffers: %8lu kB\n"
+ "Cached: %8lu kB\n"
+ "SwapCached: %8lu kB\n"
"Active: %8u kB\n"
- "Inact_dirty: %8u kB\n"
- "Inact_clean: %8u kB\n"
- "Inact_target: %8lu kB\n"
- "HighTotal: %8lu kB\n"
- "HighFree: %8lu kB\n"
- "LowTotal: %8lu kB\n"
- "LowFree: %8lu kB\n"
- "SwapTotal: %8lu kB\n"
- "SwapFree: %8lu kB\n",
- K(i.totalram),
- K(i.freeram),
- K(i.sharedram),
- K(i.bufferram),
- K(atomic_read(&page_cache_size)),
+ "Inactive: %8u kB\n"
+ "HighTotal: %8lu kB\n"
+ "HighFree: %8lu kB\n"
+ "LowTotal: %8lu kB\n"
+ "LowFree: %8lu kB\n"
+ "SwapTotal: %8lu kB\n"
+ "SwapFree: %8lu kB\n",
+ K(i.totalram),
+ K(i.freeram),
+ K(i.sharedram),
+ K(i.bufferram),
+ K(pg_size - swapper_space.nrpages),
+ K(swapper_space.nrpages),
K(nr_active_pages),
- K(nr_inactive_dirty_pages),
- K(nr_inactive_clean_pages()),
- K(inactive_target),
- K(i.totalhigh),
- K(i.freehigh),
- K(i.totalram-i.totalhigh),
- K(i.freeram-i.freehigh),
- K(i.totalswap),
- K(i.freeswap));
+ K(nr_inactive_pages),
+ K(i.totalhigh),
+ K(i.freehigh),
+ K(i.totalram-i.totalhigh),
+ K(i.freeram-i.freehigh),
+ K(i.totalswap),
+ K(i.freeswap));
return proc_calc_metrics(page, start, off, count, eof, len);
#undef B
@@ -208,39 +202,17 @@
return proc_calc_metrics(page, start, off, count, eof, len);
}
-static int cpuinfo_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+extern struct seq_operations cpuinfo_op;
+static int cpuinfo_open(struct inode *inode, struct file *file)
{
- int len = get_cpuinfo(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
+ return seq_open(file, &cpuinfo_op);
}
-
-#ifdef CONFIG_PROC_HARDWARE
-static int hardware_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = get_hardware_list(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
-}
-#endif
-
-#ifdef CONFIG_STRAM_PROC
-static int stram_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = get_stram_list(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
-}
-#endif
-
-#ifdef CONFIG_DEBUG_MALLOC
-static int malloc_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = get_malloc(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
-}
-#endif
+static struct file_operations proc_cpuinfo_operations = {
+ open: cpuinfo_open,
+ read: seq_read,
+ llseek: seq_lseek,
+ release: seq_release,
+};
#ifdef CONFIG_MODULES
static int modules_read_proc(char *page, char **start, off_t off,
@@ -250,13 +222,17 @@
return proc_calc_metrics(page, start, off, count, eof, len);
}
-static int ksyms_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+extern struct seq_operations ksyms_op;
+static int ksyms_open(struct inode *inode, struct file *file)
{
- int len = get_ksyms_list(page, start, off, count);
- if (len < count) *eof = 1;
- return len;
+ return seq_open(file, &ksyms_op);
}
+static struct file_operations proc_ksyms_operations = {
+ open: ksyms_open,
+ read: seq_read,
+ llseek: seq_lseek,
+ release: seq_release,
+};
#endif
static int kstat_read_proc(char *page, char **start, off_t off,
@@ -274,8 +250,10 @@
user += kstat.per_cpu_user[cpu];
nice += kstat.per_cpu_nice[cpu];
system += kstat.per_cpu_system[cpu];
+#if !defined(CONFIG_ARCH_S390)
for (j = 0 ; j < NR_IRQS ; j++)
sum += kstat.irqs[cpu][j];
+#endif
}
len = sprintf(page, "cpu %u %u %u %lu\n", user, nice, system,
@@ -287,20 +265,22 @@
kstat.per_cpu_nice[cpu_logical_map(i)],
kstat.per_cpu_system[cpu_logical_map(i)],
jif - ( kstat.per_cpu_user[cpu_logical_map(i)] \
- + kstat.per_cpu_nice[cpu_logical_map(i)] \
- + kstat.per_cpu_system[cpu_logical_map(i)]));
+ + kstat.per_cpu_nice[cpu_logical_map(i)] \
+ + kstat.per_cpu_system[cpu_logical_map(i)]));
len += sprintf(page + len,
"page %u %u\n"
- "swap %u %u\n"
+ "swap %u %u\n"
"intr %u",
- kstat.pgpgin,
- kstat.pgpgout,
+ kstat.pgpgin >> 1,
+ kstat.pgpgout >> 1,
kstat.pswpin,
kstat.pswpout,
sum
);
+#if !defined(CONFIG_ARCH_S390)
for (i = 0 ; i < NR_IRQS ; i++)
len += sprintf(page + len, " %u", kstat_irqs(i));
+#endif
len += sprintf(page + len, "\ndisk_io: ");
@@ -409,13 +389,6 @@
return len;
}
-static int mounts_read_proc(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- int len = get_filesystem_info(page);
- return proc_calc_metrics(page, start, off, count, eof, len);
-}
-
static int execdomains_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
@@ -500,8 +473,28 @@
write: write_profile,
};
+extern struct seq_operations mounts_op;
+static int mounts_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &mounts_op);
+}
+static struct file_operations proc_mounts_operations = {
+ open: mounts_open,
+ read: seq_read,
+ llseek: seq_lseek,
+ release: seq_release,
+};
+
struct proc_dir_entry *proc_root_kcore;
+static void create_seq_entry(char *name, mode_t mode, struct file_operations *f)
+{
+ struct proc_dir_entry *entry;
+ entry = create_proc_entry(name, mode, NULL);
+ if (entry)
+ entry->proc_fops = f;
+}
+
void __init proc_misc_init(void)
{
struct proc_dir_entry *entry;
@@ -513,19 +506,8 @@
{"uptime", uptime_read_proc},
{"meminfo", meminfo_read_proc},
{"version", version_read_proc},
- {"cpuinfo", cpuinfo_read_proc},
-#ifdef CONFIG_PROC_HARDWARE
- {"hardware", hardware_read_proc},
-#endif
-#ifdef CONFIG_STRAM_PROC
- {"stram", stram_read_proc},
-#endif
-#ifdef CONFIG_DEBUG_MALLOC
- {"malloc", malloc_read_proc},
-#endif
#ifdef CONFIG_MODULES
{"modules", modules_read_proc},
- {"ksyms", ksyms_read_proc},
#endif
{"stat", kstat_read_proc},
{"devices", devices_read_proc},
@@ -541,7 +523,6 @@
{"rtc", ds1286_read_proc},
#endif
{"locks", locks_read_proc},
- {"mounts", mounts_read_proc},
{"swaps", swaps_read_proc},
{"iomem", memory_read_proc},
{"execdomains", execdomains_read_proc},
@@ -554,6 +535,11 @@
entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
if (entry)
entry->proc_fops = &proc_kmsg_operations;
+ create_seq_entry("mounts", 0, &proc_mounts_operations);
+ create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
+#ifdef CONFIG_MODULES
+ create_seq_entry("ksyms", 0, &proc_ksyms_operations);
+#endif
proc_root_kcore = create_proc_entry("kcore", S_IRUSR, NULL);
if (proc_root_kcore) {
proc_root_kcore->proc_fops = &proc_kcore_operations;
@@ -567,7 +553,7 @@
entry->size = (1+prof_len) * sizeof(unsigned int);
}
}
-#ifdef __powerpc__
+#ifdef CONFIG_PPC32
{
extern struct file_operations ppc_htab_operations;
entry = create_proc_entry("ppc_htab", S_IRUGO|S_IWUSR, NULL);
Index: root.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/proc/root.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- root.c 14 Jan 2001 16:25:48 -0000 1.1.1.1
+++ root.c 9 Apr 2002 13:19:37 -0000 1.2
@@ -14,6 +14,7 @@
#include <linux/stat.h>
#include <linux/config.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <asm/bitops.h>
struct proc_dir_entry *proc_net, *proc_bus, *proc_root_fs, *proc_root_driver;
@@ -22,8 +23,19 @@
struct proc_dir_entry *proc_sys_root;
#endif
+static DECLARE_FSTYPE(proc_fs_type, "proc", proc_read_super, FS_SINGLE);
+
void __init proc_root_init(void)
{
+ int err = register_filesystem(&proc_fs_type);
+ if (err)
+ return;
+ proc_mnt = kern_mount(&proc_fs_type);
+ err = PTR_ERR(proc_mnt);
+ if (IS_ERR(proc_mnt)) {
+ unregister_filesystem(&proc_fs_type);
+ return;
+ }
proc_misc_init();
proc_net = proc_mkdir("net", 0);
#ifdef CONFIG_SYSVIPC
@@ -32,6 +44,10 @@
#ifdef CONFIG_SYSCTL
proc_sys_root = proc_mkdir("sys", 0);
#endif
+#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
+ proc_mkdir("sys/fs", 0);
+ proc_mkdir("sys/fs/binfmt_misc", 0);
+#endif
proc_root_fs = proc_mkdir("fs", 0);
proc_root_driver = proc_mkdir("driver", 0);
#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
@@ -42,6 +58,9 @@
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
+#ifdef CONFIG_PPC_RTAS
+ proc_rtas_init();
+#endif
proc_bus = proc_mkdir("bus", 0);
}
@@ -106,3 +125,17 @@
proc_fops: &proc_root_operations,
parent: &proc_root,
};
+
+#ifdef CONFIG_SYSCTL
+EXPORT_SYMBOL(proc_sys_root);
+#endif
+EXPORT_SYMBOL(proc_symlink);
+EXPORT_SYMBOL(proc_mknod);
+EXPORT_SYMBOL(proc_mkdir);
+EXPORT_SYMBOL(create_proc_entry);
+EXPORT_SYMBOL(remove_proc_entry);
+EXPORT_SYMBOL(proc_root);
+EXPORT_SYMBOL(proc_root_fs);
+EXPORT_SYMBOL(proc_net);
+EXPORT_SYMBOL(proc_bus);
+EXPORT_SYMBOL(proc_root_driver);
--- procfs_syms.c DELETED ---
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:42
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/executer In directory usw-pr-cvs1:/tmp/cvs-serv9187/drivers/acpi/executer Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/acpi/executer added to the repository |
Update of /cvsroot/linux-vax/kernel-2.4/fs
In directory usw-pr-cvs1:/tmp/cvs-serv32005
Modified Files:
Config.in Makefile attr.c read_write.c readdir.c select.c
stat.c super.c
Added Files:
seq_file.c
Log Message:
synch 2.4.15 commit 14
--- NEW FILE ---
/*
* linux/fs/seq_file.c
*
* helper functions for making syntetic files from sequences of records.
* initial implementation -- AV, Oct 2001.
*/
#include <linux/fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <asm/uaccess.h>
/**
* seq_open - initialize sequential file
* @file: file we initialize
* @op: method table describing the sequence
*
* seq_open() sets @file, associating it with a sequence described
* by @op. @op->start() sets the iterator up and returns the first
* element of sequence. @op->stop() shuts it down. @op->next()
* returns the next element of sequence. @op->show() prints element
* into the buffer. In case of error ->start() and ->next() return
* ERR_PTR(error). In the end of sequence they return %NULL. ->show()
* returns 0 in case of success and negative number in case of error.
*/
int seq_open(struct file *file, struct seq_operations *op)
{
struct seq_file *p = kmalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return -ENOMEM;
memset(p, 0, sizeof(*p));
sema_init(&p->sem, 1);
p->op = op;
file->private_data = p;
return 0;
}
/**
* seq_read - ->read() method for sequential files.
* @file, @buf, @size, @ppos: see file_operations method
*
* Ready-made ->f_op->read()
*/
ssize_t seq_read(struct file *file, char *buf, size_t size, loff_t *ppos)
{
struct seq_file *m = (struct seq_file *)file->private_data;
size_t copied = 0;
loff_t pos;
size_t n;
void *p;
int err = 0;
if (ppos != &file->f_pos)
return -EPIPE;
down(&m->sem);
/* grab buffer if we didn't have one */
if (!m->buf) {
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
if (!m->buf)
goto Enomem;
}
/* if not empty - flush it first */
if (m->count) {
n = min(m->count, size);
err = copy_to_user(buf, m->buf + m->from, n);
if (err)
goto Efault;
m->count -= n;
m->from += n;
size -= n;
buf += n;
copied += n;
if (!m->count)
m->index++;
if (!size)
goto Done;
}
/* we need at least one record in buffer */
while (1) {
pos = m->index;
p = m->op->start(m, &pos);
err = PTR_ERR(p);
if (!p || IS_ERR(p))
break;
err = m->op->show(m, p);
if (err)
break;
if (m->count < m->size)
goto Fill;
m->op->stop(m, p);
kfree(m->buf);
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
if (!m->buf)
goto Enomem;
}
m->op->stop(m, p);
goto Done;
Fill:
/* they want more? let's try to get some more */
while (m->count < size) {
size_t offs = m->count;
loff_t next = pos;
p = m->op->next(m, p, &next);
if (!p || IS_ERR(p)) {
err = PTR_ERR(p);
break;
}
err = m->op->show(m, p);
if (err || m->count == m->size) {
m->count = offs;
break;
}
pos = next;
}
m->op->stop(m, p);
n = min(m->count, size);
err = copy_to_user(buf, m->buf, n);
if (err)
goto Efault;
copied += n;
m->count -= n;
if (m->count)
m->from = n;
else
pos++;
m->index = pos;
Done:
if (!copied)
copied = err;
else
*ppos += copied;
up(&m->sem);
return copied;
Enomem:
err = -ENOMEM;
goto Done;
Efault:
err = -EFAULT;
goto Done;
}
static int traverse(struct seq_file *m, loff_t offset)
{
loff_t pos = 0;
int error = 0;
void *p;
m->index = 0;
m->count = m->from = 0;
if (!offset)
return 0;
if (!m->buf) {
m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
if (!m->buf)
return -ENOMEM;
}
p = m->op->start(m, &m->index);
while (p) {
error = PTR_ERR(p);
if (IS_ERR(p))
break;
error = m->op->show(m, p);
if (error)
break;
if (m->count == m->size)
goto Eoverflow;
if (pos + m->count > offset) {
m->from = offset - pos;
m->count -= m->from;
break;
}
pos += m->count;
m->count = 0;
if (pos == offset) {
m->index++;
break;
}
p = m->op->next(m, p, &m->index);
}
m->op->stop(m, p);
return error;
Eoverflow:
m->op->stop(m, p);
kfree(m->buf);
m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
return !m->buf ? -ENOMEM : -EAGAIN;
}
/**
* seq_lseek - ->llseek() method for sequential files.
* @file, @offset, @origin: see file_operations method
*
* Ready-made ->f_op->llseek()
*/
loff_t seq_lseek(struct file *file, loff_t offset, int origin)
{
struct seq_file *m = (struct seq_file *)file->private_data;
long long retval = -EINVAL;
down(&m->sem);
switch (origin) {
case 1:
offset += file->f_pos;
case 0:
if (offset < 0)
break;
retval = offset;
if (offset != file->f_pos) {
while ((retval=traverse(m, offset)) == -EAGAIN)
;
if (retval) {
/* with extreme perjudice... */
file->f_pos = 0;
m->index = 0;
m->count = 0;
} else {
retval = file->f_pos = offset;
}
}
}
up(&m->sem);
return retval;
}
/**
* seq_release - free the structures associated with sequential file.
* @file: file in question
* @inode: file->f_dentry->d_inode
*
* Frees the structures associated with sequential file; can be used
* as ->f_op->release() if you don't have private data to destroy.
*/
int seq_release(struct inode *inode, struct file *file)
{
struct seq_file *m = (struct seq_file *)file->private_data;
kfree(m->buf);
kfree(m);
return 0;
}
/**
* seq_escape - print string into buffer, escaping some characters
* @m: target buffer
* @s: string
* @esc: set of characters that need escaping
*
* Puts string into buffer, replacing each occurence of character from
* @esc with usual octal escape. Returns 0 in case of success, -1 - in
* case of overflow.
*/
int seq_escape(struct seq_file *m, const char *s, const char *esc)
{
char *end = m->buf + m->size;
char *p;
char c;
for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) {
if (!strchr(esc, c)) {
*p++ = c;
continue;
}
if (p + 3 < end) {
*p++ = '\\';
*p++ = '0' + ((c & 0300) >> 6);
*p++ = '0' + ((c & 070) >> 3);
*p++ = '0' + (c & 07);
continue;
}
m->count = m->size;
return -1;
}
m->count = p - m->buf;
return 0;
}
int seq_printf(struct seq_file *m, const char *f, ...)
{
va_list args;
int len;
if (m->count < m->size) {
va_start(args, f);
len = vsnprintf(m->buf + m->count, m->size - m->count, f, args);
va_end(args);
if (m->count + len < m->size) {
m->count += len;
return 0;
}
}
m->count = m->size;
return -1;
}
Index: Config.in
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/Config.in,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- Config.in 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ Config.in 9 Apr 2002 13:30:18 -0000 1.2
@@ -10,6 +10,7 @@
dep_tristate 'Reiserfs support' CONFIG_REISERFS_FS $CONFIG_EXPERIMENTAL
dep_mbool ' Have reiserfs do extra internal checking' CONFIG_REISERFS_CHECK $CONFIG_REISERFS_FS $CONFIG_EXPERIMENTAL
+dep_mbool ' Stats in /proc/fs/reiserfs' CONFIG_REISERFS_PROC_INFO $CONFIG_REISERFS_FS $CONFIG_EXPERIMENTAL
dep_tristate 'ADFS file system support' CONFIG_ADFS_FS $CONFIG_EXPERIMENTAL
dep_mbool ' ADFS write support (DANGEROUS)' CONFIG_ADFS_FS_RW $CONFIG_ADFS_FS $CONFIG_EXPERIMENTAL
@@ -20,24 +21,39 @@
dep_tristate 'BFS file system support (EXPERIMENTAL)' CONFIG_BFS_FS $CONFIG_EXPERIMENTAL
+tristate 'Ext3 journalling file system support (EXPERIMENTAL)' CONFIG_EXT3_FS
+# CONFIG_JBD could be its own option (even modular), but until there are
+# other users than ext3, we will simply make it be the same as CONFIG_EXT3_FS
+# dep_tristate ' Journal Block Device support (JBD for ext3)' CONFIG_JBD $CONFIG_EXT3_FS
+define_bool CONFIG_JBD $CONFIG_EXT3_FS
+dep_mbool ' JBD (ext3) debugging support' CONFIG_JBD_DEBUG $CONFIG_JBD
+
# msdos file systems
tristate 'DOS FAT fs support' CONFIG_FAT_FS
dep_tristate ' MSDOS fs support' CONFIG_MSDOS_FS $CONFIG_FAT_FS
dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS
dep_tristate ' VFAT (Windows-95) fs support' CONFIG_VFAT_FS $CONFIG_FAT_FS
dep_tristate 'EFS file system support (read only) (EXPERIMENTAL)' CONFIG_EFS_FS $CONFIG_EXPERIMENTAL
-dep_tristate 'Journalling Flash File System (JFFS) support (EXPERIMENTAL)' CONFIG_JFFS_FS $CONFIG_EXPERIMENTAL $CONFIG_MTD
-if [ "$CONFIG_JFFS_FS" != "n" ] ; then
- int 'JFFS debugging verbosity (0 = quiet, 3 = noisy)' CONFIG_JFFS_FS_VERBOSE 0
+dep_tristate 'Journalling Flash File System (JFFS) support' CONFIG_JFFS_FS $CONFIG_MTD
+if [ "$CONFIG_JFFS_FS" = "y" -o "$CONFIG_JFFS_FS" = "m" ] ; then
+ int 'JFFS debugging verbosity (0 = quiet, 3 = noisy)' CONFIG_JFFS_FS_VERBOSE 0
+ bool 'JFFS stats available in /proc filesystem' CONFIG_JFFS_PROC_FS
+fi
+dep_tristate 'Journalling Flash File System v2 (JFFS2) support' CONFIG_JFFS2_FS $CONFIG_MTD
+if [ "$CONFIG_JFFS2_FS" = "y" -o "$CONFIG_JFFS2_FS" = "m" ] ; then
+ int 'JFFS2 debugging verbosity (0 = quiet, 2 = noisy)' CONFIG_JFFS2_FS_DEBUG 0
fi
tristate 'Compressed ROM file system support' CONFIG_CRAMFS
+bool 'Virtual memory file system support (former shm fs)' CONFIG_TMPFS
tristate 'Simple RAM-based file system support' CONFIG_RAMFS
tristate 'ISO 9660 CDROM file system support' CONFIG_ISO9660_FS
dep_mbool ' Microsoft Joliet CDROM extensions' CONFIG_JOLIET $CONFIG_ISO9660_FS
+dep_mbool ' Transparent decompression extension' CONFIG_ZISOFS $CONFIG_ISO9660_FS
tristate 'Minix fs support' CONFIG_MINIX_FS
+tristate 'FreeVxFS file system support (VERITAS VxFS(TM) compatible)' CONFIG_VXFS_FS
tristate 'NTFS file system support (read only)' CONFIG_NTFS_FS
dep_mbool ' NTFS write support (DANGEROUS)' CONFIG_NTFS_RW $CONFIG_NTFS_FS $CONFIG_EXPERIMENTAL
@@ -62,8 +78,7 @@
tristate 'Second extended fs support' CONFIG_EXT2_FS
-tristate 'System V and Coherent file system support (read only)' CONFIG_SYSV_FS
-dep_mbool ' SYSV file system write support (DANGEROUS)' CONFIG_SYSV_FS_WRITE $CONFIG_SYSV_FS $CONFIG_EXPERIMENTAL
+tristate 'System V/Xenix/V7/Coherent file system support' CONFIG_SYSV_FS
tristate 'UDF file system support (read only)' CONFIG_UDF_FS
dep_mbool ' UDF write support (DANGEROUS)' CONFIG_UDF_RW $CONFIG_UDF_FS $CONFIG_EXPERIMENTAL
@@ -77,6 +92,7 @@
comment 'Network File Systems'
dep_tristate 'Coda file system support (advanced network fs)' CONFIG_CODA_FS $CONFIG_INET
+ dep_tristate 'InterMezzo file system support (experimental, replicating fs)' CONFIG_INTERMEZZO_FS $CONFIG_INET $CONFIG_EXPERIMENTAL
dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
dep_mbool ' Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
dep_bool ' Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
@@ -102,9 +118,9 @@
dep_tristate 'SMB file system support (to mount Windows shares etc.)' CONFIG_SMB_FS $CONFIG_INET
if [ "$CONFIG_SMB_FS" != "n" ]; then
- bool ' Use a default NLS' CONFIG_SMB_NLS_DEFAULT
+ bool ' Use a default NLS' CONFIG_SMB_NLS_DEFAULT
if [ "$CONFIG_SMB_NLS_DEFAULT" = "y" ]; then
- string ' Default Remote NLS Option' CONFIG_SMB_NLS_REMOTE "cp437"
+ string ' Default Remote NLS Option' CONFIG_SMB_NLS_REMOTE "cp437"
fi
fi
if [ "$CONFIG_IPX" != "n" -o "$CONFIG_INET" != "n" ]; then
@@ -120,6 +136,24 @@
# for fs/nls/Config.in
define_bool CONFIG_NCPFS_NLS n
define_bool CONFIG_SMB_FS n
+fi
+
+#
+# Do we need the compression support?
+#
+if [ "$CONFIG_ZISOFS" = "y" ]; then
+ define_tristate CONFIG_ZISOFS_FS $CONFIG_ISO9660_FS
+else
+ define_tristate CONFIG_ZISOFS_FS n
+fi
+if [ "$CONFIG_CRAMFS" = "y" -o "$CONFIG_ZISOFS_FS" = "y" ]; then
+ define_tristate CONFIG_ZLIB_FS_INFLATE y
+else
+ if [ "$CONFIG_CRAMFS" = "m" -o "$CONFIG_ZISOFS_FS" = "m" ]; then
+ define_tristate CONFIG_ZLIB_FS_INFLATE m
+ else
+ define_tristate CONFIG_ZLIB_FS_INFLATE n
+ fi
fi
mainmenu_option next_comment
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- Makefile 25 Feb 2001 23:14:45 -0000 1.1.1.2
+++ Makefile 9 Apr 2002 13:30:18 -0000 1.2
@@ -7,14 +7,14 @@
O_TARGET := fs.o
-export-objs := filesystems.o
+export-objs := filesystems.o open.o dcache.o buffer.o
mod-subdirs := nls
obj-y := open.o read_write.o devices.o file_table.o buffer.o \
- super.o block_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
- ioctl.o readdir.o select.o fifo.o locks.o \
+ super.o block_dev.o char_dev.o stat.o exec.o pipe.o namei.o \
+ fcntl.o ioctl.o readdir.o select.o fifo.o locks.o \
dcache.o inode.o attr.o bad_inode.o file.o iobuf.o dnotify.o \
- filesystems.o
+ filesystems.o namespace.o seq_file.o
ifeq ($(CONFIG_QUOTA),y)
obj-y += dquot.o
@@ -26,23 +26,28 @@
subdir-y += partitions
# Do not add any filesystems before this line
+subdir-$(CONFIG_EXT3_FS) += ext3 # Before ext2 so root fs can be ext3
+subdir-$(CONFIG_JBD) += jbd
subdir-$(CONFIG_EXT2_FS) += ext2
+subdir-$(CONFIG_ZLIB_FS_INFLATE) += inflate_fs
subdir-$(CONFIG_CRAMFS) += cramfs
subdir-$(CONFIG_RAMFS) += ramfs
subdir-$(CONFIG_CODA_FS) += coda
+subdir-$(CONFIG_INTERMEZZO_FS) += intermezzo
subdir-$(CONFIG_MINIX_FS) += minix
subdir-$(CONFIG_FAT_FS) += fat
+subdir-$(CONFIG_UMSDOS_FS) += umsdos
subdir-$(CONFIG_MSDOS_FS) += msdos
subdir-$(CONFIG_VFAT_FS) += vfat
subdir-$(CONFIG_BFS_FS) += bfs
subdir-$(CONFIG_ISO9660_FS) += isofs
subdir-$(CONFIG_DEVFS_FS) += devfs
subdir-$(CONFIG_HFS_FS) += hfs
+subdir-$(CONFIG_VXFS_FS) += freevxfs
subdir-$(CONFIG_NFS_FS) += nfs
subdir-$(CONFIG_NFSD) += nfsd
subdir-$(CONFIG_LOCKD) += lockd
subdir-$(CONFIG_NLS) += nls
-subdir-$(CONFIG_UMSDOS_FS) += umsdos
subdir-$(CONFIG_SYSV_FS) += sysv
subdir-$(CONFIG_SMB_FS) += smbfs
subdir-$(CONFIG_NCP_FS) += ncpfs
@@ -51,6 +56,7 @@
subdir-$(CONFIG_UFS_FS) += ufs
subdir-$(CONFIG_EFS_FS) += efs
subdir-$(CONFIG_JFFS_FS) += jffs
+subdir-$(CONFIG_JFFS2_FS) += jffs2
subdir-$(CONFIG_AFFS_FS) += affs
subdir-$(CONFIG_ROMFS_FS) += romfs
subdir-$(CONFIG_QNX4FS_FS) += qnx4
Index: attr.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/attr.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- attr.c 14 Jan 2001 16:25:42 -0000 1.1.1.1
+++ attr.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -11,6 +11,7 @@
#include <linux/smp_lock.h>
#include <linux/dnotify.h>
#include <linux/fcntl.h>
+#include <linux/quotaops.h>
/* Taken over from the old code... */
@@ -57,16 +58,21 @@
return retval;
}
-void inode_setattr(struct inode * inode, struct iattr * attr)
+int inode_setattr(struct inode * inode, struct iattr * attr)
{
unsigned int ia_valid = attr->ia_valid;
+ int error = 0;
+
+ if (ia_valid & ATTR_SIZE) {
+ error = vmtruncate(inode, attr->ia_size);
+ if (error)
+ goto out;
+ }
if (ia_valid & ATTR_UID)
inode->i_uid = attr->ia_uid;
if (ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
- if (ia_valid & ATTR_SIZE)
- vmtruncate(inode, attr->ia_size);
if (ia_valid & ATTR_ATIME)
inode->i_atime = attr->ia_atime;
if (ia_valid & ATTR_MTIME)
@@ -79,6 +85,8 @@
inode->i_mode &= ~S_ISGID;
}
mark_inode_dirty(inode);
+out:
+ return error;
}
static int setattr_mask(unsigned int ia_valid)
@@ -124,8 +132,13 @@
error = inode->i_op->setattr(dentry, attr);
else {
error = inode_change_ok(inode, attr);
- if (!error)
- inode_setattr(inode, attr);
+ if (!error) {
+ if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
+ (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
+ error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
+ if (!error)
+ error = inode_setattr(inode, attr);
+ }
}
unlock_kernel();
if (!error) {
Index: read_write.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/read_write.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- read_write.c 25 Feb 2001 23:14:45 -0000 1.1.1.2
+++ read_write.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -15,6 +15,7 @@
#include <asm/uaccess.h>
struct file_operations generic_ro_fops = {
+ llseek: generic_file_llseek,
read: generic_file_read,
mmap: generic_file_mmap,
};
@@ -22,6 +23,34 @@
ssize_t generic_read_dir(struct file *filp, char *buf, size_t siz, loff_t *ppos)
{
return -EISDIR;
+}
+
+loff_t generic_file_llseek(struct file *file, loff_t offset, int origin)
+{
+ long long retval;
+
+ switch (origin) {
+ case 2:
+ offset += file->f_dentry->d_inode->i_size;
+ break;
+ case 1:
+ offset += file->f_pos;
+ }
+ retval = -EINVAL;
+ if (offset>=0 && offset<=file->f_dentry->d_inode->i_sb->s_maxbytes) {
+ if (offset != file->f_pos) {
+ file->f_pos = offset;
+ file->f_reada = 0;
+ file->f_version = ++event;
+ }
+ retval = offset;
+ }
+ return retval;
+}
+
+loff_t no_llseek(struct file *file, loff_t offset, int origin)
+{
+ return -ESPIPE;
}
loff_t default_llseek(struct file *file, loff_t offset, int origin)
Index: readdir.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/readdir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- readdir.c 14 Jan 2001 16:25:38 -0000 1.1.1.1
+++ readdir.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -122,7 +122,7 @@
int count;
};
-static int fillonedir(void * __buf, const char * name, int namlen, off_t offset,
+static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
ino_t ino, unsigned int d_type)
{
struct readdir_callback * buf = (struct readdir_callback *) __buf;
@@ -183,7 +183,7 @@
int error;
};
-static int filldir(void * __buf, const char * name, int namlen, off_t offset,
+static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
ino_t ino, unsigned int d_type)
{
struct linux_dirent * dirent;
@@ -261,7 +261,7 @@
int error;
};
-static int filldir64(void * __buf, const char * name, int namlen, off_t offset,
+static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
ino_t ino, unsigned int d_type)
{
struct linux_dirent64 * dirent, d;
Index: select.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/select.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- select.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ select.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/poll.h>
+#include <linux/personality.h> /* for STICKY_TIMEOUTS */
#include <linux/file.h>
#include <asm/uaccess.h>
@@ -260,7 +261,7 @@
fd_set_bits fds;
char *bits;
long timeout;
- int ret, size;
+ int ret, size, max_fdset;
timeout = MAX_SCHEDULE_TIMEOUT;
if (tvp) {
@@ -285,8 +286,10 @@
if (n < 0)
goto out_nofds;
- if (n > current->files->max_fdset)
- n = current->files->max_fdset;
+ /* max_fdset can increase, so grab it once to avoid race */
+ max_fdset = current->files->max_fdset;
+ if (n > max_fdset)
+ n = max_fdset;
/*
* We need 6 bitmaps (in/out/ex for both incoming and outgoing),
@@ -414,7 +417,7 @@
int nchunks, nleft;
/* Do a sanity check on nfds ... */
- if (nfds > current->files->max_fds)
+ if (nfds > NR_OPEN)
return -EINVAL;
if (timeout) {
Index: stat.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/stat.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- stat.c 14 Jan 2001 16:24:33 -0000 1.1.1.1
+++ stat.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -4,6 +4,7 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
+#include <linux/config.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/file.h>
@@ -25,7 +26,7 @@
}
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(__s390__) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
/*
* For backward compatibility? Maybe this should be moved
@@ -38,7 +39,7 @@
if (warncount > 0) {
warncount--;
- printk("VFS: Warning: %s using old stat() call. Recompile your binary.\n",
+ printk(KERN_WARNING "VFS: Warning: %s using old stat() call. Recompile your binary.\n",
current->comm);
} else if (warncount < 0) {
/* it's laughable, but... */
@@ -53,7 +54,7 @@
SET_OLDSTAT_GID(tmp, inode->i_gid);
tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
#if BITS_PER_LONG == 32
- if (inode->i_size > 0x7fffffff)
+ if (inode->i_size > MAX_NON_LFS)
return -EOVERFLOW;
#endif
tmp.st_size = inode->i_size;
@@ -79,7 +80,7 @@
SET_STAT_GID(tmp, inode->i_gid);
tmp.st_rdev = kdev_t_to_nr(inode->i_rdev);
#if BITS_PER_LONG == 32
- if (inode->i_size > 0x7fffffff)
+ if (inode->i_size > MAX_NON_LFS)
return -EOVERFLOW;
#endif
tmp.st_size = inode->i_size;
@@ -126,7 +127,7 @@
}
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(__s390__) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
/*
* For backward compatibility? Maybe this should be moved
* into arch/i386 instead?
@@ -162,7 +163,7 @@
return error;
}
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(__s390__) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
/*
* For backward compatibility? Maybe this should be moved
@@ -200,7 +201,7 @@
return error;
}
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(__s390__) && !defined(__hppa__)
+#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) && !defined(__x86_64__)
/*
* For backward compatibility? Maybe this should be moved
@@ -267,7 +268,7 @@
/* ---------- LFS-64 ----------- */
-#if !defined(__alpha__) && !defined (__ia64__) && !defined(__mips64)
+#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
static long cp_new_stat64(struct inode * inode, struct stat64 * statbuf)
{
Index: super.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/super.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- super.c 25 Feb 2001 23:14:45 -0000 1.1.1.2
+++ super.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -42,27 +42,17 @@
#define __NO_VERSION__
#include <linux/module.h>
-/*
- * We use a semaphore to synchronize all mount/umount
- * activity - imagine the mess if we have a race between
- * unmounting a filesystem and re-mounting it (or something
- * else).
- */
-static DECLARE_MUTEX(mount_sem);
-
[...1792 lines suppressed...]
- int blivet;
-
- printk(KERN_NOTICE "Trying to unmount old root ... ");
- blivet = do_umount(old_rootmnt, 1, 0);
- if (!blivet) {
- printk("okay\n");
- return 0;
- }
- printk(KERN_ERR "error %d\n", blivet);
- return error;
- }
- /* FIXME: we should hold i_zombie on nd.dentry */
- move_vfsmnt(old_rootmnt, nd.dentry, nd.mnt, "/dev/root.old");
- mntput(old_rootmnt);
- path_release(&nd);
- return 0;
+ mntput(vfsmnt);
}
-
-#endif
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:38
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/ramfs
In directory usw-pr-cvs1:/tmp/cvs-serv32005/ramfs
Modified Files:
inode.c
Log Message:
synch 2.4.15 commit 14
Index: inode.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ramfs/inode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- inode.c 25 Feb 2001 23:14:48 -0000 1.1.1.2
+++ inode.c 9 Apr 2002 13:30:18 -0000 1.2
@@ -4,6 +4,7 @@
* Copyright (C) 2000 Linus Torvalds.
* 2000 Transmeta Corp.
*
+ * Usage limits added by David Gibson, Linuxcare Australia.
* This file is released under the GPL.
*/
@@ -74,17 +75,6 @@
return 0;
}
-/*
- * Writing: just make sure the page gets marked dirty, so that
- * the page stealer won't grab it.
- */
-static int ramfs_writepage(struct page *page)
-{
- SetPageDirty(page);
- UnlockPage(page);
- return 0;
-}
-
static int ramfs_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
void *addr = kmap(page);
@@ -118,7 +108,7 @@
inode->i_gid = current->fsgid;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0;
- inode->i_rdev = to_kdev_t(dev);
+ inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &ramfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
@@ -277,7 +267,7 @@
static struct address_space_operations ramfs_aops = {
readpage: ramfs_readpage,
- writepage: ramfs_writepage,
+ writepage: fail_writepage,
prepare_write: ramfs_prepare_write,
commit_write: ramfs_commit_write
};
@@ -348,3 +338,5 @@
module_init(init_ramfs_fs)
module_exit(exit_ramfs_fs)
+MODULE_LICENSE("GPL");
+
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:36
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm/ec
In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm/ec
Added Files:
Makefile ec_osl.c ecgpe.c ecmain.c ecspace.c ectransx.c
Log Message:
synch 2.4.15 commit 17
--- NEW FILE ---
O_TARGET := ospm_$(notdir $(CURDIR)).o
obj-m := $(O_TARGET)
EXTRA_CFLAGS += $(ACPI_CFLAGS)
obj-y := $(patsubst %.c,%.o,$(wildcard *.c))
include $(TOPDIR)/Rules.make
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: ec_osl.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <acpi.h>
#include <bm.h>
#include "ec.h"
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Embedded Controller Driver");
extern struct proc_dir_entry *bm_proc_root;
/****************************************************************************
*
* FUNCTION: ec_osl_init
*
* PARAMETERS: <none>
*
* RETURN: 0: Success
*
* DESCRIPTION: Module initialization.
*
****************************************************************************/
static int __init
ec_osl_init (void)
{
acpi_status status = AE_OK;
/* abort if no busmgr */
if (!bm_proc_root)
return -ENODEV;
status = ec_initialize();
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
/****************************************************************************
*
* FUNCTION: ec_osl_cleanup
*
* PARAMETERS: <none>
*
* RETURN: <none>
*
* DESCRIPTION: Module cleanup.
*
****************************************************************************/
static void __exit
ec_osl_cleanup(void)
{
ec_terminate();
return;
}
module_init(ec_osl_init);
module_exit(ec_osl_cleanup);
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: ecgpe.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "ec.h"
#define _COMPONENT ACPI_EC
MODULE_NAME ("ecgpe")
/****************************************************************************
*
* FUNCTION: ec_query_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
void
ec_query_handler (
void *context)
{
EC_CONTEXT *ec = (EC_CONTEXT*)context;
static char object_name[5] = {'_','Q','0','0','\0'};
const char hex[] = {'0','1','2','3','4','5','6','7','8',
'9','A','B','C','D','E','F'};
FUNCTION_TRACE("ec_query_handler");
if (!ec) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
return_VOID;
}
/*
* Evaluate _Qxx:
* --------------
* Evaluate corresponding _Qxx method. Note that a zero query value
* indicates a spurious EC_SCI (no such thing as _Q00).
*/
object_name[2] = hex[((ec->query_data >> 4) & 0x0F)];
object_name[3] = hex[(ec->query_data & 0x0F)];
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Evaluating [%s] for ec [%02x].\n", object_name, ec->device_handle));
bm_evaluate_object(ec->acpi_handle, object_name, NULL, NULL);
return_VOID;
}
/****************************************************************************
*
* FUNCTION: ec_gpe_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
void
ec_gpe_handler (
void *context)
{
acpi_status status = AE_OK;
EC_CONTEXT *ec = (EC_CONTEXT*)context;
EC_STATUS ec_status = 0;
FUNCTION_TRACE("ec_gpe_handler");
if (!ec) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context.\n"));
return_VOID;
}
/* TBD: synchronize w/ transaction (ectransx). */
/*
* EC_SCI?
* -------
* Check the EC_SCI bit to see if this is an EC_SCI event. If not (e.g.
* OBF/IBE) just return, as we already poll to detect these events.
*/
acpi_os_read_port(ec->status_port, &ec_status, 8);
if (!(ec_status & EC_FLAG_SCI)) {
return_VOID;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "EC_SCI event detected on ec [%02x] - running query.\n", ec->device_handle));
/*
* Run Query:
* ----------
* Query the EC to find out which _Qxx method we need to evaluate.
* Note that successful completion of the query causes the EC_SCI
* bit to be cleared (and thus clearing the interrupt source).
*/
status = ec_io_write(ec, ec->command_port, EC_COMMAND_QUERY,
EC_EVENT_OUTPUT_BUFFER_FULL);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'query command' to EC.\n"));
return_VOID;
}
status = ec_io_read(ec, ec->data_port, &(ec->query_data),
EC_EVENT_NONE);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Error reading query data.\n"));
return_VOID;
}
/* TBD: un-synchronize w/ transaction (ectransx). */
/*
* Spurious EC_SCI?
* ----------------
*/
if (!ec->query_data) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Spurious EC SCI detected.\n"));
return_VOID;
}
/*
* Defer _Qxx Execution:
* ---------------------
* Can't evaluate this method now 'cause we're at interrupt-level.
*/
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
ec_query_handler, ec);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to defer _Qxx method evaluation.\n"));
return_VOID;
}
return_VOID;
}
/****************************************************************************
*
* FUNCTION: ec_install_gpe_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_install_gpe_handler (
EC_CONTEXT *ec)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_install_gpe_handler");
if (!ec) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Evaluate _GPE:
* --------------
* Evaluate the "_GPE" object (required) to find out which GPE bit
* is used by this EC to signal events (SCIs).
*/
status = bm_evaluate_simple_integer(ec->acpi_handle,
"_GPE", &(ec->gpe_bit));
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Install GPE Handler:
* --------------------
* Install a handler for this EC's GPE bit.
*/
status = acpi_install_gpe_handler(ec->gpe_bit, ACPI_EVENT_EDGE_TRIGGERED,
&ec_gpe_handler, ec);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "acpi_install_gpe_handler() failed for GPE bit [%02x] with status [%08x].\n", ec->gpe_bit, status));
ec->gpe_bit = EC_GPE_UNKNOWN;
return_ACPI_STATUS(status);
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_remove_gpe_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_remove_gpe_handler (
EC_CONTEXT *ec)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_remove_gpe_handler");
if (!ec) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
status = acpi_remove_gpe_handler(ec->gpe_bit, &ec_gpe_handler);
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: ecmain.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "ec.h"
#define _COMPONENT ACPI_EC
MODULE_NAME ("ecmain")
/****************************************************************************
* Internal Functions
****************************************************************************/
/****************************************************************************
*
* FUNCTION: ec_print
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Prints out information on a specific ec.
*
****************************************************************************/
void
ec_print (
EC_CONTEXT *ec)
{
#ifdef ACPI_DEBUG
acpi_buffer buffer;
#endif /*ACPI_DEBUG*/
PROC_NAME("ec_print");
if (!ec) {
return;
}
acpi_os_printf("EC: found, GPE %d\n", ec->gpe_bit);
#ifdef ACPI_DEBUG
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
if (!buffer.pointer) {
return;
}
/*
* Get the full pathname for this ACPI object.
*/
acpi_get_name(ec->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
/*
* Print out basic thermal zone information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Embedded_controller[%02x]:[%p] %s\n", ec->device_handle, ec->acpi_handle, (char*)buffer.pointer));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| gpe_bit[%02x] status/command_port[%02x] data_port[%02x]\n", ec->gpe_bit, ec->status_port, ec->data_port));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
acpi_os_free(buffer.pointer);
#endif /*ACPI_DEBUG*/
return;
}
/****************************************************************************
*
* FUNCTION: ec_get_port_values
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Evaluate _CRS to get the current resources (I/O port
* addresses) for this EC.
*
****************************************************************************/
acpi_status
ec_get_port_values(
EC_CONTEXT *ec)
{
acpi_status status = AE_OK;
acpi_buffer buffer;
acpi_resource *resource = NULL;
FUNCTION_TRACE("ec_get_port_values");
if (!ec) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
buffer.length = 0;
buffer.pointer = NULL;
status = acpi_get_current_resources(ec->acpi_handle, &buffer);
if (status != AE_BUFFER_OVERFLOW) {
return_ACPI_STATUS(status);
}
buffer.pointer = acpi_os_callocate(buffer.length);
if (!buffer.pointer) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
status = acpi_get_current_resources(ec->acpi_handle, &buffer);
if (ACPI_FAILURE(status)) {
goto end;
}
resource = (acpi_resource *) buffer.pointer;
ec->data_port = resource->data.io.min_base_address;
resource = NEXT_RESOURCE(resource);
ec->status_port = ec->command_port =
resource->data.io.min_base_address;
end:
acpi_os_free(buffer.pointer);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_add_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_add_device(
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
BM_DEVICE *device = NULL;
EC_CONTEXT *ec = NULL;
u8 gpe_handler = FALSE;
u8 space_handler = FALSE;
FUNCTION_TRACE("ec_add_device");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding EC device [%02x].\n", device_handle));
if (!context || *context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Get information on this device.
*/
status = bm_get_device_info(device_handle, &device);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Allocate a new EC_CONTEXT structure.
*/
ec = acpi_os_callocate(sizeof(EC_CONTEXT));
if (!ec) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
ec->device_handle = device->handle;
ec->acpi_handle = device->acpi_handle;
/*
* Get the I/O port addresses for the command/status and data ports.
*/
status = ec_get_port_values(ec);
if (ACPI_FAILURE(status)) {
goto end;
}
/*
* See if we need to obtain the global lock for EC transactions.
*/
status = bm_evaluate_simple_integer(ec->acpi_handle, "_GLK",
&ec->use_global_lock);
if (status == AE_NOT_FOUND) {
ec->use_global_lock = 0;
}
else if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "EC _GLK failed\n"));
goto end;
}
/*
* Install a handler for servicing this EC's GPE.
*/
status = ec_install_gpe_handler(ec);
if (ACPI_FAILURE(status)) {
goto end;
}
else {
gpe_handler = TRUE;
}
/*
* Install a handler for servicing this EC's address space.
*/
status = ec_install_space_handler(ec);
if (ACPI_FAILURE(status)) {
goto end;
}
else {
space_handler = TRUE;
}
/*
* Create a semaphore to serialize EC transactions.
*/
status = acpi_os_create_semaphore(1,1, &(ec->mutex));
if (ACPI_FAILURE(status)) {
goto end;
}
/*
* Context now contains information specific to this EC. Note
* that we'll get this pointer back on every ec_request() and
* ec_notify().
*/
*context = ec;
ec_print(ec);
end:
if (ACPI_FAILURE(status)) {
if (gpe_handler) {
ec_remove_gpe_handler(ec);
}
if (space_handler) {
ec_remove_space_handler(ec);
}
if (ec->mutex) {
acpi_os_delete_semaphore(ec->mutex);
}
acpi_os_free(ec);
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_remove_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_remove_device(
void **context)
{
acpi_status status = AE_OK;
EC_CONTEXT *ec = NULL;
FUNCTION_TRACE("ec_remove_device");
if (!context || !*context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
ec = (EC_CONTEXT*)*context;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing EC device [%02x].\n", ec->device_handle));
ec_remove_space_handler(ec);
ec_remove_gpe_handler(ec);
if (ec->mutex) {
acpi_os_delete_semaphore(ec->mutex);
}
acpi_os_free(ec);
*context = NULL;
return_ACPI_STATUS(status);
}
/****************************************************************************
* External Functions
****************************************************************************/
/****************************************************************************
*
* FUNCTION: ec_initialize
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_initialize (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("ec_initialize");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
/*
* Register driver for AC Adapter devices.
*/
MEMCPY(criteria.hid, EC_HID_EC, sizeof(EC_HID_EC));
driver.notify = &ec_notify;
driver.request = &ec_request;
status = bm_register_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_terminate
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_terminate(void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("ec_terminate");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
/*
* Unregister driver for AC Adapter devices.
*/
MEMCPY(criteria.hid, EC_HID_EC, sizeof(EC_HID_EC));
driver.notify = &ec_notify;
driver.request = &ec_request;
status = bm_unregister_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_notify
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_notify (
BM_NOTIFY notify,
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_notify");
switch (notify) {
case BM_NOTIFY_DEVICE_ADDED:
status = ec_add_device(device_handle, context);
break;
case BM_NOTIFY_DEVICE_REMOVED:
status = ec_remove_device(context);
break;
default:
status = AE_SUPPORT;
break;
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_request
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_request (
BM_REQUEST *request,
void *context)
{
acpi_status status = AE_OK;
EC_REQUEST *ec_request = NULL;
EC_CONTEXT *ec = NULL;
FUNCTION_TRACE("ec_request");
/*
* Must have a valid request structure and context.
*/
if (!request || !context)
return_ACPI_STATUS(AE_BAD_PARAMETER);
/*
* buffer must contain a valid EC_REQUEST structure.
*/
status = bm_cast_buffer(&(request->buffer), (void**)&ec_request,
sizeof(EC_REQUEST));
if (ACPI_FAILURE(status))
return_ACPI_STATUS(status);
/*
* context contains information specific to this EC.
*/
ec = (EC_CONTEXT*)context;
/*
* Perform the Transaction.
*/
status = ec_transaction(ec, ec_request);
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: ecspace.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "ec.h"
#define _COMPONENT ACPI_EC
MODULE_NAME ("ecspace")
/****************************************************************************
*
* FUNCTION: ec_space_setup
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_space_setup (
acpi_handle region_handle,
u32 function,
void *handler_context,
void **return_context)
{
/*
* The EC object is in the handler context and is needed
* when calling the ec_space_handler.
*/
*return_context = handler_context;
return AE_OK;
}
/****************************************************************************
*
* FUNCTION: ec_space_handler
*
* PARAMETERS: function - Read or Write operation
* address - Where in the space to read or write
* bit_width - Field width in bits (should be 8)
* value - Pointer to in or out value
* context - context pointer
*
* RETURN:
*
* DESCRIPTION: Handler for the Embedded Controller (EC) address space
* (Op Region)
*
****************************************************************************/
acpi_status
ec_space_handler (
u32 function,
ACPI_PHYSICAL_ADDRESS address,
u32 bit_width,
u32 *value,
void *handler_context,
void *region_context)
{
acpi_status status = AE_OK;
EC_CONTEXT *ec = NULL;
EC_REQUEST ec_request;
FUNCTION_TRACE("ec_space_handler");
if (address > 0xFF || bit_width != 8 || !value || !handler_context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
ec = (EC_CONTEXT*)handler_context;
switch (function) {
case ACPI_READ_ADR_SPACE:
ec_request.command = EC_COMMAND_READ;
ec_request.address = address;
ec_request.data = 0;
break;
case ACPI_WRITE_ADR_SPACE:
ec_request.command = EC_COMMAND_WRITE;
ec_request.address = address;
ec_request.data = (u8)(*value);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Received request with invalid function [%X].\n", function));
return_ACPI_STATUS(AE_BAD_PARAMETER);
break;
}
/*
* Perform the Transaction.
*/
status = ec_transaction(ec, &ec_request);
if (ACPI_SUCCESS(status)) {
(*value) = (u32)ec_request.data;
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_install_space_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_install_space_handler (
EC_CONTEXT *ec)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_install_space_handler");
if (!ec) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
status = acpi_install_address_space_handler (ec->acpi_handle,
ACPI_ADR_SPACE_EC, &ec_space_handler, &ec_space_setup, ec);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_remove_space_handler
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_remove_space_handler (
EC_CONTEXT *ec)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_remove_space_handler");
if (!ec) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
status = acpi_remove_address_space_handler(ec->acpi_handle,
ACPI_ADR_SPACE_EC, &ec_space_handler);
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: ectransx.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "ec.h"
#define _COMPONENT ACPI_EC
MODULE_NAME ("ectransx")
/****************************************************************************
*
* FUNCTION: ec_io_wait
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_io_wait (
EC_CONTEXT *ec,
EC_EVENT wait_event)
{
EC_STATUS ec_status = 0;
u32 i = 100;
if (!ec || ((wait_event != EC_EVENT_OUTPUT_BUFFER_FULL)
&& (wait_event != EC_EVENT_INPUT_BUFFER_EMPTY))) {
return(AE_BAD_PARAMETER);
}
/*
* Wait for Event:
* ---------------
* Poll the EC status register waiting for the event to occur.
* Note that we'll wait a maximum of 1ms in 10us chunks.
*/
switch (wait_event) {
case EC_EVENT_OUTPUT_BUFFER_FULL:
do {
acpi_os_read_port(ec->status_port, &ec_status, 8);
if (ec_status & EC_FLAG_OUTPUT_BUFFER) {
return(AE_OK);
}
acpi_os_stall(10);
} while (--i>0);
break;
case EC_EVENT_INPUT_BUFFER_EMPTY:
do {
acpi_os_read_port(ec->status_port, &ec_status, 8);
if (!(ec_status & EC_FLAG_INPUT_BUFFER)) {
return(AE_OK);
}
acpi_os_stall(10);
} while (--i>0);
break;
}
return(AE_TIME);
}
/****************************************************************************
*
* FUNCTION: ec_io_read
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_io_read (
EC_CONTEXT *ec,
ACPI_IO_ADDRESS io_port,
u8 *data,
EC_EVENT wait_event)
{
acpi_status status = AE_OK;
if (!ec || !data) {
return(AE_BAD_PARAMETER);
}
acpi_os_read_port(io_port, (u32*) data, 8);
if (wait_event) {
status = ec_io_wait(ec, wait_event);
}
return(status);
}
/****************************************************************************
*
* FUNCTION: ec_io_write
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_io_write (
EC_CONTEXT *ec,
ACPI_IO_ADDRESS io_port,
u8 data,
EC_EVENT wait_event)
{
acpi_status status = AE_OK;
if (!ec) {
return(AE_BAD_PARAMETER);
}
acpi_os_write_port(io_port, data, 8);
if (wait_event) {
status = ec_io_wait(ec, wait_event);
}
return(status);
}
/****************************************************************************
*
* FUNCTION: ec_read
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_read (
EC_CONTEXT *ec,
u8 address,
u8 *data)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_read");
if (!ec || !data) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (ec->use_global_lock) {
status = acpi_acquire_global_lock();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not acquire Global Lock\n"));
return_ACPI_STATUS(status);
}
}
status = ec_io_write(ec, ec->command_port, EC_COMMAND_READ,
EC_EVENT_INPUT_BUFFER_EMPTY);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'read command' to EC.\n"));
return_ACPI_STATUS(status);
}
status = ec_io_write(ec, ec->data_port, address,
EC_EVENT_OUTPUT_BUFFER_FULL);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'read address' to EC.\n"));
return_ACPI_STATUS(status);
}
status = ec_io_read(ec, ec->data_port, data, EC_EVENT_NONE);
if (ec->use_global_lock) {
acpi_release_global_lock();
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Read data [%02x] from address [%02x] on ec [%02x].\n", (*data), address, ec->device_handle));
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_write
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_write (
EC_CONTEXT *ec,
u8 address,
u8 data)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_write");
if (!ec)
return_ACPI_STATUS(AE_BAD_PARAMETER);
if (ec->use_global_lock) {
status = acpi_acquire_global_lock();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not acquire Global Lock\n"));
return_ACPI_STATUS(status);
}
}
status = ec_io_write(ec, ec->command_port, EC_COMMAND_WRITE,
EC_EVENT_INPUT_BUFFER_EMPTY);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write command' to EC.\n"));
return_ACPI_STATUS(status);
}
status = ec_io_write(ec, ec->data_port, address,
EC_EVENT_INPUT_BUFFER_EMPTY);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write address' to EC.\n"));
return_ACPI_STATUS(status);
}
status = ec_io_write(ec, ec->data_port, data,
EC_EVENT_INPUT_BUFFER_EMPTY);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Unable to send 'write data' to EC.\n"));
return_ACPI_STATUS(status);
}
if (ec->use_global_lock) {
acpi_release_global_lock();
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Wrote data [%02x] to address [%02x] on ec [%02x].\n", data, address, ec->device_handle));
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: ec_transaction
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
ec_transaction (
EC_CONTEXT *ec,
EC_REQUEST *request)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("ec_transaction");
if (!ec || !request) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Obtain mutex to serialize all EC transactions.
*/
status = acpi_os_wait_semaphore(ec->mutex, 1, EC_DEFAULT_TIMEOUT);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Perform the transaction.
*/
switch (request->command) {
case EC_COMMAND_READ:
status = ec_read(ec, request->address, &(request->data));
break;
case EC_COMMAND_WRITE:
status = ec_write(ec, request->address, request->data);
break;
default:
status = AE_SUPPORT;
break;
}
/*
* Signal the mutex to indicate transaction completion.
*/
acpi_os_signal_semaphore(ec->mutex, 1);
return_ACPI_STATUS(status);
}
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:36
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi/ospm/button
In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi/ospm/button
Added Files:
Makefile bn.c bn_osl.c
Log Message:
synch 2.4.15 commit 17
--- NEW FILE ---
O_TARGET := ospm_$(notdir $(CURDIR)).o
obj-m := $(O_TARGET)
EXTRA_CFLAGS += $(ACPI_CFLAGS)
obj-y := $(patsubst %.c,%.o,$(wildcard *.c))
include $(TOPDIR)/Rules.make
--- NEW FILE ---
/*****************************************************************************
*
* Module Name: bn.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Plxxe, Suite 330, Boston, MA 02111-1307 USA
*/
#include <acpi.h>
#include "bn.h"
#define _COMPONENT ACPI_BUTTON
MODULE_NAME ("bn")
/*****************************************************************************
* Internal Functions
*****************************************************************************/
/*****************************************************************************
*
* FUNCTION: bn_print
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION: Prints out information on a specific button.
*
****************************************************************************/
void
bn_print (
BN_CONTEXT *button)
{
#ifdef ACPI_DEBUG
acpi_buffer buffer;
PROC_NAME("bn_print");
if (!button) {
return;
}
buffer.length = 256;
buffer.pointer = acpi_os_callocate(buffer.length);
if (!buffer.pointer) {
return;
}
/*
* Get the full pathname for this ACPI object.
*/
acpi_get_name(button->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
/*
* Print out basic button information.
*/
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
switch (button->type) {
case BN_TYPE_POWER_BUTTON:
case BN_TYPE_POWER_BUTTON_FIXED:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Power_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
case BN_TYPE_SLEEP_BUTTON:
case BN_TYPE_SLEEP_BUTTON_FIXED:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Sleep_button[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
case BN_TYPE_LID_SWITCH:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| Lid_switch[%02x]:[%p] %s\n", button->device_handle, button->acpi_handle, (char*)buffer.pointer));
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
acpi_os_free(buffer.pointer);
#endif /*ACPI_DEBUG*/
return;
}
/****************************************************************************
*
* FUNCTION: bn_add_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_add_device(
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
BM_DEVICE *device = NULL;
BN_CONTEXT *button = NULL;
FUNCTION_TRACE("bn_add_device");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding button device [%02x].\n", device_handle));
if (!context || *context) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid context.\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Get information on this device.
*/
status = bm_get_device_info( device_handle, &device );
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Allocate a new BN_CONTEXT structure.
*/
button = acpi_os_callocate(sizeof(BN_CONTEXT));
if (!button) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
button->device_handle = device->handle;
button->acpi_handle = device->acpi_handle;
/*
* Power Button?
* -------------
* Either fixed-feature or generic (namespace) types.
*/
if (strncmp(device->id.hid, BN_HID_POWER_BUTTON,
sizeof(BM_DEVICE_HID)) == 0) {
if (device->id.type == BM_TYPE_FIXED_BUTTON) {
button->type = BN_TYPE_POWER_BUTTON_FIXED;
/* Register for fixed-feature events. */
status = acpi_install_fixed_event_handler(
ACPI_EVENT_POWER_BUTTON, bn_notify_fixed,
(void*)button);
}
else {
button->type = BN_TYPE_POWER_BUTTON;
}
}
/*
* Sleep Button?
* -------------
* Either fixed-feature or generic (namespace) types.
*/
else if (strncmp( device->id.hid, BN_HID_SLEEP_BUTTON,
sizeof(BM_DEVICE_HID)) == 0) {
if (device->id.type == BM_TYPE_FIXED_BUTTON) {
button->type = BN_TYPE_SLEEP_BUTTON_FIXED;
/* Register for fixed-feature events. */
status = acpi_install_fixed_event_handler(
ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed,
(void*)button);
}
else {
button->type = BN_TYPE_SLEEP_BUTTON;
}
}
/*
* LID Switch?
* -----------
*/
else if (strncmp( device->id.hid, BN_HID_LID_SWITCH,
sizeof(BM_DEVICE_HID)) == 0) {
button->type = BN_TYPE_LID_SWITCH;
}
status = bn_osl_add_device(button);
if (ACPI_FAILURE(status)) {
goto end;
}
*context = button;
bn_print(button);
end:
if (ACPI_FAILURE(status)) {
acpi_os_free(button);
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bn_remove_device
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_remove_device(
void **context)
{
acpi_status status = AE_OK;
BN_CONTEXT *button = NULL;
FUNCTION_TRACE("bn_remove_device");
if (!context || !*context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
button = (BN_CONTEXT*)*context;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing button device [%02x].\n", button->device_handle));
/*
* Unregister for fixed-feature events.
*/
switch (button->type) {
case BN_TYPE_POWER_BUTTON_FIXED:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_POWER_BUTTON, bn_notify_fixed);
break;
case BN_TYPE_SLEEP_BUTTON_FIXED:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_SLEEP_BUTTON, bn_notify_fixed);
break;
}
bn_osl_remove_device(button);
acpi_os_free(button);
*context = NULL;
return_ACPI_STATUS(status);
}
/*****************************************************************************
* External Functions
*****************************************************************************/
/*****************************************************************************
*
* FUNCTION: bn_initialize
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_initialize (void)
{
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("bn_initialize");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
driver.notify = &bn_notify;
driver.request = &bn_request;
/*
* Register for power buttons.
*/
MEMCPY(criteria.hid, BN_HID_POWER_BUTTON, sizeof(BN_HID_POWER_BUTTON));
bm_register_driver(&criteria, &driver);
/*
* Register for sleep buttons.
*/
MEMCPY(criteria.hid, BN_HID_SLEEP_BUTTON, sizeof(BN_HID_SLEEP_BUTTON));
bm_register_driver(&criteria, &driver);
/*
* Register for LID switches.
*/
MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
bm_register_driver(&criteria, &driver);
return_ACPI_STATUS(AE_OK);
}
/****************************************************************************
*
* FUNCTION: bn_terminate
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_terminate (void)
{
acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
FUNCTION_TRACE("bn_terminate");
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
driver.notify = &bn_notify;
driver.request = &bn_request;
/*
* Unregister for power buttons.
*/
MEMCPY(criteria.hid, BN_HID_POWER_BUTTON, sizeof(BN_HID_POWER_BUTTON));
status = bm_unregister_driver(&criteria, &driver);
/*
* Unregister for sleep buttons.
*/
MEMCPY(criteria.hid, BN_HID_SLEEP_BUTTON, sizeof(BN_HID_SLEEP_BUTTON));
status = bm_unregister_driver(&criteria, &driver);
/*
* Unregister for LID switches.
*/
MEMCPY(criteria.hid, BN_HID_LID_SWITCH, sizeof(BN_HID_LID_SWITCH));
status = bm_unregister_driver(&criteria, &driver);
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bn_notify_fixed
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_notify_fixed (
void *context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("bn_notify_fixed");
if (!context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
((BN_CONTEXT*)context));
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bn_notify
*
* PARAMETERS: <none>
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_notify (
BM_NOTIFY notify_type,
BM_HANDLE device_handle,
void **context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("bn_notify");
if (!context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
switch (notify_type) {
case BM_NOTIFY_DEVICE_ADDED:
status = bn_add_device(device_handle, context);
break;
case BM_NOTIFY_DEVICE_REMOVED:
status = bn_remove_device(context);
break;
case BN_NOTIFY_STATUS_CHANGE:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
status = bn_osl_generate_event(BN_NOTIFY_STATUS_CHANGE,
((BN_CONTEXT*)*context));
break;
default:
status = AE_SUPPORT;
break;
}
return_ACPI_STATUS(status);
}
/****************************************************************************
*
* FUNCTION: bn_request
*
* PARAMETERS:
*
* RETURN:
*
* DESCRIPTION:
*
****************************************************************************/
acpi_status
bn_request (
BM_REQUEST *request,
void *context)
{
acpi_status status = AE_OK;
FUNCTION_TRACE("bn_request");
/*
* Must have a valid request structure and context.
*/
if (!request || !context) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* Handle Request:
* ---------------
*/
switch (request->command) {
default:
status = AE_SUPPORT;
break;
}
request->status = status;
return_ACPI_STATUS(status);
}
--- NEW FILE ---
/******************************************************************************
*
* Module Name: bn_osl.c
* $Revision: 1.1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000, 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <acpi.h>
#include "bn.h"
MODULE_AUTHOR("Andrew Grover");
MODULE_DESCRIPTION("ACPI Component Architecture (CA) - Button Driver");
#define BN_PROC_ROOT "button"
#define BN_PROC_POWER_BUTTON "power"
#define BN_PROC_SLEEP_BUTTON "sleep"
#define BN_PROC_LID_SWITCH "lid"
extern struct proc_dir_entry *bm_proc_root;
static struct proc_dir_entry *bn_proc_root = NULL;
#define BN_TYPE_UNKNOWN 0
#define BN_TYPE_FIXED 1
#define BN_TYPE_GENERIC 2
static int bn_power_button = BN_TYPE_UNKNOWN;
static int bn_sleep_button = BN_TYPE_UNKNOWN;
static int bn_lid_switch = BN_TYPE_UNKNOWN;
/****************************************************************************
*
* FUNCTION: bn_osl_add_device
*
****************************************************************************/
acpi_status
bn_osl_add_device(
BN_CONTEXT *button)
{
acpi_status status = AE_OK;
if (!button) {
return(AE_BAD_PARAMETER);
}
switch (button->type) {
case BN_TYPE_POWER_BUTTON_FIXED:
bn_power_button = BN_TYPE_FIXED;
printk(KERN_INFO "ACPI: Power Button (FF) found\n");
if (!proc_mkdir(BN_PROC_POWER_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
case BN_TYPE_POWER_BUTTON:
/*
* Avoid creating multiple /proc entries when (buggy) ACPI
* BIOS tables erroneously list both fixed- and generic-
* feature buttons. Note that fixed-feature buttons are
* always enumerated first (and there can only be one) so
* we only need to check here.
*/
switch (bn_power_button) {
case BN_TYPE_GENERIC:
printk(KERN_WARNING "ACPI: Multiple generic-space power buttons detected, using first\n");
break;
case BN_TYPE_FIXED:
printk(KERN_WARNING "ACPI: Multiple power buttons detected, ignoring fixed-feature\n");
default:
printk(KERN_INFO "ACPI: Power Button (CM) found\n");
bn_power_button = BN_TYPE_GENERIC;
if (!proc_mkdir(BN_PROC_POWER_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
}
break;
case BN_TYPE_SLEEP_BUTTON_FIXED:
bn_sleep_button = BN_TYPE_FIXED;
printk(KERN_INFO "ACPI: Sleep Button (FF) found\n");
if (!proc_mkdir(BN_PROC_SLEEP_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
case BN_TYPE_SLEEP_BUTTON:
/*
* Avoid creating multiple /proc entries when (buggy) ACPI
* BIOS tables erroneously list both fixed- and generic-
* feature buttons. Note that fixed-feature buttons are
* always enumerated first (and there can only be one) so
* we only need to check here.
*/
switch (bn_sleep_button) {
case BN_TYPE_GENERIC:
printk(KERN_WARNING "ACPI: Multiple generic-space sleep buttons detected, using first\n");
break;
case BN_TYPE_FIXED:
printk(KERN_WARNING "ACPI: Multiple sleep buttons detected, ignoring fixed-feature\n");
default:
bn_sleep_button = BN_TYPE_GENERIC;
printk(KERN_INFO "ACPI: Sleep Button (CM) found\n");
if (!proc_mkdir(BN_PROC_SLEEP_BUTTON, bn_proc_root)) {
status = AE_ERROR;
}
break;
}
break;
case BN_TYPE_LID_SWITCH:
if (bn_lid_switch) {
printk(KERN_WARNING "ACPI: Multiple generic-space lid switches detected, using first\n");
break;
}
bn_lid_switch = BN_TYPE_GENERIC;
printk(KERN_INFO "ACPI: Lid Switch (CM) found\n");
if (!proc_mkdir(BN_PROC_LID_SWITCH, bn_proc_root)) {
status = AE_ERROR;
}
break;
}
return(status);
}
/****************************************************************************
*
* FUNCTION: bn_osl_remove_device
*
****************************************************************************/
acpi_status
bn_osl_remove_device (
BN_CONTEXT *button)
{
if (!button) {
return(AE_BAD_PARAMETER);
}
switch (button->type) {
case BN_TYPE_POWER_BUTTON:
case BN_TYPE_POWER_BUTTON_FIXED:
remove_proc_entry(BN_PROC_POWER_BUTTON, bn_proc_root);
break;
case BN_TYPE_SLEEP_BUTTON:
case BN_TYPE_SLEEP_BUTTON_FIXED:
remove_proc_entry(BN_PROC_SLEEP_BUTTON, bn_proc_root);
break;
case BN_TYPE_LID_SWITCH:
remove_proc_entry(BN_PROC_LID_SWITCH, bn_proc_root);
break;
}
return(AE_OK);
}
/****************************************************************************
*
* FUNCTION: bn_osl_generate_event
*
****************************************************************************/
acpi_status
bn_osl_generate_event (
u32 event,
BN_CONTEXT *button)
{
acpi_status status = AE_OK;
if (!button) {
return(AE_BAD_PARAMETER);
}
switch (event) {
case BN_NOTIFY_STATUS_CHANGE:
switch(button->type) {
case BN_TYPE_POWER_BUTTON:
case BN_TYPE_POWER_BUTTON_FIXED:
status = bm_osl_generate_event(button->device_handle,
BN_PROC_ROOT, BN_PROC_POWER_BUTTON, event, 0);
break;
case BN_TYPE_SLEEP_BUTTON:
case BN_TYPE_SLEEP_BUTTON_FIXED:
status = bm_osl_generate_event(button->device_handle,
BN_PROC_ROOT, BN_PROC_SLEEP_BUTTON, event, 0);
break;
case BN_TYPE_LID_SWITCH:
status = bm_osl_generate_event(button->device_handle,
BN_PROC_ROOT, BN_PROC_LID_SWITCH, event, 0);
break;
default:
status = AE_SUPPORT;
break;
}
break;
default:
return(AE_BAD_PARAMETER);
break;
}
return(status);
}
/****************************************************************************
*
* FUNCTION: bn_osl_init
*
* PARAMETERS: <none>
*
* RETURN: 0: Success
*
* DESCRIPTION: Module initialization.
*
****************************************************************************/
static int __init
bn_osl_init (void)
{
acpi_status status = AE_OK;
/* abort if no busmgr */
if (!bm_proc_root)
return -ENODEV;
bn_proc_root = proc_mkdir(BN_PROC_ROOT, bm_proc_root);
if (!bn_proc_root) {
status = AE_ERROR;
}
else {
status = bn_initialize();
if (ACPI_FAILURE(status)) {
remove_proc_entry(BN_PROC_ROOT, bm_proc_root);
}
}
return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
}
/****************************************************************************
*
* FUNCTION: bn_osl_cleanup
*
* PARAMETERS: <none>
*
* RETURN: <none>
*
* DESCRIPTION: Module cleanup.
*
****************************************************************************/
static void __exit
bn_osl_cleanup (void)
{
bn_terminate();
if (bn_proc_root) {
remove_proc_entry(BN_PROC_ROOT, bm_proc_root);
}
return;
}
module_init(bn_osl_init);
module_exit(bn_osl_cleanup);
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:30
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/mips-boards In directory usw-pr-cvs1:/tmp/cvs-serv18950/arch/mips/mips-boards Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/mips-boards added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:26
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/ddb5xxx In directory usw-pr-cvs1:/tmp/cvs-serv19153/arch/mips/ddb5xxx Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/ddb5xxx added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:26
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acorn/block
In directory usw-pr-cvs1:/tmp/cvs-serv12544/acorn/block
Modified Files:
fd1772.c mfmhd.c
Log Message:
synch 2.4.15 commit 16
Index: fd1772.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/block/fd1772.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- fd1772.c 25 Feb 2001 23:15:12 -0000 1.1.1.2
+++ fd1772.c 9 Apr 2002 14:00:57 -0000 1.2
@@ -3,7 +3,7 @@
* Based on ataflop.c in the m68k Linux
* Copyright (C) 1993 Greg Harp
* Atari Support by Bjoern Brauel, Roman Hodek
- * Archimedes Support by Dave Gilbert (gil...@cs...)
+ * Archimedes Support by Dave Gilbert (li...@tr...)
*
* Big cleanup Sep 11..14 1994 Roman Hodek:
* - Driver now works interrupt driven
@@ -117,12 +117,17 @@
*
* DAG 30/01/99 - Started frobbing for 2.2.1
* DAG 20/06/99 - A little more frobbing:
- * Included include/asm/uaccess.h for get_user/put_user
+ * Included include/asm/uaccess.h for get_user/put_user
+ *
+ * DAG 1/09/00 - Dusted off for 2.4.0-test7
+ * MAX_SECTORS was name clashing so it is now FD1772_...
+ * Minor parameter, name layouts for 2.4.x differences
*/
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/fcntl.h>
+#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
@@ -135,16 +140,15 @@
#include <linux/mm.h>
#include <asm/arch/oldlatches.h>
-#include <asm/system.h>
#include <asm/bitops.h>
#include <asm/dma.h>
#include <asm/hardware.h>
+#include <asm/hardware/ioc.h>
#include <asm/io.h>
-#include <asm/ioc.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/pgtable.h>
-#include <asm/segment.h>
+#include <asm/system.h>
#include <asm/uaccess.h>
@@ -242,7 +246,7 @@
outb(val, (reg / 2) + FDC1772BASE);
};
-#define MAX_SECTORS 22
+#define FD1772_MAX_SECTORS 22
unsigned char *DMABuffer; /* buffer for writes */
/*static unsigned long PhysDMABuffer; *//* physical address */
@@ -276,6 +280,7 @@
static volatile int fdc_busy = 0;
static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);
+
/* long req'd for set_bit --RR */
static unsigned long changed_floppies = 0xff, fake_change = 0;
#define CHECK_CHANGE_DELAY HZ/2
@@ -287,31 +292,29 @@
#define FLOPPY_TIMEOUT (6*HZ)
#define RECALIBRATE_ERRORS 4 /* After this many errors the drive
* will be recalibrated. */
-#define MAX_ERRORS 8 /* After this many errors the driver
- * will give up. */
-
-static struct timer_list fd_timer;
+#define MAX_ERRORS 8 /* After this many errors the driver
+ * will give up. */
-#define START_MOTOR_OFF_TIMER(delay) \
- do { \
- motor_off_timer.expires = jiffies + (delay); \
- add_timer( &motor_off_timer ); \
- MotorOffTrys = 0; \
+#define START_MOTOR_OFF_TIMER(delay) \
+ do { \
+ motor_off_timer.expires = jiffies + (delay); \
+ add_timer( &motor_off_timer ); \
+ MotorOffTrys = 0; \
} while(0)
#define START_CHECK_CHANGE_TIMER(delay) \
- do { \
- mod_timer(&fd_timer, jiffies + (delay)); \
+ do { \
+ mod_timer(&fd_timer, jiffies + (delay)); \
} while(0)
-#define START_TIMEOUT() \
- do { \
- mod_timer(&timeout_timer, jiffies+FLOPPY_TIMEOUT); \
+#define START_TIMEOUT() \
+ do { \
+ mod_timer(&timeout_timer, jiffies+FLOPPY_TIMEOUT); \
} while(0)
-#define STOP_TIMEOUT() \
- do { \
- del_timer( &timeout_timer ); \
+#define STOP_TIMEOUT() \
+ do { \
+ del_timer( &timeout_timer ); \
} while(0)
#define ENABLE_IRQ() enable_irq(FIQ_FD1772+64);
@@ -369,18 +372,27 @@
static int fd_test_drive_present(int drive);
static void config_types(void);
static int floppy_open(struct inode *inode, struct file *filp);
-static void floppy_release(struct inode *inode, struct file *filp);
+static int floppy_release(struct inode *inode, struct file *filp);
/************************* End of Prototypes **************************/
-static struct timer_list motor_off_timer =
-{NULL, NULL, 0, 0, fd_motor_off_timer};
+static struct timer_list motor_off_timer = {
+ function: fd_motor_off_timer,
+};
+
#ifdef TRACKBUFFER
-static struct timer_list readtrack_timer =
- { NULL, NULL, 0, 0, fd_readtrack_check };
+static struct timer_list readtrack_timer = {
+ function: fd_readtrack_check,
+};
#endif
-static struct timer_list timeout_timer =
-{NULL, NULL, 0, 0, fd_times_out};
+
+static struct timer_list timeout_timer = {
+ function: fd_times_out,
+};
+
+static struct timer_list fd_timer = {
+ function: check_change,
+};
/* DAG: Haven't got a clue what this is? */
int stdma_islocked(void)
@@ -392,13 +404,7 @@
static void fd_select_side(int side)
{
- unsigned long flags;
-
- save_flags(flags);
- cli();
-
oldlatch_aupdate(LATCHA_SIDESEL, side ? 0 : LATCHA_SIDESEL);
- restore_flags(flags);
}
@@ -407,8 +413,6 @@
static void fd_select_drive(int drive)
{
- unsigned long flags;
-
#ifdef DEBUG
printk("fd_select_drive:%d\n", drive);
#endif
@@ -418,10 +422,7 @@
if (drive == SelectedDrive)
return;
- save_flags(flags);
- cli();
oldlatch_aupdate(LATCHA_FDSELALL, 0xf - (1 << drive));
- restore_flags(flags);
/* restore track register to saved value */
FDC1772_WRITE(FDC1772REG_TRACK, unit[drive].track);
@@ -439,10 +440,7 @@
DPRINT(("fd_deselect\n"));
- save_flags(flags);
- cli();
oldlatch_aupdate(LATCHA_FDSELALL | LATCHA_MOTOR | LATCHA_INUSE, 0xf | LATCHA_MOTOR | LATCHA_INUSE);
- restore_flags(flags);
SelectedDrive = -1;
}
@@ -474,9 +472,12 @@
status = FDC1772_READ(FDC1772REG_STATUS);
if (!(status & 0x80)) {
- /* motor already turned off by FDC1772 -> deselect drives */
- /* In actual fact its this deselection which turns the motor off on the
- Arc, since the motor control is actually on Latch A */
+ /*
+ * motor already turned off by FDC1772 -> deselect drives
+ * In actual fact its this deselection which turns the motor
+ * off on the Arc, since the motor control is actually on
+ * Latch A
+ */
DPRINT(("fdc1772: deselecting in fd_motor_off_timer\n"));
fd_deselect();
MotorOn = 0;
@@ -485,7 +486,7 @@
}
/* not yet off, try again */
- retry:
+retry:
restore_flags(flags);
/* Test again later; if tested too often, it seems there is no disk
* in the drive and the FDC1772 will leave the motor on forever (or,
@@ -623,31 +624,29 @@
DPRINT(("do_fd_action unit[drive].track=%d\n", unit[drive].track));
#ifdef TRACKBUFFER
- repeat:
+repeat:
- if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
- if (ReqCmd == READ) {
- copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
- if (++ReqCnt < CURRENT->current_nr_sectors) {
- /* read next sector */
- setup_req_params( drive );
- goto repeat;
- }
- else {
- /* all sectors finished */
- CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
- CURRENT->sector += CURRENT->current_nr_sectors;
- end_request( 1 );
- redo_fd_request();
- return;
- }
- }
- else {
- /* cmd == WRITE, pay attention to track buffer
- * consistency! */
- copy_buffer( ReqData, SECTOR_BUFFER(ReqSector) );
- }
- }
+ if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
+ if (ReqCmd == READ) {
+ copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
+ if (++ReqCnt < CURRENT->current_nr_sectors) {
+ /* read next sector */
+ setup_req_params( drive );
+ goto repeat;
+ } else {
+ /* all sectors finished */
+ CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
+ CURRENT->sector += CURRENT->current_nr_sectors;
+ end_request( 1 );
+ redo_fd_request();
+ return;
+ }
+ } else {
+ /* cmd == WRITE, pay attention to track buffer
+ * consistency! */
+ copy_buffer( ReqData, SECTOR_BUFFER(ReqSector) );
+ }
+ }
#endif
if (SelectedDrive != drive) {
@@ -708,7 +707,7 @@
static void fd_seek(void)
{
- unsigned long flags;
+ unsigned long flags;
DPRINT(("fd_seek() to track %d (unit[SelectedDrive].track=%d)\n", ReqTrack,
unit[SelectedDrive].track));
if (unit[SelectedDrive].track == ReqTrack <<
@@ -719,14 +718,14 @@
FDC1772_WRITE(FDC1772REG_DATA, ReqTrack <<
unit[SelectedDrive].disktype->stretch);
udelay(25);
- save_flags(flags);
- cliIF();
+ save_flags(flags);
+ clf();
SET_IRQ_HANDLER(fd_seek_done);
FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK | unit[SelectedDrive].steprate |
/* DAG */
(MotorOn?FDC1772CMDADD_H:0));
- restore_flags(flags);
+ restore_flags(flags);
MotorOn = 1;
set_head_settle_flag();
START_TIMEOUT();
@@ -776,13 +775,10 @@
paddr = (unsigned long) ReqData;
rwflag = 0x100;
} else {
+ paddr = (unsigned long) PhysDMABuffer;
#ifdef TRACKBUFFER
- if (read_track)
- paddr = (unsigned long)PhysTrackBuffer;
- else
- paddr =(unsigned long)PhysDMABuffer;
-#else
- paddr = (unsigned long)PhysDMABuffer;
+ if (read_track)
+ paddr = (unsigned long)PhysTrackBuffer;
#endif
rwflag = 0;
}
@@ -794,9 +790,9 @@
/*DPRINT(("fd_rwsec() before start sector \n")); */
/* Start sector of this operation */
#ifdef TRACKBUFFER
- FDC1772_WRITE( FDC1772REG_SECTOR, !read_track ? ReqSector : 1 );
+ FDC1772_WRITE( FDC1772REG_SECTOR, !read_track ? ReqSector : 1 );
#else
- FDC1772_WRITE( FDC1772REG_SECTOR, ReqSector );
+ FDC1772_WRITE( FDC1772REG_SECTOR, ReqSector );
#endif
/* Cheat for track if stretch != 0 */
@@ -810,12 +806,12 @@
DPRINT(("fd_rwsec() before setup DMA \n"));
/* Setup DMA - Heavily modified by DAG */
save_flags(flags);
- cliIF();
+ clf();
disable_dma(FLOPPY_DMA);
set_dma_mode(FLOPPY_DMA, rwflag ? DMA_MODE_WRITE : DMA_MODE_READ);
set_dma_addr(FLOPPY_DMA, (long) paddr); /* DAG - changed from Atari specific */
#ifdef TRACKBUFFER
- set_dma_count(FLOPPY_DMA,(!read_track ? 1 : unit[SelectedDrive].disktype->spt)*512);
+ set_dma_count(FLOPPY_DMA,(!read_track ? 1 : unit[SelectedDrive].disktype->spt)*512);
#else
set_dma_count(FLOPPY_DMA, 512); /* Block/sector size - going to have to change */
#endif
@@ -825,14 +821,14 @@
/* Now give it something to do */
FDC1772_WRITE(FDC1772REG_CMD, (rwflag ? (FDC1772CMD_WRSEC | FDC1772CMDADD_P) :
#ifdef TRACKBUFFER
- (FDC1772CMD_RDSEC | (read_track ? FDC1772CMDADD_M : 0) |
+ (FDC1772CMD_RDSEC | (read_track ? FDC1772CMDADD_M : 0) |
/* Hmm - the idea here is to stop the FDC spinning the disc
up when we know that we already still have it spinning */
(MotorOn?FDC1772CMDADD_H:0))
#else
- FDC1772CMD_RDSEC
+ FDC1772CMD_RDSEC
#endif
- ));
+ ));
restore_flags(flags);
DPRINT(("fd_rwsec() after DMA setup flags=0x%08x\n", flags));
@@ -845,20 +841,19 @@
/* wait for interrupt */
#ifdef TRACKBUFFER
- if (read_track) {
- /* If reading a whole track, wait about one disk rotation and
- * then check if all sectors are read. The FDC will even
- * search for the first non-existant sector and need 1 sec to
- * recognise that it isn't present :-(
- */
- del_timer( &readtrack_timer );
- readtrack_timer.function = fd_readtrack_check;
- readtrack_timer.expires = jiffies + HZ/5 + (old_motoron ? 0 : HZ);
- /* 1 rot. + 5 rot.s if motor was off */
- DPRINT(("Setting readtrack_timer to %d @ %d\n",readtrack_timer.expires,jiffies));
- add_timer( &readtrack_timer );
- MultReadInProgress = 1;
- }
+ if (read_track) {
+ /*
+ * If reading a whole track, wait about one disk rotation and
+ * then check if all sectors are read. The FDC will even
+ * search for the first non-existant sector and need 1 sec to
+ * recognise that it isn't present :-(
+ */
+ /* 1 rot. + 5 rot.s if motor was off */
+ mod_timer(&readtrack_timer, jiffies + HZ/5 + (old_motoron ? 0 : HZ));
+ DPRINT(("Setting readtrack_timer to %d @ %d\n",
+ readtrack_timer.expires,jiffies));
+ MultReadInProgress = 1;
+ }
#endif
/*DPRINT(("fd_rwsec() before START_TIMEOUT \n")); */
@@ -869,55 +864,54 @@
#ifdef TRACKBUFFER
-static void fd_readtrack_check( unsigned long dummy )
+static void fd_readtrack_check(unsigned long dummy)
+{
+ unsigned long flags, addr;
+ extern unsigned char *fdc1772_dataaddr;
+
+ DPRINT(("fd_readtrack_check @ %d\n",jiffies));
+
+ save_flags(flags);
+ clf();
-{ unsigned long flags, addr;
- extern unsigned char *fdc1772_dataaddr;
+ del_timer( &readtrack_timer );
+
+ if (!MultReadInProgress) {
+ /* This prevents a race condition that could arise if the
+ * interrupt is triggered while the calling of this timer
+ * callback function takes place. The IRQ function then has
+ * already cleared 'MultReadInProgress' when control flow
+ * gets here.
+ */
+ restore_flags(flags);
+ return;
+ }
- DPRINT(("fd_readtrack_check @ %d\n",jiffies));
+ /* get the current DMA address */
+ addr=(unsigned long)fdc1772_dataaddr; /* DAG - ? */
+ DPRINT(("fd_readtrack_check: addr=%x PhysTrackBuffer=%x\n",addr,PhysTrackBuffer));
+
+ if (addr >= (unsigned int)PhysTrackBuffer + unit[SelectedDrive].disktype->spt*512) {
+ /* already read enough data, force an FDC interrupt to stop
+ * the read operation
+ */
+ SET_IRQ_HANDLER( NULL );
+ restore_flags(flags);
+ DPRINT(("fd_readtrack_check(): done\n"));
+ FDC1772_WRITE( FDC1772REG_CMD, FDC1772CMD_FORCI );
+ udelay(25);
- save_flags(flags);
- cliIF();
-
- del_timer( &readtrack_timer );
-
- if (!MultReadInProgress) {
- /* This prevents a race condition that could arise if the
- * interrupt is triggered while the calling of this timer
- * callback function takes place. The IRQ function then has
- * already cleared 'MultReadInProgress' when control flow
- * gets here.
- */
- restore_flags(flags);
- return;
- }
-
- /* get the current DMA address */
- addr=fdc1772_dataaddr; /* DAG - ? */
- DPRINT(("fd_readtrack_check: addr=%x PhysTrackBuffer=%x\n",addr,PhysTrackBuffer));
-
- if (addr >= PhysTrackBuffer + unit[SelectedDrive].disktype->spt*512) {
- /* already read enough data, force an FDC interrupt to stop
- * the read operation
- */
- SET_IRQ_HANDLER( NULL );
- restore_flags(flags);
- DPRINT(("fd_readtrack_check(): done\n"));
- FDC1772_WRITE( FDC1772REG_CMD, FDC1772CMD_FORCI );
- udelay(25);
-
- /* No error until now -- the FDC would have interrupted
- * otherwise!
- */
- fd_rwsec_done( 0 );
- }
- else {
- /* not yet finished, wait another tenth rotation */
- restore_flags(flags);
- DPRINT(("fd_readtrack_check(): not yet finished\n"));
- readtrack_timer.expires = jiffies + HZ/5/10;
- add_timer( &readtrack_timer );
- }
+ /* No error until now -- the FDC would have interrupted
+ * otherwise!
+ */
+ fd_rwsec_done( 0 );
+ } else {
+ /* not yet finished, wait another tenth rotation */
+ restore_flags(flags);
+ DPRINT(("fd_readtrack_check(): not yet finished\n"));
+ readtrack_timer.expires = jiffies + HZ/5/10;
+ add_timer( &readtrack_timer );
+ }
}
#endif
@@ -929,13 +923,15 @@
DPRINT(("fd_rwsec_done() status=%d @ %d\n", status,jiffies));
#ifdef TRACKBUFFER
- if (read_track && !MultReadInProgress) return;
- MultReadInProgress = 0;
+ if (read_track && !MultReadInProgress)
+ return;
+
+ MultReadInProgress = 0;
- STOP_TIMEOUT();
+ STOP_TIMEOUT();
- if (read_track)
- del_timer( &readtrack_timer );
+ if (read_track)
+ del_timer( &readtrack_timer );
#endif
@@ -951,13 +947,13 @@
}
if ((status & FDC1772STAT_RECNF)
#ifdef TRACKBUFFER
- /* RECNF is no error after a multiple read when the FDC
- * searched for a non-existant sector!
- */
- && !(read_track &&
- FDC1772_READ(FDC1772REG_SECTOR) > unit[SelectedDrive].disktype->spt)
+ /* RECNF is no error after a multiple read when the FDC
+ * searched for a non-existant sector!
+ */
+ && !(read_track &&
+ FDC1772_READ(FDC1772REG_SECTOR) > unit[SelectedDrive].disktype->spt)
#endif
- ) {
+ ) {
if (Probing) {
if (unit[SelectedDrive].disktype > disk_type) {
/* try another disk type */
@@ -978,7 +974,7 @@
if (Probing) {
setup_req_params(SelectedDrive);
#ifdef TRACKBUFFER
- BufferDrive = -1;
+ BufferDrive = -1;
#endif
do_fd_action(SelectedDrive);
return;
@@ -1001,19 +997,16 @@
if (ReqCmd == READ) {
#ifdef TRACKBUFFER
- if (!read_track)
- {
- /*cache_clear (PhysDMABuffer, 512);*/
- copy_buffer (DMABuffer, ReqData);
- }
- else
- {
- /*cache_clear (PhysTrackBuffer, MAX_SECTORS * 512);*/
- BufferDrive = SelectedDrive;
- BufferSide = ReqSide;
- BufferTrack = ReqTrack;
- copy_buffer (SECTOR_BUFFER (ReqSector), ReqData);
- }
+ if (!read_track) {
+ /*cache_clear (PhysDMABuffer, 512);*/
+ copy_buffer (DMABuffer, ReqData);
+ } else {
+ /*cache_clear (PhysTrackBuffer, FD1772_MAX_SECTORS * 512);*/
+ BufferDrive = SelectedDrive;
+ BufferSide = ReqSide;
+ BufferTrack = ReqTrack;
+ copy_buffer (SECTOR_BUFFER (ReqSector), ReqData);
+ }
#else
/*cache_clear( PhysDMABuffer, 512 ); */
copy_buffer(DMABuffer, ReqData);
@@ -1032,9 +1025,9 @@
}
return;
- err_end:
+err_end:
#ifdef TRACKBUFFER
- BufferDrive = -1;
+ BufferDrive = -1;
#endif
fd_error();
@@ -1118,10 +1111,8 @@
/* Prevent "aliased" accesses. */
-static fd_ref[4] =
-{0, 0, 0, 0};
-static fd_device[4] =
-{0, 0, 0, 0};
+static int fd_ref[4];
+static int fd_device[4];
/*
* Current device number. Taken either from the block header or from the
@@ -1182,7 +1173,7 @@
if (test_bit(drive, &changed_floppies) || test_bit(drive, &fake_change)
|| unit[drive].disktype == 0) {
#ifdef TRACKBUFFER
- BufferDrive = -1;
+ BufferDrive = -1;
#endif
clear_bit(drive, &fake_change);
clear_bit(drive, &changed_floppies);
@@ -1214,7 +1205,7 @@
ReqData = ReqBuffer + 512 * ReqCnt;
#ifdef TRACKBUFFER
- read_track = (ReqCmd == READ && CURRENT_ERRORS == 0);
+ read_track = (ReqCmd == READ && CURRENT_ERRORS == 0);
#endif
DPRINT(("Request params: Si=%d Tr=%d Se=%d Data=%08lx\n", ReqSide,
@@ -1234,7 +1225,7 @@
if (!QUEUE_EMPTY && CURRENT->rq_status == RQ_INACTIVE)
goto the_end;
- repeat:
+repeat:
if (QUEUE_EMPTY)
goto the_end;
@@ -1293,25 +1284,25 @@
return;
- the_end:
+the_end:
finish_fdc();
}
static void fd1772_checkint(void)
{
- extern int fdc1772_bytestogo;
+ extern int fdc1772_bytestogo;
- /*printk("fd1772_checkint %d\n",fdc1772_fdc_int_done);*/
- if (fdc1772_fdc_int_done)
- floppy_irqconsequencehandler();
- if ((MultReadInProgress) && (fdc1772_bytestogo==0)) fd_readtrack_check(0);
- if (fdc_busy) {
- queue_task(&fd1772_tq,&tq_immediate);
- mark_bh(IMMEDIATE_BH);
- };
-};
+ /*printk("fd1772_checkint %d\n",fdc1772_fdc_int_done);*/
+ if (fdc1772_fdc_int_done)
+ floppy_irqconsequencehandler();
+ if ((MultReadInProgress) && (fdc1772_bytestogo==0)) fd_readtrack_check(0);
+ if (fdc_busy) {
+ queue_task(&fd1772_tq,&tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+ }
+}
-void do_fd_request(void)
+void do_fd_request(request_queue_t* q)
{
unsigned long flags;
@@ -1329,8 +1320,8 @@
redo_fd_request();
- queue_task(&fd1772_tq,&tq_immediate);
- mark_bh(IMMEDIATE_BH);
+ queue_task(&fd1772_tq,&tq_immediate);
+ mark_bh(IMMEDIATE_BH);
}
@@ -1338,7 +1329,7 @@
{
/* invalidate the buffer track to force a reread */
#ifdef TRACKBUFFER
- BufferDrive = -1;
+ BufferDrive = -1;
#endif
set_bit(rdev & 3, &fake_change);
@@ -1352,9 +1343,6 @@
int drive, device;
device = inode->i_rdev;
- switch (cmd) {
- RO_IOCTLS(inode->i_rdev, param);
- }
drive = MINOR(device);
switch (cmd) {
case FDFMTBEG:
@@ -1428,7 +1416,7 @@
/* if (!(mfp.par_dt_reg & 0x20))
break; */
/* Well this is my nearest guess - quit when we get an FDC interrupt */
- if (IOC_FIQSTAT & 2)
+ if (ioc_readb(IOC_FIQSTAT) & 2)
break;
}
@@ -1451,7 +1439,7 @@
FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK);
printk("fd_test_drive_present: just before wait for int\n");
/* DAG: Guess means wait for interrupt */
- while (!(IOC_FIQSTAT & 2));
+ while (!(ioc_readb(IOC_FIQSTAT) & 2));
printk("fd_test_drive_present: just after wait for int\n");
status = FDC1772_READ(FDC1772REG_STATUS);
}
@@ -1553,7 +1541,7 @@
}
-static void floppy_release(struct inode *inode, struct file *filp)
+static int floppy_release(struct inode *inode, struct file *filp)
{
int drive = MINOR(inode->i_rdev) & 3;
@@ -1563,11 +1551,12 @@
printk("floppy_release with fd_ref == 0");
fd_ref[drive] = 0;
}
+
+ return 0;
}
static struct block_device_operations floppy_fops =
{
- owner: THIS_MODULE,
open: floppy_open,
release: floppy_release,
ioctl: fd_ioctl,
@@ -1580,7 +1569,7 @@
{
int i;
- if (!machine_is_arc())
+ if (!machine_is_archimedes())
return 0;
if (register_blkdev(MAJOR_NR, "fd", &floppy_fops)) {
@@ -1603,25 +1592,15 @@
/* initialize variables */
SelectedDrive = -1;
#ifdef TRACKBUFFER
- BufferDrive = -1;
-#endif
-
- /* initialize check_change timer */
- init_timer(&fd_timer);
- fd_timer.function = check_change;
-}
-
-#ifdef TRACKBUFFER
- DMABuffer = (char *)kmalloc((MAX_SECTORS+1)*512,GFP_KERNEL); /* Atari uses 512 - I want to eventually cope with 1K sectors */
- TrackBuffer = DMABuffer + 512;
+ BufferDrive = BufferSide = BufferTrack = -1;
+ /* Atari uses 512 - I want to eventually cope with 1K sectors */
+ DMABuffer = (char *)kmalloc((FD1772_MAX_SECTORS+1)*512,GFP_KERNEL);
+ TrackBuffer = DMABuffer + 512;
#else
/* Allocate memory for the DMAbuffer - on the Atari this takes it
out of some special memory... */
DMABuffer = (char *) kmalloc(2048); /* Copes with pretty large sectors */
#endif
-#ifdef TRACKBUFFER
- BufferDrive = BufferSide = BufferTrack = -1;
-#endif
for (i = 0; i < FD_MAX_UNITS; i++) {
unit[i].track = -1;
@@ -1635,17 +1614,13 @@
blk_size[MAJOR_NR] = floppy_sizes;
blksize_size[MAJOR_NR] = floppy_blocksizes;
- blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
+ blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
config_types();
return 0;
}
-/* Just a dummy at the moment */
-void floppy_setup(char *str, int *ints)
+void floppy_eject(void)
{
-}
-
-void floppy_eject(void) {
}
Index: mfmhd.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acorn/block/mfmhd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- mfmhd.c 14 Jan 2001 18:59:31 -0000 1.1.1.1
+++ mfmhd.c 9 Apr 2002 14:00:57 -0000 1.2
@@ -560,7 +560,7 @@
};
}; /* Result read */
- /*console_printf ("mfm_rw_intr nearexit [%02X]\n", inb(mfm_IRQPollLoc)); */
+ /*console_printf ("mfm_rw_intr nearexit [%02X]\n", __raw_readb(mfm_IRQPollLoc)); */
/* If end of command move on */
if (mfm_status & (STAT_CED)) {
@@ -1208,9 +1208,6 @@
return -EFAULT;
return 0;
- case BLKGETSIZE:
- return put_user (mfm[minor].nr_sects, (long *)arg);
-
case BLKFRASET:
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
@@ -1228,6 +1225,8 @@
return -EACCES;
return mfm_reread_partitions(dev);
+ case BLKGETSIZE:
+ case BLKGETSIZE64:
case BLKFLSBUF:
case BLKROSET:
case BLKROGET:
@@ -1248,7 +1247,6 @@
if (dev >= mfm_drives)
return -ENODEV;
- MOD_INC_USE_COUNT;
while (mfm_info[dev].busy)
sleep_on (&mfm_wait_open);
@@ -1263,7 +1261,6 @@
static int mfm_release(struct inode *inode, struct file *file)
{
mfm_info[DEVICE_NR(MINOR(inode->i_rdev))].access_count--;
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -1311,19 +1308,18 @@
}
static struct gendisk mfm_gendisk = {
- MAJOR_NR, /* Major number */
- "mfm", /* Major name */
- 6, /* Bits to shift to get real from partition */
- 1 << 6, /* Number of partitions per real */
- mfm, /* hd struct */
- mfm_sizes, /* block sizes */
- 0, /* number */
- (void *) mfm_info, /* internal */
- NULL /* next */
+ major: MAJOR_NR,
+ major_name: "mfm",
+ minor_shift: 6,
+ max_p: 1 << 6,
+ part: mfm,
+ sizes: mfm_sizes,
+ real_devices: (void *)mfm_info,
};
static struct block_device_operations mfm_fops =
{
+ owner: THIS_MODULE,
open: mfm_open,
release: mfm_release,
ioctl: mfm_ioctl,
@@ -1425,7 +1421,7 @@
}
mfm_addr = ecard_address(ecs, ECARD_IOC, ECARD_MEDIUM) + 0x800;
- mfm_IRQPollLoc = mfm_addr + 0x400;
+ mfm_IRQPollLoc = ioaddr(mfm_addr + 0x400);
mfm_irqenable = mfm_IRQPollLoc;
mfm_irq = ecs->irq;
irqmask = 0x08;
@@ -1444,16 +1440,13 @@
/* Stuff for the assembler routines to get to */
hdc63463_baseaddress = ioaddr(mfm_addr);
- hdc63463_irqpolladdress = ioaddr(mfm_IRQPollLoc);
+ hdc63463_irqpolladdress = mfm_IRQPollLoc;
hdc63463_irqpollmask = irqmask;
blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
read_ahead[MAJOR_NR] = 8; /* 8 sector (4kB?) read ahread */
-#ifndef MODULE
- mfm_gendisk.next = gendisk_head;
- gendisk_head = &mfm_gendisk;
-#endif
+ add_gendisk(&mfm_gendisk);
Busy = 0;
lastspecifieddrive = -1;
@@ -1485,14 +1478,7 @@
for (i = maxp - 1; i >= 0; i--) {
int minor = start + i;
- kdev_t devi = MKDEV(MAJOR_NR, minor);
- struct super_block *sb = get_super(devi);
-
- sync_dev (devi);
- if (sb)
- invalidate_inodes (sb);
- invalidate_buffers (devi);
-
+ invalidate_device (MKDEV(MAJOR_NR, minor), 1);
mfm_gendisk.part[minor].start_sect = 0;
mfm_gendisk.part[minor].nr_sects = 0;
}
@@ -1508,6 +1494,10 @@
}
#ifdef MODULE
+
+EXPORT_NO_SYMBOLS;
+MODULE_LICENSE("GPL");
+
int init_module(void)
{
return mfm_init();
@@ -1519,6 +1509,7 @@
outw (0, mfm_irqenable); /* Required to enable IRQs from MFM podule */
free_irq(mfm_irq, NULL);
unregister_blkdev(MAJOR_NR, "mfm");
+ del_gendisk(&mfm_gendisk);
if (ecs)
ecard_release(ecs);
if (mfm_addr)
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:21
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm
In directory usw-pr-cvs1:/tmp/cvs-serv9090/vax/mm
Modified Files:
fault.c init.c pgalloc.c pgtable.c
Log Message:
synch 2.4.15 commit 14
Index: fault.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/fault.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- fault.c 11 Sep 2001 19:25:15 -0000 1.13
+++ fault.c 9 Apr 2002 13:50:55 -0000 1.14
@@ -47,7 +47,7 @@
#define REASON_WRITE (1<<2)
#undef VAX_MM_DEBUG
-#undef VAX_MM_DEBUG_USER_FAULTS
+#define VAX_MM_DEBUG_USER_FAULTS
static void
do_page_fault(struct accvio_info *info, struct pt_regs *regs)
@@ -74,7 +74,7 @@
if (in_interrupt() || !mm)
goto no_context;
- down (&mm->mmap_sem);
+ down_read (&mm->mmap_sem);
vma = find_vma(mm, address);
@@ -115,7 +115,7 @@
goto out_of_memory;
}
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
return;
/*
@@ -124,7 +124,7 @@
*/
bad_area:
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
if (user_mode(regs)) {
#ifdef VAX_MM_DEBUG_USER_FAULTS
@@ -136,7 +136,7 @@
show_regs(regs);
show_cpu_regs();
printk("\nStack dump\n");
- hex_dump((void *)((regs->fp&~0xf), 512);
+ hex_dump( (void *)(regs->fp&~0xf), 512);
printk("do_page_fault: sending SIGSEGV\n");
#endif
@@ -180,7 +180,7 @@
schedule();
goto survive;
}
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
if (user_mode(regs))
{
printk("VM: killing process %s\n", current->comm);
@@ -189,7 +189,7 @@
goto no_context;
do_sigbus:
- up(&mm->mmap_sem);
+ up_read(&mm->mmap_sem);
/*
* Send a sigbus, regardless of whether we were in kernel
Index: init.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- init.c 11 Sep 2001 19:25:15 -0000 1.18
+++ init.c 9 Apr 2002 13:50:55 -0000 1.19
@@ -36,7 +36,7 @@
context in task 0. */
pgd_t swapper_pg_dir[PTRS_PER_PGD];
-pmd_t swapper_pm_dir[2048]; /* two pages for the kernel pmd */
+pmd_t swapper_pm_dir[2048] __attribute__ ((__aligned__(8192))); /* two pages for the kernel S0 pmd */
/*
* In other architectures, paging_init sets up the kernel's page tables.
@@ -54,16 +54,14 @@
/* set up pmd */
swapper_pg_dir[2].pmd = (unsigned int)swapper_pm_dir;
- swapper_pg_dir[2].pmd2 = (unsigned int)&swapper_pm_dir[1024];
- /* FIXME: I _really_ dont like this flag. */
- pmd_val(swapper_pm_dir[PGD_SPECIAL]) = (unsigned long)swapper_pg_dir | 0x1;
-
+
/* FIXME: This is where the VMALLOC stuff from head.S should go */
printk("VAXMM: Initialising mm layer for %d tasks of size %dMB\n",TASK_MAXUPRC,(TASK_WSMAX>>20));
- /* Size the process page table slots. See asm/mm/task.h for details
+ /*
+ * Size the process page table slots. See asm/mm/task.h for details
* The _START and _END macros are from pgtable.h
- * This is all in PAGELETS and HWPTES, hence no set_pte
+ * This is all in PAGELETS and HWPTES, hence no set_pte
*/
pte = (hwpte_t *)GET_SPTE_VIRT(VMALLOC_END);
lastpte = (hwpte_t *)GET_SPTE_VIRT(TASKPTE_START);
@@ -205,3 +203,30 @@
val->mem_unit = PAGE_SIZE;
return;
}
+
+/*
+ * atp Mar 2002.
+ * The pmd cache is now separate, as it is a two page block of
+ * memory. ptes are 1 page. I'd like to separate the pmd from the
+ * pgtable_cache_sz. Later.
+ */
+int do_check_pgt_cache(int low, int high)
+{
+ int freed = 0;
+
+ if(pgtable_cache_size > high) {
+ do {
+// if(pmd_quicklist) {
+// free_pmd_slow(pmd_alloc_one_fast(NULL, 0));
+// freed++;
+// freed++; /* a two page block */
+// }
+ if(pte_quicklist){
+ free_pte_slow(pte_alloc_one_fast(NULL,0));
+ freed++;
+ }
+ } while(pgtable_cache_size > low);
+ }
+ return freed;
+}
+
Index: pgalloc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/pgalloc.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- pgalloc.c 2 Sep 2001 20:50:16 -0000 1.8
+++ pgalloc.c 9 Apr 2002 13:50:55 -0000 1.9
@@ -42,7 +42,7 @@
}
/* allocate a pgd */
-pgd_t *pgd_alloc(void)
+pgd_t *pgd_alloc(struct mm_struct *mm)
{
/* this is rather wasteful, as only a few longwords are
* used in the entire 4kb page. Perhaps we can do something
@@ -98,7 +98,6 @@
{
/* wipe a pgd structure carefully -- this is probably overkill */
pgdp->pmd=0;
- pgdp->pmd2=0;
if (pgdp->segment) {
/* p1br points at what would be page mapping 0x40000000 */
@@ -111,109 +110,64 @@
}
}
-/* bit of a null op - grab a page off the list - pmd_alloc does the real work */
-pmd_t *get_pmd_slow(void)
-{
- return (pmd_t *) __get_free_page(GFP_KERNEL);
-}
-/* allocate a 'pmd'. In fact we will set it here too, to avoid confusion */
-pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address)
-{
- /* we want to allocate two pages and remap them into the
- * appropriate pmd slot in the taskslot. */
-
+/* we used to call this routine pmd_alloc. At vn 2.4.3 pmd_alloc got removed
+ * to include/linux/mm.h, and we have now pgd_populate and pmd_populate.
+ * this is pgd_populate */
+void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
+{
+ /*
+ * we have a two page block of memory, allocated via pmd_alloc by
+ * pmd_alloc_one. This needs to be remapped into the appropriate pmd
+ * section in the taskslot in S0 space.
+ * recap: The taskslot holds all the ptes in a contiguous section of
+ * S0 address space. The amounts of virtual address space are
+ * mapped out at boot time, from the constants in asm-vax/mm/task.h
+ * The first four pages of this region are "pmd" pages, used as
+ * the bookkeeping information, which is normally done by the pgd
+ * page on 32bit processors. But we have hijacked the pgds to
+ * represent the four VAX memory segments, and to hold all the
+ * base/length register information and other related stuff.
+ *
+ * updated atp Mar 2002. pgd_populate, remove PGD_SPECIAL botch.
+ */
unsigned int is_p1;
- pmd_t *pmdpage;
pmd_t *s0addr;
- unsigned long adjaddr;
+
is_p1 = pgd->segment;
- adjaddr = pmd_index(address);
+
#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM: Calling pmd_alloc with (pgd=%8p,pmd=%8lx,address %8lx, adjaddr %8lx)\n",pgd,pgd->pmd,address,adjaddr);
+ printk(KERN_DEBUG "VAXMM: Calling pgd_populate with (mm=%8p, pgd=%8p, pmd=%8lx\n",mm,pgd,pgd->pmd);
#endif
-
/* sanity check */
- /* FIXME: is this pgd_none? */
if (pgd->pmd) {
#ifdef VAX_MM_PGALLOC_DEBUG
printk(KERN_DEBUG "VAXMM: Calling pmd_alloc on already allocated page (pgd=%8p,pmd=%8lx)\n",pgd,pgd->pmd);
#endif
- return (pmd_t *)pgd->pmd+adjaddr;
- }
-
- /* grab the first page */
- pmdpage = get_pmd_fast();
-
- if (!pmdpage) {
- /* didnt work */
- pmdpage = get_pmd_slow();
+ return;
}
- if (!pmdpage) {
- /* didnt work again - give up */
- printk(KERN_ERR "VAXMM: unable to allocate a pmd for pgd (%8p)\n",pgd );
- return NULL;
- }
- /* calculate which bit of the page table area this page fits into */
- s0addr = (pmd_t *)pgd->slot; /* base of the slot */
-
+ /* calculate which bit of the page table area this page fits into */
+ s0addr = (pmd_t *)pgd->slot; /* base of the slot */
s0addr += (is_p1) ? (P1PMD_OFFSET/sizeof(pmd_t)): (P0PMD_OFFSET/sizeof(pmd_t));
- /* remap and clear this page */
- remap_and_clear_pte_page(s0addr, (pte_t *)pmdpage);
+ /* remap and clear the first page */
+ remap_and_clear_pte_page(s0addr, (pte_t *)pmd);
- /* this is the first page in our pmd table. */
+ /* this is the pointer to our pmd table. */
pgd->pmd=(unsigned long)s0addr;
- /* now, do the same for the second */
- pmdpage = get_pmd_fast();
-
- if (!pmdpage) {
- pmdpage = get_pmd_slow();
- }
- if (!pmdpage) {
- printk(KERN_ERR "VAXMM: unable to allocate a pmd for pgd (%8p)\n",pgd );
- free_pmd_fast((pmd_t *)get_pageaddr_from_pte((pte_t *)pgd->pmd));
- remap_pte_invalidate((pmd_t *)pgd->pmd);
- return NULL;
- }
-
+ /* this is a two page block of memory */
s0addr += (PAGE_SIZE/sizeof(pmd_t));
+ pmd += (PAGE_SIZE/sizeof(pmd_t));
- remap_and_clear_pte_page(s0addr, (pte_t *)pmdpage);
- /* and the second page in our pmd table. */
- pgd->pmd2=(unsigned long)s0addr;
+ remap_and_clear_pte_page(s0addr, (pte_t *)pmd);
#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM: pmd_alloc: pgd %8p, pgd->br %8lx, pgd->lr %8lx, \n\tpgd->pmd %8lx, pgd->pmd2 %8lx\n",pgd,pgd->br, pgd->lr, pgd->pmd,pgd->pmd2);
+ printk(KERN_DEBUG "VAXMM: pmd_alloc: pgd %8p, pgd->br %8lx, pgd->lr %8lx, \n\tpgd->pmd %8lx\n",pgd,pgd->br, pgd->lr, pgd->pmd);
#endif
- /* pages allocated, now store the backpointer we need in pte_alloc
- * in the last slot in the address slot. Comfortably beyond where
- * we expect to really be allocating memory. */
- pmdpage = (pmd_t *)pgd->pmd;
-
- /* FIXME: I _really_ dont like this flag. */
- pmd_val(pmdpage[PGD_SPECIAL]) = (unsigned long)pgd | 0x1;
-
- return (pmd_t *) pgd->pmd+adjaddr;
-}
-
-/* the kernel pmd is in mm/init.c */
-extern pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
-{
- /* we rely on init.c to set up the pmd pointers in the pgd for us.
- * This leaves us just a pmd_offset sort of job */
-#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM: pmd_alloc_kernel: pgd %8p, pgd->pmd %8lx, address %8lx\n",pgd,pgd->pmd,address);
-#endif
- return pmd_offset(pgd, address);
-}
-
-extern void pmd_free_kernel(pmd_t *pmd)
-{
- return;
+ return;
}
/* This inverts the remapping done in remap_and_clear */
@@ -232,13 +186,13 @@
void pmd_free(pmd_t *pmd)
{
pmd_t *pmdp;
- pmdp = pmd+(PAGE_SIZE/4);
+ pmdp = pmd+(PAGE_SIZE/sizeof(pmd_t));
#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM:pmd_free: freeing pmd %p, pmd2 %p\n",pmd,pmdp);
+ printk(KERN_DEBUG "VAXMM:pmd_free: freeing pmd %p\n",pmd);
#endif
- free_pmd_fast((pmd_t *)get_pageaddr_from_pte((pte_t *)pmdp));
+ /* This is a double page block */
free_pmd_fast((pmd_t *)get_pageaddr_from_pte((pte_t *)pmd));
- /* invalidate the S0 ptes that map this */
+ /* invalidate the S0 ptes that map this, one per page */
remap_pte_invalidate(pmd);
remap_pte_invalidate(pmdp);
}
@@ -306,93 +260,6 @@
}
/*
- * Notes on pte_alloc_kernel()
- *
- * It is called from mm/vmalloc.c in alloc_area_pmd()
- *
- * Any extension to the SPT needs to be physically contiguous with the rest of the
- * system page table.
- * Things to consider:
- * If you want to allocate a page to hold a pte for a
- * new S0 address, (where this address is higher than SBR+SLR) then that
- * new page table page must be allocated at the exact physical page
- * That maps that S0 address. I.e.
- * To map a virtual address X you need to allocate the physical
- * page containing the address
- *
- * PFN = ( (X-PAGE_OFFSET) >> PAGE_SHIFT)
- *
- * PTE address (physical memory) = (PFN*4)+SBR
- * Physical page address = (PTE address) & ~(PAGE_MASK)
- * SLR = ((Physical page address + (1<<PAGE_SHIFT)) - SBR) / 4.
- *
- * If that physical page is already occupied, the contents must
- * be ejected. This takes time, and can lead to deadlock, particularly
- * if a dirty page needs to be written to disk/swap.
- * Also, any physical pages that are in between the previous end of the
- * system page table, and the new end (SBR+SLR) will need to be cleared,
- * otherwise random rubbish will end up in the system page table.
- *
- * This requirement of a contiguous range of physical pages, at a precise
- * address range is hard to meet on a system that has been running for any
- * length of time.
- *
- * One way to do this by "locking up the machine", moving the contents
- * of the physical pages needed to pages on the freelist, rewriting the PTE's
- * to point at the new physical pages, and then allocating and expanding
- * the system page table. No scheduling allowed. Also how you locate all
- * of the references to a given physical page so that you can rewrite them
- * without conducting a thorough search of all page tables (possibly
- * incurring page faults for those P0 page tables that have been swapped out)
- * is not clear.
- *
- *
- * - At present I'm ducking this. We fix the S0 page table size at
- * boot time, and disallow dynamic expansion. atp Feb 2001.
- *
- * - we still need to implement this ... linux still calls it ..
- * - D.A. May 2001.
- *
- * - Indeed, however, the implementation is still not obvious to me.
- * atp July 2001.
- * - let me qualify that. pte_alloc_kernel is called infrequently.
- * Mostly by the VMALLOC stuff, which already has a VMALLOC_END check.
- * so the only reason for calling this is if we are in the middle of
- * some operation, outside of the vmalloc family, mapping system space.
- * Hence the current implementation suffices, and I cant see a reason
- * to implement an expandable s0 page table.
- */
-
-
-pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
-{
- pgd_t *pgdptr = (pgd_t *)&swapper_pg_dir[2];
- unsigned long int adjusted_address;
- unsigned long int spt_entry;
- pte_t *spte;
-
- adjusted_address = ((pmd - (pmd_t *)(pgdptr->pmd))<<(PAGE_SHIFT+7)) + (address&~PMD_MASK);
-#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM:pte_alloc_kernel: pmd, %p, address %8lx, adjaddr %8lx\n",pmd,address,adjusted_address);
-#endif
-
- /* note the lr in the system pgd is in PAGELETS */
- if (((adjusted_address) >> PAGELET_SHIFT) < (pgdptr->lr)) {
- /* fill in any bits missing. Perhaps we should do this when we set up the
- * SPT in init.c just to be consistent */
- if (pmd_val(*pmd)==0) {
- spt_entry = (pmd - (pmd_t *)(pgdptr->pmd))<< (PAGE_SHIFT+7) | PAGE_OFFSET;
- spte = GET_SPTE_VIRT(spt_entry);
- pmd_val(*pmd) = (unsigned long int)spte;
- }
- return pte_offset(pmd, adjusted_address);
- }
- else
- return NULL;
-}
-
-
-/*
* Allocate a page, to hold page table entries for a user process.
*
* We grab a random page. The only catch is that it must be virtually
@@ -410,43 +277,92 @@
* to the pgd, which is where the base and length register values are held.
*
* pmd is a pointer to the slot in our bogus pmd table we want to use.
+ *
+ * free_pte_fast:
+ * We may have to allocate many pages to hold ptes, as our page table is
+ * not sparse. So, we just pop the pte we have been given by the upper
+ * layers on the pte cache, and reallocate it as needed. Its not exactly
+ * in tune with all the page table locking done in pte_alloc, but this is
+ * square peg in a decidedly round hole, and the page table locking is one
+ * of the corners.
+ * We used to have our own pte_alloc_one. This is now called vax_pte_alloc_one.
+ *
+ * pte_alloc_kernel:
+ * If we get handed a request to map something into S0 or S1 space, then
+ * we dont do it. S0 page tables are fixed by the need to be contiguous
+ * in PHYSICAL memory. On a running system, expansion of or copying of the
+ * system page tables are almost impossible (its the "find me a couple of
+ * megabytes of continuous physical ram" problem).
+ *
+ * FIXMES: page table locking.
*/
-
-pte_t * pte_alloc(pmd_t * pmd, unsigned long address)
+void pmd_populate(struct mm_struct *mm, pmd_t * pmd, pte_t *pte)
{
pgd_t *pgdp;
pmd_t *pmd_basep, *s0addr;
- unsigned long int current_last_page,is_p1,target_page,npages,pte_number,adjusted_address;
+ unsigned long int current_last_page,pgd_segment,target_page;
+ unsigned long int npages,pte_number,adjusted_address, is_p1;
pte_t *pte_page;
pmd_t *pmdi;
long int direction,ii;
pmd_basep = (pmd_t *)((unsigned long)pmd & PTE_TASK_MASK); /* base of the pmd */
+ /* see note above */
+ free_pte_fast(pte);
+
#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM:pte_alloc: pmd_basep %8lx, pmd %8lx, pmd_val %8lx, address %8lx, pmd_index %8lx\n",pmd_basep,pmd,pmd_val(*pmd),address,pmd_index(address));
+ printk(KERN_DEBUG "VAXMM:pmd_populate: mm %8p, pgd %8lx, pmd %8lx, pmd_basep %8lx, pmd_val %8lx,\n",mm,mm->pgd,pmd,pmd_basep,pmd_val(*pmd));
#endif
- pgdp = (pgd_t *)(pmd_val(pmd_basep[PGD_SPECIAL]) & ~0x1);
-
-
- /* FIXME: should test pgdp. this is pointless otherwise */
- if ((!pgdp)||(pgd_none(*pgdp))) {
- printk(KERN_ERR "VAXMM: Bad PGD (%8p, from pmd %8p) in pte_alloc\n",pgdp,pmd_basep);
+ /*
+ * This is the base of the pgd array. We need to check which pgd
+ * entry we need. This is a bit clunky, but better than what was here
+ * before.
+ */
+ pgdp = mm->pgd;
+
+ if (!pgdp) {
+ printk(KERN_ERR "VAXMM: null pgd ptr in task mm struct %8p\n",mm);
goto give_segv;
}
- if (pgdp->pmd != (unsigned long)pmd_basep) {
- printk(KERN_ERR "VAXMM: Mismatched PGD (%8p, has pmd %8lx from pmd %8p) in pte_alloc\n",pgdp,pgdp->pmd,pmd_basep);
- goto give_segv;
+
+ /* decide on the segment we are in */
+ pgd_segment=0;
+ while ((pgdp[pgd_segment].pmd != (unsigned long)pmd_basep)&&(pgd_segment<4)) {
+ pgd_segment++;
}
- is_p1=pgdp->segment;
+ switch(pgd_segment) {
+ case 0:
+ case 1:
+ /* user segments */
+ is_p1=pgd_segment;
+ pgdp = &pgdp[pgd_segment];
+ break;
+ case 2:
+ /* pte_alloc_kernel?, should we free the pte here? */
+#ifdef VAX_MM_PGALLOC_DEBUG
+ printk(KERN_DEBUG "VAXMM:pmd_populate: kernel S0 segment pmd, %p, pte %8lx\n",pmd,pte);
+#endif
+ pgdp = &pgdp[2]; /* swapper_pg_dir */
+ pmd_populate_S0(pgdp, pmd);
+ return;
+ case 3:
+ default:
+ /* no match - something has gone very wrong. free ptes? send segv? */
+#ifdef VAX_MM_PGALLOC_DEBUG
+ printk(KERN_DEBUG "VAXMM:pmd_populate: kernel S1 segment pmd, %p, pte %8lx\n",pmd,pte);
+#endif
+ printk( KERN_ERR "VAXMM: pmd_populate: Attempting to set S1 pte. pmd, %p, pte %p\n",pmd,pte);
+ goto give_segv;
+ return;
+ }
/* make an adjusted address + calculate linear page table entry */
- adjusted_address = (((pmd-pmd_basep))<<(PAGE_SHIFT+7))+ (address&~PMD_MASK);
-
-
+ adjusted_address = (((pmd-pmd_basep))<<(PAGE_SHIFT+7));
+
/* enforce wsmax memory limits */
if (is_p1){
adjusted_address |= 0x40000000;
@@ -470,14 +386,14 @@
#ifdef VAX_MM_PGALLOC_DEBUG
printk(KERN_DEBUG "VAXMM: pte_alloc called on already allocated page (pte %8lx, lr %8lx)\n",pte_number,pgdp->lr);
#endif
- return pte_offset(pmd, adjusted_address);
+ return;
}
} else {
if ((pte_number) < (pgdp->lr)) {
#ifdef VAX_MM_PGALLOC_DEBUG
printk(KERN_DEBUG "VAXMM: pte_alloc called on already allocated page (pte %8lx, lr %8lx)\n",pte_number,pgdp->lr);
#endif
- return pte_offset(pmd, adjusted_address);
+ return;
}
}
@@ -499,8 +415,9 @@
direction = 1;
pmdi = pmd_basep+(current_last_page + 1);
}
+
for (ii=0; ii<npages; ii++) {
- if (!(pte_page=pte_alloc_one(pmdi))) {
+ if (!(pte_page=vax_pte_alloc_one(pmdi))) {
printk(KERN_ERR "VAXMM: Unable to expand process page table (pgd=%8p)\n",pgdp);
goto give_segv;
}
@@ -531,29 +448,70 @@
set_vaxmm_regs_p0(pgdp);
}
}
+
/* we flush tlb anways as we have touched S0 page tables */
flush_tlb_all();
- return pte_offset(pmd, adjusted_address);
+ return;
give_segv:
- printk(KERN_NOTICE "VAXMM pte_alloc: sending SIGSEGV to process %p\n",current);
+ printk(KERN_NOTICE "VAXMM pmd_populate: sending SIGSEGV to process %p\n",current);
force_sig(SIGSEGV,current);
- return NULL;
+ return;
} /* pte_alloc */
+/*
+ * Special case of a system page table pmd entry in the S0 region.
+ * These are never actually allocated, we just enter the existing
+ * allocated page into the system pmd table. Or die horribly if its outside
+ * the existing limits.
+ */
+void pmd_populate_S0(pgd_t *pgd, pmd_t *pmd)
+{
+ pmd_t *pmd_base;
+ unsigned long int page_address, pte_number;
+ pte_t *spte;
+
+ pmd_base = (pmd_t *)pgd->pmd;
+ /* get physical page address */
+ page_address = (((pmd-pmd_base))<<(PAGE_SHIFT+7));
+ /* The length register for S0 is in pagelets */
+ pte_number = (page_address>>PAGELET_SHIFT);
+ /* convert to a virtual address */
+ page_address |= PAGE_OFFSET;
+
+ if (pte_number >= pgd->lr) {
+ printk(KERN_ERR "VAXMM: attempting to access out of bounds S0 page table entry (address %8lx, pte=%8lx, limit=%8lx)\n",page_address,pte_number, pgd->lr);
+ vaxpanic("VAXMM: bugcheck!\n");
+ return;
+ }
+
+ /* calculate the appropriate system page table entry */
+ spte = GET_SPTE_VIRT(page_address);
+ /* and enter it into the page table */
+ *pmd = __pmd(spte);
+
+ return;
+}
/* allocate a page for the page table */
-pte_t * pte_alloc_one(pmd_t *pmd)
+/* This used to be called pte_alloc_one, until that name was used in the
+ * arch independent code. See notes above pmd_populate for why this is here
+ */
+pte_t * vax_pte_alloc_one(pmd_t *pmd)
{
- if (pmd_none(*pmd)) {
- pte_t *page = get_pte_fast();
-
- if (!page) return get_pte_slow();
- return page;
- }
- return (pte_t *) pmd_val(*pmd);
+ if (pmd_none(*pmd)) {
+ pte_t *page = pte_alloc_one_fast(NULL, 0);
+
+ if (!page) return pte_alloc_one(NULL, 0);
+
+ return page;
+ }
+ /* notreached */
+ return NULL;
}
+
+
/* free the page after recovering the original address */
void pte_free(pte_t *pte)
{
@@ -569,14 +527,6 @@
free_page((unsigned long int)pte);
}
-void pte_free_kernel(pte_t *pte)
-{
-#ifdef VAX_MM_PGALLOC_DEBUG
- printk(KERN_DEBUG "VAXMM: pte_free_kernel called on pte %8p\n",pte);
-#endif
- printk(KERN_DEBUG "VAXMM: pte_free_kernel called on pte %8p\n",pte);
- free_pte_fast(pte);
-}
/* Find an entry in the third-level page table.. */
#ifdef VAX_MM_PGALLOC_DEBUG
@@ -584,7 +534,7 @@
{
unsigned long int offset;
offset = (pmd_val(*dir)+(((address>>PAGE_SHIFT)&(PTRS_PER_PTE-1))<<SIZEOF_PTE_LOG2));
- printk(KERN_DEBUG "VAXMM:pte_offset: pmd %8p, address %8lx, pte_offset %8lx\n",dir, address, offset);
+// printk(KERN_DEBUG "VAXMM:pte_offset: pmd %8p, address %8lx, pte_offset %8lx\n",dir, address, offset);
return offset;
}
#else
@@ -593,27 +543,5 @@
return (pte_t *)(pmd_val(*dir)+(((address>>PAGE_SHIFT)&(PTRS_PER_PTE-1))<<SIZEOF_PTE_LOG2));
}
#endif
-/* get_pte_kernel_slow. allocate a page of PTEs for the S0 pagetable.
- * See comments in include/asm/mm/pgalloc.h for get_pte_kernel.
- */
-pte_t *get_pte_kernel_slow(pmd_t * pmd, unsigned long address)
-{
- return (pte_t *) NULL;
-}
-
-/* just want a page here - quite simple */
-/* bit of a null op - grab a page off the list - pte_alloc does the real work */
-pte_t *get_pte_slow(void)
-{
- unsigned long pte;
- pte = (unsigned long) __get_free_page(GFP_KERNEL);
-
- if (pte) {
- return (pte_t *) pte;
- } else {
- return NULL;
- }
- return NULL;
-}
Index: pgtable.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/pgtable.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- pgtable.c 23 Aug 2001 09:25:13 -0000 1.7
+++ pgtable.c 9 Apr 2002 13:50:56 -0000 1.8
@@ -37,20 +37,3 @@
flush_tlb_all();
}
-int do_check_pgt_cache(int low, int high)
-{
- /* implemented like everyone else has - D.A. */
- int freed = 0;
- if(pgtable_cache_size > high) {
- do {
-// if(pgd_quicklist)
-// free_pgd_slow(get_pgd_fast()), freed++;
-// if(pmd_quicklist)
-// free_pmd_slow(get_pmd_fast()), freed++;
- if(pte_quicklist)
- free_pte_slow(get_pte_fast()), freed++;
- } while(pgtable_cache_size > low);
- }
- return freed;
-}
-
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel
In directory usw-pr-cvs1:/tmp/cvs-serv9090/vax/kernel
Modified Files:
init_task.c interrupt.c interrupt.h process.c ptrace.c
regdump.c semaphore.c setup.c syscall.c
Log Message:
synch 2.4.15 commit 14
Index: init_task.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/init_task.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- init_task.c 20 Jan 2001 22:00:20 -0000 1.2
+++ init_task.c 9 Apr 2002 13:50:55 -0000 1.3
@@ -1,5 +1,6 @@
#include <linux/mm.h>
#include <linux/sched.h>
+#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
Index: interrupt.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/interrupt.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- interrupt.c 15 Dec 2001 12:23:58 -0000 1.23
+++ interrupt.c 9 Apr 2002 13:50:55 -0000 1.24
@@ -6,6 +6,10 @@
It also contains the interrupt stack. Eventually, there will
need to be a separate interrupt stack per-cpu, within the
per-cpu data structures.
+ *
+ *
+ * FIXME: We should use the new interrupt architecture. It looks like
+ * a closer match to the VAX SCB.
*/
#include <linux/types.h>
@@ -462,8 +466,9 @@
restore_flags(flags);
// if (status) {
- if (softirq_active(cpu)&softirq_mask(cpu)) {
- do_softirq();
+// if (softirq_active(cpu)&softirq_mask(cpu)) {
+ if (softirq_pending(cpu)) {
+ do_softirq();
// }
}
@@ -508,7 +513,8 @@
ret_from_sys_call:
cpu=smp_processor_id();
- if (softirq_active(cpu)&softirq_mask(cpu)) {
+ if (softirq_pending(cpu)) {
+// if (softirq_active(cpu)&softirq_mask(cpu)) {
do_softirq();
goto ret_from_intr;
}
@@ -516,7 +522,8 @@
ret_from_exception:
cpu=smp_processor_id();
- if (softirq_active(cpu)&softirq_mask(cpu)) {
+ if (softirq_pending(cpu)) {
+// if (softirq_active(cpu)&softirq_mask(cpu)) {
do_softirq();
}
Index: interrupt.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/interrupt.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- interrupt.h 9 Nov 2001 23:48:40 -0000 1.8
+++ interrupt.h 9 Apr 2002 13:50:55 -0000 1.9
@@ -7,7 +7,7 @@
have to move them to include/asm-vax instead.
*/
-#include <asm/irq.h>
+#include <linux/interrupt.h>
/* This is the max number of exception and interrupt handlers we can
handle. You can increase this as far as NR_IRQS if you need to. */
Index: process.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/process.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- process.c 28 Oct 2001 23:54:18 -0000 1.15
+++ process.c 9 Apr 2002 13:50:55 -0000 1.16
@@ -11,7 +11,7 @@
#include <linux/smp_lock.h>
#include <linux/fs.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
#include <asm/uaccess.h>
#include <asm/current.h>
#include <asm/processor.h>
@@ -24,6 +24,8 @@
#include <asm/elf.h>
+#undef VAX_PROCESS_DEBUG
+
void cpu_idle(void)
{
/* endless idle loop with no priority at all */
@@ -47,7 +49,7 @@
unsigned long pcbb; /* physical address of new pcb */
struct task_struct *retval;
-#if 0
+#ifdef VAX_PROCESS_DEBUG
printk("vax_switch_to: switching %08lx -> %08lx\n",
(unsigned long)prev, (unsigned long)next);
#endif
@@ -119,9 +121,11 @@
stack_top -= 4;
child_stack = (struct new_thread_stack *)(stack_top) - 1;
-
-// printk("copy_thread: pid %d, task 0x%08lx, kstack_top 0x%8lx, usp 0x%08lx, ksp 0x%08lx\n",
-// p->pid, (unsigned long)p, stack_top, usp, child_stack);
+
+#ifdef VAX_PROCESS_DEBUG
+ printk("copy_thread: pid %d, task 0x%08lx, kstack_top 0x%8lx, usp 0x%08lx, ksp 0x%08lx\n",
+ p->pid, (unsigned long)p, stack_top, usp, child_stack);
+#endif
child_regs = &child_stack->regs;
*child_regs = *regs;
@@ -185,8 +189,10 @@
/* In child. At this point SP points to the very top of
our kernel stack, so we cannot pop anything off. That
means that we can never return from here. */
-/* printk("kernel_thread: calling thread function at %08lx\n",
- (unsigned long)fn);*/
+#ifdef VAX_PROCESS_DEBUG
+ printk("kernel_thread: calling thread function at %08lx\n",
+ (unsigned long)fn);
+#endif
kernel_thread_exit(fn(arg));
}
@@ -197,14 +203,15 @@
if (!newsp) {
newsp = regs->sp;
}
-
-/* printk("sys_clone: calling do_fork(0x%08lx, 0x%08lx, 0x%p)\n",
- clone_flags, newsp, regs); */
-
+#ifdef VAX_PROCESS_DEBUG
+ printk("sys_clone: calling do_fork(0x%08lx, 0x%08lx, 0x%p)\n",
+ clone_flags, newsp, regs);
+#endif
retval = do_fork(clone_flags, newsp, regs, 0);
-/* printk("sys_clone: do_fork() returned %d\n", retval);*/
-
+#ifdef VAX_PROCESS_DEBUG
+ printk("sys_clone: do_fork() returned %d\n", retval);
+#endif
return retval;
}
@@ -250,7 +257,9 @@
void start_thread(struct pt_regs *regs, unsigned long new_pc, unsigned long new_sp)
{
-/* printk("starting thread %8lX %8lX %8lX\n", new_pc, new_sp, regs->sp);*/
+#ifdef VAX_PROCESS_DEBUG
+ printk("starting thread %8lX %8lX %8lX\n", new_pc, new_sp, regs->sp);
+#endif
set_fs(USER_DS);
regs->pc = new_pc;
regs->sp = new_sp;
Index: ptrace.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/ptrace.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ptrace.c 14 Nov 2001 09:13:23 -0000 1.6
+++ ptrace.c 9 Apr 2002 13:50:55 -0000 1.7
@@ -120,6 +120,17 @@
return retval;
}
+/*
+ * Called by kernel/ptrace.c when detaching..
+ *
+ * Make sure single step bits etc are not set.
+ */
+void ptrace_disable(struct task_struct *child)
+{
+ /* make sure the single step bit is not set. */
+ /* FIXME: */
+}
+
asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
{
struct task_struct *child;
@@ -159,7 +170,7 @@
if (request == PTRACE_ATTACH) {
if (child == current)
goto out_tsk;
- if ((!child->dumpable ||
+ if ((!child->mm->dumpable ||
(current->uid != child->euid) ||
(current->uid != child->suid) ||
(current->uid != child->uid) ||
@@ -307,18 +318,7 @@
break;
}
case PTRACE_DETACH: /* detach a process that was attached. */
- res = -EIO;
- if ((unsigned long) data > _NSIG)
- break;
- child->ptrace &= ~(PT_PTRACED|PT_TRACESYS);
- child->exit_code = data;
- write_lock_irq(&tasklist_lock);
- REMOVE_LINKS(child);
- child->p_pptr = child->p_opptr;
- SET_LINKS(child);
- write_unlock_irq(&tasklist_lock);
- wake_up_process(child);
- res = 0;
+ res = ptrace_detach(child, data);
break;
default:
Index: regdump.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/regdump.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- regdump.c 11 Sep 2001 19:23:38 -0000 1.5
+++ regdump.c 9 Apr 2002 13:50:55 -0000 1.6
@@ -126,6 +126,17 @@
}
}
+/* FIXME: new as of 2.4.15. Not 100% sure what this is supposed to do,
+ * but I suspect its the equivalent of our dump_stack() routine, on
+ * an arbitrary task's kernel stack */
+void show_trace_task(struct task_struct * tsk)
+{
+ unsigned long int ksp;
+ ksp = tsk->thread.pcb.ksp;
+ hex_dump((void *)ksp, 256);
+ return;
+}
+
void dump_stack(unsigned int frames)
{
unsigned int reg_count;
Index: semaphore.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/semaphore.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- semaphore.c 29 Jan 2001 01:09:18 -0000 1.1
+++ semaphore.c 9 Apr 2002 13:50:55 -0000 1.2
@@ -1,6 +1,8 @@
/*
* $Id$
*
+ * Updated for new rwsem.h 2.4.4, Mar 2002 atp.
+ *
* VAX version (based on S390 version)
* Copyright (C) 2001, Kenn Humborg
*
@@ -160,146 +162,5 @@
spin_unlock_irqrestore(&semaphore_lock, flags);
return 1;
-}
-
-void down_read_failed_biased(struct rw_semaphore *sem)
-{
- struct task_struct *tsk = current;
- DECLARE_WAITQUEUE(wait, tsk);
-
- add_wait_queue(&sem->wait, &wait); /* put ourselves at the head of the list */
-
- for (;;) {
- if (sem->read_bias_granted && xchg(&sem->read_bias_granted, 0))
- break;
- set_task_state(tsk, TASK_UNINTERRUPTIBLE);
- if (!sem->read_bias_granted)
- schedule();
- }
-
- remove_wait_queue(&sem->wait, &wait);
- tsk->state = TASK_RUNNING;
-}
-
-void down_write_failed_biased(struct rw_semaphore *sem)
-{
- struct task_struct *tsk = current;
- DECLARE_WAITQUEUE(wait, tsk);
-
- add_wait_queue_exclusive(&sem->write_bias_wait, &wait); /* put ourselves at the end of the list */
-
- for (;;) {
- if (sem->write_bias_granted && xchg(&sem->write_bias_granted, 0))
- break;
- set_task_state(tsk, TASK_UNINTERRUPTIBLE);
- if (!sem->write_bias_granted)
- schedule();
- }
-
- remove_wait_queue(&sem->write_bias_wait, &wait);
- tsk->state = TASK_RUNNING;
-
- /* if the lock is currently unbiased, awaken the sleepers
- * FIXME: this wakes up the readers early in a bit of a
- * stampede -> bad!
- */
- if (atomic_read(&sem->count) >= 0)
- wake_up(&sem->wait);
-}
-
-/* Wait for the lock to become unbiased. Readers
- * are non-exclusive. =)
- */
-void down_read_failed(struct rw_semaphore *sem)
-{
- struct task_struct *tsk = current;
- DECLARE_WAITQUEUE(wait, tsk);
-
- up_read(sem); /* this takes care of granting the lock */
-
- add_wait_queue(&sem->wait, &wait);
-
- while (atomic_read(&sem->count) < 0) {
- set_task_state(tsk, TASK_UNINTERRUPTIBLE);
- if (atomic_read(&sem->count) >= 0)
- break;
- schedule();
- }
-
- remove_wait_queue(&sem->wait, &wait);
- tsk->state = TASK_RUNNING;
-}
-
-/* Wait for the lock to become unbiased. Since we're
- * a writer, we'll make ourselves exclusive.
- */
-void down_write_failed(struct rw_semaphore *sem)
-{
- struct task_struct *tsk = current;
- DECLARE_WAITQUEUE(wait, tsk);
-
- up_write(sem); /* this takes care of granting the lock */
-
- add_wait_queue_exclusive(&sem->wait, &wait);
-
- while (atomic_read(&sem->count) < 0) {
- set_task_state(tsk, TASK_UNINTERRUPTIBLE);
- if (atomic_read(&sem->count) >= 0)
- break; /* we must attempt to acquire or bias the lock */
- schedule();
- }
-
- remove_wait_queue(&sem->wait, &wait);
- tsk->state = TASK_RUNNING;
-}
-
-/* Called when someone has done an up that transitioned from
- * negative to non-negative, meaning that the lock has been
- * granted to whomever owned the bias.
- */
-void rwsem_wake_readers(struct rw_semaphore *sem)
-{
- if (xchg(&sem->read_bias_granted, 1))
- BUG();
- wake_up(&sem->wait);
-}
-
-void rwsem_wake_writers(struct rw_semaphore *sem)
-{
- if (xchg(&sem->write_bias_granted, 1))
- BUG();
- wake_up(&sem->write_bias_wait);
-}
-
-void __down_read_failed(int count, struct rw_semaphore *sem)
-{
- do {
- if (count == -1) {
- down_read_failed_biased(sem);
- break;
- }
- down_read_failed(sem);
- count = atomic_dec_return(&sem->count);
- } while (count != 0);
-}
-
-void __down_write_failed(int count, struct rw_semaphore *sem)
-{
- do {
- if (count < 0 && count > -RW_LOCK_BIAS) {
- down_write_failed_biased(sem);
- break;
- }
- down_write_failed(sem);
- count = atomic_add_return(-RW_LOCK_BIAS, &sem->count);
- } while (count != 0);
-}
-
-void __rwsem_wake(int count, struct rw_semaphore *sem)
-{
- if (count == 0)
- rwsem_wake_readers(sem);
- else
- rwsem_wake_writers(sem);
}
Index: setup.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/setup.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- setup.c 16 Sep 2001 15:24:31 -0000 1.17
+++ setup.c 9 Apr 2002 13:50:55 -0000 1.18
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/string.h>
#include <linux/delay.h>
+#include <linux/seq_file.h>
#include <asm/rpb.h>
#include <asm/page.h>
@@ -35,13 +36,13 @@
extern char _end;
/*
- * BUFFER is PAGE_SIZE bytes long.
+ * Get CPU information for use by the procfs.
*/
-int get_cpuinfo(char *buffer)
+static int show_cpuinfo(struct seq_file *m, void *v)
{
int len;
- len = sprintf(buffer, "cpu\t\t\t: VAX\n"
+ seq_printf(m, "cpu\t\t\t: VAX\n"
"cpu type\t\t: %s\n"
"cpu sidex\t\t: %d\n"
"page size\t\t: %ld\n"
@@ -52,9 +53,27 @@
PAGE_SIZE,
loops_per_jiffy / (500000/HZ),
(loops_per_jiffy / (5000/HZ)) % 100);
- return len;
+ return 0;
}
+static void *c_start(struct seq_file *m, loff_t *pos)
+{
+ return (void*)(*pos == 0);
+}
+static void *c_next(struct seq_file *m, void *v, loff_t *pos)
+{
+ ++*pos;
+ return c_start(m, pos);
+}
+static void c_stop(struct seq_file *m, void *v)
+{
+}
+struct seq_operations cpuinfo_op = {
+ start: c_start,
+ next: c_next,
+ stop: c_stop,
+ show: show_cpuinfo,
+};
void __init setup_arch(char **cmdline_p)
{
@@ -114,8 +133,6 @@
printk("calling free_bootmem(start=%08lx, len=%08lx)\n",
region_start, region_len);
free_bootmem(region_start, region_len);
-
-
region_start = PAGEALIGNUP(__pa(SPT_BASE + SPT_SIZE));
region_len = PAGEALIGNDN((max_pfn << PAGE_SHIFT)) - region_start;
Index: syscall.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/syscall.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- syscall.c 14 Sep 2001 11:41:41 -0000 1.8
+++ syscall.c 9 Apr 2002 13:50:55 -0000 1.9
@@ -78,8 +78,10 @@
nr_args = *user_ap;
}
-// printk("Dispatching syscall %d with %d args, regs=%8lx\n", chmk_arg, nr_args,regs);
-
+// if (chmk_arg==106) {
+// printk("Dispatching syscall %d with %d args, regs=%8lx ap=%8lx\n", chmk_arg, nr_args,regs,user_ap);
+// printk(" -- arg0 %d, arg1 %8lx, arg2 %8lx\n",*user_ap,*(user_ap+1),*(user_ap+2));
+// }
/* We pass all the user-supplied args plus the pointer to the
regs to the syscall function. If the syscall is implemented
in the core kernel, then it will ignore the additional
@@ -260,9 +262,9 @@
goto out;
}
- down(¤t->mm->mmap_sem);
+ down_write(¤t->mm->mmap_sem);
error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
- up(¤t->mm->mmap_sem);
+ up_write(¤t->mm->mmap_sem);
if (file)
fput(file);
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:20
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/philips In directory usw-pr-cvs1:/tmp/cvs-serv19427/arch/mips/philips Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/philips added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/lib In directory usw-pr-cvs1:/tmp/cvs-serv22420/arch/ppc/boot/lib Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/lib added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/vfat
In directory usw-pr-cvs1:/tmp/cvs-serv32005/vfat
Modified Files:
namei.c vfatfs_syms.c
Log Message:
synch 2.4.15 commit 14
Index: namei.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/vfat/namei.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- namei.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ namei.c 9 Apr 2002 13:30:20 -0000 1.2
@@ -9,10 +9,12 @@
* what file operation caused you trouble and if you can duplicate
* the problem, send a script that demonstrates it.
*
- * Short name translation 1999 by Wolfram Pienkoss <wp...@bs...>
+ * Short name translation 1999, 2001 by Wolfram Pienkoss <wp...@bs...>
+ *
+ * Support Multibyte character and cleanup by
+ * OGAWA Hirofumi <hir...@ma...>
*/
-#define __NO_VERSION__
#include <linux/module.h>
#include <linux/sched.h>
@@ -26,8 +28,6 @@
#include <linux/mm.h>
#include <linux/slab.h>
-#include "../fat/msbuffer.h"
-
#define DEBUG_LEVEL 0
#if (DEBUG_LEVEL >= 1)
# define PRINTK1(x) printk x
@@ -45,12 +45,6 @@
# define PRINTK3(x)
#endif
-#ifndef DEBUG
-# define CHECK_STACK
-#else
-# define CHECK_STACK check_stack(__FILE__, __LINE__)
-#endif
-
static int vfat_hashi(struct dentry *parent, struct qstr *qstr);
static int vfat_hash(struct dentry *parent, struct qstr *qstr);
static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b);
@@ -114,6 +108,13 @@
opts->unicode_xlate = opts->posixfs = 0;
opts->numtail = 1;
opts->utf8 = 0;
+ opts->shortname = VFAT_SFN_DISPLAY_LOWER | VFAT_SFN_CREATE_WIN95;
+ /* for backward compatible */
+ if (opts->nocase) {
+ opts->nocase = 0;
+ opts->shortname = VFAT_SFN_DISPLAY_WIN95
+ | VFAT_SFN_CREATE_WIN95;
+ }
if (!options) return 1;
save = 0;
@@ -139,6 +140,21 @@
if (ret) {
opts->numtail = !val;
}
+ } else if (!strcmp(this_char, "shortname")) {
+ if (!strcmp(value, "lower"))
+ opts->shortname = VFAT_SFN_DISPLAY_LOWER
+ | VFAT_SFN_CREATE_WIN95;
+ else if (!strcmp(value, "win95"))
+ opts->shortname = VFAT_SFN_DISPLAY_WIN95
+ | VFAT_SFN_CREATE_WIN95;
+ else if (!strcmp(value, "winnt"))
+ opts->shortname = VFAT_SFN_DISPLAY_WINNT
+ | VFAT_SFN_CREATE_WINNT;
+ else if (!strcmp(value, "mixed"))
+ opts->shortname = VFAT_SFN_DISPLAY_WINNT
+ | VFAT_SFN_CREATE_WIN95;
+ else
+ ret = 0;
}
if (this_char != options)
*(this_char-1) = ',';
@@ -156,12 +172,6 @@
}
static inline unsigned char
-vfat_getlower(struct nls_table *t, unsigned char c)
-{
- return t->charset2lower[c];
-}
-
-static inline unsigned char
vfat_tolower(struct nls_table *t, unsigned char c)
{
unsigned char nc = t->charset2lower[c];
@@ -170,12 +180,6 @@
}
static inline unsigned char
-vfat_getupper(struct nls_table *t, unsigned char c)
-{
- return t->charset2upper[c];
-}
-
-static inline unsigned char
vfat_toupper(struct nls_table *t, unsigned char c)
{
unsigned char nc = t->charset2upper[c];
@@ -194,31 +198,6 @@
return 0;
}
-static inline int
-vfat_uni2short(struct nls_table *t, wchar_t uc, unsigned char *op, int bound)
-{
- int charlen;
-
- if ( (charlen = t->uni2char(uc, op, bound)) < 0)
- charlen = 0;
-
- return charlen;
-}
-
-static inline int
-vfat_uni2upper_short(struct nls_table *t, wchar_t uc, char *op, int bound)
-{
- int chi, chl;
-
- if ( (chl = t->uni2char(uc, op, bound)) < 0)
- chl = 0;
-
- for (chi = 0; chi < chl; chi++)
- op[chi] = vfat_toupper(t, op[chi]);
-
- return chl;
-}
-
/*
* Compute the hash for the vfat name corresponding to the dentry.
* Note: if the name is invalid, we leave the hash code unchanged so
@@ -311,33 +290,6 @@
#ifdef DEBUG
-static void
-check_stack(const char *fname, int lineno)
-{
- int stack_level;
- char *pg_dir;
-
- stack_level = (long)(&pg_dir)-current->kernel_stack_page;
- if (stack_level < 0)
- printk("*-*-*-* vfat kstack overflow in %s line %d: SL=%d\n",
- fname, lineno, stack_level);
- else if (stack_level < 500)
- printk("*-*-*-* vfat kstack low in %s line %d: SL=%d\n",
- fname, lineno, stack_level);
-#if 0
- else
- printk("------- vfat kstack ok in %s line %d: SL=%d\n",
- fname, lineno, stack_level);
-#endif
-#if 0
- if (*(unsigned long *) current->kernel_stack_page != STACK_MAGIC) {
- printk("******* vfat stack corruption detected in %s at line %d\n",
- fname, lineno);
- }
-#endif
-}
-
-static int debug = 0;
static void dump_fat(struct super_block *sb,int start)
{
printk("[");
@@ -383,8 +335,44 @@
/* Characters that are undesirable in an MS-DOS file name */
-static char bad_chars[] = "*?<>|\":/\\";
-static char replace_chars[] = "[];,+=";
+static wchar_t bad_chars[] = {
+ /* `*' `?' `<' `>' `|' `"' `:' `/' */
+ 0x002A, 0x003F, 0x003C, 0x003E, 0x007C, 0x0022, 0x003A, 0x002F,
+ /* `\' */
+ 0x005C, 0,
+};
+#define IS_BADCHAR(uni) (vfat_unistrchr(bad_chars, (uni)) != NULL)
+
+static wchar_t replace_chars[] = {
+ /* `[' `]' `;' `,' `+' `=' */
+ 0x005B, 0x005D, 0x003B, 0x002C, 0x002B, 0x003D, 0,
+};
+#define IS_REPLACECHAR(uni) (vfat_unistrchr(replace_chars, (uni)) != NULL)
+
+static wchar_t skip_chars[] = {
+ /* `.' ` ' */
+ 0x002E, 0x0020, 0,
+};
+#define IS_SKIPCHAR(uni) \
+ ((wchar_t)(uni) == skip_chars[0] || (wchar_t)(uni) == skip_chars[1])
+
+static inline wchar_t *vfat_unistrchr(const wchar_t *s, const wchar_t c)
+{
+ for(; *s != c; ++s)
+ if (*s == 0)
+ return NULL;
+ return (wchar_t *) s;
+}
+
+static inline int vfat_is_used_badchars(const wchar_t *s, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++)
+ if (s[i] < 0x0020 || IS_BADCHAR(s[i]))
+ return -EINVAL;
+ return 0;
+}
/* Checks the validity of a long MS-DOS filename */
/* Returns negative number on error, 0 for a normal
@@ -393,18 +381,10 @@
static int vfat_valid_longname(const char *name, int len, int xlate)
{
const char **reserved, *walk;
- unsigned char c;
- int i, baselen;
+ int baselen;
if (len && name[len-1] == ' ') return -EINVAL;
if (len >= 256) return -EINVAL;
- for (i = 0; i < len; i++) {
- c = name[i];
- if (xlate && c == ':') continue;
- if (strchr(bad_chars,c)) {
- return -EINVAL;
- }
- }
if (len < 3) return 0;
for (walk = name; *walk != 0 && *walk != '.'; walk++);
@@ -424,72 +404,6 @@
return 0;
}
-static int vfat_valid_shortname(struct nls_table *nls, wchar_t *name, int len)
-{
- wchar_t *walk;
- unsigned char c, charbuf[NLS_MAX_CHARSET_SIZE];
- int chl, chi;
- int space;
-
- if (vfat_uni2upper_short(nls, *name, charbuf, NLS_MAX_CHARSET_SIZE) == 0)
- return -EINVAL;
-
- if (IS_FREE(charbuf))
- return -EINVAL;
-
- chl = 0;
- c = 0;
- space = 1; /* disallow names starting with a dot */
- for (walk = name; len && walk-name < 8;) {
- len--;
- chl = nls->uni2char(*walk++, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl < 0)
- return -EINVAL;
-
- for (chi = 0; chi < chl; chi++) {
- c = vfat_getupper(nls, charbuf[chi]);
- if (!c) return -EINVAL;
- if (charbuf[chi] != vfat_tolower(nls, c)) return -EINVAL;
- if (strchr(replace_chars,c)) return -EINVAL;
- if (c < ' '|| c==':') return -EINVAL;
- if (c == '.') goto dot;
- space = c == ' ';
- }
- }
-dot:;
- if (space) return -EINVAL;
- if (len && c != '.') {
- len--;
- if (vfat_uni2upper_short(nls, *walk++, charbuf, NLS_MAX_CHARSET_SIZE) == 1) {
- if (charbuf[0] != '.') return -EINVAL;
- } else
- return -EINVAL;
- c = '.';
- }
- if (c == '.') {
- if (len >= 4) return -EINVAL;
- while (len > 0) {
- len--;
- chl = nls->uni2char(*walk++, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl < 0)
- return -EINVAL;
- for (chi = 0; chi < chl; chi++) {
- c = vfat_getupper(nls, charbuf[chi]);
- if (!c) return -EINVAL;
- if (charbuf[chi] != vfat_tolower(nls, c)) return -EINVAL;
- if (strchr(replace_chars,c))
- return -EINVAL;
- if (c < ' ' || c == '.'|| c==':')
- return -EINVAL;
- space = c == ' ';
- }
- }
- if (space) return -EINVAL;
- }
-
- return 0;
-}
-
static int vfat_find_form(struct inode *dir,char *name)
{
struct msdos_dir_entry *de;
@@ -503,127 +417,134 @@
return 0;
}
-static int vfat_format_name(struct nls_table *nls, wchar_t *name,
- int len, char *res)
+/*
+ * 1) Valid characters for the 8.3 format alias are any combination of
+ * letters, uppercase alphabets, digits, any of the
+ * following special characters:
+ * $ % ' ` - @ { } ~ ! # ( ) & _ ^
+ * In this case Longfilename is not stored in disk.
+ *
+ * WinNT's Extension:
+ * File name and extension name is contain uppercase/lowercase
+ * only. And it is expressed by CASE_LOWER_BASE and CASE_LOWER_EXT.
+ *
+ * 2) File name is 8.3 format, but it contain the uppercase and
+ * lowercase char, muliti bytes char, etc. In this case numtail is not
+ * added, but Longfilename is stored.
+ *
+ * 3) When the one except for the above, or the following special
+ * character are contained:
+ * . [ ] ; , + =
+ * numtail is added, and Longfilename must be stored in disk .
+ */
+struct shortname_info {
+ unsigned char lower:1,
+ upper:1,
+ valid:1;
+};
+#define INIT_SHORTNAME_INFO(x) do { \
+ (x)->lower = 1; \
+ (x)->upper = 1; \
+ (x)->valid = 1; \
+} while (0);
+
+static inline unsigned char
+shortname_info_to_lcase(struct shortname_info *base,
+ struct shortname_info *ext)
{
- char *walk;
- unsigned char charbuf[NLS_MAX_CHARSET_SIZE];
- int chi, chl;
- int space;
+ unsigned char lcase = 0;
- if (vfat_uni2upper_short(nls, *name, charbuf, NLS_MAX_CHARSET_SIZE) == 0)
- return -EINVAL;
+ if (base->valid && ext->valid) {
+ if (!base->upper && base->lower && (ext->lower || ext->upper))
+ lcase |= CASE_LOWER_BASE;
+ if (!ext->upper && ext->lower && (base->lower || base->upper))
+ lcase |= CASE_LOWER_EXT;
+ }
- if (IS_FREE(charbuf))
- return -EINVAL;
+ return lcase;
+}
- space = 1; /* disallow names starting with a dot */
- for (walk = res; len--; ) {
- chl = vfat_uni2upper_short(nls, *name++, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl == 0)
- return -EINVAL;
- for (chi = 0; chi < chl; chi++){
- if (charbuf[chi] == '.') goto dot;
- if (!charbuf[chi]) return -EINVAL;
- if (walk-res == 8) return -EINVAL;
- if (strchr(replace_chars,charbuf[chi])) return -EINVAL;
- if (charbuf[chi] < ' '|| charbuf[chi]==':') return -EINVAL;
- space = charbuf[chi] == ' ';
- *walk = charbuf[chi];
- walk++;
- }
- }
-dot:;
- if (space) return -EINVAL;
- if (len >= 0) {
- while (walk-res < 8) *walk++ = ' ';
- while (len > 0 && walk-res < MSDOS_NAME) {
- chl = vfat_uni2upper_short(nls, *name++, charbuf, NLS_MAX_CHARSET_SIZE);
- if (len < chl)
- chl = len;
- len -= chl;
- for (chi = 0; chi < chl; chi++){
- if (!charbuf[chi]) return -EINVAL;
- if (strchr(replace_chars,charbuf[chi]))
- return -EINVAL;
- if (charbuf[chi] < ' ' || charbuf[chi] == '.'|| charbuf[chi]==':')
- return -EINVAL;
- space = charbuf[chi] == ' ';
- *walk++ = charbuf[chi];
- }
+static inline int to_shortname_char(struct nls_table *nls,
+ char *buf, int buf_size, wchar_t *src,
+ struct shortname_info *info)
+{
+ int len;
+
+ if (IS_SKIPCHAR(*src)) {
+ info->valid = 0;
+ return 0;
+ }
+ if (IS_REPLACECHAR(*src)) {
+ info->valid = 0;
+ buf[0] = '_';
+ return 1;
+ }
+
+ len = nls->uni2char(*src, buf, buf_size);
+ if (len <= 0) {
+ info->valid = 0;
+ buf[0] = '_';
+ len = 1;
+ } else if (len == 1) {
+ unsigned char prev = buf[0];
+
+ if (buf[0] >= 0x7F) {
+ info->lower = 0;
+ info->upper = 0;
+ }
+
+ buf[0] = vfat_toupper(nls, buf[0]);
+ if (isalpha(buf[0])) {
+ if (buf[0] == prev)
+ info->lower = 0;
+ else
+ info->upper = 0;
}
- if (space) return -EINVAL;
- if (len) return -EINVAL;
+ } else {
+ info->lower = 0;
+ info->upper = 0;
}
- while (walk-res < MSDOS_NAME) *walk++ = ' ';
-
- return 0;
+
+ return len;
}
-static char skip_chars[] = ".:\"?<>| ";
-
-/* Given a valid longname, create a unique shortname. Make sure the
+/*
+ * Given a valid longname, create a unique shortname. Make sure the
* shortname does not exist
+ * Returns negative number on error, 0 for a normal
+ * return, and 1 for valid shortname
*/
static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
- wchar_t *name, int len,
- char *name_res)
+ wchar_t *uname, int ulen,
+ char *name_res, unsigned char *lcase)
{
- wchar_t *ip, *op, *ext_start, *end, *name_start;
- wchar_t msdos_name[13];
- char base[9], ext[4], buf[8], *p;
+ wchar_t *ip, *ext_start, *end, *name_start;
+ unsigned char base[9], ext[4], buf[8], *p;
unsigned char charbuf[NLS_MAX_CHARSET_SIZE];
int chl, chi;
- int sz, extlen, baselen, i;
+ int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen;
+ int is_shortname;
+ struct shortname_info base_info, ext_info;
+ unsigned short opt_shortname = MSDOS_SB(dir->i_sb)->options.shortname;
+
+ is_shortname = 1;
+ INIT_SHORTNAME_INFO(&base_info);
+ INIT_SHORTNAME_INFO(&ext_info);
- PRINTK2(("Entering vfat_create_shortname\n"));
- chl = 0;
- sz = 0; /* Make compiler happy */
- if (len <= 12) {
- /* Do a case insensitive search if the name would be a valid
- * shortname if is were all capitalized. However, do not
- * allow spaces in short names because Win95 scandisk does
- * not like that */
- for (i = 0, op = &msdos_name[0], ip = name; ; i++, ip++, op++) {
- if (i == len) {
- if (vfat_format_name(nls, &msdos_name[0], len,
- name_res) < 0)
- break;
- PRINTK3(("vfat_create_shortname 1\n"));
- if (vfat_find_form(dir, name_res) < 0)
- return 0;
- return -EEXIST;
- }
- chl = vfat_uni2upper_short(nls, *ip, charbuf, NLS_MAX_CHARSET_SIZE);
- for (chi = 0; chi < chl; chi++){
- if (charbuf[chi] == ' ')
- break;
- }
- if (chi < chl)
- break;
-
- *op = *ip;
- }
- }
-
- PRINTK3(("vfat_create_shortname 3\n"));
/* Now, we need to create a shortname from the long name */
- ext_start = end = &name[len];
- while (--ext_start >= name) {
- chl = vfat_uni2upper_short(nls, *ext_start, charbuf, NLS_MAX_CHARSET_SIZE);
- for (chi = 0; chi < chl; chi++) {
- if (charbuf[chi] == '.') {
- if (ext_start == end - 1) {
- sz = len;
- ext_start = NULL;
- }
- goto stop0;
+ ext_start = end = &uname[ulen];
+ while (--ext_start >= uname) {
+ if (*ext_start == 0x002E) { /* is `.' */
+ if (ext_start == end - 1) {
+ sz = ulen;
+ ext_start = NULL;
}
+ break;
}
}
-stop0:;
- if (ext_start == name - 1) {
- sz = len;
+
+ if (ext_start == uname - 1) {
+ sz = ulen;
ext_start = NULL;
} else if (ext_start) {
/*
@@ -631,45 +552,43 @@
* an extension eg. "...test". In this case Win95
* uses the extension as the name and sets no extension.
*/
- name_start = &name[0];
- while (name_start < ext_start)
- {
- chl = vfat_uni2upper_short(nls, *name_start, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl == 0)
+ name_start = &uname[0];
+ while (name_start < ext_start) {
+ if (!IS_SKIPCHAR(*name_start))
break;
- for (chi = 0; chi < chl; chi++)
- if (!strchr(skip_chars, charbuf[chi])) {
- goto stop1;
- }
name_start++;
}
-stop1:;
if (name_start != ext_start) {
- sz = ext_start - name;
+ sz = ext_start - uname;
ext_start++;
} else {
- sz = len;
+ sz = ulen;
ext_start=NULL;
}
}
- for (baselen = i = 0, p = base, ip = name; i < sz && baselen < 8; i++, ip++)
- {
- chl = vfat_uni2upper_short(nls, *ip, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl == 0){
- *p++ = '_';
- baselen++;
+ numtail_baselen = 6;
+ numtail2_baselen = 2;
+ for (baselen = i = 0, p = base, ip = uname; i < sz; i++, ip++) {
+ chl = to_shortname_char(nls, charbuf, sizeof(charbuf),
+ ip, &base_info);
+ if (chl == 0)
continue;
- }
+ if (baselen < 2 && (baselen + chl) > 2)
+ numtail2_baselen = baselen;
+ if (baselen < 6 && (baselen + chl) > 6)
+ numtail_baselen = baselen;
for (chi = 0; chi < chl; chi++){
- if (!strchr(skip_chars, charbuf[chi])){
- if (strchr(replace_chars, charbuf[chi]))
- *p = '_';
- else
- *p = charbuf[chi];
- p++; baselen++;
- }
+ *p++ = charbuf[chi];
+ baselen++;
+ if (baselen >= 8)
+ break;
+ }
+ if (baselen >= 8) {
+ if ((chi < chl - 1) || (ip + 1) - uname < sz)
+ is_shortname = 0;
+ break;
}
}
if (baselen == 0) {
@@ -679,21 +598,23 @@
extlen = 0;
if (ext_start) {
for (p = ext, ip = ext_start; extlen < 3 && ip < end; ip++) {
- chl = vfat_uni2upper_short(nls, *ip, charbuf, NLS_MAX_CHARSET_SIZE);
- if (chl == 0) {
- *p++ = '_';
- extlen++;
+ chl = to_shortname_char(nls, charbuf, sizeof(charbuf),
+ ip, &ext_info);
+ if (chl == 0)
continue;
- }
+ if ((extlen + chl) > 3) {
+ is_shortname = 0;
+ break;
+ }
for (chi = 0; chi < chl; chi++) {
- if (!strchr(skip_chars, charbuf[chi])) {
- if (strchr(replace_chars, charbuf[chi]))
- *p = '_';
- else
- *p = charbuf[chi];
- p++; extlen++;
- }
+ *p++ = charbuf[chi];
+ extlen++;
+ }
+ if (extlen >= 3) {
+ if (ip + 1 != end)
+ is_shortname = 0;
+ break;
}
}
}
@@ -701,8 +622,8 @@
base[baselen] = '\0';
/* Yes, it can happen. ".\xe5" would do it. */
- if (IS_FREE(base))
- base[0]='_';
+ if (base[0] == DELETED_FLAG)
+ base[0] = 0x05;
/* OK, at this point we know that base is not longer than 8 symbols,
* ext is not longer than 3, base is nonempty, both don't contain
@@ -710,8 +631,28 @@
*/
memset(name_res, ' ', MSDOS_NAME);
- memcpy(name_res,base,baselen);
- memcpy(name_res+8,ext,extlen);
+ memcpy(name_res, base, baselen);
+ memcpy(name_res + 8, ext, extlen);
+ *lcase = 0;
+ if (is_shortname && base_info.valid && ext_info.valid) {
+ if (vfat_find_form(dir, name_res) == 0)
+ return -EEXIST;
+
+ if (opt_shortname & VFAT_SFN_CREATE_WIN95) {
+ return (base_info.upper && ext_info.upper);
+ } else if (opt_shortname & VFAT_SFN_CREATE_WINNT) {
+ if ((base_info.upper || base_info.lower)
+ && (ext_info.upper || ext_info.lower)) {
+ *lcase = shortname_info_to_lcase(&base_info,
+ &ext_info);
+ return 1;
+ }
+ return 0;
+ } else {
+ BUG();
+ }
+ }
+
if (MSDOS_SB(dir->i_sb)->options.numtail == 0)
if (vfat_find_form(dir, name_res) < 0)
return 0;
@@ -724,8 +665,10 @@
* values for part of the base.
*/
- if (baselen>6)
- baselen = 6;
+ if (baselen>6) {
+ baselen = numtail_baselen;
+ name_res[7] = ' ';
+ }
name_res[baselen] = '~';
for (i = 1; i < 10; i++) {
name_res[baselen+1] = i + '0';
@@ -735,8 +678,10 @@
i = jiffies & 0xffff;
sz = (jiffies >> 16) & 0x7;
- if (baselen>2)
- baselen = 2;
+ if (baselen>2) {
+ baselen = numtail2_baselen;
+ name_res[7] = ' ';
+ }
name_res[baselen+4] = '~';
name_res[baselen+5] = '1' + sz;
while (1) {
@@ -801,7 +746,6 @@
} else {
if ((charlen = nls->char2uni(ip, len-i, (wchar_t *)op)) < 0)
return -EINVAL;
-
ip += charlen;
i += charlen;
op += 2;
@@ -839,45 +783,50 @@
static int
vfat_fill_slots(struct inode *dir, struct msdos_dir_slot *ds, const char *name,
- int len, int *slots, int uni_xlate)
+ int len, int *slots, int is_dir, int uni_xlate)
{
struct nls_table *nls_io, *nls_disk;
wchar_t *uname;
struct msdos_dir_slot *ps;
struct msdos_dir_entry *de;
unsigned long page;
- unsigned char cksum;
- const char *ip;
+ unsigned char cksum, lcase;
char *uniname, msdos_name[MSDOS_NAME];
int res, utf8, slot, ulen, unilen, i;
loff_t offset;
- de = (struct msdos_dir_entry *) ds;
+ *slots = 0;
utf8 = MSDOS_SB(dir->i_sb)->options.utf8;
nls_io = MSDOS_SB(dir->i_sb)->nls_io;
nls_disk = MSDOS_SB(dir->i_sb)->nls_disk;
- if (name[len-1] == '.') len--;
+ if (name[len-1] == '.')
+ len--;
if(!(page = __get_free_page(GFP_KERNEL)))
return -ENOMEM;
- uniname = (char *) page;
+ uniname = (char *) page;
res = xlate_to_uni(name, len, uniname, &ulen, &unilen, uni_xlate,
- utf8, nls_io);
+ utf8, nls_io);
if (res < 0)
goto out_free;
uname = (wchar_t *) page;
- if (vfat_valid_shortname(nls_disk, uname, ulen) >= 0) {
- res = vfat_format_name(nls_disk, uname, ulen, de->name);
- if (!res)
- goto out_free;
- }
+ res = vfat_is_used_badchars(uname, ulen);
+ if (res < 0)
+ goto out_free;
- res = vfat_create_shortname(dir, nls_disk, uname, ulen, msdos_name);
- if (res)
+ res = vfat_create_shortname(dir, nls_disk, uname, ulen,
+ msdos_name, &lcase);
+ if (res < 0)
goto out_free;
+ else if (res == 1) {
+ de = (struct msdos_dir_entry *)ds;
+ res = 0;
+ goto shortname;
+ }
+ /* build the entry of long file name */
*slots = unilen / 13;
for (cksum = i = 0; i < 11; i++) {
cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i];
@@ -890,18 +839,26 @@
ps->reserved = 0;
ps->alias_checksum = cksum;
ps->start = 0;
- offset = (slot - 1) * 26;
- ip = &uniname[offset];
- memcpy(ps->name0_4, ip, 10);
- memcpy(ps->name5_10, ip+10, 12);
- memcpy(ps->name11_12, ip+22, 4);
+ offset = (slot - 1) * 13;
+ fatwchar_to16(ps->name0_4, uname + offset, 5);
+ fatwchar_to16(ps->name5_10, uname + offset + 5, 6);
+ fatwchar_to16(ps->name11_12, uname + offset + 11, 2);
}
ds[0].id |= 0x40;
-
de = (struct msdos_dir_entry *) ps;
+
+shortname:
PRINTK3(("vfat_fill_slots 9\n"));
- strncpy(de->name, msdos_name, MSDOS_NAME);
+ /* build the entry of 8.3 alias name */
(*slots)++;
+ strncpy(de->name, msdos_name, MSDOS_NAME);
+ de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
+ de->lcase = lcase;
+ de->adate = de->cdate = de->date = 0;
+ de->ctime_ms = de->ctime = de->time = 0;
+ de->start = 0;
+ de->starthi = 0;
+ de->size = 0;
out_free:
free_page(page);
@@ -910,95 +867,92 @@
/* We can't get "." or ".." here - VFS takes care of those cases */
-static int vfat_build_slots(struct inode *dir,const char *name,int len,
- struct msdos_dir_slot *ds, int *slots)
+static int vfat_build_slots(struct inode *dir, const char *name, int len,
+ struct msdos_dir_slot *ds, int *slots, int is_dir)
{
int res, xlate;
xlate = MSDOS_SB(dir->i_sb)->options.unicode_xlate;
- *slots = 1;
res = vfat_valid_longname(name, len, xlate);
if (res < 0)
return res;
- return vfat_fill_slots(dir, ds, name, len, slots, xlate);
+
+ return vfat_fill_slots(dir, ds, name, len, slots, is_dir, xlate);
}
static int vfat_add_entry(struct inode *dir,struct qstr* qname,
- int is_dir,struct vfat_slot_info *sinfo_out,
- struct buffer_head **bh, struct msdos_dir_entry **de)
+ int is_dir, struct vfat_slot_info *sinfo_out,
+ struct buffer_head **bh, struct msdos_dir_entry **de)
{
struct super_block *sb = dir->i_sb;
- struct msdos_dir_slot *ps;
+ struct msdos_dir_slot *dir_slots;
loff_t offset;
- struct msdos_dir_slot *ds;
int slots, slot;
- int res;
- struct msdos_dir_entry *de1;
- struct buffer_head *bh1;
- int ino;
- int len;
+ int res, len;
+ struct msdos_dir_entry *dummy_de;
+ struct buffer_head *dummy_bh;
+ int dummy_ino;
loff_t dummy;
- ds = (struct msdos_dir_slot *)
- kmalloc(sizeof(struct msdos_dir_slot)*MSDOS_SLOTS, GFP_KERNEL);
- if (ds == NULL) return -ENOMEM;
+ dir_slots = (struct msdos_dir_slot *)
+ kmalloc(sizeof(struct msdos_dir_slot) * MSDOS_SLOTS, GFP_KERNEL);
+ if (dir_slots == NULL)
+ return -ENOMEM;
len = qname->len;
while (len && qname->name[len-1] == '.')
len--;
res = fat_search_long(dir, qname->name, len,
- (MSDOS_SB(sb)->options.name_check != 's') ||
- !MSDOS_SB(sb)->options.posixfs,
- &dummy, &dummy);
+ (MSDOS_SB(sb)->options.name_check != 's')
+ || !MSDOS_SB(sb)->options.posixfs,
+ &dummy, &dummy);
if (res > 0) /* found */
res = -EEXIST;
if (res)
goto cleanup;
- res = vfat_build_slots(dir, qname->name, len, ds, &slots);
- if (res < 0) goto cleanup;
+ res = vfat_build_slots(dir, qname->name, len,
+ dir_slots, &slots, is_dir);
+ if (res < 0)
+ goto cleanup;
- offset = fat_add_entries(dir, slots, &bh1, &de1, &ino);
+ /* build the empty directory entry of number of slots */
+ offset = fat_add_entries(dir, slots, &dummy_bh, &dummy_de, &dummy_ino);
if (offset < 0) {
res = offset;
goto cleanup;
}
- fat_brelse(sb, bh1);
+ fat_brelse(sb, dummy_bh);
/* Now create the new entry */
*bh = NULL;
- for (slot = 0, ps = ds; slot < slots; slot++, ps++) {
- if (fat_get_entry(dir,&offset,bh,de, &sinfo_out->ino) < 0) {
+ for (slot = 0; slot < slots; slot++) {
+ if (fat_get_entry(dir, &offset, bh, de, &sinfo_out->ino) < 0) {
res = -EIO;
goto cleanup;
}
- memcpy(*de, ps, sizeof(struct msdos_dir_slot));
+ memcpy(*de, dir_slots + slot, sizeof(struct msdos_dir_slot));
fat_mark_buffer_dirty(sb, *bh);
}
+ res = 0;
+ /* update timestamp */
dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME;
mark_inode_dirty(dir);
- fat_date_unix2dos(dir->i_mtime,&(*de)->time,&(*de)->date);
- (*de)->ctime_ms = 0;
+ fat_date_unix2dos(dir->i_mtime, &(*de)->time, &(*de)->date);
(*de)->ctime = (*de)->time;
(*de)->adate = (*de)->cdate = (*de)->date;
- (*de)->start = 0;
- (*de)->starthi = 0;
- (*de)->size = 0;
- (*de)->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
- (*de)->lcase = CASE_LOWER_BASE | CASE_LOWER_EXT;
-
fat_mark_buffer_dirty(sb, *bh);
/* slots can't be less than 1 */
sinfo_out->long_slots = slots - 1;
- sinfo_out->longname_offset = offset - sizeof(struct msdos_dir_slot) * slots;
- res = 0;
+ sinfo_out->longname_offset =
+ offset - sizeof(struct msdos_dir_slot) * slots;
cleanup:
- kfree(ds);
+ kfree(dir_slots);
return res;
}
Index: vfatfs_syms.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/vfat/vfatfs_syms.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- vfatfs_syms.c 14 Jan 2001 16:28:32 -0000 1.1.1.1
+++ vfatfs_syms.c 9 Apr 2002 13:30:20 -0000 1.2
@@ -5,8 +5,6 @@
* These symbols are used by dmsdos.
*/
-#define ASC_LINUX_VERSION(V, P, S) (((V) * 65536) + ((P) * 256) + (S))
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/umsdos In directory usw-pr-cvs1:/tmp/cvs-serv32005/umsdos Modified Files: README-WIP.txt dir.c emd.c inode.c ioctl.c namei.c rdir.c Log Message: synch 2.4.15 commit 14 Index: README-WIP.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/README-WIP.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- README-WIP.txt 14 Jan 2001 16:27:24 -0000 1.1.1.1 +++ README-WIP.txt 9 Apr 2002 13:30:19 -0000 1.2 @@ -5,18 +5,11 @@ There is no warning any more. Both read-only and read-write stuff is fixed, both in msdos-compatibile mode, and in umsdos EMD mode, and it seems stable. -There are still few hardlink nuisances, but those are not fatal. - -I'd call it pre-release, and ask for as many people as possible to -come and test it! See notes below for some more information, or if -you are trying to use UMSDOS as root partition. Userland NOTE: new umsdos_progs (umssync, umssetup, udosctl & friends) that -will compile and work on 2.2.x kernels and glibc based systems may be found -at http://cvs.linux.hr/ - -Also look at the quick-hack "homepage" for umsdos filesystem at -http://www.voyager.hr/~mnalis/umsdos +will compile and work on 2.2.x+ kernels and glibc based systems, as well as +kernel patches and other umsdos related information may be found at +http://linux.voyager.hr/umsdos/ Information below is getting outdated slowly -- I'll fix it one day when I get enough time - there are more important things to fix right now. @@ -24,7 +17,7 @@ Legend: those lines marked with '+' on the beggining of line indicates it passed all of my tests, and performed perfect in all of them. -Current status (990202) - UMSDOS 0.85: +Current status (010125) - UMSDOS 0.86j: (1) pure MSDOS (no --linux-.--- EMD file): @@ -35,7 +28,7 @@ WRITE: + creat file - works -+ delete file - works ++ unlink file - works + write file - works + rename file (same dir) - works + rename file (dif. dir) - works @@ -66,21 +59,22 @@ WRITE: + create symlink - works -- create hardlink - works ++ create hardlink - works + create file - works + create special file - works + write to file - works + rename file (same dir) - works + rename file (dif. dir) - works -- rename hardlink (same dir) - -- rename hardlink (dif. dir) - ++ rename hardlink (same dir) - works +- rename hardlink (dif. dir) - works, but see notes below. + rename symlink (same dir) - works + rename symlink (dif. dir) - works + rename dir (same dir) - works + rename dir (dif. dir) - works -+ delete file - works ++ unlink file - works + notify_change (chown,perms) - works -+ delete hardlink - works ++ notify_change for hardlinks - works ++ unlink hardlink - works + mkdir - works + rmdir - works + umssyncing (many ioctls) - works @@ -99,24 +93,11 @@ example is specs file about it. Specifically, moving directory which contains hardlinks will break them. -Note: (about pseudoroot) If you are currently trying to use UMSDOS as root -partition (with linux installed in c:\linux) it will boot, but there may be -some problems. Volunteers ready to test pseudoroot are needed (preferably -ones with working backups or unimportant data). For example, '/DOS' pseudo -directory is only partially re-implemented and buggy. It works most of the -time, though. Update: should work ok in 0.84, although it still does not -work correctly in combination with initrd featere. Working on this! - Note: (about creating hardlinks in pseudoroot mode) - hardlinks created in pseudoroot mode are now again compatibile with 'normal' hardlinks, and vice versa. Thanks to Sorin Iordachescu <so...@ro...> for providing fix. - -Warning: (about hardlinks) - modifying hardlinks (esp. if they are in -different directories) are currently somewhat broken, I'm working on it. -Problem seems to be that code uses and updates EMD of directory where 'real -hardlink' is stored, not EMD of directory where our pseudo-hardlink is -located! I'm looking for ideas how to work around this in clean way, since -without it modifying hardlinks in any but most simple ways is broken! +See http://linux.voyager.hr/umsdos/hlbug.html for more info and upgrade +procedure if you used broken versions... ------------------------------------------------------------------------------ @@ -130,6 +111,4 @@ I'm unfortunately somewhat out of time to read linux-kernel@vger, but I do check for messages having "UMSDOS" in the subject, and read them. I might miss some in all that volume, though. I should reply to any direct e-mail -in few days. If I don't, probably I never got your message. You can try -mna...@vo...; however mn...@ja... is preferable. - +in few days. If I don't, probably I never got your message. Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/dir.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- dir.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ dir.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -67,7 +67,7 @@ static int umsdos_dir_once ( void *buf, const char *name, int len, - off_t offset, + loff_t offset, ino_t ino, unsigned type) { @@ -651,13 +651,13 @@ old_root = dget(current->fs->root); read_unlock(¤t->fs->lock); spin_lock(&dcache_lock); - path = __d_path(dentry, NULL, dentry->d_sb->s_root, NULL, buffer, len); + path = __d_path(dentry, current->fs->rootmnt, dentry->d_sb->s_root, current->fs->rootmnt, buffer, len); /* FIXME: current->fs->rootmnt */ spin_unlock(&dcache_lock); if (*path == '/') path++; /* skip leading '/' */ - if (old_root->d_inode == pseudo_root) + if (current->fs->root->d_inode == pseudo_root) { *(path-1) = '/'; path -= (UMSDOS_PSDROOT_LEN+1); Index: emd.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/emd.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- emd.c 14 Jan 2001 16:27:14 -0000 1.1.1.1 +++ emd.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -16,10 +16,23 @@ #include <linux/umsdos_fs.h> #include <linux/dcache.h> #include <linux/pagemap.h> +#include <linux/delay.h> -#include <asm/delay.h> +void put_entry (struct umsdos_dirent *p, struct umsdos_dirent *q) +{ + p->name_len = q->name_len; + p->flags = q->flags; + p->nlink = cpu_to_le16(q->nlink); + p->uid = cpu_to_le16(q->uid); + p->gid = cpu_to_le16(q->gid); + p->atime = cpu_to_le32(q->atime); + p->mtime = cpu_to_le32(q->mtime); + p->ctime = cpu_to_le32(q->ctime); + p->rdev = cpu_to_le16(q->rdev); + p->mode = cpu_to_le16(q->mode); +} -static void copy_entry(struct umsdos_dirent *p, struct umsdos_dirent *q) +static void get_entry(struct umsdos_dirent *p, struct umsdos_dirent *q) { p->name_len = q->name_len; p->name[p->name_len]='\0'; @@ -137,6 +150,7 @@ printk (KERN_WARNING "Ignoring invalid EMD entry with size %d\n", entry->name_len); p->name_len = 0; ret = -ENAMETOOLONG; /* notify umssync(8) code that something is wrong */ + /* FIXME: does not work if we did 'ls -l' before 'udosctl uls' ?! */ } recsize = umsdos_evalrecsize(p->name_len); @@ -164,7 +178,7 @@ page_cache_release(page2); } else memcpy(entry->spare,p->spare,((char*)p+recsize)-p->spare); - copy_entry(entry, p); + get_entry(entry, p); kunmap(page); page_cache_release(page); *pos += recsize; @@ -250,20 +264,11 @@ offs+info->recsize-PAGE_CACHE_SIZE); if (ret) goto out_unlock3; - p->name_len = entry->name_len; - p->flags = entry->flags; - p->nlink = cpu_to_le16(entry->nlink); - p->uid = cpu_to_le16(entry->uid); - p->gid = cpu_to_le16(entry->gid); - p->atime = cpu_to_le32(entry->atime); - p->mtime = cpu_to_le32(entry->mtime); - p->ctime = cpu_to_le32(entry->ctime); - p->rdev = cpu_to_le16(entry->rdev); - p->mode = cpu_to_le16(entry->mode); - memcpy(p->name,entry->name, + put_entry (p, entry); + memcpy(p->spare,entry->spare, (char *)(page_address(page) + PAGE_CACHE_SIZE) - p->spare); memcpy(page_address(page2), - entry->spare+PAGE_CACHE_SIZE-offs, + ((char*)entry)+PAGE_CACHE_SIZE-offs, offs+info->recsize-PAGE_CACHE_SIZE); ret = mapping->a_ops->commit_write(NULL,page2,0, offs+info->recsize-PAGE_CACHE_SIZE); @@ -280,16 +285,7 @@ offs + info->recsize); if (ret) goto out_unlock; - p->name_len = entry->name_len; - p->flags = entry->flags; - p->nlink = cpu_to_le16(entry->nlink); - p->uid = cpu_to_le16(entry->uid); - p->gid = cpu_to_le16(entry->gid); - p->atime = cpu_to_le32(entry->atime); - p->mtime = cpu_to_le32(entry->mtime); - p->ctime = cpu_to_le32(entry->ctime); - p->rdev = cpu_to_le16(entry->rdev); - p->mode = cpu_to_le16(entry->mode); + put_entry (p, entry); memcpy(p->spare,entry->spare,((char*)p+info->recsize)-p->spare); ret = mapping->a_ops->commit_write(NULL,page,offs, offs + info->recsize); @@ -464,7 +460,7 @@ goto skip_it; info->f_pos = pos; - copy_entry(entry, rentry); + get_entry(entry, rentry); ret = 0; break; skip_it: Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/inode.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- inode.c 14 Jan 2001 16:27:11 -0000 1.1.1.1 +++ inode.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -38,7 +38,7 @@ ,atomic_read(&inode->i_count))); if (inode == pseudo_root) { - printk (KERN_ERR "Umsdos: debug: releasing pseudo_root - ino=%lu count=%d\n", inode->i_ino, atomic_read(&inode->i_count)); + Printk ((KERN_ERR "Umsdos: debug: releasing pseudo_root - ino=%lu count=%d\n", inode->i_ino, atomic_read(&inode->i_count))); } if (atomic_read(&inode->i_count) == 1) @@ -49,7 +49,7 @@ void UMSDOS_put_super (struct super_block *sb) { Printk ((KERN_DEBUG "UMSDOS_put_super: entering\n")); - if (saved_root) { + if (saved_root && pseudo_root && sb->s_dev == ROOT_DEV) { shrink_dcache_parent(saved_root); dput(saved_root); saved_root = NULL; @@ -153,16 +153,56 @@ } -int umsdos_notify_change_locked(struct dentry *, struct iattr *); /* * lock the parent dir before starting ... + * also handles hardlink converting */ int UMSDOS_notify_change (struct dentry *dentry, struct iattr *attr) { - struct inode *dir = dentry->d_parent->d_inode; - struct inode *inode = dentry->d_inode; + struct inode *dir, *inode; + struct umsdos_info info; + struct dentry *temp, *old_dentry = NULL; int ret; + ret = umsdos_parse (dentry->d_name.name, dentry->d_name.len, + &info); + if (ret) + goto out; + ret = umsdos_findentry (dentry->d_parent, &info, 0); + if (ret) { +printk("UMSDOS_notify_change: %s/%s not in EMD, ret=%d\n", +dentry->d_parent->d_name.name, dentry->d_name.name, ret); + goto out; + } + + if (info.entry.flags & UMSDOS_HLINK) { + /* + * In order to get the correct (real) inode, we just drop + * the original dentry. + */ + d_drop(dentry); +Printk(("UMSDOS_notify_change: hard link %s/%s, fake=%s\n", +dentry->d_parent->d_name.name, dentry->d_name.name, info.fake.fname)); + + /* Do a real lookup to get the short name dentry */ + temp = umsdos_covered(dentry->d_parent, info.fake.fname, + info.fake.len); + ret = PTR_ERR(temp); + if (IS_ERR(temp)) + goto out; + + /* now resolve the link ... */ + temp = umsdos_solve_hlink(temp); + ret = PTR_ERR(temp); + if (IS_ERR(temp)) + goto out; + old_dentry = dentry; + dentry = temp; /* so umsdos_notify_change_locked will operate on that */ + } + + dir = dentry->d_parent->d_inode; + inode = dentry->d_inode; + ret = inode_change_ok (inode, attr); if (ret) goto out; @@ -171,11 +211,14 @@ ret = umsdos_notify_change_locked(dentry, attr); up(&dir->i_sem); if (ret == 0) - inode_setattr (inode, attr); + ret = inode_setattr (inode, attr); out: + if (old_dentry) + dput (dentry); /* if we had to use fake dentry for hardlinks, dput() it now */ return ret; } + /* * Must be called with the parent lock held. */ @@ -316,16 +359,16 @@ struct super_block *res; struct dentry *new_root; - MSDOS_SB(sb)->options.isvfat = 0; /* * Call msdos-fs to mount the disk. * Note: this returns res == sb or NULL */ res = msdos_read_super (sb, data, silent); + if (!res) goto out_fail; - printk (KERN_INFO "UMSDOS 0.86i " + printk (KERN_INFO "UMSDOS 0.86k " "(compatibility level %d.%d, fast msdos)\n", UMSDOS_VERSION, UMSDOS_RELEASE); @@ -334,6 +377,7 @@ /* install our dentry operations ... */ sb->s_root->d_op = &umsdos_dentry_operations; + umsdos_patch_dentry_inode(sb->s_root, 0); /* Check whether to change to the /linux root */ @@ -345,10 +389,9 @@ printk("umsdos_read_super: pseudo-root wrong ops!\n"); pseudo_root = new_root->d_inode; - saved_root = sb->s_root; - sb->s_root = new_root; printk(KERN_INFO "UMSDOS: changed to alternate root\n"); + dget (sb->s_root); sb->s_root = dget(new_root); } return sb; @@ -378,21 +421,23 @@ * lookup_dentry needs a (so far non-existent) root. */ printk(KERN_INFO "check_pseudo_root: mounted as root\n"); - root = lookup_one(UMSDOS_PSDROOT_NAME, sb->s_root); + root = lookup_one_len(UMSDOS_PSDROOT_NAME, sb->s_root,UMSDOS_PSDROOT_LEN); if (IS_ERR(root)) goto out_noroot; + if (!root->d_inode || !S_ISDIR(root->d_inode->i_mode)) goto out_dput; - printk(KERN_INFO "check_pseudo_root: found %s/%s\n", root->d_parent->d_name.name, root->d_name.name); +printk(KERN_INFO "check_pseudo_root: found %s/%s\n", +root->d_parent->d_name.name, root->d_name.name); /* look for /sbin/init */ - sbin = lookup_one("sbin", root); + sbin = lookup_one_len("sbin", root, 4); if (IS_ERR(sbin)) goto out_dput; if (!sbin->d_inode || !S_ISDIR(sbin->d_inode->i_mode)) goto out_dput_sbin; - init = lookup_one("init", sbin); + init = lookup_one_len("init", sbin, 4); if (IS_ERR(init)) goto out_dput_sbin; if (!init->d_inode) @@ -430,3 +475,4 @@ module_init(init_umsdos_fs) module_exit(exit_umsdos_fs) +MODULE_LICENSE("GPL"); Index: ioctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ioctl.c 14 Jan 2001 16:27:15 -0000 1.1.1.1 +++ ioctl.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -28,7 +28,7 @@ void *buf, const char *name, int name_len, - off_t offset, + loff_t offset, ino_t ino, unsigned type) { @@ -95,7 +95,7 @@ && cmd != UMSDOS_DOS_SETUP) return fat_dir_ioctl (dir, filp, cmd, data_ptr); - /* #Specification: ioctl / acces + /* #Specification: ioctl / access * Only root (effective id) is allowed to do IOCTL on directory * in UMSDOS. EPERM is returned for other user. */ Index: namei.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/namei.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- namei.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ namei.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -405,8 +405,15 @@ goto out_unlock; /* make sure it's the same inode! */ ret = -ENOENT; - if (old->d_inode != old_inode) - goto out_dput; + /* + * note: for hardlinks they will be different! + * old_inode will contain inode of .LINKxxx file containing data, and + * old->d_inode will contain inode of file containing path to .LINKxxx file + */ + if (!(old_info.entry.flags & UMSDOS_HLINK)) { + if (old->d_inode != old_inode) + goto out_dput; + } new = umsdos_covered(new_dentry->d_parent, new_info.fake.fname, new_info.fake.len); @@ -491,7 +498,7 @@ goto out; } - len = strlen (symname); + len = strlen (symname) + 1; ret = block_symlink(dentry->d_inode, symname, len); if (ret < 0) goto out_unlink; @@ -531,7 +538,7 @@ struct umsdos_info hid_info; #ifdef UMSDOS_DEBUG_VERBOSE -printk("umsdos_link: new %s%s -> %s/%s\n", +printk("umsdos_link: new %s/%s -> %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name, olddentry->d_parent->d_name.name, olddentry->d_name.name); #endif @@ -698,17 +705,36 @@ if (ret == 0) { struct iattr newattrs; + /* Do a real lookup to get the short name dentry */ + temp = umsdos_covered(olddentry->d_parent, + old_info.fake.fname, + old_info.fake.len); + ret = PTR_ERR(temp); + if (IS_ERR(temp)) + goto out_unlock2; + + /* now resolve the link ... */ + temp = umsdos_solve_hlink(temp); + ret = PTR_ERR(temp); + if (IS_ERR(temp)) + goto out_unlock2; + + #ifdef UMSDOS_PARANOIA if (!oldinode->u.umsdos_i.i_is_hlink) printk("UMSDOS_link: %s/%s, ino=%ld, not marked as hlink!\n", olddentry->d_parent->d_name.name, olddentry->d_name.name, oldinode->i_ino); #endif - oldinode->i_nlink++; + temp->d_inode->i_nlink++; Printk(("UMSDOS_link: linked %s/%s, ino=%ld, nlink=%d\n", olddentry->d_parent->d_name.name, olddentry->d_name.name, oldinode->i_ino, oldinode->i_nlink)); newattrs.ia_valid = 0; - ret = umsdos_notify_change_locked(olddentry, &newattrs); + ret = umsdos_notify_change_locked(temp, &newattrs); + if (ret == 0) + mark_inode_dirty(temp->d_inode); + dput(temp); +out_unlock2: if (ret == 0) mark_inode_dirty(olddentry->d_inode); } Index: rdir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/umsdos/rdir.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rdir.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ rdir.c 9 Apr 2002 13:30:19 -0000 1.2 @@ -32,7 +32,7 @@ static int rdir_filldir ( void *buf, const char *name, int name_len, - off_t offset, + loff_t offset, ino_t ino, unsigned int d_type) { @@ -111,6 +111,9 @@ */ Printk ((KERN_DEBUG "umsdos_rlookup_x: patch_dentry_inode %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name)); +/* only patch if needed (because we get called even for lookup + (not only rlookup) stuff sometimes, like in umsdos_covered() */ + if (dentry->d_inode->u.umsdos_i.i_patched == 0) umsdos_patch_dentry_inode(dentry, 0); } |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/ite-boards In directory usw-pr-cvs1:/tmp/cvs-serv18834/arch/mips/ite-boards Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/ite-boards added to the repository |
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:13
|
Update of /cvsroot/linux-vax/kernel-2.4/include/pcmcia
In directory usw-pr-cvs1:/tmp/cvs-serv26214/pcmcia
Modified Files:
ciscode.h cs_types.h ss.h
Log Message:
synch 2.4.15 commit 10
Index: ciscode.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/pcmcia/ciscode.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- ciscode.h 25 Feb 2001 23:14:53 -0000 1.1.1.2
+++ ciscode.h 9 Apr 2002 13:07:33 -0000 1.2
@@ -112,10 +112,12 @@
#define PRODID_SOCKET_DUAL_RS232 0x0006
#define PRODID_SOCKET_EIO 0x000a
#define PRODID_SOCKET_LPE 0x000d
+#define PRODID_SOCKET_LPE_CF 0x0075
#define MANFID_SUNDISK 0x0045
#define MANFID_TDK 0x0105
+#define PRODID_TDK_CF010 0x0900
#define MANFID_TOSHIBA 0x0098
Index: cs_types.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/pcmcia/cs_types.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- cs_types.h 25 Feb 2001 23:14:53 -0000 1.1.1.2
+++ cs_types.h 9 Apr 2002 13:07:33 -0000 1.2
@@ -36,8 +36,13 @@
#include <sys/types.h>
#endif
-typedef u_short socket_t;
+#ifdef __arm__
+typedef u_int ioaddr_t;
+#else
typedef u_short ioaddr_t;
+#endif
+
+typedef u_short socket_t;
typedef u_int event_t;
typedef u_char cisdata_t;
typedef u_short page_t;
Index: ss.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/pcmcia/ss.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- ss.h 25 Feb 2001 23:14:53 -0000 1.1.1.2
+++ ss.h 9 Apr 2002 13:07:33 -0000 1.2
@@ -30,6 +30,8 @@
#ifndef _LINUX_SS_H
#define _LINUX_SS_H
+#include <pcmcia/cs_types.h>
+
/* Definitions for card status flags for GetStatus */
#define SS_WRPROT 0x0001
#define SS_CARDLOCK 0x0002
@@ -52,6 +54,7 @@
u_int features;
u_int irq_mask;
u_int map_size;
+ ioaddr_t io_offset;
u_char pci_irq;
struct pci_dev *cb_dev;
struct bus_operations *bus;
@@ -101,7 +104,7 @@
u_char map;
u_char flags;
u_short speed;
- u_short start, stop;
+ ioaddr_t start, stop;
} pccard_io_map;
typedef struct pccard_mem_map {
|
|
From: Andy P. <at...@us...> - 2002-04-09 15:08:12
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/lockd
In directory usw-pr-cvs1:/tmp/cvs-serv29245/lockd
Modified Files:
clntlock.c clntproc.c host.c lockd_syms.c mon.c svc.c
svc4proc.c svclock.c svcproc.c svcsubs.c xdr.c xdr4.c
Log Message:
synch 2.4.15 commit 13
Index: clntlock.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/clntlock.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- clntlock.c 14 Jan 2001 16:29:33 -0000 1.1.1.1
+++ clntlock.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -8,6 +8,7 @@
#define __KERNEL_SYSCALLS__
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/nfs_fs.h>
@@ -17,7 +18,7 @@
#include <linux/lockd/lockd.h>
#include <linux/smp_lock.h>
-#define NLMDBG_FACILITY NLMDBG_CIENT
+#define NLMDBG_FACILITY NLMDBG_CLIENT
/*
* Local function prototypes
@@ -131,29 +132,63 @@
*/
/*
+ * Mark the locks for reclaiming.
+ * FIXME: In 2.5 we don't want to iterate through any global file_lock_list.
+ * Maintain NLM lock reclaiming lists in the nlm_host instead.
+ */
+static
+void nlmclnt_mark_reclaim(struct nlm_host *host)
+{
+ struct file_lock *fl;
+ struct inode *inode;
+ struct list_head *tmp;
+
+ list_for_each(tmp, &file_lock_list) {
+ fl = list_entry(tmp, struct file_lock, fl_link);
+
+ inode = fl->fl_file->f_dentry->d_inode;
+ if (inode->i_sb->s_magic != NFS_SUPER_MAGIC)
+ continue;
+ if (fl->fl_u.nfs_fl.host != host)
+ continue;
+ if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED))
+ continue;
+ fl->fl_u.nfs_fl.flags |= NFS_LCK_RECLAIM;
+ }
+}
+
+/*
+ * Someone has sent us an SM_NOTIFY. Ensure we bind to the new port number,
+ * that we mark locks for reclaiming, and that we bump the pseudo NSM state.
+ */
+static inline
+void nlmclnt_prepare_reclaim(struct nlm_host *host, u32 newstate)
+{
+ host->h_monitored = 0;
+ host->h_nsmstate = newstate;
+ host->h_state++;
+ host->h_nextrebind = 0;
+ nlm_rebind_host(host);
+ nlmclnt_mark_reclaim(host);
+ dprintk("NLM: reclaiming locks for host %s", host->h_name);
+}
+
+/*
* Reclaim all locks on server host. We do this by spawning a separate
* reclaimer thread.
- * FIXME: should bump MOD_USE_COUNT while reclaiming
*/
void
nlmclnt_recovery(struct nlm_host *host, u32 newstate)
{
- if (!host->h_reclaiming++) {
+ if (host->h_reclaiming++) {
if (host->h_nsmstate == newstate)
return;
- printk(KERN_WARNING
- "lockd: Uh-oh! Interfering reclaims for host %s",
- host->h_name);
- host->h_monitored = 0;
- host->h_nsmstate = newstate;
- host->h_state++;
- nlm_release_host(host);
+ nlmclnt_prepare_reclaim(host, newstate);
} else {
- host->h_monitored = 0;
- host->h_nsmstate = newstate;
- host->h_state++;
+ nlmclnt_prepare_reclaim(host, newstate);
nlm_get_host(host);
- kernel_thread(reclaimer, host, 0);
+ MOD_INC_USE_COUNT;
+ kernel_thread(reclaimer, host, CLONE_SIGNAL);
}
}
@@ -163,27 +198,38 @@
struct nlm_host *host = (struct nlm_host *) ptr;
struct nlm_wait *block;
struct list_head *tmp;
+ struct file_lock *fl;
+ struct inode *inode;
+
+ daemonize();
+ reparent_to_init();
+ snprintf(current->comm, sizeof(current->comm),
+ "%s-reclaim",
+ host->h_name);
/* This one ensures that our parent doesn't terminate while the
* reclaim is in progress */
lock_kernel();
lockd_up();
- /* First, reclaim all locks that have been granted previously. */
+ /* First, reclaim all locks that have been marked. */
restart:
- tmp = file_lock_list.next;
- while (tmp != &file_lock_list) {
- struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link);
- struct inode *inode = fl->fl_file->f_dentry->d_inode;
- if (inode->i_sb->s_magic == NFS_SUPER_MAGIC &&
- nlm_cmp_addr(NFS_ADDR(inode), &host->h_addr) &&
- fl->fl_u.nfs_fl.state != host->h_state &&
- (fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED)) {
- fl->fl_u.nfs_fl.flags &= ~ NFS_LCK_GRANTED;
- nlmclnt_reclaim(host, fl); /* This sleeps */
- goto restart;
- }
- tmp = tmp->next;
+ list_for_each(tmp, &file_lock_list) {
+ fl = list_entry(tmp, struct file_lock, fl_link);
+
+ inode = fl->fl_file->f_dentry->d_inode;
+ if (inode->i_sb->s_magic != NFS_SUPER_MAGIC)
+ continue;
+ if (fl->fl_u.nfs_fl.host != host)
+ continue;
+ if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_RECLAIM))
+ continue;
+
+ fl->fl_u.nfs_fl.flags &= ~NFS_LCK_RECLAIM;
+ nlmclnt_reclaim(host, fl);
+ if (signalled())
+ break;
+ goto restart;
}
host->h_reclaiming = 0;
@@ -201,6 +247,7 @@
nlm_release_host(host);
lockd_down();
unlock_kernel();
+ MOD_DEC_USE_COUNT;
return 0;
}
Index: clntproc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/clntproc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- clntproc.c 14 Jan 2001 16:29:35 -0000 1.1.1.1
+++ clntproc.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -6,6 +6,7 @@
* Copyright (C) 1996, Olaf Kirch <ok...@mo...>
*/
+#include <linux/config.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fs.h>
@@ -18,6 +19,7 @@
#include <linux/lockd/sm_inter.h>
#define NLMDBG_FACILITY NLMDBG_CLIENT
+#define NLMCLNT_GRACE_WAIT (5*HZ)
static int nlmclnt_test(struct nlm_rqst *, struct file_lock *);
static int nlmclnt_lock(struct nlm_rqst *, struct file_lock *);
@@ -142,7 +144,7 @@
/* If we're cleaning up locks because the process is exiting,
* perform the RPC call asynchronously. */
- if ((cmd == F_SETLK || cmd == F_SETLKW)
+ if ((IS_SETLK(cmd) || IS_SETLKW(cmd))
&& fl->fl_type == F_UNLCK
&& (current->flags & PF_EXITING)) {
sigfillset(¤t->blocked); /* Mask all signals */
@@ -166,17 +168,16 @@
/* Set up the argument struct */
nlmclnt_setlockargs(call, fl);
- if (cmd == F_GETLK) {
+ if (IS_SETLK(cmd) || IS_SETLKW(cmd)) {
+ if (fl->fl_type != F_UNLCK) {
+ call->a_args.block = IS_SETLKW(cmd) ? 1 : 0;
+ status = nlmclnt_lock(call, fl);
+ } else
+ status = nlmclnt_unlock(call, fl);
+ } else if (IS_GETLK(cmd))
status = nlmclnt_test(call, fl);
- } else if ((cmd == F_SETLK || cmd == F_SETLKW)
- && fl->fl_type == F_UNLCK) {
- status = nlmclnt_unlock(call, fl);
- } else if (cmd == F_SETLK || cmd == F_SETLKW) {
- call->a_args.block = (cmd == F_SETLKW)? 1 : 0;
- status = nlmclnt_lock(call, fl);
- } else {
+ else
status = -EINVAL;
- }
if (status < 0 && (call->a_flags & RPC_TASK_ASYNC))
kfree(call);
@@ -558,19 +559,22 @@
if (task->tk_status < 0) {
dprintk("lockd: unlock failed (err = %d)\n", -task->tk_status);
- goto retry_unlock;
+ goto retry_rebind;
}
- if (status != NLM_LCK_GRANTED
- && status != NLM_LCK_DENIED_GRACE_PERIOD) {
- printk("lockd: unexpected unlock status: %d\n", status);
+ if (status == NLM_LCK_DENIED_GRACE_PERIOD) {
+ rpc_delay(task, NLMCLNT_GRACE_WAIT);
+ goto retry_unlock;
}
+ if (status != NLM_LCK_GRANTED)
+ printk(KERN_WARNING "lockd: unexpected unlock status: %d\n", status);
die:
nlm_release_host(req->a_host);
kfree(req);
return;
- retry_unlock:
+ retry_rebind:
nlm_rebind_host(req->a_host);
+ retry_unlock:
rpc_restart_call(task);
}
@@ -673,6 +677,18 @@
case NLM_LCK_BLOCKED:
printk(KERN_NOTICE "lockd: unexpected status NLM_BLOCKED\n");
return -ENOLCK;
+#ifdef CONFIG_LOCKD_V4
+ case NLM_DEADLCK:
+ return -EDEADLK;
+ case NLM_ROFS:
+ return -EROFS;
+ case NLM_STALE_FH:
+ return -ESTALE;
+ case NLM_FBIG:
+ return -EOVERFLOW;
+ case NLM_FAILED:
+ return -ENOLCK;
+#endif
}
printk(KERN_NOTICE "lockd: unexpected server status %d\n", status);
return -ENOLCK;
Index: host.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/host.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- host.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ host.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -51,7 +51,8 @@
struct nlm_host *
nlmsvc_lookup_host(struct svc_rqst *rqstp)
{
- return nlm_lookup_host(rqstp->rq_client, &rqstp->rq_addr, 0, 0);
+ return nlm_lookup_host(rqstp->rq_client, &rqstp->rq_addr,
+ rqstp->rq_prot, rqstp->rq_vers);
}
/*
@@ -97,7 +98,9 @@
nlm_gc_hosts();
for (hp = &nlm_hosts[hash]; (host = *hp); hp = &host->h_next) {
- if (host->h_version != version || host->h_proto != proto)
+ if (proto && host->h_proto != proto)
+ continue;
+ if (version && host->h_version != version)
continue;
if (nlm_match_host(host, clnt, sin)) {
@@ -325,7 +328,8 @@
}
dprintk("lockd: delete host %s\n", host->h_name);
*q = host->h_next;
- if (host->h_monitored)
+ /* Don't unmonitor hosts that have been invalidated */
+ if (host->h_monitored && !host->h_killed)
nsm_unmonitor(host);
if ((clnt = host->h_rpcclnt) != NULL) {
if (atomic_read(&clnt->cl_users)) {
Index: lockd_syms.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/lockd_syms.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- lockd_syms.c 14 Jan 2001 16:29:39 -0000 1.1.1.1
+++ lockd_syms.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -35,8 +35,4 @@
EXPORT_SYMBOL(nlmsvc_invalidate_client);
EXPORT_SYMBOL(nlmsvc_ops);
-/* Configuration at insmod time */
-EXPORT_SYMBOL(nlmsvc_grace_period);
-EXPORT_SYMBOL(nlmsvc_timeout);
-
#endif /* CONFIG_MODULES */
Index: mon.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/mon.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- mon.c 14 Jan 2001 16:29:39 -0000 1.1.1.1
+++ mon.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -43,7 +43,7 @@
args.addr = host->h_addr.sin_addr.s_addr;
args.prog = NLM_PROGRAM;
- args.vers = 1;
+ args.vers = host->h_version;
args.proc = NLMPROC_NSM_NOTIFY;
memset(res, 0, sizeof(*res));
@@ -146,7 +146,7 @@
u32 addr = ntohl(argp->addr);
dprintk("nsm: xdr_encode_mon(%08x, %d, %d, %d)\n",
- htonl(argp->addr), htonl(argp->proc),
+ htonl(argp->addr), htonl(argp->prog),
htonl(argp->vers), htonl(argp->proc));
/*
Index: svc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/svc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- svc.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ svc.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -15,6 +15,7 @@
#define __KERNEL_SYSCALLS__
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/init.h>
#include <linux/sched.h>
#include <linux/errno.h>
@@ -43,7 +44,7 @@
static DECLARE_MUTEX(nlmsvc_sema);
static unsigned int nlmsvc_users;
static pid_t nlmsvc_pid;
-unsigned long nlmsvc_grace_period;
+int nlmsvc_grace_period;
unsigned long nlmsvc_timeout;
static DECLARE_MUTEX_LOCKED(lockd_start);
@@ -55,6 +56,26 @@
*/
unsigned long nlm_grace_period;
unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
+unsigned long nlm_udpport, nlm_tcpport;
+
+static unsigned long set_grace_period(void)
+{
+ unsigned long grace_period;
+
+ /* Note: nlm_timeout should always be nonzero */
+ if (nlm_grace_period)
+ grace_period = ((nlm_grace_period + nlm_timeout - 1)
+ / nlm_timeout) * nlm_timeout * HZ;
+ else
+ grace_period = nlm_timeout * 5 * HZ;
+ nlmsvc_grace_period = 1;
+ return grace_period + jiffies;
+}
+
+static inline void clear_grace_period(void)
+{
+ nlmsvc_grace_period = 0;
+}
/*
* This is the lockd kernel thread
@@ -76,45 +97,27 @@
nlmsvc_pid = current->pid;
up(&lockd_start);
- exit_mm(current);
- current->session = 1;
- current->pgrp = 1;
+ daemonize();
+ reparent_to_init();
sprintf(current->comm, "lockd");
/* Process request with signals blocked. */
spin_lock_irq(¤t->sigmask_lock);
siginitsetinv(¤t->blocked, sigmask(SIGKILL));
recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ spin_unlock_irq(¤t->sigmask_lock);
/* kick rpciod */
rpciod_up();
- /*
- * N.B. current do_fork() doesn't like NULL task->files,
- * so we defer closing files until forking rpciod.
- */
- exit_files(current);
-
dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
if (!nlm_timeout)
nlm_timeout = LOCKD_DFLT_TIMEO;
-
-#ifdef RPC_DEBUG
- nlmsvc_grace_period = 10 * HZ;
-#else
- if (nlm_grace_period) {
- nlmsvc_grace_period += (1 + nlm_grace_period / nlm_timeout)
- * nlm_timeout * HZ;
- } else {
- nlmsvc_grace_period += 5 * nlm_timeout * HZ;
- }
-#endif
-
- grace_period_expire = nlmsvc_grace_period + jiffies;
nlmsvc_timeout = nlm_timeout * HZ;
+ grace_period_expire = set_grace_period();
+
/*
* The main request loop. We don't terminate until the last
* NFS mount or NFS daemon has gone away, and we've been sent a
@@ -127,6 +130,10 @@
spin_lock_irq(¤t->sigmask_lock);
flush_signals(current);
spin_unlock_irq(¤t->sigmask_lock);
+ if (nlmsvc_ops) {
+ nlmsvc_ops->detach();
+ grace_period_expire = set_grace_period();
+ }
}
/*
@@ -137,20 +144,20 @@
*/
if (!nlmsvc_grace_period) {
timeout = nlmsvc_retry_blocked();
- } else if (time_before(nlmsvc_grace_period, jiffies))
- nlmsvc_grace_period = 0;
+ } else if (time_before(grace_period_expire, jiffies))
+ clear_grace_period();
/*
* Find a socket with data available and call its
* recvfrom routine.
*/
- if ((err = svc_recv(serv, rqstp, timeout)) == -EAGAIN)
+ err = svc_recv(serv, rqstp, timeout);
+ if (err == -EAGAIN || err == -EINTR)
continue;
if (err < 0) {
- if (err != -EINTR)
- printk(KERN_WARNING
- "lockd: terminating on error %d\n",
- -err);
+ printk(KERN_WARNING
+ "lockd: terminating on error %d\n",
+ -err);
break;
}
@@ -180,6 +187,8 @@
* shutting down the hosts and clearing the slot.
*/
if (!nlmsvc_pid || current->pid == nlmsvc_pid) {
+ if (nlmsvc_ops)
+ nlmsvc_ops->detach();
nlm_shutdown_hosts();
nlmsvc_pid = 0;
} else
@@ -234,9 +243,9 @@
goto out;
}
- if ((error = svc_makesock(serv, IPPROTO_UDP, 0)) < 0
+ if ((error = svc_makesock(serv, IPPROTO_UDP, nlm_udpport)) < 0
#ifdef CONFIG_NFSD_TCP
- || (error = svc_makesock(serv, IPPROTO_TCP, 0)) < 0
+ || (error = svc_makesock(serv, IPPROTO_TCP, nlm_tcpport)) < 0
#endif
) {
if (warned++ == 0)
@@ -314,8 +323,11 @@
MODULE_AUTHOR("Olaf Kirch <ok...@mo...>");
MODULE_DESCRIPTION("NFS file locking service version " LOCKD_VERSION ".");
+MODULE_LICENSE("GPL");
MODULE_PARM(nlm_grace_period, "10-240l");
MODULE_PARM(nlm_timeout, "3-20l");
+MODULE_PARM(nlm_udpport, "0-65535l");
+MODULE_PARM(nlm_tcpport, "0-65535l");
int
init_module(void)
@@ -333,13 +345,31 @@
/* FIXME: delete all NLM clients */
nlm_shutdown_hosts();
}
+#else
+/* not a module, so process bootargs
+ * lockd.udpport and lockd.tcpport
+ */
+
+static int __init udpport_set(char *str)
+{
+ nlm_udpport = simple_strtoul(str, NULL, 0);
+ return 1;
+}
+static int __init tcpport_set(char *str)
+{
+ nlm_tcpport = simple_strtoul(str, NULL, 0);
+ return 1;
+}
+__setup("lockd.udpport=", udpport_set);
+__setup("lockd.tcpport=", tcpport_set);
+
#endif
/*
* Define NLM program and procedures
*/
static struct svc_version nlmsvc_version1 = {
- 1, 16, nlmsvc_procedures, NULL
+ 1, 17, nlmsvc_procedures, NULL
};
static struct svc_version nlmsvc_version3 = {
3, 24, nlmsvc_procedures, NULL
Index: svc4proc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/svc4proc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- svc4proc.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ svc4proc.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -420,6 +420,8 @@
void *resp)
{
struct sockaddr_in saddr = rqstp->rq_addr;
+ int vers = rqstp->rq_vers;
+ int prot = rqstp->rq_prot;
struct nlm_host *host;
dprintk("lockd: SM_NOTIFY called\n");
@@ -435,8 +437,8 @@
/* Obtain the host pointer for this NFS server and try to
* reclaim all locks we hold on this server.
*/
- saddr.sin_addr.s_addr = argp->addr;
- if ((host = nlm_lookup_host(NULL, &saddr, IPPROTO_UDP, 1)) != NULL) {
+ saddr.sin_addr.s_addr = argp->addr;
+ if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) {
nlmclnt_recovery(host, argp->state);
nlm_release_host(host);
}
@@ -444,7 +446,7 @@
/* If we run on an NFS server, delete all locks held by the client */
if (nlmsvc_ops != NULL) {
struct svc_client *clnt;
- saddr.sin_addr.s_addr = argp->addr;
+ saddr.sin_addr.s_addr = argp->addr;
if ((clnt = nlmsvc_ops->exp_getclient(&saddr)) != NULL
&& (host = nlm_lookup_host(clnt, &saddr, 0, 0)) != NULL) {
nlmsvc_free_host_resources(host);
@@ -549,7 +551,8 @@
PROC(cancel_res, cancelres, norep, res, void),
PROC(unlock_res, unlockres, norep, res, void),
PROC(granted_res, grantedres, norep, res, void),
- PROC(none, void, void, void, void),
+ /* statd callback */
+ PROC(sm_notify, reboot, void, reboot, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
@@ -558,6 +561,4 @@
PROC(nm_lock, lockargs, res, args, res),
PROC(free_all, notify, void, args, void),
- /* statd callback */
- PROC(sm_notify, reboot, void, reboot, void),
};
Index: svclock.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/svclock.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- svclock.c 14 Jan 2001 16:29:42 -0000 1.1.1.1
+++ svclock.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -31,9 +31,14 @@
#include <linux/lockd/nlm.h>
#include <linux/lockd/lockd.h>
-
#define NLMDBG_FACILITY NLMDBG_SVCLOCK
+#ifdef CONFIG_LOCKD_V4
+#define nlm_deadlock nlm4_deadlock
+#else
+#define nlm_deadlock nlm_lck_denied
+#endif
+
static void nlmsvc_insert_block(struct nlm_block *block, unsigned long);
static int nlmsvc_remove_block(struct nlm_block *block);
static void nlmsvc_grant_callback(struct rpc_task *task);
@@ -330,12 +335,7 @@
case 0:
return nlm_granted;
case EDEADLK:
-#ifdef CONFIG_LOCKD_V4
- return nlm4_deadlock; /* will be downgraded to lck_deined if this
- * is a NLMv1,3 request */
-#else
- /* no applicable NLM status */
-#endif
+ return nlm_deadlock;
case EAGAIN:
return nlm_lck_denied;
default: /* includes ENOLCK */
@@ -346,6 +346,11 @@
if (!wait) {
up(&file->f_sema);
return nlm_lck_denied;
+ }
+
+ if (posix_locks_deadlock(&lock->fl, conflock)) {
+ up(&file->f_sema);
+ return nlm_deadlock;
}
/* If we don't have a block, create and initialize it. Then
Index: svcproc.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/svcproc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- svcproc.c 25 Feb 2001 23:14:46 -0000 1.1.1.2
+++ svcproc.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -29,17 +29,20 @@
static u32
cast_to_nlm(u32 status, u32 vers)
{
-
+ /* Note: status is assumed to be in network byte order !!! */
if (vers != 4){
- switch(ntohl(status)){
- case NLM_LCK_GRANTED:
- case NLM_LCK_DENIED:
- case NLM_LCK_DENIED_NOLOCKS:
- case NLM_LCK_BLOCKED:
- case NLM_LCK_DENIED_GRACE_PERIOD:
+ switch (status) {
+ case nlm_granted:
+ case nlm_lck_denied:
+ case nlm_lck_denied_nolocks:
+ case nlm_lck_blocked:
+ case nlm_lck_denied_grace_period:
+ break;
+ case nlm4_deadlock:
+ status = nlm_lck_denied;
break;
default:
- status = NLM_LCK_DENIED_NOLOCKS;
+ status = nlm_lck_denied_nolocks;
}
}
@@ -445,6 +448,8 @@
void *resp)
{
struct sockaddr_in saddr = rqstp->rq_addr;
+ int vers = rqstp->rq_vers;
+ int prot = rqstp->rq_prot;
struct nlm_host *host;
dprintk("lockd: SM_NOTIFY called\n");
@@ -460,8 +465,8 @@
/* Obtain the host pointer for this NFS server and try to
* reclaim all locks we hold on this server.
*/
- saddr.sin_addr.s_addr = argp->addr;
- if ((host = nlm_lookup_host(NULL, &saddr, IPPROTO_UDP, 1)) != NULL) {
+ saddr.sin_addr.s_addr = argp->addr;
+ if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) {
nlmclnt_recovery(host, argp->state);
nlm_release_host(host);
}
@@ -574,7 +579,8 @@
PROC(cancel_res, cancelres, norep, res, void),
PROC(unlock_res, unlockres, norep, res, void),
PROC(granted_res, grantedres, norep, res, void),
- PROC(none, void, void, void, void),
+ /* statd callback */
+ PROC(sm_notify, reboot, void, reboot, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
PROC(none, void, void, void, void),
@@ -583,6 +589,4 @@
PROC(nm_lock, lockargs, res, args, res),
PROC(free_all, notify, void, args, void),
- /* statd callback */
- PROC(sm_notify, reboot, void, reboot, void),
};
Index: svcsubs.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/svcsubs.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- svcsubs.c 14 Jan 2001 16:29:37 -0000 1.1.1.1
+++ svcsubs.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -305,6 +305,7 @@
dprintk("lockd: invalidating client for %s\n", host->h_name);
nlmsvc_free_host_resources(host);
host->h_expires = 0;
+ host->h_killed = 1;
nlm_release_host(host);
}
}
Index: xdr.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/xdr.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- xdr.c 14 Jan 2001 16:29:46 -0000 1.1.1.1
+++ xdr.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -91,6 +91,7 @@
return NULL;
}
f->size = NFS2_FHSIZE;
+ memset(f->data, 0, sizeof(f->data));
memcpy(f->data, p, NFS2_FHSIZE);
return p + XDR_QUADLEN(NFS2_FHSIZE);
}
@@ -124,7 +125,9 @@
struct file_lock *fl = &lock->fl;
s32 start, len, end;
- if (!(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN))
+ if (!(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len,
+ NLM_MAXSTRLEN))
|| !(p = nlm_decode_fh(p, &lock->fh))
|| !(p = nlm_decode_oh(p, &lock->oh)))
return NULL;
@@ -311,14 +314,14 @@
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
{
struct nlm_lock *lock = &argp->lock;
- int len;
memset(lock, 0, sizeof(*lock));
locks_init_lock(&lock->fl);
lock->fl.fl_pid = ~(u32) 0;
if (!(p = nlm_decode_cookie(p, &argp->cookie))
- || !(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN))
+ || !(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len, NLM_MAXSTRLEN))
|| !(p = nlm_decode_fh(p, &lock->fh))
|| !(p = nlm_decode_oh(p, &lock->oh)))
return 0;
@@ -350,9 +353,9 @@
nlmsvc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
{
struct nlm_lock *lock = &argp->lock;
- int len;
- if (!(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN)))
+ if (!(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len, NLM_MAXSTRLEN)))
return 0;
argp->state = ntohl(*p++);
return xdr_argsize_check(rqstp, p);
@@ -361,10 +364,11 @@
int
nlmsvc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
{
- if (!(p = xdr_decode_string(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
+ if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
return 0;
argp->state = ntohl(*p++);
- argp->addr = ntohl(*p++);
+ /* Preserve the address in network byte order */
+ argp->addr = *p++;
return xdr_argsize_check(rqstp, p);
}
Index: xdr4.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/fs/lockd/xdr4.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- xdr4.c 14 Jan 2001 16:29:50 -0000 1.1.1.1
+++ xdr4.c 9 Apr 2002 13:19:34 -0000 1.2
@@ -124,9 +124,9 @@
{
struct file_lock *fl = &lock->fl;
__s64 len, start, end;
- int tmp;
- if (!(p = xdr_decode_string(p, &lock->caller, &tmp, NLM_MAXSTRLEN))
+ if (!(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len, NLM_MAXSTRLEN))
|| !(p = nlm4_decode_fh(p, &lock->fh))
|| !(p = nlm4_decode_oh(p, &lock->oh)))
return NULL;
@@ -320,14 +320,14 @@
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
{
struct nlm_lock *lock = &argp->lock;
- int len;
memset(lock, 0, sizeof(*lock));
locks_init_lock(&lock->fl);
lock->fl.fl_pid = ~(u32) 0;
if (!(p = nlm4_decode_cookie(p, &argp->cookie))
- || !(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN))
+ || !(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len, NLM_MAXSTRLEN))
|| !(p = nlm4_decode_fh(p, &lock->fh))
|| !(p = nlm4_decode_oh(p, &lock->oh)))
return 0;
@@ -359,9 +359,9 @@
nlm4svc_decode_notify(struct svc_rqst *rqstp, u32 *p, struct nlm_args *argp)
{
struct nlm_lock *lock = &argp->lock;
- int len;
- if (!(p = xdr_decode_string(p, &lock->caller, &len, NLM_MAXSTRLEN)))
+ if (!(p = xdr_decode_string_inplace(p, &lock->caller,
+ &lock->len, NLM_MAXSTRLEN)))
return 0;
argp->state = ntohl(*p++);
return xdr_argsize_check(rqstp, p);
@@ -370,10 +370,11 @@
int
nlm4svc_decode_reboot(struct svc_rqst *rqstp, u32 *p, struct nlm_reboot *argp)
{
- if (!(p = xdr_decode_string(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
+ if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
return 0;
argp->state = ntohl(*p++);
- argp->addr = ntohl(*p++);
+ /* Preserve the address in network byte order */
+ argp->addr = *p++;
return xdr_argsize_check(rqstp, p);
}
|