From f1bbcc4197c4597636782a34ad138a51c40b1efb Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:12:47 -0500 Subject: [PATCH] Import 2.1.18 --- CREDITS | 12 + Documentation/Configure.help | 21 +- Documentation/cdrom/cdrom-standard.tex | 269 +++-- Makefile | 4 +- arch/alpha/defconfig | 2 +- arch/alpha/kernel/entry.S | 9 +- arch/alpha/kernel/ksyms.c | 137 ++- arch/alpha/kernel/traps.c | 44 +- arch/alpha/lib/strncpy_from_user.S | 8 +- arch/alpha/mm/extable.c | 35 +- arch/alpha/mm/fault.c | 6 +- arch/i386/kernel/bios32.c | 6 +- arch/i386/kernel/entry.S | 11 +- arch/i386/kernel/ksyms.c | 65 +- arch/i386/mm/extable.c | 34 +- arch/m68k/amiga/ksyms.c | 52 +- arch/m68k/atari/ksyms.c | 48 +- arch/m68k/kernel/ksyms.c | 75 +- arch/m68k/mm/extable.c | 26 +- arch/ppc/kernel/ksyms.c | 12 +- arch/sparc/kernel/head.S | 7 +- arch/sparc/kernel/signal.c | 74 +- arch/sparc/kernel/sparc_ksyms.c | 239 ++--- arch/sparc/kernel/sys_sunos.c | 9 +- arch/sparc/mm/extable.c | 35 +- arch/sparc/mm/sun4c.c | 62 +- drivers/block/README.fd | 53 +- drivers/block/floppy.c | 6 +- drivers/block/ide-cd.c | 20 +- drivers/block/ide.c | 74 +- drivers/block/ll_rw_blk.c | 9 +- drivers/block/md.c | 16 +- drivers/block/rd.c | 1 + drivers/cdrom/aztcd.c | 1 + drivers/cdrom/cdu31a.c | 2 + drivers/cdrom/cm206.c | 117 +- drivers/cdrom/gscd.c | 1 + drivers/cdrom/isp16.c | 5 + drivers/cdrom/mcdx.c | 257 ++--- drivers/cdrom/optcd.c | 2 +- drivers/cdrom/sbpcd.c | 1 + drivers/cdrom/sjcd.c | 1 + drivers/cdrom/sonycd535.c | 1 + drivers/char/apm_bios.c | 26 +- drivers/char/esp.c | 57 +- drivers/char/ftape/kernel-interface.c | 5 +- drivers/char/mem.c | 112 +- drivers/char/misc.c | 21 +- drivers/char/pcwd.c | 74 +- drivers/char/pcxx.c | 1 + drivers/char/riscom8.c | 4 + drivers/char/serial.c | 10 +- drivers/char/tty_io.c | 2 +- drivers/isdn/icn/icn.c | 22 +- drivers/isdn/isdn_common.c | 131 ++- drivers/isdn/pcbit/module.c | 33 +- drivers/isdn/teles/mod.c | 4 +- drivers/net/bpqether.c | 84 +- drivers/net/de620.c | 2 +- drivers/net/hdlcdrv.c | 15 +- drivers/net/mkiss.c | 79 +- drivers/net/ni52.c | 2 +- drivers/net/pi2.c | 31 +- drivers/net/ppp.c | 37 +- drivers/net/pt.c | 327 +++--- drivers/net/slhc.c | 30 +- drivers/net/sunlance.c | 88 +- drivers/pci/pci.c | 3 +- drivers/scsi/NCR53c406a.c | 2 +- drivers/scsi/NCR53c406a.h | 2 +- drivers/scsi/aha1740.c | 2 +- drivers/scsi/aha1740.h | 2 +- drivers/scsi/fdomain.c | 4 +- drivers/scsi/fdomain.h | 2 +- drivers/scsi/ide-scsi.c | 2 +- drivers/scsi/ppa.c | 2 +- drivers/scsi/ppa.h | 2 +- drivers/scsi/qlogicfas.c | 2 +- drivers/scsi/qlogicfas.h | 2 +- drivers/scsi/scsi.c | 9 - drivers/scsi/scsi_module.c | 2 +- drivers/scsi/scsi_syms.c | 69 +- drivers/scsi/sd.c | 2 +- drivers/scsi/sg.c | 2 +- drivers/scsi/sr.c | 2 +- drivers/scsi/st.c | 2 +- drivers/scsi/wd7000.c | 2 +- drivers/scsi/wd7000.h | 2 +- fs/affs/inode.c | 32 +- fs/binfmt_aout.c | 2 +- fs/binfmt_elf.c | 2 +- fs/binfmt_java.c | 4 +- fs/binfmt_script.c | 2 +- fs/block_dev.c | 44 +- fs/buffer.c | 776 +++----------- fs/dcache.c | 2 +- fs/ext/inode.c | 14 +- fs/ext2/inode.c | 86 -- fs/ext2/super.c | 20 +- fs/fat/fatfs_syms.c | 71 +- fs/hpfs/hpfs_fs.c | 23 +- fs/isofs/inode.c | 121 ++- fs/minix/inode.c | 24 +- fs/msdos/msdosfs_syms.c | 45 +- fs/ncpfs/inode.c | 26 +- fs/nfs/inode.c | 12 +- fs/proc/procfs_syms.c | 53 +- fs/smbfs/inode.c | 6 +- fs/sysv/inode.c | 20 +- fs/ufs/ufs_super.c | 11 +- fs/umsdos/inode.c | 31 +- fs/vfat/namei.c | 32 +- fs/xiafs/inode.c | 38 +- include/asm-alpha/unistd.h | 3 +- include/asm-i386/unistd.h | 1 + include/asm-sparc/bitops.h | 8 +- include/asm-sparc/pgtable.h | 5 +- include/asm-sparc/pgtsun4c.h | 8 +- include/asm-sparc64/bitops.h | 6 +- include/linux/cdrom.h | 29 + include/linux/fs.h | 13 +- include/linux/if.h | 8 +- include/linux/module.h | 254 +++-- include/linux/netdevice.h | 3 +- include/linux/socket.h | 7 +- include/linux/symtab_begin.h | 45 - include/linux/symtab_end.h | 15 - include/linux/time.h | 8 +- include/linux/uio.h | 2 +- init/main.c | 2 - kernel/ksyms.c | 518 +++++---- kernel/module.c | 1350 +++++++++++++----------- net/802/llc_macinit.c | 84 +- net/802/p8022.c | 18 +- net/802/p8022tr.c | 22 +- net/802/psnap.c | 36 +- net/appletalk/ddp.c | 400 +++---- net/ax25/af_ax25.c | 288 +++-- net/core/firewall.c | 49 +- net/ipv4/ip_masq.c | 110 +- net/ipv4/ip_masq_app.c | 114 +- net/ipv4/ip_masq_ftp.c | 22 +- net/ipv4/ip_masq_irc.c | 58 +- net/ipv4/ip_masq_raudio.c | 18 +- net/ipx/af_ipx.c | 421 ++++---- net/netbeui/netbeui.c | 174 +-- net/netrom/nr_dev.c | 20 +- net/netsyms.c | 347 +++--- net/rose/rose_dev.c | 18 +- net/socket.c | 12 - 150 files changed, 4345 insertions(+), 4833 deletions(-) delete mode 100644 include/linux/symtab_begin.h delete mode 100644 include/linux/symtab_end.h diff --git a/CREDITS b/CREDITS index 6d498af89d9d..4d1e0d81c33e 100644 --- a/CREDITS +++ b/CREDITS @@ -767,6 +767,13 @@ E: lam836@cs.cuhk.hk D: Author of the dialog utility, foundation D: for Menuconfig's lxdialog. +N: David van Leeuwen +E: david@tm.tno.nl +D: Philips/LMS cm206 cdrom driver, generic cdrom driver +S: Scheltemalaan 14 +S: 3817 KS Amersfoort +S: The Netherlands + N: Volker Lendecke E: lendecke@namu01.Num.Math.Uni-Goettingen.de D: Kernel smbfs (to mount WfW, NT and OS/2 network drives.) @@ -1149,6 +1156,11 @@ S: 1407 Broad Street S: Waynesboro, Virginia 22980 S: USA +N: Andrew J. Robinson +E: arobinso@nyx.net +W: http://www.nyx.net/~arobinso +D: Hayes ESP serial port driver + N: Florian La Roche E: rzsfl@rz.uni-sb.de E: flla@stud.uni-sb.de diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 4d731675fd7c..65a0c4d63909 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -3553,22 +3553,21 @@ CONFIG_ISTALLION whenever you want), say M here and read Documentation/modules.txt. Hayes ESP serial port support -CONFIG_ESP +CONFIG_ESPSERIAL This is a driver which supports Hayes ESP serial ports. It uses DMA to transfer data to and from the host. Make sure to read drivers/char/README.esp. To compile this driver as a module ( = code which can be inserted in and removed from the running kernel whenever you want), say M here and read Documentation/modules.txt. - This driver may be compiled as a loadable module. Hayes ESP serial port DMA channel -CONFIG_ESP_DMA_CHANNEL +CONFIG_ESPSERIAL_DMA_CHANNEL This is the DMA channel to be used to transfer data to and from the host. One DMA channel is shared between all the ESP ports. Valid values are 1 and 3. Hayes ESP serial port trigger level -CONFIG_ESP_TRIGGER_LEVEL +CONFIG_ESPSERIAL_TRIGGER_LEVEL This is the trigger level (in bytes) of the transmit FIFO and the receive FIFO. Larger values may result in fewer interrupts; however, a value too high could result in data loss. Valid values are 1 through 1015. @@ -4568,6 +4567,20 @@ CONFIG_MSDOS_PARTITION Say Y if you need this feature; users who are only using their system-native partitioning scheme can say N here. +Sparc ESP SCSI support +CONFIG_SCSI_SUNESP + This is the driver for the Sun ESP SCSI host adapter. The ESP + chipset is present in most SPARC-based computers. + +Sparc /dev/openprom compatibility driver +CONFIG_SUN_OPENPROMIO + This driver provides user programs with an interface to the Sparc + PROM device tree. The driver implements a SunOS-compatible + interface and a NetBSD-compatible interface. If you want to + compile this as a module ( = code which can be inserted in and + removed from the running kernel whenever you want), say M and read + Documentation/modules.txt. If unsure, say Y. + # need an empty line after last entry, for sed script in Configure. # diff --git a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex index ba95b97ff98d..0c0aaa2f542b 100644 --- a/Documentation/cdrom/cdrom-standard.tex +++ b/Documentation/cdrom/cdrom-standard.tex @@ -1,5 +1,5 @@ \documentclass{article} -\def\version{$Id: cdrom-standard.tex,v 1.2 1996/09/22 20:18:00 david Exp $} +\def\version{$Id: cdrom-standard.tex,v 1.6 1996/12/23 21:17:44 david Exp $} \evensidemargin=0pt \oddsidemargin=0pt @@ -128,12 +128,14 @@ important that these drives behave in the same way. (In December 1994, one of the cheapest \cdrom\ drives was a Philips cm206, a double-speed proprietary drive. In the months that I was busy writing a \linux\ driver for it, proprietary drives became old-fashioned and IDE/ATAPI -drives became standard. At the time of writing (April 1996) the -cheapest double speed drive is IDE and at one fifth of the price of -its predecessor. Eight speed drives are available now.) +drives became standard. At the time of writing (December 1996) the +cheapest drive is quadruple speed IDE and at less than half the price +of its predecessor. Twelve speed drives are available now.) -This document defines (in pre-release versions: proposes) the various -$ioctl$s, and the way the drivers should implement this. +This document defines the various $ioctl$s, and the way the drivers +should implement this. Currently (in the kernel 2.1.$n$ development +line) three low-level \cdrom\ drivers use this interface, among +which are the most important drivers for IDE and SCSI. \section{Standardizing through another software level} \label{cdrom.c} @@ -166,7 +168,7 @@ $$ \halign{$#$\ \hfil&$#$\ \hfil&$/*$ \rm# $*/$\hfil\cr struct& file_operations\ cdrom_fops = \{\hidewidth\cr &NULL, & lseek \cr - &block_read, & read---general\ block-dev\ read \cr + &block_read, & read---general block-dev read \cr &block_write, & write---general block-dev write \cr &NULL, & readdir \cr &NULL, & select \cr @@ -176,7 +178,7 @@ struct& file_operations\ cdrom_fops = \{\hidewidth\cr &cdrom_release, & release \cr &NULL, & fsync \cr &NULL, & fasync \cr - &cdrom_media_changed, & media_change \cr + &cdrom_media_changed, & media change \cr &NULL & revalidate \cr \};\cr } @@ -193,11 +195,11 @@ Registration of the \cdrom\ device driver should now be to the general routines in \cdromc, not to the VFS any more. The interfacing with \cdromc\ is implemented trough two general structures, that contain information about the capabilities of the driver, and the specific -drives on which the driver operates. The structures are seperated to +drives on which the driver operates. The structures are separated to contain information about \begin{description} \item[the low-level driver] It lists the routines that actually - implement cdrom operations, and hence the structure is called + implement \cdrom\ operations, and hence the structure is called $cdrom_device_ops$. The structure is conceptually connected to the major number of the device (although some drivers may have have different major numbers, as is the case for the IDE driver). @@ -209,20 +211,20 @@ contain information about The registration is done for each drive found by the driver (and hence for each minor number) though the call -$$register_cdrom(kdev_t\ dev, char * name, - struct\ cdrom_device_info\ _info) +$$register_cdrom(struct\ cdrom_device_info * _info, char * name) $$ -This device information structure (described shortly) contains all -information needed for the kernel to interface with the low-level -cdrom device driver. One of the main entries of this structure is a -pointer to the $cdrom_device_ops$ structure of the driver. - -This device operations structure lists the implemented routines for -interfacing to the hardware. [It is impossible to come up with a -complete list of all capabilities of (future) \cdrom\ drives, as the -developments in technology follow-up at an incredible rate. Maybe -write-operation (WORM devices) will become very popular in the -future.] The list now is: +This device information structure $_info$ (described +shortly) contains all information needed for the kernel to interface +with the low-level \cdrom\ device driver. One of the main entries of +this structure is a pointer to the $cdrom_device_ops$ structure of the +driver. + +This device operations structure $cdrom_device_ops$ lists the +implemented routines for interfacing to the hardware. [It is +impossible to come up with a complete list of all capabilities of +(future) \cdrom\ drives, as the developments in technology follow-up +at an incredible rate. Maybe write-operation (WORM devices) will +become very popular in the future.] The list now is: $$ \halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}& $/*$ \rm# $*/$\hfil\cr @@ -236,14 +238,17 @@ struct& cdrom_device_ops\ \{ \hidewidth\cr &int& (* lock_door)(struct\ cdrom_device_info *, int);\cr &int& (* select_speed)(struct\ cdrom_device_info *, int);\cr &int& (* select_disc)(struct\ cdrom_device_info *, int);\cr - &int& (* get_last_session) (struct\ cdrom_device_info *, struct\ cdrom_multisession *{});\cr + &int& (* get_last_session) (struct\ cdrom_device_info *, + struct\ cdrom_multisession *{});\cr &int& (* get_mcn)(struct\ cdrom_device_info *, struct\ cdrom_mcn *{});\cr &int& (* reset)(struct\ cdrom_device_info *);\cr - &int& (* audio_ioctl)(struct\ cdrom_device_info *, unsigned\ int, void *{});\cr - &int& (* dev_ioctl)(struct\ cdrom_device_info *, unsigned\ int, unsigned\ long);\cr + &int& (* audio_ioctl)(struct\ cdrom_device_info *, unsigned\ int, + void *{});\cr + &int& (* dev_ioctl)(struct\ cdrom_device_info *, unsigned\ int, + unsigned\ long);\cr \noalign{\medskip} &\llap{const\ }int& capability;& capability flags \cr - &int& n_minors;& number of supported minor devices \cr + &int& n_minors;& number of active minor devices \cr } $$ The \cdrom-driver should simply implement (some of) these @@ -254,14 +259,14 @@ registration of the device. The value $n_minors$ should be a positive value indicating the number of minor devices that are supported by the driver, normally~1. Although these two variables are `informative' rather than `operational,' they are included in $cdrom_device_ops$ -because they describe the cabability of the {\em driver\/} rather than +because they describe the capability of the {\em driver\/} rather than the {\em drive}. Nomenclature has always been difficult in computer programming. Note that most functions have fewer parameters than their $blkdev_fops$ counterparts. This is because very little of the information in the structures $inode$ and $file$ are used, the main -parameter is the device $dev$, from which the minor-number can be +parameter is the first, from which the major and minor number can be extracted. (Most low-level \cdrom\ drivers don't even look at that value as only one device is supported.) This will be available through $dev$ in $cdrom_device_info$ described below. @@ -272,11 +277,11 @@ $$ \halign{$#$\ \hfil&$#$\ \hfil&\hbox to 10em{$#$\hss}& $/*$ \rm# $*/$\hfil\cr struct& cdrom_device_info\ \{ \hidewidth\cr - & \llap{$const\ $}struct\ cdrom_device_ops *& ops;& device operations for this major\cr + & struct\ cdrom_device_ops *& ops;& device operations for this major\cr & struct\ cdrom_device_info *& next;& next device_info for this major\cr & void *& handle;& driver-dependent data\cr \noalign{\medskip} - & \llap{$const\ $}kdev_t& dev;& device number (incorporates minor)/\cr + & kdev_t& dev;& device number (incorporates minor)/\cr & int& mask;& mask of capability: disables them \cr &\llap{$const\ $}int& speed;& maximum speed for reading data \cr &\llap{$const\ $}int& n_discs;& number of discs in jukebox \cr @@ -287,7 +292,7 @@ struct& cdrom_device_info\ \{ \hidewidth\cr \}\cr }$$ -With this $struct$, a linked list of minor devices registrered with +With this $struct$, a linked list of minor devices registered with the same low-level driver is built, though the field $next$. The device number, the device operations struct and specifications of properties of the drive are stored in this structure. @@ -296,7 +301,7 @@ The flags $mask$ can be used to mask out some of the capabilities listed in $ops\to capability$, if a specific drive doesn't support a feature of the driver. The value $speed$ specifies the maximum head-rate of the drive, measured in units of normal audio speed -(176\,kB/sec raw data or 150\,kB/sec filesystem data). The value +(176\,kB/sec raw data or 150\,kB/sec file system data). The value $n_discs$ should reflect the number of discs the drive can hold simultaneously, if it is designed as a juke-box, or otherwise~1. The parameters are declared $const$ because they describe properties @@ -453,10 +458,16 @@ means `auto-selection', i.e., maximum data-rate or real-time audio rate. If the drive doesn't have this `auto-selection' capability, the decision should be made on the current disc loaded and the return value should be positive. A negative return value indicates an -error. (Although the audio-low-pass filters probably aren't designed -for it, more than real-time playback of audio might be used for -high-speed copying of audio tracks). Badly pressed \cdrom s may -benefit from less-than-maximum head rate. +error. + +There are a few reasons for having the speed to be selectable. Badly +pressed \cdrom s may benefit from less-than-maximum head rate. Modern +\cdrom\ drives can obtain very high head rates (up to twelve times +audio speed is common), but these drives tend to make an annoyingly +loud noise. A lower speed may reduce this. Finally, although the +audio-low-pass filters probably aren't designed for it, more than +real-time playback of audio might be used for high-speed copying of +audio tracks. \subsection{$Select_disc(struct\ cdrom_device_info * cdi, int\ number)$} @@ -573,10 +584,10 @@ The capability flag is declared $const$, to prevent drivers from accidentally tampering with the contents. The capability fags actually inform \cdromc\ on what the driver is capable of. If the drive found by the driver does not have the capability, is can be masked out by -the $cdrom_device_info$ variable $mask$. For instance, the SCSI cdrom -driver has implemeted the code for loading and ejecting cdrom's, and +the $cdrom_device_info$ variable $mask$. For instance, the SCSI \cdrom\ +driver has implemented the code for loading and ejecting \cdrom's, and hence its corresponding flags in $capability$ will be set. But a SCSI -cdrom drive might be a caddy system, which can't load the tray, and +\cdrom\ drive might be a caddy system, which can't load the tray, and hence for this drive the $cdrom_device_info$ struct will have set the $CDC_CLOSE_TRAY$ bit in $mask$. @@ -690,7 +701,7 @@ Well, these companies are in the lucky position that they generally control both the hardware and software of their supported products, and are large enough to set their own standard. They do not have to deal with a dozen or more different, competing hardware -configurations.\footnote{Personally, I think that SUN's approach to +configurations.\footnote{Incidentally, I think that SUN's approach to mounting \cdrom s is very good in origin: under Solaris a volume-daemon automatically mounts a newly inserted \cdrom\ under {\tt /cdrom/$$/}. In my opinion they should have pushed this @@ -750,7 +761,7 @@ that `take over' the interface to the kernel. The header file belonging to \cdromc\ is called \ucdrom, but may be included in {\tt cdrom.h} in the future. -\subsection{$struct\ file_operations\ cdrom_fops$} +\subsection{$Struct\ file_operations\ cdrom_fops$} The contents of this structure has been described in section~\ref{cdrom.c}, and this structure should be used in @@ -759,15 +770,15 @@ $$ register_blkdev(major, , \&cdrom_fops); $$ -\subsection{$Int\ register_cdrom(kdev_t\ dev, char * name, struct\ -cdrom_device_info\ * cdi)$} +\subsection{$Int\ register_cdrom( struct\ cdrom_device_info\ * cdi, + char * name,)$} Similar to registering $cdrom_fops$ to the kernel, the device operations and information structures, as described in section~\ref{cdrom.c}, should be registered to the general \cdrom\ interface: $$ -register_cdrom(dev, , \&_info); +register_cdrom(\&_info), ); $$ This function returns zero upon success, and non-zero upon failure. The structure $_info$ should have a pointer the @@ -853,7 +864,7 @@ specified by $arg$ of type $struct\ cdrom_tocentry *{}$. \item[CDROMPLAYMSF] Play audio fragment specified in Minute, Second, Frame format, delimited by $arg$ of type $struct\ cdrom_msf *{}$. \item[CDROMPLAYTRKIND] Play audio fragment in track-index format -delimited by $arg$ of type $struct\ cdrom_ti *{}$. +delimited by $arg$ of type $struct\ \penalty-1000 cdrom_ti *{}$. \item[CDROMVOLCTRL] Set volume specified by $arg$ of type $struct\ cdrom_volctrl *{}$. \item[CDROMVOLREAD] Read volume into by $arg$ of type $struct\ @@ -886,16 +897,23 @@ the current flags. \item[CDROM_MEDIA_CHANGED] Returns 1 if a disc has been changed since the last call. Note that calls to $cdrom_media_changed$ by the VFS are treated by an independent queue, so both mechanisms will detect - a media change once. Currently, \cdromc\ implements maximum 16 minors - per major device. + a media change once. For Juke-boxes, an extra argument $arg$ + specifies the slot for which the information is given. The special + value $CDSL_CURRENT$ requests that information about the currently + selected slot is returned. \item[CDROM_DRIVE_STATUS] Returns the status of the drive by a call to $drive_status()$. Return values are as defined in section~\ref{drive status}. Note that this call doesn't return information on the current playing activity of the drive; this can be polled through an - $ioctl$ call to $CDROMSUBCHNL$. + $ioctl$ call to $CDROMSUBCHNL$. For Juke-boxes, an extra argument + $arg$ specifies the slot for which (possibly limited) information is + given. The special value $CDSL_CURRENT$ requests that information + about the currently selected slot is returned. \item[CDROM_DISC_STATUS] Returns the type of the disc currently in the drive by a call to $disc_status()$. Return values are as defined in section~\ref{disc status}. +\item[CDROM_CHANGER_NSLOTS] Returns the number of slots in a + juke-box. \end{description} \subsubsection{Device dependent $ioct$s} @@ -908,48 +926,53 @@ if implemented. No memory allocation or verification is carried out. \begin{enumerate} \item Make a backup of your current driver. \item Get hold of the files \cdromc\ and \ucdrom, they should be in -the directory tree that came with this documentation. + the directory tree that came with this documentation. \item Include {\tt \char`\} just after {\tt cdrom.h}. \item Change the 3rd argument of $register_blkdev$ from $\&_fops$ to $\&cdrom_fops$. -\item Just after that line, add a line to register to the \cdrom\ -routines: -$$register_cdrom(major, , _dops);$$ -Similarly, add a call to $unregister_cdrom()$. -\item Copy an example of the device-operations $struct$ to your source, -e.g., from {\tt cm206.c} $cm206_dops$, and change all entries to names -corresponding to your driver, or names you just happen to like. If -your driver doesn't support a certain function, make the entry -$NULL$. At the entry $capability$ you should list all capabilities -your drive could support, in principle. If your drive has a capability -that is not listed, please send me a message. +\item Just after that line, add a line to register to the \cdrom\ + routines: + $$register_cdrom(\&_info, );$$ + Similarly, add a + call to $unregister_cdrom()$. +\item Copy an example of the device-operations $struct$ to your + source, e.g., from {\tt cm206.c} $cm206_dops$, and change all + entries to names corresponding to your driver, or names you just + happen to like. If your driver doesn't support a certain function, + make the entry $NULL$. At the entry $capability$ you should list all + capabilities your drive could support, in principle. If your drive + has a capability that is not listed, please send me a message. +\item Copy the $cdrom_device_info$ declaration from the same example + driver, and modify the entries according to your needs. If your + driver dynamically determines the capabilities of the hardware, this + structure should also be declared dynamically. \item Implement all functions in your $_dops$ structure, -according to prototypes listed in \ucdrom, and specifications given in -section~\ref{cdrom.c}. Most likely you have already implemented -the code in a large part, and you may just have to adapt the prototype -and return values. + according to prototypes listed in \ucdrom, and specifications given + in section~\ref{cdrom.c}. Most likely you have already implemented + the code in a large part, and you may just have to adapt the + prototype and return values. \item Rename your $_ioctl()$ function to $audio_ioctl$ and -change the prototype a little. Remove entries listed in the first part -in section~\ref{cdrom-ioctl}, if your code was OK, these are just calls -to the routines you adapted in the previous step. + change the prototype a little. Remove entries listed in the first + part in section~\ref{cdrom-ioctl}, if your code was OK, these are + just calls to the routines you adapted in the previous step. \item You may remove all remaining memory checking code in the -$audio_ioctl()$ function that deals with audio commands (these are -listed in the second part of section~\ref{cdrom-ioctl}). There is no -need for memory allocation either, so most $case$s in the $switch$ -statement look similar to: -$$ -case\ CDROMREADTOCENTRY\colon -get_toc_entry\bigl((struct\ cdrom_tocentry *{})\ arg\bigr); -$$ + $audio_ioctl()$ function that deals with audio commands (these are + listed in the second part of section~\ref{cdrom-ioctl}). There is no + need for memory allocation either, so most $case$s in the $switch$ + statement look similar to: + $$ + case\ CDROMREADTOCENTRY\colon get_toc_entry\bigl((struct\ + cdrom_tocentry *{})\ arg\bigr); + $$ \item All remaining $ioctl$ cases must be moved to a separate -function, $_ioctl$, the device-dependent $ioctl$s. Note that -memory checking and allocation must be kept in this code! + function, $_ioctl$, the device-dependent $ioctl$s. Note that + memory checking and allocation must be kept in this code! \item Change the prototypes of $_open()$ and -$_release()$, and remove any strategic code (i.e., tray -movement, door locking, etc.). + $_release()$, and remove any strategic code (i.e., tray + movement, door locking, etc.). \item Try to recompile the drivers. We advice you to use modules, both -for {\tt cdrom.o} and your driver, as debugging is much easier this -way. + for {\tt cdrom.o} and your driver, as debugging is much easier this + way. \end{enumerate} \section{Thanks} @@ -965,7 +988,87 @@ want to thank Linus Torvalds for making this possible in the first place. \vfill -$\version$ +$ \version\ $ \eject \end{document} +\def\versionlog{ +$Log: cdrom-standard.tex,v $ +Revision 1.6 1996/12/23 21:17:44 david +Added reasons for speed selection. + +Revision 1.5 1996/12/22 21:54:25 david +Repared version definition. + +Revision 1.4 1996/12/22 21:40:26 david +Added older version log at end of text. + +Revision 1.3 1996/12/22 21:31:58 david +Adapted text to fit kernel changes up to 2.1.15. + +Sun Dec 22 21:31:58 1996 David A. van Leeuwen + + * cdrom-standard.tex: Adapted text to fit kernel changes up to 2.1.15. + +Sun Sep 22 20:18:00 1996 David + + * cdrom-standard.tex: + Documentation adapted to align with developments started by Scott + Snyder, Gerd Knorr and myself. + + Split _ops in _info (minor stuff) and _ops (major stuff). + Moved capability back to _ops, added n_minors. + Implemented use_count in _info. + Removed open_files(). + +Sat Aug 10 10:57:16 1996 David + + * cdrom-standard.tex: + Weakened Eberhard's annoying comments by making it a quotation and + having it appear smaal-type. He doesn't react to my email-messages. + + Changed float speed to int speed. + +Tue May 21 15:27:10 1996 David + + * cdrom-standard.tex: + Typographic errors introduced by Eberhard Moenkeberg were corrected, + as well one of my own typos. I deepfully respect the person that + corrects all typos i make in code and documentation! + + Linux version 1.99.6. + + * cdrom-standard.tex: + Changes made by Eberhard Moenkeberg, much to my annoyance. The + contents of the introduction were altered completely so that it now + says the opposite of what I wrote before: that there is no need for an + additional unform cdrom layer. This makes the whole document and the + project for that matter worthless. + + ---david + + * cdrom-standard.tex: + Version as it appeared first in the official kernel documentation + tree, Linux 1.99.2, Documentation/cdrom/cdrom-standard.tex. + + Some improvements in use of English language have been made by people + that know better English than me. + +Wed Apr 17 20:46:34 1996 David + + * cdrom-standard.tex: changed #minors from 4 to 16. + +Sun Apr 14 20:53:17 1996 David + + * cdrom-standard.tex: + Update to go with cdrom.c version 0.3. More ioctl stuff. + +Wed Apr 10 18:00:28 1996 David + + * cdrom-standard.tex: + Version as first distributed among CDrom device driver authors. + +Mon Apr 8 18:25:21 1996 David A. van Leeuwen + + * cdrom-standard.tex: *** empty log message *** +} diff --git a/Makefile b/Makefile index a58a1f18ba10..b7aa5f52fed8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 1 -SUBLEVEL = 17 +SUBLEVEL = 18 ARCH = i386 @@ -176,7 +176,7 @@ vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs $(FILESYSTEMS) \ $(DRIVERS) \ $(LIBS) -o vmlinux - $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map + $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)\|\(\.\.ng$$\)' | sort > System.map symlinks: rm -f include/asm diff --git a/arch/alpha/defconfig b/arch/alpha/defconfig index f98d045095a1..14162d4f5eab 100644 --- a/arch/alpha/defconfig +++ b/arch/alpha/defconfig @@ -62,6 +62,7 @@ CONFIG_BLK_DEV_FD=y CONFIG_BLK_DEV_RAM=y # CONFIG_BLK_DEV_INITRD is not set # CONFIG_BLK_DEV_XD is not set +# CONFIG_BLK_DEV_EZ is not set # CONFIG_BLK_DEV_HD is not set # @@ -164,7 +165,6 @@ CONFIG_DE4X5=y # CONFIG_PLIP is not set # CONFIG_PPP is not set # CONFIG_NET_RADIO is not set -# CONFIG_NET_HAM is not set # CONFIG_SLIP is not set # CONFIG_TR is not set diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 6f63fdb7efb6..6c8f5a296ff0 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S @@ -648,10 +648,14 @@ syscall_error: ldq $20,72($30) /* .. and this a3 */ subq $31,$0,$0 /* with error in v0 */ addq $31,1,$1 /* set a3 for errno return */ - bis $31,$31,$26 /* tell "ret_from_sys_call" that we can restart */ + stq $0,0($30) + bis $31,$31,$26 /* tell "ret_from_sys_call" we can restart */ stq $1,72($30) /* a3 for return */ + br $31,ret_from_sys_call + ret_success: stq $0,0($30) + stq $31,72($30) /* a3=0 => no error */ br $31,ret_from_sys_call .align 3 @@ -777,4 +781,5 @@ sys_call_table: .quad sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler, sys_sched_yield .quad sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, do_entSys /* sys_afs_syscall */, sys_newuname .quad sys_nanosleep, sys_mremap, do_entSys, sys_setresuid, sys_getresuid - .quad sys_pciconfig_read, sys_pciconfig_write, do_entSys, do_entSys, do_entSys + .quad sys_pciconfig_read, sys_pciconfig_write, sys_query_module + .quad do_entSys, do_entSys diff --git a/arch/alpha/kernel/ksyms.c b/arch/alpha/kernel/ksyms.c index 9b9e19e46a38..f86102f42a61 100644 --- a/arch/alpha/kernel/ksyms.c +++ b/arch/alpha/kernel/ksyms.c @@ -12,6 +12,7 @@ #include #include #include +#include extern void bcopy (const char *src, char *dst, int len); extern struct hwrpb_struct *hwrpb; @@ -30,83 +31,71 @@ extern void dump_thread(struct pt_regs *, struct user *); extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); -static struct symbol_table arch_symbol_table = { -#include - /* platform dependent support */ +/* platform dependent support */ +EXPORT_SYMBOL(_inb); +EXPORT_SYMBOL(_inw); +EXPORT_SYMBOL(_inl); +EXPORT_SYMBOL(_outb); +EXPORT_SYMBOL(_outw); +EXPORT_SYMBOL(_outl); +EXPORT_SYMBOL(_readb); +EXPORT_SYMBOL(_readw); +EXPORT_SYMBOL(_readl); +EXPORT_SYMBOL(_writeb); +EXPORT_SYMBOL(_writew); +EXPORT_SYMBOL(_writel); +EXPORT_SYMBOL(insb); +EXPORT_SYMBOL(insw); +EXPORT_SYMBOL(insl); +EXPORT_SYMBOL(outsb); +EXPORT_SYMBOL(outsw); +EXPORT_SYMBOL(outsl); +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(strncpy); +EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(strstr); +EXPORT_SYMBOL(strtok); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(__memcpy); +EXPORT_SYMBOL(__memset); +EXPORT_SYMBOL(__constant_c_memset); - X(_inb), - X(_inw), - X(_inl), - X(_outb), - X(_outw), - X(_outl), - X(_readb), - X(_readw), - X(_readl), - X(_writeb), - X(_writew), - X(_writel), - X(__divl), - X(__reml), - X(__divq), - X(__remq), - X(__divlu), - X(__remlu), - X(__divqu), - X(__remqu), - X(insb), - X(insw), - X(insl), - X(outsb), - X(outsw), - X(outsl), - X(strcat), - X(strcmp), - X(strcpy), - X(strlen), - X(strncmp), - X(strncpy), - X(strnlen), - X(strstr), - X(strtok), - X(strchr), - X(memcmp), - X(memmove), - X(__memcpy), - X(__constant_c_memset), +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(dump_fpu); +EXPORT_SYMBOL(hwrpb); +EXPORT_SYMBOL(wrusp); - X(dump_thread), - X(dump_fpu), - X(hwrpb), - X(wrusp), +/* + * The following are specially called from the uaccess assembly stubs. + */ +EXPORT_SYMBOL_NOVERS(__copy_user); +EXPORT_SYMBOL_NOVERS(__clear_user); +EXPORT_SYMBOL(__strncpy_from_user); +EXPORT_SYMBOL(__strlen_user); - /* - * The following are special because they're not called - * explicitly (the C compiler or assembler generates them in - * response to division operations). Fortunately, their - * interface isn't gonna change any time soon now, so it's OK - * to leave it out of version control. - */ +/* + * The following are special because they're not called + * explicitly (the C compiler or assembler generates them in + * response to division operations). Fortunately, their + * interface isn't gonna change any time soon now, so it's OK + * to leave it out of version control. + */ # undef bcopy # undef memcpy # undef memset - XNOVERS(__divl), - XNOVERS(__divlu), - XNOVERS(__divq), - XNOVERS(__divqu), - XNOVERS(__reml), - XNOVERS(__remlu), - XNOVERS(__remq), - XNOVERS(__remqu), - XNOVERS(memcpy), - XNOVERS(memset), - /* these shouldn't be necessary---they should be versioned: */ - XNOVERS(__memcpy), - XNOVERS(__memset), -#include -}; - -void arch_syms_export(void) -{ - register_symtab(&arch_symbol_table); -} +EXPORT_SYMBOL_NOVERS(__divl); +EXPORT_SYMBOL_NOVERS(__divlu); +EXPORT_SYMBOL_NOVERS(__divq); +EXPORT_SYMBOL_NOVERS(__divqu); +EXPORT_SYMBOL_NOVERS(__reml); +EXPORT_SYMBOL_NOVERS(__remlu); +EXPORT_SYMBOL_NOVERS(__remq); +EXPORT_SYMBOL_NOVERS(__remqu); +EXPORT_SYMBOL_NOVERS(memcpy); +EXPORT_SYMBOL_NOVERS(memset); diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index a9e0c6cf2a2b..352a71cc9e5a 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c @@ -17,7 +17,8 @@ #include #include -void die_if_kernel(char * str, struct pt_regs * regs, long err) +void die_if_kernel(char * str, struct pt_regs * regs, long err, + unsigned long *r9_15) { long i; unsigned long sp; @@ -27,19 +28,30 @@ void die_if_kernel(char * str, struct pt_regs * regs, long err) return; printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err); sp = (unsigned long) (regs+1); - printk("pc = [<%lx>] ps = %04lx\n", regs->pc, regs->ps); - printk("rp = [<%lx>] sp = %lx\n", regs->r26, sp); - printk("r0=%lx r1=%lx r2=%lx r3=%lx\n", - regs->r0, regs->r1, regs->r2, regs->r3); - printk("r8=%lx\n", regs->r8); - printk("r16=%lx r17=%lx r18=%lx r19=%lx\n", - regs->r16, regs->r17, regs->r18, regs->r19); - printk("r20=%lx r21=%lx r22=%lx r23=%lx\n", - regs->r20, regs->r21, regs->r22, regs->r23); - printk("r24=%lx r25=%lx r26=%lx r27=%lx\n", - regs->r24, regs->r25, regs->r26, regs->r27); - printk("r28=%lx r29=%lx r30=%lx\n", - regs->r28, regs->gp, sp); + printk("pc = [<%016lx>] ps = %04lx\n", regs->pc, regs->ps); + printk("rp = [<%016lx>] sp = %016lx\n", regs->r26, sp); + printk("r0 = %016lx r1 = %016lx\n", regs->r0, regs->r1); + printk("r2 = %016lx r3 = %016lx\n", regs->r2, regs->r3); + printk("r4 = %016lx r5 = %016lx\n", regs->r4, regs->r5); + printk("r6 = %016lx r7 = %016lx\n", regs->r6, regs->r7); + + if (r9_15) { + printk("r8 = %016lx r9 = %016lx\n", regs->r8, r9_15[9]); + printk("r10= %016lx r11= %016lx\n", r9_15[10], r9_15[11]); + printk("r12= %016lx r13= %016lx\n", r9_15[12], r9_15[13]); + printk("r14= %016lx r15= %016lx\n", r9_15[14], r9_15[15]); + } else { + printk("r8 = %016lx\n", regs->r8); + } + + printk("r16= %016lx r17= %016lx\n", regs->r16, regs->r17); + printk("r18= %016lx r19= %016lx\n", regs->r18, regs->r19); + printk("r20= %016lx r21= %016lx\n", regs->r20, regs->r21); + printk("r22= %016lx r23= %016lx\n", regs->r22, regs->r23); + printk("r24= %016lx r25= %016lx\n", regs->r24, regs->r25); + printk("r26= %016lx r27= %016lx\n", regs->r26, regs->r27); + printk("r28= %016lx r29= %016lx\n", regs->r28, regs->gp); + printk("Code:"); pc = (unsigned int *) regs->pc; for (i = -3; i < 6; i++) @@ -66,7 +78,7 @@ asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask, } printk("%s: arithmetic trap at %016lx: %02lx %016lx\n", current->comm, regs.pc, summary, write_mask); - die_if_kernel("Arithmetic fault", ®s, 0); + die_if_kernel("Arithmetic fault", ®s, 0, 0); force_sig(SIGFPE, current); } @@ -76,7 +88,7 @@ asmlinkage void do_entIF(unsigned long type, unsigned long a1, { extern int ptrace_cancel_bpt (struct task_struct *who); - die_if_kernel("Instruction fault", ®s, type); + die_if_kernel("Instruction fault", ®s, type, 0); switch (type) { case 0: /* breakpoint */ if (ptrace_cancel_bpt(current)) { diff --git a/arch/alpha/lib/strncpy_from_user.S b/arch/alpha/lib/strncpy_from_user.S index 4232932d43aa..37f92f322025 100644 --- a/arch/alpha/lib/strncpy_from_user.S +++ b/arch/alpha/lib/strncpy_from_user.S @@ -313,12 +313,12 @@ $unaligned: stq_u t0, 0(a0) # e0 : $finish_up: - zapnot t0, t10, t4 # was last byte written null? + zapnot t0, t8, t4 # was last byte written null? cmovne t4, 1, t4 - and t10, 0xf0, t3 # binary search for the address of the - and t10, 0xcc, t2 # last byte written - and t10, 0xaa, t1 + and t8, 0xf0, t3 # binary search for the address of the + and t8, 0xcc, t2 # last byte written + and t8, 0xaa, t1 bic a0, 7, t0 cmovne t3, 4, t3 cmovne t2, 2, t2 diff --git a/arch/alpha/mm/extable.c b/arch/alpha/mm/extable.c index 31d0891c95fd..9b82329a9210 100644 --- a/arch/alpha/mm/extable.c +++ b/arch/alpha/mm/extable.c @@ -2,6 +2,8 @@ * linux/arch/alpha/mm/extable.c */ +#include +#include #include extern const struct exception_table_entry __start___ex_table[]; @@ -10,8 +12,12 @@ extern const struct exception_table_entry __stop___ex_table[]; static inline unsigned search_one_table(const struct exception_table_entry *first, const struct exception_table_entry *last, - signed int value) + signed long value) { + /* Abort early if the search value is out of range. */ + if (value != (signed int)value) + return 0; + while (first <= last) { const struct exception_table_entry *mid; long diff; @@ -32,19 +38,24 @@ unsigned search_exception_table(unsigned long addr) { unsigned ret; - signed int reladdr; - /* Search the kernel's table first. */ - { - register unsigned long gp __asm__("$29"); - reladdr = addr - gp; +#ifndef CONFIG_MODULE + /* There is only the kernel to search. */ + register unsigned long gp __asm__("$29"); + ret = search_one_table(__start___ex_table, __stop___ex_table - 1, + addr - gp); + if (ret) return ret; +#else + /* The kernel is the last "module" -- no need to treat it special. */ + struct module *mp; + for (mp = module_list; mp ; mp = mp->next) { + if (!mp->ex_table_start) + continue; + ret = search_one_table(mp->ex_table_start, + mp->ex_table_end - 1, addr - mp->gp); + if (ret) return ret; } - ret = search_one_table(__start___ex_table, - __stop___ex_table-1, reladdr); - if (ret) - return ret; - - /* FIXME -- search the module's tables here */ +#endif return 0; } diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c index a61b00ba2e83..a7b1e6f2c281 100644 --- a/arch/alpha/mm/fault.c +++ b/arch/alpha/mm/fault.c @@ -35,7 +35,7 @@ void get_new_asn_and_reload(struct task_struct *tsk, struct mm_struct *mm) } #endif -extern void die_if_kernel(char *,struct pt_regs *,long); +extern void die_if_kernel(char *,struct pt_regs *,long, unsigned long *); /* * This routine handles page faults. It determines the address, @@ -121,7 +121,7 @@ bad_area: printk("%s: memory violation at pc=%08lx ra=%08lx " "(bad address = %08lx)\n", tsk->comm, regs->pc, regs->r26, address); - die_if_kernel("oops", regs, cause); + die_if_kernel("oops", regs, cause, (unsigned long*)regs - 16); force_sig(SIGSEGV, tsk); return; } @@ -131,6 +131,6 @@ bad_area: */ printk(KERN_ALERT "Unable to handle kernel paging request at " "virtual address %016lx\n", address); - die_if_kernel("Oops", regs, cause); + die_if_kernel("Oops", regs, cause, (unsigned long*)regs - 16); do_exit(SIGKILL); } diff --git a/arch/i386/kernel/bios32.c b/arch/i386/kernel/bios32.c index 07e94172d8c9..f636efe61034 100644 --- a/arch/i386/kernel/bios32.c +++ b/arch/i386/kernel/bios32.c @@ -105,6 +105,7 @@ union bios32 { char chars[16]; }; +#ifdef CONFIG_PCI /* * Physical address of the service directory. I don't know if we're * allowed to have more than one of these or not, so just in case @@ -118,7 +119,6 @@ static struct { unsigned short segment; } bios32_indirect = { 0, KERNEL_CS }; -#ifdef CONFIG_PCI /* * function table for accessing PCI configuration space @@ -619,7 +619,6 @@ struct pci_access pci_direct_conf2 = { pci_conf2_write_config_dword }; -#endif struct pci_access *check_direct_pci(void) { @@ -773,9 +772,11 @@ unsigned long pcibios_fixup(unsigned long mem_start, unsigned long mem_end) return mem_start; } +#endif unsigned long pcibios_init(unsigned long memory_start, unsigned long memory_end) { +#ifdef CONFIG_PCI union bios32 *check; unsigned char sum; int i, length; @@ -818,7 +819,6 @@ unsigned long pcibios_init(unsigned long memory_start, unsigned long memory_end) } } } -#ifdef CONFIG_PCI if (bios32_entry) { memory_start = check_pcibios (memory_start, memory_end); } diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 5f838ec7b79d..94f77e65a459 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -17,7 +17,7 @@ * * Stack layout in 'ret_from_system_call': * ptrace needs to have all regs on the stack. - * if the order here is changed, it needs to be + * if the order here is changed, it needs to be * updated in fork.c:copy_process, signal.c:do_signal, * ptrace.c and ptrace.h * @@ -133,7 +133,7 @@ ENOSYS = 38 /* macro ENTER_KERNEL waits for entering the kernel, increments kernel_counter, and reloads the processor variables if necessary - uses : %eax, %edx (pushed and popped) + uses : %eax, %edx (pushed and popped) Note: We go to great pains to minimise the number of locked operations. We want to spin without locking, and lock when we attempt an update. @@ -146,7 +146,7 @@ ENOSYS = 38 #ifndef __SMP_PROF__ #define SMP_PROF_A -#define SMP_PROF_B +#define SMP_PROF_B #else @@ -627,8 +627,9 @@ ENTRY(sys_call_table) .long SYMBOL_NAME(sys_nanosleep) .long SYMBOL_NAME(sys_mremap) .long SYMBOL_NAME(sys_setresuid) - .long SYMBOL_NAME(sys_getresuid) + .long SYMBOL_NAME(sys_getresuid) /* 165 */ .long SYMBOL_NAME(sys_vm86) - .rept NR_syscalls-166 + .long SYMBOL_NAME(sys_query_module) + .rept NR_syscalls-167 .long SYMBOL_NAME(sys_ni_syscall) .endr diff --git a/arch/i386/kernel/ksyms.c b/arch/i386/kernel/ksyms.c index 084466c5c65c..bcb86de8ea44 100644 --- a/arch/i386/kernel/ksyms.c +++ b/arch/i386/kernel/ksyms.c @@ -13,43 +13,36 @@ extern void dump_thread(struct pt_regs *, struct user *); extern int dump_fpu(elf_fpregset_t *); -static struct symbol_table arch_symbol_table = { -#include - /* platform dependent support */ - X(EISA_bus), - X(MCA_bus), - X(wp_works_ok), - X(__verify_write), - X(dump_thread), - X(dump_fpu), - X(ioremap), - X(iounmap), - XNOVERS(__down_failed), - XNOVERS(__up_wakeup), +/* platform dependent support */ +EXPORT_SYMBOL(EISA_bus); +EXPORT_SYMBOL(MCA_bus); +EXPORT_SYMBOL(wp_works_ok); +EXPORT_SYMBOL(__verify_write); +EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(dump_fpu); +EXPORT_SYMBOL(ioremap); +EXPORT_SYMBOL(iounmap); +EXPORT_SYMBOL_NOVERS(__down_failed); +EXPORT_SYMBOL_NOVERS(__up_wakeup); + #ifdef __SMP__ - X(apic_reg), /* Needed internally for the I386 inlines */ - X(cpu_data), - X(syscall_count), - X(kernel_flag), - X(kernel_counter), - X(active_kernel_processor), - X(smp_invalidate_needed), +EXPORT_SYMBOL(apic_reg); /* Needed internally for the I386 inlines */ +EXPORT_SYMBOL(cpu_data); +EXPORT_SYMBOL(syscall_count); +EXPORT_SYMBOL(kernel_flag); +EXPORT_SYMBOL(kernel_counter); +EXPORT_SYMBOL(active_kernel_processor); +EXPORT_SYMBOL(smp_invalidate_needed); #endif + #ifdef CONFIG_MCA - /* Adapter probing and info methods. */ - X(mca_write_pos), - X(mca_read_pos), - X(mca_read_stored_pos), - X(mca_set_adapter_name), - X(mca_get_adapter_name), - X(mca_set_adapter_procfn), - X(mca_isenabled), - X(mca_isadapter), +/* Adapter probing and info methods. */ +EXPORT_SYMBOL(mca_write_pos); +EXPORT_SYMBOL(mca_read_pos); +EXPORT_SYMBOL(mca_read_stored_pos); +EXPORT_SYMBOL(mca_set_adapter_name); +EXPORT_SYMBOL(mca_get_adapter_name); +EXPORT_SYMBOL(mca_set_adapter_procfn); +EXPORT_SYMBOL(mca_isenabled); +EXPORT_SYMBOL(mca_isadapter); #endif -#include -}; - -void arch_syms_export(void) -{ - register_symtab(&arch_symbol_table); -} diff --git a/arch/i386/mm/extable.c b/arch/i386/mm/extable.c index c43a8d43d5a7..ba34c0395812 100644 --- a/arch/i386/mm/extable.c +++ b/arch/i386/mm/extable.c @@ -14,11 +14,6 @@ search_one_table(const struct exception_table_entry *first, const struct exception_table_entry *last, unsigned long value) { - /* Some versions of the linker are buggy and do not align the - __start pointer along with the section, thus we may be low. */ - if ((long)first & 3) - (long)first = ((long)first | 3) + 1; - while (first <= last) { const struct exception_table_entry *mid; long diff; @@ -39,25 +34,22 @@ unsigned long search_exception_table(unsigned long addr) { unsigned long ret; -#ifdef CONFIG_MODULES - struct module *mp; -#endif - /* Search the kernel's table first. */ - ret = search_one_table(__start___ex_table, - __stop___ex_table-1, addr); - if (ret) - return ret; - -#ifdef CONFIG_MODULES +#ifndef CONFIG_MODULES + /* There is only the kernel to search. */ + ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); + if (ret) return ret; +#else + /* The kernel is the last "module" -- no need to treat it special. */ + struct module *mp; for (mp = module_list; mp != NULL; mp = mp->next) { - if (mp->exceptinfo.start != NULL) { - ret = search_one_table(mp->exceptinfo.start, - mp->exceptinfo.stop-1, addr); - if (ret) - return ret; - } + if (mp->ex_table_start == NULL) + continue; + ret = search_one_table(mp->ex_table_start, + mp->ex_table_end - 1, addr); + if (ret) return ret; } #endif + return 0; } diff --git a/arch/m68k/amiga/ksyms.c b/arch/m68k/amiga/ksyms.c index 1e87df7c7aef..0c12976ebc20 100644 --- a/arch/m68k/amiga/ksyms.c +++ b/arch/m68k/amiga/ksyms.c @@ -6,37 +6,21 @@ extern volatile u_short amiga_audio_min_period; extern u_short amiga_audio_period; -static struct symbol_table amiga_symbol_table = { -#include - - /* - * Add things here when you find the need for it. - */ - X(amiga_model), - X(amiga_hw_present), - X(amiga_eclock), - X(amiga_colorclock), - X(amiga_chip_alloc), - X(amiga_chip_free), - X(amiga_chip_avail), - X(amiga_audio_period), - X(amiga_audio_min_period), - - X(zorro_find), - X(zorro_get_board), - X(zorro_config_board), - X(zorro_unconfig_board), - X(zorro_unused_z2ram), - - /* example - X(something_you_need), - */ - - -#include -}; - -void amiga_syms_export(void) -{ - register_symtab(&amiga_symbol_table); -} +/* + * Add things here when you find the need for it. + */ +EXPORT_SYMBOL(amiga_model); +EXPORT_SYMBOL(amiga_hw_present); +EXPORT_SYMBOL(amiga_eclock); +EXPORT_SYMBOL(amiga_colorclock); +EXPORT_SYMBOL(amiga_chip_alloc); +EXPORT_SYMBOL(amiga_chip_free); +EXPORT_SYMBOL(amiga_chip_avail); +EXPORT_SYMBOL(amiga_audio_period); +EXPORT_SYMBOL(amiga_audio_min_period); + +EXPORT_SYMBOL(zorro_find); +EXPORT_SYMBOL(zorro_get_board); +EXPORT_SYMBOL(zorro_config_board); +EXPORT_SYMBOL(zorro_unconfig_board); +EXPORT_SYMBOL(zorro_unused_z2ram); diff --git a/arch/m68k/atari/ksyms.c b/arch/m68k/atari/ksyms.c index fdd207e62b3d..ee6c474bba6c 100644 --- a/arch/m68k/atari/ksyms.c +++ b/arch/m68k/atari/ksyms.c @@ -9,35 +9,25 @@ extern void atari_microwire_cmd( int cmd ); -static struct symbol_table atari_symbol_table = { -#include - X(atari_mch_cookie), - X(atari_hw_present), - X(is_medusa), - X(atari_register_vme_int), - X(atari_unregister_vme_int), - X(stdma_lock), - X(stdma_release), - X(stdma_others_waiting), - X(stdma_islocked), +EXPORT_SYMBOL(atari_mch_cookie); +EXPORT_SYMBOL(atari_hw_present); +EXPORT_SYMBOL(is_medusa); +EXPORT_SYMBOL(atari_register_vme_int); +EXPORT_SYMBOL(atari_unregister_vme_int); +EXPORT_SYMBOL(stdma_lock); +EXPORT_SYMBOL(stdma_release); +EXPORT_SYMBOL(stdma_others_waiting); +EXPORT_SYMBOL(stdma_islocked); - X(atari_mouse_buttons), - X(atari_mouse_interrupt_hook), - X(atari_MIDI_interrupt_hook), - X(atari_mch_cookie), - X(ikbd_write), - X(ikbd_mouse_y0_top), - X(ikbd_mouse_thresh), - X(ikbd_mouse_rel_pos), - X(ikbd_mouse_disable), +EXPORT_SYMBOL(atari_mouse_buttons); +EXPORT_SYMBOL(atari_mouse_interrupt_hook); +EXPORT_SYMBOL(atari_MIDI_interrupt_hook); +EXPORT_SYMBOL(atari_mch_cookie); +EXPORT_SYMBOL(ikbd_write); +EXPORT_SYMBOL(ikbd_mouse_y0_top); +EXPORT_SYMBOL(ikbd_mouse_thresh); +EXPORT_SYMBOL(ikbd_mouse_rel_pos); +EXPORT_SYMBOL(ikbd_mouse_disable); - X(atari_microwire_cmd), - -#include -}; - -void atari_syms_export(void) -{ - register_symtab(&atari_symbol_table); -} +EXPORT_SYMBOL(atari_microwire_cmd); diff --git a/arch/m68k/kernel/ksyms.c b/arch/m68k/kernel/ksyms.c index cea67064f691..4478957e4edb 100644 --- a/arch/m68k/kernel/ksyms.c +++ b/arch/m68k/kernel/ksyms.c @@ -18,47 +18,34 @@ extern char m68k_debug_device[]; extern void dump_thread(struct pt_regs *, struct user *); extern int dump_fpu(elf_fpregset_t *); -static struct symbol_table arch_symbol_table = { -#include - /* platform dependent support */ - - X(memcmp), - X(m68k_machtype), - X(m68k_cputype), - X(m68k_is040or060), - X(cache_push), - X(cache_push_v), - X(cache_clear), - X(mm_vtop), - X(mm_ptov), - X(mm_end_of_chunk), - X(m68k_debug_device), - X(request_irq), - X(free_irq), - X(dump_fpu), - X(dump_thread), - X(strnlen), - X(strrchr), - X(strstr), - - /* The following are special because they're not called - explicitly (the C compiler generates them). Fortunately, - their interface isn't gonna change any time soon now, so - it's OK to leave it out of version control. */ - XNOVERS(__ashrdi3), - XNOVERS(memcpy), - XNOVERS(memset), - - XNOVERS(__down_failed), - XNOVERS(__up_wakeup), - -#include -}; - -void arch_syms_export(void) -{ - register_symtab(&arch_symbol_table); - - if (mach_syms_export) - mach_syms_export(); -} +/* platform dependent support */ + +EXPORT_SYMBOLS(memcmp); +EXPORT_SYMBOLS(m68k_machtype); +EXPORT_SYMBOLS(m68k_cputype); +EXPORT_SYMBOLS(m68k_is040or060); +EXPORT_SYMBOLS(cache_push); +EXPORT_SYMBOLS(cache_push_v); +EXPORT_SYMBOLS(cache_clear); +EXPORT_SYMBOLS(mm_vtop); +EXPORT_SYMBOLS(mm_ptov); +EXPORT_SYMBOLS(mm_end_of_chunk); +EXPORT_SYMBOLS(m68k_debug_device); +EXPORT_SYMBOLS(request_irq); +EXPORT_SYMBOLS(free_irq); +EXPORT_SYMBOLS(dump_fpu); +EXPORT_SYMBOLS(dump_thread); +EXPORT_SYMBOLS(strnlen); +EXPORT_SYMBOLS(strrchr); +EXPORT_SYMBOLS(strstr); + +/* The following are special because they're not called + explicitly (the C compiler generates them). Fortunately, + their interface isn't gonna change any time soon now, so + it's OK to leave it out of version control. */ +EXPORT_SYMBOLS_NOVERS(__ashrdi3); +EXPORT_SYMBOLS_NOVERS(memcpy); +EXPORT_SYMBOLS_NOVERS(memset); + +EXPORT_SYMBOLS_NOVERS(__down_failed); +EXPORT_SYMBOLS_NOVERS(__up_wakeup); diff --git a/arch/m68k/mm/extable.c b/arch/m68k/mm/extable.c index 6104120b79da..c3cdba749b6e 100644 --- a/arch/m68k/mm/extable.c +++ b/arch/m68k/mm/extable.c @@ -34,24 +34,22 @@ unsigned long search_exception_table(unsigned long addr) { unsigned long ret; -#ifdef CONFIG_MODULES - struct module *mp; -#endif - /* Search the kernel's table first. */ +#ifndef CONFIG_MODULES + /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); - if (ret) - return ret; - -#ifdef CONFIG_MODULES + if (ret) return ret; +#else + /* The kernel is the last "module" -- no need to treat it special. */ + struct module *mp; for (mp = module_list; mp != NULL; mp = mp->next) { - if (mp->exceptinfo.start != NULL) { - ret = search_one_table(mp->exceptinfo.start, - mp->exceptinfo.stop-1, addr); - if (ret) - return ret; - } + if (mp->ex_table_start == NULL) + continue; + ret = search_one_table(mp->ex_table_start, + mp->ex_table_stop-1, addr); + if (ret) return ret; } #endif + return 0; } diff --git a/arch/ppc/kernel/ksyms.c b/arch/ppc/kernel/ksyms.c index a0d3ec66e8d2..b59b8964e498 100644 --- a/arch/ppc/kernel/ksyms.c +++ b/arch/ppc/kernel/ksyms.c @@ -1,14 +1,4 @@ #include #include -static struct symbol_table arch_symbol_table = { -#include - /* platform dependent support */ -#include -}; - -void arch_syms_export(void) -{ - register_symtab(&arch_symbol_table); -} - +/* platform dependent support */ diff --git a/arch/sparc/kernel/head.S b/arch/sparc/kernel/head.S index a359b05f10c6..d756630fafb2 100644 --- a/arch/sparc/kernel/head.S +++ b/arch/sparc/kernel/head.S @@ -1,4 +1,4 @@ -/* $Id: head.S,v 1.74 1996/12/08 08:18:59 davem Exp $ +/* $Id: head.S,v 1.75 1996/12/20 07:54:57 davem Exp $ * head.S: The initial boot code for the Sparc port of Linux. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -409,7 +409,7 @@ C_LABEL(cpu3_stack): .skip 0x2000 */ .globl C_LABEL(bootup_user_stack) .globl C_LABEL(bootup_kernel_stack) - .globl C_LABEL(pg0) + .globl C_LABEL(pg0), C_LABEL(pg1), C_LABEL(pg2), C_LABEL(pg3) .globl C_LABEL(empty_bad_page) .globl C_LABEL(empty_bad_page_table) .globl C_LABEL(empty_zero_page) @@ -418,6 +418,9 @@ C_LABEL(bootup_user_stack): .skip 0x2000 C_LABEL(bootup_kernel_stack): .skip 0x2000 C_LABEL(swapper_pg_dir): .skip 0x1000 C_LABEL(pg0): .skip 0x1000 +C_LABEL(pg1): .skip 0x1000 +C_LABEL(pg2): .skip 0x1000 +C_LABEL(pg3): .skip 0x1000 C_LABEL(empty_bad_page): .skip 0x1000 C_LABEL(empty_bad_page_table): .skip 0x1000 C_LABEL(empty_zero_page): .skip 0x1000 diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c index 201e0d9b986c..b1b157aa7944 100644 --- a/arch/sparc/kernel/signal.c +++ b/arch/sparc/kernel/signal.c @@ -1,4 +1,4 @@ -/* $Id: signal.c,v 1.64 1996/12/03 08:44:34 jj Exp $ +/* $Id: signal.c,v 1.66 1996/12/20 07:54:58 davem Exp $ * linux/arch/sparc/kernel/signal.c * * Copyright (C) 1991, 1992 Linus Torvalds @@ -26,7 +26,11 @@ #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) asmlinkage int sys_waitpid(pid_t pid, unsigned long *stat_addr, int options); + +extern void fpsave(unsigned long *fpregs, unsigned long *fsr, + void *fpqueue, unsigned long *fpqdepth); extern void fpload(unsigned long *fpregs, unsigned long *fsr); + asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs, unsigned long orig_o0, int ret_from_syscall); @@ -64,7 +68,6 @@ struct signal_sframe { struct new_signal_frame { struct sparc_stackf ss; - struct reg_window sig_window; __siginfo_t info; unsigned long __pad; unsigned long insns [2]; @@ -140,11 +143,26 @@ void do_new_sigreturn (struct pt_regs *regs) up_psr = regs->psr; memcpy (regs, &sf->info.si_regs, sizeof (struct pt_regs)); - /* User can only change condition codes in %psr. */ - regs->psr = (up_psr & ~(PSR_ICC)) | (regs->psr & PSR_ICC); + /* User can only change condition codes and FPU enabling in the %psr. */ + regs->psr = (up_psr & ~(PSR_ICC | PSR_EF)) | (regs->psr & (PSR_ICC | PSR_EF)); - if (regs->psr & PSR_EF) - fpload (&sf->info.si_float_regs [0], &sf->info.si_fsr); + if (regs->psr & PSR_EF) { + regs->psr &= ~(PSR_EF); +#ifndef __SMP__ + if(current == last_task_used_math) + last_task_used_math = 0; +#endif + current->used_math = 1; + current->flags &= ~(PF_USEDFPU); + + /* Copy signal FPU state into thread struct FPU state. */ + memcpy(¤t->tss.float_regs[0], &sf->info.si_float_regs[0], + (sizeof(unsigned long) * 64)); + current->tss.fsr = sf->info.si_fsr; + if((current->tss.fpqdepth = sf->info.si_fpqdepth) != 0) + memcpy(¤t->tss.fpqueue[0], &sf->info.si_fpqueue[0], + ((sizeof(unsigned long) + (sizeof(unsigned long *))) * 16)); + } current->blocked = sf->info.si_mask & _BLOCKABLE; } @@ -287,17 +305,53 @@ new_setup_frame(struct sigaction *sa, struct pt_regs *regs, int signo, unsigned } if (current->tss.w_saved != 0){ - printk ("Ay Caramba! w_saved not zero!\n"); + printk ("%s[%d]: Invalid user stack frame for signal delivery.\n", + current->comm, current->pid); do_exit (SIGILL); return; } - /* 2. Save the state current process state */ + /* 2. Save the current process state */ memcpy (&sf->info.si_regs, regs, sizeof (struct pt_regs)); - if (regs->psr & PSR_EF){ +#ifdef __SMP__ + if(current->flags & PF_USEDFPU) { + put_psr(get_psr() | PSR_EF); fpsave (&sf->info.si_float_regs [0], &sf->info.si_fsr, &sf->info.si_fpqueue[0], &sf->info.si_fpqdepth); + + /* Save a copy into thread struct as well. */ + memcpy(¤t->tss.float_regs[0], &sf->info.si_float_regs[0], + (sizeof(unsigned long) * 64)); + current->tss.fsr = sf->info.si_fsr; + if((current->tss.fpqdepth = sf->info.si_fpqdepth) != 0) + memcpy(¤t->tss.fpqueue[0], &sf->info.si_fpqueue[0], + ((sizeof(unsigned long) + (sizeof(unsigned long *))) * 16)); + + regs->psr &= ~(PSR_EF); + current->flags &= ~(PF_USEDFPU); } +#else + if(current == last_task_used_math) { + put_psr(get_psr() | PSR_EF); + fpsave (&sf->info.si_float_regs [0], &sf->info.si_fsr, + &sf->info.si_fpqueue[0], &sf->info.si_fpqdepth); + + /* Save a copy into thread struct as well. */ + memcpy(¤t->tss.float_regs[0], &sf->info.si_float_regs[0], + (sizeof(unsigned long) * 64)); + current->tss.fsr = sf->info.si_fsr; + if((current->tss.fpqdepth = sf->info.si_fpqdepth) != 0) + memcpy(¤t->tss.fpqueue[0], &sf->info.si_fpqueue[0], + ((sizeof(unsigned long) + (sizeof(unsigned long *))) * 16)); + + last_task_used_math = NULL; + regs->psr &= ~(PSR_EF); + } +#endif + + /* This new thread of control has not used the FPU. */ + current->used_math = 0; + sf->info.si_mask = oldmask; memcpy (sf, (char *) regs->u_regs [UREG_FP], sizeof (struct reg_window)); @@ -315,7 +369,7 @@ new_setup_frame(struct sigaction *sa, struct pt_regs *regs, int signo, unsigned regs->pc = (unsigned long) sa->sa_handler; regs->npc = (regs->pc + 4); - /* Flush cache, replace this with a generic thingie */ + /* Flush instruction space. */ flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); } diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index d25019ca0a28..629694eda133 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -65,139 +65,128 @@ extern void dump_thread(struct pt_regs *, struct user *); * support routines are named is a mess, they all start with * a '.' which makes it a bitch to export, here is the trick: */ -#define DD(sym) extern int __sparc_dot_ ## sym (int) __asm__("." ## #sym) -#define XD(sym) { (void *) & __sparc_dot_ ## sym, "." ## #sym } -DD(rem); -DD(urem); -DD(div); -DD(udiv); -DD(mul); -DD(umul); +#define EXPORT_SYMBOL_DOT(sym) \ +extern int __sparc_dot_ ## sym (int) __asm__("." ## #sym); \ +const struct module_symbol __export_dot_##sym \ +__attribute__((section("__ksymtab"))) = \ +{ (unsigned long) &__sparc_dot_ ## sym, "." ## #sym } -static struct symbol_table arch_symbol_table = { -#include - /* used by various drivers */ - X(sparc_cpu_model), +/* used by various drivers */ +EXPORT_SYMBOL(sparc_cpu_model); #ifdef __SMP__ - X(kernel_flag), - X(kernel_counter), - X(active_kernel_processor), - X(syscall_count), +EXPORT_SYMBOL(kernel_flag); +EXPORT_SYMBOL(kernel_counter); +EXPORT_SYMBOL(active_kernel_processor); +EXPORT_SYMBOL(syscall_count); #endif - X(page_offset), - X(stack_top), +EXPORT_SYMBOL(page_offset); +EXPORT_SYMBOL(stack_top); - X(udelay), - X(mstk48t02_regs), +EXPORT_SYMBOL(udelay); +EXPORT_SYMBOL(mstk48t02_regs); #if CONFIG_SUN_AUXIO - X(auxio_register), +EXPORT_SYMBOL(auxio_register); #endif - X(request_fast_irq), - X(sparc_alloc_io), - X(sparc_free_io), - X(mmu_v2p), - X(mmu_unlockarea), - X(mmu_lockarea), - X(mmu_get_scsi_sgl), - X(mmu_get_scsi_one), - X(mmu_release_scsi_sgl), - X(mmu_release_scsi_one), - X(sparc_dvma_malloc), - X(sun4c_unmapioaddr), - X(srmmu_unmapioaddr), +EXPORT_SYMBOL(request_fast_irq); +EXPORT_SYMBOL(sparc_alloc_io); +EXPORT_SYMBOL(sparc_free_io); +EXPORT_SYMBOL(mmu_v2p); +EXPORT_SYMBOL(mmu_unlockarea); +EXPORT_SYMBOL(mmu_lockarea); +EXPORT_SYMBOL(mmu_get_scsi_sgl); +EXPORT_SYMBOL(mmu_get_scsi_one); +EXPORT_SYMBOL(mmu_release_scsi_sgl); +EXPORT_SYMBOL(mmu_release_scsi_one); +EXPORT_SYMBOL(sparc_dvma_malloc); +EXPORT_SYMBOL(sun4c_unmapioaddr); +EXPORT_SYMBOL(srmmu_unmapioaddr); #if CONFIG_SBUS - X(SBus_chain), +EXPORT_SYMBOL(SBus_chain); #endif - /* Solaris/SunOS binary compatibility */ - X(svr4_setcontext), - X(svr4_getcontext), - X(_sigpause_common), - X(sunos_mmap), - X(sunos_poll), - - /* Should really be in linux/kernel/ksyms.c */ - X(dump_thread), - - /* prom symbols */ - X(idprom), - X(prom_root_node), - X(prom_getchild), - X(prom_getsibling), - X(prom_searchsiblings), - X(prom_firstprop), - X(prom_nextprop), - X(prom_getproplen), - X(prom_getproperty), - X(prom_setprop), - X(prom_nodeops), - X(prom_getbootargs), - X(prom_apply_obio_ranges), - X(prom_getname), - X(prom_feval), - X(prom_getstring), - X(prom_apply_sbus_ranges), - X(prom_getint), - X(prom_getintdefault), - X(romvec), - - /* sparc library symbols */ - X(bcopy), - X(memmove), - X(memscan), - X(strlen), - X(strnlen), - X(strcpy), - X(strncpy), - X(strcat), - X(strncat), - X(strcmp), - X(strncmp), - X(strchr), - X(strrchr), - X(strpbrk), - X(strtok), - X(strstr), - X(strspn), - - /* Special internal versions of library functions. */ - X(__copy_1page), - X(__memcpy), - X(__memset), - X(bzero_1page), - X(__bzero), - X(__memscan_zero), - X(__memscan_generic), - X(__memcmp), - X(__strncmp), - - /* Moving data to/from userspace. */ - X(__copy_user), - X(__clear_user), - X(__strncpy_from_user), - - /* No version information on this, heavily used in inline asm, - * and will always be 'void __ret_efault(void)'. - */ - XNOVERS(__ret_efault), - - /* No version information on these, as gcc produces such symbols. */ - XNOVERS(memcmp), - XNOVERS(memcpy), - XNOVERS(memset), - XNOVERS(__ashrdi3), - - XD(rem), - XD(urem), - XD(mul), - XD(umul), - XD(div), - XD(udiv), -#include -}; -void arch_syms_export(void) -{ - register_symtab(&arch_symbol_table); -} +/* Solaris/SunOS binary compatibility */ +EXPORT_SYMBOL(svr4_setcontext); +EXPORT_SYMBOL(svr4_getcontext); +EXPORT_SYMBOL(_sigpause_common); +EXPORT_SYMBOL(sunos_mmap); +EXPORT_SYMBOL(sunos_poll); + +/* Should really be in linux/kernel/ksyms.c */ +EXPORT_SYMBOL(dump_thread); + +/* prom symbols */ +EXPORT_SYMBOL(idprom); +EXPORT_SYMBOL(prom_root_node); +EXPORT_SYMBOL(prom_getchild); +EXPORT_SYMBOL(prom_getsibling); +EXPORT_SYMBOL(prom_searchsiblings); +EXPORT_SYMBOL(prom_firstprop); +EXPORT_SYMBOL(prom_nextprop); +EXPORT_SYMBOL(prom_getproplen); +EXPORT_SYMBOL(prom_getproperty); +EXPORT_SYMOBL(prom_setprop); +EXPORT_SYMBOL(prom_nodeops); +EXPORT_SYMBOL(prom_getbootargs); +EXPORT_SYMBOL(prom_apply_obio_ranges); +EXPORT_SYMBOL(prom_getname); +EXPORT_SYMBOL(prom_feval); +EXPORT_SYMBOL(prom_getstring); +EXPORT_SYMBOL(prom_apply_sbus_ranges); +EXPORT_SYMBOL(prom_getint); +EXPORT_SYMBOL(prom_getintdefault); +EXPORT_SYMBOL(romvec); + +/* sparc library symbols */ +EXPORT_SYMBOL(bcopy); +EXPORT_SYMBOL(memmove); +EXPORT_SYMBOL(memscan); +EXPORT_SYMBOL(strlen); +EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(strcpy); +EXPORT_SYMBOL(strncpy); +EXPORT_SYMBOL(strcat); +EXPORT_SYMBOL(strncat); +EXPORT_SYMBOL(strcmp); +EXPORT_SYMBOL(strncmp); +EXPORT_SYMBOL(strchr); +EXPORT_SYMBOL(strrchr); +EXPORT_SYMBOL(strpbrk); +EXPORT_SYMBOL(strtok); +EXPORT_SYMBOL(strstr); +EXPORT_SYMBOL(strspn); + +/* Special internal versions of library functions. */ +EXPORT_SYMBOL(__copy_1page); +EXPORT_SYMBOL(__memcpy); +EXPORT_SYMBOL(__memset); +EXPORT_SYMBOL(bzero_1page); +EXPORT_SYMBOL(__bzero); +EXPORT_SYMBOL(__memscan_zero); +EXPORT_SYMBOL(__memscan_generic); +EXPORT_SYMBOL(__memcmp); +EXPORT_SYMBOL(__strncmp); + +/* Moving data to/from userspace. */ +EXPORT_SYMBOL(__copy_user); +EXPORT_SYMBOL(__clear_user); +EXPORT_SYMBOL(__strncpy_from_user); + +/* No version information on this, heavily used in inline asm, + * and will always be 'void __ret_efault(void)'. + */ +EXPORT_SYMBOLNOVERS(__ret_efault); + +/* No version information on these, as gcc produces such symbols. */ +EXPORT_SYMBOL_NOVERS(memcmp); +EXPORT_SYMBOL_NOVERS(memcpy); +EXPORT_SYMBOL_NOVERS(memset); +EXPORT_SYMBOL_NOVERS(__ashrdi3); + +EXPORT_SYMBOL_DOT(rem); +EXPORT_SYMBOL_DOT(urem); +EXPORT_SYMBOL_DOT(mul); +EXPORT_SYMBOL_DOT(umul); +EXPORT_SYMBOL_DOT(div); +EXPORT_SYMBOL_DOT(udiv); diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index 0b9245e4a75d..67bcf8cea52b 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -1,4 +1,4 @@ -/* $Id: sys_sunos.c,v 1.68 1996/12/19 05:25:43 davem Exp $ +/* $Id: sys_sunos.c,v 1.69 1996/12/21 04:50:38 tridge Exp $ * sys_sunos.c: SunOS specific syscall compatibility support. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -131,7 +131,7 @@ asmlinkage int sunos_mctl(unsigned long addr, unsigned long len, int function, c } /* SunOS is completely broken... it returns 0 on success, otherwise - * ENOMEM. For sys_sbrk() it wants the new brk value as a return + * ENOMEM. For sys_sbrk() it wants the old brk value as a return * on success and ENOMEM as before on failure. */ asmlinkage int sunos_brk(unsigned long brk) @@ -142,7 +142,7 @@ asmlinkage int sunos_brk(unsigned long brk) if(sparc_cpu_model == sun4c) { if(brk >= 0x20000000 && brk < 0xe0000000) - return current->mm->brk; + return -ENOMEM; } if (brk < current->mm->end_code) @@ -205,13 +205,14 @@ asmlinkage int sunos_brk(unsigned long brk) asmlinkage unsigned long sunos_sbrk(int increment) { int error; + unsigned long oldbrk = current->mm->brk; /* This should do it hopefully... */ error = sunos_brk(((int) current->mm->brk) + increment); if(error) return error; else - return current->mm->brk; + return oldbrk; } /* XXX Completely undocumented, and completely magic... diff --git a/arch/sparc/mm/extable.c b/arch/sparc/mm/extable.c index a82de96f56f6..dfbcab8dc3f6 100644 --- a/arch/sparc/mm/extable.c +++ b/arch/sparc/mm/extable.c @@ -31,12 +31,13 @@ search_one_table(const struct exception_table_entry *start, else last = mid-1; } - if (last->insn < value && !last->fixup && (last + 1)->insn > value) { + if (last->insn < value && !last->fixup && last[1].insn > value) { *g2 = (value - last->insn)/4; - return (last + 1)->fixup; + return last[1].fixup; } - if (first > start && (first-1)->insn < value && !(first-1)->fixup && first->insn < value) { - *g2 = (value - (first-1)->insn)/4; + if (first > start && first[-1].insn < value + && !first[-1].fixup && first->insn < value) { + *g2 = (value - firstp[-1].insn)/4; return first->fixup; } return 0; @@ -46,25 +47,23 @@ unsigned long search_exception_table(unsigned long addr, unsigned long *g2) { unsigned long ret; -#ifdef CONFIG_MODULES - struct module *mp; -#endif - /* Search the kernel's table first. */ +#ifndef CONFIG_MODULES + /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr, g2); - if (ret) - return ret; - -#ifdef CONFIG_MODULES + if (ret) return ret; +#else + /* The kernel is the last "module" -- no need to treat it special. */ + struct module *mp; for (mp = module_list; mp != NULL; mp = mp->next) { - if (mp->exceptinfo.start != NULL) { - ret = search_one_table(mp->exceptinfo.start, - mp->exceptinfo.stop-1, addr, g2); - if (ret) - return ret; - } + if (mp->ex_table_start == NULL) + continue; + ret = search_one_table(mp->ex_table_start, + mp->ex_table_stop-1, addr, g2); + if (ret) return ret; } #endif + return 0; } diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 92b7a9e8aa6b..0492971ec179 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -1,4 +1,4 @@ -/* $Id: sun4c.c,v 1.133 1996/12/18 06:43:28 tridge Exp $ +/* $Id: sun4c.c,v 1.135 1996/12/23 05:27:50 davem Exp $ * sun4c.c: Doing in software what should be done in hardware. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -1862,10 +1862,11 @@ static void sun4c_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdir) /* Please take special note on the foo_kernel() routines below, our * fast in window fault handler wants to get at the pte's for vmalloc * area with traps off, therefore they _MUST_ be locked down to prevent - * a watchdog from happening. The lowest VMALLOC'd thing is the buffer - * cache hash table, it is never free'd ever, so the pg0 we use for the - * lowest most page of pte's will never be freed and is guarenteed to - * be locked down. Be careful with this code thanks. + * a watchdog from happening. It only takes 4 pages of pte's to lock + * down the maximum vmalloc space possible on sun4c so we statically + * allocate these page table pieces in the kernel image. Therefore + * we should never have to really allocate or free any kernel page + * table information. */ /* Allocate and free page tables. The xxx_kernel() versions are @@ -1874,39 +1875,16 @@ static void sun4c_update_rootmmu_dir(struct task_struct *tsk, pgd_t *pgdir) */ static void sun4c_pte_free_kernel(pte_t *pte) { - unsigned long pg0_addr = (unsigned long) pg0; - unsigned long this_addr = (unsigned long) pte; - unsigned long page = (unsigned long) pte; - - pg0_addr &= PAGE_MASK; - this_addr &= PAGE_MASK; - - /* See above comment. */ - if(pg0_addr != this_addr) { - page = (PAGE_OFFSET + ((sun4c_get_pte(this_addr) & 0xffff)<> PAGE_SHIFT) & (SUN4C_PTRS_PER_PTE - 1); - if (sun4c_pmd_none(*pmd)) { - pte_t *page = (pte_t *) get_free_page(GFP_KERNEL); - if (sun4c_pmd_none(*pmd)) { - if (page) { - /* See above comment. */ - page = (pte_t *) sun4c_lockarea((char *)page, PAGE_SIZE); - *pmd = __pmd(PGD_TABLE | (unsigned long) page); - return page + address; - } - *pmd = __pmd(PGD_TABLE | (unsigned long) BAD_PAGETABLE); - return NULL; - } - free_page((unsigned long) page); - } + if(address >= SUN4C_LOCK_VADDR) + return NULL; + if (sun4c_pmd_none(*pmd)) + panic("sun4c_pmd_none for kernel pmd, can't happen..."); if (sun4c_pmd_bad(*pmd)) { printk("Bad pmd in pte_alloc_kernel: %08lx\n", pmd_val(*pmd)); *pmd = __pmd(PGD_TABLE | (unsigned long) BAD_PAGETABLE); @@ -1921,7 +1899,6 @@ static pte_t *sun4c_pte_alloc_kernel(pmd_t *pmd, unsigned long address) */ static void sun4c_pmd_free_kernel(pmd_t *pmd) { - *pmd = __pmd(0); } static pmd_t *sun4c_pmd_alloc_kernel(pgd_t *pgd, unsigned long address) @@ -2072,7 +2049,7 @@ extern unsigned long end; __initfunc(unsigned long sun4c_paging_init(unsigned long start_mem, unsigned long end_mem)) { int i, cnt; - unsigned long kernel_end; + unsigned long kernel_end, vaddr; extern unsigned long sparc_iobase_vaddr; kernel_end = (unsigned long) &end; @@ -2093,8 +2070,19 @@ __initfunc(unsigned long sun4c_paging_init(unsigned long start_mem, unsigned lon sun4c_set_context(0); memset(swapper_pg_dir, 0, PAGE_SIZE); memset(pg0, 0, PAGE_SIZE); + memset(pg1, 0, PAGE_SIZE); + memset(pg2, 0, PAGE_SIZE); + memset(pg3, 0, PAGE_SIZE); + /* Save work later. */ - swapper_pg_dir[SUN4C_VMALLOC_START>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg0); + vaddr = SUN4C_VMALLOC_START; + swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg0); + vaddr += SUN4C_PGDIR_SIZE; + swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg1); + vaddr += SUN4C_PGDIR_SIZE; + swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg2); + vaddr += SUN4C_PGDIR_SIZE; + swapper_pg_dir[vaddr>>SUN4C_PGDIR_SHIFT] = __pgd(PGD_TABLE | (unsigned long) pg3); sun4c_init_ss2_cache_bug(); start_mem = PAGE_ALIGN(start_mem); start_mem = sparc_context_init(start_mem, num_contexts); diff --git a/drivers/block/README.fd b/drivers/block/README.fd index f10b9218cd08..c3742498c689 100644 --- a/drivers/block/README.fd +++ b/drivers/block/README.fd @@ -4,7 +4,7 @@ FAQ list: ========= A FAQ list may be found in the fdutils package (see below), and also -at ftp.imag.fr:pub/Linux/ZLIBC/floppy/FAQ +at http://www.club.innet.lu/~year3160/floppy/FAQ.html Lilo config options (Thinkpad users, read this) @@ -171,58 +171,25 @@ package. This package also contains a new version of mtools which allows to access high capacity disks (up to 1992K on a high density 3 1/2 disk!). It also contains additional documentation about the floppy driver. It can be found at: - ftp.imag.fr:pub/Linux/ZLIBC/fdutils/fdutils-4.1.src.tar.gz - sunsite.unc.edu:/pub/Linux/system/Misc/fdutils-4.1.src.tar.gz - tsx-11.mit.edu:/pub/linux/sources/sbin/fdutils-4.1.src.tar.gz + linux.wauug.org:/pub/knaff/fdutils/fdutils-4.3.src.tar.gz + sunsite.unc.edu:/pub/Linux/system/Misc/fdutils-4.3.src.tar.gz + tsx-11.mit.edu:/pub/linux/sources/sbin/fdutils-4.3.src.tar.gz Alpha patches to these utilities are at: - ftp.imag.fr:pub/Linux/ZLIBC/fdutils/ALPHA + http://www.club.innet.lu/~year3160/fdutils/ALPHA All patches contained in this directory are directly against the base version, i.e. DON'T APPLY THEM ON TOP OF EACH OTHER. Only apply the most recent one. - -Alpha patches for the floppy driver: -==================================== - - You may find ALPHA patches of the driver itself in -ftp.imag.fr:pub/Linux/ZLIBC/floppy/ALPHA. These patches are named -fdp-.diff.gz - WARNING: These _are_ ALPHA, and may introduce new problems! Some -problems may only show up on certain hardware, or when trying weirdo -things. So don't be misled by people claiming they are stable and -should really be BETA. What works for one person, may not work for -somebody else at all. This directory contains a RELEASES file -describing the features of some of these patches. - - If after some testing these patches prove to be sufficiently stable, -they'll move into ftp.imag.fr:pub/Linux/ZLIBC/floppy/BETA. - - You may find quick&dirty fixes to the driver in -ftp.imag.fr:pub/Linux/ZLIBC/QDF. These patches are named -fdp-.diff - These patches fix only the most obvious problems, or provide trivial -enhancements. The main objective is to keep these patches small and -local, in order to keep the probability of introducing new problems as -small as possible. However, they may not attack the root of the -problem but only cure the symptoms. This directory contains a RELEASES -file describing the features of these patches. - - The ALPHA, BETA and QDF directories are removed, and replaced by a -README file when they get empty due to integration of the patches into -the stock kernel. You may still find patches to old kernels in -ftp.imag.fr:pub/Linux/ZLIBC/obsolete - - Reporting problems about the floppy driver ========================================== If you have a question or a bug report about the floppy driver, mail -me at Alain.Knaff@imag.fr. If you post to the news, use preferably one -of the groups comp.os.linux.help (for questions) or -comp.os.linux.hardware (for bug reports). As the volume in these -groups is rather high, be sure to include the word "floppy" (or -"FLOPPY") in the subject line. +me at Alain.Knaff@poboxes.com . If you post to Usenet, preferably use +comp.os.linux.hardware. As the volume in these groups is rather high, +be sure to include the word "floppy" (or "FLOPPY") in the subject +line. If the reported problem happens when mounting floppy disks, be +sure to mention also the type of the filesystem in the subject line. Be sure to read the FAQ before mailing/posting any bug reports! diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 611e151de8a0..90d8280ce43a 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4061,7 +4061,9 @@ static int floppy_grab_irq_and_dma(void) static void floppy_release_irq_and_dma(void) { #ifdef FLOPPY_SANITY_CHECK +#ifndef __sparc__ int drive; +#endif #endif long tmpsize; unsigned long tmpaddr; @@ -4094,9 +4096,11 @@ static void floppy_release_irq_and_dma(void) } #ifdef FLOPPY_SANITY_CHECK +#ifndef __sparc__ for (drive=0; drive < N_FDC * 4; drive++) if (motor_off_timer[drive].next) printk("motor off timer %d still active\n", drive); +#endif if (fd_timeout.next) printk("floppy timer still active:%s\n", timeout_message); @@ -4179,7 +4183,7 @@ extern "C" { #endif int init_module(void) { - printk(KERN_INFO "inserting floppy driver for %s\n", kernel_version); + printk(KERN_INFO "inserting floppy driver for " UTS_RELEASE "\n"); if(floppy) parse_floppy_cfg_string(floppy); diff --git a/drivers/block/ide-cd.c b/drivers/block/ide-cd.c index 6d2e4d6a0ee4..c2c480648d7b 100644 --- a/drivers/block/ide-cd.c +++ b/drivers/block/ide-cd.c @@ -144,6 +144,9 @@ * to fix the drive door locking problems. * * 4.03 Dec 04, 1996 -- Added DSC overlap support. + * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch + * by Ales Makarov (xmakarov@sun.felk.cvut.cz) + * * * MOSTLY DONE LIST: * Query the drive to find what features are available @@ -152,8 +155,8 @@ * TO DO LIST: * Avoid printing error messages for expected errors from the drive. * (If you are using a cd changer, you may get errors in the kernel - logs that are completly expected. Don't complpain to me about this, - unless you have a patch to fix it. I am working on it...) + * logs that are completly expected. Don't complain to me about this, + * unless you have a patch to fix it. I am working on it...) * Reset unlocks drive? * Implement ide_cdrom_disc_status using the generic cdrom interface * Implement ide_cdrom_select_speed using the generic cdrom interface @@ -161,7 +164,7 @@ * * -- Suggestions are welcome. Patches that work are more welcome though. * For those wishing to work on this driver, please be sure you download - * and comply with the latest ATAPI standard. This document can + * and comply with the latest ATAPI standard. This document can be * obtained by anonymous ftp from fission.dt.wdc.com in directory: * /pub/standards/atapi/spec/SFF8020-r2.6/PDF/8020r26.pdf * @@ -1834,7 +1837,7 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba, int nblocks, pc.c[7] = ((nblocks>>8) & 0xff); pc.c[6] = ((nblocks>>16) & 0xff); if (format <= 1) - pc.c[9] = 0xf0; + pc.c[9] = 0xf8; /* returns 2352 for any format */ else pc.c[9] = 0x10; @@ -1956,6 +1959,7 @@ int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi, switch (cmd) { + case CDROMREADRAW: case CDROMREADMODE1: case CDROMREADMODE2: { struct cdrom_msf msf; @@ -1966,11 +1970,13 @@ int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi, if (cmd == CDROMREADMODE1) { blocksize = CD_FRAMESIZE; format = 2; - } else { + } else if (cmd == CDROMREADMODE2) { blocksize = CD_FRAMESIZE_RAW0; format = 3; + } else { + blocksize = CD_FRAMESIZE_RAW; + format = 0; } - stat = verify_area (VERIFY_WRITE, (char *)arg, blocksize); if (stat) return stat; @@ -1989,7 +1995,7 @@ int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi, if (lba < 0 || lba >= toc->capacity) return -EINVAL; - buf = (char *) kmalloc (CD_FRAMESIZE_RAW0, GFP_KERNEL); + buf = (char *) kmalloc (CD_FRAMESIZE_RAW, GFP_KERNEL); if (buf == NULL) return -ENOMEM; diff --git a/drivers/block/ide.c b/drivers/block/ide.c index 5423eb2576fd..a7f688ff316c 100644 --- a/drivers/block/ide.c +++ b/drivers/block/ide.c @@ -2828,45 +2828,55 @@ struct file_operations ide_fops[] = {{ ide_revalidate_disk /* revalidate */ }}; -static struct symbol_table ide_syms = { -#include - X(ide_hwifs), - X(ide_register_module), X(ide_unregister_module), +EXPORT_SYMBOL(ide_hwifs); +EXPORT_SYMBOL(ide_register_module); +EXPORT_SYMBOL(ide_unregister_module); - /* - * Probe module - */ - X(ide_timer_expiry), X(ide_intr), - X(ide_geninit), X(ide_fops), - X(ide_get_queue), - X(do_ide0_request), +/* + * Probe module + */ +EXPORT_SYMBOL(ide_timer_expiry); +EXPORT_SYMBOL(ide_intr); +EXPORT_SYMBOL(ide_geninit); +EXPORT_SYMBOL(ide_fops); +EXPORT_SYMBOL(ide_get_queue); +EXPORT_SYMBOL(do_ide0_request); #if MAX_HWIFS > 1 - X(do_ide1_request), +EXPORT_SYMBOL(do_ide1_request); #endif /* MAX_HWIFS > 1 */ #if MAX_HWIFS > 2 - X(do_ide2_request), +EXPORT_SYMBOL(do_ide2_request); #endif /* MAX_HWIFS > 2 */ #if MAX_HWIFS > 3 - X(do_ide3_request), +EXPORT_SYMBOL(do_ide3_request); #endif /* MAX_HWIFS > 3 */ - /* - * Driver module - */ - X(ide_scan_devices), X(ide_register_subdriver), - X(ide_unregister_subdriver), X(ide_input_data), - X(ide_output_data), X(atapi_input_bytes), - X(atapi_output_bytes), X(ide_set_handler), - X(ide_dump_status), X(ide_error), - X(ide_fixstring), X(ide_wait_stat), - X(ide_do_reset), X(ide_init_drive_cmd), - X(ide_do_drive_cmd), X(ide_end_drive_cmd), - X(ide_end_request), X(ide_revalidate_disk), - X(ide_cmd), X(ide_stall_queue), - - X(ide_register), X(ide_unregister), -#include -}; +/* + * Driver module + */ +EXPORT_SYMBOL(ide_scan_devices); +EXPORT_SYMBOL(ide_register_subdriver); +EXPORT_SYMBOL(ide_unregister_subdriver); +EXPORT_SYMBOL(ide_input_data); +EXPORT_SYMBOL(ide_output_data); +EXPORT_SYMBOL(atapi_input_bytes); +EXPORT_SYMBOL(atapi_output_bytes); +EXPORT_SYMBOL(ide_set_handler); +EXPORT_SYMBOL(ide_dump_status); +EXPORT_SYMBOL(ide_error); +EXPORT_SYMBOL(ide_fixstring); +EXPORT_SYMBOL(ide_wait_stat); +EXPORT_SYMBOL(ide_do_reset); +EXPORT_SYMBOL(ide_init_drive_cmd); +EXPORT_SYMBOL(ide_do_drive_cmd); +EXPORT_SYMBOL(ide_end_drive_cmd); +EXPORT_SYMBOL(ide_end_request); +EXPORT_SYMBOL(ide_revalidate_disk); +EXPORT_SYMBOL(ide_cmd); +EXPORT_SYMBOL(ide_stall_queue); + +EXPORT_SYMBOL(ide_register); +EXPORT_SYMBOL(ide_unregister); /* * This is gets invoked once during initialization, to set *everything* up @@ -2879,12 +2889,12 @@ int ide_init (void) ide_init_builtin_drivers(); initializing = 0; - (void) register_symtab(&ide_syms); return 0; } #ifdef MODULE char *options = NULL; +MODULE_PARM(options,"s"); static void parse_options (char *line) { diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index a622cb741b09..5525e240664f 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -375,7 +375,8 @@ static void make_request(int major,int rw, struct buffer_head * bh) req = *get_queue(bh->b_rdev); if (!req) { /* MD and loop can't handle plugging without deadlocking */ - if (major != MD_MAJOR && major != LOOP_MAJOR) + if (major != MD_MAJOR && major != LOOP_MAJOR && + major != DDV_MAJOR) plug_device(blk_dev + major); } else switch (major) { case IDE0_MAJOR: /* same as HD_MAJOR */ @@ -725,5 +726,11 @@ int blk_dev_init(void) #ifdef CONFIG_BLK_DEV_MD md_init(); #endif CONFIG_BLK_DEV_MD +#ifdef CONFIG_APBLOCK + ap_init(); +#endif +#ifdef CONFIG_DDV + ddv_init(); +#endif return 0; } diff --git a/drivers/block/md.c b/drivers/block/md.c index a5c8d262e38f..75620bd5404d 100644 --- a/drivers/block/md.c +++ b/drivers/block/md.c @@ -431,17 +431,10 @@ static void do_md_request (void) return; } -static struct symbol_table md_symbol_table= -{ -#include - - X(md_size), - X(register_md_personality), - X(unregister_md_personality), - X(partition_name), - -#include -}; +EXPORT_SYMBOL(md_size); +EXPORT_SYMBOL(register_md_personality); +EXPORT_SYMBOL(unregister_md_personality); +EXPORT_SYMBOL(partition_name); static struct proc_dir_entry proc_md = { PROC_MD, 6, "mdstat", @@ -461,7 +454,6 @@ static void md_geninit (struct gendisk *gdisk) } blksize_size[MAJOR_NR] = md_blocksizes; - register_symtab (&md_symbol_table); proc_register(&proc_root, &proc_md); } diff --git a/drivers/block/rd.c b/drivers/block/rd.c index f488cb4137c1..c3edeffa29f9 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c @@ -100,6 +100,7 @@ int rd_image_start = 0; /* starting block # of image */ #ifdef CONFIG_BLK_DEV_INITRD unsigned long initrd_start,initrd_end; int mount_initrd = 1; /* zero if initrd should not be mounted */ +int initrd_below_start_ok = 0; #endif #endif diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c index 5a8f5e7b70ff..c13bf5a46071 100644 --- a/drivers/cdrom/aztcd.c +++ b/drivers/cdrom/aztcd.c @@ -268,6 +268,7 @@ static int azt_mode = -1; static volatile int azt_read_count = 1; static int azt_port = AZT_BASE_ADDR; +MODULE_PARM(azt_port, "i"); static char azt_cont = 0; static char azt_init_end = 0; diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c index 70ba49160bdd..74877302452f 100644 --- a/drivers/cdrom/cdu31a.c +++ b/drivers/cdrom/cdu31a.c @@ -255,6 +255,7 @@ static unsigned int sony_blocks_left = 0; /* Number of 512 byte blocks left /* The base I/O address of the Sony Interface. This is a variable (not a #define) so it can be easily changed via some future ioctl() */ static unsigned int cdu31a_port = 0; +MODULE_PARM(cdu31a_port, "i"); /* * The following are I/O addresses of the various registers for the drive. The @@ -325,6 +326,7 @@ static unsigned volatile char final_pos_msf[3] = { 0, 0, 0 }; /* What IRQ is the drive using? 0 if none. */ static int cdu31a_irq = 0; +MODULE_PARM(cdu31a_irq, "i"); /* The interrupt handler will wake this queue up when it gets an interrupts. */ diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index 4870b8dc07d6..9411b3f02ed6 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c @@ -77,7 +77,33 @@ History: Upgrade to Linux kernel 1.3.78. 11 apr 1996 0.98 Upgrade to Linux kernel 1.3.85 - Made it more uniform. + More code moved to cdrom.c + + 0.99 Some more small changes to decrease number + of oopses at module load; + + Branch from here: + + 0.99.1.0 Update to kernel release 2.0.10 dev_t -> kdev_t + (emoenke) various typos found by others. extra + module-load oops protection. + + 0.99.1.1 Initialization constant cdrom_dops.speed + changed from float (2.0) to int (2); Cli()-sti() pair + around cm260_reset() in module initialization code. + + 0.99.1.2 Changes literally as proposed by Scott Snyder + , which have to do mainly with + the poor minor support i had. The major new concept is + to change a cdrom driver's operations struct from the + capabilities struct. This reflects the fact that there + is one major for a driver, whilst there can be many + minors whith completely different capabilities. + + 0.99.1.3 More changes for operations/info separation. + + 0.99.1.4 Added speed selection (someone had to do this + first). * * Parts of the code are based upon lmscd.c written by Kai Petzke, * sbpcd.c written by Eberhard Moenkeberg, and mcd.c by Martin @@ -98,7 +124,7 @@ History: * - Philips/LMS cm260 product specification * * David van Leeuwen, david@tm.tno.nl. */ -#define VERSION "$Id: cm206.c,v 0.99.1.1 1996/08/11 10:35:01 david Exp $" +#define VERSION "$Id: cm206.c,v 0.99.1.4 1996/12/23 21:46:13 david Exp $" #include @@ -135,6 +161,8 @@ static int auto_probe=1; /* Yes, why not? */ static int cm206_base = CM206_BASE; static int cm206_irq = CM206_IRQ; +MODULE_PARM(cm206_base, "i"); +MODULE_PARM(cm206_irq, "i"); #define POLLOOP 10000 #define READ_AHEAD 1 /* defines private buffer, waste! */ @@ -580,7 +608,7 @@ void get_disc_status(void) /* The new open. The real opening strategy is defined in cdrom.c. */ -static int cm206_open(struct cdrom_device_info *i, int purpose) +static int cm206_open(struct cdrom_device_info * cdi, int purpose) { if (!cd->openfiles) { /* reset only first time */ cd->background=0; @@ -593,7 +621,7 @@ static int cm206_open(struct cdrom_device_info *i, int purpose) return 0; } -static void cm206_release(struct cdrom_device_info *i) +static void cm206_release(struct cdrom_device_info * cdi) { if (cd->openfiles==1) { if (cd->background) { @@ -885,7 +913,8 @@ void get_toc_entry(struct cdrom_tocentry * ep) * upon success. Memory checking has been done by cdrom_ioctl(), the * calling function, as well as LBA/MSF sanitization. */ -int cm206_audio_ioctl(struct cdrom_device_info *i, unsigned int cmd, void * arg) +int cm206_audio_ioctl(struct cdrom_device_info * cdi, unsigned int cmd, + void * arg) { switch (cmd) { case CDROMREADTOCHDR: @@ -930,7 +959,8 @@ int cm206_audio_ioctl(struct cdrom_device_info *i, unsigned int cmd, void * arg) some driver statistics accessible through ioctl calls. */ -static int cm206_ioctl(struct cdrom_device_info *i, unsigned int cmd, unsigned long arg) +static int cm206_ioctl(struct cdrom_device_info * cdi, unsigned int cmd, + unsigned long arg) { switch (cmd) { #ifdef STATISTICS @@ -947,7 +977,7 @@ static int cm206_ioctl(struct cdrom_device_info *i, unsigned int cmd, unsigned l } } -int cm206_media_changed(struct cdrom_device_info *i, int n) +int cm206_media_changed(struct cdrom_device_info * cdi, int disc_nr) { if (cd != NULL) { int r; @@ -963,14 +993,14 @@ int cm206_media_changed(struct cdrom_device_info *i, int n) the logic should be in cdrom.c */ /* returns number of times device is in use */ -int cm206_open_files(struct cdrom_device_info *i) +int cm206_open_files(struct cdrom_device_info * cdi) { if (cd) return cd->openfiles; return -1; } /* controls tray movement */ -int cm206_tray_move(struct cdrom_device_info *i, int position) +int cm206_tray_move(struct cdrom_device_info * cdi, int position) { if (position) { /* 1: eject */ type_0_command(c_open_tray,1); @@ -981,7 +1011,7 @@ int cm206_tray_move(struct cdrom_device_info *i, int position) } /* gives current state of the drive */ -int cm206_drive_status(struct cdrom_device_info *i, int n) +int cm206_drive_status(struct cdrom_device_info * cdi, int slot_nr) { get_drive_status(); if (cd->dsb & dsb_tray_not_closed) return CDS_TRAY_OPEN; @@ -991,7 +1021,7 @@ int cm206_drive_status(struct cdrom_device_info *i, int n) } /* gives current state of disc in drive */ -int cm206_disc_status(struct cdrom_device_info *i) +int cm206_disc_status(struct cdrom_device_info * cdi) { uch xa; get_drive_status(); @@ -1009,7 +1039,7 @@ int cm206_disc_status(struct cdrom_device_info *i) } /* locks or unlocks door lock==1: lock; return 0 upon success */ -int cm206_lock_door(struct cdrom_device_info *i, int lock) +int cm206_lock_door(struct cdrom_device_info * cdi, int lock) { uch command = (lock) ? c_lock_tray : c_unlock_tray; type_0_command(command, 1); /* wait and get dsb */ @@ -1020,7 +1050,8 @@ int cm206_lock_door(struct cdrom_device_info *i, int lock) /* Although a session start should be in LBA format, we return it in MSF format because it is slightly easier, and the new generic ioctl will take care of the necessary conversion. */ -int cm206_get_last_session(struct cdrom_device_info *i, struct cdrom_multisession * mssp) +int cm206_get_last_session(struct cdrom_device_info * cdi, + struct cdrom_multisession * mssp) { if (!FIRST_TRACK) get_disc_status(); if (mssp != NULL) { @@ -1038,7 +1069,7 @@ int cm206_get_last_session(struct cdrom_device_info *i, struct cdrom_multisessio return 0; } -int cm206_get_upc(struct cdrom_device_info *info, struct cdrom_mcn * mcn) +int cm206_get_upc(struct cdrom_device_info * cdi, struct cdrom_mcn * mcn) { uch upc[10]; char * ret = mcn->medium_catalog_number; @@ -1054,7 +1085,7 @@ int cm206_get_upc(struct cdrom_device_info *info, struct cdrom_mcn * mcn) return 0; } -int cm206_reset(struct cdrom_device_info *i) +int cm206_reset(struct cdrom_device_info * cdi) { stop_read(); reset_cm260(); @@ -1067,6 +1098,26 @@ int cm206_reset(struct cdrom_device_info *i) return 0; } +int cm206_select_speed(struct cdrom_device_info * cdi, int speed) +{ + int r; + switch (speed) { + case 0: + r = type_0_command(c_auto_mode, 1); + break; + case 1: + r = type_0_command(c_force_1x, 1); + break; + case 2: + r = type_0_command(c_force_2x, 1); + break; + default: + return -1; + } + if (r<0) return r; + else return 1; +} + static struct cdrom_device_ops cm206_dops = { cm206_open, /* open */ cm206_release, /* release */ @@ -1075,7 +1126,7 @@ static struct cdrom_device_ops cm206_dops = { cm206_media_changed, /* media changed */ cm206_tray_move, /* tray move */ cm206_lock_door, /* lock door */ - NULL, /* select speed */ + cm206_select_speed, /* select speed */ NULL, /* select disc */ cm206_get_last_session, /* get last session */ cm206_get_upc, /* get universal product code */ @@ -1087,22 +1138,22 @@ static struct cdrom_device_ops cm206_dops = { 1, /* number of minor devices */ }; -static struct cdrom_device_info cm206_info= { - &cm206_dops, - NULL, - NULL, - CM206_CDROM_MAJOR, - CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION | - CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO, /* capability */ - 2, /* maximum speed */ - 1, /* number of discs */ - 0, /* options, ignored */ - 0, /* mc_flags, ignored */ - 0 + +static struct cdrom_device_info cm206_info = { + &cm206_dops, /* device operations */ + NULL, /* link */ + NULL, /* handle (not used by cm206) */ + MKDEV(MAJOR_NR,0), /* dev */ + 0, /* mask */ + 2, /* maximum speed */ + 1, /* number of discs */ + 0, /* options, not owned */ + 0, /* mc_flags, not owned */ + 0 /* use count, not owned */ }; - -/* This routine gets called during init if thing go wrong, can be used - * in cleanup_module as well. */ + +/* This routine gets called during initialization if thing go wrong, + * can be used in cleanup_module as well. */ void cleanup(int level) { switch (level) { @@ -1229,7 +1280,7 @@ int cm206_init(void) cleanup(3); return -EIO; } - if (register_cdrom(&cm206_info,"cm206") != 0) { + if (register_cdrom(&cm206_info, "cm206") != 0) { printk("Cannot register for cdrom %d!\n", MAJOR_NR); cleanup(3); return -EIO; @@ -1304,6 +1355,6 @@ void cm206_setup(char *s, int *p) #endif /* MODULE */ /* * Local variables: - * compile-command: "gcc -DMODULE -D__KERNEL__ -I/usr/src/linux/include/linux -Wall -Wstrict-prototypes -O2 -m486 -c cm206.c -o cm206.o" + * compile-command: "gcc -DMODULE -D__KERNEL__ -I. -I/usr/src/linux/include/linux -Wall -Wstrict-prototypes -O2 -m486 -c cm206.c -o cm206.o" * End: */ diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c index 7495443719f1..d1f5b894f164 100644 --- a/drivers/cdrom/gscd.c +++ b/drivers/cdrom/gscd.c @@ -71,6 +71,7 @@ static int gscdPresent = 0; static unsigned char gscd_buf[2048]; /* buffer for block size conversion */ static int gscd_bn = -1; static short gscd_port = GSCD_BASE_ADDR; +MODULE_PARM(gscd, "h"); /* Kommt spaeter vielleicht noch mal dran ... * static struct wait_queue *gscd_waitq = NULL; diff --git a/drivers/cdrom/isp16.c b/drivers/cdrom/isp16.c index 2637cdb363a0..d19793605883 100644 --- a/drivers/cdrom/isp16.c +++ b/drivers/cdrom/isp16.c @@ -62,6 +62,11 @@ static int isp16_cdrom_base = ISP16_CDROM_IO_BASE; static int isp16_cdrom_irq = ISP16_CDROM_IRQ; static int isp16_cdrom_dma = ISP16_CDROM_DMA; static char *isp16_cdrom_type = ISP16_CDROM_TYPE; +MODULE_PARM(isp16_cdrom_base, "i"); +MODULE_PARM(isp16_cdrom_irq, "i"); +MODULE_PARM(isp16_cdrom_dma, "i"); +MODULE_PARM(isp16_cdrom_type, "s"); + #ifdef MODULE int init_module(void); void cleanup_module(void); diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c index 227e951eb238..01784d4b7e23 100644 --- a/drivers/cdrom/mcdx.c +++ b/drivers/cdrom/mcdx.c @@ -3,15 +3,15 @@ * Copyright (C) 1995 1996 Heiko Schlittermann * VERSION: 2.14(hs) * - * ... anyway, I'm back again, thanks to Marcin, he adopted + * ... anyway, I'm back again, thanks to Marcin, he adopted * large portions of my code (at least the parts containing * my main thoughts ...) * ****************** H E L P ********************************* * If you ever plan to update your CD ROM drive and perhaps - * want to sell or simply give away your Mitsumi FX-001[DS] + * want to sell or simply give away your Mitsumi FX-001[DS] * -- Please -- - * mail me (heiko@lotte.sax.de). When my last drive goes + * mail me (heiko@lotte.sax.de). When my last drive goes * ballistic no more driver support will be available from me! ************************************************************* * @@ -19,12 +19,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. @@ -43,7 +43,7 @@ * Heiko Eissfeldt (VERIFY_READ/WRITE) * Marcin Dalecki (improved performance, shortened code) * ... somebody forgotten? - * + * */ @@ -70,11 +70,11 @@ static const char *mcdx_c_version #define MAJOR_NR MITSUMI_X_CDROM_MAJOR #include -/* for compatible parameter passing with "insmod" */ -#define mcdx_drive_map mcdx +/* for compatible parameter passing with "insmod" */ +#define mcdx_drive_map mcdx #include -#ifndef HZ +#ifndef HZ #error HZ not defined #endif @@ -121,7 +121,7 @@ const unsigned char READ1X = 0xc0; const unsigned char READ2X = 0xc1; -/* DECLARATIONS ****************************************************/ +/* DECLARATIONS ****************************************************/ struct s_subqcode { unsigned char control; unsigned char tno; @@ -136,7 +136,7 @@ struct s_diskinfo { struct cdrom_msf0 msf_leadout; struct cdrom_msf0 msf_first; }; - + struct s_multi { unsigned char multi; struct cdrom_msf0 msf_last; @@ -161,7 +161,7 @@ struct s_drive_stuff { volatile int lock; /* exclusive usage */ int eject_sw; /* 1 - eject on last close (default 0) */ int autoclose; /* 1 - close the door on open (default 1) */ - + /* cd infos */ struct s_diskinfo di; struct s_multi multi; @@ -170,7 +170,7 @@ struct s_drive_stuff { struct s_subqcode stop; int xa; /* 1 if xa disk */ int audio; /* 1 if audio disk */ - int audiostatus; + int audiostatus; /* `buffer' control */ volatile int valid; /* pending, ..., values are valid */ @@ -204,7 +204,7 @@ struct s_drive_stuff { }; -/* Prototypes ******************************************************/ +/* Prototypes ******************************************************/ /* The following prototypes are already declared elsewhere. They are repeated here to show what's going on. And to sense, if they're @@ -219,7 +219,7 @@ int check_mcdx_media_change(kdev_t); void mcdx_setup(char *, int *); /* Indirect exported functions. These functions are exported by their - addresses, such as mcdx_open and mcdx_close in the + addresses, such as mcdx_open and mcdx_close in the structure fops. */ /* ??? exported by the mcdx_sigaction struct */ @@ -256,9 +256,9 @@ static int mcdx_requestmultidiskinfo(struct s_drive_stuff*, struct s_multi*, int static int mcdx_requesttocdata(struct s_drive_stuff*, struct s_diskinfo*, int); static int mcdx_getstatus(struct s_drive_stuff*, int); static int mcdx_getval(struct s_drive_stuff*, int to, int delay, char*); -static int mcdx_talk(struct s_drive_stuff*, - const unsigned char* cmd, size_t, - void *buffer, size_t size, +static int mcdx_talk(struct s_drive_stuff*, + const unsigned char* cmd, size_t, + void *buffer, size_t size, unsigned int timeout, int); static int mcdx_readtoc(struct s_drive_stuff*); static int mcdx_playtrk(struct s_drive_stuff*, const struct cdrom_ti*); @@ -273,6 +273,7 @@ static struct s_drive_stuff* mcdx_stuffp[MCDX_NDRIVES]; static struct s_drive_stuff* mcdx_irq_map[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +MODULE_PARM(mcdx, "1-4i"); static struct file_operations mcdx_fops = { NULL, /* lseek - use kernel default */ @@ -290,13 +291,13 @@ static struct file_operations mcdx_fops = { NULL /* revalidate */ }; -/* KERNEL INTERFACE FUNCTIONS **************************************/ +/* KERNEL INTERFACE FUNCTIONS **************************************/ -static int +static int mcdx_ioctl( - struct inode* ip, struct file* fp, + struct inode* ip, struct file* fp, unsigned int cmd, unsigned long arg) -{ +{ struct s_drive_stuff *stuffp = mcdx_stuffp[MINOR(ip->i_rdev)]; if (!stuffp->present) return -ENXIO; @@ -344,7 +345,7 @@ mcdx_ioctl( && (-1 == mcdx_hold(stuffp, 1))) return -EIO; if ((ans = verify_area( - VERIFY_READ, (void*) arg, sizeof(struct cdrom_msf)))) + VERIFY_READ, (void*) arg, sizeof(struct cdrom_msf)))) return ans; copy_from_user(&msf, (void*) arg, sizeof msf); @@ -377,13 +378,13 @@ mcdx_ioctl( if ((ans = verify_area(VERIFY_WRITE, (void *) arg, sizeof(entry)))) return ans; copy_from_user(&entry, (void *) arg, sizeof(entry)); - if (entry.cdte_track == CDROM_LEADOUT) + if (entry.cdte_track == CDROM_LEADOUT) tp = &stuffp->toc[stuffp->di.n_last - stuffp->di.n_first + 1]; - else if (entry.cdte_track > stuffp->di.n_last + else if (entry.cdte_track > stuffp->di.n_last || entry.cdte_track < stuffp->di.n_first) return -EINVAL; else tp = &stuffp->toc[entry.cdte_track - stuffp->di.n_first]; - if (NULL == tp) xwarn("FATAL.\n"); + if (NULL == tp) xwarn("FATAL.\n"); entry.cdte_adr = tp->control; entry.cdte_ctrl = tp->control >> 4; @@ -422,7 +423,7 @@ mcdx_ioctl( sub.cdsc_trk = bcd2uint(q.tno); sub.cdsc_ind = bcd2uint(q.index); - xtrace(SUBCHNL, "trk %d, ind %d\n", + xtrace(SUBCHNL, "trk %d, ind %d\n", sub.cdsc_trk, sub.cdsc_ind); if (sub.cdsc_format == CDROM_LBA) { @@ -482,10 +483,10 @@ mcdx_ioctl( int ans; struct cdrom_multisession ms; xtrace(IOCTL, "ioctl() MULTISESSION\n"); - if (0 != (ans = verify_area(VERIFY_WRITE, (void*) arg, + if (0 != (ans = verify_area(VERIFY_WRITE, (void*) arg, sizeof(struct cdrom_multisession)))) return ans; - + copy_from_user(&ms, (void*) arg, sizeof(struct cdrom_multisession)); if (ms.addr_format == CDROM_MSF) { ms.addr.msf.minute = bcd2uint(stuffp->multi.msf_last.minute); @@ -499,9 +500,9 @@ mcdx_ioctl( copy_to_user((void*) arg, &ms, sizeof(struct cdrom_multisession)); if (ms.addr_format == CDROM_MSF) { - xtrace(MS, + xtrace(MS, "ioctl() (%d, %02x:%02x.%02x [%02x:%02x.%02x])\n", - ms.xa_flag, + ms.xa_flag, ms.addr.msf.minute, ms.addr.msf.second, ms.addr.msf.frame, @@ -509,7 +510,7 @@ mcdx_ioctl( stuffp->multi.msf_last.second, stuffp->multi.msf_last.frame); } else { - xtrace(MS, + xtrace(MS, "ioctl() (%d, 0x%08x [%02x:%02x.%02x])\n", ms.xa_flag, ms.addr.lba, @@ -538,7 +539,7 @@ mcdx_ioctl( xtrace(IOCTL, "ioctl() VOLCTRL\n"); if ((ans = verify_area( - VERIFY_READ, + VERIFY_READ, (void*) arg, sizeof(volctrl)))) return ans; @@ -581,11 +582,11 @@ void do_mcdx_request() dev = MINOR(CURRENT->rq_dev); stuffp = mcdx_stuffp[dev]; - if ((dev < 0) - || (dev >= MCDX_NDRIVES) - || !stuffp + if ((dev < 0) + || (dev >= MCDX_NDRIVES) + || !stuffp || (!stuffp->present)) { - xwarn("do_request(): bad device: %s\n", + xwarn("do_request(): bad device: %s\n", kdevname(CURRENT->rq_dev)); xtrace(REQUEST, "end_request(0): bad device\n"); end_request(0); return; @@ -639,12 +640,12 @@ void do_mcdx_request() goto again; } -static int +static int mcdx_open(struct inode *ip, struct file *fp) /* actions done on open: - * 1) get the drives status + * 1) get the drives status * 2) set the stuffp.readcmd if a CD is in. - * (return no error if no CD is found, since ioctl() + * (return no error if no CD is found, since ioctl() * needs an opened device */ { struct s_drive_stuff *stuffp; @@ -680,7 +681,7 @@ mcdx_open(struct inode *ip, struct file *fp) /* close the door, * This should be explained ... - * - If the door is open and its last close is too recent the + * - If the door is open and its last close is too recent the * autoclose wouldn't probably be what we want. * - If we didn't try to close the door yet, close it and go on. * - If we autoclosed the door and couldn't succeed in find a valid @@ -703,7 +704,7 @@ mcdx_open(struct inode *ip, struct file *fp) if (stuffp->xxx) { xtrace(OPENCLOSE, "open() media changed\n"); - /* but wait - the time of media change will be set at the + /* but wait - the time of media change will be set at the * very last of this block - it seems, some of the following * talk() will detect a media change ... (I think, config() * is the reason. */ @@ -726,10 +727,10 @@ mcdx_open(struct inode *ip, struct file *fp) /* we succeeded, so on next open(2) we could try auto close * again */ stuffp->autoclose = 1; - + #if !MCDX_QUIET if (stuffp->multi.multi > 2) - xinfo("open() unknown multisession value (%d)\n", + xinfo("open() unknown multisession value (%d)\n", stuffp->multi.multi); #endif @@ -752,7 +753,7 @@ mcdx_open(struct inode *ip, struct file *fp) } else { - stuffp->lastsector = (CD_FRAMESIZE / 512) + stuffp->lastsector = (CD_FRAMESIZE / 512) * msf2log(&stuffp->di.msf_leadout) - 1; xtrace(OPENCLOSE, "open() start %d (%02x:%02x.%02x) %d\n", @@ -772,7 +773,7 @@ mcdx_open(struct inode *ip, struct file *fp) if (stuffp->toc) { xtrace(MALLOC, "open() free old toc @ %p\n", stuffp->toc); kfree(stuffp->toc); - + stuffp->toc = NULL; } @@ -786,7 +787,7 @@ mcdx_open(struct inode *ip, struct file *fp) /* Set the read speed */ xwarn("AAA %x AAA\n", stuffp->readcmd); if (stuffp->readerrs) stuffp->readcmd = READ1X; - else stuffp->readcmd = + else stuffp->readcmd = stuffp->present | SINGLE ? READ1X : READ2X; xwarn("XXX %x XXX\n", stuffp->readcmd); #else @@ -810,26 +811,26 @@ mcdx_open(struct inode *ip, struct file *fp) stuffp->xa ? "XA" : "normal"); /* set data mode */ - if (-1 == (ans = mcdx_setdatamode(stuffp, + if (-1 == (ans = mcdx_setdatamode(stuffp, stuffp->xa ? MODE2 : MODE1, 1))) { /* MOD_DEC_USE_COUNT, return -EIO; */ stuffp->xa = 0; break; } - if ((stuffp->audio = e_audio(ans))) break; + if ((stuffp->audio = e_audio(ans))) break; - while (0 == (ans = mcdx_transfer(stuffp, buf, 0, 1))) + while (0 == (ans = mcdx_transfer(stuffp, buf, 0, 1))) ; if (ans == 1) break; - stuffp->xa = !stuffp->xa; + stuffp->xa = !stuffp->xa; } /* if (!tries) MOD_DEC_USE_COUNT, return -EIO; */ } /* xa disks will be read in raw mode, others not */ - if (-1 == mcdx_setdrivemode(stuffp, + if (-1 == mcdx_setdrivemode(stuffp, stuffp->xa ? RAW : COOKED, 1)) { MOD_DEC_USE_COUNT; return -EIO; @@ -841,7 +842,7 @@ mcdx_open(struct inode *ip, struct file *fp) xinfo("open() %s%s disk found\n", stuffp->xa ? "XA / " : "", stuffp->multi.multi ? "Multi Session" : "Single Session"); - } + } /* stuffp->xxx = 0; */ } @@ -851,7 +852,7 @@ mcdx_open(struct inode *ip, struct file *fp) MOD_DEC_USE_COUNT; return -EIO; } - } + } stuffp->xxx = 0; stuffp->users++; @@ -859,7 +860,7 @@ mcdx_open(struct inode *ip, struct file *fp) } -static void +static void mcdx_close(struct inode *ip, struct file *fp) { struct s_drive_stuff *stuffp; @@ -895,7 +896,7 @@ int check_mcdx_media_change(kdev_t full_dev) /* Return: 1 if media changed since last call to this function 0 otherwise */ { - struct s_drive_stuff *stuffp; + struct s_drive_stuff *stuffp; xinfo("check_mcdx_media_change called for device %s\n", kdevname(full_dev)); @@ -915,7 +916,7 @@ void mcdx_setup(char *str, int *pi) if (pi[0] > 1) mcdx_drive_map[0][1] = pi[2]; } -/* DIRTY PART ******************************************************/ +/* DIRTY PART ******************************************************/ static void mcdx_delay(struct s_drive_stuff *stuff, long jifs) /* This routine is used for sleeping. @@ -923,7 +924,7 @@ static void mcdx_delay(struct s_drive_stuff *stuff, long jifs) * =0 means minimal sleeping (let the kernel * run for other processes) * >0 means at least sleep for that amount. - * May be we could use a simple count loop w/ jumps to itself, but + * May be we could use a simple count loop w/ jumps to itself, but * I wanna make this independent of cpu speed. [1 jiffy is 1/HZ] sec */ { unsigned long tout = jiffies + jifs; @@ -931,12 +932,12 @@ static void mcdx_delay(struct s_drive_stuff *stuff, long jifs) /* If loaded during kernel boot no *_sleep_on is * allowed! */ - if (current->pid == 0) { + if (current->pid == 0) { while (jiffies < tout) { current->timeout = jiffies; schedule(); } - } else { + } else { current->timeout = tout; xtrace(SLEEP, "*** delay: sleepq\n"); interruptible_sleep_on(&stuff->sleepq); @@ -944,10 +945,10 @@ static void mcdx_delay(struct s_drive_stuff *stuff, long jifs) if (current->signal & ~current->blocked) { xtrace(SLEEP, "got signal\n"); } - } + } } -static void +static void mcdx_intr(int irq, void *dev_id, struct pt_regs* regs) { struct s_drive_stuff *stuffp; @@ -969,7 +970,7 @@ mcdx_intr(int irq, void *dev_id, struct pt_regs* regs) b = inb((unsigned int) stuffp->rreg_status); stuffp->introk = ~b & MCDX_RBIT_DTEN; - /* NOTE: We only should get interrupts if the data we + /* NOTE: We only should get interrupts if the data we * requested are ready to transfer. * But the drive seems to generate ``asynchronous'' interrupts * on several error conditions too. (Despite the err int enable @@ -979,7 +980,7 @@ mcdx_intr(int irq, void *dev_id, struct pt_regs* regs) if (!stuffp->introk) { xtrace(IRQ, "intr() irq %d hw status 0x%02x\n", irq, b); if (~b & MCDX_RBIT_STEN) { - xinfo( "intr() irq %d status 0x%02x\n", + xinfo( "intr() irq %d status 0x%02x\n", irq, inb((unsigned int) stuffp->rreg_data)); } else { xinfo( "intr() irq %d ambiguous hw status\n", irq); @@ -993,11 +994,11 @@ mcdx_intr(int irq, void *dev_id, struct pt_regs* regs) } -static int +static int mcdx_talk ( - struct s_drive_stuff *stuffp, + struct s_drive_stuff *stuffp, const unsigned char *cmd, size_t cmdlen, - void *buffer, size_t size, + void *buffer, size_t size, unsigned int timeout, int tries) /* Send a command to the drive, wait for the result. * returns -1 on timeout, drive status otherwise @@ -1015,7 +1016,7 @@ mcdx_talk ( while (stuffp->lock) { xtrace(SLEEP, "*** talk: lockq\n"); - interruptible_sleep_on(&stuffp->lockq); + interruptible_sleep_on(&stuffp->lockq); xtrace(SLEEP, "talk: awoken\n"); } @@ -1023,12 +1024,12 @@ mcdx_talk ( /* An operation other then reading data destroys the * data already requested and remembered in stuffp->request, ... */ - stuffp->valid = 0; + stuffp->valid = 0; #if MCDX_DEBUG & TALK - { + { unsigned char i; - xtrace(TALK, "talk() %d / %d tries, res.size %d, command 0x%02x", + xtrace(TALK, "talk() %d / %d tries, res.size %d, command 0x%02x", tries, timeout, size, (unsigned char) cmd[0]); for (i = 1; i < cmdlen; i++) xtrace(TALK, " 0x%02x", cmd[i]); xtrace(TALK, "\n"); @@ -1047,9 +1048,9 @@ mcdx_talk ( /* get the status byte */ if (-1 == mcdx_getval(stuffp, timeout, 0, bp)) { - xinfo("talk() %02x timed out (status), %d tr%s left\n", + xinfo("talk() %02x timed out (status), %d tr%s left\n", cmd[0], tries - 1, tries == 2 ? "y" : "ies"); - continue; + continue; } st = *bp; sz--; @@ -1059,7 +1060,7 @@ mcdx_talk ( /* command error? */ if (e_cmderr(st)) { - xwarn("command error cmd = %02x %s \n", + xwarn("command error cmd = %02x %s \n", cmd[0], cmdlen > 1 ? "..." : ""); st = -1; continue; @@ -1067,9 +1068,9 @@ mcdx_talk ( /* audio status? */ if (stuffp->audiostatus == CDROM_AUDIO_INVALID) - stuffp->audiostatus = + stuffp->audiostatus = e_audiobusy(st) ? CDROM_AUDIO_PLAY : CDROM_AUDIO_NO_STATUS; - else if (stuffp->audiostatus == CDROM_AUDIO_PLAY + else if (stuffp->audiostatus == CDROM_AUDIO_PLAY && e_audiobusy(st) == 0) stuffp->audiostatus = CDROM_AUDIO_COMPLETED; @@ -1082,7 +1083,7 @@ mcdx_talk ( /* now actually get the data */ while (sz--) { if (-1 == mcdx_getval(stuffp, timeout, 0, bp)) { - xinfo("talk() %02x timed out (data), %d tr%s left\n", + xinfo("talk() %02x timed out (data), %d tr%s left\n", cmd[0], tries - 1, tries == 2 ? "y" : "ies"); st = -1; break; } @@ -1104,6 +1105,7 @@ mcdx_talk ( /* MODULE STUFF ***********************************************************/ #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { @@ -1119,10 +1121,9 @@ int init_module(void) } } - if (!drives) + if (!drives) return -EIO; - register_symtab(0); return 0; } @@ -1131,7 +1132,7 @@ void cleanup_module(void) int i; xinfo("cleanup_module called\n"); - + for (i = 0; i < MCDX_NDRIVES; i++) { struct s_drive_stuff *stuffp; stuffp = mcdx_stuffp[i]; @@ -1149,7 +1150,7 @@ void cleanup_module(void) if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0) { xwarn("cleanup() unregister_blkdev() failed\n"); - } + } #if !MCDX_QUIET else xinfo("cleanup() succeeded\n"); #endif @@ -1164,7 +1165,7 @@ int mcdx_init(void) int drive; #ifdef MODULE - xwarn("Version 2.14(hs) for %s\n", kernel_version); + xwarn("Version 2.14(hs) for " UTS_RELEASE "\n"); #else xwarn("Version 2.14(hs) \n"); #endif @@ -1176,7 +1177,7 @@ int mcdx_init(void) mcdx_stuffp[drive] = NULL; /* do the initialisation */ - for (drive = 0; drive < MCDX_NDRIVES; drive++) { + for (drive = 0; drive < MCDX_NDRIVES; drive++) { struct s_version version; struct s_drive_stuff* stuffp; int size; @@ -1184,14 +1185,14 @@ int mcdx_init(void) mcdx_blocksizes[drive] = 0; size = sizeof(*stuffp); - + xtrace(INIT, "init() try drive %d\n", drive); xtrace(INIT, "kmalloc space for stuffpt's\n"); xtrace(MALLOC, "init() malloc %d bytes\n", size); if (!(stuffp = kmalloc(size, GFP_KERNEL))) { xwarn("init() malloc failed\n"); - break; + break; } xtrace(INIT, "init() got %d bytes for drive stuff @ %p\n", sizeof(*stuffp), stuffp); @@ -1215,7 +1216,7 @@ int mcdx_init(void) xwarn("0x%3p,%d: " "Init failed. I/O ports (0x%3p..0x%3p) already in use.\n", stuffp->wreg_data, stuffp->irq, - stuffp->wreg_data, + stuffp->wreg_data, stuffp->wreg_data + MCDX_IO_SIZE - 1); xtrace(MALLOC, "init() free stuffp @ %p\n", stuffp); kfree(stuffp); @@ -1241,19 +1242,19 @@ int mcdx_init(void) } switch (version.code) { - case 'D': - stuffp->readcmd = READ2X; - stuffp->present = DOUBLE | DOOR | MULTI; + case 'D': + stuffp->readcmd = READ2X; + stuffp->present = DOUBLE | DOOR | MULTI; break; - case 'F': - stuffp->readcmd = READ1X; + case 'F': + stuffp->readcmd = READ1X; stuffp->present = SINGLE | DOOR | MULTI; break; - case 'M': + case 'M': stuffp->readcmd = READ1X; stuffp->present = SINGLE; break; - default: + default: stuffp->present = 0; break; } @@ -1291,9 +1292,9 @@ int mcdx_init(void) kfree(stuffp); continue; } - request_region((unsigned int) stuffp->wreg_data, - MCDX_IO_SIZE, - DEVICE_NAME); + request_region((unsigned int) stuffp->wreg_data, + MCDX_IO_SIZE, + DEVICE_NAME); xtrace(INIT, "init() get garbage\n"); { @@ -1324,12 +1325,12 @@ int mcdx_init(void) return 0; } -static int +static int mcdx_transfer(struct s_drive_stuff *stuffp, char *p, int sector, int nr_sectors) /* This seems to do the actually transfer. But it does more. It keeps track of errors occurred and will (if possible) fall back - to single speed on error. + to single speed on error. Return: -1 on timeout or other error else status byte (as in stuff->st) */ { @@ -1351,7 +1352,7 @@ mcdx_transfer(struct s_drive_stuff *stuffp, stuffp->readcmd = READ1X; return mcdx_transfer(stuffp, p, sector, nr_sectors); #endif - + } @@ -1363,7 +1364,7 @@ static int mcdx_xfer(struct s_drive_stuff *stuffp, { int border; int done = 0; - + if (stuffp->audio) { xwarn("Attempt to read from audio CD.\n"); return -1; @@ -1403,9 +1404,9 @@ static int mcdx_xfer(struct s_drive_stuff *stuffp, interruptible_sleep_on(&stuffp->busyq); if (!stuffp->introk) { xtrace(XFER, "error via interrupt\n"); } - else if (current->timeout == 0) { xtrace(XFER, "timeout\n"); } + else if (current->timeout == 0) { xtrace(XFER, "timeout\n"); } else if (current->signal & ~current->blocked) { - xtrace(XFER, "signal\n"); + xtrace(XFER, "signal\n"); } else continue; stuffp->lock = 0; @@ -1428,8 +1429,8 @@ static int mcdx_xfer(struct s_drive_stuff *stuffp, insb((unsigned int) stuffp->rreg_data, p, HEAD); } - /* now actually read the data */ - insb((unsigned int) stuffp->rreg_data, p, 512); + /* now actually read the data */ + insb((unsigned int) stuffp->rreg_data, p, 512); /* test if it's the last sector of a block, * if so, we have to handle XA special */ @@ -1450,7 +1451,7 @@ static int mcdx_xfer(struct s_drive_stuff *stuffp, } else { - /* The requested sector(s) is/are out of the + /* The requested sector(s) is/are out of the * already requested range, so we have to bother the drive * with a new request. */ @@ -1546,7 +1547,7 @@ static unsigned int msf2log(const struct cdrom_msf0* pmsf) + bcd2uint(pmsf->minute) * 4500 - CD_BLOCK_OFFSET; } - + int mcdx_readtoc(struct s_drive_stuff* stuffp) /* Read the toc entries from the CD, * Return: -1 on failure, else 0 */ @@ -1584,15 +1585,15 @@ int mcdx_readtoc(struct s_drive_stuff* stuffp) int trk; int retries; - for (trk = 0; - trk < (stuffp->di.n_last - stuffp->di.n_first + 1); + for (trk = 0; + trk < (stuffp->di.n_last - stuffp->di.n_first + 1); trk++) stuffp->toc[trk].index = 0; for (retries = 300; retries; retries--) { /* why 300? */ struct s_subqcode q; unsigned int idx; - + if (-1 == mcdx_requestsubqcode(stuffp, &q, 1)) { mcdx_setdrivemode(stuffp, DATA, 1); return -EIO; @@ -1600,8 +1601,8 @@ int mcdx_readtoc(struct s_drive_stuff* stuffp) idx = bcd2uint(q.index); - if ((idx > 0) - && (idx <= stuffp->di.n_last) + if ((idx > 0) + && (idx <= stuffp->di.n_last) && (q.tno == 0) && (stuffp->toc[idx - stuffp->di.n_first].index == 0)) { stuffp->toc[idx - stuffp->di.n_first] = q; @@ -1610,7 +1611,7 @@ int mcdx_readtoc(struct s_drive_stuff* stuffp) } if (trk == 0) break; } - memset(&stuffp->toc[stuffp->di.n_last - stuffp->di.n_first + 1], + memset(&stuffp->toc[stuffp->di.n_last - stuffp->di.n_first + 1], 0, sizeof(stuffp->toc[0])); stuffp->toc[stuffp->di.n_last - stuffp->di.n_first + 1].dt = stuffp->di.msf_leadout; @@ -1623,8 +1624,8 @@ int mcdx_readtoc(struct s_drive_stuff* stuffp) #if MCDX_DEBUG && READTOC { int trk; - for (trk = 0; - trk < (stuffp->di.n_last - stuffp->di.n_first + 2); + for (trk = 0; + trk < (stuffp->di.n_last - stuffp->di.n_first + 2); trk++) xtrace(READTOC, "ioctl() %d readtoc %02x %02x %02x" " %02x:%02x.%02x %02x:%02x.%02x\n", @@ -1651,7 +1652,7 @@ mcdx_playmsf(struct s_drive_stuff* stuffp, const struct cdrom_msf* msf) } cmd[0] = stuffp->playcmd; - + cmd[1] = msf->cdmsf_min0; cmd[2] = msf->cdmsf_sec0; cmd[3] = msf->cdmsf_frame0; @@ -1662,12 +1663,12 @@ mcdx_playmsf(struct s_drive_stuff* stuffp, const struct cdrom_msf* msf) xtrace(PLAYMSF, "ioctl(): play %x " "%02x:%02x:%02x -- %02x:%02x:%02x\n", cmd[0], cmd[1], cmd[2], cmd[3], - cmd[4], cmd[5], cmd[6]); + cmd[4], cmd[5], cmd[6]); outsb((unsigned int) stuffp->wreg_data, cmd, sizeof cmd); if (-1 == mcdx_getval(stuffp, 3 * HZ, 0, NULL)) { - xwarn("playmsf() timeout\n"); + xwarn("playmsf() timeout\n"); return -1; } @@ -1675,7 +1676,7 @@ mcdx_playmsf(struct s_drive_stuff* stuffp, const struct cdrom_msf* msf) return 0; } -static int +static int mcdx_playtrk(struct s_drive_stuff* stuffp, const struct cdrom_ti* ti) { struct s_subqcode* p; @@ -1705,7 +1706,7 @@ mcdx_playtrk(struct s_drive_stuff* stuffp, const struct cdrom_ti* ti) /* Drive functions ************************************************/ -static int +static int mcdx_closedoor(struct s_drive_stuff *stuffp, int tries) { if (stuffp->present & DOOR) @@ -1714,7 +1715,7 @@ mcdx_closedoor(struct s_drive_stuff *stuffp, int tries) return 0; } -static int +static int mcdx_stop(struct s_drive_stuff *stuffp, int tries) { return mcdx_talk(stuffp, "\xf0", 1, NULL, 1, 2 * HZ, tries); } @@ -1732,8 +1733,8 @@ mcdx_eject(struct s_drive_stuff *stuffp, int tries) } static int -mcdx_requestsubqcode(struct s_drive_stuff *stuffp, - struct s_subqcode *sub, +mcdx_requestsubqcode(struct s_drive_stuff *stuffp, + struct s_subqcode *sub, int tries) { char buf[11]; @@ -1741,7 +1742,7 @@ mcdx_requestsubqcode(struct s_drive_stuff *stuffp, if (-1 == (ans = mcdx_talk( stuffp, "\x20", 1, buf, sizeof(buf), - 2 * HZ, tries))) + 2 * HZ, tries))) return -1; sub->control = buf[1]; sub->tno = buf[2]; @@ -1775,7 +1776,7 @@ mcdx_requestmultidiskinfo(struct s_drive_stuff *stuffp, struct s_multi *multi, i } } -static int +static int mcdx_requesttocdata(struct s_drive_stuff *stuffp, struct s_diskinfo *info, int tries) { char buf[9]; @@ -1860,7 +1861,7 @@ mcdx_requestversion(struct s_drive_stuff *stuffp, struct s_version *ver, int tri char buf[3]; int ans; - if (-1 == (ans = mcdx_talk(stuffp, "\xdc", + if (-1 == (ans = mcdx_talk(stuffp, "\xdc", 1, buf, sizeof(buf), 2 * HZ, tries))) return ans; @@ -1872,7 +1873,7 @@ mcdx_requestversion(struct s_drive_stuff *stuffp, struct s_version *ver, int tri static int mcdx_reset(struct s_drive_stuff *stuffp, enum resetmodes mode, int tries) -{ +{ if (mode == HARD) { outb(0, (unsigned int) stuffp->wreg_chn); /* no dma, no irq -> hardware */ outb(0, (unsigned int) stuffp->wreg_reset); /* hw reset */ @@ -1914,8 +1915,8 @@ mcdx_getval(struct s_drive_stuff *stuffp, int to, int delay, char* buf) static int mcdx_setattentuator( - struct s_drive_stuff* stuffp, - struct cdrom_volctrl* vol, + struct s_drive_stuff* stuffp, + struct cdrom_volctrl* vol, int tries) { char cmd[5]; diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c index 4644ea48186f..4fe117103783 100644 --- a/drivers/cdrom/optcd.c +++ b/drivers/cdrom/optcd.c @@ -106,7 +106,7 @@ static void debug(int debug_this, const char* fmt, ...) #define optcd_port optcd /* Needed for the modutils. */ static short optcd_port = OPTCD_PORTBASE; /* I/O base of drive. */ - +MODULE_PARM(optcd_port, "h"); /* Drive registers, read */ #define DATA_PORT optcd_port /* Read data/status */ #define STATUS_PORT optcd_port+1 /* Indicate data/status availability */ diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index df4341ffacd2..be850e12bad7 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -442,6 +442,7 @@ static int sbpcd[] = #else static int sbpcd[] = {CDROM_PORT, SBPRO}; /* probe with user's setup only */ #endif +MODULE_PARM(sbpcd, "2i"); #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c index 6f44f04154d0..2bc62badb544 100644 --- a/drivers/cdrom/sjcd.c +++ b/drivers/cdrom/sjcd.c @@ -106,6 +106,7 @@ static int sjcd_audio_status; static struct sjcd_play_msf sjcd_playing; static int sjcd_base = SJCD_BASE_ADDR; +MODULE_PARM(sjcd_base, "i"); static struct wait_queue *sjcd_waitq = NULL; diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c index b7e206028227..f5ea541c2318 100644 --- a/drivers/cdrom/sonycd535.c +++ b/drivers/cdrom/sonycd535.c @@ -198,6 +198,7 @@ static int do_sony_cmd(Byte * cmd, int nCmd, Byte status[2], /* The base I/O address of the Sony Interface. This is a variable (not a #define) so it can be easily changed via some future ioctl() */ static unsigned int sony535_cd_base_io = CDU535_ADDRESS; +MODULE_PARM(sony535_cd_base_io, "i"); /* * The following are I/O addresses of the various registers for the drive. The diff --git a/drivers/char/apm_bios.c b/drivers/char/apm_bios.c index c680040af098..96962faecf55 100644 --- a/drivers/char/apm_bios.c +++ b/drivers/char/apm_bios.c @@ -73,12 +73,8 @@ #include #include -static struct symbol_table apm_syms = { -#include - X(apm_register_callback), - X(apm_unregister_callback), -#include -}; +EXPORT_SYMBOL(apm_register_callback); +EXPORT_SYMBOL(apm_unregister_callback); extern unsigned long get_cmos_time(void); @@ -89,7 +85,7 @@ extern unsigned long get_cmos_time(void); #define APM_MINOR_DEV 134 /* Configurable options: - * + * * CONFIG_APM_IGNORE_USER_SUSPEND: define to ignore USER SUSPEND requests. * This is necessary on the NEC Versa M series, which generates these when * resuming from SYSTEM SUSPEND. However, enabling this on other laptops @@ -564,7 +560,7 @@ void apm_unregister_callback(int (*callback)(apm_event_t)) *ptr = old->next; kfree_s(old, sizeof(callback_list_t)); } - + static int queue_empty(struct apm_bios_struct * as) { return as->event_head == as->event_tail; @@ -579,7 +575,7 @@ static apm_event_t get_queued_event(struct apm_bios_struct * as) static int queue_event(apm_event_t event, struct apm_bios_struct *sender) { struct apm_bios_struct * as; - + if (user_list == NULL) return 0; for (as = user_list; as != NULL; as = as->next) { @@ -635,7 +631,7 @@ static void suspend(void) clock_cmos_diff += CURRENT_TIME; got_clock_diff = 1; restore_flags(flags); - + err = apm_set_power_state(APM_STATE_SUSPEND); if (err) apm_error("suspend", err); @@ -673,7 +669,7 @@ static void send_event(apm_event_t event, apm_event_t undo, { callback_list_t * call; callback_list_t * fix; - + for (call = callback_list; call != NULL; call = call->next) { if (call->callback(event) && undo) { for (fix = callback_list; fix != call; fix = fix->next) @@ -796,7 +792,7 @@ void apm_do_busy(void) if (!apm_enabled) return; - + #ifndef ALWAYS_CALL_BUSY if (!clock_slowed) return; @@ -1054,7 +1050,7 @@ int apm_get_info(char *buf, char **start, off_t fpos, int length, int dummy) Number of remaining minutes or seconds -1: Unknown 8) min = minutes; sec = seconds */ - + p += sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", driver_version, (apm_bios_info.version >> 8) & 0xff, @@ -1176,7 +1172,7 @@ void apm_bios_init(void) if (dx == 0xffff) printk("unknown\n"); else { - if ((dx & 0x8000)) + if ((dx & 0x8000)) printk("%d minutes\n", dx & 0x7ffe ); else printk("%d seconds\n", dx & 0x7fff ); @@ -1202,8 +1198,6 @@ void apm_bios_init(void) apm_timer.expires = APM_CHECK_TIMEOUT + jiffies; add_timer(&apm_timer); - register_symtab(&apm_syms); - #ifdef CONFIG_PROC_FS proc_register_dynamic(&proc_root, &apm_proc_entry); #endif diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 89c21f06aff4..263fe27e0d2d 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -28,6 +28,11 @@ * by Dennis J. Boylan). Patches to allow use with 2.1.x contributed * by Chris Faylor. * + * Most recent changes: (Andrew J. Robinson) + * Remove tx_flowed_[on|off], since the ESP handles flow itself. + * Enabled reinterrupt pacing to ensure all requests are serviced. + * Decreased RX timeout to reduce latency. + * * This module exports the following rs232 io functions: * * int esp_init(void); @@ -68,8 +73,9 @@ static int irq[NR_PRIMARY] = {0,0,0,0,0,0,0,0}; /* IRQ for each base port */ static unsigned int divisor[NR_PRIMARY] = {0,0,0,0,0,0,0,0}; /* custom divisor for each port */ -static unsigned int dma = CONFIG_ESP_DMA_CHANNEL; /* DMA channel */ -static unsigned int trigger = CONFIG_ESP_TRIGGER_LEVEL; /* FIFO trigger level */ +static unsigned int dma = CONFIG_ESPSERIAL_DMA_CHANNEL; /* DMA channel */ +static unsigned int trigger = CONFIG_ESPSERIAL_TRIGGER_LEVEL; + /* FIFO trigger level */ /* END */ static char *dma_buffer; @@ -78,8 +84,8 @@ static char *dma_buffer; #define WAKEUP_CHARS 1024 -static char *serial_name = "ESP driver"; -static char *serial_version = "1.1"; +static char *serial_name = "ESP serial driver"; +static char *serial_version = "1.2"; DECLARE_TASK_QUEUE(tq_esp); @@ -574,31 +580,8 @@ static _INLINE_ void check_modem_status(struct esp_struct *info) } } -static _INLINE_ void tx_flowed_on(struct esp_struct *info) -{ -#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) - printk("CTS tx start..."); -#endif - info->tty->hw_stopped = 0; - info->IER |= UART_IER_THRI; - serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); /* set mask */ - serial_out(info, UART_ESI_CMD2, info->IER); - rs_sched_event(info, ESP_EVENT_WRITE_WAKEUP); -} - -static _INLINE_ void tx_flowed_off(struct esp_struct *info) -{ -#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) - printk("CTS tx stop..."); -#endif - info->tty->hw_stopped = 1; - info->IER &= ~UART_IER_THRI; - serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); /* set mask */ - serial_out(info, UART_ESI_CMD2, info->IER); -} - /* - * This is the serial driver's interrupt routine for a single port + * This is the serial driver's interrupt routine */ static void rs_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) { @@ -644,12 +627,6 @@ static void rs_interrupt_single(int irq, void *dev_id, struct pt_regs * regs) if (err_status & 0x8000) /* Start break */ wake_up_interruptible(&info->break_wait); - - if (err_status & 0x0002) /* tx off */ - tx_flowed_off(info); - - if (err_status & 0x0004) /* tx on */ - tx_flowed_on(info); } if ((scratch & 0x88) || /* DMA completed or timed out */ @@ -777,7 +754,7 @@ static void esp_basic_init(struct esp_struct * info) /* set error status mask (check this) */ serial_out(info, UART_ESI_CMD1, ESI_SET_ERR_MASK); serial_out(info, UART_ESI_CMD2, 0xbd); - serial_out(info, UART_ESI_CMD2, 0x06); + serial_out(info, UART_ESI_CMD2, 0x00); /* set DMA timeout */ serial_out(info, UART_ESI_CMD1, ESI_SET_DMA_TMOUT); @@ -793,6 +770,10 @@ static void esp_basic_init(struct esp_struct * info) /* Set clock scaling */ serial_out(info, UART_ESI_CMD1, ESI_SET_PRESCALAR); serial_out(info, UART_ESI_CMD2, ESPC_SCALE); + + /* set reinterrupt pacing */ + serial_out(info, UART_ESI_CMD1, ESI_SET_REINTR); + serial_out(info, UART_ESI_CMD2, 0xff); } static int startup(struct esp_struct * info) @@ -867,7 +848,7 @@ static int startup(struct esp_struct * info) /* set receive character timeout */ serial_out(info, UART_ESI_CMD1, ESI_SET_RX_TIMEOUT); - serial_out(info, UART_ESI_CMD2, 0xff); + serial_out(info, UART_ESI_CMD2, 0x80); info->stat_flags = 0; @@ -1417,7 +1398,7 @@ static void rs_unthrottle(struct tty_struct * tty) serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); serial_out(info, UART_ESI_CMD2, info->IER); serial_out(info, UART_ESI_CMD1, ESI_SET_RX_TIMEOUT); - serial_out(info, UART_ESI_CMD2, 0xff); + serial_out(info, UART_ESI_CMD2, 0x80); sti(); } @@ -2409,7 +2390,7 @@ int esp_init(void) } if ((dma != 1) && (dma != 3)) - dma = CONFIG_ESP_DMA_CHANNEL; + dma = 1; if ((trigger < 1) || (trigger > 1015)) trigger = 768; diff --git a/drivers/char/ftape/kernel-interface.c b/drivers/char/ftape/kernel-interface.c index b29088461720..5fba55bd2207 100644 --- a/drivers/char/ftape/kernel-interface.c +++ b/drivers/char/ftape/kernel-interface.c @@ -116,6 +116,7 @@ void dmafree(void *addr, int order) */ #ifdef MODULE +EXPORT_NO_SYMBOLS; #define ftape_init init_module #endif @@ -175,9 +176,7 @@ int ftape_init(void) udelay_calibrate(); /* must be before fdc_wait_calibrate ! */ fdc_wait_calibrate(); TRACE_EXIT; -#ifdef MODULE - register_symtab(0); /* remove global ftape symbols */ -#endif + return 0; } diff --git a/drivers/char/mem.c b/drivers/char/mem.c index c75c36a82899..36764df22da5 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -34,27 +34,17 @@ void isdn_init(void); void pcwatchdog_init(void); #endif -static long read_ram(struct inode * inode, struct file * file, - char * buf, unsigned long count) -{ - return -EIO; -} - -static long write_ram(struct inode * inode, struct file * file, - const char * buf, unsigned long count) -{ - return -EIO; -} - +/* + * This funcion reads the *physical* memory. The f_pos points directly to the + * memory location. + */ static long read_mem(struct inode * inode, struct file * file, char * buf, unsigned long count) { unsigned long p = file->f_pos; unsigned long end_mem; - int read; + unsigned long read; - if (count < 0) - return -EINVAL; end_mem = __pa(high_memory); if (p >= end_mem) return 0; @@ -82,10 +72,8 @@ static long write_mem(struct inode * inode, struct file * file, { unsigned long p = file->f_pos; unsigned long end_mem; - int written; + unsigned long written; - if (count < 0) - return -EINVAL; end_mem = __pa(high_memory); if (p >= end_mem) return 0; @@ -132,19 +120,70 @@ static int mmap_mem(struct inode * inode, struct file * file, struct vm_area_str return 0; } +/* + * This function reads the *virtual* memory as seen by the kernel. + */ static long read_kmem(struct inode *inode, struct file *file, char *buf, unsigned long count) { - int read1, read2; - - read1 = read_mem(inode, file, buf, count); - if (read1 < 0) - return read1; - read2 = vread(buf + read1, (char *) ((unsigned long) file->f_pos), count - read1); - if (read2 < 0) - return read2; - file->f_pos += read2; - return read1 + read2; + unsigned long p = file->f_pos; + unsigned long read = 0; + long virtr; + + if (p < (unsigned long) high_memory) { + unsigned long tmp; + + if (count > (unsigned long) high_memory - p) + tmp = (unsigned long) high_memory - p; + else + tmp = count; + read = tmp; +#if defined(__sparc__) /* we don't have page 0 mapped on sparc.. */ + while (p < PAGE_SIZE && tmp > 0) { + put_user(0,buf); + buf++; + p++; + tmp--; + } +#endif + copy_to_user(buf, (char *) p, tmp); + buf += tmp; + } + + virtr = vread(buf, (char *) (unsigned long) file->f_pos, count - read); + if (virtr < 0) + return virtr; + file->f_pos += virtr + read; + return virtr + read; +} + +/* + * This function writes to the *virtual* memory as seen by the kernel. + */ +static long write_kmem(struct inode * inode, struct file * file, + const char * buf, unsigned long count) +{ + unsigned long p = file->f_pos; + unsigned long written; + + if (p >= (unsigned long) high_memory) + return 0; + if (count > (unsigned long) high_memory - p) + count = (unsigned long) high_memory - p; + written = 0; +#if defined(__sparc__) /* we don't have page 0 mapped on sparc.. */ + while (p < PAGE_SIZE && count > 0) { + /* Hmm. Do something? */ + buf++; + p++; + count--; + written++; + } +#endif + copy_from_user((char *) p, buf, count); + written += count; + file->f_pos += written; + return count; } static long read_port(struct inode * inode, struct file * file, @@ -298,24 +337,10 @@ static long long memory_lseek(struct inode * inode, struct file * file, return file->f_pos; } -#define write_kmem write_mem #define mmap_kmem mmap_mem #define zero_lseek null_lseek #define write_zero write_null -static struct file_operations ram_fops = { - memory_lseek, - read_ram, - write_ram, - NULL, /* ram_readdir */ - NULL, /* ram_select */ - NULL, /* ram_ioctl */ - NULL, /* ram_mmap */ - NULL, /* no special open code */ - NULL, /* no special release code */ - NULL /* fsync */ -}; - static struct file_operations mem_fops = { memory_lseek, read_mem, @@ -395,9 +420,6 @@ static struct file_operations full_fops = { static int memory_open(struct inode * inode, struct file * filp) { switch (MINOR(inode->i_rdev)) { - case 0: - filp->f_op = &ram_fops; - break; case 1: filp->f_op = &mem_fops; break; diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 90159fe43fcf..d3cf60d97338 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -175,17 +175,13 @@ void cleanup_module(void) #endif -static struct symbol_table misc_syms = { /* Should this be surrounded with "#ifdef CONFIG_MODULES" ? */ -#include - X(misc_register), - X(misc_deregister), +EXPORT_SYMBOL(misc_register); +EXPORT_SYMBOL(misc_deregister); #ifndef MODULE - X(set_selection), /* used by the kmouse module, can only */ - X(paste_selection), /* be exported if misc.c is in linked in */ +EXPORT_SYMBOL(set_selection); /* used by the kmouse module, can only */ +EXPORT_SYMBOL(paste_selection); /* be exported if misc.c is in linked in */ #endif -#include -}; #if defined(CONFIG_PROC_FS) && !defined(MODULE) static struct proc_dir_entry proc_misc = { @@ -240,15 +236,10 @@ int misc_init(void) #endif #endif /* !MODULE */ if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { - printk("unable to get major %d for misc devices\n", - MISC_MAJOR); + printk("unable to get major %d for misc devices\n", + MISC_MAJOR); return -EIO; } - if(register_symtab(&misc_syms)!=0) - { - unregister_chrdev(MISC_MAJOR, "misc"); - return -EIO; - } return 0; } diff --git a/drivers/char/pcwd.c b/drivers/char/pcwd.c index 0d7cae0d1c9d..783a36e2534b 100644 --- a/drivers/char/pcwd.c +++ b/drivers/char/pcwd.c @@ -215,14 +215,13 @@ static void pcwd_send_heartbeat(void) wdrst_stat |= WD_WDRST; outb_p(wdrst_stat, current_readport + PORT_OFFSET); - return(1); } static int pcwd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int i, cdat, rv; - static struct watchdog_ident ident= + static struct watchdog_info ident= { WDIOF_OVERHEAT|WDIOF_CARDRESET, #ifdef CONFIG_PCWD_REV_A @@ -238,61 +237,39 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, return -ENOIOCTLCMD; case WDIOC_GETSUPPORT: - i = verify_area(VERIFY_WRITE, (void*) arg, sizeof(struct watchdog_info)); - if (i) - return i; - else - return copy_to_user(arg, &ident, sizeof(ident)); + i = copy_to_user((void*)arg, &ident, sizeof(ident)); + return i ? -EFAULT : 0; case WDIOC_GETSTATUS: - i = verify_area(VERIFY_WRITE, (void*) arg, sizeof(int)); - if (i) - return i; - else { - cdat = inb(current_readport); - rv = 0; + cdat = inb(current_readport); + rv = 0; - if (cdat & WD_WDRST) - rv |= WDIOF_CARDRESET; + if (cdat & WD_WDRST) + rv |= WDIOF_CARDRESET; - if (cdat & WD_T110) - rv |= WDIOF_OVERHEAT; + if (cdat & WD_T110) + rv |= WDIOF_OVERHEAT; - return put_user(rv, (int *) arg); - } + return put_user(rv, (int *) arg); break; case WDIOC_GETBOOTSTATUS: - i = verify_area(VERIFY_WRITE, (void*) arg, sizeof(int)); - if (i) - return i; - else { - int rv; - rv = 0; - - if (initial_status & WD_WDRST) - rv |= WDIOF_CARDRESET; - - if (initial_status & WD_T110) - rv |= WDIOF_OVERHEAT; - return put_user(rv, (int *) arg); - } - break; + rv = 0; + + if (initial_status & WD_WDRST) + rv |= WDIOF_CARDRESET; + + if (initial_status & WD_T110) + rv |= WDIOF_OVERHEAT; + return put_user(rv, (int *) arg); case WDIOC_GETTEMP: - i = verify_area(VERIFY_WRITE, (void*) arg, sizeof(int)); - if (i) - return i; - else { - int rv; - - rv = 0; - if ((supports_temp) && (mode_debug == 0)) { - rv = inb(current_readport); - return put_user(rv, (int*) arg); - } else - return put_user(rv, (int*) arg); - } + rv = 0; + if ((supports_temp) && (mode_debug == 0)) { + rv = inb(current_readport); + return put_user(rv, (int*) arg); + } else + return put_user(rv, (int*) arg); case WDIOC_KEEPALIVE: pcwd_send_heartbeat(); @@ -304,11 +281,12 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, static long pcwd_write(struct file *file, struct inode *inode, const char *buf, unsigned long len) { - if(len) + if (len) { pcwd_send_heartbeat(); return 1; } + return 0; } static int pcwd_open(struct inode *ino, struct file *filep) diff --git a/drivers/char/pcxx.c b/drivers/char/pcxx.c index b3f3af024287..005f48a17872 100644 --- a/drivers/char/pcxx.c +++ b/drivers/char/pcxx.c @@ -1111,6 +1111,7 @@ int pcxe_init(void) digi_channels = kmalloc(sizeof(struct channel) * nbdevs, GFP_KERNEL); if (!digi_channels) panic("Unable to allocate digi_channel struct"); + memset(digi_channels, 0, sizeof(struct channel) * nbdevs); pcxe_table = kmalloc(sizeof(struct tty_struct *) * nbdevs, GFP_KERNEL); if (!pcxe_table) diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 1ca581b43aca..1996ebeee69d 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1857,6 +1857,10 @@ int iobase = 0; int iobase1 = 0; int iobase2 = 0; int iobase3 = 0; +MODULE_PARM(iobase, "i"); +MODULE_PARM(iobase1, "i"); +MODULE_PARM(iobase2, "i"); +MODULE_PARM(iobase3, "i"); /* * You can setup up to 4 boards (current value of RC_NBOARD) diff --git a/drivers/char/serial.c b/drivers/char/serial.c index c2a3d46b3d7f..bd414851602b 100644 --- a/drivers/char/serial.c +++ b/drivers/char/serial.c @@ -2955,12 +2955,8 @@ static void autoconfig(struct serial_state * state) int register_serial(struct serial_struct *req); void unregister_serial(int line); -static struct symbol_table serial_syms = { -#include - X(register_serial), - X(unregister_serial), -#include -}; +EXPORT_SYMBOL(register_serial); +EXPORT_SYMBOL(unregister_serial); /* * The serial driver boot-time initialization code! @@ -3062,7 +3058,7 @@ int rs_init(void) state->port, state->irq, uart_config[state->type].name); } - register_symtab(&serial_syms); + return 0; } diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 5e3f3d0b04a6..fc0ab0d578e3 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -1923,7 +1923,7 @@ int tty_init(void) panic("Couldn't register /dev/console driver\n"); kbd_init(); -#ifdef CONFIG_ESP /* init ESP before rs, so rs doesn't see the port */ +#ifdef CONFIG_ESPSERIAL /* init ESP before rs, so rs doesn't see the port */ esp_init(); #endif #ifdef CONFIG_SERIAL diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index aca9fe72b976..b704b67aef0c 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c @@ -16,7 +16,7 @@ * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: icn.c,v $ * Revision 1.29 1996/08/29 20:34:54 fritz @@ -154,7 +154,7 @@ static void icn_free_queue(struct sk_buff_head *queue) { struct sk_buff *skb; unsigned long flags; - + save_flags(flags); cli(); while ((skb = skb_dequeue(queue))) @@ -334,7 +334,7 @@ static void icn_pollbchan_receive(int channel, icn_card *card) while (rbavl) { cnt = readb(&rbuf_l); if ((card->rcvidx[channel] + cnt) > 4000) { - printk(KERN_WARNING + printk(KERN_WARNING "icn: (%s) bogus packet on ch%d, dropping.\n", CID, channel + 1); @@ -354,7 +354,7 @@ static void icn_pollbchan_receive(int channel, icn_card *card) printk(KERN_WARNING "ïcn: receive out of memory\n"); break; } - memcpy(skb_put(skb, cnt), card->rcvbuf[channel], cnt); + memcpy(skb_put(skb, cnt), card->rcvbuf[channel], cnt); card->rcvidx[channel] = 0; card->interface.rcvcallb_skb(card->myid, channel, skb); } @@ -403,7 +403,7 @@ static void icn_pollbchan_send(int channel, icn_card *card) writeb (0x0, &sbuf_f); cnt = skb->len; } - writeb (cnt, &sbuf_l); + writeb (cnt, &sbuf_l); memcpy_toio(&sbuf_d, skb->data, cnt); skb_pull(skb, cnt); card->sndcount[channel] -= cnt; @@ -633,7 +633,7 @@ static void icn_polldchan(unsigned long data) vstr[3] = '\0'; card->fw_rev = (int)simple_strtoul(vstr,NULL,10); continue; - + } } } else { @@ -758,7 +758,7 @@ static int icn_check_loader(int cardnumber) /* Load the boot-code into the interface-card's memory and start it. * Always called from user-process. - * + * * Parameters: * buffer = pointer to packet * Return: @@ -916,7 +916,7 @@ static int icn_loadproto(u_char * buffer, icn_card * card) cnt = MIN(256, left); if (copy_from_user(codebuf, p, cnt)) /* FIXME -WRONG */return -EFAULT; - memcpy_toio(&sbuf_l, codebuf, cnt); /* copy data */ + memcpy_toio(&sbuf_l, codebuf, cnt); /* copy data */ sbnext; /* switch to next buffer */ p += cnt; left -= cnt; @@ -1263,7 +1263,7 @@ static int icn_command(isdn_ctrl * c, icn_card * card) char sis[50]; char dcode[4]; int si1, si2; - + a = c->arg; strcpy(sis, c->num); p = strrchr(sis, ','); @@ -1589,6 +1589,7 @@ static int icn_addcard(int port, char *id1, char *id2) } #ifdef MODULE +EXPORT_NO_SYMBOLS; #define icn_init init_module #else void icn_setup(char *str, int *ints) @@ -1623,9 +1624,6 @@ int icn_init(void) dev.channel = -1; dev.mcard = NULL; - /* No symbols to export, hide all symbols */ - register_symtab(NULL); - if ((p = strchr(revision, ':'))) { strcpy(rev, p + 1); p = strchr(rev, '$'); diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c index 04415c79717e..b11a11468d93 100644 --- a/drivers/isdn/isdn_common.c +++ b/drivers/isdn/isdn_common.c @@ -5,7 +5,7 @@ * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de) * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) - * + * * 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, or (at your option) @@ -18,7 +18,7 @@ * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn_common.c,v $ * Revision 1.23 1996/06/25 18:35:38 fritz @@ -297,7 +297,7 @@ static void isdn_receive_skb_callback(int di, int channel, struct sk_buff *skb) int ifmt; #endif modem_info *info; - + if ((i = isdn_dc2minor(di,channel))==-1) { isdn_trash_skb(skb, FREE_READ); return; @@ -679,7 +679,7 @@ static int isdn_status_callback(isdn_ctrl * c) } for (i = 0; i < ISDN_MAX_CHANNELS; i++) { modem_info *info = &dev->mdm.info[i]; - + if (info->isdn_driver == di) { info->isdn_driver = -1; info->isdn_channel = -1; @@ -727,7 +727,7 @@ int isdn_getnum(char **p) /* * isdn_readbchan() tries to get data from the read-queue. * It MUST be called with interrupts off. - * + * * I hope I got the EFAULT error path right -AK. */ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int user) @@ -739,7 +739,7 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int int dflag; struct sk_buff *skb; u_char *cp; - int ret = 0; + int ret = 0; if (!dev->drv[di]) return 0; @@ -753,7 +753,7 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int cp = buf; count = 0; while (left) { - ret = 0; + ret = 0; if (!(skb = skb_peek(&dev->drv[di]->rpqueue[channel]))) break; if (skb->lock) @@ -772,8 +772,8 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int if (dev->drv[di]->DLEflag & DLEmask) { if (user) { ret = put_user(DLE,cp); - cp++; - if (ret) break; + cp++; + if (ret) break; } else *cp++ = DLE; dev->drv[di]->DLEflag &= ~DLEmask; @@ -781,7 +781,7 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int if (user) { ret = put_user(*p,cp); if (ret) break; - cp++; + cp++; } else *cp++ = *p; if (*p == DLE) { @@ -803,12 +803,12 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int dflag = 0; } count_put = count_pull; - ret = 0; + ret = 0; if (user) ret = copy_to_user(cp, skb->data, count_put); else memcpy(cp, skb->data, count_put); - count_put -= ret; + count_put -= ret; cp += count_put; left -= count_put; } @@ -832,7 +832,7 @@ int isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, int * but we pull off the data we got until now. */ skb_pull(skb,count_pull); - skb->lock = 0; + skb->lock = 0; } dev->drv[di]->rcvcount[channel] -= count_put; } @@ -937,7 +937,7 @@ static long isdn_read(struct inode *inode, struct file *file, char *buf, unsigne if (copy_to_user(buf, p, len)) return -EFAULT; file->f_pos += len; - return len; + return len; } return 0; } @@ -1085,25 +1085,25 @@ static int isdn_set_allcfg(char *src) return ret; save_flags(flags); cli(); - ret = get_user(i, src); - if (ret) - goto out; + ret = get_user(i, src); + if (ret) + goto out; src += sizeof(int); while (i) { char *c; char *c2; if(copy_from_user((char *) &cfg, src, sizeof(cfg))) - goto fault; + goto fault; src += sizeof(cfg); if (!isdn_net_new(cfg.name, NULL)) { restore_flags(flags); return -EIO; } - if ((ret = isdn_net_setcfg(&cfg))) - goto out; + if ((ret = isdn_net_setcfg(&cfg))) + goto out; if(copy_from_user(buf, src, sizeof(buf))) - goto fault; + goto fault; src += sizeof(buf); c = buf; while (*c) { @@ -1112,15 +1112,15 @@ static int isdn_set_allcfg(char *src) strcpy(phone.phone, c); strcpy(phone.name, cfg.name); phone.outgoing = 0; - if ((ret = isdn_net_addphone(&phone))) - goto fault; + if ((ret = isdn_net_addphone(&phone))) + goto fault; if (c2) c = c2; else c += strlen(c); } if(copy_from_user(buf, src, sizeof(buf))) - goto fault; + goto fault; src += sizeof(buf); c = buf; while (*c) { @@ -1129,8 +1129,8 @@ static int isdn_set_allcfg(char *src) strcpy(phone.phone, c); strcpy(phone.name, cfg.name); phone.outgoing = 1; - if ((ret = isdn_net_addphone(&phone))) - goto out; + if ((ret = isdn_net_addphone(&phone))) + goto out; if (c2) c = c2; else @@ -1175,7 +1175,7 @@ static int isdn_get_allcfg(char *dest) cfg.callback = (p->local.flags & ISDN_NET_CALLBACK) ? 1 : 0; cfg.chargehup = (p->local.hupflags & 4) ? 1 : 0; cfg.ihup = (p->local.hupflags & 8) ? 1 : 0; - ret = 0; + ret = 0; ret += copy_to_user(dest, p->local.name, 10); dest += 10; ret += copy_to_user(dest, (char *) &cfg, sizeof(cfg)); @@ -1183,15 +1183,15 @@ static int isdn_get_allcfg(char *dest) strcpy(phone.name, p->local.name); phone.outgoing = 0; if (ret) - break; - if ((ret = isdn_net_getphones(&phone, dest)) < 0) - break; + break; + if ((ret = isdn_net_getphones(&phone, dest)) < 0) + break; else dest += ret; strcpy(phone.name, p->local.name); phone.outgoing = 1; - if ((ret = isdn_net_getphones(&phone, dest)) < 0) - break; + if ((ret = isdn_net_getphones(&phone, dest)) < 0) + break; else dest += ret; p = p->next; @@ -1226,11 +1226,11 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar int i; for (i = 0;iibytes[i],p); - if (ret) break; - p++; + if (ret) break; + p++; ret = put_user(dev->obytes[i],p); - p++; - if (ret) break; + p++; + if (ret) break; } return ret; } else @@ -1258,19 +1258,19 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar /* Add a network-interface */ if (arg) { if(copy_from_user(name, (char *) arg, sizeof(name))) - return -EFAULT; + return -EFAULT; s = name; } else s = NULL; if ((s = isdn_net_new(s, NULL))) { - return copy_to_user((char *) arg, s, strlen(s) + 1) ? -EFAULT : ret; + return copy_to_user((char *) arg, s, strlen(s) + 1) ? -EFAULT : ret; } else return -ENODEV; case IIOCNETASL: /* Add a slave to a network-interface */ if (arg) { if(copy_from_user(bname, (char *) arg, sizeof(bname))) - return -EFAULT; + return -EFAULT; } else return -EINVAL; if ((s = isdn_net_newslave(bname))) { @@ -1293,12 +1293,12 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return -EINVAL; case IIOCNETGCF: /* Get configurable parameters of a network-interface */ - if (arg) { + if (arg) { if(copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg))) - return -EFAULT; + return -EFAULT; if (!(ret = isdn_net_getcfg(&cfg))) { if(copy_to_user((char *) arg, (char *) &cfg, sizeof(cfg))) - return -EFAULT; + return -EFAULT; } return ret; } else @@ -1333,13 +1333,13 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return -EINVAL; #ifdef CONFIG_ISDN_PPP case IIOCNETALN: - if (arg) + if (arg) ret = copy_from_user(name,(char*)arg,sizeof(name)); else - return -EINVAL; + return -EINVAL; return ret ? -EFAULT : isdn_ppp_dial_slave(name); case IIOCNETDLN: - + if(arg) { ret = copy_from_user(name,(char*)arg,sizeof(name)); } else @@ -1374,7 +1374,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar char *p; if(copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct))) - return -EFAULT; + return -EFAULT; if (strlen(iocts.drvid)) { if ((p = strchr(iocts.drvid, ','))) *p = 0; @@ -1415,14 +1415,14 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { char *p = (char *) arg; int i; - + for (i = 0; i < ISDN_MAX_CHANNELS; i++) { if(copy_to_user(p, dev->mdm.info[i].emu.profile, ISDN_MODEM_ANZREG)) return -EFAULT; p += ISDN_MODEM_ANZREG; if(copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN)) - return -EFAULT; + return -EFAULT; p += ISDN_MSNLEN; } return (ISDN_MODEM_ANZREG + ISDN_MSNLEN) * ISDN_MAX_CHANNELS; @@ -1434,14 +1434,14 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar if (arg) { char *p = (char *) arg; int i; - + for (i = 0; i < ISDN_MAX_CHANNELS; i++) { if(copy_from_user(dev->mdm.info[i].emu.profile, p, ISDN_MODEM_ANZREG)) - return -EFAULT; + return -EFAULT; p += ISDN_MODEM_ANZREG; if(copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN)) - return -EFAULT; + return -EFAULT; p += ISDN_MSNLEN; } return 0; @@ -1455,9 +1455,9 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar int i; char *p; char nstring[255]; - + ret = copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); - + if (ret) return -EFAULT; if (strlen(iocts.drvid)) { drvidx = -1; @@ -1472,7 +1472,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar return -ENODEV; if (cmd == IIOCSETMAP) { ret = copy_from_user(nstring, (char *) iocts.arg, 255); - if (ret) return -EFAULT; + if (ret) return -EFAULT; memset(dev->drv[drvidx]->msn2eaz, 0, sizeof(dev->drv[drvidx]->msn2eaz)); p = strtok(nstring, ","); @@ -1489,7 +1489,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar dev->drv[drvidx]->msn2eaz[i] : "-", (i < 9) ? "," : "\0"); if(copy_to_user((char *) iocts.arg, nstring, strlen(nstring) + 1)) - return -EFAULT; + return -EFAULT; } return 0; } else @@ -1511,7 +1511,7 @@ static int isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar ret = copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)); if (ret) - return -EFAULT; + return -EFAULT; if (strlen(iocts.drvid)) { if ((p = strchr(iocts.drvid, ','))) *p = 0; @@ -1802,7 +1802,7 @@ void isdn_unexclusive_channel(int di, int ch) * len = Length of packet-data * */ -void isdn_receive_callback(int drvidx, int chan, u_char *buf, int len) +void isdn_receive_callback(int drvidx, int chan, u_char *buf, int len) { struct sk_buff *skb; @@ -1819,7 +1819,7 @@ void isdn_receive_callback(int drvidx, int chan, u_char *buf, int len) /* * writebuf replacement for SKB_ABLE drivers */ -int isdn_writebuf_stub(int drvidx, int chan, const u_char *buf, int len, +int isdn_writebuf_stub(int drvidx, int chan, const u_char *buf, int len, int user) { int ret; @@ -1841,7 +1841,7 @@ int isdn_writebuf_stub(int drvidx, int chan, const u_char *buf, int len, if (user) { if(copy_from_user(skb_put(skb, len), buf, len)) { kfree_skb(skb,FREE_WRITE); - return -EFAULT; + return -EFAULT; } } else memcpy(skb_put(skb, len), buf, len); @@ -1869,7 +1869,7 @@ int isdn_writebuf_skb_stub(int drvidx, int chan, struct sk_buff * skb) int ret; int len = skb->len; /* skb pointer no longer valid after free */ - if (dev->drv[drvidx]->interface->writebuf_skb) + if (dev->drv[drvidx]->interface->writebuf_skb) ret = dev->drv[drvidx]->interface-> writebuf_skb(drvidx, chan, skb); else { @@ -1970,7 +1970,7 @@ int register_isdn(isdn_if * i) if (!dev->drv[drvidx]) break; i->channels = drvidx; - + i->rcvcallb_skb = isdn_receive_skb_callback; i->rcvcallb = isdn_receive_callback; i->statcallb = isdn_status_callback; @@ -1980,7 +1980,7 @@ int register_isdn(isdn_if * i) cli(); for (j = 0; j < drvidx; j++) if (!strcmp(i->id,dev->drvid[j])) - sprintf(i->id, "line%d", drvidx); + sprintf(i->id, "line%d", drvidx); for (j = 0; j < n; j++) for (k = 0; k < ISDN_MAX_CHANNELS; k++) if (dev->chanmap[k] < 0) { @@ -2023,15 +2023,10 @@ static char *isdn_getrev(const char *revision) return rev; } -static struct symbol_table isdn_syms = { -#include - X(register_isdn), -#include -}; +EXPORT_SYMBOL(register_isdn); static void isdn_export_syms(void) { - register_symtab(&isdn_syms); has_exported = 1; } diff --git a/drivers/isdn/pcbit/module.c b/drivers/isdn/pcbit/module.c index 2f2aa374f1ce..c40654ab8907 100644 --- a/drivers/isdn/pcbit/module.c +++ b/drivers/isdn/pcbit/module.c @@ -1,13 +1,13 @@ /* * Copyright (C) 1996 Universidade de Lisboa - * + * * Written by Pedro Roque Marques (roque@di.fc.ul.pt) * - * This software may be used and distributed according to the terms of + * This software may be used and distributed according to the terms of * the GNU Public License, incorporated herein by reference. */ -/* +/* * PCBIT-D module support */ @@ -35,6 +35,7 @@ extern void pcbit_terminate(int board); extern int pcbit_init_dev(int board, int mem_base, int irq); #ifdef MODULE +EXPORT_NO_SYMBOLS; #define pcbit_init init_module #endif @@ -44,11 +45,11 @@ int pcbit_init(void) num_boards = 0; - printk(KERN_INFO + printk(KERN_INFO "PCBIT-D device driver v 0.5 - " "Copyright (C) 1996 Universidade de Lisboa\n"); - if (mem[0] || irq[0]) + if (mem[0] || irq[0]) { for (board=0; board < MAX_PCBIT_CARDS && mem[board] && irq[board]; board++) { @@ -56,14 +57,14 @@ int pcbit_init(void) mem[board] = 0xD0000; if (!irq[board]) irq[board] = 5; - + if (pcbit_init_dev(board, mem[board], irq[board]) == 0) num_boards++; - - else + + else { - printk(KERN_WARNING - "pcbit_init failed for dev %d", + printk(KERN_WARNING + "pcbit_init failed for dev %d", board + 1); return -EIO; } @@ -74,7 +75,7 @@ int pcbit_init(void) if (!num_boards) { - printk(KERN_INFO + printk(KERN_INFO "Trying to detect board using default settings\n"); if (pcbit_init_dev(0, 0xD0000, 5) == 0) num_boards++; @@ -82,9 +83,6 @@ int pcbit_init(void) return -EIO; } - /* No symbols to export, hide all symbols */ - register_symtab(NULL); - return 0; } @@ -95,7 +93,7 @@ void cleanup_module(void) for (board = 0; board < num_boards; board++) pcbit_terminate(board); - printk(KERN_INFO + printk(KERN_INFO "PCBIT-D module unloaded\n"); } @@ -114,7 +112,7 @@ void pcbit_setup(char *str, int *ints) mem[i] = ints[j]; j++; argc--; } - + if (argc) { irq[i] = ints[j]; j++; argc--; @@ -124,6 +122,3 @@ void pcbit_setup(char *str, int *ints) } } #endif - - - diff --git a/drivers/isdn/teles/mod.c b/drivers/isdn/teles/mod.c index 0b12d9c92ea8..051ca516127f 100644 --- a/drivers/isdn/teles/mod.c +++ b/drivers/isdn/teles/mod.c @@ -53,6 +53,7 @@ teles_mod_inc_use_count(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; #define teles_init init_module #else void teles_setup(char *str, int *ints) @@ -115,9 +116,6 @@ teles_init(void) CallcNew(); ll_init(); - /* No symbols to export, hide all symbols */ - register_symtab(NULL); - #ifdef MODULE printk(KERN_NOTICE "Teles module installed\n"); #endif diff --git a/drivers/net/bpqether.c b/drivers/net/bpqether.c index 4995a46e60ac..a7a94e99dc0b 100644 --- a/drivers/net/bpqether.c +++ b/drivers/net/bpqether.c @@ -1,9 +1,9 @@ /* * G8BPQ compatible "AX.25 via ethernet" driver release 003 * - * This is ALPHA test software. This code may break your machine, randomly - * fail to work with new releases, misbehave and/or generally screw up. - * It might even work. + * This is ALPHA test software. This code may break your machine, randomly + * fail to work with new releases, misbehave and/or generally screw up. + * It might even work. * * This code REQUIRES 2.0.0 or higher/ NET3.029 * @@ -15,11 +15,11 @@ * * This is a "pseudo" network driver to allow AX.25 over Ethernet * using G8BPQ encapsulation. It has been extracted from the protocol - * implementation because + * implementation because * * - things got unreadable within the protocol stack * - to cure the protocol stack from "feature-ism" - * - a protocol implementation shouldn't need to know on + * - a protocol implementation shouldn't need to know on * which hardware it is running * - user-level programs like the AX.25 utilities shouldn't * need to know about the hardware. @@ -28,7 +28,7 @@ * - to have room for extensions * - it just deserves to "live" as an own driver * - * This driver can use any ethernet destination address, and can be + * This driver can use any ethernet destination address, and can be * limited to accept frames from one dedicated ethernet card only. * * Note that the driver sets up the BPQ devices automagically on @@ -44,7 +44,7 @@ * probably some buffering, and /voila/... * * History - * BPQ 001 Joerg(DL1BKE) Extracted BPQ code from AX.25 + * BPQ 001 Joerg(DL1BKE) Extracted BPQ code from AX.25 * protocol stack and added my own * yet existing patches * BPQ 002 Joerg(DL1BKE) Scan network device list on @@ -137,7 +137,7 @@ static struct bpqdev { static __inline__ struct device *bpq_get_ether_dev(struct device *dev) { struct bpqdev *bpq; - + bpq = (struct bpqdev *)dev->priv; return (bpq != NULL) ? bpq->ethdev : NULL; @@ -177,7 +177,7 @@ static int bpq_check_devices(struct device *dev) struct bpqdev *bpq, *bpq_prev; int result = 0; unsigned long flags; - + save_flags(flags); cli(); @@ -189,7 +189,7 @@ static int bpq_check_devices(struct device *dev) bpq_prev->next = bpq->next; else bpq_devices = bpq->next; - + if (&bpq->axdev == dev) result = 1; @@ -199,9 +199,9 @@ static int bpq_check_devices(struct device *dev) bpq_prev = bpq; } - + restore_flags(flags); - + return result; } @@ -220,7 +220,7 @@ static int bpq_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * struct bpqdev *bpq; skb->sk = NULL; /* Initially we don't know who it's for */ - + dev = bpq_get_ax25_dev(dev); if (dev == NULL || dev->start == 0) { @@ -250,7 +250,7 @@ static int bpq_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * ptr = skb_push(skb, 1); *ptr = 0; - + skb->dev = dev; skb->protocol = htons(ETH_P_AX25); skb->mac.raw = skb->data; @@ -269,7 +269,7 @@ static int bpq_xmit(struct sk_buff *skb, struct device *dev) unsigned char *ptr; struct bpqdev *bpq; int size; - + /* * Just to be *really* sure not to send anything if the interface * is down, the ethernet device may have gone. @@ -282,9 +282,9 @@ static int bpq_xmit(struct sk_buff *skb, struct device *dev) skb_pull(skb, 1); size = skb->len; - - /* - * The AX.25 code leaves enough room for the ethernet header, but + + /* + * The AX.25 code leaves enough room for the ethernet header, but * sendto() does not. */ if (skb_headroom(skb) < AX25_BPQ_HEADER_LEN) { /* Ough! */ @@ -305,17 +305,17 @@ static int bpq_xmit(struct sk_buff *skb, struct device *dev) dev_kfree_skb(skb, FREE_WRITE); skb = newskb; } - + skb->protocol = htons(ETH_P_AX25); ptr = skb_push(skb, 2); *ptr++ = (size + 5) % 256; *ptr++ = (size + 5) / 256; - + bpq = (struct bpqdev *)dev->priv; bpq->stats.tx_packets++; - + if ((dev = bpq_get_ether_dev(dev)) == NULL) { bpq->stats.tx_dropped++; dev_kfree_skb(skb, FREE_WRITE); @@ -368,10 +368,10 @@ static int bpq_ioctl(struct device *dev, struct ifreq *ifr, int cmd) if (!suser()) return -EPERM; - + if (bpq == NULL) /* woops! */ return -ENODEV; - + switch (cmd) { case SIOCSBPQETHOPT: if ((err = verify_area(VERIFY_WRITE, ifr->ifr_data, sizeof(struct bpq_req))) != 0) @@ -383,9 +383,9 @@ static int bpq_ioctl(struct device *dev, struct ifreq *ifr, int cmd) default: return -EINVAL; } - + break; - + case SIOCSBPQETHADDR: if ((err = verify_area(VERIFY_READ, ethaddr, sizeof(struct bpq_ethaddr))) != 0) return err; @@ -407,7 +407,7 @@ static int bpq_open(struct device *dev) { if (bpq_check_devices(dev)) return -ENODEV; /* oops, it's gone */ - + dev->tbusy = 0; dev->start = 1; @@ -444,10 +444,10 @@ static int bpq_dev_init(struct device *dev) static char * bpq_print_ethaddr(unsigned char *e) { static char buf[18]; - - sprintf(buf, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", + + sprintf(buf, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", e[0], e[1], e[2], e[3], e[4], e[5]); - + return buf; } @@ -457,7 +457,7 @@ int bpq_get_info(char *buffer, char **start, off_t offset, int length, int dummy int len = 0; off_t pos = 0; off_t begin = 0; - + cli(); len += sprintf(buffer, "dev ether destination accept from\n"); @@ -476,7 +476,7 @@ int bpq_get_info(char *buffer, char **start, off_t offset, int length, int dummy len = 0; begin = pos; } - + if (pos > offset + length) break; } @@ -489,7 +489,7 @@ int bpq_get_info(char *buffer, char **start, off_t offset, int length, int dummy if (len > length) len = length; return len; -} +} /* ------------------------------------------------------------------------ */ @@ -503,12 +503,12 @@ static int bpq_new_device(struct device *dev) int k; unsigned char *buf; struct bpqdev *bpq, *bpq2; - + if ((bpq = (struct bpqdev *)kmalloc(sizeof(struct bpqdev), GFP_KERNEL)) == NULL) return -ENOMEM; - + memset(bpq, 0, sizeof(struct bpqdev)); - + bpq->ethdev = dev; bpq->ethname[sizeof(bpq->ethname)-1] = '\0'; @@ -533,7 +533,7 @@ static int bpq_new_device(struct device *dev) kfree(bpq); return -ENODEV; } - + dev->priv = (void *)bpq; /* pointer back */ dev->name = buf; dev->init = bpq_dev_init; @@ -576,7 +576,7 @@ static int bpq_new_device(struct device *dev) dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN; dev->mtu = AX25_DEF_PACLEN; dev->addr_len = AX25_ADDR_LEN; - + cli(); if (bpq_devices == NULL) { @@ -585,7 +585,7 @@ static int bpq_new_device(struct device *dev) for (bpq2 = bpq_devices; bpq2->next != NULL; bpq2 = bpq2->next); bpq2->next = bpq; } - + sti(); return 0; @@ -598,7 +598,7 @@ static int bpq_new_device(struct device *dev) static int bpq_device_event(struct notifier_block *this,unsigned long event, void *ptr) { struct device *dev = (struct device *)ptr; - + if (!dev_is_ethdev(dev)) return NOTIFY_DONE; @@ -658,10 +658,10 @@ int bpq_init(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - register_symtab(NULL); - return bpq_init(); } @@ -675,7 +675,7 @@ void cleanup_module(void) #ifdef CONFIG_PROC_FS proc_net_unregister(PROC_NET_AX25_BPQETHER); -#endif +#endif for (bpq = bpq_devices; bpq != NULL; bpq = bpq->next) unregister_netdev(&bpq->axdev); diff --git a/drivers/net/de620.c b/drivers/net/de620.c index ecc64619b5b7..7cfc5ce577fc 100644 --- a/drivers/net/de620.c +++ b/drivers/net/de620.c @@ -713,7 +713,7 @@ de620_rx_intr(struct device *dev) else { /* Yep! Go get it! */ skb_reserve(skb,2); /* Align */ skb->dev = dev; - skb->free = 1; + skb->used = 0; /* skb->data points to the start of sk_buff data area */ buffer = skb_put(skb,size); /* copy the packet into the buffer */ diff --git a/drivers/net/hdlcdrv.c b/drivers/net/hdlcdrv.c index 6e55cb210eec..2cb5b6e9a809 100644 --- a/drivers/net/hdlcdrv.c +++ b/drivers/net/hdlcdrv.c @@ -888,15 +888,11 @@ int hdlcdrv_unregister_hdlcdrv(struct device *dev) /* --------------------------------------------------------------------- */ -static struct symbol_table hdlcdrv_syms = { -#include - X(hdlcdrv_receiver), - X(hdlcdrv_transmitter), - X(hdlcdrv_arbitrate), - X(hdlcdrv_register_hdlcdrv), - X(hdlcdrv_unregister_hdlcdrv), -#include -}; +EXPORT_SYMBOL(hdlcdrv_receiver); +EXPORT_SYMBOL(hdlcdrv_transmitter); +EXPORT_SYMBOL(hdlcdrv_arbitrate); +EXPORT_SYMBOL(hdlcdrv_register_hdlcdrv); +EXPORT_SYMBOL(hdlcdrv_unregister_hdlcdrv); /* --------------------------------------------------------------------- */ @@ -907,7 +903,6 @@ int init_module(void) printk(KERN_INFO "hdlcdrv: (C) 1996 Thomas Sailer HB9JNX/AE4WA\n"); printk(KERN_INFO "hdlcdrv: version 0.2 compiled %s %s\n", __TIME__, __DATE__); - register_symtab(&hdlcdrv_syms); return 0; } diff --git a/drivers/net/mkiss.c b/drivers/net/mkiss.c index cdcf484e94e2..c19ac12104a9 100644 --- a/drivers/net/mkiss.c +++ b/drivers/net/mkiss.c @@ -101,11 +101,11 @@ static inline struct ax_disp *ax_alloc(void) for (i = 0; i < ax25_maxdev; i++) { axp = ax25_ctrls[i]; - + /* Not allocated ? */ if (axp == NULL) break; - + /* Not in use ? */ if (!set_bit(AXF_INUSE, &axp->ctrl.flags)) break; @@ -261,9 +261,9 @@ static void ax_bump(struct ax_disp *ax) struct sk_buff *skb; struct mkiss_channel *mkiss; int count; - + tmp_ax = ax; - + if (ax->rbuff[0] > 0x0f) { if (ax->mkiss != NULL) { mkiss= ax->mkiss->tty->driver_data; @@ -271,7 +271,7 @@ static void ax_bump(struct ax_disp *ax) tmp_ax = ax->mkiss; } } - + count = ax->rcount; if ((skb = dev_alloc_skb(count)) == NULL) { @@ -282,7 +282,7 @@ static void ax_bump(struct ax_disp *ax) skb->dev = tmp_ax->dev; memcpy(skb_put(skb,count), ax->rbuff, count); - skb->mac.raw = skb->data; + skb->mac.raw = skb->data; skb->protocol = htons(ETH_P_AX25); netif_rx(skb); tmp_ax->rx_packets++; @@ -307,7 +307,7 @@ static void ax_encaps(struct ax_disp *ax, unsigned char *icp, int len) } p = icp; - + if (mkiss->magic != MKISS_DRIVER_MAGIC) { count = kiss_esc(p, (unsigned char *)ax->xbuff, len); ax->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); @@ -320,7 +320,7 @@ static void ax_encaps(struct ax_disp *ax, unsigned char *icp, int len) count = kiss_esc(p, (unsigned char *) ax->mkiss->xbuff, len); ax->mkiss->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); actual = ax->mkiss->tty->driver.write(ax->mkiss->tty, 0, ax->mkiss->xbuff, count); - ax->tx_packets++; + ax->tx_packets++; ax->mkiss->dev->trans_start = jiffies; ax->mkiss->xleft = count - actual; ax->mkiss->xhead = ax->mkiss->xbuff + actual; @@ -336,7 +336,7 @@ static void ax25_write_wakeup(struct tty_struct *tty) int actual; struct ax_disp *ax = (struct ax_disp *)tty->disc_data; struct mkiss_channel *mkiss; - + /* First make sure we're connected. */ if (ax == NULL || ax->magic != AX25_MAGIC || !ax->dev->start) return; @@ -368,14 +368,14 @@ static int ax_xmit(struct sk_buff *skb, struct device *dev) struct ax_disp *ax = (struct ax_disp*)dev->priv; struct mkiss_channel *mkiss = ax->tty->driver_data; struct ax_disp *tmp_ax; - + tmp_ax = NULL; - + if (mkiss->magic == MKISS_DRIVER_MAGIC) { if (skb->data[0] < 0x10) skb->data[0] = skb->data[0] + 0x10; tmp_ax = ax->mkiss; - } + } if (!dev->start) { printk(KERN_ERR "%s: xmit call when iface is down\n", dev->name); @@ -385,13 +385,13 @@ static int ax_xmit(struct sk_buff *skb, struct device *dev) if (tmp_ax != NULL) if (tmp_ax->dev->tbusy) return 1; - - if (tmp_ax != NULL) + + if (tmp_ax != NULL) if (dev->tbusy) { printk(KERN_ERR "mkiss: dev busy while serial dev is free\n"); ax_unlock(ax); } - + if (dev->tbusy) { /* * May be we must check transmitter timeout here ? @@ -410,7 +410,7 @@ static int ax_xmit(struct sk_buff *skb, struct device *dev) ax->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); ax_unlock(ax); } - + /* We were not busy, so we are now... :-) */ if (skb != NULL) { ax_lock(ax); @@ -585,7 +585,7 @@ static int ax25_open(struct tty_struct *tty) if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty); - /* Restore default settings */ + /* Restore default settings */ ax->dev->type = ARPHRD_AX25; /* Perform the low-level AX25 initialization. */ @@ -612,7 +612,7 @@ static int ax25_open(struct tty_struct *tty) ax->mkiss = tmp_ax; tmp_ax->mkiss = ax; } - + MOD_INC_USE_COUNT; /* Done. We have linked the TTY line to a channel. */ @@ -630,7 +630,7 @@ static void ax25_close(struct tty_struct *tty) mkiss = ax->mode; dev_close(ax->dev); - + tty->disc_data = 0; ax->tty = NULL; @@ -783,7 +783,7 @@ static int ax25_disp_ioctl(struct tty_struct *tty, void *file, int cmd, void *ar case SIOCGIFENCAP: if ((err = verify_area(VERIFY_WRITE, arg, sizeof(int))) != 0) return err; - put_user(4, (int *)arg); + put_user(4, (int *)arg); return 0; case SIOCSIFENCAP: @@ -820,12 +820,12 @@ int mkiss_init_ctrl_dev(void) int status; if (ax25_maxdev < 4) ax25_maxdev = 4; /* Sanity */ - + if ((ax25_ctrls = (ax25_ctrl_t **)kmalloc(sizeof(void*) * ax25_maxdev, GFP_KERNEL)) == NULL) { printk(KERN_ERR "mkiss: Can't allocate ax25_ctrls[] array ! No mkiss available\n"); return -ENOMEM; } - + /* Clear the pointer array, we allocate devices when we need them */ memset(ax25_ctrls, 0, sizeof(void*) * ax25_maxdev); /* Pointers */ @@ -879,7 +879,7 @@ static int ax25_init(struct device *dev) memset(ax, 0, sizeof (struct ax_disp)); ax->magic = AX25_MAGIC; ax->dev = dev; - + /* Finish setting up the DEVICE info. */ dev->mtu = AX_MTU; dev->hard_start_xmit = ax_xmit; @@ -919,7 +919,7 @@ static int ax25_init(struct device *dev) static int mkiss_open(struct tty_struct *tty, struct file *filp) { struct mkiss_channel *mkiss; - int chan; + int chan; chan = MINOR(tty->device) - tty->driver.minor_start; @@ -966,11 +966,11 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file, unsigned int c case TIOCMGET: case TIOCMBIS: case TIOCMBIC: - case TIOCMSET: + case TIOCMSET: case TCSETS: case TCSETSF: /* should flush first, but... */ case TCSETSW: /* should wait until flush, but... */ - return 0; + return 0; default: return -ENOIOCTLCMD; } @@ -980,7 +980,7 @@ static int mkiss_ioctl(struct tty_struct *tty, struct file *file, unsigned int c static void mkiss_dummy(struct tty_struct *tty) { struct mkiss_channel *mkiss = tty->driver_data; - + if (tty == NULL) return; @@ -991,7 +991,7 @@ static void mkiss_dummy(struct tty_struct *tty) static void mkiss_dummy2(struct tty_struct *tty, unsigned char ch) { struct mkiss_channel *mkiss = tty->driver_data; - + if (tty == NULL) return; @@ -1043,7 +1043,7 @@ static int mkiss_init(void) mkiss_driver.magic = MKISS_DRIVER_MAGIC; mkiss_driver.name = "mkiss"; - mkiss_driver.major = MKISS_MAJOR; + mkiss_driver.major = MKISS_MAJOR; mkiss_driver.minor_start = 0; mkiss_driver.num = NR_MKISS; mkiss_driver.type = TTY_DRIVER_TYPE_SERIAL; @@ -1074,25 +1074,24 @@ static int mkiss_init(void) mkiss_driver.stop = mkiss_dummy; mkiss_driver.start = mkiss_dummy; mkiss_driver.hangup = mkiss_dummy; - mkiss_driver.flush_chars = mkiss_dummy; - mkiss_driver.put_char = mkiss_dummy2; - + mkiss_driver.flush_chars = mkiss_dummy; + mkiss_driver.put_char = mkiss_dummy2; + if (tty_register_driver(&mkiss_driver)) { printk(KERN_ERR "Couldn't register Mkiss device\n"); - return -EIO; - } + return -EIO; + } printk(KERN_INFO "AX.25 Multikiss device enabled\n"); - return 0; + return 0; } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { - register_symtab(NULL); - return mkiss_init_ctrl_dev(); } @@ -1106,7 +1105,7 @@ void cleanup_module(void) /* * VSV = if dev->start==0, then device * unregistred while close proc. - */ + */ if (ax25_ctrls[i]->dev.start) unregister_netdev(&(ax25_ctrls[i]->dev)); @@ -1119,11 +1118,11 @@ void cleanup_module(void) ax25_ctrls = NULL; } - if ((i = tty_register_ldisc(N_AX25, NULL))) + if ((i = tty_register_ldisc(N_AX25, NULL))) printk(KERN_ERR "mkiss: can't unregister line discipline (err = %d)\n", i); if (tty_unregister_driver(&mkiss_driver)) /* remove devive */ printk(KERN_ERR "mkiss: can't unregister MKISS device\n"); } - + #endif /* MODULE */ diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index 18ef6949fc07..4dd1a5ab5898 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c @@ -1163,7 +1163,7 @@ static int ni52_send_packet(struct sk_buff *skb, struct device *dev) return 0; if(skb->len > XMIT_BUFF_SIZE) { - printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %ld bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len); + printk("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n",dev->name,XMIT_BUFF_SIZE,skb->len); return 0; } diff --git a/drivers/net/pi2.c b/drivers/net/pi2.c index f96e4dfe7e8f..f172bfe0c071 100644 --- a/drivers/net/pi2.c +++ b/drivers/net/pi2.c @@ -39,7 +39,7 @@ init() so it doesn't migrate module based ethernet cards up to eth2 Took out the old module ideas as they are no longer relevant to the PI driver. - July 16, 1994 (dp) Fixed the B channel rx overrun problem ac referred to + July 16, 1994 (dp) Fixed the B channel rx overrun problem ac referred to above. Also added a bit of a hack to improve the maximum baud rate on the B channel (Search for STUFF2). Included ioctl stuff from John Paul Morrison. version 0.6 ALPHA @@ -51,7 +51,7 @@ version 0.8 ALPHA July 17, 1995 (ac) Finally polishing of AX25.030+ support Oct 29, 1995 (ac) A couple of minor fixes before this, and this release changes - to the proper set_mac_address semantics which will break + to the proper set_mac_address semantics which will break a few programs I suspect. Aug 18, 1996 (jsn) Converted to be used as a module. Dec 13, 1996 (jsn) Fixed to match Linux networking changes. @@ -124,16 +124,16 @@ struct mbuf { /* * The actual devices we will use */ - + /* * PI device declarations. */ - + static int pi0_preprobe(struct device *dev){return 0;} /* Dummy probe function */ static struct device pi0a = { "pi0a", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, pi0_preprobe }; static struct device pi0b = { "pi0b", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, pi0_preprobe }; - + /* The number of low I/O ports used by the card. */ #define PI_TOTAL_SIZE 8 @@ -688,7 +688,7 @@ static void b_txint(struct pi_local *lp) * Tx OFF now - flag should have gone */ rts(lp, OFF); - + restore_flags(flags); return; } @@ -831,7 +831,7 @@ static void b_exint(struct pi_local *lp) c = *lp->txptr++; /* Wait for tx buffer empty */ while((rdscc(lp->cardbase, cmd, R0) & 0x04) == 0) - ; + ; wrtscc(lp->cardbase, cmd, R8, c); } #endif @@ -896,7 +896,7 @@ static void b_exint(struct pi_local *lp) c = *lp->txptr++; /* Wait for tx buffer empty */ while((rdscc(lp->cardbase, cmd, R0) & 0x04) == 0) - ; + ; wrtscc(lp->cardbase, cmd, R8, c); } #endif @@ -1225,9 +1225,9 @@ int pi_init(void) be rejected by get_dma_buffer(). */ register_netdev(&pi0a); - + pi0a.priv = kmalloc(sizeof(struct pi_local) + (DMA_BUFF_SIZE + sizeof(struct mbuf)) * 4, GFP_KERNEL | GFP_DMA); - + pi0a.dma = PI_DMA; pi0a.base_addr = ioaddr + 2; pi0a.irq = 0; @@ -1244,7 +1244,7 @@ int pi_init(void) pi_probe(&pi0b, card_type); pi0b.irq = pi0a.irq; /* IRQ is shared */ - + return 0; } @@ -1510,7 +1510,7 @@ static void pi_interrupt(int reg_ptr, void *dev_id, struct pt_regs *regs) printk(KERN_ERR "PI: pi_interrupt(): irq %d for unknown device.\n", irq); return; } -#endif +#endif /* Read interrupt status register (only valid from channel A) * Process all pending interrupts in while loop */ @@ -1591,7 +1591,7 @@ static int pi_ioctl(struct device *dev, struct ifreq *ifr, int cmd) int ret = verify_area(VERIFY_WRITE, ifr->ifr_data, sizeof(struct pi_req)); if (ret) return ret; - + if(cmd!=SIOCDEVPRIVATE) return -EINVAL; @@ -1628,7 +1628,7 @@ static int pi_ioctl(struct device *dev, struct ifreq *ifr, int cmd) pi_close(dev); free_dma(lp->dmachan); dev->dma = lp->dmachan = rq.dmachan; - if (request_dma(lp->dmachan,"pi2")) + if (request_dma(lp->dmachan,"pi2")) ret = -EAGAIN; pi_open(dev); restore_flags(flags); @@ -1672,9 +1672,10 @@ static struct netstats * } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - register_symtab(NULL); return pi_init(); } diff --git a/drivers/net/ppp.c b/drivers/net/ppp.c index 96e6f79ddc97..06bb554177e9 100644 --- a/drivers/net/ppp.c +++ b/drivers/net/ppp.c @@ -246,7 +246,7 @@ static ppp_ctrl_t *ppp_list = NULL; static char ppp_warning[] = KERN_WARNING "PPP: ALERT! not INUSE! %d\n"; static char szVersion[] = PPP_VERSION; - + /* * Information for the protocol decoder */ @@ -347,13 +347,13 @@ ppp_first_time (void) "TCP compression code copyright 1989 Regents of the " "University of California\n"); #endif - + printk (KERN_INFO "PPP Dynamic channel allocation code copyright 1995 " "Caldera, Inc.\n"); /* * Register the tty discipline - */ + */ (void) memset (&ppp_ldisc, 0, sizeof (ppp_ldisc)); ppp_ldisc.magic = TTY_LDISC_MAGIC; ppp_ldisc.open = ppp_tty_open; @@ -365,7 +365,7 @@ ppp_first_time (void) ppp_ldisc.receive_room = ppp_tty_room; ppp_ldisc.receive_buf = ppp_tty_receive; ppp_ldisc.write_wakeup = ppp_tty_wakeup; - + status = tty_register_ldisc (N_PPP, &ppp_ldisc); if (status == 0) printk (KERN_INFO "PPP line discipline registered.\n"); @@ -454,13 +454,9 @@ ppp_init_ctrl_blk (register struct ppp *ppp) ppp->sc_rc_state = NULL; } -static struct symbol_table ppp_syms = { -#include - X(ppp_register_compressor), - X(ppp_unregister_compressor), - X(ppp_crc16_table), -#include -}; +EXPORT_SYMBOL(ppp_register_compressor); +EXPORT_SYMBOL(ppp_unregister_compressor); +EXPORT_SYMBOL(ppp_crc16_table); /* called at boot/load time for each ppp device defined in the kernel */ @@ -474,8 +470,6 @@ ppp_init (struct device *dev) if (first_time) { first_time = 0; answer = ppp_first_time(); - if (answer == 0) - (void) register_symtab (&ppp_syms); } if (answer == 0) answer = -ENODEV; @@ -576,7 +570,7 @@ ppp_changedmtu (struct ppp *ppp, int new_mtu, int new_mru) mru = PPP_MRU; mru += 10; - + if (ppp->flags & SC_DEBUG) printk (KERN_INFO "ppp: channel %s mtu = %d, mru = %d\n", dev->name, new_mtu, new_mru); @@ -2168,7 +2162,7 @@ ppp_set_compression (struct ppp *ppp, struct ppp_option_data *odp) ptr = data.ptr; if ((__u32) nb >= (__u32)CCP_MAX_OPTION_LENGTH) nb = CCP_MAX_OPTION_LENGTH; - + error = verify_area (VERIFY_READ, ptr, nb); } @@ -3179,7 +3173,7 @@ ppp_find (int pid_value) /* try to find the exact same free device which we had before */ ctl = ppp_list; if_num = 0; - + while (ctl) { ppp = ctl2ppp (ctl); if (!set_bit(0, &ppp->inuse)) { @@ -3209,7 +3203,7 @@ ppp_alloc (void) /* try to find an free device */ ctl = ppp_list; if_num = 0; - + while (ctl) { ppp = ctl2ppp (ctl); if (!set_bit(0, &ppp->inuse)) @@ -3233,7 +3227,7 @@ ppp_alloc (void) ppp->line = if_num; ppp->tty = NULL; ppp->dev = dev; - + dev->next = NULL; dev->init = ppp_init_dev; dev->name = ctl->name; @@ -3241,7 +3235,7 @@ ppp_alloc (void) dev->priv = (void *) ppp; sprintf (dev->name, "ppp%d", if_num); - + /* link in the new channel */ ctl->next = ppp_list; ppp_list = ctl; @@ -3424,8 +3418,7 @@ init_module(void) if (status != 0) printk (KERN_INFO "PPP: ppp_init() failure %d\n", status); - else - (void) register_symtab (&ppp_syms); + return (status); } @@ -3480,7 +3473,7 @@ cleanup_module(void) "PPP: ppp line discipline successfully unregistered\n"); /* * De-register the devices so that there is no problem with them - */ + */ next_ctl = ppp_list; while (next_ctl) { ctl = next_ctl; diff --git a/drivers/net/pt.c b/drivers/net/pt.c index 8188433d68a2..bc9620adbdd7 100644 --- a/drivers/net/pt.c +++ b/drivers/net/pt.c @@ -36,8 +36,8 @@ * pt_loopback functions - they were unused. * 13/12/96 jsn Fixed to match Linux networking changes. */ - -/* + +/* * default configuration of the PackeTwin, * ie What Craig uses his PT for. */ @@ -172,7 +172,7 @@ static void switchbuffers(struct pt_local *lp) else lp->rcvbuf = lp->rxdmabuf1; } - + static void hardware_send_packet(struct pt_local *lp, struct sk_buff *skb) { char kickflag; @@ -214,7 +214,7 @@ static void hardware_send_packet(struct pt_local *lp, struct sk_buff *skb) } /*switch */ return; } - + lp->stats.tx_packets++; save_flags(flags); @@ -224,18 +224,18 @@ static void hardware_send_packet(struct pt_local *lp, struct sk_buff *skb) #ifdef PT_DEBUG printk(KERN_DEBUG "PT: hardware_send_packet(): kickflag = %d (%d).\n", kickflag, lp->base & CHANA); -#endif +#endif skb_queue_tail(&lp->sndq, skb); if (kickflag) { /* Simulate interrupt to transmit */ if (lp->dmachan) - { + { pt_txisr(lp); } else { save_flags(flags); cli(); if (lp->tstate == IDLE) - pt_txisr(lp); + pt_txisr(lp); restore_flags(flags); } } @@ -331,7 +331,7 @@ static void scc_init(struct device *dev) #ifdef PT_DEBUG printk(KERN_DEBUG "PT: scc_init(): (%d).\n", lp->base & CHANA); -#endif +#endif save_flags(flags); cli(); @@ -344,26 +344,26 @@ static void scc_init(struct device *dev) } else { wrtscc(lp->cardbase, cmd, R9, CHRB); /* Reset channel B */ } - + /* Deselect all Rx and Tx interrupts */ wrtscc(lp->cardbase, cmd, R1, 0); - + /* Turn off external interrupts (like CTS/CD) */ wrtscc(lp->cardbase, cmd, R15, 0); - + /* X1 clock, SDLC mode */ wrtscc(lp->cardbase, cmd, R4, SDLC | X1CLK); - + /* Preset CRC and set mode */ if (lp->nrzi) { /* Preset Tx CRC, put into NRZI mode */ - wrtscc(lp->cardbase, cmd, R10, CRCPS | NRZI); + wrtscc(lp->cardbase, cmd, R10, CRCPS | NRZI); } else { /* Preset Tx CRC, put into NRZ mode */ - wrtscc(lp->cardbase, cmd, R10, CRCPS); + wrtscc(lp->cardbase, cmd, R10, CRCPS); } - + /* Tx/Rx parameters */ if (lp->speed) /* Use internal clocking */ { @@ -375,7 +375,7 @@ static void scc_init(struct device *dev) wrtscc(lp->cardbase, cmd, R11, TCTRxCP | RCRTxCP | TRxCBR); wrtscc(lp->cardbase,cmd, R14, 0); /* wiz1 */ } - + /* Null out SDLC start address */ wrtscc(lp->cardbase, cmd, R6, 0); @@ -397,12 +397,12 @@ static void scc_init(struct device *dev) br = lp->speed; tc = ((lp->xtal / 32) / (br * 2)) - 2; wrtscc(lp->cardbase, cmd, R12, tc & 0xff); /* lower byte */ - wrtscc(lp->cardbase, cmd, R13, (tc >> 8) & 0xff); /* upper byte */ + wrtscc(lp->cardbase, cmd, R13, (tc >> 8) & 0xff); /* upper byte */ } /* Turn transmitter off, to setup stuff */ pt_rts(lp, OFF); - + /* External clocking */ if (lp->speed) { @@ -415,7 +415,7 @@ static void scc_init(struct device *dev) if (lp->base & CHANA) outb_p( (pt_sercfg &= ~PT_EXTCLKA), (lp->cardbase + SERIAL_CFG) ); else - outb_p( (pt_sercfg &= ~PT_EXTCLKB), (lp->cardbase + SERIAL_CFG) ); + outb_p( (pt_sercfg &= ~PT_EXTCLKB), (lp->cardbase + SERIAL_CFG) ); } else { /* DPLL frm rtxc,BRG src PCLK */ /* wrtscc(lp->cardbase, cmd, R14, BRSRC | SSRTxC);*/ @@ -423,14 +423,14 @@ static void scc_init(struct device *dev) if (lp->base & CHANA) outb_p( (pt_sercfg |= PT_EXTCLKA), (lp->cardbase + SERIAL_CFG) ); else - outb_p( (pt_sercfg |= PT_EXTCLKB), (lp->cardbase + SERIAL_CFG) ); + outb_p( (pt_sercfg |= PT_EXTCLKB), (lp->cardbase + SERIAL_CFG) ); } - if (!lp->dmachan) + if (!lp->dmachan) wrtscc(lp->cardbase, cmd, R1, (INT_ALL_Rx | EXT_INT_ENAB)); wrtscc(lp->cardbase, cmd, R15, BRKIE); /* ABORT int */ - + /* Turn on the DTR to tell modem we're alive */ if (lp->base & CHANA) outb_p( (pt_sercfg |= PT_DTRA_ON), (lp->cardbase + SERIAL_CFG) ); @@ -439,7 +439,7 @@ static void scc_init(struct device *dev) /* Now, turn on the receiver and hunt for a flag */ wrtscc(lp->cardbase, cmd, R3, RxENABLE | RxCRC_ENAB | AUTO_ENAB | Rx8 ); - + restore_flags(flags); } /* scc_init() */ @@ -451,11 +451,11 @@ static void chipset_init(struct device *dev) struct pt_local *lp = (struct pt_local*) dev->priv; #ifdef PT_DEBUG printk(KERN_DEBUG "PT: chipset_init(): pt0a tstate = %d.\n", ((struct pt_local*)pt0a.priv)->tstate); - printk(KERN_DEBUG "PT: chipset_init(): pt0b tstate = %d.\n", ((struct pt_local*)pt0b.priv)->tstate); + printk(KERN_DEBUG "PT: chipset_init(): pt0b tstate = %d.\n", ((struct pt_local*)pt0b.priv)->tstate); #endif /* Reset SCC if both channels are to be canned */ if ( ((lp->base & CHANA) && !(pt_sercfg & PT_DTRB_ON)) || - (!(lp->base & CHANA) && !(pt_sercfg & PT_DTRA_ON)) ) + (!(lp->base & CHANA) && !(pt_sercfg & PT_DTRA_ON)) ) { wrtscc(lp->cardbase, lp->base + CTL, R9, FHWRES); /* Reset int and dma registers */ @@ -463,7 +463,7 @@ static void chipset_init(struct device *dev) outb_p((pt_dmacfg = 0), lp->cardbase + DMA_CFG); #ifdef PT_DEBUG printk(KERN_DEBUG "PT: chipset_init() Resetting SCC, called by ch (%d).\n", lp->base & CHANA); -#endif +#endif } /* Reset individual channel */ if (lp->base & CHANA) { @@ -471,11 +471,11 @@ static void chipset_init(struct device *dev) outb_p( (pt_sercfg &= ~PT_DTRA_ON), lp->cardbase + SERIAL_CFG); } else { wrtscc(lp->cardbase, lp->base + CTL, R9, MIE | DLC | NV | CHRB); - outb_p( (pt_sercfg &= ~PT_DTRB_ON), lp->cardbase + SERIAL_CFG); - } -} /* chipset_init() */ - - + outb_p( (pt_sercfg &= ~PT_DTRB_ON), lp->cardbase + SERIAL_CFG); + } +} /* chipset_init() */ + + int pt_init(void) { @@ -532,7 +532,7 @@ int pt_init(void) pt_probe(&pt0b); pt0b.irq = pt0a.irq; /* IRQ is shared */ - + return 0; } /* pt_init() */ @@ -545,7 +545,7 @@ static int hw_probe(int ioaddr) int a = 1; int b = 1; unsigned long start_time, end_time; - + inb_p(ioaddr + TMR1CLR); inb_p(ioaddr + TMR2CLR); @@ -558,7 +558,7 @@ static int hw_probe(int ioaddr) outb_p(SC1 | LSB_MSB | MODE0, ioaddr + TMRCMD); outb_p((time << 1) & 0xff, ioaddr + TMR1); outb_p((time >> 7) & 0xff, ioaddr + TMR1); - + /* wait until counter reg is loaded */ do { /* Latch count for reading */ @@ -581,20 +581,20 @@ static int hw_probe(int ioaddr) return 0; } } - + /* Now fix the timers up for general operation */ - + /* Clear the timers */ inb_p(ioaddr + TMR1CLR); inb_p(ioaddr + TMR2CLR); - + outb_p(SC1 | LSB_MSB | MODE0, ioaddr + TMRCMD); inb_p(ioaddr + TMR1CLR); - + outb_p(SC2 | LSB_MSB | MODE0, ioaddr + TMRCMD); /* Should this be tmr1 or tmr2? wiz3*/ inb_p(ioaddr + TMR1CLR); - + return 1; } /* hw_probe() */ @@ -606,13 +606,13 @@ static void pt_rts(struct pt_local *lp, int x) int cmd = lp->base + CTL; #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_rts(): Transmitter status will be %d (%d).\n", x, lp->base & CHANA); -#endif +#endif if (x == ON) { /* Ex ints off to avoid int */ wrtscc(lp->cardbase, cmd, R15, 0); wrtscc(lp->cardbase, cmd, R3, AUTO_ENAB | Rx8); /* Rx off */ lp->rstate = IDLE; - + if(lp->dmachan) { /* Setup for Tx DMA */ @@ -621,7 +621,7 @@ static void pt_rts(struct pt_local *lp, int x) /* No interrupts */ wrtscc(lp->cardbase, cmd, R1, 0); } - + if (!lp->clockmode) { if (lp->speed) @@ -637,7 +637,7 @@ static void pt_rts(struct pt_local *lp, int x) /* Transmitter on now */ } else { /* turning off Tx */ lp->tstate = IDLE; - + /* Turn off Tx by dropping RTS */ wrtscc(lp->cardbase, cmd, R5, Tx8 | DTR); if (!lp->clockmode) @@ -651,7 +651,7 @@ static void pt_rts(struct pt_local *lp, int x) tc = ((lp->xtal / 32) / (br * 2)) - 2; wrtscc(lp->cardbase, cmd, R12, tc & 0xff); wrtscc(lp->cardbase, cmd, R13, (tc >> 8) & 0xff); - + /* SEARCH mode, BRG source */ wrtscc(lp->cardbase, cmd, R14, BRSRC | SEARCH); /* Enable the BRG */ @@ -661,23 +661,23 @@ static void pt_rts(struct pt_local *lp, int x) /* Flush Rx fifo */ /* Turn Rx off */ wrtscc(lp->cardbase, cmd, R3, AUTO_ENAB | Rx8); - + /* Reset error latch */ wrtscc(lp->cardbase, cmd, R0, ERR_RES); - + /* get status byte from R1 */ (void) rdscc(lp->cardbase, cmd, R1); - + /* Read and dump data in queue */ (void) rdscc(lp->cardbase, cmd, R8); (void) rdscc(lp->cardbase, cmd, R8); (void) rdscc(lp->cardbase, cmd, R8); - + /* Now, turn on Rx and hunt for a flag */ wrtscc(lp->cardbase, cmd, R3, RxENABLE | AUTO_ENAB | Rx8 ); - + lp->rstate = ACTIVE; - + if (lp->dmachan) { setup_rx_dma(lp); @@ -691,9 +691,9 @@ static void pt_rts(struct pt_local *lp, int x) } wrtscc(lp->cardbase, cmd, R15, BRKIE ); } -} /* pt_rts() */ - - +} /* pt_rts() */ + + static int valid_dma_page(unsigned long addr, unsigned long dev_bufsize) { if (((addr & 0xffff) + dev_bufsize) <= 0x10000) @@ -708,7 +708,7 @@ static int pt_set_mac_address(struct device *dev, void *addr) memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); /* addr is an AX.25 shifted ASCII */ return 0; /* mac address */ } - + /* Allocate a buffer which does not cross a DMA page boundary */ static char * get_dma_buffer(unsigned long *mem_ptr) @@ -765,11 +765,11 @@ static int pt_probe(struct device *dev) lp->base = dev->base_addr; lp->cardbase = dev->base_addr & 0x3f0; - + /* These need to be initialised before scc_init() is called. */ lp->xtal = XTAL; - + if (dev->base_addr & CHANA) { lp->speed = DEF_A_SPEED; lp->txdelay = DEF_A_TXDELAY; @@ -801,10 +801,10 @@ static int pt_probe(struct device *dev) * properly first!! */ lp->dmachan = 0; - + if (dev->irq < 2) { autoirq_setup(0); - + /* Turn on PT interrupts */ save_flags(flags); cli(); @@ -818,7 +818,7 @@ static int pt_probe(struct device *dev) /* Turn off PT interrupts */ save_flags(flags); cli(); - outb_p( (pt_sercfg &= ~ PT_EI), lp->cardbase + INT_CFG); + outb_p( (pt_sercfg &= ~ PT_EI), lp->cardbase + INT_CFG); restore_flags(flags); if (!dev->irq) { @@ -893,7 +893,7 @@ static int pt_open(struct device *dev) unsigned long flags; struct pt_local *lp = dev->priv; static first_time = 1; - + if (dev->base_addr & CHANA) { if (first_time) @@ -905,12 +905,12 @@ static int pt_open(struct device *dev) } } irq2dev_map[dev->irq] = dev; - - /* Reset hardware */ + + /* Reset hardware */ chipset_init(dev); } lp->tstate = IDLE; - + if (dev->base_addr & CHANA) { scc_init(dev); @@ -919,12 +919,12 @@ static int pt_open(struct device *dev) /* Save a copy of register RR0 for comparing with later on */ /* We always put 0 in zero count */ lp->saved_RR0 = rdscc(lp->cardbase, lp->base + CTL, R0) & ~ZCOUNT; - + /* master interrupt enable */ save_flags(flags); cli(); wrtscc(lp->cardbase, lp->base + CTL, R9, MIE | NV); - outb_p( pt_sercfg |= PT_EI, lp->cardbase + INT_CFG); + outb_p( pt_sercfg |= PT_EI, lp->cardbase + INT_CFG); restore_flags(flags); lp->open_time = jiffies; @@ -935,7 +935,7 @@ static int pt_open(struct device *dev) first_time = 0; MOD_INC_USE_COUNT; - + return 0; } /* pt_open() */ @@ -945,7 +945,7 @@ static int pt_send_packet(struct sk_buff *skb, struct device *dev) #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_send_packet(): (%d)\n", lp->base & CHANA); -#endif +#endif /* If some higher layer thinks we've missed an tx-done interrupt we are passed NULL. Caution: dev_tint() handles the cli()/sti() itself.*/ @@ -955,11 +955,11 @@ static int pt_send_packet(struct sk_buff *skb, struct device *dev) } hardware_send_packet(lp, skb); dev->trans_start = jiffies; - + return 0; } - - + + /* The inverse routine to pt_open() */ static int pt_close(struct device *dev) @@ -970,12 +970,12 @@ static int pt_close(struct device *dev) int cmd; cmd = lp->base + CTL; - + save_flags(flags); cli(); - + /* Reset SCC or channel */ - chipset_init(dev); + chipset_init(dev); disable_dma(lp->dmachan); lp->open_time = 0; @@ -985,15 +985,15 @@ static int pt_close(struct device *dev) /* Free any buffers left in the hardware transmit queue */ while ((ptr = skb_dequeue(&lp->sndq)) != NULL) free_p(ptr); - + restore_flags(flags); - + #ifdef PT_DEBUG - printk(KERN_DEBUG "PT: pt_close(): Closing down channel (%d).\n", lp->base & CHANA); -#endif + printk(KERN_DEBUG "PT: pt_close(): Closing down channel (%d).\n", lp->base & CHANA); +#endif MOD_DEC_USE_COUNT; - + return 0; } /* pt_close() */ @@ -1010,7 +1010,7 @@ static int pt_ioctl(struct device *dev, struct ifreq *ifr, int cmd) if (cmd != SIOCDEVPRIVATE) return -EINVAL; - + copy_from_user(&rq, ifr->ifr_data, sizeof(struct pt_req)); switch (rq.cmd) { @@ -1044,7 +1044,7 @@ static int pt_ioctl(struct device *dev, struct ifreq *ifr, int cmd) pt_close(dev); free_dma(lp->dmachan); dev->dma = lp->dmachan = rq.dmachan; - if (request_dma(lp->dmachan,"pt")) + if (request_dma(lp->dmachan,"pt")) ret = -EAGAIN; pt_open(dev); restore_flags(flags); @@ -1103,7 +1103,7 @@ static void tdelay(struct pt_local *lp, int time) /* For some reason, we turn off the Tx interrupts here! */ if (!lp->dmachan) wrtscc(lp->cardbase, lp->base + CTL, R1, INT_ALL_Rx | EXT_INT_ENAB); - + if (lp->base & CHANA) { outb_p(time & 0xff, lp->cardbase + TMR1); outb_p((time >> 8)&0xff, lp->cardbase + TMR1); @@ -1119,23 +1119,23 @@ static void pt_txisr(struct pt_local *lp) unsigned long flags; int cmd; unsigned char c; - + save_flags(flags); cli(); cmd = lp->base + CTL; #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_txisr(): tstate = %d (%d).\n", lp->tstate, lp->base & CHANA); -#endif - - switch (lp->tstate) +#endif + + switch (lp->tstate) { case CRCOUT: lp->tstate = FLAGOUT; tdelay(lp, lp->squeldelay); restore_flags(flags); return; - + case IDLE: /* Transmitter idle. Find a frame for transmission */ if ((lp->sndbuf = skb_dequeue(&lp->sndq)) == NULL) @@ -1144,7 +1144,7 @@ static void pt_txisr(struct pt_local *lp) * Tx off now - flag should have gone */ pt_rts(lp, OFF); - + restore_flags(flags); return; } @@ -1155,7 +1155,7 @@ static void pt_txisr(struct pt_local *lp) lp->txcnt = (int) lp->sndbuf->len - 1; } /* If a buffer to send, drop though here */ - + case DEFER: /* Check DCD - debounce it */ /* See Intel Microcommunications Handbook p2-308 */ @@ -1184,12 +1184,12 @@ static void pt_txisr(struct pt_local *lp) tdelay(lp, lp->txdelay); restore_flags(flags); return; - + case ACTIVE: /* Here we are actively sending a frame */ if (lp->txcnt--) { - /* XLZ - checkout Gracilis PT code to see if the while + /* XLZ - checkout Gracilis PT code to see if the while * loop is better or not. */ c = *lp->txptr++; @@ -1228,7 +1228,7 @@ static void pt_txisr(struct pt_local *lp) printk(KERN_ERR "PT: pt_txisr(): Invalid tstate (%d) for chan %s.\n", lp->tstate, (cmd & CHANA? "A": "B") ); pt_rts(lp, OFF); lp->tstate = IDLE; - break; + break; } /*switch */ restore_flags(flags); } @@ -1250,15 +1250,15 @@ static void pt_rxisr(struct device *dev) /* Get status byte from R1 */ rse = rdscc(lp->cardbase, cmd, R1); - + #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_rxisr(): R1 = %#3x. (%d)\n", rse, lp->base & CHANA); -#endif +#endif if (lp->dmachan && (rse & Rx_OVR)) lp->rstate = RXERROR; - - if (rdscc(lp->cardbase, cmd, R0) & Rx_CH_AV && !lp->dmachan) + + if (rdscc(lp->cardbase, cmd, R0) & Rx_CH_AV && !lp->dmachan) { /* There is a char to be stored * Read special condition bits before reading the data char @@ -1291,22 +1291,22 @@ static void pt_rxisr(struct device *dev) (void) rdscc(lp->cardbase, cmd, R8); (void) rdscc(lp->cardbase, cmd, R8); (void) rdscc(lp->cardbase, cmd, R8); - + /* Reset error latch */ wrtscc(lp->cardbase, cmd, R0, ERR_RES); lp->rstate = ACTIVE; - + /* Resync the SCC */ wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); - + } } - + if (rse & END_FR) { #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_rxisr() Got end of a %u byte frame.\n", lp->rcvbuf->cnt); -#endif +#endif if (lp->dmachan) { clear_dma_ff(lp->dmachan); @@ -1314,7 +1314,7 @@ static void pt_rxisr(struct device *dev) } else { bytecount = lp->rcvbuf->cnt; } - + /* END OF FRAME - Make sure Rx was active */ if (lp->rcvbuf->cnt > 0 || lp->dmachan) { @@ -1339,12 +1339,12 @@ static void pt_rxisr(struct device *dev) lp->rcvbuf->cnt = 0; /* Re-sync the SCC */ - wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); - + wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); + } #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_rxisr() %s error.\n", (rse & CRC_ERR)? "CRC" : "state"); -#endif +#endif } else { /* We have a valid frame */ if (lp->dmachan) @@ -1353,11 +1353,11 @@ static void pt_rxisr(struct device *dev) /* Get buffer for next frame */ cur_buf = lp->rcvbuf; switchbuffers(lp); - setup_rx_dma(lp); + setup_rx_dma(lp); } else { pkt_len = lp->rcvbuf->cnt -= 2; /* Toss 2 CRC bytes */ pkt_len += 1; /* make room for KISS control byte */ - } + } /* Malloc up new buffer */ sksize = pkt_len; @@ -1370,7 +1370,7 @@ static void pt_rxisr(struct device *dev) return; } skb->dev = dev; - + /* KISS kludge = prefix with a 0 byte */ cfix=skb_put(skb,pkt_len); *cfix++=0; @@ -1411,13 +1411,13 @@ static void pt_tmrisr(struct pt_local *lp) #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_tmrisr(): tstate = %d (%d).\n", lp->tstate, lp->base & CHANA); -#endif - +#endif + save_flags(flags); cli(); - - - switch (lp->tstate) + + + switch (lp->tstate) { /* Most of this stuff is in pt_exisr() */ case FLAGOUT: @@ -1426,19 +1426,19 @@ static void pt_tmrisr(struct pt_local *lp) /* case ACTIVE: case UNDERRUN:*/ pt_exisr(lp); - break; - + break; + default: if (lp->base & CHANA) printk(KERN_ERR "PT: pt_tmrisr(): Invalid tstate %d for Channel A\n", lp->tstate); else printk(KERN_ERR "PT: pt_tmrisr(): Invalid tstate %d for Channel B\n", lp->tstate); - break; + break; } /* end switch */ restore_flags(flags); } /* pt_tmrisr() */ - + /* * This routine is called by the kernel when there is an interrupt for the * PT. @@ -1452,7 +1452,7 @@ static void pt_interrupt(int irq, void *dev_id, struct pt_regs *regs) unsigned char st; register int cbase = dev->base_addr & 0x3f0; unsigned long flags; - + /* Read the PT's interrupt register, this is not the SCC one! */ intreg = inb_p(cbase + INT_REG); while(( intreg & 0x07) != 0x07) { @@ -1462,11 +1462,11 @@ static void pt_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* Read interrupt vector from R2, channel B */ #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_interrupt(): R3 = %#3x", st); -#endif +#endif /* st = rdscc(lp->cardbase, cbase + CHANB + CTL, R2) & 0x0e;*/ #ifdef PT_DEBUG printk(KERN_DEBUG "PI: R2 = %#3x.\n", st); -#endif +#endif if (st & CHARxIP) { /* Channel A Rx */ lp = (struct pt_local*)pt0a.priv; @@ -1498,7 +1498,7 @@ static void pt_interrupt(int irq, void *dev_id, struct pt_regs *regs) wrtscc(lp->cardbase, lp->base + CTL, R0, RES_H_IUS); restore_flags(flags); } /* end of SCC ints */ - + if (!(intreg & PT_TMR1_MSK)) { /* Clear timer 1 */ @@ -1528,19 +1528,19 @@ static void pt_exisr(struct pt_local *lp) unsigned char st; char c; int length; - + save_flags(flags); cli(); - + /* Get external status */ st = rdscc(lp->cardbase, cmd, R0); #ifdef PT_DEBUG printk(KERN_DEBUG "PT: exisr(): R0 = %#3x tstate = %d (%d).\n", st, lp->tstate, lp->base & CHANA); -#endif +#endif /* Reset external status latch */ wrtscc(lp->cardbase, cmd, R0, RES_EXT_INT); - + if ((lp->rstate >= ACTIVE) && (st & BRK_ABRT) && lp->dmachan) { setup_rx_dma(lp); @@ -1552,7 +1552,7 @@ static void pt_exisr(struct pt_local *lp) case ACTIVE: /* Unexpected underrun */ #ifdef PT_DEBUG printk(KERN_DEBUG "PT: exisr(): unexpected underrun detected.\n"); -#endif +#endif free_p(lp->sndbuf); lp->sndbuf = NULL; if (!lp->dmachan) @@ -1565,7 +1565,7 @@ static void pt_exisr(struct pt_local *lp) tdelay(lp, lp->squeldelay); restore_flags(flags); return; - case UNDERRUN: + case UNDERRUN: lp->tstate = CRCOUT; restore_flags(flags); return; @@ -1587,47 +1587,47 @@ static void pt_exisr(struct pt_local *lp) lp->txcnt = (int) lp->sndbuf->len - 1; } /* Fall through if we have a packet */ - + case ST_TXDELAY: if (lp->dmachan) { /* Disable DMA chan */ disable_dma(lp->dmachan); - + /* Set up for TX dma */ wrtscc(lp->cardbase, cmd, R1, WT_FN_RDYFN | EXT_INT_ENAB); - + length = lp->sndbuf->len - 1; memcpy(lp->txdmabuf, &lp->sndbuf->data[1], length); - + /* Setup DMA controller for Tx */ setup_tx_dma(lp, length); - + enable_dma(lp->dmachan); - + /* Reset CRC, Txint pending */ wrtscc(lp->cardbase, cmd, R0, RES_Tx_CRC | RES_Tx_P); - + /* Allow underrun only */ wrtscc(lp->cardbase, cmd, R15, TxUIE); - + /* Enable TX DMA */ wrtscc(lp->cardbase, cmd, R1, WT_RDY_ENAB | WT_FN_RDYFN | EXT_INT_ENAB); - + /* Send CRC on underrun */ wrtscc(lp->cardbase, cmd, R0, RES_EOM_L); - + lp->tstate = ACTIVE; break; - } + } /* Get first char to send */ lp->txcnt--; c = *lp->txptr++; /* Reset CRC for next frame */ wrtscc(lp->cardbase, cmd, R0, RES_Tx_CRC); - + /* send abort on underrun */ - if (lp->nrzi) + if (lp->nrzi) { wrtscc(lp->cardbase, cmd, R10, CRCPS | NRZI | ABUNDER); } else { @@ -1635,10 +1635,10 @@ static void pt_exisr(struct pt_local *lp) } /* send first char */ wrtscc(lp->cardbase, cmd, R8, c); - + /* Reset end of message latch */ wrtscc(lp->cardbase, cmd, R0, RES_EOM_L); - + /* stuff an extra one in */ /* while ((rdscc(lp->cardbase, cmd, R0) & Tx_BUF_EMP) && lp->txcnt) { @@ -1646,21 +1646,21 @@ static void pt_exisr(struct pt_local *lp) c = *lp->txptr++; wrtscc(lp->cardbase, cmd, R8, c); }*/ - + /* select Tx interrupts to enable */ /* Allow underrun int only */ wrtscc(lp->cardbase, cmd, R15, TxUIE); - + /* Reset external interrupts */ wrtscc(lp->cardbase, cmd, R0, RES_EXT_INT); - + /* Tx and Rx ints enabled */ wrtscc(lp->cardbase, cmd, R1, TxINT_ENAB | EXT_INT_ENAB); - + lp->tstate = ACTIVE; restore_flags(flags); return; - + /* slotime has timed out */ case DEFER: /* Check DCD - debounce it @@ -1691,14 +1691,14 @@ static void pt_exisr(struct pt_local *lp) tdelay(lp, lp->txdelay); restore_flags(flags); return; - + /* Only for int driven parts */ if (lp->dmachan) { restore_flags(flags); return; } - + } /* end switch */ /* * Rx mode only @@ -1710,24 +1710,24 @@ static void pt_exisr(struct pt_local *lp) { #ifdef PT_DEBUG printk(KERN_DEBUG "PT: exisr(): abort detected.\n"); -#endif +#endif /* read and dump all of SCC Rx FIFO */ (void) rdscc(lp->cardbase, cmd, R8); (void) rdscc(lp->cardbase, cmd, R8); - (void) rdscc(lp->cardbase, cmd, R8); - + (void) rdscc(lp->cardbase, cmd, R8); + lp->rcp = lp->rcvbuf->data; lp->rcvbuf->cnt = 0; - + /* Re-sync the SCC */ - wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); + wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); } - + /* Check for DCD transitions */ if ( (st & DCD) != (lp->saved_RR0 & DCD)) { -#ifdef PT_DEBUG +#ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_exisr(): DCD is now %s.\n", (st & DCD)? "ON" : "OFF" ); #endif if (st & DCD) @@ -1737,13 +1737,13 @@ static void pt_exisr(struct pt_local *lp) { #ifdef PT_DEBUG printk(KERN_DEBUG "PT: pt_exisr() dumping %u bytes from buffer.\n", lp->rcvbuf->cnt); -#endif +#endif /* wind back buffers */ lp->rcp = lp->rcvbuf->data; lp->rcvbuf->cnt = 0; } } else { /* DCD off */ - + /* read and dump al SCC FIFO */ (void)rdscc(lp->cardbase, cmd, R8); (void)rdscc(lp->cardbase, cmd, R8); @@ -1752,11 +1752,11 @@ static void pt_exisr(struct pt_local *lp) /* wind back buffers */ lp->rcp = lp->rcvbuf->data; lp->rcvbuf->cnt = 0; - + /* Re-sync the SCC */ - wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); - } - + wrtscc(lp->cardbase, cmd, R3, RxENABLE | ENT_HM | AUTO_ENAB | Rx8); + } + } /* Update the saved version of register RR) */ lp->saved_RR0 = st &~ ZCOUNT; @@ -1765,9 +1765,10 @@ static void pt_exisr(struct pt_local *lp) } /* pt_exisr() */ #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - register_symtab(NULL); return pt_init(); } @@ -1780,7 +1781,7 @@ void cleanup_module(void) kfree(pt0a.priv); pt0a.priv = NULL; unregister_netdev(&pt0a); - + kfree(pt0b.priv); pt0b.priv = NULL; unregister_netdev(&pt0b); diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c index 3071c2323a4d..35d9335c409f 100644 --- a/drivers/net/slhc.c +++ b/drivers/net/slhc.c @@ -87,7 +87,6 @@ static unsigned char *encode(unsigned char *cp, unsigned short n); static long decode(unsigned char **cpp); static unsigned char * put16(unsigned char *cp, unsigned short x); static unsigned short pull16(unsigned char **cpp); -static void export_slhc_syms(void); /* Initialize compression data structure * slots must be in range 0 to 255 (zero meaning no compression) @@ -720,30 +719,20 @@ void slhc_o_status(struct slcompress *comp) } } -static struct symbol_table slhc_syms = { /* Should this be surrounded with "#ifdef CONFIG_MODULES" ? */ -#include - /* VJ header compression */ - X(slhc_init), - X(slhc_free), - X(slhc_remember), - X(slhc_compress), - X(slhc_uncompress), - X(slhc_toss), -#include -}; - -static void export_slhc_syms(void) -{ - register_symtab(&slhc_syms); -} +/* VJ header compression */ +EXPORT_SYMBOL(slhc_init); +EXPORT_SYMBOL(slhc_free); +EXPORT_SYMBOL(slhc_remember); +EXPORT_SYMBOL(slhc_compress); +EXPORT_SYMBOL(slhc_uncompress); +EXPORT_SYMBOL(slhc_toss); #ifdef MODULE int init_module(void) { printk(KERN_INFO "CSLIP: code copyright 1989 Regents of the University of California\n"); - export_slhc_syms(); return 0; } @@ -751,11 +740,12 @@ void cleanup_module(void) { return; } + #else /* MODULE */ void slhc_install(void) { - export_slhc_syms(); } -#endif + +#endif /* MODULE */ #endif /* CONFIG_INET */ diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index c464dc3997e6..7618a66ef7c1 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c @@ -42,8 +42,13 @@ 11/17/96: Handle LE_C0_MERR in lance_interrupt(). (ecd@skynet.be) + 12/22/96: Don't loop forever in lance_rx() on incomplete packets. + This was the sun4c killer. Shit, stupid bug. + (ecd@skynet.be) */ + #undef DEBUG_DRIVER + static char *version = "sunlance.c:v1.9 21/Aug/96 Miguel de Icaza (miguel@nuclecu.unam.mx)\n"; @@ -429,7 +434,6 @@ static int lance_rx (struct device *dev) if ((bits & LE_R1_POK) != LE_R1_POK) { lp->stats.rx_over_errors++; lp->stats.rx_errors++; - continue; } else if (bits & LE_R1_ERR) { /* Count only the end frame as a rx error, * not the beginning @@ -624,7 +628,8 @@ static int lance_open (struct device *dev) last_dev = dev; - if (request_irq (dev->irq, &lance_interrupt, SA_SHIRQ, lancestr, (void *) dev)) { + if (request_irq (dev->irq, &lance_interrupt, SA_SHIRQ, + lancestr, (void *) dev)) { printk ("Lance: Can't get irq %d\n", dev->irq); return -EAGAIN; } @@ -635,7 +640,8 @@ static int lance_open (struct device *dev) /* On the 4m, setup the ledma to provide the upper bits for buffers */ if (lp->ledma) - lp->ledma->regs->dma_test = ((unsigned int) lp->init_block) & 0xff000000; + lp->ledma->regs->dma_test = ((unsigned int) lp->init_block) + & 0xff000000; lance_init_ring (dev); load_csrs (lp); @@ -716,7 +722,8 @@ static inline int lance_reset (struct device *dev) lp->ledma->regs->cond_reg |= DMA_RST_ENET; udelay (200); lp->ledma->regs->cond_reg &= ~DMA_RST_ENET; - lp->ledma->regs->dma_test = ((unsigned int) lp->init_block) & 0xff000000; + lp->ledma->regs->dma_test = ((unsigned int) lp->init_block) + & 0xff000000; } lance_init_ring (dev); load_csrs (lp); @@ -737,6 +744,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct device *dev) volatile struct lance_regs *ll = lp->ll; volatile struct lance_init_block *ib = lp->init_block; volatile unsigned long flush; + unsigned long flags; int entry, skblen, len; int status = 0; static int outs; @@ -748,7 +756,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct device *dev) if (tickssofar < 100) { status = -1; } else { - printk ("%s: transmit timed out, status %04x, resetting\n", + printk ("%s: transmit timed out, status %04x, reset\n", dev->name, ll->rdp); lance_reset (dev); } @@ -762,35 +770,25 @@ static int lance_start_xmit (struct sk_buff *skb, struct device *dev) } if (skb->len <= 0) { - printk ("skb len is %d\n", skb->len); + printk ("skb len is %ld\n", skb->len); return 0; } + /* Block a timer-based transmit from overlapping. */ -#ifdef OLD_METHOD - dev->tbusy = 1; -#else if (set_bit (0, (void *) &dev->tbusy) != 0) { printk ("Transmitter access conflict.\n"); return -1; } -#endif + skblen = skb->len; - if (!TX_BUFFS_AVAIL) - return -1; + save_and_cli(flags); -#ifdef DEBUG_DRIVER - /* dump the packet */ - { - int i; - - for (i = 0; i < 64; i++) { - if ((i % 16) == 0) - printk ("\n"); - printk ("%2.2x ", skb->data [i]); - } + if (!TX_BUFFS_AVAIL) { + restore_flags(flags); + return -1; } -#endif + len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen; entry = lp->tx_new & TX_RING_MOD_MASK; ib->btx_ring [entry].length = (-len) | 0xf000; @@ -820,6 +818,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct device *dev) if (lp->ledma) flush = ll->rdp; + restore_flags(flags); return status; } @@ -862,15 +861,13 @@ static void lance_load_multicast (struct device *dev) crc = 0xffffffff; for (byte = 0; byte < 6; byte++) - for (bit = *addrs++, j = 0; j < 8; j++, bit>>=1) - { + for (bit = *addrs++, j = 0; j < 8; j++, bit >>= 1) { int test; test = ((bit ^ crc) & 0x01); crc >>= 1; - if (test) - { + if (test) { crc = crc ^ poly; } } @@ -933,16 +930,17 @@ int sparc_lance_init (struct device *dev, struct linux_sbus_device *sdev, dev->base_addr = (long) sdev; /* Copy the IDPROM ethernet address to the device structure, later we - * will copy the address in the device structure to the lance initialization - * block + * will copy the address in the device structure to the lance + * initialization block. */ for (i = 0; i < 6; i++) - printk ("%2.2x%c", - dev->dev_addr[i] = idprom->id_ethaddr[i], i == 5 ? ' ': ':'); + printk ("%2.2x%c", dev->dev_addr[i] = idprom->id_ethaddr[i], + i == 5 ? ' ': ':'); printk("\n"); /* Get the IO region */ - prom_apply_sbus_ranges (sdev->my_bus, &sdev->reg_addrs [0], sdev->num_registers); + prom_apply_sbus_ranges (sdev->my_bus, &sdev->reg_addrs [0], + sdev->num_registers); ll = sparc_alloc_io (sdev->reg_addrs [0].phys_addr, 0, sizeof (struct lance_regs), lancestr, sdev->reg_addrs[0].which_io, 0x0); @@ -953,7 +951,8 @@ int sparc_lance_init (struct device *dev, struct linux_sbus_device *sdev, memset ((char *)dev->priv, 0, sizeof (struct lance_private)); if (lebuffer){ - prom_apply_sbus_ranges (lebuffer->my_bus, &lebuffer->reg_addrs [0], + prom_apply_sbus_ranges (lebuffer->my_bus, + &lebuffer->reg_addrs [0], lebuffer->num_registers); lp->init_block = (void *) sparc_alloc_io (lebuffer->reg_addrs [0].phys_addr, 0, @@ -966,8 +965,10 @@ int sparc_lance_init (struct device *dev, struct linux_sbus_device *sdev, lancedma); lp->pio_buffer = 0; } - lp->busmaster_regval = prom_getintdefault(sdev->prom_node, "busmaster-regval", - (LE_C3_BSWP|LE_C3_ACON|LE_C3_BCON)); + lp->busmaster_regval = prom_getintdefault(sdev->prom_node, + "busmaster-regval", + (LE_C3_BSWP | LE_C3_ACON | + LE_C3_BCON)); lp->ll = ll; lp->name = lancestr; @@ -1014,10 +1015,10 @@ int sparc_lance_init (struct device *dev, struct linux_sbus_device *sdev, sizeof(prop)); if (strcmp(prop, "true")) { - printk("%s: warning: overriding option 'tpe-link-test?'\n", - dev->name); - printk("%s: warning: mail any problems to ecd@skynet.be\n", - dev->name); + printk("%s: warning: overriding option " + "'tpe-link-test?'\n", dev->name); + printk("%s: warning: mail any problems " + "to ecd@skynet.be\n", dev->name); set_auxio(AUXIO_LINK_TEST, 0); } no_link_test: @@ -1039,7 +1040,8 @@ no_link_test: /* This should never happen. */ if ((int)(lp->init_block->brx_ring) & 0x07) { - printk(" **ERROR** LANCE Rx and Tx rings not on even boundary.\n"); + printk("%s: ERROR: Rx and Tx rings not on even boundary.\n", + dev->name); return ENODEV; } @@ -1092,13 +1094,15 @@ int sparc_lance_probe (struct device *dev) if (strcmp (sdev->prom_name, "ledma") == 0) { cards++; ledma = find_ledma (sdev); - if ((v = sparc_lance_init(dev, sdev->child, ledma, 0))) + if ((v = sparc_lance_init(dev, sdev->child, + ledma, 0))) return v; continue; } if (strcmp (sdev->prom_name, "lebuffer") == 0){ cards++; - if ((v = sparc_lance_init(dev, sdev->child, 0, sdev))) + if ((v = sparc_lance_init(dev, sdev->child, + 0, sdev))) return v; continue; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f34d903a977f..378f33ddd89a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -194,7 +194,7 @@ struct pci_dev_info dev_info[] = { DEVICE( ALLIANCE, ALLIANCE_PROMOTIO, "Promotion-6410"), DEVICE( ALLIANCE, ALLIANCE_PROVIDEO, "Provideo"), DEVICE( VMIC, VMIC_VME, "VMIVME-7587"), - DEVICE( DIGI, DIGI_RIGHTSWITCH, "Digi RightSwitch SE-6"), + DEVICE( DIGI, DIGI_RIGHTSWITCH, "RightSwitch SE-6"), DEVICE( MUTECH, MUTECH_MV1000, "MV-1000"), DEVICE( ZEITNET, ZEITNET_1221, "1221"), DEVICE( ZEITNET, ZEITNET_1225, "1225"), @@ -522,6 +522,7 @@ const char *pci_strvendor(unsigned int vendor) case PCI_VENDOR_ID_PLX: return "PLX"; case PCI_VENDOR_ID_ALLIANCE: return "Alliance"; case PCI_VENDOR_ID_VMIC: return "VMIC"; + case PCI_VENDOR_ID_DIGI: return "Digi Intl."; case PCI_VENDOR_ID_MUTECH: return "Mutech"; case PCI_VENDOR_ID_TOSHIBA: return "Toshiba"; case PCI_VENDOR_ID_ZEITNET: return "ZeitNet"; diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index f37de04e4681..793f30608ba3 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c @@ -729,7 +729,7 @@ NCR53c406a_abort(Scsi_Cmnd *SCpnt){ } int -NCR53c406a_reset(Scsi_Cmnd *SCpnt){ +NCR53c406a_reset(Scsi_Cmnd *SCpnt, unsigned int ignored){ DEB(printk("NCR53c406a_reset called\n")); outb(C4_IMG, CONFIG4); /* Select reg set 0 */ outb(CHIP_RESET, CMD_REG); diff --git a/drivers/scsi/NCR53c406a.h b/drivers/scsi/NCR53c406a.h index dcb48870bfdc..88e45e5e6a92 100644 --- a/drivers/scsi/NCR53c406a.h +++ b/drivers/scsi/NCR53c406a.h @@ -57,7 +57,7 @@ const char* NCR53c406a_info(struct Scsi_Host *); int NCR53c406a_command(Scsi_Cmnd *); int NCR53c406a_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); int NCR53c406a_abort(Scsi_Cmnd *); -int NCR53c406a_reset(Scsi_Cmnd *); +int NCR53c406a_reset(Scsi_Cmnd *, unsigned int); int NCR53c406a_biosparm(Disk *, kdev_t, int []); #endif /* _NCR53C406A_H */ diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index 0c5240e80b5b..e13dd1b12eef 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c @@ -499,7 +499,7 @@ int aha1740_abort(Scsi_Cmnd * SCpnt) that it will get some kind of response for the command in SCpnt. We must oblige, or the command will hang the scsi system */ -int aha1740_reset(Scsi_Cmnd * SCpnt) +int aha1740_reset(Scsi_Cmnd * SCpnt, unsigned int ignored) { DEB(printk("aha1740_reset called\n")); return SCSI_RESET_PUNT; diff --git a/drivers/scsi/aha1740.h b/drivers/scsi/aha1740.h index 0c5de11a223f..206cf03b71b8 100644 --- a/drivers/scsi/aha1740.h +++ b/drivers/scsi/aha1740.h @@ -157,7 +157,7 @@ int aha1740_detect(Scsi_Host_Template *); int aha1740_command(Scsi_Cmnd *); int aha1740_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); int aha1740_abort(Scsi_Cmnd *); -int aha1740_reset(Scsi_Cmnd *); +int aha1740_reset(Scsi_Cmnd *, unsigned int); int aha1740_biosparam(Disk *, kdev_t, int*); #define AHA1740_ECBS 32 diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 146696120360..43599d806d54 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -1007,7 +1007,7 @@ int fdomain_16x0_detect( Scsi_Host_Template *tpnt ) Write_FIFO_port = port_base + Write_FIFO; Write_SCSI_Data_port = port_base + Write_SCSI_Data; - fdomain_16x0_reset( NULL ); + fdomain_16x0_reset( NULL, 0 ); if (fdomain_test_loopback()) { #if DEBUG_DETECT @@ -1892,7 +1892,7 @@ int fdomain_16x0_abort( Scsi_Cmnd *SCpnt) return SCSI_ABORT_SUCCESS; } -int fdomain_16x0_reset( Scsi_Cmnd *SCpnt ) +int fdomain_16x0_reset( Scsi_Cmnd *SCpnt, unsigned int ignored ) { #if DEBUG_RESET static int called_once = 0; diff --git a/drivers/scsi/fdomain.h b/drivers/scsi/fdomain.h index 429db819e268..c15255819575 100644 --- a/drivers/scsi/fdomain.h +++ b/drivers/scsi/fdomain.h @@ -29,7 +29,7 @@ int fdomain_16x0_detect( Scsi_Host_Template * ); int fdomain_16x0_command( Scsi_Cmnd * ); int fdomain_16x0_abort( Scsi_Cmnd * ); const char *fdomain_16x0_info( struct Scsi_Host * ); -int fdomain_16x0_reset( Scsi_Cmnd * ); +int fdomain_16x0_reset( Scsi_Cmnd *, unsigned int ); int fdomain_16x0_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) ); int fdomain_16x0_biosparam( Disk *, kdev_t, int * ); int fdomain_16x0_proc_info( char *buffer, char **start, off_t offset, diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 54a23822538c..ca1d1a769beb 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -467,7 +467,7 @@ Scsi_Host_Template idescsi_template = IDESCSI; int init_module (void) { idescsi_init (); - idescsi_template.usage_count = &mod_use_count_; + idescsi_template.usage_count = &__this_module.usecount; scsi_register_module (MODULE_SCSI_HA, &idescsi_template); return 0; } diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 1793de1145ba..b744599009dd 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -463,7 +463,7 @@ int ppa_abort( Scsi_Cmnd * cmd ) return SCSI_ABORT_SNOOZE; } -int ppa_reset( Scsi_Cmnd * cmd ) +int ppa_reset( Scsi_Cmnd * cmd, unsigned int ignored ) { ppa_abort_flag = 2; return SCSI_RESET_PUNT; diff --git a/drivers/scsi/ppa.h b/drivers/scsi/ppa.h index 9dbfe7e63c20..c00198031840 100644 --- a/drivers/scsi/ppa.h +++ b/drivers/scsi/ppa.h @@ -14,7 +14,7 @@ const char * ppa_info(struct Scsi_Host *); int ppa_command(Scsi_Cmnd *); int ppa_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); int ppa_abort(Scsi_Cmnd *); -int ppa_reset(Scsi_Cmnd *); +int ppa_reset(Scsi_Cmnd *, unsigned int); int ppa_biosparam(Disk *, kdev_t, int[]); #define PPA { \ diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c index a3784e9264c5..1d166c9e73fa 100644 --- a/drivers/scsi/qlogicfas.c +++ b/drivers/scsi/qlogicfas.c @@ -656,7 +656,7 @@ int qlogicfas_abort(Scsi_Cmnd * cmd) /*----------------------------------------------------------------*/ /* reset SCSI bus */ -int qlogicfas_reset(Scsi_Cmnd * cmd) +int qlogicfas_reset(Scsi_Cmnd * cmd, unsigned int ignored) { qabort = 2; ql_zap(); diff --git a/drivers/scsi/qlogicfas.h b/drivers/scsi/qlogicfas.h index df2bb73ae309..4dc16df097c7 100644 --- a/drivers/scsi/qlogicfas.h +++ b/drivers/scsi/qlogicfas.h @@ -6,7 +6,7 @@ const char * qlogicfas_info(struct Scsi_Host *); int qlogicfas_command(Scsi_Cmnd *); int qlogicfas_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *)); int qlogicfas_abort(Scsi_Cmnd *); -int qlogicfas_reset(Scsi_Cmnd *); +int qlogicfas_reset(Scsi_Cmnd *, unsigned int); int qlogicfas_biosparam(Disk *, kdev_t, int[]); #ifndef NULL diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 08b03e47f18d..504004d09ba4 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -97,10 +97,6 @@ static int scan_scsis_single (int channel,int dev,int lun,int * max_scsi_dev , struct Scsi_Host *shpnt, char * scsi_result); void scsi_build_commandblocks(Scsi_Device * SDpnt); -#ifdef CONFIG_MODULES -extern struct symbol_table scsi_symbol_table; -#endif - static FreeSectorBitmap * dma_malloc_freelist = NULL; static int scsi_need_isa_bounce_buffers; static unsigned int dma_sectors = 0; @@ -2558,10 +2554,6 @@ int scsi_dev_init(void) timer_table[SCSI_TIMER].fn = scsi_main_timeout; timer_table[SCSI_TIMER].expires = 0; -#ifdef CONFIG_MODULES - register_symtab(&scsi_symbol_table); -#endif - /* Register the /proc/scsi/scsi entry */ #if CONFIG_PROC_FS proc_scsi_register(0, &proc_scsi_scsi); @@ -3479,7 +3471,6 @@ int init_module(void) { timer_table[SCSI_TIMER].fn = scsi_main_timeout; timer_table[SCSI_TIMER].expires = 0; - register_symtab(&scsi_symbol_table); scsi_loadable_module_flag = 1; /* Register the /proc/scsi/scsi entry */ diff --git a/drivers/scsi/scsi_module.c b/drivers/scsi/scsi_module.c index 9ba78d835eaf..644327d34d53 100644 --- a/drivers/scsi/scsi_module.c +++ b/drivers/scsi/scsi_module.c @@ -32,7 +32,7 @@ #include int init_module(void) { - driver_template.usage_count = &mod_use_count_; + driver_template.usage_count = &__this_module.usecount; scsi_register_module(MODULE_SCSI_HA, &driver_template); return (driver_template.present == 0); } diff --git a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c index a9d14f3b2aae..30a86bf62fe6 100644 --- a/drivers/scsi/scsi_syms.c +++ b/drivers/scsi/scsi_syms.c @@ -5,6 +5,7 @@ #define __NO_VERSION__ #include #include + #ifdef CONFIG_MODULES #include @@ -37,47 +38,39 @@ extern int scsicam_bios_param (Disk * disk, extern void print_command (unsigned char *command); extern void print_sense(const char * devclass, Scsi_Cmnd * SCpnt); -struct symbol_table scsi_symbol_table = { -#include - X(scsi_register_module), - X(scsi_unregister_module), - X(scsi_free), - X(scsi_malloc), - X(scsi_register), - X(scsi_unregister), - X(scsicam_bios_param), - X(allocate_device), - X(scsi_do_cmd), - X(scsi_command_size), - X(scsi_init_malloc), - X(scsi_init_free), - X(scsi_ioctl), - X(print_command), - X(print_sense), - X(print_msg), - X(print_status), - X(dma_free_sectors), - X(kernel_scsi_ioctl), - X(need_isa_buffer), - X(request_queueable), - X(print_Scsi_Cmnd), - X(scsi_mark_host_reset), - X(scsi_mark_bus_reset), +EXPORT_SYMBOL(scsi_register_module); +EXPORT_SYMBOL(scsi_unregister_module); +EXPORT_SYMBOL(scsi_free); +EXPORT_SYMBOL(scsi_malloc); +EXPORT_SYMBOL(scsi_register); +EXPORT_SYMBOL(scsi_unregister); +EXPORT_SYMBOL(scsicam_bios_param); +EXPORT_SYMBOL(allocate_device); +EXPORT_SYMBOL(scsi_do_cmd); +EXPORT_SYMBOL(scsi_command_size); +EXPORT_SYMBOL(scsi_init_malloc); +EXPORT_SYMBOL(scsi_init_free); +EXPORT_SYMBOL(scsi_ioctl); +EXPORT_SYMBOL(print_command); +EXPORT_SYMBOL(print_sense); +EXPORT_SYMBOL(print_msg); +EXPORT_SYMBOL(print_status); +EXPORT_SYMBOL(dma_free_sectors); +EXPORT_SYMBOL(kernel_scsi_ioctl); +EXPORT_SYMBOL(need_isa_buffer); +EXPORT_SYMBOL(request_queueable); +EXPORT_SYMBOL(print_Scsi_Cmnd); +EXPORT_SYMBOL(scsi_mark_host_reset); +EXPORT_SYMBOL(scsi_mark_bus_reset); #if defined(CONFIG_PROC_FS) - X(proc_print_scsidevice), +EXPORT_SYMBOL(proc_print_scsidevice); #endif /* * These are here only while I debug the rest of the scsi stuff. */ - X(scsi_hostlist), - X(scsi_hosts), - X(scsi_devicelist), - X(scsi_devices), +EXPORT_SYMBOL(scsi_hostlist); +EXPORT_SYMBOL(scsi_hosts); +EXPORT_SYMBOL(scsi_devicelist); +EXPORT_SYMBOL(scsi_devices); - /******************************************************** - * Do not add anything below this line, - * as the stacked modules depend on this! - */ -#include -}; -#endif +#endif /* CONFIG_MODULES */ diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8e7f2ff86532..863a782c1696 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1534,7 +1534,7 @@ static void sd_detach(Scsi_Device * SDp) #ifdef MODULE int init_module(void) { - sd_template.usage_count = &mod_use_count_; + sd_template.usage_count = &__this_module.usecount; return scsi_register_module(MODULE_SCSI_DEV, &sd_template); } diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3e1382fc18de..1bcb065e9ee2 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -632,7 +632,7 @@ static void sg_detach(Scsi_Device * SDp) #ifdef MODULE int init_module(void) { - sg_template.usage_count = &mod_use_count_; + sg_template.usage_count = &__this_module.usecount; return scsi_register_module(MODULE_SCSI_DEV, &sg_template); } diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index deb38d989616..22a7cc17c719 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -1006,7 +1006,7 @@ static void sr_detach(Scsi_Device * SDp) #ifdef MODULE int init_module(void) { - sr_template.usage_count = &mod_use_count_; + sr_template.usage_count = &__this_module.usecount; return scsi_register_module(MODULE_SCSI_DEV, &sr_template); } diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 3c6e475c6fa9..321bf3ff5eae 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3068,7 +3068,7 @@ static void st_detach(Scsi_Device * SDp) #ifdef MODULE int init_module(void) { - st_template.usage_count = &mod_use_count_; + st_template.usage_count = &__this_module.usecount; return scsi_register_module(MODULE_SCSI_DEV, &st_template); } diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index e7347c127ddb..c422f30451c3 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c @@ -1462,7 +1462,7 @@ int wd7000_abort(Scsi_Cmnd * SCpnt) /* * I also have no idea how to do a reset... */ -int wd7000_reset(Scsi_Cmnd * SCpnt) +int wd7000_reset(Scsi_Cmnd * SCpnt, unsigned int ignored) { return SCSI_RESET_PUNT; } diff --git a/drivers/scsi/wd7000.h b/drivers/scsi/wd7000.h index e4aec6b50927..705f9295833a 100644 --- a/drivers/scsi/wd7000.h +++ b/drivers/scsi/wd7000.h @@ -17,7 +17,7 @@ int wd7000_detect(Scsi_Host_Template *); int wd7000_command(Scsi_Cmnd *); int wd7000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); int wd7000_abort(Scsi_Cmnd *); -int wd7000_reset(Scsi_Cmnd *); +int wd7000_reset(Scsi_Cmnd *, unsigned int); int wd7000_biosparam(Disk *, kdev_t, int *); #ifndef NULL diff --git a/fs/affs/inode.c b/fs/affs/inode.c index b44842705d42..0c11f3109741 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -4,7 +4,7 @@ * (c) 1996 Hans-Joachim Widmaier - Rewritten * * (C) 1993 Ray Burr - Modified for Amiga FFS filesystem. - * + * * (C) 1992 Eric Youngdale Modified for ISO9660 filesystem. * * (C) 1991 Linus Torvalds - minix filesystem @@ -98,11 +98,11 @@ affs_write_super(struct super_block *sb) pr_debug("AFFS: write_super() at %d, clean=%d\n",CURRENT_TIME,clean); } -static struct super_operations affs_sops = { +static struct super_operations affs_sops = { affs_read_inode, affs_notify_change, affs_write_inode, - affs_put_inode, + affs_put_inode, affs_put_super, affs_write_super, affs_statfs, @@ -467,7 +467,7 @@ affs_read_super(struct super_block *s,void *data, int silent) size = s->u.affs_sb.s_partition_size - reserved; num_bm = (size + s->s_blocksize * 8 - 32 - 1) / (s->s_blocksize * 8 - 32); az_no = (size + AFFS_ZONE_SIZE - 1) / (AFFS_ZONE_SIZE - 32); - ptype = num_bm * sizeof(struct affs_bm_info) + + ptype = num_bm * sizeof(struct affs_bm_info) + az_no * sizeof(struct affs_alloc_zone) + MAX_ZONES * sizeof(struct affs_zone); pr_debug("num_bm=%d, az_no=%d, sum=%d\n",num_bm,az_no,ptype); @@ -666,7 +666,7 @@ affs_read_inode(struct inode *inode) inode->u.affs_i.i_protect = prot; inode->u.affs_i.i_parent = htonl(file_end->parent); - inode->u.affs_i.i_original = 0; + inode->u.affs_i.i_original = 0; inode->u.affs_i.i_zone = 0; inode->u.affs_i.i_hlink = 0; inode->u.affs_i.i_pa_cnt = 0; @@ -682,7 +682,7 @@ affs_read_inode(struct inode *inode) inode->i_mode = inode->i_sb->u.affs_sb.s_mode; else inode->i_mode = prot_to_mode(prot); - + if (inode->i_sb->u.affs_sb.s_flags & SF_SETUID) inode->i_uid = inode->i_sb->u.affs_sb.s_uid; else { @@ -761,7 +761,7 @@ affs_read_inode(struct inode *inode) sys_tz.tz_minuteswest * 60; affs_brelse(bh); affs_brelse(lbh); - + inode->i_op = NULL; if (S_ISREG(inode->i_mode)) { if (inode->i_sb->u.affs_sb.s_flags & SF_OFS) { @@ -829,16 +829,16 @@ affs_notify_change(struct inode *inode, struct iattr *attr) error = inode_change_ok(inode,attr); if (error) return error; - + if (((attr->ia_valid & ATTR_UID) && (inode->i_sb->u.affs_sb.s_flags & SF_SETUID)) || ((attr->ia_valid & ATTR_GID) && (inode->i_sb->u.affs_sb.s_flags & SF_SETGID)) || ((attr->ia_valid & ATTR_MODE) && (inode->i_sb->u.affs_sb.s_flags & (SF_SETMODE | SF_IMMUTABLE)))) error = -EPERM; - + if (error) return (inode->i_sb->u.affs_sb.s_flags & SF_QUIET) ? 0 : error; - + if (attr->ia_valid & ATTR_MODE) inode->u.affs_i.i_protect = mode_to_prot(attr->ia_mode); @@ -870,7 +870,7 @@ affs_new_inode(const struct inode *dir) if (!dir || !(inode = get_empty_inode())) return NULL; - + sb = dir->i_sb; inode->i_sb = sb; inode->i_flags = sb->s_flags; @@ -950,12 +950,12 @@ affs_add_entry(struct inode *dir, struct inode *link, struct inode *inode, hash = affs_hash_name(name,len,AFFS_I2FSTYPE(dir),AFFS_I2HSIZE(dir)); lock_super(inode->i_sb); - DIR_END(inode_bh->b_data,inode)->hash_chain = + DIR_END(inode_bh->b_data,inode)->hash_chain = ((struct dir_front *)dir_bh->b_data)->hashtable[hash]; ((struct dir_front *)dir_bh->b_data)->hashtable[hash] = ntohl(inode->i_ino); if (link_bh) { LINK_END(inode_bh->b_data,inode)->original = ntohl(link->i_ino); - LINK_END(inode_bh->b_data,inode)->link_chain = + LINK_END(inode_bh->b_data,inode)->link_chain = FILE_END(link_bh->b_data,link)->link_chain; FILE_END(link_bh->b_data,link)->link_chain = ntohl(inode->i_ino); affs_fix_checksum(AFFS_I2BSIZE(link),link_bh->b_data,5); @@ -994,14 +994,12 @@ init_affs_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { - int status; - if ((status = init_affs_fs()) == 0) - register_symtab(0); - return status; + return init_affs_fs(); } void diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index cb535656a407..4f445764f31a 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c @@ -37,7 +37,7 @@ static struct linux_binfmt aout_format = { #ifndef MODULE NULL, NULL, load_aout_binary, load_aout_library, aout_core_dump #else - NULL, &mod_use_count_, load_aout_binary, load_aout_library, aout_core_dump + NULL, &__this_module.usecount, load_aout_binary, load_aout_library, aout_core_dump #endif }; diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c698330d373b..b2db801a5516 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -59,7 +59,7 @@ static struct linux_binfmt elf_format = { #ifndef MODULE NULL, NULL, load_elf_binary, load_elf_library, elf_core_dump #else - NULL, &mod_use_count_, load_elf_binary, load_elf_library, elf_core_dump + NULL, &__this_module.usecount, load_elf_binary, load_elf_library, elf_core_dump #endif }; diff --git a/fs/binfmt_java.c b/fs/binfmt_java.c index 6b75fa830fb7..4192f6d66791 100644 --- a/fs/binfmt_java.c +++ b/fs/binfmt_java.c @@ -144,7 +144,7 @@ static struct linux_binfmt java_format = { #ifndef MODULE NULL, 0, load_java, NULL, NULL #else - NULL, &mod_use_count_, load_java, NULL, NULL + NULL, &__this_module.usecount, load_java, NULL, NULL #endif }; @@ -161,7 +161,7 @@ static struct linux_binfmt applet_format = { #ifndef MODULE NULL, 0, load_applet, NULL, NULL #else - NULL, &mod_use_count_, load_applet, NULL, NULL + NULL, &__this_module.usecount, load_applet, NULL, NULL #endif }; diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index 9050a106ca3d..864edfe08324 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c @@ -100,7 +100,7 @@ struct linux_binfmt script_format = { #ifndef MODULE NULL, 0, load_script, NULL, NULL #else - NULL, &mod_use_count_, load_script, NULL, NULL + NULL, &__this_module.usecount, load_script, NULL, NULL #endif }; diff --git a/fs/block_dev.c b/fs/block_dev.c index 4d802f4e3cd0..f42026ac2a8b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -23,19 +23,16 @@ extern int *blksize_size[]; long block_write(struct inode * inode, struct file * filp, const char * buf, unsigned long count) { - int blocksize, blocksize_bits, i, j, buffercount,write_error; + int blocksize, blocksize_bits, i, buffercount,write_error; int block, blocks; loff_t offset; int chars; int written = 0; - int cluster_list[MAX_BUF_PER_PAGE]; struct buffer_head * bhlist[NBUF]; - int blocks_per_cluster; unsigned int size; kdev_t dev; struct buffer_head * bh, *bufferlist[NBUF]; register char * p; - int excess; write_error = buffercount = 0; dev = inode->i_rdev; @@ -52,8 +49,6 @@ long block_write(struct inode * inode, struct file * filp, i >>= 1; } - blocks_per_cluster = PAGE_SIZE / blocksize; - block = filp->f_pos >> blocksize_bits; offset = filp->f_pos & (blocksize-1); @@ -69,15 +64,14 @@ long block_write(struct inode * inode, struct file * filp, chars=count; #if 0 - if (chars == blocksize) - bh = getblk(dev, block, blocksize); - else - bh = breada(dev,block,block+1,block+2,-1); - + /* get the buffer head */ + { + struct buffer_head * (*fn)(kdev_t, int, int) = getblk; + if (chars != blocksize) + fn = bread; + bh = fn(dev, block, blocksize); + } #else - for(i=0; i> 9) / 2; if (block + blocks > size) blocks = size - block; if (blocks > NBUF) blocks=NBUF; - excess = (block + blocks) % blocks_per_cluster; - if ( blocks > excess ) - blocks -= excess; bhlist[0] = bh; for(i=1; i= 0) brelse(bhlist[i--]); @@ -167,8 +154,6 @@ long block_read(struct inode * inode, struct file * filp, int blocksize_bits, i; unsigned int blocks, rblocks, left; int bhrequest, uptodate; - int cluster_list[MAX_BUF_PER_PAGE]; - int blocks_per_cluster; struct buffer_head ** bhb, ** bhe; struct buffer_head * buflist[NBUF]; struct buffer_head * bhreq[NBUF]; @@ -176,7 +161,6 @@ long block_read(struct inode * inode, struct file * filp, loff_t size; kdev_t dev; int read; - int excess; dev = inode->i_rdev; blocksize = BLOCK_SIZE; @@ -195,8 +179,6 @@ long block_read(struct inode * inode, struct file * filp, else size = INT_MAX; - blocks_per_cluster = PAGE_SIZE / blocksize; - if (offset > size) left = 0; /* size - offset might not fit into left, so check explicitly. */ @@ -217,9 +199,6 @@ long block_read(struct inode * inode, struct file * filp, if (filp->f_reada) { if (blocks < read_ahead[MAJOR(dev)] / (blocksize >> 9)) blocks = read_ahead[MAJOR(dev)] / (blocksize >> 9); - excess = (block + blocks) % blocks_per_cluster; - if ( blocks > excess ) - blocks -= excess; if (rblocks > blocks) blocks = rblocks; @@ -242,12 +221,6 @@ long block_read(struct inode * inode, struct file * filp, uptodate = 1; while (blocks) { --blocks; -#if 1 - if((block % blocks_per_cluster) == 0) { - for(i=0; i #include #include @@ -41,39 +38,34 @@ #define NR_SIZES 5 static char buffersize_index[17] = {-1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 4}; -static short int bufferindex_size[NR_SIZES] = {512, 1024, 2048, 4096, 8192}; #define BUFSIZE_INDEX(X) ((int) buffersize_index[(X)>>9]) #define MAX_BUF_PER_PAGE (PAGE_SIZE / 512) +#define MAX_UNUSED_BUFFERS 30 /* don't ever have more than this number of + unused buffer heads */ +#define HASH_PAGES 4 /* number of pages to use for the hash table */ +#define NR_HASH (HASH_PAGES*PAGE_SIZE/sizeof(struct buffer_head *)) +#define HASH_MASK (NR_HASH-1) static int grow_buffers(int pri, int size); -static int shrink_specific_buffers(unsigned int priority, int size); -static int maybe_shrink_lav_buffers(int); -static int nr_hash = 0; /* Size of hash table */ static struct buffer_head ** hash_table; static struct buffer_head * lru_list[NR_LIST] = {NULL, }; -/* next_to_age is an array of pointers into the lru lists, used to - cycle through the buffers aging their contents when deciding which - buffers to discard when more memory is needed */ -static struct buffer_head * next_to_age[NR_LIST] = {NULL, }; static struct buffer_head * free_list[NR_SIZES] = {NULL, }; static struct buffer_head * unused_list = NULL; -struct buffer_head * reuse_list = NULL; +static struct buffer_head * reuse_list = NULL; static struct wait_queue * buffer_wait = NULL; -int nr_buffers = 0; -int nr_buffers_type[NR_LIST] = {0,}; -int nr_buffers_size[NR_SIZES] = {0,}; -int nr_buffers_st[NR_SIZES][NR_LIST] = {{0,},}; -int buffer_usage[NR_SIZES] = {0,}; /* Usage counts used to determine load average */ -int buffers_lav[NR_SIZES] = {0,}; /* Load average of buffer usage */ -int nr_free[NR_SIZES] = {0,}; +static int nr_buffers = 0; +static int nr_buffers_type[NR_LIST] = {0,}; +static int nr_buffer_heads = 0; +static int nr_unused_buffer_heads = 0; +static int refilled = 0; /* Set NZ when a buffer freelist is refilled + this is used by the loop device */ + +/* this is used by some architectures to estimate available memory */ int buffermem = 0; -int nr_buffer_heads = 0; -int refilled = 0; /* Set NZ when a buffer freelist is refilled */ -extern int *blksize_size[]; /* Here is the parameter block for the bdflush process. If you add or * remove any of the parameters, make sure to update kernel/sysctl.c. @@ -82,8 +74,9 @@ extern int *blksize_size[]; static void wakeup_bdflush(int); #define N_PARAM 9 -#define LAV +/* the dummy values in this structure are left in there for compatibility + with old programs that play with the /proc entries */ union bdflush_param{ struct { int nfract; /* Percentage of buffer cache dirty to @@ -94,26 +87,17 @@ union bdflush_param{ each time we call refill */ int nref_dirt; /* Dirty buffer threshold for activating bdflush when trying to refill buffers. */ - int clu_nfract; /* Percentage of buffer cache to scan to - search for free clusters */ + int dummy1; /* unused */ int age_buffer; /* Time for normal buffer to age before we flush it */ int age_super; /* Time for superblock to age before we flush it */ - int lav_const; /* Constant used for load average (time - constant */ - int lav_ratio; /* Used to determine how low a lav for a - particular size can go before we start to - trim back the buffers */ + int dummy2; /* unused */ + int dummy3; /* unused */ } b_un; unsigned int data[N_PARAM]; } bdf_prm = {{60, 500, 64, 256, 15, 30*HZ, 5*HZ, 1884, 2}}; -/* The lav constant is set for 1 minute, as long as the update process runs - every 5 seconds. If you change the frequency of update, the time - constant will also change. */ - - /* These are the min and max parameter values that we will allow to be assigned */ int bdflush_min[N_PARAM] = { 0, 10, 5, 25, 0, 100, 100, 1, 1}; int bdflush_max[N_PARAM] = {100,5000, 2000, 2000,100, 60000, 60000, 2047, 5}; @@ -328,7 +312,7 @@ void invalidate_buffers(kdev_t dev) } } -#define _hashfn(dev,block) (((unsigned)(HASHDEV(dev)^block))%nr_hash) +#define _hashfn(dev,block) (((unsigned)(HASHDEV(dev)^block))&HASH_MASK) #define hash(dev,block) hash_table[_hashfn(dev,block)] static inline void remove_from_hash_queue(struct buffer_head * bh) @@ -355,11 +339,6 @@ static inline void remove_from_lru_list(struct buffer_head * bh) lru_list[bh->b_list] = bh->b_next_free; if (lru_list[bh->b_list] == bh) lru_list[bh->b_list] = NULL; - if (next_to_age[bh->b_list] == bh) - next_to_age[bh->b_list] = bh->b_next_free; - if (next_to_age[bh->b_list] == bh) - next_to_age[bh->b_list] = NULL; - bh->b_next_free = bh->b_prev_free = NULL; } @@ -372,7 +351,6 @@ static inline void remove_from_free_list(struct buffer_head * bh) panic("Free list corrupted"); if(!free_list[isize]) panic("Free list empty"); - nr_free[isize]--; if(bh->b_next_free == bh) free_list[isize] = NULL; else { @@ -392,7 +370,6 @@ static inline void remove_from_queues(struct buffer_head * bh) return; } nr_buffers_type[bh->b_list]--; - nr_buffers_st[BUFSIZE_INDEX(bh->b_size)][bh->b_list]--; remove_from_hash_queue(bh); remove_from_lru_list(bh); } @@ -403,8 +380,6 @@ static inline void put_last_lru(struct buffer_head * bh) return; if (bh == lru_list[bh->b_list]) { lru_list[bh->b_list] = bh->b_next_free; - if (next_to_age[bh->b_list] == bh) - next_to_age[bh->b_list] = bh->b_next_free; return; } if(bh->b_dev == B_FREE) @@ -416,8 +391,6 @@ static inline void put_last_lru(struct buffer_head * bh) lru_list[bh->b_list] = bh; lru_list[bh->b_list]->b_prev_free = bh; } - if (!next_to_age[bh->b_list]) - next_to_age[bh->b_list] = bh; bh->b_next_free = lru_list[bh->b_list]; bh->b_prev_free = lru_list[bh->b_list]->b_prev_free; @@ -439,7 +412,6 @@ static inline void put_last_free(struct buffer_head * bh) bh->b_prev_free = bh; } - nr_free[isize]++; bh->b_next_free = free_list[isize]; bh->b_prev_free = free_list[isize]->b_prev_free; free_list[isize]->b_prev_free->b_next_free = bh; @@ -457,15 +429,13 @@ static inline void insert_into_queues(struct buffer_head * bh) lru_list[bh->b_list] = bh; bh->b_prev_free = bh; } - if (!next_to_age[bh->b_list]) - next_to_age[bh->b_list] = bh; + if (bh->b_next_free) panic("VFS: buffer LRU pointers corrupted"); bh->b_next_free = lru_list[bh->b_list]; bh->b_prev_free = lru_list[bh->b_list]->b_prev_free; lru_list[bh->b_list]->b_prev_free->b_next_free = bh; lru_list[bh->b_list]->b_prev_free = bh; nr_buffers_type[bh->b_list]++; - nr_buffers_st[BUFSIZE_INDEX(bh->b_size)][bh->b_list]++; /* put the buffer in new hash-queue if it has a device */ bh->b_prev = NULL; bh->b_next = NULL; @@ -518,6 +488,7 @@ struct buffer_head * get_hash_table(kdev_t dev, int block, int size) void set_blocksize(kdev_t dev, int size) { + extern int *blksize_size[]; int i, nlist; struct buffer_head * bh, *bhnext; @@ -566,26 +537,69 @@ void set_blocksize(kdev_t dev, int size) } } -#define BADNESS(bh) (buffer_dirty(bh) || buffer_locked(bh)) -void refill_freelist(int size) +/* check if a buffer is OK to be reclaimed */ +static inline int can_reclaim(struct buffer_head *bh, int size) +{ + if (bh->b_count || + buffer_protected(bh) || buffer_locked(bh)) + return 0; + + if (mem_map[MAP_NR((unsigned long) bh->b_data)].count != 1 || + buffer_dirty(bh)) { + refile_buffer(bh); + return 0; + } + + if (bh->b_size != size) + return 0; + + return 1; +} + +/* find a candidate buffer to be reclaimed */ +static struct buffer_head *find_candidate(struct buffer_head *list,int *list_len,int size) +{ + struct buffer_head *bh; + + for (bh = list; + bh && (*list_len) > 0; + bh = bh->b_next_free, (*list_len)--) { + if (size != bh->b_size) { + /* this provides a mechanism for freeing blocks + of other sizes, this is necessary now that we + no longer have the lav code. */ + try_to_free_buffer(bh,&bh,1); + continue; + } + + if (buffer_locked(bh) && + (bh->b_list == BUF_LOCKED || bh->b_list == BUF_LOCKED1)) { + /* Buffers are written in the order they are placed + on the locked list. If we encounter a locked + buffer here, this means that the rest of them + are also locked */ + (*list_len) = 0; + return NULL; + } + + if (can_reclaim(bh,size)) + return bh; + } + + return NULL; +} + +static void refill_freelist(int size) { - struct buffer_head * bh, * tmp; - struct buffer_head * candidate[NR_LIST]; + struct buffer_head * bh; + struct buffer_head * candidate[BUF_DIRTY]; unsigned int best_time, winner; - int isize = BUFSIZE_INDEX(size); - int buffers[NR_LIST]; + int buffers[BUF_DIRTY]; int i; int needed; - /* First see if we even need this. Sometimes it is advantageous - to request some blocks in a filesystem that we know that we will - be needing ahead of time. */ - - if (nr_free[isize] > 100) - return; - - ++refilled; + refilled = 1; /* If there are too many dirty buffers, we wake up the update process now so as to ensure that there are still clean buffers available for user processes to use (and dirty) */ @@ -598,72 +612,24 @@ void refill_freelist(int size) needed -= PAGE_SIZE; } - if(needed <= 0) return; - - /* See if there are too many buffers of a different size. - If so, victimize them */ - - while(maybe_shrink_lav_buffers(size)) - { - if(!grow_buffers(GFP_BUFFER, size)) break; - needed -= PAGE_SIZE; - if(needed <= 0) return; - }; - +repeat: /* OK, we cannot grow the buffer cache, now try to get some from the lru list */ /* First set the candidate pointers to usable buffers. This should be quick nearly all of the time. */ -repeat0: - for(i=0; i 0; bh = tmp, buffers[i]--) - { - if(buffers[i] < 0) panic("Here is the problem"); - tmp = bh->b_next_free; - if (!bh) break; - - if (mem_map[MAP_NR((unsigned long) bh->b_data)].count != 1 || - buffer_dirty(bh)) { - refile_buffer(bh); - continue; - } - - if (bh->b_count || buffer_protected(bh) || bh->b_size != size) - continue; - - /* Buffers are written in the order they are placed - on the locked list. If we encounter a locked - buffer here, this means that the rest of them - are also locked */ - if (buffer_locked(bh) && (i == BUF_LOCKED || i == BUF_LOCKED1)) { - buffers[i] = 0; - break; - } - - if (BADNESS(bh)) continue; - break; - }; - if(!buffers[i]) candidate[i] = NULL; /* Nothing on this list */ - else candidate[i] = bh; - if(candidate[i] && candidate[i]->b_count) panic("Here is the problem"); + candidate[i] = find_candidate(lru_list[i], &buffers[i], size); } - repeat: - if(needed <= 0) return; - /* Now see which candidate wins the election */ winner = best_time = UINT_MAX; - for(i=0; ib_lru_time < best_time){ best_time = candidate[i]->b_lru_time; @@ -674,65 +640,21 @@ repeat0: /* If we have a winner, use it, and then get a new candidate from that list */ if(winner != UINT_MAX) { i = winner; - bh = candidate[i]; - candidate[i] = bh->b_next_free; - if(candidate[i] == bh) candidate[i] = NULL; /* Got last one */ - if (bh->b_count || bh->b_size != size) - panic("Busy buffer in candidate list\n"); - if (mem_map[MAP_NR((unsigned long) bh->b_data)].count != 1) - panic("Shared buffer in candidate list\n"); - if (buffer_protected(bh)) - panic("Protected buffer in candidate list\n"); - if (BADNESS(bh)) panic("Buffer in candidate list with BADNESS != 0\n"); - - if(bh->b_dev == B_FREE) - panic("Wrong list"); - remove_from_queues(bh); - bh->b_dev = B_FREE; - put_last_free(bh); - needed -= bh->b_size; - buffers[i]--; - if(buffers[i] < 0) panic("Here is the problem"); + while (needed>0 && (bh=candidate[i])) { + candidate[i] = bh->b_next_free; + if(candidate[i] == bh) candidate[i] = NULL; /* Got last one */ + remove_from_queues(bh); + bh->b_dev = B_FREE; + put_last_free(bh); + needed -= bh->b_size; + buffers[i]--; + if(buffers[i] == 0) candidate[i] = NULL; - if(buffers[i] == 0) candidate[i] = NULL; - - /* Now all we need to do is advance the candidate pointer - from the winner list to the next usable buffer */ - if(candidate[i] && buffers[i] > 0){ - if(buffers[i] <= 0) panic("Here is another problem"); - for (bh = candidate[i]; buffers[i] > 0; bh = tmp, buffers[i]--) { - if(buffers[i] < 0) panic("Here is the problem"); - tmp = bh->b_next_free; - if (!bh) break; - - if (mem_map[MAP_NR((unsigned long) bh->b_data)].count != 1 || - buffer_dirty(bh)) { - refile_buffer(bh); - continue; - }; - - if (bh->b_count || buffer_protected(bh) || bh->b_size != size) - continue; - - /* Buffers are written in the order they are - placed on the locked list. If we encounter - a locked buffer here, this means that the - rest of them are also locked */ - if (buffer_locked(bh) && (i == BUF_LOCKED || i == BUF_LOCKED1)) { - buffers[i] = 0; - break; - } - - if (BADNESS(bh)) continue; - break; - }; - if(!buffers[i]) candidate[i] = NULL; /* Nothing here */ - else candidate[i] = bh; - if(candidate[i] && candidate[i]->b_count) - panic("Here is the problem"); + if (candidate[i] && !can_reclaim(candidate[i],size)) + candidate[i] = find_candidate(candidate[i],&buffers[i], size); } - - goto repeat; + if (needed >= 0) + goto repeat; } if(needed <= 0) return; @@ -742,7 +664,7 @@ repeat0: if (nr_free_pages > min_free_pages + 5) { if (grow_buffers(GFP_BUFFER, size)) { needed -= PAGE_SIZE; - goto repeat0; + goto repeat; }; } @@ -750,7 +672,7 @@ repeat0: if (!grow_buffers(GFP_ATOMIC, size)) wakeup_bdflush(1); needed -= PAGE_SIZE; - goto repeat0; + goto repeat; } /* @@ -768,9 +690,6 @@ struct buffer_head * getblk(kdev_t dev, int block, int size) struct buffer_head * bh; int isize = BUFSIZE_INDEX(size); - /* Update this for the buffer size lav. */ - buffer_usage[isize]++; - /* If there are too many dirty buffers, we wake up the update process now so as to ensure that there are still clean buffers available for user processes to use (and dirty) */ @@ -828,7 +747,6 @@ void set_writetime(struct buffer_head * buf, int flag) void refile_buffer(struct buffer_head * buf) { int dispose; - int isize; if(buf->b_dev == B_FREE) { printk("Attempt to refile free buffer\n"); @@ -836,17 +754,13 @@ void refile_buffer(struct buffer_head * buf) } if (buffer_dirty(buf)) dispose = BUF_DIRTY; - else if ((mem_map[MAP_NR((unsigned long) buf->b_data)].count > 1) || buffer_protected(buf)) - dispose = BUF_SHARED; else if (buffer_locked(buf)) dispose = BUF_LOCKED; - else if (buf->b_list == BUF_SHARED) - dispose = BUF_UNSHARED; else dispose = BUF_CLEAN; if(dispose == BUF_CLEAN) buf->b_lru_time = jiffies; if(dispose != buf->b_list) { - if(dispose == BUF_DIRTY || dispose == BUF_UNSHARED) + if(dispose == BUF_DIRTY) buf->b_lru_time = jiffies; if(dispose == BUF_LOCKED && (buf->b_flushtime - buf->b_lru_time) <= bdf_prm.b_un.age_super) @@ -857,16 +771,13 @@ void refile_buffer(struct buffer_head * buf) if (dispose == BUF_DIRTY) { /* This buffer is dirty, maybe we need to start flushing. */ /* If too high a percentage of the buffers are dirty... */ - if (nr_buffers_type[BUF_DIRTY] > - (nr_buffers - nr_buffers_type[BUF_SHARED]) * - bdf_prm.b_un.nfract/100) + if (nr_buffers_type[BUF_DIRTY] > nr_buffers * bdf_prm.b_un.nfract/100) wakeup_bdflush(0); /* If this is a loop device, and - * more than half of the buffers of this size are dirty... */ + * more than half of the buffers are dirty... */ /* (Prevents no-free-buffers deadlock with loop device.) */ - isize = BUFSIZE_INDEX(buf->b_size); if (MAJOR(buf->b_dev) == LOOP_MAJOR && - nr_buffers_st[isize][BUF_DIRTY]*2>nr_buffers_size[isize]) + nr_buffers_type[BUF_DIRTY]*2>nr_buffers) wakeup_bdflush(1); } } @@ -993,11 +904,15 @@ struct buffer_head * breada(kdev_t dev, int block, int bufsize, return NULL; } -/* - * See fs/inode.c for the weird use of volatile.. - */ static void put_unused_buffer_head(struct buffer_head * bh) { + if (nr_unused_buffer_heads >= MAX_UNUSED_BUFFERS) { + nr_buffer_heads--; + kfree(bh); + return; + } + memset(bh,0,sizeof(*bh)); + nr_unused_buffer_heads++; bh->b_next_free = unused_list; unused_list = bh; wake_up(&buffer_wait); @@ -1005,21 +920,23 @@ static void put_unused_buffer_head(struct buffer_head * bh) static void get_more_buffer_heads(void) { - int i; struct buffer_head * bh; - for (;;) { - if (unused_list) - return; - + while (!unused_list) { /* * This is critical. We can't swap out pages to get * more buffer heads, because the swap-out may need * more buffer-heads itself. Thus GFP_ATOMIC. */ - bh = (struct buffer_head *) get_free_page(GFP_ATOMIC); - if (bh) - break; + /* we now use kmalloc() here instead of gfp as we want + to be able to easily release buffer heads - they + took up quite a bit of memory (tridge) */ + bh = (struct buffer_head *) kmalloc(sizeof(*bh),GFP_ATOMIC); + if (bh) { + put_unused_buffer_head(bh); + nr_buffer_heads++; + return; + } /* * Uhhuh. We're _really_ low on memory. Now we just @@ -1030,10 +947,6 @@ static void get_more_buffer_heads(void) sleep_on(&buffer_wait); } - for (nr_buffer_heads+=i=PAGE_SIZE/sizeof*bh ; i>0; i--) { - bh->b_next_free = unused_list; /* only make link */ - unused_list = bh++; - } } /* @@ -1076,6 +989,7 @@ static struct buffer_head * get_unused_buffer_head(void) return NULL; bh = unused_list; unused_list = bh->b_next_free; + nr_unused_buffer_heads--; return bh; } @@ -1401,7 +1315,6 @@ static int grow_buffers(int pri, int size) tmp = bh; while (1) { - nr_free[isize]++; if (insert_point) { tmp->b_next_free = insert_point->b_next_free; tmp->b_prev_free = insert_point; @@ -1413,7 +1326,6 @@ static int grow_buffers(int pri, int size) } insert_point = tmp; ++nr_buffers; - ++nr_buffers_size[isize]; if (tmp->b_this_page) tmp = tmp->b_this_page; else @@ -1443,7 +1355,6 @@ int try_to_free_buffer(struct buffer_head * bh, struct buffer_head ** bhp, { unsigned long page; struct buffer_head * tmp, * p; - int isize = BUFSIZE_INDEX(bh->b_size); *bhp = bh; page = (unsigned long) bh->b_data; @@ -1465,7 +1376,6 @@ int try_to_free_buffer(struct buffer_head * bh, struct buffer_head ** bhp, p = tmp; tmp = tmp->b_this_page; nr_buffers--; - nr_buffers_size[isize]--; if (p == *bhp) { *bhp = p->b_prev_free; @@ -1481,177 +1391,6 @@ int try_to_free_buffer(struct buffer_head * bh, struct buffer_head ** bhp, return !mem_map[MAP_NR(page)].count; } -/* Age buffers on a given page, according to whether they have been - visited recently or not. */ -static inline void age_buffer(struct buffer_head *bh) -{ - struct buffer_head *tmp = bh; - int touched = 0; - - /* - * When we age a page, we mark all other buffers in the page - * with the "has_aged" flag. Then, when these aliased buffers - * come up for aging, we skip them until next pass. This - * ensures that a page full of multiple buffers only gets aged - * once per pass through the lru lists. - */ - if (clear_bit(BH_Has_aged, &bh->b_state)) - return; - - do { - touched |= clear_bit(BH_Touched, &tmp->b_state); - tmp = tmp->b_this_page; - set_bit(BH_Has_aged, &tmp->b_state); - } while (tmp != bh); - clear_bit(BH_Has_aged, &bh->b_state); - - if (touched) - touch_page(mem_map + MAP_NR((unsigned long) bh->b_data)); - else - age_page(mem_map + MAP_NR((unsigned long) bh->b_data)); -} - -/* - * Consult the load average for buffers and decide whether or not - * we should shrink the buffers of one size or not. If we decide yes, - * do it and return 1. Else return 0. Do not attempt to shrink size - * that is specified. - * - * I would prefer not to use a load average, but the way things are now it - * seems unavoidable. The way to get rid of it would be to force clustering - * universally, so that when we reclaim buffers we always reclaim an entire - * page. Doing this would mean that we all need to move towards QMAGIC. - */ - -static int maybe_shrink_lav_buffers(int size) -{ - int nlist; - int isize; - int total_lav, total_n_buffers, n_sizes; - - /* Do not consider the shared buffers since they would not tend - to have getblk called very often, and this would throw off - the lav. They are not easily reclaimable anyway (let the swapper - make the first move). */ - - total_lav = total_n_buffers = n_sizes = 0; - for(nlist = 0; nlist < NR_SIZES; nlist++) - { - total_lav += buffers_lav[nlist]; - if(nr_buffers_size[nlist]) n_sizes++; - total_n_buffers += nr_buffers_size[nlist]; - total_n_buffers -= nr_buffers_st[nlist][BUF_SHARED]; - } - - /* See if we have an excessive number of buffers of a particular - size - if so, victimize that bunch. */ - - isize = (size ? BUFSIZE_INDEX(size) : -1); - - if (n_sizes > 1) - for(nlist = 0; nlist < NR_SIZES; nlist++) - { - if(nlist == isize) continue; - if(nr_buffers_size[nlist] && - bdf_prm.b_un.lav_const * buffers_lav[nlist]*total_n_buffers < - total_lav * (nr_buffers_size[nlist] - nr_buffers_st[nlist][BUF_SHARED])) - if(shrink_specific_buffers(6, bufferindex_size[nlist])) - return 1; - } - return 0; -} - -/* - * Try to free up some pages by shrinking the buffer-cache - * - * Priority tells the routine how hard to try to shrink the - * buffers: 6 means "don't bother too much", while a value - * of 0 means "we'd better get some free pages now". - * - * "limit" is meant to limit the shrink-action only to pages - * that are in the 0 - limit address range, for DMA re-allocations. - * We ignore that right now. - */ - -static int shrink_specific_buffers(unsigned int priority, int size) -{ - struct buffer_head *bh; - int nlist; - int i, isize, isize1; - -#ifdef DEBUG - if(size) printk("Shrinking buffers of size %d\n", size); -#endif - /* First try the free lists, and see if we can get a complete page - from here */ - isize1 = (size ? BUFSIZE_INDEX(size) : -1); - - for(isize = 0; isizeb_next_free, i++) { - if (bh->b_count || buffer_protected(bh) || - !bh->b_this_page) - continue; - if (!age_of((unsigned long) bh->b_data) && - try_to_free_buffer(bh, &bh, 6)) - return 1; - if(!bh) break; - /* Some interrupt must have used it after we - freed the page. No big deal - keep looking */ - } - } - - /* Not enough in the free lists, now try the lru list */ - - for(nlist = 0; nlist < NR_LIST; nlist++) { - repeat1: - if(priority > 2 && nlist == BUF_SHARED) continue; - i = nr_buffers_type[nlist]; - i = ((BUFFEROUT_WEIGHT * i) >> 10) >> priority; - for ( ; i > 0; i-- ) { - bh = next_to_age[nlist]; - if (!bh) - break; - next_to_age[nlist] = bh->b_next_free; - - /* First, age the buffer. */ - age_buffer(bh); - /* We may have stalled while waiting for I/O - to complete. */ - if(bh->b_list != nlist) goto repeat1; - if (bh->b_count || buffer_protected(bh) || - !bh->b_this_page) - continue; - if(size && bh->b_size != size) continue; - if (buffer_locked(bh)) - if (priority) - continue; - else - wait_on_buffer(bh); - if (buffer_dirty(bh)) { - bh->b_count++; - bh->b_flushtime = 0; - ll_rw_block(WRITEA, 1, &bh); - bh->b_count--; - continue; - } - /* At priority 6, only consider really old - (age==0) buffers for reclaiming. At - priority 0, consider any buffers. */ - if ((age_of((unsigned long) bh->b_data) >> - (6-priority)) > 0) - continue; - if (try_to_free_buffer(bh, &bh, 0)) - return 1; - if(!bh) break; - } - } - return 0; -} - - /* ================== Debugging =================== */ void show_buffers(void) @@ -1659,17 +1398,18 @@ void show_buffers(void) struct buffer_head * bh; int found = 0, locked = 0, dirty = 0, used = 0, lastused = 0; int protected = 0; - int shared; - int nlist, isize; + int nlist; + static char *buf_types[NR_LIST] = {"CLEAN","LOCKED","LOCKED1","DIRTY"}; printk("Buffer memory: %6dkB\n",buffermem>>10); printk("Buffer heads: %6d\n",nr_buffer_heads); printk("Buffer blocks: %6d\n",nr_buffers); for(nlist = 0; nlist < NR_LIST; nlist++) { - shared = found = locked = dirty = used = lastused = protected = 0; + found = locked = dirty = used = lastused = protected = 0; bh = lru_list[nlist]; if(!bh) continue; + do { found++; if (buffer_locked(bh)) @@ -1678,260 +1418,32 @@ void show_buffers(void) protected++; if (buffer_dirty(bh)) dirty++; - if (mem_map[MAP_NR(((unsigned long) bh->b_data))].count != 1) - shared++; if (bh->b_count) used++, lastused = found; bh = bh->b_next_free; } while (bh != lru_list[nlist]); - printk("Buffer[%d] mem: %d buffers, %d used (last=%d), " - "%d locked, %d protected, %d dirty %d shrd\n", - nlist, found, used, lastused, - locked, protected, dirty, shared); - }; - printk("Size [LAV] Free Clean Unshar Lck Lck1 Dirty Shared \n"); - for(isize = 0; isizeb_data; - page &= PAGE_MASK; - if(mem_map[MAP_NR(page)].count != 1) return 0; - tmp = bh; - do { - if (!tmp) - return 0; - - if (tmp->b_count || buffer_protected(tmp) || - buffer_dirty(tmp) || buffer_locked(tmp)) - return 0; - tmp = tmp->b_this_page; - } while (tmp != bh); - tmp = bh; - - while((unsigned long) tmp->b_data & (PAGE_SIZE - 1)) - tmp = tmp->b_this_page; - - /* This is the buffer at the head of the page */ - bh = tmp; - do { - p = tmp; - tmp = tmp->b_this_page; - remove_from_queues(p); - p->b_dev = dev; - mark_buffer_uptodate(p, 0); - clear_bit(BH_Req, &p->b_state); - p->b_blocknr = starting_block++; - insert_into_queues(p); - } while (tmp != bh); - return 1; -} - -/* - * Try to find a free cluster by locating a page where - * all of the buffers are unused. We would like this function - * to be atomic, so we do not call anything that might cause - * the process to sleep. The priority is somewhat similar to - * the priority used in shrink_buffers. - * - * My thinking is that the kernel should end up using whole - * pages for the buffer cache as much of the time as possible. - * This way the other buffers on a particular page are likely - * to be very near each other on the free list, and we will not - * be expiring data prematurely. For now we only cannibalize buffers - * of the same size to keep the code simpler. - */ -static int reassign_cluster(kdev_t dev, - unsigned int starting_block, int size) -{ - struct buffer_head *bh; - int isize = BUFSIZE_INDEX(size); - int i; - - /* We want to give ourselves a really good shot at generating - a cluster, and since we only take buffers from the free - list, we "overfill" it a little. */ - - while(nr_free[isize] < 32) refill_freelist(size); - - bh = free_list[isize]; - if(bh) - for (i=0 ; !i || bh != free_list[isize] ; bh = bh->b_next_free, i++) { - if (!bh->b_this_page) continue; - if (try_to_reassign(bh, &bh, dev, starting_block)) - return 4; - } - return 0; -} - -/* This function tries to generate a new cluster of buffers - * from a new page in memory. We should only do this if we have - * not expanded the buffer cache to the maximum size that we allow. - */ -static unsigned long try_to_generate_cluster(kdev_t dev, int block, int size) -{ - struct buffer_head * bh, * tmp, * arr[MAX_BUF_PER_PAGE]; - int isize = BUFSIZE_INDEX(size); - unsigned long offset; - unsigned long page; - int nblock; - - page = get_free_page(GFP_NOBUFFER); - if(!page) return 0; - - bh = create_buffers(page, size); - if (!bh) { - free_page(page); - return 0; + printk("%8s: %d buffers, %d used (last=%d), " + "%d locked, %d protected, %d dirty\n", + buf_types[nlist], found, used, lastused, + locked, protected, dirty); }; - nblock = block; - for (offset = 0 ; offset < PAGE_SIZE ; offset += size) { - if (find_buffer(dev, nblock++, size)) - goto not_aligned; - } - tmp = bh; - nblock = 0; - while (1) { - arr[nblock++] = bh; - bh->b_count = 1; - bh->b_flushtime = 0; - bh->b_state = 0; - bh->b_dev = dev; - bh->b_list = BUF_CLEAN; - bh->b_blocknr = block++; - nr_buffers++; - nr_buffers_size[isize]++; - insert_into_queues(bh); - if (bh->b_this_page) - bh = bh->b_this_page; - else - break; - } - buffermem += PAGE_SIZE; - mem_map[MAP_NR(page)].buffers = bh; - bh->b_this_page = tmp; - while (nblock-- > 0) - brelse(arr[nblock]); - return 4; /* ?? */ -not_aligned: - while ((tmp = bh) != NULL) { - bh = bh->b_this_page; - put_unused_buffer_head(tmp); - } - free_page(page); - return 0; } -unsigned long generate_cluster(kdev_t dev, int b[], int size) -{ - int i, offset; - - for (i = 0, offset = 0 ; offset < PAGE_SIZE ; i++, offset += size) { - if(i && b[i]-1 != b[i-1]) return 0; /* No need to cluster */ - if(find_buffer(dev, b[i], size)) return 0; - }; - - /* OK, we have a candidate for a new cluster */ - - /* See if one size of buffer is over-represented in the buffer cache, - if so reduce the numbers of buffers */ - if(maybe_shrink_lav_buffers(size)) - { - int retval; - retval = try_to_generate_cluster(dev, b[0], size); - if(retval) return retval; - }; - - if (nr_free_pages > min_free_pages*2) - return try_to_generate_cluster(dev, b[0], size); - else - return reassign_cluster(dev, b[0], size); -} - -unsigned long generate_cluster_swab32(kdev_t dev, int b[], int size) -{ - int i, offset; - - for (i = 0, offset = 0 ; offset < PAGE_SIZE ; i++, offset += size) { - if(i && le32_to_cpu(b[i])-1 != - le32_to_cpu(b[i-1])) return 0; /* No need to cluster */ - if(find_buffer(dev, le32_to_cpu(b[i]), size)) return 0; - }; - - /* OK, we have a candidate for a new cluster */ - - /* See if one size of buffer is over-represented in the buffer cache, - if so reduce the numbers of buffers */ - if(maybe_shrink_lav_buffers(size)) - { - int retval; - retval = try_to_generate_cluster(dev, le32_to_cpu(b[0]), size); - if(retval) return retval; - }; - - if (nr_free_pages > min_free_pages*2) - return try_to_generate_cluster(dev, le32_to_cpu(b[0]), size); - else - return reassign_cluster(dev, le32_to_cpu(b[0]), size); -} /* ===================== Init ======================= */ /* - * This initializes the initial buffer free list. nr_buffers_type is set - * to one less the actual number of buffers, as a sop to backwards - * compatibility --- the old code did this (I think unintentionally, - * but I'm not sure), and programs in the ps package expect it. - * - TYT 8/30/92 + * allocate the hash table and init the free list */ void buffer_init(void) { - int i; - int isize = BUFSIZE_INDEX(BLOCK_SIZE); - long memsize = num_physpages << PAGE_SHIFT; - - if (memsize >= 64*1024*1024) - nr_hash = 65521; - else if (memsize >= 32*1024*1024) - nr_hash = 32749; - else if (memsize >= 16*1024*1024) - nr_hash = 16381; - else if (memsize >= 8*1024*1024) - nr_hash = 8191; - else if (memsize >= 4*1024*1024) - nr_hash = 4093; - else nr_hash = 997; - - hash_table = (struct buffer_head **) vmalloc(nr_hash * - sizeof(struct buffer_head *)); - + hash_table = (struct buffer_head **)vmalloc(NR_HASH*sizeof(struct buffer_head *)); + if (!hash_table) + panic("Failed to allocate buffer hash table\n"); + memset(hash_table,0,NR_HASH*sizeof(struct buffer_head *)); - for (i = 0 ; i < nr_hash ; i++) - hash_table[i] = NULL; lru_list[BUF_CLEAN] = 0; grow_buffers(GFP_KERNEL, BLOCK_SIZE); - if (!free_list[isize]) - panic("VFS: Unable to initialize buffer free list!"); - return; } @@ -1967,7 +1479,7 @@ static void wakeup_bdflush(int wait) asmlinkage int sync_old_buffers(void) { - int i, isize; + int i; int ndirty, nwritten; int nlist; int ncount; @@ -2023,13 +1535,6 @@ asmlinkage int sync_old_buffers(void) printk("Wrote %d/%d buffers\n", nwritten, ndirty); #endif - /* We assume that we only come through here on a regular - schedule, like every 5 seconds. Now update load averages. - Shift usage counts to prevent overflow. */ - for(isize = 0; isizesignal = 0; interruptible_sleep_on(&bdflush_wait); } diff --git a/fs/dcache.c b/fs/dcache.c index 809c21528833..e375f18d8180 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -27,7 +27,7 @@ * to be short. */ #define DCACHE_NAME_LEN 15 -#define DCACHE_SIZE 128 +#define DCACHE_SIZE 1024 struct hash_list { struct dir_cache_entry * next; diff --git a/fs/ext/inode.c b/fs/ext/inode.c index 7ca1cd1725c8..5545dd1229ff 100644 --- a/fs/ext/inode.c +++ b/fs/ext/inode.c @@ -46,7 +46,7 @@ void ext_put_super(struct super_block *sb) return; } -static struct super_operations ext_sops = { +static struct super_operations ext_sops = { ext_read_inode, NULL, ext_write_inode, @@ -57,7 +57,7 @@ static struct super_operations ext_sops = { NULL }; -struct super_block *ext_read_super(struct super_block *s,void *data, +struct super_block *ext_read_super(struct super_block *s,void *data, int silent) { struct buffer_head *bh; @@ -346,7 +346,7 @@ struct buffer_head * ext_bread(struct inode * inode, int block, int create) struct buffer_head * bh; bh = ext_getblk(inode,block,create); - if (!bh || buffer_uptodate(bh)) + if (!bh || buffer_uptodate(bh)) return bh; ll_rw_block(READ, 1, &bh); wait_on_buffer(bh); @@ -462,13 +462,11 @@ int init_ext_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_ext_fs()) == 0) - register_symtab(0); - return status; + return init_ext_fs(); } void cleanup_module(void) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index eddcc5ab5e1c..5a876261e2e7 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -329,42 +329,6 @@ repeat: return result; } -static int block_getcluster (struct inode * inode, struct buffer_head * bh, - int nr, - int blocksize) -{ - u32 * p; - int firstblock = 0; - int result = 0; - int i; - - /* Check to see if clustering possible here. */ - - if(!bh) return 0; - - if((nr & ((PAGE_SIZE >> EXT2_BLOCK_SIZE_BITS(inode->i_sb)) - 1)) != 0) - goto out; - if(nr + 3 > EXT2_ADDR_PER_BLOCK(inode->i_sb)) goto out; - - for(i=0; i< (PAGE_SIZE >> EXT2_BLOCK_SIZE_BITS(inode->i_sb)); i++) { - p = (u32 *) bh->b_data + nr + i; - - /* All blocks in cluster must already be allocated */ - if(le32_to_cpu(*p) == 0) goto out; - - /* See if aligned correctly */ - if(i==0) firstblock = le32_to_cpu(*p); - else if(le32_to_cpu(*p) != firstblock + i) goto out; - } - - p = (u32 *) bh->b_data + nr; - result = generate_cluster_swab32(bh->b_dev, (int *) p, blocksize); - - out: - brelse(bh); - return result; -} - struct buffer_head * ext2_getblk (struct inode * inode, long block, int create, int * err) { @@ -427,56 +391,6 @@ struct buffer_head * ext2_getblk (struct inode * inode, long block, inode->i_sb->s_blocksize, b, err); } -int ext2_getcluster (struct inode * inode, long block) -{ - struct buffer_head * bh; - int err, create; - unsigned long b; - unsigned long addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); - int addr_per_block_bits = EXT2_ADDR_PER_BLOCK_BITS(inode->i_sb); - - create = 0; - err = -EIO; - if (block < 0) { - ext2_warning (inode->i_sb, "ext2_getblk", "block < 0"); - return 0; - } - if (block > EXT2_NDIR_BLOCKS + addr_per_block + - (1 << (addr_per_block_bits * 2)) + - ((1 << (addr_per_block_bits * 2)) << addr_per_block_bits)) { - ext2_warning (inode->i_sb, "ext2_getblk", "block > big"); - return 0; - } - - err = -ENOSPC; - b = block; - if (block < EXT2_NDIR_BLOCKS) return 0; - - block -= EXT2_NDIR_BLOCKS; - - if (block < addr_per_block) { - bh = inode_getblk (inode, EXT2_IND_BLOCK, create, b, &err); - return block_getcluster (inode, bh, block, - inode->i_sb->s_blocksize); - } - block -= addr_per_block; - if (block < (1 << (addr_per_block_bits * 2))) { - bh = inode_getblk (inode, EXT2_DIND_BLOCK, create, b, &err); - bh = block_getblk (inode, bh, block >> addr_per_block_bits, - create, inode->i_sb->s_blocksize, b, &err); - return block_getcluster (inode, bh, block & (addr_per_block - 1), - inode->i_sb->s_blocksize); - } - block -= (1 << (addr_per_block_bits * 2)); - bh = inode_getblk (inode, EXT2_TIND_BLOCK, create, b, &err); - bh = block_getblk (inode, bh, block >> (addr_per_block_bits * 2), - create, inode->i_sb->s_blocksize, b, &err); - bh = block_getblk (inode, bh, (block >> addr_per_block_bits) & (addr_per_block - 1), - create, inode->i_sb->s_blocksize, b, &err); - return block_getcluster (inode, bh, block & (addr_per_block - 1), - inode->i_sb->s_blocksize); -} - struct buffer_head * ext2_bread (struct inode * inode, int block, int create, int *err) { diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 6bcdb5e2092e..bcb20c3c3c8c 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -129,7 +129,7 @@ void ext2_put_super (struct super_block * sb) return; } -static struct super_operations ext2_sops = { +static struct super_operations ext2_sops = { ext2_read_inode, NULL, ext2_write_inode, @@ -421,22 +421,22 @@ struct super_block * ext2_read_super (struct super_block * sb, void * data, if (le32_to_cpu(es->s_rev_level) > EXT2_GOOD_OLD_REV) { if (le32_to_cpu(es->s_feature_incompat) & ~EXT2_FEATURE_INCOMPAT_SUPP) { printk("EXT2-fs: %s: couldn't mount because of " - "unsupported optional features.\n", + "unsupported optional features.\n", kdevname(dev)); goto failed_mount; } if (!(sb->s_flags & MS_RDONLY) && (le32_to_cpu(es->s_feature_ro_compat) & ~EXT2_FEATURE_RO_COMPAT_SUPP)) { printk("EXT2-fs: %s: couldn't mount RDWR because of " - "unsupported optional features.\n", + "unsupported optional features.\n", kdevname(dev)); goto failed_mount; } } sb->s_blocksize_bits = le32_to_cpu(sb->u.ext2_sb.s_es->s_log_block_size) + 10; sb->s_blocksize = 1 << sb->s_blocksize_bits; - if (sb->s_blocksize != BLOCK_SIZE && - (sb->s_blocksize == 1024 || sb->s_blocksize == 2048 || + if (sb->s_blocksize != BLOCK_SIZE && + (sb->s_blocksize == 1024 || sb->s_blocksize == 2048 || sb->s_blocksize == 4096)) { unsigned long offset; @@ -675,7 +675,7 @@ int ext2_remount (struct super_block * sb, int * flags, char * data) else { /* * Mounting a RDONLY partition read-write, so reread and - * store the current valid flag. (It may have been changed + * store the current valid flag. (It may have been changed * by e2fsck since we originally mounted the partition.) */ sb->u.ext2_sb.s_mount_state = le16_to_cpu(es->s_state); @@ -695,13 +695,11 @@ int init_ext2_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_ext2_fs()) == 0) - register_symtab(0); - return status; + return init_ext2_fs(); } void cleanup_module(void) diff --git a/fs/fat/fatfs_syms.c b/fs/fat/fatfs_syms.c index 6318549ccb1c..b711e97a5d8d 100644 --- a/fs/fat/fatfs_syms.c +++ b/fs/fat/fatfs_syms.c @@ -14,45 +14,40 @@ extern struct file_operations fat_dir_operations; -static struct symbol_table fat_syms = { -#include - X(fat_a2alias), - X(fat_a2uni), - X(fat_add_cluster), - X(fat_bmap), - X(fat_brelse), - X(fat_cache_inval_inode), - X(fat_code2uni), - X(fat_date_unix2dos), - X(fat_dir_operations), - X(fat_file_read), - X(fat_file_write), - X(fat_fs_panic), - X(fat_get_entry), - X(fat_lock_creation), - X(fat_mark_buffer_dirty), - X(fat_mmap), - X(fat_notify_change), - X(fat_parent_ino), - X(fat_put_inode), - X(fat_put_super), - X(fat_read_inode), - X(fat_read_super), - X(fat_readdirx), - X(fat_readdir), - X(fat_scan), - X(fat_smap), - X(fat_statfs), - X(fat_truncate), - X(fat_uni2asc_pg), - X(fat_uni2code), - X(fat_unlock_creation), - X(fat_write_inode), -#include -}; +EXPORT_SYMBOL(fat_a2alias); +EXPORT_SYMBOL(fat_a2uni); +EXPORT_SYMBOL(fat_add_cluster); +EXPORT_SYMBOL(fat_bmap); +EXPORT_SYMBOL(fat_brelse); +EXPORT_SYMBOL(fat_cache_inval_inode); +EXPORT_SYMBOL(fat_code2uni); +EXPORT_SYMBOL(fat_date_unix2dos); +EXPORT_SYMBOL(fat_dir_operations); +EXPORT_SYMBOL(fat_file_read); +EXPORT_SYMBOL(fat_file_write); +EXPORT_SYMBOL(fat_fs_panic); +EXPORT_SYMBOL(fat_get_entry); +EXPORT_SYMBOL(fat_lock_creation); +EXPORT_SYMBOL(fat_mark_buffer_dirty); +EXPORT_SYMBOL(fat_mmap); +EXPORT_SYMBOL(fat_notify_change); +EXPORT_SYMBOL(fat_parent_ino); +EXPORT_SYMBOL(fat_put_inode); +EXPORT_SYMBOL(fat_put_super); +EXPORT_SYMBOL(fat_read_inode); +EXPORT_SYMBOL(fat_read_super); +EXPORT_SYMBOL(fat_readdirx); +EXPORT_SYMBOL(fat_readdir); +EXPORT_SYMBOL(fat_scan); +EXPORT_SYMBOL(fat_smap); +EXPORT_SYMBOL(fat_statfs); +EXPORT_SYMBOL(fat_truncate); +EXPORT_SYMBOL(fat_uni2asc_pg); +EXPORT_SYMBOL(fat_uni2code); +EXPORT_SYMBOL(fat_unlock_creation); +EXPORT_SYMBOL(fat_write_inode); int init_fat_fs(void) { - return register_symtab(&fat_syms); + return 0; } - diff --git a/fs/hpfs/hpfs_fs.c b/fs/hpfs/hpfs_fs.c index 3d70172f516e..3fdc59a1c5b8 100644 --- a/fs/hpfs/hpfs_fs.c +++ b/fs/hpfs/hpfs_fs.c @@ -29,7 +29,7 @@ #include "hpfs.h" #include "hpfs_caps.h" -/* +/* * HPFS is a mixture of 512-byte blocks and 2048-byte blocks. The 2k blocks * are used for directories and bitmaps. For bmap to work, we must run the * file system with 512-byte blocks. The 2k blocks are assembled in buffers @@ -115,7 +115,7 @@ * seen -- in fact noncontiguous files are seldom seen. I think this is * partly the open() call that lets programs specify the length of an * output file when they know it, and partly because HPFS.IFS really is - * very good at resisting fragmentation. + * very good at resisting fragmentation. */ /* notation */ @@ -298,7 +298,7 @@ static inline fnode_secno ino_secno(ino_t ino) } /* - * test for directory's inode number + * test for directory's inode number */ static inline int ino_is_dir(ino_t ino) @@ -606,7 +606,7 @@ static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask, else return 0; } - else if (!strcmp(p,"nocheck")) + else if (!strcmp(p,"nocheck")) *nocheck=1; else return 1; @@ -1043,7 +1043,7 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno) * Search allocation tree *b for the given file sector number and return * the disk sector number. Buffer *bhp has the tree in it, and can be * reused for subtrees when access to *b is no longer needed. - * *bhp is busy on entry and exit. + * *bhp is busy on entry and exit. */ static secno bplus_lookup(struct inode *inode, struct bplus_header *b, @@ -1342,7 +1342,7 @@ static struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno, * 0 => . -1 => .. 1 1.1 ... 8.9 9 => files -2 => eof * * The directory inode caches one position-to-dnode correspondence so - * we won't have to repeatedly scan the top levels of the tree. + * we won't have to repeatedly scan the top levels of the tree. */ /* @@ -1427,7 +1427,7 @@ static int hpfs_readdir(struct inode *inode, struct file *filp, void * dirent, /* * Map the dir entry at subtree coordinates given by *posp, and - * increment *posp to point to the following dir entry. + * increment *posp to point to the following dir entry. */ static struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp, @@ -1754,13 +1754,11 @@ int init_hpfs_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_hpfs_fs()) == 0) - register_symtab(0); - return status; + return init_hpfs_fs(); } void cleanup_module(void) @@ -1769,4 +1767,3 @@ void cleanup_module(void) } #endif - diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 086872bf2434..5d4857ed1625 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -1,6 +1,6 @@ /* * linux/fs/isofs/inode.c - * + * * (C) 1991 Linus Torvalds - minix filesystem * 1992, 1993, 1994 Eric Youngdale Modified for ISO9660 filesystem. * 1994 Eberhard Moenkeberg - multi session handling. @@ -41,7 +41,7 @@ void isofs_put_super(struct super_block *sb) lock_super(sb); #ifdef LEAK_CHECK - printk("Outstanding mallocs:%d, outstanding buffers: %d\n", + printk("Outstanding mallocs:%d, outstanding buffers: %d\n", check_malloc, check_bread); #endif sb->s_dev = 0; @@ -50,7 +50,7 @@ void isofs_put_super(struct super_block *sb) return; } -static struct super_operations isofs_sops = { +static struct super_operations isofs_sops = { isofs_read_inode, NULL, /* notify_change */ NULL, /* write_inode */ @@ -127,7 +127,7 @@ static int parse_options(char *options, struct iso9660_options * popt) else if (!strcmp(value,"auto")) popt->conversion = 'a'; else return 0; } - else if (value && + else if (value && (!strcmp(this_char,"block") || !strcmp(this_char,"mode") || !strcmp(this_char,"uid") || @@ -143,8 +143,8 @@ static int parse_options(char *options, struct iso9660_options * popt) if (*vpnt) return 0; switch(*this_char) { case 'b': - if ( ivalue != 512 - && ivalue != 1024 + if ( ivalue != 512 + && ivalue != 1024 && ivalue != 2048) return 0; popt->blocksize = ivalue; break; @@ -177,7 +177,7 @@ static int parse_options(char *options, struct iso9660_options * popt) * * A broken CDwriter software or drive firmware does not set new standards, * at least not if conflicting with the existing ones. - * + * * emoenke@gwdg.de */ #define WE_OBEY_THE_WRITTEN_STANDARDS 1 @@ -201,7 +201,7 @@ static unsigned int isofs_get_last_session(kdev_t dev) CDROMMULTISESSION, (unsigned long) &ms_info); set_fs(USER_DS); -#if 0 +#if 0 printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); if (i==0) { @@ -258,7 +258,7 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, printk("gid = %d\n", opt.gid); printk("uid = %d\n", opt.uid); #endif - + blocksize_bits = 0; { int i = opt.blocksize; @@ -274,7 +274,7 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, s->u.isofs_sb.s_high_sierra = high_sierra = 0; /* default is iso9660 */ vol_desc_start = isofs_get_last_session(dev); - + for (iso_blknum = vol_desc_start+16; iso_blknum < vol_desc_start+100; iso_blknum++) { int b = iso_blknum << (ISOFS_BLOCK_BITS-blocksize_bits); @@ -292,26 +292,26 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, vdp = (struct iso_volume_descriptor *)bh->b_data; hdp = (struct hs_volume_descriptor *)bh->b_data; - + if (strncmp (hdp->id, HS_STANDARD_ID, sizeof hdp->id) == 0) { if (isonum_711 (hdp->type) != ISO_VD_PRIMARY) goto out; if (isonum_711 (hdp->type) == ISO_VD_END) goto out; - + s->u.isofs_sb.s_high_sierra = 1; high_sierra = 1; opt.rock = 'n'; h_pri = (struct hs_primary_descriptor *)vdp; break; } - + if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof vdp->id) == 0) { if (isonum_711 (vdp->type) != ISO_VD_PRIMARY) goto out; if (isonum_711 (vdp->type) == ISO_VD_END) goto out; - + pri = (struct iso_primary_descriptor *)vdp; break; } @@ -326,7 +326,7 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, MOD_DEC_USE_COUNT; return NULL; } - + if(high_sierra){ rootp = (struct iso_directory_record *) h_pri->root_directory_record; #ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS @@ -350,9 +350,9 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, s->u.isofs_sb.s_log_zone_size = isonum_723 (pri->logical_block_size); s->u.isofs_sb.s_max_size = isonum_733(pri->volume_space_size); } - + s->u.isofs_sb.s_ninodes = 0; /* No way to figure this out easily */ - + /* RDE: convert log zone size to bit shift */ orig_zonesize = s -> u.isofs_sb.s_log_zone_size; @@ -368,22 +368,22 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, /* RDE: data zone now byte offset! */ - s->u.isofs_sb.s_firstdatazone = ((isonum_733 (rootp->extent) + + s->u.isofs_sb.s_firstdatazone = ((isonum_733 (rootp->extent) + isonum_711 (rootp->ext_attr_length)) << s -> u.isofs_sb.s_log_zone_size); s->s_magic = ISOFS_SUPER_MAGIC; - + /* The CDROM is read-only, has no nodes (devices) on it, and since all of the files appear to be owned by root, we really do not want to allow suid. (suid or devices will not show up unless we have Rock Ridge extensions) */ - + s->s_flags |= MS_RDONLY /* | MS_NODEV | MS_NOSUID */; - + brelse(bh); - + printk(KERN_DEBUG "Max size:%ld Log zone size:%ld\n", - s->u.isofs_sb.s_max_size, + s->u.isofs_sb.s_max_size, 1UL << s->u.isofs_sb.s_log_zone_size); printk(KERN_DEBUG "First datazone:%ld Root inode number %d\n", s->u.isofs_sb.s_firstdatazone >> s -> u.isofs_sb.s_log_zone_size, @@ -392,7 +392,7 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, if(high_sierra) printk(KERN_DEBUG "Disc in High Sierra format.\n"); unlock_super(s); /* set up enough so that it can read an inode */ - + /* * Force the blocksize to 512 for 512 byte sectors. The file * read primitives really get it wrong in a bad way if we don't @@ -430,7 +430,7 @@ struct super_block *isofs_read_super(struct super_block *s,void *data, s->u.isofs_sb.s_mode = opt.mode & 0777; s->s_blocksize = opt.blocksize; s->s_blocksize_bits = blocksize_bits; - s->s_mounted = iget(s, (isonum_733(rootp->extent) + + s->s_mounted = iget(s, (isonum_733(rootp->extent) + isonum_711(rootp->ext_attr_length)) << s -> u.isofs_sb.s_log_zone_size); unlock_super(s); @@ -507,7 +507,7 @@ void isofs_read_inode(struct inode * inode) printk("unable to read i-node block"); goto fail; } - + pnt = ((unsigned char *) bh->b_data + (inode->i_ino & (bufsize - 1))); raw_inode = ((struct iso_directory_record *) pnt); @@ -552,7 +552,7 @@ void isofs_read_inode(struct inode * inode) for(i=0; i< raw_inode->name_len[0]; i++) if(raw_inode->name[i]=='.' || raw_inode->name[i]==';') break; - if(i == raw_inode->name_len[0] || raw_inode->name[i] == ';') + if(i == raw_inode->name_len[0] || raw_inode->name[i] == ';') inode->i_mode |= S_IXUGO; /* execute permission */ } inode->i_uid = inode->i_sb->u.isofs_sb.s_uid; @@ -571,12 +571,12 @@ void isofs_read_inode(struct inode * inode) byte of the file length. Catch this and holler. WARNING: this will make it impossible for a file to be > 16Mb on the CDROM!!!*/ - if(inode->i_sb->u.isofs_sb.s_cruft == 'y' && + if(inode->i_sb->u.isofs_sb.s_cruft == 'y' && inode->i_size & 0xff000000){ /* printk("Illegal format on cdrom. Pester manufacturer.\n"); */ inode->i_size &= 0x00ffffff; } - + if (raw_inode->interleave[0]) { printk("Interleaved files not (yet) supported.\n"); inode->i_size = 0; @@ -598,17 +598,17 @@ void isofs_read_inode(struct inode * inode) #endif #ifdef DEBUG - printk("Get inode %d: %d %d: %d\n",inode->i_ino, block, + printk("Get inode %d: %d %d: %d\n",inode->i_ino, block, ((int)pnt) & 0x3ff, inode->i_size); #endif - - inode->i_mtime = inode->i_atime = inode->i_ctime = + + inode->i_mtime = inode->i_atime = inode->i_ctime = iso_date(raw_inode->date, high_sierra); - inode->u.isofs_i.i_first_extent = (isonum_733 (raw_inode->extent) + + inode->u.isofs_i.i_first_extent = (isonum_733 (raw_inode->extent) + isonum_711 (raw_inode->ext_attr_length)) << inode -> i_sb -> u.isofs_sb.s_log_zone_size; - + inode->u.isofs_i.i_backlink = 0xffffffff; /* Will be used for previous directory */ switch (inode->i_sb->u.isofs_sb.s_conversion){ case 'a': @@ -633,31 +633,31 @@ void isofs_read_inode(struct inode * inode) /* hmm..if we want uid or gid set, override the rock ridge setting */ test_and_set_uid(&inode->i_uid, inode->i_sb->u.isofs_sb.s_uid); } - + #ifdef DEBUG printk("Inode: %x extent: %x\n",inode->i_ino, inode->u.isofs_i.i_first_extent); #endif brelse(bh); - + inode->i_op = NULL; /* get the volume sequence number */ volume_seq_no = isonum_723 (raw_inode->volume_sequence_number) ; - /* + /* * Disable checking if we see any volume number other than 0 or 1. * We could use the cruft option, but that has multiple purposes, one * of which is limiting the file size to 16Mb. Thus we silently allow * volume numbers of 0 to go through without complaining. */ - if (inode->i_sb->u.isofs_sb.s_cruft == 'n' && + if (inode->i_sb->u.isofs_sb.s_cruft == 'n' && (volume_seq_no != 0) && (volume_seq_no != 1)) { printk("Warning: defective cdrom (volume sequence number). Enabling \"cruft\" mount option.\n"); inode->i_sb->u.isofs_sb.s_cruft = 'y'; } #ifndef IGNORE_WRONG_MULTI_VOLUME_SPECS - if (inode->i_sb->u.isofs_sb.s_cruft != 'y' && + if (inode->i_sb->u.isofs_sb.s_cruft != 'y' && (volume_seq_no != 0) && (volume_seq_no != 1)) { printk("Multi volume CD somehow got mounted.\n"); } else @@ -725,31 +725,31 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) int directory_size; struct buffer_head * bh; struct iso_directory_record * de; - + offset = 0; block = extent << (ISOFS_ZONE_BITS(parent) - bufbits); if (!(bh = bread(parent->i_dev, block, bufsize))) return -1; - + while (1 == 1) { de = (struct iso_directory_record *) (bh->b_data + offset); - if (*((unsigned char *) de) == 0) + if (*((unsigned char *) de) == 0) { brelse(bh); printk("Directory .. not found\n"); return -1; } - + offset += *((unsigned char *) de); - if (offset >= bufsize) + if (offset >= bufsize) { printk(".. Directory not in first block" " of directory.\n"); brelse(bh); return -1; } - - if (de->name_len[0] == 1 && de->name[0] == 1) + + if (de->name_len[0] == 1 && de->name[0] == 1) { parent_dir = find_rock_ridge_relocation(de, parent); directory_size = isonum_733 (de->size); @@ -761,7 +761,7 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) printk("Parent dir:%x\n",parent_dir); #endif /* Now we know the extent where the parent dir starts on. */ - + result = -1; offset = 0; @@ -770,17 +770,17 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) { return -1; } - + for(;;) { de = (struct iso_directory_record *) (bh->b_data + offset); inode_number = (block << bufbits)+(offset & (bufsize - 1)); - + /* If the length byte is zero, we should move on to the next CDROM sector. If we are at the end of the directory, we kick out of the while loop. */ - - if (*((unsigned char *) de) == 0) + + if (*((unsigned char *) de) == 0) { brelse(bh); offset = 0; @@ -802,7 +802,7 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) } continue; } - + /* Make sure that the entire directory record is in the current bh block. If not, we malloc a buffer, and put the two halves together, so that we can cleanly read the block. */ @@ -821,7 +821,7 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) brelse(bh); offset -= bufsize; directory_size -= bufsize; - if(directory_size < 0) + if(directory_size < 0) { printk("Directory size < 0\n"); return -1; @@ -833,12 +833,12 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) } memcpy((char *)cpnt+frag1, bh->b_data, offset); } - + if (find_rock_ridge_relocation(de, parent) == extent){ result = inode_number; goto out; } - + if (cpnt) { kfree(cpnt); cpnt = NULL; @@ -859,7 +859,7 @@ int isofs_lookup_grandparent(struct inode * parent, int extent) #endif return result; } - + #ifdef LEAK_CHECK #undef malloc #undef free_s @@ -900,13 +900,11 @@ int init_iso9660_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_iso9660_fs()) == 0) - register_symtab(0); - return status; + return init_iso9660_fs(); } void cleanup_module(void) @@ -915,4 +913,3 @@ void cleanup_module(void) } #endif - diff --git a/fs/minix/inode.c b/fs/minix/inode.c index db47aed4ce07..3474c20b87e8 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -74,7 +74,7 @@ void minix_put_super(struct super_block *sb) return; } -static struct super_operations minix_sops = { +static struct super_operations minix_sops = { minix_read_inode, NULL, minix_write_inode, @@ -163,7 +163,7 @@ static const char * minix_checkroot(struct super_block *s) return errmsg; } -struct super_block *minix_read_super(struct super_block *s,void *data, +struct super_block *minix_read_super(struct super_block *s,void *data, int silent) { struct buffer_head *bh; @@ -441,7 +441,7 @@ int minix_bmap(struct inode * inode,int block) /* * The minix V1 fs getblk functions. */ -static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr, +static struct buffer_head * V1_inode_getblk(struct inode * inode, int nr, int create) { int tmp; @@ -475,7 +475,7 @@ repeat: return result; } -static struct buffer_head * V1_block_getblk(struct inode * inode, +static struct buffer_head * V1_block_getblk(struct inode * inode, struct buffer_head * bh, int nr, int create) { int tmp; @@ -525,7 +525,7 @@ repeat: return result; } -static struct buffer_head * V1_minix_getblk(struct inode * inode, int block, +static struct buffer_head * V1_minix_getblk(struct inode * inode, int block, int create) { struct buffer_head * bh; @@ -554,7 +554,7 @@ static struct buffer_head * V1_minix_getblk(struct inode * inode, int block, /* * The minix V2 fs getblk functions. */ -static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr, +static struct buffer_head * V2_inode_getblk(struct inode * inode, int nr, int create) { int tmp; @@ -588,7 +588,7 @@ repeat: return result; } -static struct buffer_head * V2_block_getblk(struct inode * inode, +static struct buffer_head * V2_block_getblk(struct inode * inode, struct buffer_head * bh, int nr, int create) { int tmp; @@ -638,7 +638,7 @@ repeat: return result; } -static struct buffer_head * V2_minix_getblk(struct inode * inode, int block, +static struct buffer_head * V2_minix_getblk(struct inode * inode, int block, int create) { struct buffer_head * bh; @@ -952,13 +952,11 @@ int init_minix_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_minix_fs()) == 0) - register_symtab(0); - return status; + return init_minix_fs(); } void cleanup_module(void) diff --git a/fs/msdos/msdosfs_syms.c b/fs/msdos/msdosfs_syms.c index 2621fbfcc909..7827c0af3c10 100644 --- a/fs/msdos/msdosfs_syms.c +++ b/fs/msdos/msdosfs_syms.c @@ -10,38 +10,29 @@ #include #include -static struct symbol_table msdos_syms = { -#include - /* - * Support for umsdos fs - * - * These symbols are _always_ exported, in case someone - * wants to install the umsdos module later. - */ - X(msdos_create), - X(msdos_lookup), - X(msdos_mkdir), - X(msdos_read_inode), - X(msdos_rename), - X(msdos_rmdir), - X(msdos_unlink), - X(msdos_unlink_umsdos), - X(msdos_read_super), - X(msdos_put_super), -#include -}; +/* + * Support for umsdos fs + * + * These symbols are _always_ exported, in case someone + * wants to install the umsdos module later. + */ +EXPORT_SYMBOL(msdos_create); +EXPORT_SYMBOL(msdos_lookup); +EXPORT_SYMBOL(msdos_mkdir); +EXPORT_SYMBOL(msdos_read_inode); +EXPORT_SYMBOL(msdos_rename); +EXPORT_SYMBOL(msdos_rmdir); +EXPORT_SYMBOL(msdos_unlink); +EXPORT_SYMBOL(msdos_unlink_umsdos); +EXPORT_SYMBOL(msdos_read_super); +EXPORT_SYMBOL(msdos_put_super); + struct file_system_type msdos_fs_type = { msdos_read_super, "msdos", 1, NULL }; - int init_msdos_fs(void) { - int status; - - if ((status = register_filesystem(&msdos_fs_type)) == 0) - status = register_symtab(&msdos_syms); - return status; + return register_filesystem(&msdos_fs_type); } - diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index e63af19346fa..5a95ffb1f337 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c @@ -151,7 +151,7 @@ ncp_put_inode(struct inode *inode) DDPRINTK("ncp_put_inode: put directory %ld\n", inode->i_ino); ncp_invalid_dir_cache(inode); - } + } clear_inode(inode); unlock_super(sb); @@ -228,7 +228,7 @@ ncp_read_super(struct super_block *sb, void *raw_data, int silent) lock_super(sb); NCP_SBP(sb) = server; - + sb->s_blocksize = 1024; /* Eh... Is this correct? */ sb->s_blocksize_bits = 10; sb->s_magic = NCP_SUPER_MAGIC; @@ -269,7 +269,7 @@ ncp_read_super(struct super_block *sb, void *raw_data, int silent) unlock_super(sb); goto fail; } - + /* * Make the connection to the server */ @@ -402,11 +402,11 @@ ncp_trigger_message(struct ncp_server *server) #endif } -static void +static void ncp_statfs(struct super_block *sb, struct statfs *buf, int bufsiz) { struct statfs tmp; - + /* We cannot say how much disk space is left on a mounted NetWare Server, because free space is distributed over volumes, and the current user might have disk quotas. So @@ -439,11 +439,11 @@ ncp_notify_change(struct inode *inode, struct iattr *attr) if ((result = inode_change_ok(inode, attr)) < 0) return result; - if (((attr->ia_valid & ATTR_UID) && + if (((attr->ia_valid & ATTR_UID) && (attr->ia_uid != NCP_SERVER(inode)->m.uid))) return -EPERM; - if (((attr->ia_valid & ATTR_GID) && + if (((attr->ia_valid & ATTR_GID) && (attr->ia_uid != NCP_SERVER(inode)->m.gid))) return -EPERM; @@ -461,14 +461,14 @@ ncp_notify_change(struct inode *inode, struct iattr *attr) ncp_date_unix2dos(attr->ia_ctime, &(info.creationTime), &(info.creationDate)); } - + if ((attr->ia_valid & ATTR_MTIME) != 0) { info_mask |= (DM_MODIFY_TIME|DM_MODIFY_DATE); ncp_date_unix2dos(attr->ia_mtime, &(info.modifyTime), &(info.modifyDate)); } - + if ((attr->ia_valid & ATTR_ATIME) != 0) { __u16 dummy; @@ -527,7 +527,7 @@ ncp_notify_change(struct inode *inode, struct iattr *attr) return result; } - + #ifdef DEBUG_NCP_MALLOC int ncp_malloced; int ncp_current_malloced; @@ -543,6 +543,8 @@ int init_ncp_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module( void) { @@ -556,9 +558,7 @@ init_module( void) #endif ncp_init_dir_cache(); - if ((status = init_ncp_fs()) == 0) - register_symtab(0); - return status; + return init_ncp_fs(); } void diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e47227011c40..f6c6f478690b 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -42,7 +42,7 @@ static void nfs_put_super(struct super_block *); static void nfs_read_inode(struct inode *); static void nfs_statfs(struct super_block *, struct statfs *, int bufsiz); -static struct super_operations nfs_sops = { +static struct super_operations nfs_sops = { nfs_read_inode, /* read inode */ nfs_notify_change, /* notify change */ NULL, /* write inode */ @@ -280,7 +280,7 @@ int nfs_notify_change(struct inode *inode, struct iattr *attr) int error; sattr.mode = (unsigned) -1; - if (attr->ia_valid & ATTR_MODE) + if (attr->ia_valid & ATTR_MODE) sattr.mode = attr->ia_mode; sattr.uid = (unsigned) -1; @@ -360,13 +360,11 @@ int init_nfs_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_nfs_fs()) == 0) - register_symtab(0); - return status; + return init_nfs_fs(); } void cleanup_module(void) diff --git a/fs/proc/procfs_syms.c b/fs/proc/procfs_syms.c index beb3c87d001b..6f9aee71d00d 100644 --- a/fs/proc/procfs_syms.c +++ b/fs/proc/procfs_syms.c @@ -9,36 +9,30 @@ * in the procfs. */ extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, - off_t offset, int length, int inout); + off_t offset, int length, int inout); extern struct inode_operations proc_scsi_inode_operations; -static struct symbol_table procfs_syms = { -/* Should this be surrounded with "#ifdef CONFIG_MODULES" ? */ -#include - X(proc_register), - X(proc_register_dynamic), - X(proc_unregister), - X(proc_root), - X(proc_get_inode), - X(in_group_p), - X(generate_cluster), - X(proc_net_inode_operations), - X(proc_net), +EXPORT_SYMBOL(proc_register); +EXPORT_SYMBOL(proc_register_dynamic); +EXPORT_SYMBOL(proc_unregister); +EXPORT_SYMBOL(proc_root); +EXPORT_SYMBOL(proc_get_inode); +EXPORT_SYMBOL(in_group_p); +EXPORT_SYMBOL(proc_net_inode_operations); +EXPORT_SYMBOL(proc_net); + +/* + * This is required so that if we load scsi later, that the + * scsi code can attach to /proc/scsi in the correct manner. + */ +EXPORT_SYMBOL(proc_scsi); +EXPORT_SYMBOL(proc_scsi_inode_operations); +EXPORT_SYMBOL(dispatch_scsi_info_ptr); - /* - * This is required so that if we load scsi later, that the - * scsi code can attach to /proc/scsi in the correct manner. - */ - X(proc_scsi), - X(proc_scsi_inode_operations), - X(dispatch_scsi_info_ptr), - #if defined(CONFIG_SUN_OPENPROMFS_MODULE) - X(proc_openprom_register), - X(proc_openprom_deregister), -#endif -#include -}; +EXPORT_SYMBOL(proc_openprom_register); +EXPORT_SYMBOL(proc_openprom_deregister); +#endif static struct file_system_type proc_fs_type = { proc_read_super, "proc", 0, NULL @@ -46,10 +40,5 @@ static struct file_system_type proc_fs_type = { int init_proc_fs(void) { - int status; - - if ((status = register_filesystem(&proc_fs_type)) == 0) - status = register_symtab(&procfs_syms); - return status; + return register_filesystem(&proc_fs_type) == 0; } - diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index b39403358728..865010e03df9 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c @@ -438,6 +438,8 @@ init_smb_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { @@ -453,9 +455,7 @@ init_module(void) smb_init_dir_cache(); - if ((status = init_smb_fs()) == 0) - register_symtab(0); - return status; + return init_smb_fs(); } void diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 4e14cb35ede8..713fcf9ce84d 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c @@ -42,7 +42,7 @@ void sysv_put_inode(struct inode *inode) } -static struct super_operations sysv_sops = { +static struct super_operations sysv_sops = { sysv_read_inode, sysv_notify_change, sysv_write_inode, @@ -72,7 +72,7 @@ static void detected_bs512 (struct super_block *sb) sb->sv_inodes_per_block = 512/64; sb->sv_inodes_per_block_1 = 512/64-1; sb->sv_inodes_per_block_bits = 9-6; - sb->sv_toobig_block = 10 + + sb->sv_toobig_block = 10 + (sb->sv_ind_per_block = 512/4) + (sb->sv_ind_per_block_2 = (512/4)*(512/4)) + (sb->sv_ind_per_block_3 = (512/4)*(512/4)*(512/4)); @@ -99,7 +99,7 @@ static void detected_bs1024 (struct super_block *sb) sb->sv_inodes_per_block = 1024/64; sb->sv_inodes_per_block_1 = 1024/64-1; sb->sv_inodes_per_block_bits = 10-6; - sb->sv_toobig_block = 10 + + sb->sv_toobig_block = 10 + (sb->sv_ind_per_block = 1024/4) + (sb->sv_ind_per_block_2 = (1024/4)*(1024/4)) + (sb->sv_ind_per_block_3 = (1024/4)*(1024/4)*(1024/4)); @@ -336,7 +336,7 @@ static struct super_block * detected_coherent (struct super_block *sb, struct bu return sb; } -struct super_block *sysv_read_super(struct super_block *sb,void *data, +struct super_block *sysv_read_super(struct super_block *sb,void *data, int silent) { struct buffer_head *bh; @@ -669,7 +669,7 @@ repeat: return result; } -static struct buffer_head * block_getblk(struct inode * inode, +static struct buffer_head * block_getblk(struct inode * inode, struct buffer_head * bh, int nr, int create) { struct super_block *sb; @@ -985,19 +985,17 @@ int init_sysv_fs(void) for (i = 0; i < 3; i++) { if ((ouch = register_filesystem(&sysv_fs_type[i])) != 0) - return ouch; + break; } return ouch; } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_sysv_fs()) == 0) - register_symtab(0); - return status; + return init_sysv_fs(); } void cleanup_module(void) diff --git a/fs/ufs/ufs_super.c b/fs/ufs/ufs_super.c index 3810c926057d..59655bc5ac10 100644 --- a/fs/ufs/ufs_super.c +++ b/fs/ufs/ufs_super.c @@ -57,13 +57,11 @@ init_ufs_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_ufs_fs()) == 0) - register_symtab(0); - return status; + return init_ufs_fs(); } void cleanup_module(void) @@ -138,7 +136,7 @@ ufs_read_super(struct super_block * sb, void * data, int silent) goto ufs_read_super_lose; } /* XXX - redo this so we can free it later... */ - usb = (struct ufs_superblock *)__get_free_page(GFP_KERNEL); + usb = (struct ufs_superblock *)__get_free_page(GFP_KERNEL); if (usb == NULL) { brelse(bh1); brelse(bh2); @@ -325,4 +323,3 @@ void ufs_statfs(struct super_block * sb, struct statfs * buf, int bufsiz) copy_to_user(buf, sp, bufsiz); return; } - diff --git a/fs/umsdos/inode.c b/fs/umsdos/inode.c index 8157edca6cdc..eb00ad917e97 100644 --- a/fs/umsdos/inode.c +++ b/fs/umsdos/inode.c @@ -1,7 +1,7 @@ /* * linux/fs/umsdos/inode.c * - * Written 1993 by Jacques Gelinas + * Written 1993 by Jacques Gelinas * Inspired from linux/fs/msdos/... by Werner Almesberger * */ @@ -275,7 +275,7 @@ int UMSDOS_notify_change(struct inode *inode, struct iattr *attr) { int ret = 0; - if ((ret = inode_change_ok(inode, attr)) != 0) + if ((ret = inode_change_ok(inode, attr)) != 0) return ret; if (inode->i_nlink > 0){ @@ -321,17 +321,17 @@ int UMSDOS_notify_change(struct inode *inode, struct iattr *attr) ret = umsdos_emd_dir_read (emd_owner,&filp,(char*)&entry ,UMSDOS_REC_SIZE); if (ret == 0){ - if (attr->ia_valid & ATTR_UID) + if (attr->ia_valid & ATTR_UID) entry.uid = attr->ia_uid; - if (attr->ia_valid & ATTR_GID) + if (attr->ia_valid & ATTR_GID) entry.gid = attr->ia_gid; - if (attr->ia_valid & ATTR_MODE) + if (attr->ia_valid & ATTR_MODE) entry.mode = attr->ia_mode; - if (attr->ia_valid & ATTR_ATIME) + if (attr->ia_valid & ATTR_ATIME) entry.atime = attr->ia_atime; - if (attr->ia_valid & ATTR_MTIME) + if (attr->ia_valid & ATTR_MTIME) entry.mtime = attr->ia_mtime; - if (attr->ia_valid & ATTR_CTIME) + if (attr->ia_valid & ATTR_CTIME) entry.ctime = attr->ia_ctime; entry.nlink = inode->i_nlink; @@ -352,7 +352,7 @@ int UMSDOS_notify_change(struct inode *inode, struct iattr *attr) PRINTK (("\n")); } } - if (ret == 0) + if (ret == 0) inode_setattr(inode, attr); return ret; } @@ -366,7 +366,7 @@ int UMSDOS_notify_change(struct inode *inode, struct iattr *attr) so it's easier to tell them apart. */ -static struct super_operations umsdos_sops = { +static struct super_operations umsdos_sops = { UMSDOS_read_inode, UMSDOS_notify_change, UMSDOS_write_inode, @@ -431,7 +431,7 @@ struct super_block *UMSDOS_read_super( This feature allows the installation of a linux system within a DOS system in a subdirectory. - + A user may install its linux stuff in c:\linux avoiding any clash with existing DOS file and subdirectory. When linux boots, it hides this fact, showing a normal @@ -505,13 +505,11 @@ int init_umsdos_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_umsdos_fs()) == 0) - register_symtab(0); - return status; + return init_umsdos_fs(); } void cleanup_module(void) @@ -520,4 +518,3 @@ void cleanup_module(void) } #endif - diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index f0d5817717bc..4a0c2373e13d 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c @@ -1572,34 +1572,23 @@ void vfat_read_inode(struct inode *inode) fat_read_inode(inode, &vfat_dir_inode_operations); } - - - static struct file_system_type vfat_fs_type = { vfat_read_super, "vfat", 1, NULL }; -static struct symbol_table vfat_syms = { -#include - X(vfat_create), - X(vfat_unlink), - X(vfat_mkdir), - X(vfat_rmdir), - X(vfat_rename), - X(vfat_put_super), - X(vfat_read_super), - X(vfat_read_inode), - X(vfat_lookup), -#include -}; +EXPORT_SYMBOL(vfat_create); +EXPORT_SYMBOL(vfat_unlink); +EXPORT_SYMBOL(vfat_mkdir); +EXPORT_SYMBOL(vfat_rmdir); +EXPORT_SYMBOL(vfat_rename); +EXPORT_SYMBOL(vfat_put_super); +EXPORT_SYMBOL(vfat_read_super); +EXPORT_SYMBOL(vfat_read_inode); +EXPORT_SYMBOL(vfat_lookup); int init_vfat_fs(void) { - int status; - - if ((status = register_filesystem(&vfat_fs_type)) == 0) - status = register_symtab(&vfat_syms); - return status; + return register_filesystem(&vfat_fs_type); } #ifdef MODULE @@ -1608,7 +1597,6 @@ int init_module(void) return init_vfat_fs(); } - void cleanup_module(void) { unregister_filesystem(&vfat_fs_type); diff --git a/fs/xiafs/inode.c b/fs/xiafs/inode.c index 48b31e9724eb..58b5b0781273 100644 --- a/fs/xiafs/inode.c +++ b/fs/xiafs/inode.c @@ -2,7 +2,7 @@ * linux/fs/xiafs/inode.c * * Copyright (C) Q. Frank Xia, 1993. - * + * * Based on Linus' minix/inode.c * Copyright (C) Linus Torvalds, 1991, 1992. * @@ -24,7 +24,7 @@ #include "xiafs_mac.h" static u_long random_nr; - + void xiafs_put_inode(struct inode *inode) { if (inode->i_nlink) @@ -48,7 +48,7 @@ void xiafs_put_super(struct super_block *sb) MOD_DEC_USE_COUNT; } -static struct super_operations xiafs_sops = { +static struct super_operations xiafs_sops = { xiafs_read_inode, NULL, xiafs_write_inode, @@ -94,8 +94,8 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, } s->s_blocksize = sp->s_zone_size; s->s_blocksize_bits = 10 + sp->s_zone_shift; - if (s->s_blocksize != BLOCK_SIZE && - (s->s_blocksize == 1024 || s->s_blocksize == 2048 || + if (s->s_blocksize != BLOCK_SIZE && + (s->s_blocksize == 1024 || s->s_blocksize == 2048 || s->s_blocksize == 4096)) { brelse(bh); set_blocksize(dev, s->s_blocksize); @@ -148,7 +148,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data, s->s_dev = dev; s->s_op = &xiafs_sops; s->s_mounted = iget(s, _XIAFS_ROOT_INO); - if (!s->s_mounted) + if (!s->s_mounted) goto xiafs_read_super_fail; unlock_super(s); random_nr=CURRENT_TIME; @@ -220,7 +220,7 @@ int xiafs_bmap(struct inode * inode,int zone) zone -= XIAFS_ADDRS_PER_Z(inode->i_sb); i = inode->u.xiafs_i.i_dind_zone; if (i) - i = zone_bmap(bread(inode->i_dev, i, XIAFS_ZSIZE(inode->i_sb)), + i = zone_bmap(bread(inode->i_dev, i, XIAFS_ZSIZE(inode->i_sb)), zone >> XIAFS_ADDRS_PER_Z_BITS(inode->i_sb)); if (i) i= zone_bmap(bread(inode->i_dev,i, XIAFS_ZSIZE(inode->i_sb)), @@ -240,7 +240,7 @@ static u_long get_prev_addr(struct inode * inode, int zone) return random_nr + inode->i_sb->u.xiafs_sb.s_firstdatazone; } -static struct buffer_head * +static struct buffer_head * dt_getblk(struct inode * inode, u_long *lp, int create, u_long prev_addr) { int tmp; @@ -270,8 +270,8 @@ repeat: return result; } -static struct buffer_head * -indt_getblk(struct inode * inode, struct buffer_head * bh, +static struct buffer_head * +indt_getblk(struct inode * inode, struct buffer_head * bh, int nr, int create, u_long prev_addr) { int tmp; @@ -347,9 +347,9 @@ struct buffer_head * xiafs_getblk(struct inode * inode, int zone, int create) } zone -= XIAFS_ADDRS_PER_Z(inode->i_sb); bh = dt_getblk(inode, &(inode->u.xiafs_i.i_dind_zone), create, prev_addr); - bh = indt_getblk(inode, bh, zone>>XIAFS_ADDRS_PER_Z_BITS(inode->i_sb), + bh = indt_getblk(inode, bh, zone>>XIAFS_ADDRS_PER_Z_BITS(inode->i_sb), create, prev_addr); - bh = indt_getblk(inode, bh, zone&(XIAFS_ADDRS_PER_Z(inode->i_sb)-1), + bh = indt_getblk(inode, bh, zone&(XIAFS_ADDRS_PER_Z(inode->i_sb)-1), create, prev_addr); return bh; } @@ -390,7 +390,7 @@ void xiafs_read_inode(struct inode * inode) printk("XIA-FS: read i-node zone failed (%s %d)\n", WHERE_ERR); return; } - raw_inode = ((struct xiafs_inode *) bh->b_data) + + raw_inode = ((struct xiafs_inode *) bh->b_data) + ((ino-1) & (XIAFS_INODES_PER_Z(inode->i_sb) - 1)); inode->i_mode = raw_inode->i_mode; inode->i_uid = raw_inode->i_uid; @@ -445,7 +445,7 @@ static struct buffer_head * xiafs_update_inode(struct inode * inode) inode->i_dirt=0; return 0; } - zone = 1 + inode->i_sb->u.xiafs_sb.s_imap_zones + + zone = 1 + inode->i_sb->u.xiafs_sb.s_imap_zones + inode->i_sb->u.xiafs_sb.s_zmap_zones + (ino-1) / XIAFS_INODES_PER_Z(inode->i_sb); if (!(bh=bread(inode->i_dev, zone, XIAFS_ZSIZE(inode->i_sb)))) { @@ -468,7 +468,7 @@ static struct buffer_head * xiafs_update_inode(struct inode * inode) else { XIAFS_PUT_BLOCKS(raw_inode, inode->i_blocks); for (zone = 0; zone < 8; zone++) - raw_inode->i_zone[zone] = (raw_inode->i_zone[zone] & 0xff000000) + raw_inode->i_zone[zone] = (raw_inode->i_zone[zone] & 0xff000000) | (inode->u.xiafs_i.i_zone[zone] & 0xffffff); raw_inode->i_ind_zone = (raw_inode->i_ind_zone & 0xff000000) | (inode->u.xiafs_i.i_ind_zone & 0xffffff); @@ -523,13 +523,11 @@ int init_xiafs_fs(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; + int init_module(void) { - int status; - - if ((status = init_xiafs_fs()) == 0) - register_symtab(0); - return status; + return init_xiafs_fs(); } void cleanup_module(void) diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h index 03f74548188d..3a33d8b6966e 100644 --- a/include/asm-alpha/unistd.h +++ b/include/asm-alpha/unistd.h @@ -170,6 +170,7 @@ #define __NR_getresuid 344 #define __NR_pciconfig_read 345 #define __NR_pciconfig_write 346 +#define __NR_query_module 347 #if defined(__LIBRARY__) && defined(__GNUC__) @@ -214,7 +215,7 @@ type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ { \ extern long syscall (int, ...); \ - return syscall(__NR_##name, arg1, arg2, arg3, arg4); \ + return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5); \ } #endif /* __LIBRARY__ && __GNUC__ */ diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 403f481a3c0a..3ed5ab884206 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -171,6 +171,7 @@ #define __NR_mremap 163 #define __NR_setresuid 164 #define __NR_getresuid 165 +#define __NR_query_module 166 /* user-visible error numbers are in the range -1 - -122: see */ diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index 2f57fe404bda..1a1034948f5b 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.39 1996/12/10 06:06:35 davem Exp $ +/* $Id: bitops.h,v 1.40 1996/12/23 05:28:49 davem Exp $ * bitops.h: Bit string operations on the Sparc. * * Copyright 1995 David S. Miller (davem@caip.rutgers.edu) @@ -474,6 +474,12 @@ found_middle: #define ext2_find_first_zero_bit find_first_zero_le_bit #define ext2_find_next_zero_bit find_next_zero_le_bit +/* Bitmap functions for the minix filesystem. */ +#define minix_set_bit(nr,addr) set_bit(nr,addr) +#define minix_clear_bit(nr,addr) clear_bit(nr,addr) +#define minix_test_bit(nr,addr) test_bit(nr,addr) +#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) + #endif /* __KERNEL__ */ #endif /* defined(_SPARC_BITOPS_H) */ diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h index b4a219892a7c..d238f3898a5a 100644 --- a/include/asm-sparc/pgtable.h +++ b/include/asm-sparc/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.54 1996/12/03 02:38:31 davem Exp $ */ +/* $Id: pgtable.h,v 1.56 1996/12/23 05:28:50 davem Exp $ */ #ifndef _SPARC_PGTABLE_H #define _SPARC_PGTABLE_H @@ -105,6 +105,9 @@ extern pgd_t swapper_pg_dir[1024]; * holds the same as on the i386. */ extern pte_t pg0[1024]; +extern pte_t pg1[1024]; +extern pte_t pg2[1024]; +extern pte_t pg3[1024]; extern unsigned long ptr_in_current_pgd; diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h index 48ae19a866bb..f2fd5ab327d3 100644 --- a/include/asm-sparc/pgtsun4c.h +++ b/include/asm-sparc/pgtsun4c.h @@ -1,4 +1,4 @@ -/* $Id: pgtsun4c.h,v 1.32 1996/12/08 08:39:04 davem Exp $ +/* $Id: pgtsun4c.h,v 1.33 1996/12/20 07:55:04 davem Exp $ * pgtsun4c.h: Sun4c specific pgtable.h defines and code. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -109,7 +109,7 @@ extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr) extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry) { - __asm__ __volatile__("\n\tstba %1, [%0] %2\n\t" : : + __asm__ __volatile__("\n\tstba %1, [%0] %2; nop; nop; nop;\n\t" : : "r" (addr), "r" (entry), "i" (ASI_SEGMAP)); @@ -128,7 +128,7 @@ extern __inline__ unsigned long sun4c_get_pte(unsigned long addr) extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry) { - __asm__ __volatile__("\n\tsta %1, [%0] %2\n\t" : : + __asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : : "r" (addr), "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE)); @@ -148,7 +148,7 @@ extern __inline__ int sun4c_get_context(void) extern __inline__ int sun4c_set_context(int ctx) { - __asm__ __volatile__("\n\tstba %0, [%1] %2\n\t" : : + __asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : : "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL)); return ctx; diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 69a583dcd8e5..05baf435bf48 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.4 1996/12/12 15:50:14 davem Exp $ +/* $Id: bitops.h,v 1.5 1996/12/21 06:09:28 davem Exp $ * bitops.h: Bit string operations on the V9. * * Copyright 1996 David S. Miller (davem@caip.rutgers.edu) @@ -204,10 +204,6 @@ extern __inline__ int test_le_bit(int nr, __const__ void * addr) #define find_first_zero_le_bit(addr, size) \ find_next_zero_le_bit((addr), (size), 0) ---------------------------------------------------------- -| byte | byte | byte | byte | byte | byte | byte | byte | ---------------------------------------------------------- - 63 56 55 48 47 40 39 32 31 24 23 16 15 8 7 0 extern __inline__ unsigned long __swab64(unsigned long value) { return (((value>>56) & 0x00000000000000ff) | diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index aba1458c354d..4750777f794f 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -61,7 +61,36 @@ * * - XA data (green, mode2 form2): | sync - head - sub - data - EDC | * | 12 - 4 - 8 - 2324 - 4 | + * + * Sector types (format) - Forces the CD-ROM to read the specified sector type, + * attempt to read any other format ends with an error + * + * format sector type user data size (bytes) + * ----------------------------------------------------------------------------- + * 1 CD DA (Red Book) 2352 (CD_FRAMESIZE_RAW) + * 2 Mode1 Form1 (Yellow Book) 2048 (CD_FRAMESIZE) + * 3 Mode1 Form2 (Yellow Book) 2336 (CD_FRAMESIZE_RAW0) + * 4 Mode2 Form1 (Green Book) 2048 (CD_FRAMESIZE) + * 5 Mode2 Form2 (Green Book) 2328 (2324+4 spare bytes) + * + * + * Data Selection Field (pc.c[9]) - This value controls the actual number + * of bytes transferred from the CD-ROM + * + * bit 7 6 5 4 3 2 1 0 + * ---------------------------------------------------------------------------- + * | Sync | Sub | Header | User | EDC & | Error | Block | reserved + * | | Header | | Data | ECC | Flags | Error | + * \-------------------------------------------/\---------------/ + * | | + * V V + * stored on CD (2532) generated during error correction + * + * The maximal number of bytes returned by CD-ROM is 2646 (CD_FRAMESIZE_RAWER), + * when pc.c[9] = 0xfa. + * */ + /* * CDROM IOCTL structures diff --git a/include/linux/fs.h b/include/linux/fs.h index 54ad0699b8c1..0f2c962db250 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -573,20 +573,17 @@ extern struct super_block super_blocks[NR_SUPER]; extern void refile_buffer(struct buffer_head * buf); extern void set_writetime(struct buffer_head * buf, int flag); -extern void refill_freelist(int size); extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int); extern int nr_buffers; extern int buffermem; extern int nr_buffer_heads; -#define BUF_CLEAN 0 -#define BUF_UNSHARED 1 /* Buffers that were shared but are not any more */ -#define BUF_LOCKED 2 /* Buffers scheduled for write */ -#define BUF_LOCKED1 3 /* Supers, inodes */ -#define BUF_DIRTY 4 /* Dirty buffers, not yet scheduled for write */ -#define BUF_SHARED 5 /* Buffers shared */ -#define NR_LIST 6 +#define BUF_CLEAN 0 +#define BUF_LOCKED 1 /* Buffers scheduled for write */ +#define BUF_LOCKED1 2 /* Supers, inodes */ +#define BUF_DIRTY 3 /* Dirty buffers, not yet scheduled for write */ +#define NR_LIST 4 void mark_buffer_uptodate(struct buffer_head * bh, int on); diff --git a/include/linux/if.h b/include/linux/if.h index c8d325e8f5cb..06e2d740ed2c 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -19,7 +19,7 @@ #ifndef _LINUX_IF_H #define _LINUX_IF_H -#include /* for "caddr_t" et al */ +#include /* for "__kernel_caddr_t" et al */ #include /* for "struct sockaddr" et al */ /* Standard interface flags. */ @@ -109,7 +109,7 @@ struct ifreq int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ - caddr_t ifru_data; + __kernel_caddr_t ifru_data; } ifr_ifru; }; @@ -139,8 +139,8 @@ struct ifconf int ifc_len; /* size of buffer */ union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; + __kernel_caddr_t ifcu_buf; + struct ifreq *ifcu_req; } ifc_ifcu; }; #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ diff --git a/include/linux/module.h b/include/linux/module.h index 1bf540e93615..a69b2b573a26 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -1,138 +1,212 @@ /* * Dynamic loading of modules into the kernel. * - * Modified by Bjorn Ekwall + * Rewritten by Richard Henderson Dec 1996 */ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H #ifdef __GENKSYMS__ -# define _set_ver(sym,vers) sym -# undef MODVERSIONS -# define MODVERSIONS +# undef MODVERSIONS +# define MODVERSIONS #else /* ! __GENKSYMS__ */ # if defined(MODVERSIONS) && !defined(MODULE) && defined(EXPORT_SYMTAB) -# define _set_ver(sym,vers) sym # include # endif #endif /* __GENKSYMS__ */ -/* values of module.state */ -#define MOD_UNINITIALIZED 0 -#define MOD_RUNNING 1 -#define MOD_DELETED 2 +/* Don't need to bring in all of uaccess.h just for this decl. */ +struct exception_table_entry; -/* maximum length of module name */ -#define MOD_MAX_NAME 64 - -/* magic marker for modules inserted from kerneld, to be auto-reaped */ -#define MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ -#define MOD_VISITED 0x20000000 /* Thanks Jacques! */ - -/* maximum length of symbol name */ -#define SYM_MAX_NAME 60 - -struct kernel_sym { /* sent to "insmod" */ - unsigned long value; /* value of symbol */ - char name[SYM_MAX_NAME]; /* name of symbol */ +/* Used by get_kernel_syms, which is depreciated. */ +struct kernel_sym +{ + unsigned long value; + char name[60]; /* should have been 64-sizeof(long); oh well */ }; -struct module_ref { - struct module *module; - struct module_ref *next; -}; - -struct internal_symbol { - void *addr; +struct module_symbol +{ + unsigned long value; const char *name; - }; - -struct symbol_table { /* received from "insmod" */ - int size; /* total, including string table!!! */ - int n_symbols; - int n_refs; - struct internal_symbol symbol[0]; /* actual size defined by n_symbols */ - struct module_ref ref[0]; /* actual size defined by n_refs */ }; -/* - * Note: The string table follows immediately after the symbol table in memory! - */ -struct _exceptinfo{ - struct exception_table_entry *start; - struct exception_table_entry *stop; + +struct module_ref +{ + struct module *dep; /* "parent" pointer */ + struct module *ref; /* "child" pointer */ + struct module_ref *next_ref; }; -struct module { +struct module +{ + unsigned long size_of_struct; /* == sizeof(module) */ struct module *next; - struct module_ref *ref; /* the list of modules that refer to me */ - struct symbol_table *symtab; const char *name; - int size; /* size of module in pages */ - void* addr; /* address of module */ - int state; - void (*cleanup)(void); /* cleanup routine */ - struct _exceptinfo exceptinfo; + unsigned long size; + + long usecount; + unsigned long flags; /* AUTOCLEAN et al */ + + unsigned nsyms; + unsigned ndeps; + + struct module_symbol *syms; + struct module_ref *deps; + struct module_ref *refs; + int (*init)(void); + void (*cleanup)(void); + const struct exception_table_entry *ex_table_start; + const struct exception_table_entry *ex_table_end; +#ifdef __alpha__ + unsigned long gp; +#endif }; -/* - prior to modules-2.1 there were no real way to identify - which insmod is talking to us Now a special signature must - be written here. - - The new module utilities knows about older kernel and write - the init in the signature and the cleanup in the init. - This is to make sure newer utilities work with older kernel - so it is simple for people to upgrade. -*/ -#define MODULE_2_1_7_SIG ((void*)0x00000217) - -struct mod_routines { - void *signature; - int (*init)(void); /* initialization routine */ - void (*cleanup)(void); /* cleanup routine */ - struct _exceptinfo exceptinfo; +struct module_info +{ + unsigned long addr; + unsigned long size; + unsigned long flags; }; -/* - * The first word of the module contains the use count. - */ -#define GET_USE_COUNT(module) (* (long *) (module)->addr) -/* - * define the count variable, and usage macros. - */ +/* Bits of module.flags. */ + +#define MOD_UNINITIALIZED 0 +#define MOD_RUNNING 1 +#define MOD_DELETED 2 +#define MOD_AUTOCLEAN 4 +#define MOD_VISITED 8 + +/* Values for query_module's which. */ + +#define QM_MODULES 1 +#define QM_DEPS 2 +#define QM_REFS 3 +#define QM_SYMBOLS 4 +#define QM_INFO 5 + +/* Backwards compatibility definition. */ + +#define GET_USE_COUNT(module) ((module)->usecount) + +/* Indirect stringification. */ + +#define __MODULE_STRING_1(x) #x +#define __MODULE_STRING(x) __MODULE_STRING_1(x) #ifdef MODULE -extern long mod_use_count_; -#define MOD_INC_USE_COUNT (mod_use_count_++, mod_use_count_ |= MOD_VISITED) -#define MOD_DEC_USE_COUNT (mod_use_count_--, mod_use_count_ |= MOD_VISITED) -#define MOD_IN_USE ((mod_use_count_ & ~(MOD_AUTOCLEAN | MOD_VISITED)) != 0) +/* Embedded module documentation macros. */ + +/* For documentation purposes only. */ + +#define MODULE_AUTHOR(name) \ +const char __module_author[] __attribute__((section(".modinfo"))) = \ +"author=" name + +/* Could potentially be used by kerneld... */ + +#define MODULE_SUPPORTED_DEVICE(dev) \ +const char __module_device[] __attribute__((section(".modinfo"))) = \ +"device=" dev + +/* Used to verify parameters given to the module. The TYPE arg should + be a string in the following format: + [min[-max]]{b,h,i,l,s} + The MIN and MAX specifiers delimit the length of the array. If MAX + is omitted, it defaults to MIN; if both are omitted, the default is 1. + The final character is a type specifier: + b byte + h short + i int + l long + s string +*/ + +#define MODULE_PARM(var,type) \ +const char __module_parm_##var[] \ +__attribute__((section(".modinfo"))) = \ +"parm_" __MODULE_STRING(var) "=" type + +/* The attributes of a section are set the first time the section is + seen; we want .modinfo to not be allocated. This header should be + included before any functions or variables are defined. */ + +__asm__(".section .modinfo\n\t.text"); + +/* Define the module variable, and usage macros. */ +extern struct module __this_module; + +#define MOD_INC_USE_COUNT \ + (__this_module.usecount++, __this_module.flags |= MOD_VISITED) +#define MOD_DEC_USE_COUNT \ + (__this_module.usecount--, __this_module.flags |= MOD_VISITED) +#define MOD_IN_USE \ + (__this_module.usecount != 0) #ifndef __NO_VERSION__ #include -char kernel_version[]=UTS_RELEASE; -#endif - +const char __module_kernel_version[] __attribute__((section(".modinfo"))) = +"kernel_version=" UTS_RELEASE; #if defined(MODVERSIONS) && !defined(__GENKSYMS__) -int Using_Versions; /* gcc will handle this global (used as a flag) correctly */ +const char __module_using_checksums[] __attribute__((section(".modinfo"))) = +"using_checksums=1"; +#endif #endif -#else +#else /* MODULE */ + +#define MODULE_AUTHOR(name) +#define MODULE_SUPPORTED_DEVICE(name) +#define MODULE_PARM(var,type) #define MOD_INC_USE_COUNT do { } while (0) #define MOD_DEC_USE_COUNT do { } while (0) #define MOD_IN_USE 1 + extern struct module *module_list; -#endif +#endif /* MODULE */ + +/* Export a symbol either from the kernel or a module. + + In the kernel, the symbol is added to the kernel's global symbol table. + + In a module, it controls which variables are exported. If no + variables are explicitly exported, the action is controled by the + insmod -[xX] flags. Otherwise, only the variables listed are exported. + This obviates the need for the old register_symtab() function. */ + +#if defined(__GENKSYMS__) + +/* We want the EXPORT_SYMBOL tag left intact for recognition. */ + +#elif !defined(CONFIG_MODULES) + +#define EXPORT_SYMBOL(var) +#define EXPORT_SYMBOL_NOVERS(var) +#define EXPORT_NO_SYMBOLS + +#else + +#define EXPORT_SYMBOL(var) \ +const struct module_symbol __export_##var \ +__attribute__((section("__ksymtab"))) = { \ + (unsigned long)&var, __MODULE_STRING(var) \ +} \ + +#define EXPORT_SYMBOL_NOVERS(var) EXPORT_SYMBOL(var) -/* insert new symbol table */ -extern int register_symtab_from(struct symbol_table *, long *); #ifdef MODULE -#define register_symtab(symtab) register_symtab_from(symtab, &mod_use_count_) +/* Force a module to export no symbols. */ +#define EXPORT_NO_SYMBOLS \ +__asm__(".section __ksymtab\n.text") #else -#define register_symtab(symtab) register_symtab_from(symtab, 0) -#endif +#define EXPORT_NO_SYMBOLS +#endif /* MODULE */ #endif + +#endif /* _LINUX_MODULE_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b095e4fea5e7..9e1722b6799d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -83,7 +83,8 @@ struct hh_cache int hh_refcnt; /* number of users */ unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP */ char hh_uptodate; /* hh_data is valid */ - char hh_data[16]; /* cached hardware header */ + /* cached hardware header; allow for machine alignment needs. */ + unsigned long hh_data[16/sizeof(unsigned long)]; }; /* diff --git a/include/linux/socket.h b/include/linux/socket.h index 8a45d935578b..28a6bb18e193 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -34,9 +34,9 @@ struct msghdr void * msg_name; /* Socket name */ int msg_namelen; /* Length of name */ struct iovec * msg_iov; /* Data blocks */ - size_t msg_iovlen; /* Number of blocks */ + __kernel_size_t msg_iovlen; /* Number of blocks */ void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ - size_t msg_controllen; /* Length of cmsg list */ + __kernel_size_t msg_controllen; /* Length of cmsg list */ unsigned msg_flags; }; @@ -47,7 +47,7 @@ struct msghdr */ struct cmsghdr { - size_t cmsg_len; /* data byte count, including hdr */ + __kernel_size_t cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ unsigned char cmsg_data[0]; @@ -105,7 +105,6 @@ extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, struct ucred { - /* Should we be using __kernel_*_t here ?? */ __kernel_pid_t pid; __kernel_uid_t uid; __kernel_gid_t gid; diff --git a/include/linux/symtab_begin.h b/include/linux/symtab_begin.h deleted file mode 100644 index 65a87008c537..000000000000 --- a/include/linux/symtab_begin.h +++ /dev/null @@ -1,45 +0,0 @@ -#include - -#ifdef MODVERSIONS -# undef _set_ver -# undef X -/* - * These two macros _will_ get enough arguments from the X* macros - * since "sym" expands to "symaddr, symstr" from the #define in *.ver - */ -# define _basic_version(symaddr,symstr) symaddr, symstr -# define _alias_version(really,symaddr,symstr) (void *) & really , symstr - -# ifndef __GENKSYMS__ -# ifdef MODULE -# define _set_ver(sym,ver) \ - (void *) & sym ## _R ## ver, SYMBOL_NAME_STR(sym) "_R" #ver -# else /* !MODULE */ -# define _set_ver(sym,ver) \ - (void *) & sym, SYMBOL_NAME_STR(sym) "_R" #ver -# endif /* !MODULE */ -# define X(sym) { _basic_version(sym) } -/* - * For _really_ stacked modules: - * - * Use "Xalias(local_symbol, symbol_from_other_module)" - * to make subsequent modules really use "local_symbol" - * when they think that they are using "symbol_from_other_module" - * - * The "aliasing" module can still use "symbol_from_other_module", - * but can now replace and/or modify the behaviour of that symbol. - */ -# define Xalias(really,sym) { _alias_version(really,sym) } -# endif /* !__GENKSYMS__ */ -#else /* !MODVERSIONS */ -# define X(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} -# define Xalias(really,sym) { (void *) & really, SYMBOL_NAME_STR(sym)} -#endif /* MODVERSIONS */ -/* - * Some symbols always need to be unversioned. This includes - * compiler generated calls to functions. - */ -#define XNOVERS(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} - -#define EMPTY {0,0} - 0, 0, 0, { diff --git a/include/linux/symtab_end.h b/include/linux/symtab_end.h deleted file mode 100644 index 91b92e2982ac..000000000000 --- a/include/linux/symtab_end.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef MODVERSIONS -#undef _set_ver -#if defined(MODULE) && !defined(__GENKSYMS__) -#define _set_ver(sym,vers) sym ## _R ## vers -#else -#define _set_ver(a,b) a -#endif -#endif /* MODVERSIONS */ -#undef X -#undef EMPTY - /* mark end of table, last entry above ended with a comma! */ - { (void *)0, (char *)0 } - }, - /* no module refs, insmod will take care of that instead! */ - { { (struct module *)0, (struct module_ref *)0 } } diff --git a/include/linux/time.h b/include/linux/time.h index 47246a142f7c..e632337404ae 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -22,10 +22,10 @@ struct timezone { #define NFDBITS __NFDBITS #ifdef __KERNEL__ -void do_gettimeofday(struct timeval *tv); -void do_settimeofday(struct timeval *tv); -void get_fast_time(struct timeval *tv); -void (*do_get_fast_time)(struct timeval *); +extern void do_gettimeofday(struct timeval *tv); +extern void do_settimeofday(struct timeval *tv); +extern void get_fast_time(struct timeval *tv); +extern void (*do_get_fast_time)(struct timeval *); #endif #define FD_SETSIZE __FD_SETSIZE diff --git a/include/linux/uio.h b/include/linux/uio.h index 547034f60411..cdfdca72ef5c 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -17,7 +17,7 @@ struct iovec { void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ - size_t iov_len; /* Must be size_t (1003.1g) */ + __kernel_size_t iov_len; /* Must be size_t (1003.1g) */ }; /* diff --git a/init/main.c b/init/main.c index de89aacb70bb..7284e0e8b476 100644 --- a/init/main.c +++ b/init/main.c @@ -713,7 +713,6 @@ static void parse_options(char *line) extern void setup_arch(char **, unsigned long *, unsigned long *); -extern void arch_syms_export(void); #ifndef __SMP__ @@ -882,7 +881,6 @@ asmlinkage void start_kernel(void) ipc_init(); #endif dquot_init(); - arch_syms_export(); sti(); check_bugs(); diff --git a/kernel/ksyms.c b/kernel/ksyms.c index ceb4275c24cd..a78d8a927133 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -1,4 +1,4 @@ -/* +/* * Herein lies all the functions/variables that are "exported" for linkage * with dynamically loaded kernel modules. * Jon. @@ -6,7 +6,7 @@ * - Stacked module support and unified symbol table added (June 1994) * - External symbol table support added (December 1994) * - Versions on symbols added (December 1994) - * by Bjorn Ekwall + * by Bjorn Ekwall */ #include @@ -52,7 +52,7 @@ extern unsigned char aux_device_present, kbd_read_mask; #ifdef __i386__ - extern struct drive_info_struct drive_info; +extern struct drive_info_struct drive_info; #endif #ifdef CONFIG_PCI @@ -83,294 +83,278 @@ extern void free_dma(unsigned int dmanr); extern void hard_reset_now(void); -struct symbol_table symbol_table = { -#include #ifdef MODVERSIONS - { (void *)1 /* Version version :-) */, - SYMBOL_NAME_STR (Using_Versions) }, +const struct module_symbol __export_Using_Versions +__attribute__((section("__ksymtab"))) = { + 1 /* Version version */, "Using_Versions" +}; #endif - /* stackable module support */ - X(register_symtab_from), #ifdef CONFIG_KERNELD - X(kerneld_send), +EXPORT_SYMBOL(kerneld_send); #endif - X(get_options), +EXPORT_SYMBOL(get_options); #ifdef CONFIG_PCI - /* PCI BIOS support */ - X(pcibios_present), - X(pcibios_find_class), - X(pcibios_find_device), - X(pcibios_read_config_byte), - X(pcibios_read_config_word), - X(pcibios_read_config_dword), - X(pcibios_write_config_byte), - X(pcibios_write_config_word), - X(pcibios_write_config_dword), - X(pcibios_strerror), - X(pci_strvendor), - X(pci_strdev), +/* PCI BIOS support */ +EXPORT_SYMBOL(pcibios_present); +EXPORT_SYMBOL(pcibios_find_class); +EXPORT_SYMBOL(pcibios_find_device); +EXPORT_SYMBOL(pcibios_read_config_byte); +EXPORT_SYMBOL(pcibios_read_config_word); +EXPORT_SYMBOL(pcibios_read_config_dword); +EXPORT_SYMBOL(pcibios_write_config_byte); +EXPORT_SYMBOL(pcibios_write_config_word); +EXPORT_SYMBOL(pcibios_write_config_dword); +EXPORT_SYMBOL(pcibios_strerror); +EXPORT_SYMBOL(pci_strvendor); +EXPORT_SYMBOL(pci_strdev); #endif - /* process memory management */ - X(do_mmap), - X(do_munmap), - X(exit_mm), - - /* internal kernel memory management */ - X(__get_free_pages), - X(free_pages), - X(kmalloc), - X(kfree), - X(vmalloc), - X(vfree), - X(mem_map), - X(remap_page_range), - X(max_mapnr), - X(num_physpages), - X(high_memory), - X(update_vm_cache), - - /* filesystem internal functions */ - X(getname), - X(putname), - X(__iget), - X(iput), - X(namei), - X(lnamei), - X(open_namei), - X(sys_close), - X(close_fp), - X(check_disk_change), - X(invalidate_buffers), - X(invalidate_inodes), - X(invalidate_inode_pages), - X(fsync_dev), - X(permission), - X(inode_setattr), - X(inode_change_ok), - X(set_blocksize), - X(getblk), - X(bread), - X(breada), - X(__brelse), - X(__bforget), - X(ll_rw_block), - X(__wait_on_buffer), - X(mark_buffer_uptodate), - X(unlock_buffer), - X(dcache_lookup), - X(dcache_add), - X(add_blkdev_randomness), - X(generic_file_read), - X(generic_file_mmap), - X(generic_readpage), - - /* device registration */ - X(register_chrdev), - X(unregister_chrdev), - X(register_blkdev), - X(unregister_blkdev), - X(tty_register_driver), - X(tty_unregister_driver), - X(tty_std_termios), +/* process memory management */ +EXPORT_SYMBOL(do_mmap); +EXPORT_SYMBOL(do_munmap); +EXPORT_SYMBOL(exit_mm); + +/* internal kernel memory management */ +EXPORT_SYMBOL(__get_free_pages); +EXPORT_SYMBOL(free_pages); +EXPORT_SYMBOL(kmalloc); +EXPORT_SYMBOL(kfree); +EXPORT_SYMBOL(vmalloc); +EXPORT_SYMBOL(vfree); +EXPORT_SYMBOL(mem_map); +EXPORT_SYMBOL(remap_page_range); +EXPORT_SYMBOL(max_mapnr); +EXPORT_SYMBOL(num_physpages); +EXPORT_SYMBOL(high_memory); +EXPORT_SYMBOL(update_vm_cache); + +/* filesystem internal functions */ +EXPORT_SYMBOL(getname); +EXPORT_SYMBOL(putname); +EXPORT_SYMBOL(__iget); +EXPORT_SYMBOL(iput); +EXPORT_SYMBOL(namei); +EXPORT_SYMBOL(lnamei); +EXPORT_SYMBOL(open_namei); +EXPORT_SYMBOL(sys_close); +EXPORT_SYMBOL(close_fp); +EXPORT_SYMBOL(check_disk_change); +EXPORT_SYMBOL(invalidate_buffers); +EXPORT_SYMBOL(invalidate_inodes); +EXPORT_SYMBOL(invalidate_inode_pages); +EXPORT_SYMBOL(fsync_dev); +EXPORT_SYMBOL(permission); +EXPORT_SYMBOL(inode_setattr); +EXPORT_SYMBOL(inode_change_ok); +EXPORT_SYMBOL(set_blocksize); +EXPORT_SYMBOL(getblk); +EXPORT_SYMBOL(bread); +EXPORT_SYMBOL(breada); +EXPORT_SYMBOL(__brelse); +EXPORT_SYMBOL(__bforget); +EXPORT_SYMBOL(ll_rw_block); +EXPORT_SYMBOL(__wait_on_buffer); +EXPORT_SYMBOL(mark_buffer_uptodate); +EXPORT_SYMBOL(unlock_buffer); +EXPORT_SYMBOL(dcache_lookup); +EXPORT_SYMBOL(dcache_add); +EXPORT_SYMBOL(add_blkdev_randomness); +EXPORT_SYMBOL(generic_file_read); +EXPORT_SYMBOL(generic_file_mmap); +EXPORT_SYMBOL(generic_readpage); + +/* device registration */ +EXPORT_SYMBOL(register_chrdev); +EXPORT_SYMBOL(unregister_chrdev); +EXPORT_SYMBOL(register_blkdev); +EXPORT_SYMBOL(unregister_blkdev); +EXPORT_SYMBOL(tty_register_driver); +EXPORT_SYMBOL(tty_unregister_driver); +EXPORT_SYMBOL(tty_std_termios); #if defined(CONFIG_BLK_DEV_IDECD) || \ defined(CONFIG_BLK_DEV_SR) || \ defined(CONFIG_CM206) - X(register_cdrom), - X(unregister_cdrom), - X(cdrom_fops), +EXPORT_SYMBOL(register_cdrom); +EXPORT_SYMBOL(unregister_cdrom); +EXPORT_SYMBOL(cdrom_fops); #endif - /* block device driver support */ - X(block_read), - X(block_write), - X(block_fsync), - X(wait_for_request), - X(blksize_size), - X(hardsect_size), - X(blk_size), - X(blk_dev), - X(is_read_only), - X(set_device_ro), - X(bmap), - X(sync_dev), - X(get_blkfops), - X(blkdev_open), - X(blkdev_release), - X(gendisk_head), - X(resetup_one_dev), - X(unplug_device), +/* block device driver support */ +EXPORT_SYMBOL(block_read); +EXPORT_SYMBOL(block_write); +EXPORT_SYMBOL(block_fsync); +EXPORT_SYMBOL(wait_for_request); +EXPORT_SYMBOL(blksize_size); +EXPORT_SYMBOL(hardsect_size); +EXPORT_SYMBOL(blk_size); +EXPORT_SYMBOL(blk_dev); +EXPORT_SYMBOL(is_read_only); +EXPORT_SYMBOL(set_device_ro); +EXPORT_SYMBOL(bmap); +EXPORT_SYMBOL(sync_dev); +EXPORT_SYMBOL(get_blkfops); +EXPORT_SYMBOL(blkdev_open); +EXPORT_SYMBOL(blkdev_release); +EXPORT_SYMBOL(gendisk_head); +EXPORT_SYMBOL(resetup_one_dev); +EXPORT_SYMBOL(unplug_device); #ifdef __i386__ - X(drive_info), +EXPORT_SYMBOL(drive_info); #endif -#ifdef CONFIG_SERIAL - /* Module creation of serial units */ - X(register_serial), - X(unregister_serial), -#endif - /* tty routines */ - X(tty_hangup), - X(tty_wait_until_sent), - X(tty_check_change), - X(tty_hung_up_p), - X(do_SAK), - X(console_print), - - /* filesystem registration */ - X(register_filesystem), - X(unregister_filesystem), - - /* executable format registration */ - X(register_binfmt), - X(unregister_binfmt), - X(search_binary_handler), - X(prepare_binprm), - X(remove_arg_zero), - - /* execution environment registration */ - X(lookup_exec_domain), - X(register_exec_domain), - X(unregister_exec_domain), - - /* sysctl table registration */ - X(register_sysctl_table), - X(unregister_sysctl_table), - X(sysctl_string), - X(sysctl_intvec), - X(proc_dostring), - X(proc_dointvec), - X(proc_dointvec_minmax), - - /* interrupt handling */ - X(request_irq), - X(free_irq), - X(enable_irq), - X(disable_irq), - X(probe_irq_on), - X(probe_irq_off), - X(bh_active), - X(bh_mask), - X(bh_mask_count), - X(bh_base), - X(add_timer), - X(del_timer), - X(tq_timer), - X(tq_immediate), - X(tq_scheduler), - X(timer_active), - X(timer_table), - X(intr_count), - - /* autoirq from drivers/net/auto_irq.c */ - X(autoirq_setup), - X(autoirq_report), - - /* dma handling */ - X(request_dma), - X(free_dma), +/* tty routines */ +EXPORT_SYMBOL(tty_hangup); +EXPORT_SYMBOL(tty_wait_until_sent); +EXPORT_SYMBOL(tty_check_change); +EXPORT_SYMBOL(tty_hung_up_p); +EXPORT_SYMBOL(do_SAK); +EXPORT_SYMBOL(console_print); + +/* filesystem registration */ +EXPORT_SYMBOL(register_filesystem); +EXPORT_SYMBOL(unregister_filesystem); + +/* executable format registration */ +EXPORT_SYMBOL(register_binfmt); +EXPORT_SYMBOL(unregister_binfmt); +EXPORT_SYMBOL(search_binary_handler); +EXPORT_SYMBOL(prepare_binprm); +EXPORT_SYMBOL(remove_arg_zero); + +/* execution environment registration */ +EXPORT_SYMBOL(lookup_exec_domain); +EXPORT_SYMBOL(register_exec_domain); +EXPORT_SYMBOL(unregister_exec_domain); + +/* sysctl table registration */ +EXPORT_SYMBOL(register_sysctl_table); +EXPORT_SYMBOL(unregister_sysctl_table); +EXPORT_SYMBOL(sysctl_string); +EXPORT_SYMBOL(sysctl_intvec); +EXPORT_SYMBOL(proc_dostring); +EXPORT_SYMBOL(proc_dointvec); +EXPORT_SYMBOL(proc_dointvec_minmax); + +/* interrupt handling */ +EXPORT_SYMBOL(request_irq); +EXPORT_SYMBOL(free_irq); +EXPORT_SYMBOL(enable_irq); +EXPORT_SYMBOL(disable_irq); +EXPORT_SYMBOL(probe_irq_on); +EXPORT_SYMBOL(probe_irq_off); +EXPORT_SYMBOL(bh_active); +EXPORT_SYMBOL(bh_mask); +EXPORT_SYMBOL(bh_mask_count); +EXPORT_SYMBOL(bh_base); +EXPORT_SYMBOL(add_timer); +EXPORT_SYMBOL(del_timer); +EXPORT_SYMBOL(tq_timer); +EXPORT_SYMBOL(tq_immediate); +EXPORT_SYMBOL(tq_scheduler); +EXPORT_SYMBOL(timer_active); +EXPORT_SYMBOL(timer_table); +EXPORT_SYMBOL(intr_count); + +/* autoirq from drivers/net/auto_irq.c */ +EXPORT_SYMBOL(autoirq_setup); +EXPORT_SYMBOL(autoirq_report); + +/* dma handling */ +EXPORT_SYMBOL(request_dma); +EXPORT_SYMBOL(free_dma); #ifdef HAVE_DISABLE_HLT - X(disable_hlt), - X(enable_hlt), +EXPORT_SYMBOL(disable_hlt); +EXPORT_SYMBOL(enable_hlt); #endif - /* IO port handling */ - X(check_region), - X(request_region), - X(release_region), - - /* process management */ - X(wake_up), - X(wake_up_interruptible), - X(sleep_on), - X(interruptible_sleep_on), - X(schedule), - X(current_set), - X(jiffies), - X(xtime), - X(do_gettimeofday), - X(loops_per_sec), - X(need_resched), - X(kstat), - X(kill_proc), - X(kill_pg), - X(kill_sl), - - /* misc */ - X(panic), - X(printk), - X(sprintf), - X(vsprintf), - X(kdevname), - X(simple_strtoul), - X(system_utsname), - X(sys_call_table), - X(hard_reset_now), - X(_ctype), - X(secure_tcp_sequence_number), - - /* Signal interfaces */ - X(send_sig), - - /* Program loader interfaces */ - X(setup_arg_pages), - X(copy_strings), - X(do_execve), - X(flush_old_exec), - X(open_inode), - X(read_exec), - - /* Miscellaneous access points */ - X(si_meminfo), - - /* Added to make file system as module */ - X(set_writetime), - X(sys_tz), - X(__wait_on_super), - X(file_fsync), - X(clear_inode), - X(refile_buffer), - X(nr_async_pages), - X(___strtok), - X(init_fifo), - X(super_blocks), - X(reuse_list), - X(fifo_inode_operations), - X(chrdev_inode_operations), - X(blkdev_inode_operations), - X(read_ahead), - X(get_hash_table), - X(get_empty_inode), - X(insert_inode_hash), - X(event), - X(__down), - X(__up), - X(securelevel), +/* IO port handling */ +EXPORT_SYMBOL(check_region); +EXPORT_SYMBOL(request_region); +EXPORT_SYMBOL(release_region); + +/* process management */ +EXPORT_SYMBOL(wake_up); +EXPORT_SYMBOL(wake_up_interruptible); +EXPORT_SYMBOL(sleep_on); +EXPORT_SYMBOL(interruptible_sleep_on); +EXPORT_SYMBOL(schedule); +EXPORT_SYMBOL(current_set); +EXPORT_SYMBOL(jiffies); +EXPORT_SYMBOL(xtime); +EXPORT_SYMBOL(do_gettimeofday); +EXPORT_SYMBOL(loops_per_sec); +EXPORT_SYMBOL(need_resched); +EXPORT_SYMBOL(kstat); +EXPORT_SYMBOL(kill_proc); +EXPORT_SYMBOL(kill_pg); +EXPORT_SYMBOL(kill_sl); + +/* misc */ +EXPORT_SYMBOL(panic); +EXPORT_SYMBOL(printk); +EXPORT_SYMBOL(sprintf); +EXPORT_SYMBOL(vsprintf); +EXPORT_SYMBOL(kdevname); +EXPORT_SYMBOL(simple_strtoul); +EXPORT_SYMBOL(system_utsname); +EXPORT_SYMBOL(sys_call_table); +EXPORT_SYMBOL(hard_reset_now); +EXPORT_SYMBOL(_ctype); +EXPORT_SYMBOL(secure_tcp_sequence_number); + +/* Signal interfaces */ +EXPORT_SYMBOL(send_sig); + +/* Program loader interfaces */ +EXPORT_SYMBOL(setup_arg_pages); +EXPORT_SYMBOL(copy_strings); +EXPORT_SYMBOL(do_execve); +EXPORT_SYMBOL(flush_old_exec); +EXPORT_SYMBOL(open_inode); +EXPORT_SYMBOL(read_exec); + +/* Miscellaneous access points */ +EXPORT_SYMBOL(si_meminfo); + +/* Added to make file system as module */ +EXPORT_SYMBOL(set_writetime); +EXPORT_SYMBOL(sys_tz); +EXPORT_SYMBOL(__wait_on_super); +EXPORT_SYMBOL(file_fsync); +EXPORT_SYMBOL(clear_inode); +EXPORT_SYMBOL(refile_buffer); +EXPORT_SYMBOL(nr_async_pages); +EXPORT_SYMBOL(___strtok); +EXPORT_SYMBOL(init_fifo); +EXPORT_SYMBOL(super_blocks); +EXPORT_SYMBOL(reuse_list); +EXPORT_SYMBOL(fifo_inode_operations); +EXPORT_SYMBOL(chrdev_inode_operations); +EXPORT_SYMBOL(blkdev_inode_operations); +EXPORT_SYMBOL(read_ahead); +EXPORT_SYMBOL(get_hash_table); +EXPORT_SYMBOL(get_empty_inode); +EXPORT_SYMBOL(insert_inode_hash); +EXPORT_SYMBOL(event); +EXPORT_SYMBOL(__down); +EXPORT_SYMBOL(__up); +EXPORT_SYMBOL(securelevel); + /* all busmice */ - X(add_mouse_randomness), - X(fasync_helper), +EXPORT_SYMBOL(add_mouse_randomness); +EXPORT_SYMBOL(fasync_helper); + /* psaux mouse */ - X(aux_device_present), - X(kbd_read_mask), +EXPORT_SYMBOL(aux_device_present); +EXPORT_SYMBOL(kbd_read_mask); #ifdef CONFIG_BLK_DEV_MD - X(disk_name), /* for md.c */ +EXPORT_SYMBOL(disk_name); /* for md.c */ #endif - /* binfmt_aout */ - X(get_write_access), - X(put_write_access), - - /******************************************************** - * Do not add anything below this line, - * as the stacked modules depend on this! - */ -#include -}; - -/* -int symbol_table_size = sizeof (symbol_table) / sizeof (symbol_table[0]); -*/ +/* binfmt_aout */ +EXPORT_SYMBOL(get_write_access); +EXPORT_SYMBOL(put_write_access); diff --git a/kernel/module.c b/kernel/module.c index 09cee93b78c0..0cf595a991de 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -4,789 +4,925 @@ #include #include #include -#include -#include #include - #include +#include + /* * Originally by Anonymous (as far as I know...) * Linux version by Bas Laarhoven * 0.99.14 version by Jon Tombs , - * * Heavily modified by Bjorn Ekwall May 1994 (C) - * This source is covered by the GNU GPL, the same as all kernel sources. - * - * Features: - * - Supports stacked modules (removable only of there are no dependents). - * - Supports table of symbols defined by the modules. - * - Supports /proc/ksyms, showing value, name and owner of all - * the symbols defined by all modules (in stack order). - * - Added module dependencies information into /proc/modules - * - Supports redefines of all symbols, for streams-like behaviour. - * - Compatible with older versions of insmod. - * - * New addition in December 1994: (Bjorn Ekwall, idea from Jacques Gelinas) - * - Externally callable function: - * - * "int register_symtab(struct symbol_table *)" - * - * This function can be called from within the kernel, - * and ALSO from loadable modules. - * The goal is to assist in modularizing the kernel even more, - * and finally: reducing the number of entries in ksyms.c - * since every subsystem should now be able to decide and - * control exactly what symbols it wants to export, locally! + * Rewritten by Richard Henderson Dec 1996 * - * On 1-Aug-95: altered code to use same style as - * do /proc/net/XXX "files". Namely allow more than 4kB - * (or what the block size is) output. - * - * - Use dummy syscall functions for users who disable all - * module support. Similar to kernel/sys.c (Paul Gortmaker) + * This source is covered by the GNU GPL, the same as all kernel sources. */ #ifdef CONFIG_MODULES /* a *big* #ifdef block... */ -static struct module kernel_module; -struct module *module_list = &kernel_module; +extern struct module_symbol __start___ksymtab[]; +extern struct module_symbol __stop___ksymtab[]; -static int freeing_modules; /* true if some modules are marked for deletion */ +extern const struct exception_table_entry __start___ex_table[]; +extern const struct exception_table_entry __stop___ex_table[]; -static struct module *find_module( const char *name); -static int free_modules( void); +static struct module kernel_module = +{ + sizeof(struct module), /* size_of_struct */ + NULL, /* next */ + "", /* name */ + 0, /* size */ + 1, /* usecount */ + MOD_RUNNING, /* flags */ + 0, /* nsyms -- to filled in in init_modules */ + 0, /* ndeps */ + __start___ksymtab, /* syms */ + NULL, /* deps */ + NULL, /* refs */ + NULL, /* init */ + NULL, /* cleanup */ + __start___ex_table, /* ex_table_start */ + __stop___ex_table, /* ex_table_end */ +#ifdef __alpha__ + NULL, /* gp */ +#endif +}; + +struct module *module_list = &kernel_module; + +static long get_mod_name(const char *user_name, char **buf); +static void put_mod_name(char *buf); +static struct module *find_module(const char *name); +static void free_module(struct module *); -extern struct symbol_table symbol_table; /* in kernel/ksyms.c */ /* * Called at boot time */ -void init_modules(void) { - struct internal_symbol *sym; - int i; - for (i = 0, sym = symbol_table.symbol; sym->name; ++sym, ++i) - ; - symbol_table.n_symbols = i; +void init_modules(void) +{ + kernel_module.nsyms = __stop___ksymtab - __start___ksymtab; - kernel_module.symtab = &symbol_table; - kernel_module.state = MOD_RUNNING; /* Hah! */ - kernel_module.name = ""; +#ifdef __alpha__ + { + register unsigned long gp __asm__("$29"); + kernel_module.gp = gp; + } +#endif } - /* * Copy the name of a module from user space. */ -inline int -get_mod_name(char *user_name, char *buf) + +static inline long +get_mod_name(const char *user_name, char **buf) { - /* Should return -EBIG instead of -EFAULT when the name - is too long, but that we couldn't detect real faults then. - Maybe strncpy_from_user() should return -EBIG, when - the source string is too long. */ - return strncpy_from_user(buf, user_name, MOD_MAX_NAME); + unsigned long page; + long retval; + + if ((unsigned long)user_name >= TASK_SIZE) + return -EFAULT; + + page = __get_free_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + retval = strncpy_from_user((char *)page, user_name, PAGE_SIZE); + if (retval > 0) { + if (retval < PAGE_SIZE) { + *buf = (char *)page; + return retval; + } + retval = -ENAMETOOLONG; + } else if (!retval) + retval = -EINVAL; + + free_page(page); + return retval; } +static inline void +put_mod_name(char *buf) +{ + free_page((unsigned long)buf); +} /* * Allocate space for a module. */ + asmlinkage unsigned long -sys_create_module(char *module_name, unsigned long size) +sys_create_module(const char *name_user, size_t size) { - struct module *mp; - void* addr; - int error; - int npages; - int sspace = sizeof(struct module) + MOD_MAX_NAME; - char name[MOD_MAX_NAME]; + char *name; + long namelen, error; + struct module *mod; - if (!suser()) - return -EPERM; - if (module_name == NULL || size == 0) - return -EINVAL; - if ((error = get_mod_name(module_name, name)) < 0) - return error; + if (!suser()) { + error = -EPERM; + goto err0; + } + if ((namelen = get_mod_name(name_user, &name)) < 0) { + error = namelen; + goto err0; + } + if (size < sizeof(struct module)+namelen) { + error = -EINVAL; + goto err1; + } if (find_module(name) != NULL) { - return -EEXIST; + error = -EEXIST; + goto err1; } - - if ((mp = (struct module*) kmalloc(sspace, GFP_KERNEL)) == NULL) { - return -ENOMEM; + if ((mod = (struct module *)vmalloc(size)) == NULL) { + error = -ENOMEM; + goto err1; } - strcpy((char *)(mp + 1), name); /* why not? */ - npages = (size + sizeof (long) + PAGE_SIZE - 1) / PAGE_SIZE; - if ((addr = vmalloc(npages * PAGE_SIZE)) == 0) { - kfree_s(mp, sspace); - return -ENOMEM; - } + memset(mod, 0, sizeof(*mod)); + mod->size_of_struct = sizeof(*mod); + mod->next = module_list; + mod->name = (char *)(mod + 1); + mod->size = size; + memcpy((char*)(mod+1), name, namelen+1); - mp->next = module_list; - mp->ref = NULL; - mp->symtab = NULL; - mp->name = (char *)(mp + 1); - mp->size = npages; - mp->addr = addr; - mp->state = MOD_UNINITIALIZED; - mp->cleanup = NULL; - mp->exceptinfo.start = NULL; - mp->exceptinfo.stop = NULL; + put_mod_name(name); - * (long *) addr = 0; /* set use count to zero */ - module_list = mp; /* link it in */ + module_list = mod; /* link it in */ - pr_debug("module `%s' (%lu pages @ 0x%08lx) created\n", - mp->name, (unsigned long) mp->size, (unsigned long) mp->addr); - return (unsigned long) addr; -} + return (unsigned long) mod; +err1: + put_mod_name(name); +err0: + return error; +} /* * Initialize a module. */ + asmlinkage int -sys_init_module(char *module_name, char *code, unsigned codesize, - struct mod_routines *routines, - struct symbol_table *symtab) +sys_init_module(const char *name_user, struct module *mod_user) { - struct module *mp; - struct symbol_table *newtab; - char name[MOD_MAX_NAME]; - int error; - struct mod_routines rt; + struct module mod_tmp, *mod; + char *name, *n_name; + long namelen, n_namelen, i, error; + unsigned long mod_user_size; + struct module_ref *dep; + + if (!suser()) { + error = -EPERM; + goto err0; + } + if ((namelen = get_mod_name(name_user, &name)) < 0) { + error = namelen; + goto err0; + } + if ((mod = find_module(name)) == NULL) { + error = -ENOENT; + goto err1; + } - if (!suser()) - return -EPERM; + /* In the future we can check for various known sizes, but for + now there is only one. */ + if ((error = get_user(mod_user_size, &mod_user->size_of_struct)) != 0) + goto err1; + if (mod_user_size != sizeof(struct module)) { + printk(KERN_ERR "init_module: Invalid module header size.\n" + KERN_ERR "A new version of the modutils is likely " + "needed.\n"); + error = -EINVAL; + goto err1; + } -#ifdef __i386__ - /* A little bit of protection... we "know" where the user stack is... */ + /* Hold the current contents while we play with the user's idea + of righteousness. */ + mod_tmp = *mod; - if (symtab && ((unsigned long)symtab > 0xb0000000)) { - printk(KERN_WARNING "warning: you are using an old insmod, no symbols will be inserted!\n"); - symtab = NULL; + error = copy_from_user(mod, mod_user, sizeof(struct module)); + if (error) { + error = -EFAULT; + goto err2; } -#endif - if ((error = get_mod_name(module_name, name)) < 0) - return error; - pr_debug("initializing module `%s', %d (0x%x) bytes\n", - name, codesize, codesize); - if (copy_from_user(&rt, routines, sizeof rt)) - return -EFAULT; - if ((mp = find_module(name)) == NULL) - return -ENOENT; - if (codesize & MOD_AUTOCLEAN) { - /* - * set autoclean marker from codesize... - * set usage count to "zero" - */ - codesize &= ~MOD_AUTOCLEAN; - GET_USE_COUNT(mp) = MOD_AUTOCLEAN; - } - if ((codesize + sizeof (long) + PAGE_SIZE - 1) / PAGE_SIZE > mp->size) - return -EINVAL; - if (copy_from_user((char *)mp->addr + sizeof (long), code, codesize)) - return -EFAULT; - memset((char *)mp->addr + sizeof (long) + codesize, 0, - mp->size * PAGE_SIZE - (codesize + sizeof (long))); - pr_debug("module init entry = 0x%08lx, cleanup entry = 0x%08lx\n", - (unsigned long) rt.init, (unsigned long) rt.cleanup); - if (rt.signature != MODULE_2_1_7_SIG){ - printk ("Older insmod used with kernel 2.1.7 +\n"); - return -EINVAL; + + /* Sanity check the size of the module. */ + error = -EINVAL; + + if (mod->size > mod_tmp.size) { + printk(KERN_ERR "init_module: Size of initialized module " + "exceeds size of created module.\n"); + goto err2; } - mp->cleanup = rt.cleanup; - mp->exceptinfo = rt.exceptinfo; - - /* update kernel symbol table */ - if (symtab) { /* symtab == NULL means no new entries to handle */ - struct internal_symbol *sym; - struct module_ref *ref; - int size; - int i; - int legal_start; - - error = get_user(size, &symtab->size); - if (error) - return error; - if ((newtab = (struct symbol_table*) kmalloc(size, GFP_KERNEL)) == NULL) { - return -ENOMEM; - } - if (copy_from_user((char *)(newtab), symtab, size)) { - kfree_s(newtab, size); - return -EFAULT; - } + /* Make sure all interesting pointers are sane. */ - /* sanity check */ - legal_start = sizeof(struct symbol_table) + - newtab->n_symbols * sizeof(struct internal_symbol) + - newtab->n_refs * sizeof(struct module_ref); +#define bound(p, n, m) ((unsigned long)(p) >= (unsigned long)(m+1) && \ + (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size) - if ((newtab->n_symbols < 0) || (newtab->n_refs < 0) || (legal_start > size)) { - printk(KERN_WARNING "Rejecting illegal symbol table (n_symbols=%d,n_refs=%d)\n", - newtab->n_symbols, newtab->n_refs); - kfree_s(newtab, size); - return -EINVAL; - } + if (!bound(mod->name, namelen, mod)) { + printk(KERN_ERR "init_module: mod->name out of bounds.\n"); + goto err2; + } + if (mod->nsyms && !bound(mod->syms, mod->nsyms, mod)) { + printk(KERN_ERR "init_module: mod->syms out of bounds.\n"); + goto err2; + } + if (mod->ndeps && !bound(mod->deps, mod->ndeps, mod)) { + printk(KERN_ERR "init_module: mod->deps out of bounds.\n"); + goto err2; + } + if (mod->init && !bound(mod->init, 0, mod)) { + printk(KERN_ERR "init_module: mod->init out of bounds.\n"); + goto err2; + } + if (mod->cleanup && !bound(mod->cleanup, 0, mod)) { + printk(KERN_ERR "init_module: mod->cleanup out of bounds.\n"); + goto err2; + } + if (mod->ex_table_start > mod->ex_table_end + || (mod->ex_table_start && + !((unsigned long)mod->ex_table_start >= (unsigned long)(mod+1) + && ((unsigned long)mod->ex_table_end + < (unsigned long)mod + mod->size))) + || (((unsigned long)mod->ex_table_start + - (unsigned long)mod->ex_table_end) + % sizeof(struct exception_table_entry))) { + printk(KERN_ERR "init_module: mod->ex_table_* invalid.\n"); + goto err2; + } + if (mod->flags & ~MOD_AUTOCLEAN) { + printk(KERN_ERR "init_module: mod->flags invalid.\n"); + goto err2; + } +#ifdef __alpha__ + if (!bound(mod->gp - 0x8000, 0, mod)) { + printk(KERN_ERR "init_module: mod->gp out of bounds.\n"); + goto err2; + } +#endif - /* relocate name pointers, index referred from start of table */ - for (sym = &(newtab->symbol[0]), i = 0; i < newtab->n_symbols; ++sym, ++i) { - if ((unsigned long)sym->name < legal_start || size <= (unsigned long)sym->name) { - printk(KERN_WARNING "Rejecting illegal symbol table\n"); - kfree_s(newtab, size); - return -EINVAL; - } - /* else */ - sym->name += (long)newtab; - } - mp->symtab = newtab; - - /* Update module references. - * On entry, from "insmod", ref->module points to - * the referenced module! - * Now it will point to the current module instead! - * The ref structure becomes the first link in the linked - * list of references to the referenced module. - * Also, "sym" from above, points to the first ref entry!!! - */ - for (ref = (struct module_ref *)sym, i = 0; - i < newtab->n_refs; ++ref, ++i) { - - /* Check for valid reference */ - struct module *link = module_list; - while (link && (ref->module != link)) - link = link->next; - - if (link == (struct module *)0) { - printk(KERN_WARNING "Non-module reference! Rejected!\n"); - return -EINVAL; - } +#undef bound + + /* Check that the user isn't doing something silly with the name. */ + + if ((n_namelen = get_mod_name(mod->name - (unsigned long)mod + + (unsigned long)mod_user, + &n_name)) < 0) { + error = n_namelen; + goto err2; + } + if (namelen != n_namelen || strcmp(n_name, mod_tmp.name) != 0) { + printk(KERN_ERR "init_module: changed module name to " + "`%s' from `%s'\n", + n_name, mod_tmp.name); + error = -EINVAL; + goto err3; + } - ref->next = ref->module->ref; - ref->module->ref = ref; - ref->module = mp; + /* Ok, that's about all the sanity we can stomach; copy the rest. */ + + error = copy_from_user(mod+1, mod_user+1, mod->size-sizeof(*mod)); + if (error) { + error = -EFAULT; + goto err3; + } + + /* Update module references. */ + mod->next = mod_tmp.next; + mod->refs = NULL; + for (i = 0, dep = mod->deps; i < mod->ndeps; ++i, ++dep) { + struct module *o, *d = dep->dep; + + /* Make sure the indicated dependancies are really modules. */ + if (d == mod) { + printk(KERN_ERR "init_module: self-referential " + "dependancy in mod->deps.\n"); + error = -EINVAL; + goto err3; } + + for (o = module_list; o != &kernel_module; o = o->next) + if (o == d) goto found_dep; + + printk(KERN_ERR "init_module: found dependancy that is " + "(no longer?) a module.\n"); + error = -EINVAL; + goto err3; + + found_dep: + dep->ref = mod; + dep->next_ref = d->refs; + d->refs = dep; } - GET_USE_COUNT(mp) += 1; - if ((*rt.init)() != 0) { - GET_USE_COUNT(mp) = 0; + /* Free our temporary memory. */ + put_mod_name(n_name); + put_mod_name(name); + + /* Initialize the module. */ + mod->usecount = 1; + if (mod->init && mod->init() != 0) { + mod->usecount = 0; return -EBUSY; } - GET_USE_COUNT(mp) -= 1; - mp->state = MOD_RUNNING; + mod->usecount--; + /* And set it running. */ + mod->flags |= MOD_RUNNING; return 0; + +err3: + put_mod_name(n_name); +err2: + *mod = mod_tmp; +err1: + put_mod_name(name); +err0: + return error; } asmlinkage int -sys_delete_module(char *module_name) +sys_delete_module(const char *name_user) { - struct module *mp; - char name[MOD_MAX_NAME]; - int error; + struct module *mod, *next; + char *name; + long error; if (!suser()) return -EPERM; - /* else */ - if (module_name != NULL) { - if ((error = get_mod_name(module_name, name)) < 0) + + if (name_user) { + if ((error = get_mod_name(name_user, &name)) < 0) return error; - if ((mp = find_module(name)) == NULL) + if (error == 0) { + put_mod_name(name); + return -EINVAL; + } + if ((mod = find_module(name)) == NULL) { + put_mod_name(name); return -ENOENT; - if ((mp->ref != NULL) || - ((GET_USE_COUNT(mp) & ~(MOD_AUTOCLEAN | MOD_VISITED)) != 0)) + } + put_mod_name(name); + if (mod->refs != NULL || mod->usecount != 0) return -EBUSY; - GET_USE_COUNT(mp) &= ~(MOD_AUTOCLEAN | MOD_VISITED); - if (mp->state == MOD_RUNNING) - (*mp->cleanup)(); - mp->state = MOD_DELETED; - free_modules(); + + free_module(mod); + return 0; } - /* for automatic reaping */ - else { - struct module *mp_next; - for (mp = module_list; mp != &kernel_module; mp = mp_next) { - mp_next = mp->next; - if ((mp->ref == NULL) && (mp->state == MOD_RUNNING) && - ((GET_USE_COUNT(mp) & ~MOD_VISITED) == MOD_AUTOCLEAN)) { - if ((GET_USE_COUNT(mp) & MOD_VISITED)) { - /* Don't reap until one "cycle" after last _use_ */ - GET_USE_COUNT(mp) &= ~MOD_VISITED; - } - else { - GET_USE_COUNT(mp) &= ~(MOD_AUTOCLEAN | MOD_VISITED); - (*mp->cleanup)(); - mp->state = MOD_DELETED; - free_modules(); - } - } + + /* Do automatic reaping */ + for (mod = module_list; mod != &kernel_module; mod = next) { + next = mod->next; + if (mod->refs == NULL && + mod->usecount == 0 && + ((mod->flags & (MOD_AUTOCLEAN|MOD_RUNNING|MOD_DELETED)) + == (MOD_AUTOCLEAN|MOD_RUNNING))) { + if (mod->flags & MOD_VISITED) + mod->flags &= ~MOD_VISITED; + else + free_module(mod); } } return 0; } +/* Query various bits about modules. */ -/* - * Copy the kernel symbol table to user space. If the argument is null, - * just return the size of the table. - * - * Note that the transient module symbols are copied _first_, - * in lifo order!!! - * - * The symbols to "insmod" are according to the "old" format: struct kernel_sym, - * which is actually quite handy for this purpose. - * Note that insmod inserts a struct symbol_table later on... - * (as that format is quite handy for the kernel...) - * - * For every module, the first (pseudo)symbol copied is the module name - * and the address of the module struct. - * This lets "insmod" keep track of references, and build the array of - * struct module_refs in the symbol table. - * The format of the module name is "#module", so that "insmod" can easily - * notice when a module name comes along. Also, this will make it possible - * to use old versions of "insmod", albeit with reduced functionality... - * The "kernel" module has an empty name. - */ -asmlinkage int -sys_get_kernel_syms(struct kernel_sym *table) +static int +qm_modules(char *buf, size_t bufsize, size_t *ret) { - struct internal_symbol *from; - struct kernel_sym isym; - struct kernel_sym *to; - struct module *mp = module_list; - int i; - int nmodsyms = 0; - int err; + struct module *mod; + size_t nmod, space, len; - for (mp = module_list; mp; mp = mp->next) { - if (mp->symtab && mp->symtab->n_symbols) { - /* include the count for the module name! */ - nmodsyms += mp->symtab->n_symbols + 1; - } - else - /* include the count for the module name! */ - nmodsyms += 1; /* return modules without symbols too */ - } - - if (table != NULL) { - to = table; - - /* copy all module symbols first (always LIFO order) */ - for (mp = module_list; mp; mp = mp->next) { - if (mp->state == MOD_RUNNING) { - /* magic: write module info as a pseudo symbol */ - isym.value = (unsigned long)mp; - sprintf(isym.name, "#%s", mp->name); - err = copy_to_user(to, &isym, sizeof isym); - if (err) - return -EFAULT; - ++to; - - if (mp->symtab != NULL) { - for (i = mp->symtab->n_symbols, - from = mp->symtab->symbol; - i > 0; --i, ++from, ++to) { - - isym.value = (unsigned long)from->addr; - strncpy(isym.name, from->name, sizeof isym.name); - err = copy_to_user(to, &isym, sizeof isym); - if (err) - return -EFAULT; - } - } - } - } + nmod = space = 0; + + for (mod=module_list; mod != &kernel_module; mod=mod->next, ++nmod) { + len = strlen(mod->name)+1; + if (len > bufsize) + goto calc_space_needed; + if (copy_to_user(buf, mod->name, len)) + return -EFAULT; + buf += len; + bufsize -= len; + space += len; } - return nmodsyms; + if (put_user(nmod, ret)) + return -EFAULT; + else + return 0; + +calc_space_needed: + for (space += len; mod; mod = mod->next) + space += strlen(mod->name)+1; + + if (put_user(space, ret)) + return -EFAULT; + else + return -ENOSPC; } -/* - * Look for a module by name, ignoring modules marked for deletion. - */ -struct module * -find_module( const char *name) +static int +qm_deps(struct module *mod, char *buf, size_t bufsize, size_t *ret) { - struct module *mp; + size_t i, space, len; - for (mp = module_list ; mp ; mp = mp->next) { - if (mp->state == MOD_DELETED) - continue; - if (!strcmp(mp->name, name)) - break; + if (mod == &kernel_module) + return -EINVAL; + if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING) + if (put_user(0, ret)) + return -EFAULT; + else + return 0; + + space = 0; + for (i = 0; i < mod->ndeps; ++i) { + const char *dep_name = mod->deps[i].dep->name; + + len = strlen(dep_name)+1; + if (len > bufsize) + goto calc_space_needed; + if (copy_to_user(buf, dep_name, len)) + return -EFAULT; + buf += len; + bufsize -= len; + space += len; } - return mp; + + if (put_user(i, ret)) + return -EFAULT; + else + return 0; + +calc_space_needed: + for (space += len; i < mod->ndeps; ++i) + space += strlen(mod->deps[i].dep->name)+1; + + if (put_user(space, ret)) + return -EFAULT; + else + return -ENOSPC; } -static void -drop_refs(struct module *mp) +static int +qm_refs(struct module *mod, char *buf, size_t bufsize, size_t *ret) { - struct module *step; - struct module_ref *prev; + size_t nrefs, space, len; struct module_ref *ref; - for (step = module_list; step; step = step->next) { - for (prev = ref = step->ref; ref; ref = prev->next) { - if (ref->module == mp) { - if (ref == step->ref) - step->ref = ref->next; - else - prev->next = ref->next; - break; /* every module only references once! */ - } - else - prev = ref; - } + if (mod == &kernel_module) + return -EINVAL; + if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING) + if (put_user(0, ret)) + return -EFAULT; + else + return 0; + + space = 0; + for (nrefs = 0, ref = mod->refs; ref ; ++nrefs, ref = ref->next_ref) { + const char *ref_name = ref->ref->name; + + len = strlen(ref_name)+1; + if (len > bufsize) + goto calc_space_needed; + if (copy_to_user(buf, ref_name, len)) + return -EFAULT; + buf += len; + bufsize -= len; + space += len; } + + if (put_user(nrefs, ret)) + return -EFAULT; + else + return 0; + +calc_space_needed: + for (space += len; ref; ref = ref->next_ref) + space += strlen(ref->ref->name)+1; + + if (put_user(space, ret)) + return -EFAULT; + else + return -ENOSPC; } -/* - * Try to free modules which have been marked for deletion. Returns nonzero - * if a module was actually freed. - */ -int -free_modules( void) +static int +qm_symbols(struct module *mod, char *buf, size_t bufsize, size_t *ret) { - struct module *mp; - struct module **mpp; - int did_deletion; - - did_deletion = 0; - freeing_modules = 0; - mpp = &module_list; - while ((mp = *mpp) != NULL) { - if (mp->state != MOD_DELETED) { - mpp = &mp->next; - } else { - if ((GET_USE_COUNT(mp) != 0) || (mp->ref != NULL)) { - freeing_modules = 1; - mpp = &mp->next; - } else { /* delete it */ - *mpp = mp->next; - if (mp->symtab) { - if (mp->symtab->n_refs) - drop_refs(mp); - if (mp->symtab->size) - kfree_s(mp->symtab, mp->symtab->size); - } - vfree(mp->addr); - kfree_s(mp, sizeof(struct module) + MOD_MAX_NAME); - did_deletion = 1; - } - } + size_t i, space, len; + struct module_symbol *s; + char *strings; + unsigned long *vals; + + if ((mod->flags & (MOD_RUNNING | MOD_DELETED)) != MOD_RUNNING) + if (put_user(0, ret)) + return -EFAULT; + else + return 0; + + space = mod->nsyms * 2*sizeof(void *); + + if (!access_ok(VERIFY_WRITE, buf, space)) + return -EFAULT; + + i = len = 0; + s = mod->syms; + + if (space > bufsize) + goto calc_space_needed; + + bufsize -= space; + vals = (unsigned long *)buf; + strings = buf+space; + + for (; i < mod->nsyms ; ++i, ++s, vals += 2) { + len = strlen(s->name)+1; + if (len > bufsize) + goto calc_space_needed; + + if (copy_to_user(strings, s->name, len) + || __put_user(s->value, vals+0) + || __put_user(space, vals+1)) + return -EFAULT; + + strings += len; + bufsize -= len; + space += len; } - return did_deletion; + + if (put_user(i, ret)) + return -EFAULT; + else + return 0; + +calc_space_needed: + for (space += len; i < mod->nsyms; ++i, ++s) + space += strlen(s->name)+1; + + if (put_user(space, ret)) + return -EFAULT; + else + return -ENOSPC; } +static int +qm_info(struct module *mod, char *buf, size_t bufsize, size_t *ret) +{ + int error = 0; -/* - * Called by the /proc file system to return a current list of modules. - */ -int get_module_list(char *buf) + if (mod == &kernel_module) + return -EINVAL; + + if (sizeof(struct module_info) <= bufsize) { + struct module_info info; + info.addr = (unsigned long)mod; + info.size = mod->size; + info.flags = mod->flags; + + if (copy_to_user(buf, &info, sizeof(struct module_info))) + return -EFAULT; + } else + error = -ENOSPC; + + if (put_user(sizeof(struct module_info), ret)) + return -EFAULT; + + return error; +} + +asmlinkage int +sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, + size_t *ret) { - char *p; - const char *q; - int i; - struct module *mp; - struct module_ref *ref; - char size[32]; - - p = buf; - /* Do not show the kernel pseudo module */ - for (mp = module_list ; mp && mp->next; mp = mp->next) { - if (p - buf > 4096 - 100) - break; /* avoid overflowing buffer */ - q = mp->name; - if (*q == '\0' && mp->size == 0 && mp->ref == NULL) - continue; /* don't list modules for kernel syms */ - i = 20; - while (*q) { - *p++ = *q++; - i--; - } - sprintf(size, "%d", mp->size); - i -= strlen(size); - if (i <= 0) - i = 1; - while (--i >= 0) - *p++ = ' '; - q = size; - while (*q) - *p++ = *q++; - if (mp->state == MOD_UNINITIALIZED) - q = " (uninitialized)"; - else if (mp->state == MOD_RUNNING) - q = ""; - else if (mp->state == MOD_DELETED) - q = " (deleted)"; - else - q = " (bad state)"; - while (*q) - *p++ = *q++; - - *p++ = '\t'; - if ((ref = mp->ref) != NULL) { - *p++ = '['; - for (; ref; ref = ref->next) { - q = ref->module->name; - while (*q) - *p++ = *q++; - if (ref->next) - *p++ = ' '; - } - *p++ = ']'; - } - if (mp->state == MOD_RUNNING) { - sprintf(size,"\t%ld%s", - GET_USE_COUNT(mp) & ~(MOD_AUTOCLEAN | MOD_VISITED), - ((GET_USE_COUNT(mp) & MOD_AUTOCLEAN)? - " (autoclean)":"")); - q = size; - while (*q) - *p++ = *q++; + struct module *mod; + + if (name_user == NULL) + mod = &kernel_module; + else { + long namelen; + char *name; + + if ((namelen = get_mod_name(name_user, &name)) < 0) + return namelen; + if (namelen == 0) + mod = &kernel_module; + else if ((mod = find_module(name)) == NULL) { + put_mod_name(name); + return -ENOENT; } - *p++ = '\n'; + put_mod_name(name); + } + + switch (which) + { + case 0: + return 0; + case QM_MODULES: + return qm_modules(buf, bufsize, ret); + case QM_DEPS: + return qm_deps(mod, buf, bufsize, ret); + case QM_REFS: + return qm_refs(mod, buf, bufsize, ret); + case QM_SYMBOLS: + return qm_symbols(mod, buf, bufsize, ret); + case QM_INFO: + return qm_info(mod, buf, bufsize, ret); } - return p - buf; -} + return -EINVAL; +} /* - * Called by the /proc file system to return a current list of ksyms. + * Copy the kernel symbol table to user space. If the argument is + * NULL, just return the size of the table. + * + * This call is depreciated in favour of query_module+QM_SYMBOLS which + * does not arbitrarily limit the length of the symbol. */ -int get_ksyms_list(char *buf, char **start, off_t offset, int length) + +asmlinkage int +sys_get_kernel_syms(struct kernel_sym *table) { - struct module *mp; - struct internal_symbol *sym; + struct module *mod; int i; - char *p = buf; - int len = 0; /* code from net/ipv4/proc.c */ - off_t pos = 0; - off_t begin = 0; - for (mp = module_list; mp; mp = mp->next) { - if ((mp->state == MOD_RUNNING) && - (mp->symtab != NULL) && - (mp->symtab->n_symbols > 0)) { - for (i = mp->symtab->n_symbols, - sym = mp->symtab->symbol; - i > 0; --i, ++sym) { - - p = buf + len; - if (mp->name[0]) { - len += sprintf(p, "%08lx %s\t[%s]\n", - (long)sym->addr, - sym->name, mp->name); - } else { - len += sprintf(p, "%08lx %s\n", - (long)sym->addr, - sym->name); - } - pos = begin + len; - if (pos < offset) { - len = 0; - begin = pos; - } - pos = begin + len; - if (pos > offset+length) - goto leave_the_loop; - } + for (mod = module_list, i = 0; mod; mod = mod->next) { + /* include the count for the module name! */ + i += mod->nsyms + 1; + } + + if (table == NULL) + return i; + + for (mod = module_list, i = 0; mod; mod = mod->next) { + struct kernel_sym ksym; + struct module_symbol *msym; + unsigned int j; + + if ((mod->flags & (MOD_RUNNING|MOD_DELETED)) != MOD_RUNNING) + continue; + + /* magic: write module info as a pseudo symbol */ + ksym.value = (unsigned long)mod; + ksym.name[0] = '#'; + strncpy(ksym.name+1, mod->name, sizeof(ksym.name)-1); + ksym.name[sizeof(ksym.name)-1] = '\0'; + + if (copy_to_user(table, &ksym, sizeof(ksym)) != 0) + return i; + ++i, ++table; + + if (mod->nsyms == 0) + continue; + + for (j = 0, msym = mod->syms; j < mod->nsyms; ++j, ++msym) { + ksym.value = msym->value; + strncpy(ksym.name, msym->name, sizeof(ksym.name)); + ksym.name[sizeof(ksym.name)-1] = '\0'; + + if (copy_to_user(table, &ksym, sizeof(ksym)) != 0) + return i; + ++i, ++table; } } - leave_the_loop: - *start = buf + (offset - begin); - len -= (offset - begin); - if (len > length) - len = length; - return len; + return i; } /* - * Rules: - * - The new symbol table should be statically allocated, or else you _have_ - * to set the "size" field of the struct to the number of bytes allocated. - * - * - The strings that name the symbols will not be copied, maybe the pointers - * - * - For a loadable module, the function should only be called in the - * context of init_module - * - * Those are the only restrictions! (apart from not being reentrant...) - * - * If you want to remove a symbol table for a loadable module, - * the call looks like: "register_symtab(0)". - * - * The look of the code is mostly dictated by the format of - * the frozen struct symbol_table, due to compatibility demands. + * Look for a module by name, ignoring modules marked for deletion. */ -#define INTSIZ sizeof(struct internal_symbol) -#define REFSIZ sizeof(struct module_ref) -#define SYMSIZ sizeof(struct symbol_table) -#define MODSIZ sizeof(struct module) -static struct symbol_table nulltab; -int -register_symtab_from(struct symbol_table *intab, long *from) +static struct module * +find_module(const char *name) { - struct module *mp; - struct module *link; - struct symbol_table *oldtab; - struct symbol_table *newtab; - struct module_ref *newref; - int size; - - if (intab && (intab->n_symbols == 0)) { - struct internal_symbol *sym; - /* How many symbols, really? */ - - for (sym = intab->symbol; sym->name; ++sym) - intab->n_symbols +=1; - } - - for (mp = module_list; mp != &kernel_module; mp = mp->next) { - /* - * "from" points to "mod_use_count_" (== start of module) - * or is == 0 if called from a non-module - */ - if ((unsigned long)(mp->addr) == (unsigned long)from) + struct module *mod; + + for (mod = module_list; mod ; mod = mod->next) { + if (mod->flags & MOD_DELETED) + continue; + if (!strcmp(mod->name, name)) break; } - if (mp == &kernel_module) { - /* Aha! Called from an "internal" module */ - if (!intab) - return 0; /* or -ESILLY_PROGRAMMER :-) */ + return mod; +} - /* create a pseudo module! */ - if (!(mp = (struct module*) kmalloc(MODSIZ, GFP_KERNEL))) { - /* panic time! */ - printk(KERN_ERR "Out of memory for new symbol table!\n"); - return -ENOMEM; - } - /* else OK */ - memset(mp, 0, MODSIZ); - mp->state = MOD_RUNNING; /* Since it is resident... */ - mp->name = ""; /* This is still the "kernel" symbol table! */ - mp->symtab = intab; +/* + * Free the given module. + */ - /* link it in _after_ the resident symbol table */ - mp->next = kernel_module.next; - kernel_module.next = mp; +static void +free_module(struct module *mod) +{ + struct module_ref *dep; + unsigned i; - return 0; + /* Let the module clean up. */ + + mod->flags |= MOD_DELETED; + if (mod->flags & MOD_RUNNING) { + mod->cleanup(); + mod->flags &= ~MOD_RUNNING; } - /* else ******** Called from a loadable module **********/ + /* Remove the module from the dependancy lists. */ - /* - * This call should _only_ be done in the context of the - * call to init_module i.e. when loading the module!! - * Or else... - */ + for (i = 0, dep = mod->deps; i < mod->ndeps; ++i, ++dep) { + struct module_ref **pp; + for (pp = &dep->dep->refs; *pp != dep; pp = &(*pp)->next_ref) + continue; + *pp = dep->next_ref; + } - /* Any table there before? */ - if ((oldtab = mp->symtab) == (struct symbol_table*)0) { - /* No, just insert it! */ - mp->symtab = intab; - return 0; + /* And from the main module list. */ + + if (mod == module_list) { + module_list = mod->next; + } else { + struct module *p; + for (p = module_list; p->next != mod; p = p->next) + continue; + p->next = mod->next; } - /* else ****** we have to replace the module symbol table ******/ + /* And free the memory. */ - if (oldtab->n_refs == 0) { /* no problems! */ - mp->symtab = intab; - /* if the old table was kmalloc-ed, drop it */ - if (oldtab->size > 0) - kfree_s(oldtab, oldtab->size); + vfree(mod); +} - return 0; - } +/* + * Called by the /proc file system to return a current list of modules. + */ + +int get_module_list(char *p) +{ + size_t left = PAGE_SIZE; + struct module *mod; + char tmpstr[64]; + struct module_ref *ref; - /* else */ - /***** The module references other modules... insmod said so! *****/ - /* We have to allocate a new symbol table, or we lose them! */ - if (intab == (struct symbol_table*)0) - intab = &nulltab; /* easier code with zeroes in place */ + for (mod = module_list; mod != &kernel_module; mod = mod->next) { + long len; + const char *q; + +#define safe_copystr(str, len) \ + do { \ + if (left < len) \ + goto fini; \ + memcpy(p, str, len); p += len, left -= len; \ + } while (0) + + len = strlen(mod->name); + safe_copystr(mod->name, len); + + if ((len = 20 - len) > 0) { + if (left < len) + goto fini; + memset(p, ' ', len); + p += len; + left -= len; + } - /* the input symbol table space does not include the string table */ - /* (it does for symbol tables that insmod creates) */ + len = sprintf(tmpstr, "%8lu", mod->size); + safe_copystr(tmpstr, len); - if (!(newtab = (struct symbol_table*)kmalloc( - size = SYMSIZ + intab->n_symbols * INTSIZ + - oldtab->n_refs * REFSIZ, - GFP_KERNEL))) { - /* panic time! */ - printk(KERN_ERR "Out of memory for new symbol table!\n"); - return -ENOMEM; - } + if (mod->flags & MOD_RUNNING) { + len = sprintf(tmpstr, "%4lu", mod->usecount); + safe_copystr(tmpstr, len); + } - /* copy up to, and including, the new symbols */ - memcpy(newtab, intab, SYMSIZ + intab->n_symbols * INTSIZ); + if (mod->flags & MOD_DELETED) + q = " (deleted)"; + else if (mod->flags & MOD_RUNNING) + q = ""; + else + q = " (uninitialized)"; + len = strlen(q); + safe_copystr(q, len); - newtab->size = size; - newtab->n_refs = oldtab->n_refs; + safe_copystr("\t", 1); - /* copy references */ - memcpy( ((char *)newtab) + SYMSIZ + intab->n_symbols * INTSIZ, - ((char *)oldtab) + SYMSIZ + oldtab->n_symbols * INTSIZ, - oldtab->n_refs * REFSIZ); + if ((ref = mod->refs) != NULL) { + safe_copystr("[", 1); + while (1) { + q = ref->ref->name; + len = strlen(q); + safe_copystr(q, len); - /* relink references from the old table to the new one */ + if ((ref = ref->next_ref) != NULL) + safe_copystr(" ", 1); + else + break; + } + safe_copystr("]", 1); + } - /* pointer to the first reference entry in newtab! Really! */ - newref = (struct module_ref*) &(newtab->symbol[newtab->n_symbols]); + if ((mod->flags & (MOD_RUNNING | MOD_AUTOCLEAN)) + == (MOD_RUNNING | MOD_AUTOCLEAN)) { + safe_copystr(" (autoclean)", 12); + } - /* check for reference links from previous modules */ - for ( link = module_list; - link && (link != &kernel_module); - link = link->next) { + safe_copystr("\n", 1); - if (link->ref && (link->ref->module == mp)) - link->ref = newref++; +#undef safe_copystr } - mp->symtab = newtab; +fini: + return PAGE_SIZE - left; +} - /* all references (if any) have been handled */ +/* + * Called by the /proc file system to return a current list of ksyms. + */ - /* if the old table was kmalloc-ed, drop it */ - if (oldtab->size > 0) - kfree_s(oldtab, oldtab->size); +int +get_ksyms_list(char *buf, char **start, off_t offset, int length) +{ + struct module *mod; + char *p = buf; + int len = 0; /* code from net/ipv4/proc.c */ + off_t pos = 0; + off_t begin = 0; - return 0; + for (mod = module_list; mod; mod = mod->next) { + unsigned i; + struct module_symbol *sym; + + if (!(mod->flags & MOD_RUNNING) || (mod->flags & MOD_DELETED)) + continue; + + for (i = mod->nsyms, sym = mod->syms; i > 0; --i, ++sym) { + p = buf + len; + if (*mod->name) { + len += sprintf(p, "%0*lx %s\t[%s]\n", + (int)(2*sizeof(void*)), + sym->value, sym->name, + mod->name); + } else { + len += sprintf(p, "%0*lx %s\n", + (int)(2*sizeof(void*)), + sym->value, sym->name); + } + pos = begin + len; + if (pos < offset) { + len = 0; + begin = pos; + } + pos = begin + len; + if (pos > offset+length) + goto leave_the_loop; + } + } +leave_the_loop: + *start = buf + (offset - begin); + len -= (offset - begin); + if (len > length) + len = length; + return len; } #else /* CONFIG_MODULES */ /* Dummy syscalls for people who don't want modules */ -asmlinkage unsigned long sys_create_module(void) +asmlinkage unsigned long +sys_create_module(const char *name_user, size_t size) { return -ENOSYS; } -asmlinkage int sys_init_module(void) +asmlinkage int +sys_init_module(const char *name_user, struct module *mod_user) { return -ENOSYS; } -asmlinkage int sys_delete_module(void) +asmlinkage int +sys_delete_module(const char *name_user) { return -ENOSYS; } -asmlinkage int sys_get_kernel_syms(void) +asmlinkage int +sys_query_module(const char *name_user, int which, char *buf, size_t bufsize, + size_t *ret) { + /* Let the program know about the new interface. Not that + it'll do them much good. */ + if (which == 0) + return 0; + return -ENOSYS; } -int register_symtab_from(struct symbol_table *intab, long *from) +asmlinkage int +sys_get_kernel_syms(struct kernel_sym *table) { - return 0; + return -ENOSYS; } #endif /* CONFIG_MODULES */ - diff --git a/net/802/llc_macinit.c b/net/802/llc_macinit.c index d2ce73f40b6f..a934db5124c3 100644 --- a/net/802/llc_macinit.c +++ b/net/802/llc_macinit.c @@ -1,9 +1,9 @@ /* * NET An implementation of the IEEE 802.2 LLC protocol for the - * LINUX operating system. LLC is implemented as a set of + * LINUX operating system. LLC is implemented as a set of * state machines and callbacks for higher networking layers. * - * Code for initialization, termination, registration and + * Code for initialization, termination, registration and * MAC layer glue. * * Written by Tim Alpaerts, Tim_Alpaerts@toyota-motor-europe.com @@ -16,7 +16,7 @@ * Changes * Alan Cox : Chainsawed to Linux format * Added llc_ to names - * Started restructuring handlers + * Started restructuring handlers */ #include @@ -35,11 +35,11 @@ /* * All incoming frames pass thru mac_data_indicate(). * Here an llc structure is associated with an skb depending on the source - * MAC address in the pdu. + * MAC address in the pdu. * The received sk_buffs with pdus other than I_CMD and I_RSP * are freed by mac_data_indicate() after processing, * the I pdu buffers are freed by the cl2llc client when it no longer needs - * the skb. + * the skb. */ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, struct packet_type *pt) @@ -49,12 +49,12 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st unsigned char type; frameptr fr; int free=1; - + /* - * Truncate buffer to true 802.3 length + * Truncate buffer to true 802.3 length * [FIXME: move to 802.2 demux] */ - + ll = *(skb->data -2) * 256 + *(skb->data -1); skb_trim( skb, ll ); @@ -64,23 +64,23 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st if (type <= FRMR_RSP) { - /* - * PDU is of the type 2 set + /* + * PDU is of the type 2 set */ - if ((lp->llc_mode == MODE_ABM)||(type == SABME_CMD)) + if ((lp->llc_mode == MODE_ABM)||(type == SABME_CMD)) llc_process_otype2_frame(lp, skb, type); - + } - else + else { /* - * PDU belongs to type 1 set + * PDU belongs to type 1 set */ p_flag = fr->u_hdr.u_pflag; switch(type) { case TEST_CMD: - llc_sendpdu(lp, TEST_RSP, 0,ll -3, + llc_sendpdu(lp, TEST_RSP, 0,ll -3, fr->u_hdr.u_info); break; case TEST_RSP: @@ -88,12 +88,12 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st { lp->ops->test_indication_ep(lp, ll -3, fr->u_hdr.u_info); - } + } break; - case XID_CMD: + case XID_CMD: /* - * Basic format XID is handled by LLC itself - * Doc 5.4.1.1.2 p 48/49 + * Basic format XID is handled by LLC itself + * Doc 5.4.1.1.2 p 48/49 */ if ((ll == 6)&&(fr->u_hdr.u_info[0] == 0x81)) @@ -105,10 +105,10 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st } break; - case XID_RSP: + case XID_RSP: if( ll == 6 && fr->u_hdr.u_info[0] == 0x81 ) { - lp->k = fr->u_hdr.u_info[2]; + lp->k = fr->u_hdr.u_info[2]; } if (lp->ops->xid_indication_ep != NULL) { @@ -118,24 +118,24 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st break; case UI_CMD: - if(lp->ops->unit_data_indication_ep != NULL) + if(lp->ops->unit_data_indication_ep != NULL) { free=lp->ops->unit_data_indication_ep(lp, ll-3, fr->u_hdr.u_info); } break; - - default: + + default: /* - * All other type 1 pdus ignored for now + * All other type 1 pdus ignored for now */ - } + } } - + if (free&&(!(IS_IFRAME(fr)))) { /* - * No auto free for I pdus + * No auto free for I pdus */ skb->sk = NULL; kfree_skb(skb, FREE_READ); @@ -148,9 +148,9 @@ int llc_mac_data_indicate(llcptr lp, struct sk_buff *skb, struct device *dev, st * Create an LLC client. As it is the job of the caller to clean up * LLC's on device down, the device list must be locked before this call. */ - + int register_cl2llc_client(llcptr lp, const char *device, llc_ops *ops, u8 *rmac, u8 ssap, u8 dsap) -{ +{ char eye_init[] = "LLC\0"; memset(lp, 0, sizeof(*lp)); @@ -163,12 +163,12 @@ int register_cl2llc_client(llcptr lp, const char *device, llc_ops *ops, u8 *rmac lp->n1 = 1490; lp->n2 = 10; lp->timer_interval[P_TIMER] = HZ; /* 1 sec */ - lp->timer_interval[REJ_TIMER] = HZ/8; + lp->timer_interval[REJ_TIMER] = HZ/8; lp->timer_interval[ACK_TIMER] = HZ/8; lp->timer_interval[BUSY_TIMER] = HZ*2; lp->local_sap = ssap; lp->ops = ops; - lp->remote_mac_len = lp->dev->addr_len; + lp->remote_mac_len = lp->dev->addr_len; memcpy(lp->remote_mac, rmac, lp->remote_mac_len); lp->state = 0; lp->llc_mode = MODE_ADM; @@ -188,26 +188,20 @@ void unregister_cl2llc_client(llcptr lp) } -static struct symbol_table cl2llc_proto_syms = -{ -#include - X(register_cl2llc_client), - X(unregister_cl2llc_client), - X(llc_data_request), - X(llc_unit_data_request), - X(llc_test_request), - X(llc_xid_request), -#include -}; +EXPORT_SYMBOL(register_cl2llc_client); +EXPORT_SYMBOL(unregister_cl2llc_client); +EXPORT_SYMBOL(llc_data_request); +EXPORT_SYMBOL(llc_unit_data_request); +EXPORT_SYMBOL(llc_test_request); +EXPORT_SYMBOL(llc_xid_request); #define ALL_TYPES_8022 0 void llc_init(struct net_proto *proto) { - register_symtab( &cl2llc_proto_syms ); printk(KERN_NOTICE "IEEE 802.2 LLC for Linux 2.1 (c) 1996 Tim Alpaerts\n"); - return; + return; } #ifdef MODULE diff --git a/net/802/p8022.c b/net/802/p8022.c index f8754e5c0650..968603b204d4 100644 --- a/net/802/p8022.c +++ b/net/802/p8022.c @@ -14,7 +14,7 @@ static struct datalink_proto *p8022_list = NULL; * frames. We have the absolute minimum needed for IPX, * IP and Appletalk phase 2. */ - + static struct datalink_proto * find_8022_client(unsigned char type) { @@ -46,7 +46,7 @@ p8022_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) } static void -p8022_datalink_header(struct datalink_proto *dl, +p8022_datalink_header(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest_node) { struct device *dev = skb->dev; @@ -59,7 +59,7 @@ p8022_datalink_header(struct datalink_proto *dl, dev->hard_header(skb, dev, ETH_P_802_3, dest_node, NULL, skb->len); } -static struct packet_type p8022_packet_type = +static struct packet_type p8022_packet_type = { 0, /* MUTTER ntohs(ETH_P_8022),*/ NULL, /* All devices */ @@ -68,21 +68,15 @@ static struct packet_type p8022_packet_type = NULL, }; -static struct symbol_table p8022_proto_syms = { -#include - X(register_8022_client), - X(unregister_8022_client), -#include -}; - +EXPORT_SYMBOL(register_8022_client); +EXPORT_SYMBOL(unregister_8022_client); void p8022_proto_init(struct net_proto *pro) { p8022_packet_type.type=htons(ETH_P_802_2); dev_add_pack(&p8022_packet_type); - register_symtab(&p8022_proto_syms); } - + struct datalink_proto * register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *)) { diff --git a/net/802/p8022tr.c b/net/802/p8022tr.c index d1fcc5c46b4e..4d7ed668afcc 100644 --- a/net/802/p8022tr.c +++ b/net/802/p8022tr.c @@ -16,7 +16,7 @@ static struct datalink_proto *p8022tr_list = NULL; * frames. We have the absolute minimum needed for IPX, * IP and Appletalk phase 2. */ - + static struct datalink_proto * find_8022tr_client(unsigned char type) { @@ -48,7 +48,7 @@ p8022tr_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) } static void -p8022tr_datalink_header(struct datalink_proto *dl, +p8022tr_datalink_header(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest_node) { struct device *dev = skb->dev; @@ -66,30 +66,25 @@ p8022tr_datalink_header(struct datalink_proto *dl, memmove(newdata, olddata, dev->hard_header_len - SNAP_HEADER_LEN); } -static struct packet_type p8022tr_packet_type = +static struct packet_type p8022tr_packet_type = { - 0, + 0, NULL, /* All devices */ p8022tr_rcv, NULL, NULL, }; - -static struct symbol_table p8022tr_proto_syms = { -#include - X(register_8022tr_client), - X(unregister_8022tr_client), -#include -}; + +EXPORT_SYMBOL(register_8022tr_client); +EXPORT_SYMBOL(unregister_8022tr_client); void p8022tr_proto_init(struct net_proto *pro) { p8022tr_packet_type.type=htons(ETH_P_TR_802_2); dev_add_pack(&p8022tr_packet_type); - register_symtab(&p8022tr_proto_syms); } - + struct datalink_proto * register_8022tr_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *)) { @@ -134,4 +129,3 @@ void unregister_8022tr_client(unsigned char type) restore_flags(flags); } - diff --git a/net/802/psnap.c b/net/802/psnap.c index 4f17352ab586..2f0af6199614 100644 --- a/net/802/psnap.c +++ b/net/802/psnap.c @@ -9,7 +9,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ - + #include #include #include @@ -25,7 +25,7 @@ static struct datalink_proto *snap_dl = NULL; /* 802.2 DL for SNAP */ /* * Find a snap client by matching the 5 bytes. */ - + static struct datalink_proto *find_snap_client(unsigned char *desc) { struct datalink_proto *proto; @@ -37,27 +37,27 @@ static struct datalink_proto *find_snap_client(unsigned char *desc) /* * A SNAP packet has arrived */ - + int snap_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) { - static struct packet_type psnap_packet_type = + static struct packet_type psnap_packet_type = { - 0, + 0, NULL, /* All Devices */ snap_rcv, NULL, NULL, }; - + struct datalink_proto *proto; proto = find_snap_client(skb->h.raw); - if (proto != NULL) + if (proto != NULL) { /* * Pass the frame on. */ - + skb->h.raw += 5; skb_pull(skb,5); if (psnap_packet_type.type == 0) @@ -72,7 +72,7 @@ int snap_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) /* * Put a SNAP header on a frame and pass to 802.2 */ - + static void snap_datalink_header(struct datalink_proto *dl, struct sk_buff *skb, unsigned char *dest_node) { memcpy(skb_push(skb,5),dl->type,5); @@ -83,25 +83,20 @@ static void snap_datalink_header(struct datalink_proto *dl, struct sk_buff *skb, * Set up the SNAP layer */ -static struct symbol_table snap_proto_syms = { -#include - X(register_snap_client), - X(unregister_snap_client), -#include -}; - +EXPORT_SYMBOL(register_snap_client); +EXPORT_SYMBOL(unregister_snap_client); + void snap_proto_init(struct net_proto *pro) { snap_dl=register_8022_client(0xAA, snap_rcv); if(snap_dl==NULL) printk("SNAP - unable to register with 802.2\n"); - register_symtab(&snap_proto_syms); } - + /* * Register SNAP clients. We don't yet use this for IP or IPX. */ - + struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *)) { struct datalink_proto *proto; @@ -110,7 +105,7 @@ struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)( return NULL; proto = (struct datalink_proto *) kmalloc(sizeof(*proto), GFP_ATOMIC); - if (proto != NULL) + if (proto != NULL) { memcpy(proto->type, desc,5); proto->type_len = 5; @@ -152,4 +147,3 @@ void unregister_snap_client(unsigned char *desc) restore_flags(flags); } - diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index fb2b889b65c9..60ee9a2aac36 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -5,8 +5,8 @@ * Alan Cox * * - * With more than a little assistance from - * + * With more than a little assistance from + * * Wesley Craig * * Fixes: @@ -33,7 +33,7 @@ * TODO * ASYNC I/O */ - + #include #include #include @@ -95,15 +95,15 @@ static struct sock *volatile atalk_socket_list=NULL; * handler using this technique. They can be added although we do not * use this facility. */ - + static void atalk_remove_socket(struct sock *sk) { unsigned long flags; struct sock *s; - + save_flags(flags); cli(); - + s=atalk_socket_list; if(s==sk) { @@ -138,22 +138,22 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, struct atalk_ifa { struct sock *s; - for( s = atalk_socket_list; s != NULL; s = s->next ) + for( s = atalk_socket_list; s != NULL; s = s->next ) { - if ( to->sat_port != s->protinfo.af_at.src_port ) + if ( to->sat_port != s->protinfo.af_at.src_port ) { continue; } if ( to->sat_addr.s_net == 0 && to->sat_addr.s_node == ATADDR_BCAST && - s->protinfo.af_at.src_net == atif->address.s_net ) + s->protinfo.af_at.src_net == atif->address.s_net ) { break; } if ( to->sat_addr.s_net == s->protinfo.af_at.src_net && - (to->sat_addr.s_node == s->protinfo.af_at.src_node + (to->sat_addr.s_node == s->protinfo.af_at.src_node ||to->sat_addr.s_node == ATADDR_BCAST )) { break; @@ -167,22 +167,22 @@ static struct sock *atalk_search_socket(struct sockaddr_at *to, struct atalk_ifa /* * Find a socket in the list. */ - + static struct sock *atalk_find_socket(struct sockaddr_at *sat) { struct sock *s; - for ( s = atalk_socket_list; s != NULL; s = s->next ) + for ( s = atalk_socket_list; s != NULL; s = s->next ) { - if ( s->protinfo.af_at.src_net != sat->sat_addr.s_net ) + if ( s->protinfo.af_at.src_net != sat->sat_addr.s_net ) { continue; } - if ( s->protinfo.af_at.src_node != sat->sat_addr.s_node ) + if ( s->protinfo.af_at.src_node != sat->sat_addr.s_node ) { continue; } - if ( s->protinfo.af_at.src_port != sat->sat_port ) + if ( s->protinfo.af_at.src_port != sat->sat_port ) { continue; } @@ -203,7 +203,7 @@ static void atalk_destroy_socket(struct sock *sk); /* * Handler for deferred kills. */ - + static void atalk_destroy_timer(unsigned long data) { atalk_destroy_socket((struct sock *)data); @@ -213,12 +213,12 @@ static void atalk_destroy_socket(struct sock *sk) { struct sk_buff *skb; atalk_remove_socket(sk); - + while((skb=skb_dequeue(&sk->receive_queue))!=NULL) { kfree_skb(skb,FREE_READ); } - + if(sk->wmem_alloc == 0 && sk->rmem_alloc == 0 && sk->dead) { sk_free(sk); @@ -239,9 +239,9 @@ static void atalk_destroy_socket(struct sock *sk) /* - * Called from proc fs + * Called from proc fs */ - + int atalk_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { struct sock *s; @@ -267,10 +267,10 @@ int atalk_get_info(char *buffer, char **start, off_t offset, int length, int dum s->protinfo.af_at.dest_port); len += sprintf (buffer+len,"%08X:%08X ", s->wmem_alloc, s->rmem_alloc); len += sprintf (buffer+len,"%02X %d\n", s->state, SOCK_INODE(s->socket)->i_uid); - + /* Are we still dumping unwanted data then discard the record */ pos=begin+len; - + if(posoffset+length) /* We have dumped enough */ break; } - + /* The data in question runs from begin to begin+len */ *start=buffer+(offset-begin); /* Start of wanted data */ len-=(offset-begin); /* Remove unwanted header data from length */ if(len>length) len=length; /* Remove unwanted tail data from length */ - + return len; } @@ -303,21 +303,21 @@ static struct atalk_iface *atalk_iface_list=NULL; /* * Appletalk interface control */ - + /* - * Drop a device. Doesn't drop any of its routes - that is the - * the callers problem. Called when we down the interface or + * Drop a device. Doesn't drop any of its routes - that is the + * the callers problem. Called when we down the interface or * delete the address. */ - + static void atif_drop_device(struct device *dev) { struct atalk_iface **iface = &atalk_iface_list; struct atalk_iface *tmp; - while ((tmp = *iface) != NULL) + while ((tmp = *iface) != NULL) { - if (tmp->dev == dev) + if (tmp->dev == dev) { *iface = tmp->next; kfree_s(tmp, sizeof(struct atalk_iface)); @@ -331,7 +331,7 @@ static struct atalk_iface *atif_add_device(struct device *dev, struct at_addr *s { struct atalk_iface *iface=(struct atalk_iface *) kmalloc(sizeof(*iface), GFP_KERNEL); - unsigned long flags; + unsigned long flags; if(iface==NULL) return NULL; iface->dev=dev; @@ -348,7 +348,7 @@ static struct atalk_iface *atif_add_device(struct device *dev, struct at_addr *s /* * Perform phase 2 AARP probing on our tentative address. */ - + static int atif_probe_device(struct atalk_iface *atif) { int ct; @@ -357,19 +357,19 @@ static int atif_probe_device(struct atalk_iface *atif) int probe_node=atif->address.s_node; int netct; int nodect; - + struct ifreq atreq; struct sockaddr_at *sa; int err; /* * THIS IS A HACK: Farallon cards want to do their own picking of - * addresses. This needs tidying up post 1.4, but we need it in + * addresses. This needs tidying up post 1.4, but we need it in * now for the 1.4 release as is. * */ if((atif->dev->type == ARPHRD_LOCALTLK || atif->dev->type == ARPHRD_PPP) - && atif->dev->do_ioctl) + && atif->dev->do_ioctl) { /* fake up the request and pass it down */ sa = (struct sockaddr_at*)&atreq.ifr_addr; @@ -389,11 +389,11 @@ static int atif_probe_device(struct atalk_iface *atif) * properly. We can then also dump the localtalk test. */ return err; - } + } /* * Offset the network we start probing with. */ - + if(probe_net==ATADDR_ANYNET) { if(!netrange) @@ -401,15 +401,15 @@ static int atif_probe_device(struct atalk_iface *atif) else probe_net=ntohs(atif->nets.nr_firstnet) + (jiffies%netrange); } - + if(probe_node == ATADDR_ANYNODE) probe_node = jiffies&0xFF; - - + + /* * Scan the networks. */ - + for(netct=0;netct<=netrange;netct++) { /* @@ -474,7 +474,7 @@ static struct at_addr *atalk_find_primary(void) /* * Give a device find its atif control structure */ - + struct atalk_iface *atalk_find_dev(struct device *dev) { struct atalk_iface *iface; @@ -488,15 +488,15 @@ struct atalk_iface *atalk_find_dev(struct device *dev) * Find a match for 'any network' - ie any of our interfaces with that * node number will do just nicely. */ - + static struct atalk_iface *atalk_find_anynet(int node, struct device *dev) { struct atalk_iface *iface; - for(iface=atalk_iface_list;iface!=NULL;iface=iface->next) + for(iface=atalk_iface_list;iface!=NULL;iface=iface->next) { if ( iface->dev != dev || ( iface->status & ATIF_PROBE )) continue; - if ( node == ATADDR_BCAST || iface->address.s_node == node ) + if ( node == ATADDR_BCAST || iface->address.s_node == node ) return iface; } return NULL; @@ -505,13 +505,13 @@ static struct atalk_iface *atalk_find_anynet(int node, struct device *dev) /* * Find a match for a specific network:node pair */ - + static struct atalk_iface *atalk_find_interface(int net, int node) { struct atalk_iface *iface; for(iface=atalk_iface_list;iface!=NULL;iface=iface->next) { - if((node==ATADDR_BCAST || iface->address.s_node==node) + if((node==ATADDR_BCAST || iface->address.s_node==node) && iface->address.s_net==net && !(iface->status&ATIF_PROBE)) return iface; } @@ -524,7 +524,7 @@ static struct atalk_iface *atalk_find_interface(int net, int node) * the socket (later on...). We know about host routes and the fact * that a route must be direct to broadcast. */ - + static struct atalk_route *atrtr_find(struct at_addr *target) { struct atalk_route *r; @@ -543,12 +543,12 @@ static struct atalk_route *atrtr_find(struct at_addr *target) return NULL; } - + /* * Given an appletalk network find the device to use. This can be * a simple lookup. Funny stuff like routers can wait 8) */ - + static struct device *atrtr_get_dev(struct at_addr *sa) { struct atalk_route *atr=atrtr_find(sa); @@ -561,7 +561,7 @@ static struct device *atrtr_get_dev(struct at_addr *sa) /* * Set up a default router. */ - + static void atrtr_set_default(struct device *dev) { atrtr_default.dev=dev; @@ -575,7 +575,7 @@ static void atrtr_set_default(struct device *dev) * entry in the list. While it uses netranges we always set them to one * entry to work like netatalk. */ - + static int atrtr_create(struct rtentry *r, struct device *devhint) { struct sockaddr_at *ta=(struct sockaddr_at *)&r->rt_dst; @@ -583,22 +583,22 @@ static int atrtr_create(struct rtentry *r, struct device *devhint) struct atalk_route *rt; struct atalk_iface *iface, *riface; unsigned long flags; - + save_flags(flags); - + /* * Fixme: Raise/Lower a routing change semaphore for these * operations. */ - + /* * Validate the request - */ + */ if(ta->sat_family!=AF_APPLETALK) return -EINVAL; if(devhint == NULL && ga->sat_family != AF_APPLETALK) return -EINVAL; - + /* * Now walk the routing table and make our decisions */ @@ -608,7 +608,7 @@ static int atrtr_create(struct rtentry *r, struct device *devhint) if(r->rt_flags != rt->flags) continue; - if(ta->sat_addr.s_net == rt->target.s_net) + if(ta->sat_addr.s_net == rt->target.s_net) { if(!(rt->flags&RTF_HOST)) break; @@ -617,9 +617,9 @@ static int atrtr_create(struct rtentry *r, struct device *devhint) } } - if ( devhint == NULL ) + if ( devhint == NULL ) { - for ( riface = NULL, iface = atalk_iface_list; iface; iface = iface->next ) + for ( riface = NULL, iface = atalk_iface_list; iface; iface = iface->next ) { if ( riface == NULL && ntohs( ga->sat_addr.s_net ) >= ntohs( iface->nets.nr_firstnet ) && ntohs( ga->sat_addr.s_net ) <= ntohs( iface->nets.nr_lastnet )) @@ -647,11 +647,11 @@ static int atrtr_create(struct rtentry *r, struct device *devhint) /* * Fill in the entry. */ - rt->target=ta->sat_addr; + rt->target=ta->sat_addr; rt->dev=devhint; rt->flags=r->rt_flags; rt->gateway=ga->sat_addr; - + restore_flags(flags); return 0; } @@ -660,17 +660,17 @@ static int atrtr_create(struct rtentry *r, struct device *devhint) /* * Delete a route. Find it and discard it. */ - + static int atrtr_delete( struct at_addr *addr ) { struct atalk_route **r = &atalk_router_list; struct atalk_route *tmp; - while ((tmp = *r) != NULL) + while ((tmp = *r) != NULL) { if (tmp->target.s_net == addr->s_net && (!(tmp->flags&RTF_GATEWAY) || - tmp->target.s_node == addr->s_node )) + tmp->target.s_node == addr->s_node )) { *r = tmp->next; kfree_s(tmp, sizeof(struct atalk_route)); @@ -685,15 +685,15 @@ static int atrtr_delete( struct at_addr *addr ) * Called when a device is downed. Just throw away any routes * via it. */ - + void atrtr_device_down(struct device *dev) { struct atalk_route **r = &atalk_router_list; struct atalk_route *tmp; - while ((tmp = *r) != NULL) + while ((tmp = *r) != NULL) { - if (tmp->dev == dev) + if (tmp->dev == dev) { *r = tmp->next; kfree_s(tmp, sizeof(struct atalk_route)); @@ -728,7 +728,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event, vo /* * Device configuration ioctl calls. */ - + int atif_ioctl(int cmd, void *arg) { struct ifreq atreq; @@ -741,17 +741,17 @@ int atif_ioctl(int cmd, void *arg) int ct; int limit; struct rtentry rtdef; - + err = copy_from_user(&atreq,arg,sizeof(atreq)); if (err) - return -EFAULT; + return -EFAULT; if((dev=dev_get(atreq.ifr_name))==NULL) return -ENODEV; - + sa=(struct sockaddr_at*)&atreq.ifr_addr; atif=atalk_find_dev(dev); - + switch(cmd) { case SIOCSIFADDR: @@ -779,7 +779,7 @@ int atif_ioctl(int cmd, void *arg) */ if(atif->status&ATIF_PROBE) return -EBUSY; - + atif->address.s_net=sa->sat_addr.s_net; atif->address.s_node=sa->sat_addr.s_node; atrtr_device_down(dev); /* Flush old routes */ @@ -791,10 +791,10 @@ int atif_ioctl(int cmd, void *arg) atif->nets= *nr; /* - * Check if the chosen address is used. If so we - * error and atalkd will try another. + * Check if the chosen address is used. If so we + * error and atalkd will try another. */ - + if(!(dev->flags&IFF_LOOPBACK) && atif_probe_device(atif)<0) { atif_drop_device(dev); @@ -805,7 +805,7 @@ int atif_ioctl(int cmd, void *arg) * Hey it worked - add the direct * routes. */ - + sa=(struct sockaddr_at *)&rtdef.rt_gateway; sa->sat_family=AF_APPLETALK; sa->sat_addr.s_net=atif->address.s_net; @@ -819,13 +819,13 @@ int atif_ioctl(int cmd, void *arg) /* * Routerless initial state. */ - if(nr->nr_firstnet==htons(0) && nr->nr_lastnet==htons(0xFFFE)) + if(nr->nr_firstnet==htons(0) && nr->nr_lastnet==htons(0xFFFE)) { sa->sat_addr.s_net=atif->address.s_net; atrtr_create(&rtdef, dev); atrtr_set_default(dev); - } - else + } + else { limit=ntohs(nr->nr_lastnet); if(limit-ntohs(nr->nr_firstnet) > 256) @@ -867,15 +867,15 @@ int atif_ioctl(int cmd, void *arg) /* * Routing ioctl() calls */ - + static int atrtr_ioctl(unsigned int cmd, void *arg) { int err; struct rtentry rt; - + err = copy_from_user(&rt,arg,sizeof(rt)); if (err) - return -EFAULT; + return -EFAULT; switch(cmd) { @@ -972,15 +972,15 @@ int atalk_rt_get_info(char *buffer, char **start, off_t offset, int length, int * Checksum: This is 'optional'. It's quite likely also a good * candidate for assembler hackery 8) */ - + unsigned short atalk_checksum(struct ddpehdr *ddp, int len) { unsigned long sum=0; /* Assume unsigned long is >16 bits */ unsigned char *data=(unsigned char *)ddp; - + len-=4; /* skip header 4 bytes */ - data+=4; - + data+=4; + /* This ought to be unwrapped neatly. I'll trust gcc for now */ while(len--) { @@ -997,12 +997,12 @@ unsigned short atalk_checksum(struct ddpehdr *ddp, int len) return htons((unsigned short)sum); return 0xFFFF; /* Use 0xFFFF for 0. 0 itself means none */ } - + /* * Generic fcntl calls are already dealt with. If we don't need funny ones * this is the all you need. Async I/O is also separate. */ - + static int atalk_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg) { /* struct sock *sk=sock->sk;*/ @@ -1014,24 +1014,24 @@ static int atalk_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg) } /* - * Set 'magic' options for appletalk. If we don't have any this is fine + * Set 'magic' options for appletalk. If we don't have any this is fine * as it is. */ - + static int atalk_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen) { struct sock *sk; int err,opt; - + sk=sock->sk; - + if(optval==NULL) return(-EINVAL); err = get_user(opt, (int *)optval); if (err) return err; - + switch(level) { case SOL_ATALK: @@ -1041,7 +1041,7 @@ static int atalk_setsockopt(struct socket *sock, int level, int optname, char *o return -EOPNOTSUPP; } break; - + default: return -EOPNOTSUPP; } @@ -1051,14 +1051,14 @@ static int atalk_setsockopt(struct socket *sock, int level, int optname, char *o /* * Get any magic options. Comment above applies. */ - + static int atalk_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen) { struct sock *sk; int val=0; int err; - + sk=sock->sk; switch(level) @@ -1084,7 +1084,7 @@ static int atalk_getsockopt(struct socket *sock, int level, int optname, /* * Only for connection oriented sockets - ignore */ - + static int atalk_listen(struct socket *sock, int backlog) { return -EOPNOTSUPP; @@ -1093,7 +1093,7 @@ static int atalk_listen(struct socket *sock, int backlog) /* * These are standard. */ - + static void def_callback1(struct sock *sk) { if(!sk->dead) @@ -1113,7 +1113,7 @@ static void def_callback2(struct sock *sk, int len) * Create a socket. Initialise the socket, blank the addresses * set the state. */ - + static int atalk_create(struct socket *sock, int protocol) { struct sock *sk; @@ -1148,15 +1148,15 @@ static int atalk_create(struct socket *sock, int protocol) sk->state=TCP_CLOSE; sk->socket=sock; sk->type=sock->type; - + sk->mtu=DDP_MAXSZ; - + if(sock!=NULL) { sk->sleep=&sock->wait; sock->sk=sk; } - + sk->state_change=def_callback1; sk->data_ready=def_callback2; sk->write_space=def_callback1; @@ -1169,7 +1169,7 @@ static int atalk_create(struct socket *sock, int protocol) /* * Copy a socket. No work needed. */ - + static int atalk_dup(struct socket *newsock,struct socket *oldsock) { return(atalk_create(newsock,SOCK_DGRAM)); @@ -1178,7 +1178,7 @@ static int atalk_dup(struct socket *newsock,struct socket *oldsock) /* * Free a socket. No work needed */ - + static int atalk_release(struct socket *sock, struct socket *peer) { struct sock *sk=sock->sk; @@ -1191,12 +1191,12 @@ static int atalk_release(struct socket *sock, struct socket *peer) atalk_destroy_socket(sk); return(0); } - + /* * Pick a source address if one is not given. Just return * an error if not supportable. */ - + static int atalk_pick_port(struct sockaddr_at *sat) { for ( sat->sat_port = ATPORT_RESERVED; sat->sat_port < ATPORT_LAST; sat->sat_port++ ) @@ -1206,7 +1206,7 @@ static int atalk_pick_port(struct sockaddr_at *sat) } return -EBUSY; } - + static int atalk_autobind(struct sock *sk) { struct at_addr *ap = atalk_find_primary(); @@ -1229,17 +1229,17 @@ static int atalk_autobind(struct sock *sk) /* * Set the address 'our end' of the connection. */ - + static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk; struct sockaddr_at *addr=(struct sockaddr_at *)uaddr; - + sk=sock->sk; - + if(sk->zapped==0) return(-EINVAL); - + if(addr_len!=sizeof(struct sockaddr_at)) return -EINVAL; @@ -1255,7 +1255,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) sk->protinfo.af_at.src_node=addr->sat_addr.s_node=ap->s_node; } else - { + { if ( atalk_find_interface( addr->sat_addr.s_net, addr->sat_addr.s_node ) == NULL ) return -EADDRNOTAVAIL; sk->protinfo.af_at.src_net=addr->sat_addr.s_net; @@ -1273,7 +1273,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) sk->protinfo.af_at.src_port=addr->sat_port; if(atalk_find_socket(addr)!=NULL) - return -EADDRINUSE; + return -EADDRINUSE; atalk_insert_socket(sk); sk->zapped=0; @@ -1283,35 +1283,35 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) /* * Set the address we talk to. */ - + static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { struct sock *sk=sock->sk; struct sockaddr_at *addr; - - sk->state = TCP_CLOSE; + + sk->state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if(addr_len!=sizeof(*addr)) return(-EINVAL); addr=(struct sockaddr_at *)uaddr; - + if(addr->sat_family!=AF_APPLETALK) return -EAFNOSUPPORT; #if 0 /* Netatalk doesn't check this - fix netatalk first!*/ if(addr->sat_addr.s_node==ATADDR_BCAST && !sk->broadcast) return -EACCES; -#endif +#endif if(sk->zapped) { if(atalk_autobind(sk)<0) return -EBUSY; - } - + } + if(atrtr_get_dev(&addr->sat_addr)==NULL) return -ENETUNREACH; - + sk->protinfo.af_at.dest_port=addr->sat_port; sk->protinfo.af_at.dest_net=addr->sat_addr.s_net; sk->protinfo.af_at.dest_node=addr->sat_addr.s_node; @@ -1323,7 +1323,7 @@ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, /* * Not relevant */ - + static int atalk_socketpair(struct socket *sock1, struct socket *sock2) { return(-EOPNOTSUPP); @@ -1332,10 +1332,10 @@ static int atalk_socketpair(struct socket *sock1, struct socket *sock2) /* * Not relevant */ - + static int atalk_accept(struct socket *sock, struct socket *newsock, int flags) { - if(newsock->sk) { + if(newsock->sk) { sk_free(newsock->sk); MOD_DEC_USE_COUNT; } @@ -1346,22 +1346,22 @@ static int atalk_accept(struct socket *sock, struct socket *newsock, int flags) * Find the name of an appletalk socket. Just copy the right * fields into the sockaddr. */ - + static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct sockaddr_at sat; struct sock *sk; - + sk=sock->sk; if(sk->zapped) { if(atalk_autobind(sk)<0) return -ENOBUFS; - } - + } + *uaddr_len = sizeof(struct sockaddr_at); - + if(peer) { if(sk->state!=TCP_ESTABLISHED) @@ -1383,11 +1383,11 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, /* * Receive a packet (in skb) from device dev. This has come from the SNAP decoder, and on entry - * skb->h.raw is the DDP header, skb->len is the DDP length. The physical headers have been + * skb->h.raw is the DDP header, skb->len is the DDP length. The physical headers have been * extracted. PPP should probably pass frames marked as for this layer * [ie ARPHRD_ETHERTALK] */ - + static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) { struct sock *sock; @@ -1395,15 +1395,15 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type struct atalk_iface *atif; struct sockaddr_at tosat; int origlen; - + /* Size check */ if(skb->lenlen; - + skb_trim(skb,min(skb->len,ddp->deh_len)); /* @@ -1429,7 +1429,7 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * (Otherwise we'll detonate most spectacularly * in the middle of recvmsg()). */ - + if(skb->lendeh_sum && atalk_checksum(ddp, ddp->deh_len)!= ddp->deh_sum) @@ -1449,15 +1449,15 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type } #ifdef CONFIG_FIREWALL - + if(call_in_firewall(AF_APPLETALK, skb->dev, ddp, NULL)!=FW_ACCEPT) { kfree_skb(skb, FREE_READ); return 0; } - -#endif - + +#endif + /* Check the packet is aimed at us */ if(ddp->deh_dnet == 0) /* Net 0 is 'this network' */ @@ -1466,24 +1466,24 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type atif=atalk_find_interface(ddp->deh_dnet,ddp->deh_dnode); /* Not ours */ - if(atif==NULL) + if(atif==NULL) { struct atalk_route *rt; struct at_addr ta; /* Don't route multicast, etc., packets, or packets sent to "this network" */ - if (skb->pkt_type != PACKET_HOST || ddp->deh_dnet == 0) + if (skb->pkt_type != PACKET_HOST || ddp->deh_dnet == 0) { kfree_skb(skb, FREE_READ); return(0); } - -#ifdef CONFIG_FIREWALL + +#ifdef CONFIG_FIREWALL /* * Check firewall allows this routing */ - + if(call_fw_firewall(AF_APPLETALK, skb->dev, ddp, NULL)!=FW_ACCEPT) { kfree_skb(skb, FREE_READ); @@ -1506,7 +1506,7 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * Route goes through another gateway, so * set the target to the gateway instead. */ - + if(rt->flags&RTF_GATEWAY) { ta.s_net = rt->gateway.s_net; @@ -1514,14 +1514,14 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type } /* Fix up skb->len field */ - skb_trim(skb,min(origlen, rt->dev->hard_header_len + + skb_trim(skb,min(origlen, rt->dev->hard_header_len + ddp_dl->header_length + ddp->deh_len)); *((__u16 *)ddp)=ntohs(*((__u16 *)ddp)); /* Mend the byte order */ /* * Send the buffer onwards */ - + skb=skb_unshare(skb, GFP_ATOMIC, FREE_READ); if(skb) { @@ -1539,18 +1539,18 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type tosat.sat_port = ddp->deh_dport; sock=atalk_search_socket( &tosat, atif ); - + if(sock==NULL) /* But not one of our sockets */ { kfree_skb(skb,FREE_READ); return(0); } - + /* * Queue packet (standard) */ - + skb->sk = sock; if(sock_queue_rcv_skb(sock,skb)<0) @@ -1567,7 +1567,7 @@ static int atalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type * header and append a long one. */ - + static int ltalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) { struct ddpehdr *ddp; @@ -1575,49 +1575,49 @@ static int ltalk_rcv(struct sk_buff *skb, struct device *dev, struct packet_type /* * Expand any short form frames. */ - + if(skb->mac.raw[2]==1) { /* * Find our address. */ - + ap=atalk_find_dev_addr(dev); if(ap==NULL || skb->lendata; - + /* * Now fill in the long header. */ - + /* * These two first. The mac overlays the new source/dest * network information so we MUST copy these before * we write the network numbers ! */ - + ddp->deh_dnode=skb->mac.raw[0]; /* From physical header */ ddp->deh_snode=skb->mac.raw[1]; /* From physical header */ - + ddp->deh_dnet=ap->s_net; /* Network number */ - ddp->deh_snet=ap->s_net; + ddp->deh_snet=ap->s_net; ddp->deh_sum=0; /* No checksum */ /* * Not sure about this bit... */ ddp->deh_len=skb->len; - ddp->deh_hops=15; /* Non routable, so force a drop + ddp->deh_hops=15; /* Non routable, so force a drop if we slip up later */ *((__u16 *)ddp)=htons(*((__u16 *)ddp)); /* Mend the byte order */ } @@ -1639,13 +1639,13 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, int loopback=0; int err; int flags = msg->msg_flags; - + if(flags&~MSG_DONTWAIT) return -EINVAL; if(len>587) return -EMSGSIZE; - + if(usat) { if(sk->zapped) @@ -1671,19 +1671,19 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, usat->sat_addr.s_node=sk->protinfo.af_at.dest_node; usat->sat_addr.s_net=sk->protinfo.af_at.dest_net; } - + /* Build a packet */ - + if(sk->debug) printk("SK %p: Got address.\n",sk); - + size=sizeof(struct ddpehdr)+len+ddp_dl->header_length; /* For headers */ if(usat->sat_addr.s_net!=0 || usat->sat_addr.s_node == ATADDR_ANYNODE) { rt=atrtr_find(&usat->sat_addr); if(rt==NULL) - return -ENETUNREACH; + return -ENETUNREACH; dev=rt->dev; } else @@ -1699,7 +1699,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, if(sk->debug) printk("SK %p: Size needed %d, device %s\n", sk, size, dev->name); - + size += dev->hard_header_len; skb = sock_alloc_send_skb(sk, size, 0, flags&MSG_DONTWAIT, &err); @@ -1712,10 +1712,10 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, skb_reserve(skb,dev->hard_header_len); skb->dev=dev; - + if(sk->debug) printk("SK %p: Begin build.\n", sk); - + ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr)); ddp->deh_pad=0; ddp->deh_hops=0; @@ -1736,34 +1736,34 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, if(sk->debug) printk("SK %p: Copy user data (%d bytes).\n", sk, len); - + err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len); if (err) { kfree_skb(skb, FREE_WRITE); return -EFAULT; } - + if(sk->no_check==1) ddp->deh_sum=0; else ddp->deh_sum=atalk_checksum(ddp, len+sizeof(*ddp)); - + #ifdef CONFIG_FIREWALL if(call_out_firewall(AF_APPLETALK, skb->dev, ddp, NULL)!=FW_ACCEPT) { kfree_skb(skb, FREE_WRITE); return -EPERM; - } - + } + #endif - + /* * Loopback broadcast packets to non gateway targets (ie routes * to group we are in) */ - + if(ddp->deh_dnode==ATADDR_BCAST) { if((!(rt->flags&RTF_GATEWAY))&&(!(dev->flags&IFF_LOOPBACK))) @@ -1781,7 +1781,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, } } - if((dev->flags&IFF_LOOPBACK) || loopback) + if((dev->flags&IFF_LOOPBACK) || loopback) { if(sk->debug) printk("SK %p: Loop back.\n", sk); @@ -1794,7 +1794,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, skb_pull(skb,ddp_dl->header_length); atalk_rcv(skb,dev,NULL); } - else + else { if(sk->debug) printk("SK %p: send out.\n", sk); @@ -1803,7 +1803,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, gsat.sat_addr = rt->gateway; usat = &gsat; } - + if(aarp_send_ddp(dev,skb,&usat->sat_addr, NULL)==-1) kfree_skb(skb, FREE_WRITE); /* else queued/sent above in the aarp queue */ @@ -1814,7 +1814,7 @@ static int atalk_sendmsg(struct socket *sock, struct msghdr *msg, int len, } -static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, +static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags, struct scm_cookie *scm) { struct sock *sk=sock->sk; @@ -1850,8 +1850,8 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, msg->msg_flags|=MSG_TRUNC; } er = skb_copy_datagram_iovec(skb,sizeof(*ddp),msg->msg_iov,copied); - if (er) - goto out; + if (er) + goto out; } if(sat) { @@ -1864,7 +1864,7 @@ static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, out: skb_free_datagram(sk, skb); return er ? er : (copied); -} +} static int atalk_shutdown(struct socket *sk,int how) @@ -1880,7 +1880,7 @@ static int atalk_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) { long amount=0; struct sock *sk=sock->sk; - + switch(cmd) { /* @@ -1917,7 +1917,7 @@ static int atalk_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) return(atrtr_ioctl(cmd,(void *)arg)); /* * Interface - */ + */ case SIOCGIFADDR: case SIOCSIFADDR: case SIOCGIFBRDADDR: @@ -1960,7 +1960,7 @@ static struct net_proto_family atalk_family_ops = { static struct proto_ops atalk_dgram_ops = { AF_APPLETALK, - + atalk_dup, atalk_release, atalk_bind, @@ -2033,13 +2033,13 @@ void atalk_proto_init(struct net_proto *pro) (void) sock_register(&atalk_family_ops); if ((ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv)) == NULL) printk(KERN_CRIT "Unable to register DDP with SNAP.\n"); - - ltalk_packet_type.type=htons(ETH_P_LOCALTALK); + + ltalk_packet_type.type=htons(ETH_P_LOCALTALK); dev_add_pack(<alk_packet_type); - + ppptalk_packet_type.type=htons(ETH_P_PPPTALK); dev_add_pack(&ppptalk_packet_type); - + register_netdevice_notifier(&ddp_notifier); aarp_proto_init(); @@ -2047,17 +2047,17 @@ void atalk_proto_init(struct net_proto *pro) proc_net_register(&proc_appletalk); proc_net_register(&proc_atalk_route); proc_net_register(&proc_atalk_iface); -#endif +#endif printk(KERN_INFO "Appletalk 0.18 for Linux NET3.037\n"); } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { atalk_proto_init(NULL); - register_symtab(0); return 0; } @@ -2065,7 +2065,7 @@ int init_module(void) * FIX THIS: If there are any routes/devices configured * for appletalk we must not be unloaded. */ - + /* Remove all route entries. Interrupts must be off. */ extern inline void free_route_list(void) { @@ -2105,7 +2105,7 @@ void cleanup_module(void) proc_net_unregister(PROC_NET_ATALK); proc_net_unregister(PROC_NET_AT_ROUTE); proc_net_unregister(PROC_NET_ATIF); -#endif +#endif unregister_netdevice_notifier(&ddp_notifier); dev_remove_pack(<alk_packet_type); dev_remove_pack(&ppptalk_packet_type); diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 5e6c79179741..c9d67acb4719 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1,8 +1,8 @@ /* * AX.25 release 034 * - * This is ALPHA test software. This code may break your machine, randomly fail to work with new - * releases, misbehave and/or generally screw up. It might even work. + * This is ALPHA test software. This code may break your machine, randomly fail to work with new + * releases, misbehave and/or generally screw up. It might even work. * * This code REQUIRES 2.1.15 or higher/ NET3.038 * @@ -94,7 +94,7 @@ * copy only when needed. * Consider better arbitrary protocol support. */ - + #include #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) #include @@ -152,14 +152,14 @@ char *ax2asc(ax25_address *a) if (c != ' ') *s++ = c; } - + *s++ = '-'; if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { *s++ = '1'; n -= 10; } - + *s++ = n + '0'; *s++ = '\0'; @@ -194,7 +194,7 @@ ax25_address *asc2ax(char *callsign) } addr.ax25_call[6] = *s++ - '0'; - + if (*s != '\0') { addr.ax25_call[6] *= 10; addr.ax25_call[6] += *s++ - '0'; @@ -235,7 +235,7 @@ static void ax25_free_cb(ax25_cb *ax25) kfree_s(ax25->digipeat, sizeof(ax25_digi)); ax25->digipeat = NULL; } - + kfree_s(ax25, sizeof(ax25_cb)); MOD_DEC_USE_COUNT; @@ -248,7 +248,7 @@ static void ax25_remove_socket(ax25_cb *ax25) { ax25_cb *s; unsigned long flags; - + save_flags(flags); cli(); @@ -277,7 +277,7 @@ static void ax25_remove_socket(ax25_cb *ax25) static void ax25_kill_by_device(struct device *dev) { ax25_cb *s; - + for (s = ax25_list; s != NULL; s = s->next) { if (s->device == dev) { s->state = AX25_STATE_0; @@ -390,7 +390,7 @@ static struct sock *ax25_find_socket(ax25_address *my_addr, ax25_address *dest_a * Find an AX.25 control block given both ends. It will only pick up * floating AX.25 control blocks or non Raw socket bound control blocks. */ - + static ax25_cb *ax25_find_cb(ax25_address *my_addr, ax25_address *dest_addr, struct device *dev) { ax25_cb *s; @@ -416,7 +416,7 @@ static ax25_cb *ax25_find_cb(ax25_address *my_addr, ax25_address *dest_addr, str /* * Look for any matching address - RAW sockets can bind to arbitrary names */ - + static struct sock *ax25_addr_match(ax25_address *addr) { unsigned long flags; @@ -440,7 +440,7 @@ static struct sock *ax25_addr_match(ax25_address *addr) static void ax25_send_to_raw(struct sock *sk, struct sk_buff *skb, int proto) { struct sk_buff *copy; - + while (sk != NULL) { if (sk->type == SOCK_RAW && sk->protocol == proto && sk->rmem_alloc <= sk->rcvbuf) { if ((copy = skb_clone(skb, GFP_ATOMIC)) == NULL) @@ -454,7 +454,7 @@ static void ax25_send_to_raw(struct sock *sk, struct sk_buff *skb, int proto) sk = sk->next; } -} +} /* * Deferred destroy. @@ -479,15 +479,15 @@ void ax25_destroy_socket(ax25_cb *ax25) /* Not static as it's used by the timer { struct sk_buff *skb; unsigned long flags; - + save_flags(flags); cli(); - + del_timer(&ax25->timer); - + ax25_remove_socket(ax25); ax25_clear_queues(ax25); /* Flush the queues */ - + if (ax25->sk != NULL) { while ((skb = skb_dequeue(&ax25->sk->receive_queue)) != NULL) { if (skb->sk != ax25->sk) { /* A pending connection */ @@ -499,7 +499,7 @@ void ax25_destroy_socket(ax25_cb *ax25) /* Not static as it's used by the timer kfree_skb(skb, FREE_READ); } } - + if (ax25->sk != NULL) { if (ax25->sk->wmem_alloc || ax25->sk->rmem_alloc) { /* Defer: outstanding buffers */ init_timer(&ax25->timer); @@ -529,7 +529,7 @@ int ax25_uid_policy = 0; ax25_address *ax25_findbyuid(uid_t uid) { ax25_uid_assoc *a; - + for (a = ax25_uid_list; a != NULL; a = a->next) { if (a->uid == uid) return &a->call; @@ -541,7 +541,7 @@ ax25_address *ax25_findbyuid(uid_t uid) static int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) { ax25_uid_assoc *a; - + switch (cmd) { case SIOCAX25GETUID: for (a = ax25_uid_list; a != NULL; a = a->next) { @@ -568,7 +568,7 @@ static int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) case SIOCAX25DELUID: { ax25_uid_assoc **l; - + if (!suser()) return -EPERM; l = &ax25_uid_list; @@ -579,12 +579,12 @@ static int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) kfree_s(a, sizeof(*a)); return 0; } - + l = &((*l)->next); } return -ENOENT; } - + default: return -EINVAL; } @@ -604,12 +604,12 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) ax25_cb *ax25; unsigned long flags; int err; - + if ((err = verify_area(VERIFY_READ, arg, sizeof(ax25_ctl))) != 0) return err; copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl)); - + if ((dev = ax25rtr_get_dev(&ax25_ctl.port_addr)) == NULL) return -ENODEV; @@ -620,7 +620,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) case AX25_KILL: ax25_clear_queues(ax25); ax25_send_control(ax25, DISC, POLLON, C_COMMAND); - + ax25->state = AX25_STATE_0; if (ax25->sk != NULL) { ax25->sk->state = TCP_CLOSE; @@ -637,17 +637,17 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) case AX25_WINDOW: if (ax25->modulus == MODULUS) { - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 7) return -EINVAL; } else { - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 63) return -EINVAL; } ax25->window = ax25_ctl.arg; break; case AX25_T1: - if (ax25_ctl.arg < 1) + if (ax25_ctl.arg < 1) return -EINVAL; ax25->rtt = (ax25_ctl.arg * PR_SLOWHZ) / 2; ax25->t1 = ax25_ctl.arg * PR_SLOWHZ; @@ -658,7 +658,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) break; case AX25_T2: - if (ax25_ctl.arg < 1) + if (ax25_ctl.arg < 1) return -EINVAL; save_flags(flags); cli(); ax25->t2 = ax25_ctl.arg * PR_SLOWHZ; @@ -668,14 +668,14 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) break; case AX25_N2: - if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) + if (ax25_ctl.arg < 1 || ax25_ctl.arg > 31) return -EINVAL; ax25->n2count = 0; ax25->n2 = ax25_ctl.arg; break; case AX25_T3: - if (ax25_ctl.arg < 0) + if (ax25_ctl.arg < 0) return -EINVAL; save_flags(flags); cli(); ax25->t3 = ax25_ctl.arg * PR_SLOWHZ; @@ -685,7 +685,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) break; case AX25_IDLE: - if (ax25_ctl.arg < 0) + if (ax25_ctl.arg < 0) return -EINVAL; save_flags(flags); cli(); ax25->idle = ax25_ctl.arg * PR_SLOWHZ * 60; @@ -695,12 +695,12 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) break; case AX25_PACLEN: - if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) + if (ax25_ctl.arg < 16 || ax25_ctl.arg > 65535) return -EINVAL; #if 0 if (ax25_ctl.arg > 256) /* we probably want this */ printk(KERN_WARNING "ax25_ctl_ioctl: Warning --- huge paclen %d\n", (int)ax25_ctl.arg); -#endif +#endif ax25->paclen = ax25_ctl.arg; break; @@ -713,7 +713,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void *arg) default: return -EINVAL; } - + return 0; } @@ -792,14 +792,14 @@ int ax25_dev_is_dama_slave(struct device *dev) { ax25_cb *ax25; int count = 0; - + for (ax25 = ax25_list; ax25 != NULL; ax25 = ax25->next) { if (ax25->device == dev && ax25->dama_slave) { count++; break; } } - + return count; } @@ -885,7 +885,7 @@ int ax25_send_frame(struct sk_buff *skb, ax25_address *src, ax25_address *dest, /* idle timeouts only for mode vc connections */ ax25->idletimer = ax25->idle; - + ax25_insert_socket(ax25); ax25->state = AX25_STATE_1; @@ -893,8 +893,8 @@ int ax25_send_frame(struct sk_buff *skb, ax25_address *src, ax25_address *dest, ax25_set_timer(ax25); ax25_output(ax25, skb); - - return 1; /* We had to create it */ + + return 1; /* We had to create it */ } /* @@ -922,7 +922,7 @@ int ax25_link_up(ax25_address *src, ax25_address *dest, struct device *dev) struct device *ax25rtr_get_dev(ax25_address *addr) { struct device *dev; - + for (dev = dev_base; dev != NULL; dev = dev->next) if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25 && ax25cmp(addr, (ax25_address*) dev->dev_addr) == 0) @@ -947,7 +947,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, int err, opt; sk = (struct sock *)sock->sk; - + if (level != SOL_AX25) return -EOPNOTSUPP; @@ -994,7 +994,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, return -EINVAL; sk->protinfo.ax25->t3 = opt * PR_SLOWHZ; return 0; - + case AX25_IDLE: if (opt < 0) return -EINVAL; @@ -1012,7 +1012,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, case AX25_HDRINCL: sk->protinfo.ax25->hdrincl = opt ? 1 : 0; return 0; - + case AX25_PACLEN: if (opt < 16 || opt > 65535) return -EINVAL; @@ -1029,10 +1029,10 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, { struct sock *sk; int val = 0; - int err; + int err; sk = (struct sock *)sock->sk; - + if (level != SOL_AX25) return -EOPNOTSUPP; @@ -1056,7 +1056,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, case AX25_T3: val = sk->protinfo.ax25->t3 / PR_SLOWHZ; break; - + case AX25_IDLE: val = sk->protinfo.ax25->idle / (PR_SLOWHZ * 60); break; @@ -1072,7 +1072,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, case AX25_HDRINCL: val = sk->protinfo.ax25->hdrincl; break; - + case AX25_PACLEN: val = sk->protinfo.ax25->paclen; break; @@ -1195,7 +1195,7 @@ static int ax25_create(struct socket *sock, int protocol) ax25->sk = sk; sk->protinfo.ax25 = ax25; - + return 0; } @@ -1263,14 +1263,14 @@ static struct sock *ax25_make_new(struct sock *osk, struct device *dev) ax25->maxqueue = osk->protinfo.ax25->maxqueue; ax25->source_addr = osk->protinfo.ax25->source_addr; - + if (osk->protinfo.ax25->digipeat != NULL) { if ((ax25->digipeat = (ax25_digi *)kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { sk_free(sk); ax25_free_cb(ax25); return NULL; } - + *ax25->digipeat = *osk->protinfo.ax25->digipeat; } @@ -1324,7 +1324,7 @@ static int ax25_release(struct socket *sock, struct socket *peer) sk->state_change(sk); sk->dead = 1; ax25_destroy_socket(sk->protinfo.ax25); - break; + break; case AX25_STATE_3: case AX25_STATE_4: @@ -1374,19 +1374,19 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; struct device *dev; ax25_address *call; - + sk = (struct sock *)sock->sk; - + if (sk->zapped == 0) return -EINVAL; - + if (addr_len != sizeof(struct sockaddr_ax25) && addr_len != sizeof(struct full_sockaddr_ax25)) return -EINVAL; call = ax25_findbyuid(current->euid); if (call == NULL && ax25_uid_policy && !suser()) return -EACCES; - + if (call == NULL) sk->protinfo.ax25->source_addr = addr->fsa_ax25.sax25_call; else @@ -1436,21 +1436,21 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, struct sock *sk = (struct sock *)sock->sk; struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr; int err; - + if (sk->state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) { sock->state = SS_CONNECTED; return 0; /* Connect completed during a ERESTARTSYS event */ } - + if (sk->state == TCP_CLOSE && sock->state == SS_CONNECTING) { sock->state = SS_UNCONNECTED; return -ECONNREFUSED; } - + if (sk->state == TCP_ESTABLISHED && sk->type == SOCK_SEQPACKET) return -EISCONN; /* No reconnect on a seqpacket socket */ - - sk->state = TCP_CLOSE; + + sk->state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if (addr_len != sizeof(struct sockaddr_ax25) && addr_len != sizeof(struct full_sockaddr_ax25)) @@ -1497,35 +1497,35 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, if (sk->protinfo.ax25->device == NULL) return -EHOSTUNREACH; } - + if (sk->type == SOCK_SEQPACKET && ax25_find_cb(&sk->protinfo.ax25->source_addr, &addr->sax25_call, sk->protinfo.ax25->device) != NULL) return -EADDRINUSE; /* Already such a connection */ sk->protinfo.ax25->dest_addr = addr->sax25_call; - + /* First the easy one */ if (sk->type != SOCK_SEQPACKET) { sock->state = SS_CONNECTED; sk->state = TCP_ESTABLISHED; return 0; } - - /* Move to connecting socket, ax.25 lapb WAIT_UA.. */ + + /* Move to connecting socket, ax.25 lapb WAIT_UA.. */ sock->state = SS_CONNECTING; sk->state = TCP_SYN_SENT; - + if (ax25_dev_is_dama_slave(sk->protinfo.ax25->device)) dama_establish_data_link(sk->protinfo.ax25); else ax25_establish_data_link(sk->protinfo.ax25); - + sk->protinfo.ax25->state = AX25_STATE_1; ax25_set_timer(sk->protinfo.ax25); /* Start going SABM SABM until a UA or a give up and DM */ - + /* Now the loop */ if (sk->state != TCP_ESTABLISHED && (flags & O_NONBLOCK)) return -EINPROGRESS; - + cli(); /* To avoid races on the sleep */ /* A DM or timeout will go to closed, a UA will go to ABM */ @@ -1543,14 +1543,14 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, sock->state = SS_UNCONNECTED; return sock_error(sk); /* Always set at this point */ } - + sock->state = SS_CONNECTED; sti(); - + return 0; } - + static int ax25_socketpair(struct socket *sock1, struct socket *sock2) { return -EOPNOTSUPP; @@ -1566,15 +1566,15 @@ static int ax25_accept(struct socket *sock, struct socket *newsock, int flags) sk_free(newsock->sk); newsock->sk = NULL; - + sk = (struct sock *)sock->sk; if (sk->type != SOCK_SEQPACKET) return -EOPNOTSUPP; - + if (sk->state != TCP_LISTEN) return -EINVAL; - + /* * The write queue this time is holding sockets ready to use * hooked into the SABM we saved @@ -1613,9 +1613,9 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, struct full_sockaddr_ax25 *sax = (struct full_sockaddr_ax25 *)uaddr; struct sock *sk; unsigned char ndigi, i; - + sk = (struct sock *)sock->sk; - + if (peer != 0) { if (sk->state != TCP_ESTABLISHED) return -ENOTCONN; @@ -1642,10 +1642,10 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, else sax->fsa_digipeater[0] = null_ax25_address; } - + return 0; } - + static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_addr, struct packet_type *ptype) { struct sock *make; @@ -1661,20 +1661,20 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a /* * Process the AX.25/LAPB frame. */ - + skb->h.raw = skb->data; - + #ifdef CONFIG_FIREWALL if (call_in_firewall(PF_AX25, skb->dev, skb->h.raw, NULL) != FW_ACCEPT) { kfree_skb(skb, FREE_READ); return 0; } -#endif +#endif /* * Parse the address header. */ - + if (ax25_parse_addr(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL) { kfree_skb(skb, FREE_READ); return 0; @@ -1686,7 +1686,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a if (dp.lastrepeat + 1 < dp.ndigi) { /* Not yet digipeated completely */ if (ax25cmp(&dp.calls[dp.lastrepeat + 1], dev_addr) == 0) { struct device *dev_out = dev; - + skb=skb_unshare(skb, GFP_ATOMIC, FREE_READ); if(skb==NULL) return 0; @@ -1747,7 +1747,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a /* Also match on any registered callsign from L3/4 */ if (!mine && ax25_listen_mine(&dest, dev)) mine = 1; - + if ((*skb->data & ~0x10) == LAPB_UI) { /* UI frame - bypass LAPB processing */ skb->h.raw = skb->data + 2; /* skip control and pid */ @@ -1761,7 +1761,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a /* Now we are pointing at the pid byte */ switch (skb->data[1]) { -#ifdef CONFIG_INET +#ifdef CONFIG_INET case AX25_P_IP: skb_pull(skb,2); /* drop PID/CTRL */ ip_rcv(skb, dev, ptype); /* Note ptype here is the wrong one, fix me later */ @@ -1771,7 +1771,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a skb_pull(skb,2); arp_rcv(skb, dev, ptype); /* Note ptype here is wrong... */ break; -#endif +#endif case AX25_P_TEXT: /* Now find a suitable dgram socket */ if ((sk = ax25_find_socket(&dest, &src, SOCK_DGRAM)) != NULL) { @@ -1790,7 +1790,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a } else { kfree_skb(skb, FREE_READ); } - break; + break; default: kfree_skb(skb, FREE_READ); /* Will scan SOCK_AX25 RAW sockets */ @@ -1809,14 +1809,14 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a kfree_skb(skb, FREE_READ); return 0; } - + /* LAPB */ - + /* AX.25 state 1-4 */ - + if ((ax25 = ax25_find_cb(&dest, &src, dev)) != NULL) { /* - * Process the frame. If it is queued up internally it returns one otherwise we + * Process the frame. If it is queued up internally it returns one otherwise we * free it immediately. This routine itself wakes the user context layers so we * do no further work */ @@ -1829,7 +1829,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a /* AX.25 state 0 (disconnected) */ /* a) received not a SABM(E) */ - + if ((*skb->data & ~PF) != SABM && (*skb->data & ~PF) != SABME) { /* * Never reply to a DM. Also ignore any connects for @@ -1843,7 +1843,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a } /* b) received SABM(E) */ - + if ((sk = ax25_find_listener(&dest, dev, SOCK_SEQPACKET)) != NULL) { if (sk->ack_backlog == sk->max_ack_backlog || (make = ax25_make_new(sk, dev)) == NULL) { if (mine) @@ -1852,7 +1852,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a kfree_skb(skb, FREE_READ); return 0; } - + ax25 = make->protinfo.ax25; skb_queue_head(&sk->receive_queue, skb); @@ -1867,7 +1867,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a kfree_skb(skb, FREE_READ); return 0; } - + if ((ax25 = ax25_create_cb()) == NULL) { ax25_return_dm(dev, &src, &dest, &dp); kfree_skb(skb, FREE_READ); @@ -1909,7 +1909,7 @@ static int ax25_rcv(struct sk_buff *skb, struct device *dev, ax25_address *dev_a } ax25->device = dev; - + ax25_send_control(ax25, UA, POLLON, C_RESPONSE); if (dama) ax25_dama_on(ax25); /* bke 951121 */ @@ -1950,7 +1950,7 @@ static int kiss_rcv(struct sk_buff *skb, struct device *dev, struct packet_type } -static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, +static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct scm_cookie *scm) { struct sock *sk = (struct sock *)sock->sk; @@ -2022,7 +2022,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, sax.sax25_call = sk->protinfo.ax25->dest_addr; dp = sk->protinfo.ax25->digipeat; } - + if (sk->debug) printk("AX.25: sendto: Addresses built.\n"); @@ -2080,7 +2080,7 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, printk("Built header (%d bytes)\n",lv); skb->h.raw = asmptr; - + if (sk->debug) printk("base=%p pos=%p\n", skb->data, asmptr); @@ -2094,10 +2094,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, int len, return len; } - + } -static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags, +static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int flags, struct scm_cookie *scm) { struct sock *sk = (struct sock *)sock->sk; @@ -2106,7 +2106,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int f struct sk_buff *skb; int er; int dama; - + /* * This works for seqpacket too. The receiver has ordered the * queue for us! We do one quick check first though @@ -2165,7 +2165,7 @@ static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int f skb_free_datagram(sk, skb); return copied; -} +} static int ax25_shutdown(struct socket *sk, int how) { @@ -2238,7 +2238,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) if (!suser()) return -EPERM; return ax25_rt_ioctl(cmd, (void *)arg); - + case SIOCAX25CTLCON: if (!suser()) return -EPERM; @@ -2302,7 +2302,7 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length, i ax25->rtt / PR_SLOWHZ, ax25->window, ax25->paclen); - + len += sprintf(buffer + len, " %s", ax25->dama_slave ? " slave" : " no"); if (ax25->sk != NULL) { @@ -2312,14 +2312,14 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length, i } else { len += sprintf(buffer + len, "\n"); } - + pos = begin + len; if (pos < offset) { len = 0; begin = pos; } - + if (pos > offset + length) break; } @@ -2332,9 +2332,9 @@ static int ax25_get_info(char *buffer, char **start, off_t offset, int length, i if (len > length) len = length; return(len); -} +} -static struct net_proto_family ax25_family_ops = +static struct net_proto_family ax25_family_ops = { AF_AX25, ax25_create @@ -2342,7 +2342,7 @@ static struct net_proto_family ax25_family_ops = static struct proto_ops ax25_proto_ops = { AF_AX25, - + ax25_dup, ax25_release, ax25_bind, @@ -2364,7 +2364,7 @@ static struct proto_ops ax25_proto_ops = { /* * Called by socket.c on kernel start up */ -static struct packet_type ax25_packet_type = +static struct packet_type ax25_packet_type = { 0, /* MUTTER ntohs(ETH_P_AX25),*/ 0, /* copy */ @@ -2378,30 +2378,25 @@ static struct notifier_block ax25_dev_notifier = { 0 }; -static struct symbol_table ax25_syms = { -#include - X(ax25_encapsulate), - X(ax25_rebuild_header), +EXPORT_SYMBOL(ax25_encapsulate); +EXPORT_SYMBOL(ax25_rebuild_header); #if defined(CONFIG_NETROM_MODULE) || defined(CONFIG_ROSE_MODULE) - X(ax25_findbyuid), - X(ax25_link_up), - X(ax25_linkfail_register), - X(ax25_linkfail_release), - X(ax25_listen_register), - X(ax25_listen_release), - X(ax25_protocol_register), - X(ax25_protocol_release), - X(ax25_send_frame), - X(ax25_uid_policy), - X(ax25cmp), - X(ax2asc), - X(asc2ax), - X(null_ax25_address), -#endif -#include -}; +EXPORT_SYMBOL(ax25_findbyuid); +EXPORT_SYMBOL(ax25_link_up); +EXPORT_SYMBOL(ax25_linkfail_register); +EXPORT_SYMBOL(ax25_linkfail_release); +EXPORT_SYMBOL(ax25_listen_register); +EXPORT_SYMBOL(ax25_listen_release); +EXPORT_SYMBOL(ax25_protocol_register); +EXPORT_SYMBOL(ax25_protocol_release); +EXPORT_SYMBOL(ax25_send_frame); +EXPORT_SYMBOL(ax25_uid_policy); +EXPORT_SYMBOL(ax25cmp); +EXPORT_SYMBOL(ax2asc); +EXPORT_SYMBOL(asc2ax); +EXPORT_SYMBOL(null_ax25_address); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS static struct proc_dir_entry proc_ax25_route = { PROC_NET_AX25_ROUTE, 10, "ax25_route", S_IFREG | S_IRUGO, 1, 0, 0, @@ -2426,16 +2421,15 @@ void ax25_proto_init(struct net_proto *pro) { sock_register(&ax25_family_ops); ax25_packet_type.type = htons(ETH_P_AX25); - dev_add_pack(&ax25_packet_type); + dev_add_pack(&ax25_packet_type); register_netdevice_notifier(&ax25_dev_notifier); - register_symtab(&ax25_syms); ax25_register_sysctl(); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS proc_net_register(&proc_ax25_route); proc_net_register(&proc_ax25); proc_net_register(&proc_ax25_calls); -#endif +#endif printk(KERN_INFO "G4KLX/GW4PTS AX.25 for Linux. Version 0.34 for Linux NET3.037 (Linux 2.1)\n"); } @@ -2446,13 +2440,13 @@ void ax25_proto_init(struct net_proto *pro) void ax25_queue_xmit(struct sk_buff *skb) { unsigned char *ptr; - + #ifdef CONFIG_FIREWALL if (call_out_firewall(PF_AX25, skb->dev, skb->data, NULL) != FW_ACCEPT) { dev_kfree_skb(skb, FREE_WRITE); return; } -#endif +#endif skb->protocol = htons(ETH_P_AX25); @@ -2471,7 +2465,7 @@ void ax25_queue_xmit(struct sk_buff *skb) */ #ifdef CONFIG_INET - + int ax25_encapsulate(struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, void *saddr, unsigned len) { @@ -2479,7 +2473,7 @@ int ax25_encapsulate(struct sk_buff *skb, struct device *dev, unsigned short typ unsigned char *buff = skb_push(skb, AX25_HEADER_LEN); *buff++ = 0; /* KISS DATA */ - + if (daddr != NULL) memcpy(buff, daddr, dev->addr_len); /* Address specified */ @@ -2514,7 +2508,7 @@ int ax25_encapsulate(struct sk_buff *skb, struct device *dev, unsigned short typ *buff++ = 0; break; } - + if (daddr != NULL) return AX25_HEADER_LEN; @@ -2569,7 +2563,7 @@ int ax25_rebuild_header(struct sk_buff *skb) bp[14] &= ~LAPB_C; bp[14] |= LAPB_E; bp[14] |= SSSID_SPARE; - + /* * dl1bke 960317: we use ax25_queue_xmit here to allow mode datagram * over ethernet. I don't know if this is valid, though. @@ -2582,7 +2576,7 @@ int ax25_rebuild_header(struct sk_buff *skb) ax25_queue_xmit(skb); return 1; -} +} #endif @@ -2609,7 +2603,7 @@ void cleanup_module(void) unregister_netdevice_notifier(&ax25_dev_notifier); ax25_packet_type.type = htons(ETH_P_AX25); - dev_remove_pack(&ax25_packet_type); + dev_remove_pack(&ax25_packet_type); sock_unregister(ax25_proto_ops.family); } diff --git a/net/core/firewall.c b/net/core/firewall.c index a57f67eaf23c..791d64d0e9bf 100644 --- a/net/core/firewall.c +++ b/net/core/firewall.c @@ -6,7 +6,7 @@ * much hacked by: Alan Cox */ -#include +#include #include #include @@ -17,24 +17,24 @@ static struct firewall_ops *firewall_chain[NPROTO]; /* * Register a firewall */ - + int register_firewall(int pf, struct firewall_ops *fw) { struct firewall_ops **p; - + if(pf<0||pf>=NPROTO) return -EINVAL; - + /* * Don't allow two people to adjust at once. */ - + while(firewall_lock) schedule(); firewall_lock=1; - + p=&firewall_chain[pf]; - + while(*p) { if(fw->fw_priority > (*p)->fw_priority) @@ -42,7 +42,7 @@ int register_firewall(int pf, struct firewall_ops *fw) p=&((*p)->next); } - + /* * We need to use a memory barrier to make sure that this * works correctly even in SMP with weakly ordered writes. @@ -70,20 +70,20 @@ int register_firewall(int pf, struct firewall_ops *fw) int unregister_firewall(int pf, struct firewall_ops *fw) { struct firewall_ops **nl; - + if(pf<0||pf>=NPROTO) return -EINVAL; - + /* * Don't allow two people to adjust at once. */ - + while(firewall_lock) schedule(); firewall_lock=1; nl=&firewall_chain[pf]; - + while(*nl!=NULL) { if(*nl==fw) @@ -92,7 +92,7 @@ int unregister_firewall(int pf, struct firewall_ops *fw) *nl = f; firewall_lock=0; return 0; - } + } nl=&((*nl)->next); } firewall_lock=0; @@ -102,7 +102,7 @@ int unregister_firewall(int pf, struct firewall_ops *fw) int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg) { struct firewall_ops *fw=firewall_chain[pf]; - + while(fw!=NULL) { int rc=fw->fw_forward(fw,pf,dev,phdr,arg); @@ -116,11 +116,11 @@ int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg) /* * Actual invocation of the chains */ - + int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg) { struct firewall_ops *fw=firewall_chain[pf]; - + while(fw!=NULL) { int rc=fw->fw_input(fw,pf,dev,phdr,arg); @@ -134,7 +134,7 @@ int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg) int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg) { struct firewall_ops *fw=firewall_chain[pf]; - + while(fw!=NULL) { int rc=fw->fw_output(fw,pf,dev,phdr,arg); @@ -146,20 +146,15 @@ int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg) return firewall_policy[pf]; } -static struct symbol_table firewall_syms = { -#include - X(register_firewall), - X(unregister_firewall), - X(call_in_firewall), - X(call_out_firewall), - X(call_fw_firewall), -#include -}; +EXPORT_SYMBOL(register_firewall); +EXPORT_SYMBOL(unregister_firewall); +EXPORT_SYMBOL(call_in_firewall); +EXPORT_SYMBOL(call_out_firewall); +EXPORT_SYMBOL(call_fw_firewall); void fwchain_init(void) { int i; for(i=0;i @@ -66,7 +66,7 @@ static __u16 masq_port = PORT_MASQ_BEGIN; * * Greater values could lower MASQ_EXPIRATION setting as a way to * manage 'masq_entries resource'. - * + * */ int ip_masq_free_ports[2] = { @@ -74,15 +74,11 @@ int ip_masq_free_ports[2] = { PORT_MASQ_END - PORT_MASQ_BEGIN /* TCP */ }; -static struct symbol_table ip_masq_syms = { -#include - X(ip_masq_new), - X(ip_masq_set_expire), - X(ip_masq_free_ports), - X(ip_masq_expire), - X(ip_masq_out_get_2), -#include -}; +EXPORT_SYMBOL(ip_masq_new); +EXPORT_SYMBOL(ip_masq_set_expire); +EXPORT_SYMBOL(ip_masq_free_ports); +EXPORT_SYMBOL(ip_masq_expire); +EXPORT_SYMBOL(ip_masq_out_get_2); /* * 2 ip_masq hash tables: for input and output pkts lookups. @@ -323,7 +319,7 @@ static void masq_expire(unsigned long data) masq_proto_name(ms->protocol), ntohl(ms->saddr),ntohs(ms->sport)); #endif - + save_flags(flags); cli(); @@ -378,47 +374,47 @@ struct ip_masq * ip_masq_new(struct device *dev, int proto, __u32 saddr, __u16 s if (proto == IPPROTO_UDP) ms->flags |= IP_MASQ_F_NO_DADDR; - + /* get masq address from rif */ ms->maddr = dev->pa_addr; for (ports_tried = 0; ports_tried < *free_ports_p; ports_tried++){ save_flags(flags); cli(); - + /* * Try the next available port number */ - + ms->mport = htons(masq_port++); if (masq_port==PORT_MASQ_END) masq_port = PORT_MASQ_BEGIN; - + restore_flags(flags); - + /* * lookup to find out if this port is used. */ - + mst = ip_masq_getbym(proto, ms->maddr, ms->mport); if (mst == NULL) { save_flags(flags); cli(); - + if (*free_ports_p == 0) { restore_flags(flags); break; } (*free_ports_p)--; ip_masq_hash(ms); - + restore_flags(flags); - + ip_masq_bind_app(ms); n_fails = 0; return ms; } } - + if (++n_fails < 5) printk("ip_masq_new(proto=%s): could not get free masq entry (free=%d).\n", masq_proto_name(ms->protocol), *free_ports_p); @@ -451,7 +447,7 @@ static void recalc_check(struct udphdr *uh, __u32 saddr, if(uh->check==0) uh->check=0xFFFF; } - + int ip_fw_masquerade(struct sk_buff **skb_ptr, struct device *dev) { struct sk_buff *skb=*skb_ptr; @@ -489,7 +485,7 @@ int ip_fw_masquerade(struct sk_buff **skb_ptr, struct device *dev) /* * Nope, not found, create a new entry for it */ - + if (ms==NULL) { ms = ip_masq_new(dev, iph->protocol, @@ -503,7 +499,7 @@ int ip_fw_masquerade(struct sk_buff **skb_ptr, struct device *dev) /* * Change the fragments origin */ - + size = skb->len - ((unsigned char *)portptr - skb->nh.raw); /* * Set iph addr and port from ip_masq obj. @@ -529,7 +525,7 @@ int ip_fw_masquerade(struct sk_buff **skb_ptr, struct device *dev) /* * Adjust packet accordingly to protocol */ - + if (iph->protocol==IPPROTO_UDP) { timeout = ip_masq_expire->udp_timeout; @@ -566,7 +562,10 @@ int ip_fw_masquerade(struct sk_buff **skb_ptr, struct device *dev) else timeout = ip_masq_expire->tcp_timeout; skb->csum = csum_partial((void *)(th + 1), size - sizeof(*th), 0); - tcp_v4_check(th, size, iph->saddr, iph->daddr, skb->csum); + th->check = 0; + th->check = tcp_v4_check(th, size, iph->saddr, iph->daddr, + csum_partial((char *)th, sizeof(*th), + skb->csum)); } ip_masq_set_expire(ms, timeout); ip_send_check(iph); @@ -602,7 +601,7 @@ int ip_fw_masq_icmp(struct sk_buff **skb_p, struct device *dev) ntohl(iph->saddr), ntohl(iph->daddr)); #endif - /* + /* * Work through seeing if this is for us. * These checks are supposed to be in an order that * means easy things are checked first to speed up @@ -622,8 +621,8 @@ int ip_fw_masq_icmp(struct sk_buff **skb_p, struct device *dev) if ((ciph->protocol != IPPROTO_UDP) && (ciph->protocol != IPPROTO_TCP)) return 0; - /* - * Find the ports involved - this packet was + /* + * Find the ports involved - this packet was * incoming so the ports are right way round * (but reversed relative to outer IP header!) */ @@ -633,10 +632,10 @@ int ip_fw_masq_icmp(struct sk_buff **skb_p, struct device *dev) return 0; /* Ensure the checksum is correct */ - if (ip_compute_csum((unsigned char *) icmph, len)) + if (ip_compute_csum((unsigned char *) icmph, len)) { /* Failed checksum! */ - printk(KERN_INFO "MASQ: forward ICMP: failed checksum from %s!\n", + printk(KERN_INFO "MASQ: forward ICMP: failed checksum from %s!\n", in_ntoa(iph->saddr)); return(-1); } @@ -657,11 +656,11 @@ int ip_fw_masq_icmp(struct sk_buff **skb_p, struct device *dev) /* First change the source IP address, and recalc checksum */ iph->saddr = ms->maddr; ip_send_check(iph); - + /* Now change the *dest* address in the contained IP */ ciph->daddr = ms->maddr; ip_send_check(ciph); - + /* the TCP/UDP dest port - cannot redo check */ pptr[1] = ms->mport; @@ -713,8 +712,8 @@ int ip_fw_demasq_icmp(struct sk_buff **skb_p, struct device *dev) if ((ciph->protocol != IPPROTO_UDP) && (ciph->protocol != IPPROTO_TCP)) return 0; - /* - * Find the ports involved - remember this packet was + /* + * Find the ports involved - remember this packet was * *outgoing* so the ports are reversed (and addresses) */ pptr = (__u16 *)&(((char *)ciph)[ciph->ihl*4]); @@ -723,10 +722,10 @@ int ip_fw_demasq_icmp(struct sk_buff **skb_p, struct device *dev) return 0; /* Ensure the checksum is correct */ - if (ip_compute_csum((unsigned char *) icmph, len)) + if (ip_compute_csum((unsigned char *) icmph, len)) { /* Failed checksum! */ - printk(KERN_INFO "MASQ: reverse ICMP: failed checksum from %s!\n", + printk(KERN_INFO "MASQ: reverse ICMP: failed checksum from %s!\n", in_ntoa(iph->saddr)); return(-1); } @@ -747,11 +746,11 @@ int ip_fw_demasq_icmp(struct sk_buff **skb_p, struct device *dev) /* First change the dest IP address, and recalc checksum */ iph->daddr = ms->saddr; ip_send_check(iph); - + /* Now change the *source* address in the contained IP */ ciph->saddr = ms->saddr; ip_send_check(ciph); - + /* the TCP/UDP source port - cannot redo check */ pptr[0] = ms->sport; @@ -803,7 +802,7 @@ int ip_fw_demasquerade(struct sk_buff **skb_p, struct device *dev) /* No UDP checksum */ break; - switch (skb->ip_summed) + switch (skb->ip_summed) { case CHECKSUM_NONE: skb->csum = csum_partial((char *)portptr, len, 0); @@ -811,7 +810,7 @@ int ip_fw_demasquerade(struct sk_buff **skb_p, struct device *dev) if (csum_tcpudp_magic(iph->saddr, iph->daddr, len, iph->protocol, skb->csum)) { - printk(KERN_INFO "MASQ: failed TCP/UDP checksum from %s!\n", + printk(KERN_INFO "MASQ: failed TCP/UDP checksum from %s!\n", in_ntoa(iph->saddr)); return -1; } @@ -898,10 +897,12 @@ int ip_fw_demasquerade(struct sk_buff **skb_p, struct device *dev) len - sizeof(struct tcphdr), 0); th = (struct tcphdr *) portptr; th->check = 0; + th->check = tcp_v4_check(th, len, iph->saddr, + iph->daddr, + csum_partial((char *)th, + sizeof(*th), + skb->csum)); - tcp_v4_check(th, len, iph->saddr, iph->daddr, - skb->csum); - /* Check if TCP FIN or RST */ if (th->fin) { @@ -911,7 +912,7 @@ int ip_fw_demasquerade(struct sk_buff **skb_p, struct device *dev) { ms->flags |= IP_MASQ_F_SAW_RST; } - + /* Now set the timeouts */ if (ms->flags & IP_MASQ_F_SAW_RST) { @@ -948,18 +949,18 @@ static int ip_msqhst_procinfo(char *buffer, char **start, off_t offset, char temp[129]; int idx = 0; int len=0; - - if (offset < 128) + + if (offset < 128) { sprintf(temp, "Prc FromIP FPrt ToIP TPrt Masq Init-seq Delta PDelta Expires (free=%d,%d)", - ip_masq_free_ports[0], ip_masq_free_ports[1]); + ip_masq_free_ports[0], ip_masq_free_ports[1]); len = sprintf(buffer, "%-127s\n", temp); } pos = 128; save_flags(flags); cli(); - + for(idx = 0; idx < IP_MASQ_TAB_SIZE; idx++) for(ms = ip_masq_m_tab[idx]; ms ; ms = ms->m_link) { @@ -997,24 +998,23 @@ done: return len; } -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS static struct proc_dir_entry proc_net_ipmsqhst = { PROC_NET_IPMSQHST, 13, "ip_masquerade", S_IFREG | S_IRUGO, 1, 0, 0, 0, &proc_net_inode_operations, ip_msqhst_procinfo }; -#endif +#endif /* * Initialize ip masquerading */ int ip_masq_init(void) { - register_symtab (&ip_masq_syms); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS proc_net_register(&proc_net_ipmsqhst); -#endif +#endif ip_masq_app_init(); return 0; diff --git a/net/ipv4/ip_masq_app.c b/net/ipv4/ip_masq_app.c index 5485cdd07a7a..e628c619c75d 100644 --- a/net/ipv4/ip_masq_app.c +++ b/net/ipv4/ip_masq_app.c @@ -19,7 +19,7 @@ * * FIXME: * - ip_masq_skb_replace(): use same skb if space available. - * + * */ #include @@ -53,13 +53,9 @@ static __inline__ const char * masq_proto_name(unsigned proto) #define IP_MASQ_APP_PROTO(type) ( (type>>16) & 0x00ff ) -static struct symbol_table ip_masq_app_syms = { -#include - X(register_ip_masq_app), - X(unregister_ip_masq_app), - X(ip_masq_skb_replace), -#include -}; +EXPORT_SYMBOL(register_ip_masq_app); +EXPORT_SYMBOL(unregister_ip_masq_app); +EXPORT_SYMBOL(ip_masq_skb_replace); /* * will hold masq app. hashed list heads @@ -83,13 +79,13 @@ int register_ip_masq_app(struct ip_masq_app *mapp, unsigned short proto, __u16 p mapp->type = IP_MASQ_APP_TYPE(proto, port); mapp->n_attach = 0; hash = IP_MASQ_APP_HASH(proto, port); - + save_flags(flags); cli(); mapp->next = ip_masq_app_base[hash]; - ip_masq_app_base[hash] = mapp; + ip_masq_app_base[hash] = mapp; restore_flags(flags); - + return 0; } @@ -124,7 +120,7 @@ int unregister_ip_masq_app(struct ip_masq_app *mapp) restore_flags(flags); return 0; } - + restore_flags(flags); printk("unregister_ip_masq_app(proto=%s,port=%u): not hashed!\n", masq_proto_name(IP_MASQ_APP_PROTO(mapp->type)), IP_MASQ_APP_PORT(mapp->type)); @@ -191,12 +187,12 @@ struct ip_masq_app * ip_masq_bind_app(struct ip_masq *ms) /* * don't allow binding if already bound */ - + if (ms->app != NULL) { printk("ip_masq_bind_app() called for already bound object.\n"); return ms->app; } - + ms->app = mapp; if (mapp->masq_init_1) mapp->masq_init_1(mapp, ms); ip_masq_app_bind_chg(mapp, +1); @@ -227,9 +223,9 @@ int ip_masq_unbind_app(struct ip_masq *ms) static __inline__ void masq_fix_seq(const struct ip_masq_seq *ms_seq, struct tcphdr *th) { __u32 seq; - + seq = ntohl(th->seq); - + /* * Adjust seq with delta-offset for all packets after * the most recent resized pkt seq and with previous_delta offset @@ -249,7 +245,7 @@ static __inline__ void masq_fix_seq(const struct ip_masq_seq *ms_seq, struct tcp #endif } } - + } @@ -260,15 +256,15 @@ static __inline__ void masq_fix_seq(const struct ip_masq_seq *ms_seq, struct tcp static __inline__ void masq_fix_ack_seq(const struct ip_masq_seq *ms_seq, struct tcphdr *th) { __u32 ack_seq; - + ack_seq=ntohl(th->ack_seq); - + /* * Adjust ack_seq with delta-offset for * the packets AFTER most recent resized pkt has caused a shift * for packets before most recent resized pkt, use previous_delta */ - + if (ms_seq->delta || ms_seq->previous_delta) { if(after(ack_seq,ms_seq->init_seq)) { th->ack_seq = htonl(ack_seq-ms_seq->delta); @@ -282,7 +278,7 @@ static __inline__ void masq_fix_ack_seq(const struct ip_masq_seq *ms_seq, struct #endif } } - + } /* @@ -293,7 +289,7 @@ static __inline__ void masq_fix_ack_seq(const struct ip_masq_seq *ms_seq, struct static __inline__ void masq_seq_update(struct ip_masq *ms, struct ip_masq_seq *ms_seq, unsigned mflag, __u32 seq, int diff) { /* if (diff == 0) return; */ - + if ( !(ms->flags & mflag) || after(seq, ms_seq->init_seq)) { ms_seq->previous_delta=ms_seq->delta; @@ -316,50 +312,50 @@ int ip_masq_app_pkt_out(struct ip_masq *ms, struct sk_buff **skb_p, struct devic struct tcphdr *th; int diff; __u32 seq; - + /* * check if application masquerading is bound to * this ip_masq. * assumes that once an ip_masq is bound, * it will not be unbound during its life. */ - + if ( (mapp = ms->app) == NULL) return 0; - + iph = (*skb_p)->nh.iph; th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); - + /* * Remember seq number in case this pkt gets resized */ - + seq = ntohl(th->seq); - + /* * Fix seq stuff if flagged as so. */ - + if (ms->protocol == IPPROTO_TCP) { if (ms->flags & IP_MASQ_F_OUT_SEQ) masq_fix_seq(&ms->out_seq, th); if (ms->flags & IP_MASQ_F_IN_SEQ) masq_fix_ack_seq(&ms->in_seq, th); } - + /* - * Call private output hook function + * Call private output hook function */ - + if ( mapp->pkt_out == NULL ) return 0; - + diff = mapp->pkt_out(mapp, ms, skb_p, dev); - + /* * Update ip_masq seq stuff if len has changed. */ - + if (diff != 0 && ms->protocol == IPPROTO_TCP) masq_seq_update(ms, &ms->out_seq, IP_MASQ_F_OUT_SEQ, seq, diff); @@ -379,50 +375,50 @@ int ip_masq_app_pkt_in(struct ip_masq *ms, struct sk_buff **skb_p, struct device struct tcphdr *th; int diff; __u32 seq; - + /* * check if application masquerading is bound to * this ip_masq. * assumes that once an ip_masq is bound, * it will not be unbound during its life. */ - + if ( (mapp = ms->app) == NULL) return 0; - + iph = (*skb_p)->nh.iph; th = (struct tcphdr *)&(((char *)iph)[iph->ihl*4]); - + /* * Remember seq number in case this pkt gets resized */ - + seq = ntohl(th->seq); - + /* * Fix seq stuff if flagged as so. */ - + if (ms->protocol == IPPROTO_TCP) { if (ms->flags & IP_MASQ_F_IN_SEQ) masq_fix_seq(&ms->in_seq, th); if (ms->flags & IP_MASQ_F_OUT_SEQ) masq_fix_ack_seq(&ms->out_seq, th); } - + /* - * Call private input hook function + * Call private input hook function */ - + if ( mapp->pkt_in == NULL ) return 0; - + diff = mapp->pkt_in(mapp, ms, skb_p, dev); /* * Update ip_masq seq stuff if len has changed. */ - + if (diff != 0 && ms->protocol == IPPROTO_TCP) masq_seq_update(ms, &ms->in_seq, IP_MASQ_F_IN_SEQ, seq, diff); @@ -446,7 +442,7 @@ int ip_masq_app_getinfo(char *buffer, char **start, off_t offset, int length, in for (idx=0 ; idx < IP_MASQ_APP_TAB_SIZE; idx++) for (mapp = ip_masq_app_base[idx]; mapp ; mapp = mapp->next) { - /* + /* * If you change the length of this sprintf, then all * the length calculations need fixing too! * Line length = 40 (3 + 2 + 7 + 1 + 7 + 1 + 2 + 17) @@ -468,19 +464,19 @@ done: *start = buffer + begin; len -= begin; if (len > length) - len = length; + len = length; return len; } -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS static struct proc_dir_entry proc_net_ip_masq_app = { PROC_NET_IP_MASQ_APP, 11, "ip_masq_app", S_IFREG | S_IRUGO, 1, 0, 0, 0, &proc_net_inode_operations, ip_masq_app_getinfo }; -#endif +#endif /* * Initialization routine @@ -488,11 +484,9 @@ static struct proc_dir_entry proc_net_ip_masq_app = { int ip_masq_app_init(void) { - - register_symtab (&ip_masq_app_syms); -#ifdef CONFIG_PROC_FS +#ifdef CONFIG_PROC_FS proc_net_register(&proc_net_ip_masq_app); -#endif +#endif return 0; } @@ -531,7 +525,7 @@ static struct sk_buff * skb_replace(struct sk_buff *skb, int pri, char *o_buf, i * * FIXME: move this to core/sbuff.c:skb_grow() */ - + n_skb = alloc_skb(MAX_HEADER + skb->len + diff, pri); if (n_skb == NULL) { printk("skb_replace(): no room left (from %p)\n", @@ -561,17 +555,17 @@ static struct sk_buff * skb_replace(struct sk_buff *skb, int pri, char *o_buf, i /* * Copy pkt in new buffer */ - + memcpy(n_skb->data, skb->data, o_offset); memcpy(n_skb->data + o_offset, n_buf, n_len); memcpy(n_skb->data + o_offset + n_len, o_buf + o_len, skb->len - (o_offset + o_len) ); - + /* * Problem, how to replace the new skb with old one, * preferably inplace */ - + kfree_skb(skb, FREE_WRITE); } return n_skb; @@ -590,7 +584,7 @@ struct sk_buff * ip_masq_skb_replace(struct sk_buff *skb, int pri, char *o_buf, diff = n_len - o_len; n_skb = skb_replace(skb, pri, o_buf, o_len, n_buf, n_len); skb_len = skb->len; - + if (diff) { struct iphdr *iph; diff --git a/net/ipv4/ip_masq_ftp.c b/net/ipv4/ip_masq_ftp.c index 299e81179c8b..5a5fd341cf6e 100644 --- a/net/ipv4/ip_masq_ftp.c +++ b/net/ipv4/ip_masq_ftp.c @@ -5,19 +5,19 @@ * Version: @(#)ip_masq_ftp.c 0.01 02/05/96 * * Author: Wouter Gadeyne - * + * * * Fixes: * Wouter Gadeyne : Fixed masquerading support of ftp PORT commands * Juan Jose Ciarlante : Code moved and adapted from ip_fw.c - * + * * * * 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. - * + * */ #include @@ -100,14 +100,14 @@ masq_ftp_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb port = (p5<<8) | p6; #if DEBUG_CONFIG_IP_MASQ_FTP printk("PORT %X:%X detected\n",from,port); -#endif +#endif /* * Now update or create an masquerade entry for it */ #if DEBUG_CONFIG_IP_MASQ_FTP printk("protocol %d %lX:%X %X:%X\n", iph->protocol, htonl(from), htons(port), iph->daddr, 0); -#endif +#endif n_ms = ip_masq_out_get_2(iph->protocol, htonl(from), htons(port), iph->daddr, 0); @@ -120,7 +120,7 @@ masq_ftp_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb htonl(from), htons(port), iph->daddr, 0, IP_MASQ_F_NO_DPORT); - + if (n_ms==NULL) return 0; } @@ -142,18 +142,18 @@ masq_ftp_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb buf_len = strlen(buf); #if DEBUG_CONFIG_IP_MASQ_FTP printk("new PORT %X:%X\n",from,port); -#endif +#endif /* * Calculate required delta-offset to keep TCP happy */ - + diff = buf_len - (data-p); - + /* * No shift. */ - + if (diff==0) { /* @@ -201,12 +201,12 @@ int ip_masq_ftp_done(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { if (ip_masq_ftp_init() != 0) return -EIO; - register_symtab(0); return 0; } diff --git a/net/ipv4/ip_masq_irc.c b/net/ipv4/ip_masq_irc.c index 5e5c4905b6cf..e2004c0f32c0 100644 --- a/net/ipv4/ip_masq_irc.c +++ b/net/ipv4/ip_masq_irc.c @@ -5,7 +5,7 @@ * Version: @(#)ip_masq_irc.c 0.01 03/20/96 * * Author: Juan Jose Ciarlante - * + * * * Fixes: * - set NO_DADDR flag in ip_masq_new(). @@ -17,7 +17,7 @@ * 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. - * + * */ #include @@ -77,29 +77,29 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb * AAAAAAAAA: bound addr (1.0.0.0==16777216, min 8 digits) * P: bound port (min 1 d ) * F: filename (min 1 d ) - * S: size (min 1 d ) + * S: size (min 1 d ) * 0x01, \n: terminators */ data_limit = skb->h.raw + skb->len; - + while (data < (data_limit - 25) ) { if (memcmp(data,"DCC ",4)) { data ++; continue; } - + dcc_p = data; data += 4; /* point to DCC cmd */ - + if (memcmp(data, "CHAT ", 5) == 0 || memcmp(data, "SEND ", 5) == 0) { /* * extra arg (file_size) req. for "SEND" */ - + if (*data == 'S') xtra_args++; data += 5; } @@ -109,22 +109,22 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb /* * skip next string. */ - + while( *data++ != ' ') - + /* * must still parse, at least, "AAAAAAAA P\x01\n", * 12 bytes left. */ if (data > (data_limit-12)) return 0; - + addr_beg_p = data; - + /* * client bound address in dec base */ - + s_addr = simple_strtoul(data,&data,10); if (*data++ !=' ') continue; @@ -132,14 +132,14 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb /* * client bound port in dec base */ - + s_port = simple_strtoul(data,&data,10); addr_end_p = data; - + /* * should check args consistency? */ - + while(xtra_args) { if (*data != ' ') break; @@ -147,24 +147,24 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb simple_strtoul(data,&data,10); xtra_args--; } - + if (xtra_args != 0) continue; - + /* * terminators. */ - + if (data[0] != 0x01) continue; if (data[1]!='\r' && data[1]!='\n') continue; - + /* * Now create an masquerade entry for it * must set NO_DPORT and NO_DADDR because * connection is requested by another client. */ - + n_ms = ip_masq_new(dev, IPPROTO_TCP, htonl(s_addr),htons(s_port), 0, 0, @@ -174,29 +174,29 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb return 0; ip_masq_set_expire(n_ms, ip_masq_expire->tcp_fin_timeout); - + /* * Replace the old "address port" with the new one */ - + buf_len = sprintf(buf,"%lu %u", ntohl(n_ms->maddr),ntohs(n_ms->mport)); - + /* * Calculate required delta-offset to keep TCP happy */ - + diff = buf_len - (addr_end_p-addr_beg_p); #if DEBUG_CONFIG_IP_MASQ_IRC *addr_beg_p = '\0'; printk("masq_irc_out(): '%s' %X:%X detected (diff=%d)\n", dcc_p, s_addr,s_port, diff); -#endif +#endif /* * No shift. */ - - if (diff==0) + + if (diff==0) { /* * simple case, just copy. @@ -219,7 +219,7 @@ masq_irc_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff **skb * You need 1 object per port in case you need * to offer also other used irc ports (6665,6666,etc), * they will share methods but they need own space for - * data. + * data. */ struct ip_masq_app ip_masq_irc = { @@ -252,12 +252,12 @@ int ip_masq_irc_done(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { if (ip_masq_irc_init() != 0) return -EIO; - register_symtab(NULL); return 0; } diff --git a/net/ipv4/ip_masq_raudio.c b/net/ipv4/ip_masq_raudio.c index 6d3c71e2f56e..097f835ff456 100644 --- a/net/ipv4/ip_masq_raudio.c +++ b/net/ipv4/ip_masq_raudio.c @@ -31,10 +31,10 @@ * * At present the "first packet" is defined as a packet starting with * the protocol ID string - "PNA". - * When the link is up there appears to be enough control data + * When the link is up there appears to be enough control data * crossing the control link to keep it open even if a long audio * piece is playing. - * + * */ #include @@ -64,11 +64,11 @@ masq_raudio_init_1 (struct ip_masq_app *mapp, struct ip_masq *ms) { MOD_INC_USE_COUNT; if ((ms->app_data = kmalloc(sizeof(struct raudio_priv_data), - GFP_ATOMIC)) == NULL) + GFP_ATOMIC)) == NULL) printk(KERN_INFO "RealAudio: No memory for application data\n"); - else + else { - struct raudio_priv_data *priv = + struct raudio_priv_data *priv = (struct raudio_priv_data *)ms->app_data; priv->seen_start = 0; priv->data_conn = NULL; @@ -94,7 +94,7 @@ masq_raudio_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff ** char *p, *data, *data_limit; struct ip_masq *n_ms; unsigned short version, msg_id, msg_len, udp_port; - struct raudio_priv_data *priv = + struct raudio_priv_data *priv = (struct raudio_priv_data *)ms->app_data; /* Everything running correctly already */ @@ -156,7 +156,7 @@ masq_raudio_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff ** ms->saddr, udp_port, ms->daddr, 0, IP_MASQ_F_NO_DPORT); - + if (n_ms==NULL) return 0; @@ -171,7 +171,7 @@ masq_raudio_out (struct ip_masq_app *mapp, struct ip_masq *ms, struct sk_buff ** if (priv) priv->data_conn = n_ms; - /* + /* * There is nothing else useful we can do * Maybe a development could do more, but for now * we exit gracefully! @@ -214,12 +214,12 @@ int ip_masq_raudio_done(void) } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { if (ip_masq_raudio_init() != 0) return -EIO; - register_symtab(0); return 0; } diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index a4136b697e5b..b88e0dd84ff7 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -12,17 +12,17 @@ * * All the material in this file is subject to the Gnu license version 2. * Neither Alan Cox nor the Swansea University Computer Society admit liability - * nor provide warranty for any of this software. This material is provided - * as is and at no charge. + * nor provide warranty for any of this software. This material is provided + * as is and at no charge. * * Revision 0.21: Uses the new generic socket option code. * Revision 0.22: Gcc clean ups and drop out device registration. Use the - * new multi-protocol edition of hard_header + * new multi-protocol edition of hard_header * Revision 0.23: IPX /proc by Mark Evans. * Adding a route will overwrite any existing route to the same * network. * Revision 0.24: Supports new /proc with no 4K limit - * Revision 0.25: Add ephemeral sockets, passive local network + * Revision 0.25: Add ephemeral sockets, passive local network * identification, support for local net 0 and * multiple datalinks * Revision 0.26: Device drop kills IPX routes via it. (needed for modules) @@ -56,9 +56,9 @@ * * * Portions Copyright (c) 1995 Caldera, Inc. - * Neither Greg Page nor Caldera, Inc. admit liability nor provide - * warranty for any of this software. This material is provided - * "AS-IS" and at no charge. + * Neither Greg Page nor Caldera, Inc. admit liability nor provide + * warranty for any of this software. This material is provided + * "AS-IS" and at no charge. */ #include @@ -128,7 +128,7 @@ ipxcfg_set_auto_create(char val) } return 0; } - + static int ipxcfg_set_auto_select(char val) { @@ -142,7 +142,7 @@ static int ipxcfg_get_config_data(ipx_config_data *arg) { ipx_config_data vals; - + vals.ipxcfg_auto_create_interfaces = ipxcfg_auto_create_interfaces; vals.ipxcfg_auto_select_primary = ipxcfg_auto_select_primary; return copy_to_user(arg, &vals, sizeof(vals)) ? -EFAULT : 0; @@ -160,8 +160,8 @@ ipxcfg_get_config_data(ipx_config_data *arg) * handler using this technique. They can be added although we do not * use this facility. */ - -static void + +static void ipx_remove_socket(struct sock *sk) { struct sock *s; @@ -170,7 +170,7 @@ ipx_remove_socket(struct sock *sk) save_flags(flags); cli(); - + /* Determine interface with which socket is associated */ intrfc = sk->protinfo.af_ipx.intrfc; if (intrfc == NULL) { @@ -183,7 +183,7 @@ ipx_remove_socket(struct sock *sk) intrfc->if_sklist=s->next; restore_flags(flags); return; - } + } while(s && s->next) { if(s->next==sk) { @@ -202,8 +202,8 @@ ipx_remove_socket(struct sock *sk) * Once it is removed from the queue no interrupt or bottom half will * touch it and we are (fairly 8-) ) safe. */ - -static void + +static void ipx_destroy_socket(struct sock *sk) { struct sk_buff *skb; @@ -212,11 +212,11 @@ ipx_destroy_socket(struct sock *sk) while((skb=skb_dequeue(&sk->receive_queue))!=NULL) { kfree_skb(skb,FREE_READ); } - + sk_free(sk); MOD_DEC_USE_COUNT; } - + /* The following code is used to support IPX Interfaces (IPXITF). An * IPX interface is defined by a physical device and a frame type. */ @@ -237,8 +237,8 @@ ipxitf_find_using_phys(struct device *dev, unsigned short datalink) { ipx_interface *i; - for (i=ipx_interfaces; - i && ((i->if_dev!=dev) || (i->if_dlink_type!=datalink)); + for (i=ipx_interfaces; + i && ((i->if_dev!=dev) || (i->if_dlink_type!=datalink)); i=i->if_next) ; return i; @@ -280,8 +280,8 @@ ipxitf_find_socket(ipx_interface *intrfc, unsigned short port) { struct sock *s; - for (s=intrfc->if_sklist; - (s != NULL) && (s->protinfo.af_ipx.port != port); + for (s=intrfc->if_sklist; + (s != NULL) && (s->protinfo.af_ipx.port != port); s=s->next) ; @@ -306,7 +306,7 @@ ipxitf_find_internal_socket(ipx_interface *intrfc, s = s->next; } return s; -} +} #endif static void ipxrtr_del_routes(ipx_interface *); @@ -337,11 +337,11 @@ ipxitf_down(ipx_interface *intrfc) if (intrfc == ipx_interfaces) { ipx_interfaces = intrfc->if_next; } else { - for (i = ipx_interfaces; + for (i = ipx_interfaces; (i != NULL) && (i->if_next != intrfc); i = i->if_next) ; - if ((i != NULL) && (i->if_next == intrfc)) + if ((i != NULL) && (i->if_next == intrfc)) i->if_next = intrfc->if_next; } @@ -359,7 +359,7 @@ ipxitf_down(ipx_interface *intrfc) return; } -static int +static int ipxitf_device_event(struct notifier_block *notifier, unsigned long event, void *ptr) { struct device *dev = ptr; @@ -369,9 +369,9 @@ ipxitf_device_event(struct notifier_block *notifier, unsigned long event, void * return NOTIFY_DONE; for (i = ipx_interfaces; i != NULL; ) { - + tmp = i->if_next; - if (i->if_dev == dev) + if (i->if_dev == dev) ipxitf_down(i); i = tmp; @@ -384,7 +384,7 @@ static int ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb) { int retval; - if((retval = sock_queue_rcv_skb(sock, skb))<0) + if((retval = sock_queue_rcv_skb(sock, skb))<0) { /* * skb->sk is NULL here, so FREE_WRITE does not hurt @@ -401,7 +401,7 @@ static int ipxitf_def_skb_handler(struct sock *sock, struct sk_buff *skb) #ifdef CONFIG_IPX_INTERN static int -ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) +ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) { struct ipxhdr *ipx = skb->nh.ipxh; struct sock *s; @@ -465,7 +465,7 @@ ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) #else static int -ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) +ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) { struct ipxhdr *ipx = skb->nh.ipxh; struct sock *sock1 = NULL, *sock2 = NULL; @@ -480,10 +480,10 @@ ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) * The *SPECIAL* socket list contains: 0x452(SAP), 0x453(RIP) and * 0x456(Diagnostic). */ - - if (ipx_primary_net && (intrfc != ipx_primary_net)) + + if (ipx_primary_net && (intrfc != ipx_primary_net)) { - switch (ntohs(ipx->ipx_dest.sock)) + switch (ntohs(ipx->ipx_dest.sock)) { case 0x452: case 0x453: @@ -494,7 +494,7 @@ ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) * interface via ipxitf_send; however, we'll cheat * and just demux it here. */ - sock2 = ipxitf_find_socket(ipx_primary_net, + sock2 = ipxitf_find_socket(ipx_primary_net, ipx->ipx_dest.sock); break; default: @@ -502,57 +502,57 @@ ipxitf_demux_socket(ipx_interface *intrfc, struct sk_buff *skb, int copy) } } - /* + /* * if there is nothing to do, return. The kfree will * cancel any charging. */ - - if (sock1 == NULL && sock2 == NULL) + + if (sock1 == NULL && sock2 == NULL) { - if (!copy) + if (!copy) kfree_skb(skb,FREE_WRITE); return 0; } /* * This next segment of code is a little awkward, but it sets it up - * so that the appropriate number of copies of the SKB are made and - * that skb1 and skb2 point to it (them) so that it (they) can be + * so that the appropriate number of copies of the SKB are made and + * that skb1 and skb2 point to it (them) so that it (they) can be * demuxed to sock1 and/or sock2. If we are unable to make enough * copies, we do as much as is possible. */ - - if (copy) + + if (copy) { skb1 = skb_clone(skb, GFP_ATOMIC); - if (skb1) + if (skb1) skb1->arp=1; - } - else + } + else { skb1 = skb; } - - if (skb1 == NULL) - return -ENOMEM; + + if (skb1 == NULL) + return -ENOMEM; /* - * Do we need 2 SKBs? + * Do we need 2 SKBs? */ - - if (sock1 && sock2) + + if (sock1 && sock2) { skb2 = skb_clone(skb1, GFP_ATOMIC); - if (skb2 != NULL) + if (skb2 != NULL) skb2->arp = 1; } - else + else skb2 = skb1; - + if (sock1) (void) ipxitf_def_skb_handler(sock1, skb1); - if (skb2 == NULL) + if (skb2 == NULL) return -ENOMEM; if (sock2) @@ -635,35 +635,35 @@ static int ipxitf_send(ipx_interface *intrfc, struct sk_buff *skb, char *node) /* * Broadcast, loop and possibly keep to send on. */ - if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0) + if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0) { if (!send_to_wire) skb_orphan(skb); ipxitf_demux_socket(intrfc, skb, send_to_wire); - if (!send_to_wire) + if (!send_to_wire) return 0; } } /* - * If the originating net is not equal to our net; this is routed + * If the originating net is not equal to our net; this is routed * We are still charging the sender. Which is right - the driver * free will handle this fairly. */ - - if (ipx->ipx_source.net != intrfc->if_netnum) + + if (ipx->ipx_source.net != intrfc->if_netnum) { - if (++(ipx->ipx_tctrl) > ipxcfg_max_hops) + if (++(ipx->ipx_tctrl) > ipxcfg_max_hops) send_to_wire = 0; } - if (!send_to_wire) + if (!send_to_wire) { /* * We do a FREE_WRITE here because this indicates how - * to treat the socket with which the packet is + * to treat the socket with which the packet is * associated. If this packet is associated with a - * socket at all, it must be the originator of the + * socket at all, it must be the originator of the * packet. Routed packets will have no socket associated * with them. */ @@ -672,21 +672,21 @@ static int ipxitf_send(ipx_interface *intrfc, struct sk_buff *skb, char *node) } /* - * Determine the appropriate hardware address + * Determine the appropriate hardware address */ - + addr_len = dev->addr_len; - if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0) + if (memcmp(ipx_broadcast_node, node, IPX_NODE_LEN) == 0) memcpy(dest_node, dev->broadcast, addr_len); else memcpy(dest_node, &(node[IPX_NODE_LEN-addr_len]), addr_len); /* - * Make any compensation for differing physical/data link size + * Make any compensation for differing physical/data link size */ - + skb = ipxitf_adjust_skbuff(intrfc, skb); - if (skb == NULL) + if (skb == NULL) return 0; /* set up data link and physical headers */ @@ -726,37 +726,37 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) struct ipxhdr *ipx = skb->nh.ipxh; ipx_interface *i; -#ifdef CONFIG_FIREWALL +#ifdef CONFIG_FIREWALL /* * We firewall first, ask questions later. */ - + if (call_in_firewall(PF_IPX, skb->dev, ipx, NULL)!=FW_ACCEPT) { kfree_skb(skb, FREE_READ); return 0; } - -#endif + +#endif /* See if we should update our network number */ - if ((intrfc->if_netnum == 0L) && + if ((intrfc->if_netnum == 0L) && (ipx->ipx_source.net == ipx->ipx_dest.net) && - (ipx->ipx_source.net != 0L)) + (ipx->ipx_source.net != 0L)) { /* NB: NetWare servers lie about their hop count so we * dropped the test based on it. This is the best way * to determine this is a 0 hop count packet. */ - if ((i=ipxitf_find_using_net(ipx->ipx_source.net))==NULL) + if ((i=ipxitf_find_using_net(ipx->ipx_source.net))==NULL) { intrfc->if_netnum = ipx->ipx_source.net; (void) ipxitf_add_local_route(intrfc); - } - else + } + else { printk(KERN_WARNING "IPX: Network number collision %lx\n %s %s and %s %s\n", - htonl(ipx->ipx_source.net), + htonl(ipx->ipx_source.net), ipx_device_name(i), ipx_frame_name(i->if_dlink_type), ipx_device_name(intrfc), @@ -837,9 +837,9 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) if (ipx->ipx_source.net == 0L) ipx->ipx_source.net = intrfc->if_netnum; - if (intrfc->if_netnum != ipx->ipx_dest.net) + if (intrfc->if_netnum != ipx->ipx_dest.net) { -#ifdef CONFIG_FIREWALL +#ifdef CONFIG_FIREWALL /* * See if we are allowed to firewall forward */ @@ -848,7 +848,7 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) kfree_skb(skb, FREE_READ); return 0; } -#endif +#endif /* We only route point-to-point packets. */ if ((skb->pkt_type != PACKET_BROADCAST) && (skb->pkt_type != PACKET_MULTICAST)) @@ -864,8 +864,8 @@ static int ipxitf_rcv(ipx_interface *intrfc, struct sk_buff *skb) } /* see if we should keep it */ - if ((memcmp(ipx_broadcast_node, ipx->ipx_dest.node, IPX_NODE_LEN) == 0) - || (memcmp(intrfc->if_node, ipx->ipx_dest.node, IPX_NODE_LEN) == 0)) + if ((memcmp(ipx_broadcast_node, ipx->ipx_dest.node, IPX_NODE_LEN) == 0) + || (memcmp(intrfc->if_node, ipx->ipx_dest.node, IPX_NODE_LEN) == 0)) { return ipxitf_demux_socket(intrfc, skb, 0); } @@ -895,7 +895,7 @@ ipxitf_insert(ipx_interface *intrfc) return; } -static int +static int ipxitf_create_internal(ipx_interface_definition *idef) { ipx_interface *intrfc; @@ -939,7 +939,7 @@ ipx_map_frame_type(unsigned char type) return 0; } -static int +static int ipxitf_create(ipx_interface_definition *idef) { struct device *dev; @@ -947,7 +947,7 @@ ipxitf_create(ipx_interface_definition *idef) struct datalink_proto *datalink = NULL; ipx_interface *intrfc; - if (idef->ipx_special == IPX_INTERNAL) + if (idef->ipx_special == IPX_INTERNAL) return ipxitf_create_internal(idef); if ((idef->ipx_special == IPX_PRIMARY) && (ipx_primary_net != NULL)) @@ -958,7 +958,7 @@ ipxitf_create(ipx_interface_definition *idef) return -EADDRINUSE; switch (idef->ipx_dlink_type) { - case IPX_FRAME_ETHERII: + case IPX_FRAME_ETHERII: dlink_type = htons(ETH_P_IPX); datalink = pEII_datalink; break; @@ -983,11 +983,11 @@ ipxitf_create(ipx_interface_definition *idef) break; } - if (datalink == NULL) + if (datalink == NULL) return -EPROTONOSUPPORT; dev=dev_get(idef->ipx_device); - if (dev==NULL) + if (dev==NULL) return -ENODEV; if (!(dev->flags & IFF_UP)) @@ -997,7 +997,7 @@ ipxitf_create(ipx_interface_definition *idef) if(dev->addr_len>IPX_NODE_LEN) return -EINVAL; - if ((intrfc = ipxitf_find_using_phys(dev, dlink_type)) == NULL) + if ((intrfc = ipxitf_find_using_phys(dev, dlink_type)) == NULL) { /* Ok now create */ intrfc=(ipx_interface *)kmalloc(sizeof(ipx_interface),GFP_ATOMIC); @@ -1010,14 +1010,14 @@ ipxitf_create(ipx_interface_definition *idef) intrfc->if_sklist = NULL; intrfc->if_sknum = IPX_MIN_EPHEMERAL_SOCKET; /* Setup primary if necessary */ - if ((idef->ipx_special == IPX_PRIMARY)) + if ((idef->ipx_special == IPX_PRIMARY)) ipx_primary_net = intrfc; intrfc->if_internal = 0; intrfc->if_ipx_offset = dev->hard_header_len + datalink->header_length; if(memcmp(idef->ipx_node, "\000\000\000\000\000\000", IPX_NODE_LEN)==0) { memset(intrfc->if_node, 0, IPX_NODE_LEN); - memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), + memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), dev->dev_addr, dev->addr_len); } else @@ -1026,13 +1026,13 @@ ipxitf_create(ipx_interface_definition *idef) } /* If the network number is known, add a route */ - if (intrfc->if_netnum == 0L) + if (intrfc->if_netnum == 0L) return 0; return ipxitf_add_local_route(intrfc); } -static int +static int ipxitf_delete(ipx_interface_definition *idef) { struct device *dev = NULL; @@ -1076,7 +1076,7 @@ ipxitf_auto_create(struct device *dev, unsigned short dlink_type) case ETH_P_802_3: datalink = p8023_datalink; break; default: return NULL; } - + if (dev == NULL) return NULL; @@ -1092,10 +1092,10 @@ ipxitf_auto_create(struct device *dev, unsigned short dlink_type) intrfc->if_sklist = NULL; intrfc->if_internal = 0; intrfc->if_sknum = IPX_MIN_EPHEMERAL_SOCKET; - intrfc->if_ipx_offset = dev->hard_header_len + + intrfc->if_ipx_offset = dev->hard_header_len + datalink->header_length; memset(intrfc->if_node, 0, IPX_NODE_LEN); - memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), + memcpy((char *)&(intrfc->if_node[IPX_NODE_LEN-dev->addr_len]), dev->dev_addr, dev->addr_len); ipxitf_insert(intrfc); } @@ -1103,7 +1103,7 @@ ipxitf_auto_create(struct device *dev, unsigned short dlink_type) return intrfc; } -static int +static int ipxitf_ioctl_real(unsigned int cmd, void *arg) { switch(cmd) @@ -1134,7 +1134,7 @@ ipxitf_ioctl_real(unsigned int cmd, void *arg) ipx_interface *ipxif; struct device *dev; int err; - + if (copy_from_user(&ifr,arg,sizeof(ifr))) return -EFAULT; sipx=(struct sockaddr_ipx *)&ifr.ifr_addr; @@ -1171,7 +1171,7 @@ ipxitf_ioctl_real(unsigned int cmd, void *arg) } } -static int +static int ipxitf_ioctl(unsigned int cmd, void *arg) { int ret; @@ -1241,7 +1241,7 @@ ipxrtr_del_routes(ipx_interface *intrfc) } } -static int +static int ipxrtr_create(ipx_route_definition *rd) { ipx_interface *intrfc; @@ -1255,7 +1255,7 @@ ipxrtr_create(ipx_route_definition *rd) } -static int +static int ipxrtr_delete(long net) { ipx_route **r; @@ -1270,7 +1270,7 @@ ipxrtr_delete(long net) *r = tmp->ir_next; kfree_s(tmp, sizeof(ipx_route)); return 0; - } + } r = &(tmp->ir_next); } @@ -1300,42 +1300,42 @@ static __u16 ipx_set_checksum(struct ipxhdr *packet,int length) __u16 *p=(__u16 *)&packet->ipx_pktsize; /* - * Number of complete words + * Number of complete words */ __u32 i=length>>1; /* - * Loop through all complete words except the checksum field + * Loop through all complete words except the checksum field */ while(--i) sum+=*p++; /* - * Add on the last part word if it exists + * Add on the last part word if it exists */ if(packet->ipx_pktsize&htons(1)) sum+=ntohs(0xff00)&*p; /* - * Do final fixup + * Do final fixup */ - + sum=(sum&0xffff)+(sum>>16); /* - * It's a pity there's no concept of carry in C + * It's a pity there's no concept of carry in C */ if(sum>=0x10000) sum++; - + return ~sum; }; - + /* * Route an outgoing frame from a socket. */ @@ -1349,14 +1349,14 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, stru int ipx_offset; ipx_route *rt = NULL; int err; - + /* Find the appropriate interface on which to send packet */ - if ((usipx->sipx_network == 0L) && (ipx_primary_net != NULL)) + if ((usipx->sipx_network == 0L) && (ipx_primary_net != NULL)) { usipx->sipx_network = ipx_primary_net->if_netnum; intrfc = ipx_primary_net; - } - else + } + else { rt = ipxrtr_lookup(usipx->sipx_network); if (rt==NULL) { @@ -1364,7 +1364,7 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, stru } intrfc = rt->ir_intrfc; } - + ipx_offset = intrfc->if_ipx_offset; size=sizeof(struct ipxhdr)+len; size += ipx_offset; @@ -1388,7 +1388,7 @@ static int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, stru #ifdef CONFIG_IPX_INTERN memcpy(ipx->ipx_source.node, sk->protinfo.af_ipx.node, IPX_NODE_LEN); #else - if ((err = ntohs(sk->protinfo.af_ipx.port)) == 0x453 || err == 0x452) + if ((err = ntohs(sk->protinfo.af_ipx.port)) == 0x453 || err == 0x452) { /* RIP/SAP special handling for mars_nwe */ ipx->ipx_source.net = intrfc->if_netnum; @@ -1447,7 +1447,7 @@ ipxrtr_route_skb(struct sk_buff *skb) return 0; } i = r->ir_intrfc; - (void)ipxitf_send(i, skb, (r->ir_routed) ? + (void)ipxitf_send(i, skb, (r->ir_routed) ? r->ir_router_node : ipx->ipx_dest.node); return 0; } @@ -1461,21 +1461,21 @@ static int ipxrtr_ioctl(unsigned int cmd, void *arg) int err; struct rtentry rt; /* Use these to behave like 'other' stacks */ struct sockaddr_ipx *sg,*st; - + err = copy_from_user(&rt,arg,sizeof(rt)); if (err) - return -EFAULT; + return -EFAULT; sg=(struct sockaddr_ipx *)&rt.rt_gateway; st=(struct sockaddr_ipx *)&rt.rt_dst; - + if(!(rt.rt_flags&RTF_GATEWAY)) return -EINVAL; /* Direct routes are fixed */ if(sg->sipx_family!=AF_IPX) return -EINVAL; if(st->sipx_family!=AF_IPX) return -EINVAL; - + switch(cmd) { case SIOCDELRT: @@ -1524,22 +1524,22 @@ static int ipx_interface_get_info(char *buffer, char **start, off_t offset, /* Theory.. Keep printing in the same place until we pass offset */ - len += sprintf (buffer,"%-11s%-15s%-9s%-11s%s\n", "Network", + len += sprintf (buffer,"%-11s%-15s%-9s%-11s%s\n", "Network", "Node_Address", "Primary", "Device", "Frame_Type"); for (i = ipx_interfaces; i != NULL; i = i->if_next) { len += sprintf(buffer+len, "%08lX ", ntohl(i->if_netnum)); - len += sprintf (buffer+len,"%02X%02X%02X%02X%02X%02X ", + len += sprintf (buffer+len,"%02X%02X%02X%02X%02X%02X ", i->if_node[0], i->if_node[1], i->if_node[2], i->if_node[3], i->if_node[4], i->if_node[5]); len += sprintf(buffer+len, "%-9s", (i == ipx_primary_net) ? "Yes" : "No"); len += sprintf (buffer+len, "%-11s", ipx_device_name(i)); - len += sprintf (buffer+len, "%s\n", + len += sprintf (buffer+len, "%s\n", ipx_frame_name(i->if_dlink_type)); /* Are we still dumping unwanted data then discard the record */ pos=begin+len; - + if(posoffset+length) /* We have dumped enough */ break; } - + /* The data in question runs from begin to begin+len */ *start=buffer+(offset-begin); /* Start of wanted data */ len-=(offset-begin); /* Remove unwanted header data from length */ if(len>length) len=length; /* Remove unwanted tail data from length */ - + return len; } @@ -1568,28 +1568,28 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, /* Theory.. Keep printing in the same place until we pass offset */ -#ifdef CONFIG_IPX_INTERN - len += sprintf (buffer,"%-28s%-28s%-10s%-10s%-7s%s\n", "Local_Address", +#ifdef CONFIG_IPX_INTERN + len += sprintf (buffer,"%-28s%-28s%-10s%-10s%-7s%s\n", "Local_Address", #else - len += sprintf (buffer,"%-15s%-28s%-10s%-10s%-7s%s\n", "Local_Address", + len += sprintf (buffer,"%-15s%-28s%-10s%-10s%-7s%s\n", "Local_Address", #endif - "Remote_Address", "Tx_Queue", "Rx_Queue", + "Remote_Address", "Tx_Queue", "Rx_Queue", "State", "Uid"); for (i = ipx_interfaces; i != NULL; i = i->if_next) { for (s = i->if_sklist; s != NULL; s = s->next) { #ifdef CONFIG_IPX_INTERN len += sprintf(buffer+len, - "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", + "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", htonl(s->protinfo.af_ipx.intrfc->if_netnum), s->protinfo.af_ipx.node[0], - s->protinfo.af_ipx.node[1], - s->protinfo.af_ipx.node[2], - s->protinfo.af_ipx.node[3], - s->protinfo.af_ipx.node[4], + s->protinfo.af_ipx.node[1], + s->protinfo.af_ipx.node[2], + s->protinfo.af_ipx.node[3], + s->protinfo.af_ipx.node[4], s->protinfo.af_ipx.node[5], htons(s->protinfo.af_ipx.port)); #else - len += sprintf(buffer+len,"%08lX:%04X ", + len += sprintf(buffer+len,"%08lX:%04X ", htonl(i->if_netnum), htons(s->protinfo.af_ipx.port)); #endif @@ -1597,24 +1597,24 @@ static int ipx_get_info(char *buffer, char **start, off_t offset, len += sprintf(buffer+len, "%-28s", "Not_Connected"); } else { len += sprintf (buffer+len, - "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", + "%08lX:%02X%02X%02X%02X%02X%02X:%04X ", htonl(s->protinfo.af_ipx.dest_addr.net), s->protinfo.af_ipx.dest_addr.node[0], - s->protinfo.af_ipx.dest_addr.node[1], + s->protinfo.af_ipx.dest_addr.node[1], s->protinfo.af_ipx.dest_addr.node[2], - s->protinfo.af_ipx.dest_addr.node[3], + s->protinfo.af_ipx.dest_addr.node[3], s->protinfo.af_ipx.dest_addr.node[4], s->protinfo.af_ipx.dest_addr.node[5], htons(s->protinfo.af_ipx.dest_addr.sock)); } - len += sprintf (buffer+len,"%08X %08X ", + len += sprintf (buffer+len,"%08X %08X ", s->wmem_alloc, s->rmem_alloc); - len += sprintf (buffer+len,"%02X %03d\n", + len += sprintf (buffer+len,"%02X %03d\n", s->state, SOCK_INODE(s->socket)->i_uid); - + /* Are we still dumping unwanted data then discard the record */ pos=begin+len; - + if(poslength) len=length; /* Remove unwanted tail data from length */ - + return len; } @@ -1642,16 +1642,16 @@ static int ipx_rt_get_info(char *buffer, char **start, off_t offset, off_t pos=0; off_t begin=0; - len += sprintf (buffer,"%-11s%-13s%s\n", + len += sprintf (buffer,"%-11s%-13s%s\n", "Network", "Router_Net", "Router_Node"); for (rt = ipx_routes; rt != NULL; rt = rt->ir_next) { len += sprintf (buffer+len,"%08lX ", ntohl(rt->ir_net)); if (rt->ir_routed) { - len += sprintf (buffer+len,"%08lX %02X%02X%02X%02X%02X%02X\n", - ntohl(rt->ir_intrfc->if_netnum), - rt->ir_router_node[0], rt->ir_router_node[1], - rt->ir_router_node[2], rt->ir_router_node[3], + len += sprintf (buffer+len,"%08lX %02X%02X%02X%02X%02X%02X\n", + ntohl(rt->ir_intrfc->if_netnum), + rt->ir_router_node[0], rt->ir_router_node[1], + rt->ir_router_node[2], rt->ir_router_node[3], rt->ir_router_node[4], rt->ir_router_node[5]); } else { len += sprintf (buffer+len, "%-13s%s\n", @@ -1692,16 +1692,16 @@ static int ipx_setsockopt(struct socket *sock, int level, int optname, char *opt { struct sock *sk; int err,opt; - + sk=sock->sk; - + if (optval==NULL) return(-EINVAL); err = get_user(opt, (unsigned int *)optval); if (err) return err; - + switch(level) { case SOL_IPX: @@ -1714,7 +1714,7 @@ static int ipx_setsockopt(struct socket *sock, int level, int optname, char *opt return -EOPNOTSUPP; } break; - + default: return -EOPNOTSUPP; } @@ -1726,7 +1726,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname, struct sock *sk; int val=0; int err; - + sk=sock->sk; switch(level) @@ -1742,7 +1742,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname, return -ENOPROTOOPT; } break; - + default: return -EOPNOTSUPP; } @@ -1798,13 +1798,13 @@ static int ipx_create(struct socket *sock, int protocol) sk->socket=sock; sk->type=sock->type; sk->mtu=IPX_MTU; - sk->no_check = 1; /* Checksum off by default */ + sk->no_check = 1; /* Checksum off by default */ if(sock!=NULL) { sk->sleep=&sock->wait; sock->sk=sk; } - + sk->state_change=def_callback1; sk->data_ready=def_callback2; sk->write_space=def_callback1; @@ -1833,7 +1833,7 @@ static int ipx_dup(struct socket *newsock,struct socket *oldsock) return(ipx_create(newsock,SOCK_DGRAM)); } -static unsigned short +static unsigned short ipx_first_free_socketnum(ipx_interface *intrfc) { unsigned short socketNum = intrfc->if_sknum; @@ -1850,21 +1850,21 @@ ipx_first_free_socketnum(ipx_interface *intrfc) intrfc->if_sknum = socketNum; return ntohs(socketNum); } - + static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk; ipx_interface *intrfc; struct sockaddr_ipx *addr=(struct sockaddr_ipx *)uaddr; - + sk=sock->sk; - + if(sk->zapped==0) return -EINVAL; - + if(addr_len!=sizeof(struct sockaddr_ipx)) return -EINVAL; - + intrfc = ipxitf_find_using_net(addr->sipx_network); if (intrfc == NULL) return -EADDRNOTAVAIL; @@ -1902,8 +1902,8 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { memcpy(sk->protinfo.af_ipx.node, addr->sipx_node, IPX_NODE_LEN); } - if (ipxitf_find_internal_socket(intrfc, - sk->protinfo.af_ipx.node, + if (ipxitf_find_internal_socket(intrfc, + sk->protinfo.af_ipx.node, sk->protinfo.af_ipx.port) != NULL) { if(sk->debug) @@ -1919,14 +1919,14 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) * with the ipx routing ioctl() */ - memcpy(sk->protinfo.af_ipx.node, intrfc->if_node, + memcpy(sk->protinfo.af_ipx.node, intrfc->if_node, IPX_NODE_LEN); - + if(ipxitf_find_socket(intrfc, addr->sipx_port)!=NULL) { if(sk->debug) printk("IPX: bind failed because port %X in" " use.\n", (int)addr->sipx_port); - return -EADDRINUSE; + return -EADDRINUSE; } } @@ -1939,7 +1939,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) if(sk->debug) printk("IPX: bind failed because port %X in use.\n", (int)addr->sipx_port); - return -EADDRINUSE; + return -EADDRINUSE; } #endif @@ -1956,20 +1956,20 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, { struct sock *sk=sock->sk; struct sockaddr_ipx *addr; - - sk->state = TCP_CLOSE; + + sk->state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if(addr_len!=sizeof(*addr)) return(-EINVAL); addr=(struct sockaddr_ipx *)uaddr; - + if(sk->protinfo.af_ipx.port==0) /* put the autobinding in */ { struct sockaddr_ipx uaddr; int ret; - + uaddr.sipx_port = 0; uaddr.sipx_network = 0L; #ifdef CONFIG_IPX_INTERN @@ -1980,7 +1980,7 @@ static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, sizeof(struct sockaddr_ipx)); if (ret != 0) return (ret); } - + if(ipxrtr_lookup(addr->sipx_network)==NULL) return -ENETUNREACH; sk->protinfo.af_ipx.dest_addr.net=addr->sipx_network; @@ -2013,11 +2013,11 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, ipx_address *addr; struct sockaddr_ipx sipx; struct sock *sk; - + sk=sock->sk; - + *uaddr_len = sizeof(struct sockaddr_ipx); - + if(peer) { if(sk->state!=TCP_ESTABLISHED) return -ENOTCONN; @@ -2031,7 +2031,7 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, #ifdef CONFIG_IPX_INTERN memcpy(sipx.sipx_node, sk->protinfo.af_ipx.node, IPX_NODE_LEN); #else - memcpy(sipx.sipx_node, + memcpy(sipx.sipx_node, sk->protinfo.af_ipx.intrfc->if_node, IPX_NODE_LEN); #endif @@ -2041,7 +2041,7 @@ static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, } sipx.sipx_port = sk->protinfo.af_ipx.port; } - + sipx.sipx_family = AF_IPX; sipx.sipx_type = sk->protinfo.af_ipx.type; memcpy(uaddr,&sipx,sizeof(sipx)); @@ -2127,13 +2127,13 @@ int ipx_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) return 0; } } - + /* Determine what local ipx endpoint this is */ intrfc = ipxitf_find_using_phys(dev, pt->type); - if (intrfc == NULL) + if (intrfc == NULL) { if (ipxcfg_auto_create_interfaces && - ntohl(ipx->ipx_dest.net)!=0L) + ntohl(ipx->ipx_dest.net)!=0L) { intrfc = ipxitf_auto_create(dev, pt->type); } @@ -2157,20 +2157,20 @@ static int ipx_sendmsg(struct socket *sock, struct msghdr *msg, int len, int retval; int flags = msg->msg_flags; - if (sk->zapped) + if (sk->zapped) return -EIO; /* Socket not bound */ if (flags&~MSG_DONTWAIT) return -EINVAL; - if(usipx) + if(usipx) { - if(sk->protinfo.af_ipx.port == 0) + if(sk->protinfo.af_ipx.port == 0) { struct sockaddr_ipx uaddr; int ret; uaddr.sipx_port = 0; - uaddr.sipx_network = 0L; + uaddr.sipx_network = 0L; #ifdef CONFIG_IPX_INTERN memcpy(uaddr.sipx_node, sk->protinfo.af_ipx.intrfc ->if_node, IPX_NODE_LEN); @@ -2185,7 +2185,7 @@ static int ipx_sendmsg(struct socket *sock, struct msghdr *msg, int len, if(usipx->sipx_family != AF_IPX) return -EINVAL; } - else + else { if(sk->state!=TCP_ESTABLISHED) return -ENOTCONN; @@ -2196,9 +2196,9 @@ static int ipx_sendmsg(struct socket *sock, struct msghdr *msg, int len, usipx->sipx_network=sk->protinfo.af_ipx.dest_addr.net; memcpy(usipx->sipx_node,sk->protinfo.af_ipx.dest_addr.node,IPX_NODE_LEN); } - + retval = ipxrtr_route_packet(sk, usipx, msg->msg_iov, len, flags&MSG_DONTWAIT); - if (retval < 0) + if (retval < 0) return retval; return len; @@ -2251,7 +2251,7 @@ static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, int size, skb_free_datagram(sk, skb); return(copied); -} +} static int ipx_shutdown(struct socket *sk,int how) { @@ -2262,7 +2262,7 @@ static int ipx_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) { long amount=0; struct sock *sk=sock->sk; - + switch(cmd) { case TIOCOUTQ: @@ -2290,7 +2290,7 @@ static int ipx_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) return -EPERM; case SIOCGIFADDR: return(ipxitf_ioctl(cmd,(void *)arg)); - case SIOCIPXCFGDATA: + case SIOCIPXCFGDATA: { return(ipxcfg_get_config_data((void *)arg)); } @@ -2328,7 +2328,7 @@ static struct net_proto_family ipx_family_ops = { static struct proto_ops ipx_dgram_ops = { AF_IPX, - + ipx_dup, ipx_release, ipx_bind, @@ -2349,7 +2349,7 @@ static struct proto_ops ipx_dgram_ops = { /* Called by protocol.c on kernel start up */ -static struct packet_type ipx_8023_packet_type = +static struct packet_type ipx_8023_packet_type = { 0, /* MUTTER ntohs(ETH_P_8023),*/ @@ -2359,7 +2359,7 @@ static struct packet_type ipx_8023_packet_type = NULL, }; -static struct packet_type ipx_dix_packet_type = +static struct packet_type ipx_dix_packet_type = { 0, /* MUTTER ntohs(ETH_P_IPX),*/ NULL, /* All devices */ @@ -2410,23 +2410,23 @@ ipx_proto_init(struct net_proto *pro) p8023_datalink = make_8023_client(); ipx_8023_packet_type.type=htons(ETH_P_802_3); dev_add_pack(&ipx_8023_packet_type); - + if ((p8022_datalink = register_8022_client(ipx_8022_type, ipx_rcv)) == NULL) printk(KERN_CRIT "IPX: Unable to register with 802.2\n"); if ((p8022tr_datalink = register_8022tr_client(ipx_8022_type, ipx_rcv)) == NULL) printk(KERN_CRIT "IPX: Unable to register with 802.2TR\n"); - + if ((pSNAP_datalink = register_snap_client(ipx_snap_id, ipx_rcv)) == NULL) printk(KERN_CRIT "IPX: Unable to register with SNAP\n"); - + register_netdevice_notifier(&ipx_dev_notifier); #ifdef CONFIG_PROC_FS proc_net_register(&ipx_procinfo); proc_net_register(&ipx_if_procinfo); proc_net_register(&ipx_rt_procinfo); -#endif - +#endif + printk(KERN_INFO "Swansea University Computer Society IPX 0.35 for NET3.037\n"); printk(KERN_INFO "IPX Portions Copyright (c) 1995 Caldera, Inc.\n"); } @@ -2436,13 +2436,13 @@ ipx_proto_init(struct net_proto *pro) * * Use counts are incremented/decremented when * sockets are created/deleted. - * + * * Routes are always associated with an interface, and * allocs/frees will remain properly accounted for by * their associated interfaces. - * + * * Ergo, before the ipx module can be removed, all IPX - * sockets be closed from user space. + * sockets be closed from user space. */ static void @@ -2460,7 +2460,7 @@ ipx_proto_finito(void) proc_net_unregister(PROC_NET_IPX_ROUTE); proc_net_unregister(PROC_NET_IPX_INTERFACE); proc_net_unregister(PROC_NET_IPX); -#endif +#endif unregister_netdevice_notifier(&ipx_dev_notifier); @@ -2486,10 +2486,11 @@ ipx_proto_finito(void) return; } +EXPORT_NO_SYMBOLS; + int init_module(void) { ipx_proto_init(NULL); - register_symtab(0); return 0; } diff --git a/net/netbeui/netbeui.c b/net/netbeui/netbeui.c index d69a3b6b905a..93807d0a4eda 100644 --- a/net/netbeui/netbeui.c +++ b/net/netbeui/netbeui.c @@ -1,4 +1,4 @@ - + #include #include #include @@ -56,15 +56,15 @@ static netbeui_socket *volatile netbeui_socket_list=NULL; * handler using this technique. They can be added although we do not * use this facility. */ - + static void netbeui_remove_socket(netbeui_socket *sk) { unsigned long flags; netbeui_socket *s; - + save_flags(flags); cli(); - + s=netbeui_socket_list; if(s==sk) { @@ -107,7 +107,7 @@ static void netbeui_destroy_socket(netbeui_socket *sk); /* * Handler for deferred kills. */ - + static void netbeui_destroy_timer(unsigned long data) { netbeui_destroy_socket((netbeui_socket *)data); @@ -117,12 +117,12 @@ static void netbeui_destroy_socket(netbeui_socket *sk) { struct sk_buff *skb; netbeui_remove_socket(sk); - + while((skb=skb_dequeue(&sk->receive_queue))!=NULL) { kfree_skb(skb,FREE_READ); } - + if(sk->wmem_alloc == 0 && sk->rmem_alloc == 0 && sk->dead) { sk_free(sk); @@ -143,9 +143,9 @@ static void netbeui_destroy_socket(netbeui_socket *sk) /* - * Called from proc fs + * Called from proc fs */ - + int netbeui_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { netbeui_socket *s; @@ -171,10 +171,10 @@ int netbeui_get_info(char *buffer, char **start, off_t offset, int length, int d s->protinfo.af_at.dest_port); len += sprintf (buffer+len,"%08X:%08X ", s->wmem_alloc, s->rmem_alloc); len += sprintf (buffer+len,"%02X %d\n", s->state, SOCK_INODE(s->socket)->i_uid); - + /* Are we still dumping unwanted data then discard the record */ pos=begin+len; - + if(posoffset+length) /* We have dumped enough */ break; } - + /* The data in question runs from begin to begin+len */ *start=buffer+(offset-begin); /* Start of wanted data */ len-=(offset-begin); /* Remove unwanted header data from length */ if(len>length) len=length; /* Remove unwanted tail data from length */ - + return len; } @@ -218,7 +218,7 @@ static int nb_device_event(struct notifier_block *this, unsigned long event, voi * Generic fcntl calls are already dealt with. If we don't need funny ones * this is the all you need. Async I/O is also separate. */ - + static int netbeui_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg) { /* netbeui_socket *sk=(netbeui_socket *)sock->data;*/ @@ -230,24 +230,24 @@ static int netbeui_fcntl(struct socket *sock, unsigned int cmd, unsigned long ar } /* - * Set 'magic' options for netbeui. If we don't have any this is fine + * Set 'magic' options for netbeui. If we don't have any this is fine * as it is. */ - + static int netbeui_setsockopt(struct socket *sock, int level, int optname, char *optval, int optlen) { netbeui_socket *sk; int err,opt; - + sk=(netbeui_socket *)sock->data; - + if(optval==NULL) return(-EINVAL); err = get_user(opt, (int *)optval); if (err) return err; - + switch(level) { case SOL_NETBEUI: @@ -257,7 +257,7 @@ static int netbeui_setsockopt(struct socket *sock, int level, int optname, char return -EOPNOTSUPP; } break; - + case SOL_SOCKET: return sock_setsockopt(sk,level,optname,optval,optlen); @@ -270,14 +270,14 @@ static int netbeui_setsockopt(struct socket *sock, int level, int optname, char /* * Get any magic options. Comment above applies. */ - + static int netbeui_getsockopt(struct socket *sock, int level, int optname, char *optval, int *optlen) { netbeui_socket *sk; int val=0; int err; - + sk=(netbeui_socket *)sock->data; switch(level) @@ -290,10 +290,10 @@ static int netbeui_getsockopt(struct socket *sock, int level, int optname, return -ENOPROTOOPT; } break; - + case SOL_SOCKET: return sock_getsockopt(sk,level,optname,optval,optlen); - + default: return -EOPNOTSUPP; } @@ -306,7 +306,7 @@ static int netbeui_getsockopt(struct socket *sock, int level, int optname, /* * Only for connection oriented sockets - ignore */ - + static int netbeui_listen(struct socket *sock, int backlog) { struct sock *sk=(netbeui_socket *)sock->data; @@ -321,13 +321,13 @@ static int netbeui_listen(struct socket *sock, int backlog) sk->state=TCP_LISTEN; sk->state_change(sk); netbeui_llc_listen(sk); - return 0; + return 0; } /* * These are standard. */ - + static void def_callback1(struct sock *sk) { if(!sk->dead) @@ -347,7 +347,7 @@ static void def_callback2(struct sock *sk, int len) * Create a socket. Initialise the socket, blank the addresses * set the state. */ - + static int netbeui_create(struct socket *sock, int protocol) { netbeui_socket *sk; @@ -364,14 +364,14 @@ static int netbeui_create(struct socket *sock, int protocol) sk_free((void *)sk); return(-ESOCKTNOSUPPORT); } - + sk->llc802=llc_alloc(GFP_KERNEL); if(sk->llc802==NULL) { sk_free((void *)sk); return -ENOBUFS: } - + MOD_INC_USE_COUNT; sk->allocation=GFP_KERNEL; @@ -386,13 +386,13 @@ static int netbeui_create(struct socket *sock, int protocol) sk->socket=sock; sk->type=sock->type; sk->mtu=1500; - + if(sock!=NULL) { sock->data=(void *)sk; sk->sleep=sock->wait; } - + sk->state_change=def_callback1; sk->data_ready=def_callback2; sk->write_space=def_callback1; @@ -404,7 +404,7 @@ static int netbeui_create(struct socket *sock, int protocol) /* * Copy a socket. No work needed. */ - + static int netbeui_dup(struct socket *newsock,struct socket *oldsock) { return(netbeui_create(newsock,oldsock->type)); @@ -413,7 +413,7 @@ static int netbeui_dup(struct socket *newsock,struct socket *oldsock) /* * Free a socket. No work needed */ - + static int netbeui_release(struct socket *sock, struct socket *peer) { netbeui_socket *sk=(netbeui_socket *)sock->data; @@ -426,21 +426,21 @@ static int netbeui_release(struct socket *sock, struct socket *peer) netbeui_destroy_socket(sk); return(0); } - + /* * Set the address 'our end' of the connection. */ - + static int netbeui_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len) { netbeui_socket *sk; struct sockaddr_netbeui *addr=(struct sockaddr_netbeui *)uaddr; - + sk=(netbeui_socket *)sock->data; - + if(sk->zapped==0) return(-EINVAL); - + if(addr_len!=sizeof(struct sockaddr_at)) return -EINVAL; @@ -448,7 +448,7 @@ static int netbeui_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_ return -EAFNOSUPPORT; if(netbeui_find_socket(addr)!=NULL) - return -EADDRINUSE; + return -EADDRINUSE; netbeui_insert_socket(sk); sk->zapped=0; @@ -458,20 +458,20 @@ static int netbeui_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_ /* * Set the address we talk to. */ - + static int netbeui_connect(struct socket *sock, struct sockaddr *uaddr, size_t addr_len, int flags) { netbeui_socket *sk=(netbeui_socket *)sock->data; struct sockaddr_netbeui *addr; - - sk->state = TCP_CLOSE; + + sk->state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if(addr_len!=sizeof(*addr)) return(-EINVAL); addr=(struct sockaddr_netbeui *)uaddr; - + if(addr->sat_family!=AF_NETBEUI) return -EAFNOSUPPORT; @@ -481,16 +481,16 @@ static int netbeui_connect(struct socket *sock, struct sockaddr *uaddr, if(sk->zapped) return -EINVAL; - + if(atrtr_get_dev(&addr->sat_addr)==NULL) return -ENETUNREACH; - + } /* * Not relevant */ - + static int netbeui_socketpair(struct socket *sock1, struct socket *sock2) { return(-EOPNOTSUPP); @@ -499,7 +499,7 @@ static int netbeui_socketpair(struct socket *sock1, struct socket *sock2) /* * WRITE ME */ - + static int netbeui_accept(struct socket *sock, struct socket *newsock, int flags) { if(newsock->data) @@ -511,21 +511,21 @@ static int netbeui_accept(struct socket *sock, struct socket *newsock, int flags * Find the name of a netbeui socket. Just copy the right * fields into the sockaddr. */ - + static int netbeui_getname(struct socket *sock, struct sockaddr *uaddr, size_t *uaddr_len, int peer) { struct sockaddr_netbeui snb; netbeui_socket *sk; - + sk=(netbeui_socket *)sock->data; if(sk->zapped) { return -EINVAL; - } - + } + *uaddr_len = sizeof(struct sockaddr_netbeui); - + if(peer) { if(sk->state!=TCP_ESTABLISHED) @@ -542,7 +542,7 @@ static int netbeui_getname(struct socket *sock, struct sockaddr *uaddr, /* * Receive a packet (in skb) from device dev. */ - + static int netbeui_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) { netbeui_socket *sock; @@ -560,13 +560,13 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int struct netbeui_route *rt; int loopback=0; int err; - + if(flags) return -EINVAL; - + if(len>587) return -EMSGSIZE; - + if(usat) { if(sk->zapped) @@ -582,7 +582,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int #if 0 /* netnetbeui doesn't implement this check */ if(usat->sat_addr.s_node==ATADDR_BCAST && !sk->broadcast) return -EPERM; -#endif +#endif } else { @@ -594,19 +594,19 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int usat->sat_addr.s_node=sk->protinfo.af_at.dest_node; usat->sat_addr.s_net=sk->protinfo.af_at.dest_net; } - + /* Build a packet */ - + if(sk->debug) printk("SK %p: Got address.\n",sk); - + size=sizeof(struct ddpehdr)+len+nb_dl->header_length; /* For headers */ if(usat->sat_addr.s_net!=0 || usat->sat_addr.s_node == ATADDR_ANYNODE) { rt=atrtr_find(&usat->sat_addr); if(rt==NULL) - return -ENETUNREACH; + return -ENETUNREACH; dev=rt->dev; } else @@ -622,7 +622,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int if(sk->debug) printk("SK %p: Size needed %d, device %s\n", sk, size, dev->name); - + size += dev->hard_header_len; skb = sock_alloc_send_skb(sk, size, 0, 0 , &err); @@ -636,10 +636,10 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int skb_reserve(skb,dev->hard_header_len); skb->dev=dev; - + if(sk->debug) printk("SK %p: Begin build.\n", sk); - + ddp=(struct ddpehdr *)skb_put(skb,sizeof(struct ddpehdr)); ddp->deh_pad=0; ddp->deh_hops=0; @@ -660,34 +660,34 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int if(sk->debug) printk("SK %p: Copy user data (%d bytes).\n", sk, len); - + err = memcpy_fromiovec(skb_put(skb,len),msg->msg_iov,len); if (err) { kfree_skb(skb, FREE_WRITE); return -EFAULT; } - + if(sk->no_check==1) ddp->deh_sum=0; else ddp->deh_sum=netbeui_checksum(ddp, len+sizeof(*ddp)); - + #ifdef CONFIG_FIREWALL if(call_out_firewall(AF_NETBEUI, skb->dev, ddp, NULL)!=FW_ACCEPT) { kfree_skb(skb, FREE_WRITE); return -EPERM; - } - + } + #endif - + /* * Loopback broadcast packets to non gateway targets (ie routes * to group we are in) */ - + if(ddp->deh_dnode==ATADDR_BCAST) { if((!(rt->flags&RTF_GATEWAY))&&(!(dev->flags&IFF_LOOPBACK))) @@ -705,7 +705,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int } } - if((dev->flags&IFF_LOOPBACK) || loopback) + if((dev->flags&IFF_LOOPBACK) || loopback) { if(sk->debug) printk("SK %p: Loop back.\n", sk); @@ -719,7 +719,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int skb_pull(skb,nb_dl->header_length); netbeui_rcv(skb,dev,NULL); } - else + else { if(sk->debug) printk("SK %p: send out.\n", sk); @@ -728,7 +728,7 @@ static int netbeui_sendmsg(struct socket *sock, struct msghdr *msg, int len, int gsat.sat_addr = rt->gateway; usat = &gsat; } - + if(nb_send_low(dev,skb,&usat->sat_addr, NULL)==-1) kfree_skb(skb, FREE_WRITE); /* else queued/sent above in the aarp queue */ @@ -747,7 +747,7 @@ static int netbeui_recvmsg(struct socket *sock, struct msghdr *msg, int size, in int copied = 0; struct sk_buff *skb; int er = 0; - + if(addr_len) *addr_len=sizeof(*sat); @@ -777,8 +777,8 @@ static int netbeui_recvmsg(struct socket *sock, struct msghdr *msg, int size, in msg->msg_flags|=MSG_TRUNC; } er = skb_copy_datagram_iovec(skb,sizeof(*ddp),msg->msg_iov,copied); - if (er) - goto out; + if (er) + goto out; } if(sat) { @@ -790,7 +790,7 @@ static int netbeui_recvmsg(struct socket *sock, struct msghdr *msg, int size, in out: skb_free_datagram(sk, skb); return er ? er : (copied); -} +} static int netbeui_shutdown(struct socket *sk,int how) @@ -801,7 +801,7 @@ static int netbeui_shutdown(struct socket *sk,int how) static int netbeui_select(struct socket *sock , int sel_type, select_table *wait) { netbeui_socket *sk=(netbeui_socket *)sock->data; - + return datagram_select(sk,sel_type,wait); } @@ -813,7 +813,7 @@ static int netbeui_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg { long amount=0; netbeui_socket *sk=(netbeui_socket *)sock->data; - + switch(cmd) { /* @@ -850,7 +850,7 @@ static int netbeui_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg return(atrtr_ioctl(cmd,(void *)arg)); /* * Interface - */ + */ case SIOCGIFADDR: case SIOCSIFADDR: case SIOCGIFBRDADDR: @@ -888,7 +888,7 @@ static int netbeui_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg static struct proto_ops netbeui_proto_ops = { AF_NETBEUI, - + netbeui_create, netbeui_dup, netbeui_release, @@ -933,22 +933,22 @@ void netbeui_proto_init(struct net_proto *pro) /* ddp? isn't it atalk too? 8) */ if ((nb_dl = register_snap_client(nb_snap_id, netbeui_rcv)) == NULL) printk(KERN_CRIT "Unable to register DDP with SNAP.\n"); - + register_netdevice_notifier(&nb_notifier); #ifdef CONFIG_PROC_FS proc_net_register(&proc_netbeui); -#endif +#endif printk(KERN_INFO "NetBEUI 0.02 for Linux NET3.037\n"); } #ifdef MODULE +EXPORT_NO_SYMBOLS; int init_module(void) { netbeui_proto_init(NULL); - register_symtab(0); return 0; } @@ -957,7 +957,7 @@ void cleanup_module(void) unsigned long flags; #ifdef CONFIG_PROC_FS proc_net_unregister(PROC_NET_NETBEUI); -#endif +#endif unregister_netdevice_notifier(&nb_notifier); unregister_snap_client(nb_snap_id); sock_unregister(netbeui_proto_ops.family); diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 8d7fed0f70d9..59e92b5ba07c 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -1,8 +1,8 @@ /* * NET/ROM release 004 * - * This is ALPHA test software. This code may break your machine, randomly fail to work with new - * releases, misbehave and/or generally screw up. It might even work. + * This is ALPHA test software. This code may break your machine, randomly fail to work with new + * releases, misbehave and/or generally screw up. It might even work. * * This code REQUIRES 1.3.0 or higher/ NET3.029 * @@ -106,8 +106,8 @@ static int nr_header(struct sk_buff *skb, struct device *dev, unsigned short typ if (daddr != NULL) return 37; - - return -37; + + return -37; } static int nr_rebuild_header(struct sk_buff *skb) @@ -126,7 +126,7 @@ static int nr_rebuild_header(struct sk_buff *skb) bp[6] &= ~LAPB_E; bp[6] |= SSSID_SPARE; bp += AX25_ADDR_LEN; - + bp[6] &= ~LAPB_C; bp[6] |= LAPB_E; bp[6] |= SSSID_SPARE; @@ -158,7 +158,7 @@ static int nr_set_mac_address(struct device *dev, void *addr) ax25_listen_release((ax25_address *)dev->dev_addr, NULL); memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); - + ax25_listen_register((ax25_address *)dev->dev_addr, NULL); return 0; @@ -279,6 +279,8 @@ static struct device dev_nr[] = { {"nr3", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, nr_init} }; +EXPORT_NO_SYMBOLS; + int init_module(void) { int i; @@ -286,10 +288,8 @@ int init_module(void) for (i = 0; i < 4; i++) register_netdev(&dev_nr[i]); - register_symtab(NULL); - nr_proto_init(NULL); - + return 0; } @@ -312,7 +312,7 @@ void cleanup_module(void) nr_unregister_sysctl(); sock_unregister(nr_proto_ops.family); - + for (i = 0; i < 4; i++) { if (dev_nr[i].priv != NULL) { kfree(dev_nr[i].priv); diff --git a/net/netsyms.c b/net/netsyms.c index 56dd7fda3aac..a443e27ac0da 100644 --- a/net/netsyms.c +++ b/net/netsyms.c @@ -69,140 +69,136 @@ extern void destroy_8023_client(struct datalink_proto *); extern char *skb_push_errstr; extern char *skb_put_errstr; -static struct symbol_table net_syms = { -#include +/* Skbuff symbols. */ +EXPORT_SYMBOL(skb_push_errstr); +EXPORT_SYMBOL(skb_put_errstr); - /* Skbuff symbols. */ - X(skb_push_errstr), - X(skb_put_errstr), +/* Socket layer registration */ +EXPORT_SYMBOL(sock_register); +EXPORT_SYMBOL(sock_unregister); - /* Socket layer registration */ - X(sock_register), - X(sock_unregister), +/* Socket layer support routines */ +EXPORT_SYMBOL(memcpy_fromiovec); +EXPORT_SYMBOL(sock_setsockopt); +EXPORT_SYMBOL(sock_getsockopt); +EXPORT_SYMBOL(sock_sendmsg); +EXPORT_SYMBOL(sock_recvmsg); +EXPORT_SYMBOL(sk_alloc); +EXPORT_SYMBOL(sk_free); +EXPORT_SYMBOL(sock_wake_async); +EXPORT_SYMBOL(sock_alloc_send_skb); +EXPORT_SYMBOL(sock_rfree); +EXPORT_SYMBOL(sock_wfree); +EXPORT_SYMBOL(skb_recv_datagram); +EXPORT_SYMBOL(skb_free_datagram); +EXPORT_SYMBOL(skb_copy_datagram); +EXPORT_SYMBOL(skb_copy_datagram_iovec); +EXPORT_SYMBOL(skb_realloc_headroom); +EXPORT_SYMBOL(datagram_select); - /* Socket layer support routines */ - X(memcpy_fromiovec), - X(sock_setsockopt), - X(sock_getsockopt), - X(sock_sendmsg), - X(sock_recvmsg), - X(sk_alloc), - X(sk_free), - X(sock_wake_async), - X(sock_alloc_send_skb), - X(sock_rfree), - X(sock_wfree), - X(skb_recv_datagram), - X(skb_free_datagram), - X(skb_copy_datagram), - X(skb_copy_datagram_iovec), - X(skb_realloc_headroom), - X(datagram_select), - - /* Needed by smbfs.o */ - X(__scm_destroy), - X(__scm_send), +/* Needed by smbfs.o */ +EXPORT_SYMBOL(__scm_destroy); +EXPORT_SYMBOL(__scm_send); #ifdef CONFIG_IPX_MODULE - X(make_8023_client), - X(destroy_8023_client), - X(make_EII_client), - X(destroy_EII_client), +EXPORT_SYMBOL(make_8023_client); +EXPORT_SYMBOL(destroy_8023_client); +EXPORT_SYMBOL(make_EII_client); +EXPORT_SYMBOL(destroy_EII_client); #endif #ifdef CONFIG_INET - /* Internet layer registration */ - X(get_new_socknum), - X(inet_add_protocol), - X(inet_del_protocol), - X(rarp_ioctl_hook), - X(init_etherdev), - X(ip_route_output), - X(icmp_send), - X(ip_options_compile), - X(ip_rt_put), - X(arp_send), - X(ip_id_count), - X(ip_send_check), - X(ip_fragment), - X(ip_dev_find_tunnel), - X(inet_family_ops), +/* Internet layer registration */ +EXPORT_SYMBOL(get_new_socknum); +EXPORT_SYMBOL(inet_add_protocol); +EXPORT_SYMBOL(inet_del_protocol); +EXPORT_SYMBOL(rarp_ioctl_hook); +EXPORT_SYMBOL(init_etherdev); +EXPORT_SYMBOL(ip_route_output); +EXPORT_SYMBOL(icmp_send); +EXPORT_SYMBOL(ip_options_compile); +EXPORT_SYMBOL(ip_rt_put); +EXPORT_SYMBOL(arp_send); +EXPORT_SYMBOL(ip_id_count); +EXPORT_SYMBOL(ip_send_check); +EXPORT_SYMBOL(ip_fragment); +EXPORT_SYMBOL(ip_dev_find_tunnel); +EXPORT_SYMBOL(inet_family_ops); #ifdef CONFIG_IP_FORWARD - X(ip_forward), +EXPORT_SYMBOL(ip_forward); #endif #ifdef CONFIG_IPV6_MODULE - /* inet functions common to v4 and v6 */ - X(inet_stream_ops), - X(inet_dgram_ops), - X(inet_remove_sock), - X(inet_release), - X(inet_stream_connect), - X(inet_dgram_connect), - X(inet_accept), - X(inet_select), - X(inet_listen), - X(inet_shutdown), - X(inet_setsockopt), - X(inet_getsockopt), - X(inet_fcntl), - X(inet_sendmsg), - X(inet_recvmsg), - X(tcp_sock_array), - X(udp_sock_array), - X(destroy_sock), - X(ip_queue_xmit), - X(csum_partial), - X(skb_copy), - X(dev_lockct), - X(ndisc_eth_hook), - X(memcpy_fromiovecend), - X(csum_partial_copy), - X(csum_partial_copy_fromiovecend), - X(__release_sock), - X(net_timer), - X(inet_put_sock), - /* UDP/TCP exported functions for TCPv6 */ - X(udp_ioctl), - X(udp_connect), - X(udp_sendmsg), - X(tcp_cache_zap), - X(tcp_close), - X(tcp_accept), - X(tcp_write_wakeup), - X(tcp_read_wakeup), - X(tcp_select), - X(tcp_ioctl), - X(tcp_shutdown), - X(tcp_setsockopt), - X(tcp_getsockopt), - X(tcp_recvmsg), - X(tcp_send_synack), - X(sock_wmalloc), - X(tcp_reset_xmit_timer), - X(tcp_parse_options), - X(tcp_rcv_established), - X(tcp_init_xmit_timers), - X(tcp_clear_xmit_timers), - X(tcp_slt_array), - X(__tcp_inc_slow_timer), - X(tcp_statistics), - X(tcp_rcv_state_process), - X(tcp_do_sendmsg), - X(tcp_v4_build_header), - X(tcp_v4_rebuild_header), - X(tcp_v4_send_check), - X(tcp_v4_conn_request), - X(tcp_v4_syn_recv_sock), - X(tcp_v4_backlog_rcv), - X(tcp_v4_connect), - X(__ip_chk_addr), - X(net_reset_timer), - X(net_delete_timer), - X(udp_prot), - X(tcp_prot), - X(ipv4_specific), +/* inet functions common to v4 and v6 */ +EXPORT_SYMBOL(inet_stream_ops); +EXPORT_SYMBOL(inet_dgram_ops); +EXPORT_SYMBOL(inet_remove_sock); +EXPORT_SYMBOL(inet_release); +EXPORT_SYMBOL(inet_stream_connect); +EXPORT_SYMBOL(inet_dgram_connect); +EXPORT_SYMBOL(inet_accept); +EXPORT_SYMBOL(inet_select); +EXPORT_SYMBOL(inet_listen); +EXPORT_SYMBOL(inet_shutdown); +EXPORT_SYMBOL(inet_setsockopt); +EXPORT_SYMBOL(inet_getsockopt); +EXPORT_SYMBOL(inet_fcntl); +EXPORT_SYMBOL(inet_sendmsg); +EXPORT_SYMBOL(inet_recvmsg); +EXPORT_SYMBOL(tcp_sock_array); +EXPORT_SYMBOL(udp_sock_array); +EXPORT_SYMBOL(destroy_sock); +EXPORT_SYMBOL(ip_queue_xmit); +EXPORT_SYMBOL(csum_partial); +EXPORT_SYMBOL(dev_lockct); +EXPORT_SYMBOL(ndisc_eth_hook); +EXPORT_SYMBOL(memcpy_fromiovecend); +EXPORT_SYMBOL(csum_partial_copy); +EXPORT_SYMBOL(csum_partial_copy_fromiovecend); +EXPORT_SYMBOL(__release_sock); +EXPORT_SYMBOL(net_timer); +EXPORT_SYMBOL(inet_put_sock); +/* UDP/TCP exported functions for TCPv6 */ +EXPORT_SYMBOL(udp_ioctl); +EXPORT_SYMBOL(udp_connect); +EXPORT_SYMBOL(udp_sendmsg); +EXPORT_SYMBOL(tcp_cache_zap); +EXPORT_SYMBOL(tcp_close); +EXPORT_SYMBOL(tcp_accept); +EXPORT_SYMBOL(tcp_write_wakeup); +EXPORT_SYMBOL(tcp_read_wakeup); +EXPORT_SYMBOL(tcp_select); +EXPORT_SYMBOL(tcp_ioctl); +EXPORT_SYMBOL(tcp_shutdown); +EXPORT_SYMBOL(tcp_setsockopt); +EXPORT_SYMBOL(tcp_getsockopt); +EXPORT_SYMBOL(tcp_recvmsg); +EXPORT_SYMBOL(tcp_send_synack); +EXPORT_SYMBOL(sock_wmalloc); +EXPORT_SYMBOL(tcp_reset_xmit_timer); +EXPORT_SYMBOL(tcp_parse_options); +EXPORT_SYMBOL(tcp_rcv_established); +EXPORT_SYMBOL(tcp_init_xmit_timers); +EXPORT_SYMBOL(tcp_clear_xmit_timers); +EXPORT_SYMBOL(tcp_slt_array); +EXPORT_SYMBOL(__tcp_inc_slow_timer); +EXPORT_SYMBOL(tcp_statistics); +EXPORT_SYMBOL(tcp_rcv_state_process); +EXPORT_SYMBOL(tcp_do_sendmsg); +EXPORT_SYMBOL(tcp_v4_build_header); +EXPORT_SYMBOL(tcp_v4_rebuild_header); +EXPORT_SYMBOL(tcp_v4_send_check); +EXPORT_SYMBOL(tcp_v4_conn_request); +EXPORT_SYMBOL(tcp_v4_syn_recv_sock); +EXPORT_SYMBOL(tcp_v4_backlog_rcv); +EXPORT_SYMBOL(tcp_v4_connect); +EXPORT_SYMBOL(__ip_chk_addr); +EXPORT_SYMBOL(net_reset_timer); +EXPORT_SYMBOL(net_delete_timer); +EXPORT_SYMBOL(udp_prot); +EXPORT_SYMBOL(tcp_prot); +EXPORT_SYMBOL(ipv4_specific); #endif #if defined(CONFIG_ULTRA) || defined(CONFIG_WD80x3) || \ @@ -210,21 +206,21 @@ static struct symbol_table net_syms = { defined(CONFIG_E2100) || defined(CONFIG_HPLAN_PLUS) || \ defined(CONFIG_HPLAN) || defined(CONFIG_AC3200) || \ defined(CONFIG_ES3210) - /* If 8390 NIC support is built in, we will need these. */ - X(ei_open), - X(ei_close), - X(ei_debug), - X(ei_interrupt), - X(ethdev_init), - X(NS8390_init), +/* If 8390 NIC support is built in, we will need these. */ +EXPORT_SYMBOL(ei_open); +EXPORT_SYMBOL(ei_close); +EXPORT_SYMBOL(ei_debug); +EXPORT_SYMBOL(ei_interrupt); +EXPORT_SYMBOL(ethdev_init); +EXPORT_SYMBOL(NS8390_init); #endif #ifdef CONFIG_TR - X(tr_setup), - X(tr_type_trans), - X(register_trdev), - X(unregister_trdev), - X(init_trdev), +EXPORT_SYMBOL(tr_setup); +EXPORT_SYMBOL(tr_type_trans); +EXPORT_SYMBOL(register_trdev); +EXPORT_SYMBOL(unregister_trdev); +EXPORT_SYMBOL(init_trdev); #endif #ifdef CONFIG_NET_ALIAS @@ -233,59 +229,50 @@ static struct symbol_table net_syms = { #endif /* CONFIG_INET */ - /* Device callback registration */ - X(register_netdevice_notifier), - X(unregister_netdevice_notifier), +/* Device callback registration */ +EXPORT_SYMBOL(register_netdevice_notifier); +EXPORT_SYMBOL(unregister_netdevice_notifier); #ifdef CONFIG_NET_ALIAS - X(register_net_alias_type), - X(unregister_net_alias_type), +EXPORT_SYMBOL(register_net_alias_type); +EXPORT_SYMBOL(unregister_net_alias_type); #endif - /* support for loadable net drivers */ +/* support for loadable net drivers */ #ifdef CONFIG_INET - X(register_netdev), - X(unregister_netdev), - X(ether_setup), - X(eth_type_trans), - X(eth_copy_and_sum), - X(arp_query), - X(alloc_skb), - X(__kfree_skb), - X(skb_clone), - X(skb_copy), - X(dev_alloc_skb), - X(netif_rx), - X(dev_tint), - X(irq2dev_map), - X(dev_add_pack), - X(dev_remove_pack), - X(dev_get), - X(dev_ioctl), - X(dev_queue_xmit), - X(dev_base), - X(dev_close), - X(dev_mc_add), - X(arp_find), - X(n_tty_ioctl), - X(tty_register_ldisc), - X(kill_fasync), - X(arp_query), - X(ip_rcv), - X(arp_rcv), +EXPORT_SYMBOL(register_netdev); +EXPORT_SYMBOL(unregister_netdev); +EXPORT_SYMBOL(ether_setup); +EXPORT_SYMBOL(eth_type_trans); +EXPORT_SYMBOL(eth_copy_and_sum); +EXPORT_SYMBOL(arp_query); +EXPORT_SYMBOL(alloc_skb); +EXPORT_SYMBOL(__kfree_skb); +EXPORT_SYMBOL(skb_clone); +EXPORT_SYMBOL(skb_copy); +EXPORT_SYMBOL(dev_alloc_skb); +EXPORT_SYMBOL(netif_rx); +EXPORT_SYMBOL(dev_tint); +EXPORT_SYMBOL(irq2dev_map); +EXPORT_SYMBOL(dev_add_pack); +EXPORT_SYMBOL(dev_remove_pack); +EXPORT_SYMBOL(dev_get); +EXPORT_SYMBOL(dev_ioctl); +EXPORT_SYMBOL(dev_queue_xmit); +EXPORT_SYMBOL(dev_base); +EXPORT_SYMBOL(dev_close); +EXPORT_SYMBOL(dev_mc_add); +EXPORT_SYMBOL(arp_find); +EXPORT_SYMBOL(n_tty_ioctl); +EXPORT_SYMBOL(tty_register_ldisc); +EXPORT_SYMBOL(kill_fasync); +EXPORT_SYMBOL(ip_rcv); +EXPORT_SYMBOL(arp_rcv); #endif /* CONFIG_INET */ #ifdef CONFIG_NETLINK - X(netlink_attach), - X(netlink_detach), - X(netlink_donothing), - X(netlink_post), +EXPORT_SYMBOL(netlink_attach); +EXPORT_SYMBOL(netlink_detach); +EXPORT_SYMBOL(netlink_donothing); +EXPORT_SYMBOL(netlink_post); #endif /* CONFIG_NETLINK */ - -#include -}; - -void export_net_symbols(void) -{ - register_symtab(&net_syms); -} diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c index 0d91a7eb580e..8d703d81caee 100644 --- a/net/rose/rose_dev.c +++ b/net/rose/rose_dev.c @@ -1,8 +1,8 @@ /* * Rose release 001 * - * This is ALPHA test software. This code may break your machine, randomly fail to work with new - * releases, misbehave and/or generally screw up. It might even work. + * This is ALPHA test software. This code may break your machine, randomly fail to work with new + * releases, misbehave and/or generally screw up. It might even work. * * This code REQUIRES 2.1.0 or higher/ NET3.029 * @@ -87,8 +87,8 @@ static int rose_header(struct sk_buff *skb, struct device *dev, unsigned short t if (daddr != NULL) return 37; - - return -37; + + return -37; } static int rose_rebuild_header(struct sk_buff *skb) @@ -130,7 +130,7 @@ static int rose_set_mac_address(struct device *dev, void *addr) ax25_listen_release((ax25_address *)dev->dev_addr, NULL); memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); - + ax25_listen_register((ax25_address *)dev->dev_addr, NULL); return 0; @@ -249,15 +249,15 @@ static struct device dev_rose[] = { {"rose1", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, rose_init} }; +EXPORT_NO_SYMBOLS; + int init_module(void) { register_netdev(&dev_rose[0]); register_netdev(&dev_rose[1]); - register_symtab(NULL); - rose_proto_init(NULL); - + return 0; } @@ -281,7 +281,7 @@ void cleanup_module(void) unregister_netdevice_notifier(&rose_dev_notifier); sock_unregister(rose_proto_ops.family); - + for (i = 0; i < 2; i++) { if (dev_rose[i].priv != NULL) { kfree(dev_rose[i].priv); diff --git a/net/socket.c b/net/socket.c index b963c36842ad..926bb77843f3 100644 --- a/net/socket.c +++ b/net/socket.c @@ -94,10 +94,6 @@ #include -#if defined(CONFIG_MODULES) && defined(CONFIG_NET) -extern void export_net_symbols(void); -#endif - static long long sock_lseek(struct inode *inode, struct file *file, long long offset, int whence); static long sock_read(struct inode *inode, struct file *file, @@ -1512,14 +1508,6 @@ void sock_init(void) */ proto_init(); - - /* - * Export networking symbols to the world. - */ - -#if defined(CONFIG_MODULES) && defined(CONFIG_NET) - export_net_symbols(); -#endif } int socket_get_info(char *buffer, char **start, off_t offset, int length) -- 2.39.5