You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Andy P. <at...@us...> - 2002-04-09 16:55:53
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/sound In directory usw-pr-cvs1:/tmp/cvs-serv7449/sound Modified Files: CMI8338 MAD16 OPL3-SA2 Opti PAS16 README.OSS es1370 es1371 solo1 sonicvibes Added Files: WaveArtist btaudio cs46xx Removed Files: PCM1-pro via82cxxx.txt Log Message: synch 2.4.15 commit 28 --- NEW FILE --- (the following is from the armlinux CVS) WaveArtist mixer and volume levels can be accessed via these commands: nn30 read registers nn, where nn = 00 - 09 for mixer settings 0a - 13 for channel volumes mm31 write the volume setting in pairs, where mm = (nn - 10) / 2 rr32 write the mixer settings in pairs, where rr = nn/2 xx33 reset all settings to default 0y34 select mono source, y=0 = left, y=1 = right bits nn 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 00 | 0 | 0 0 1 1 | left line mixer gain | left aux1 mixer gain |lmute| ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 01 | 0 | 0 1 0 1 | left aux2 mixer gain | right 2 left mic gain |mmute| ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 02 | 0 | 0 1 1 1 | left mic mixer gain | left mic | left mixer gain |dith | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 03 | 0 | 1 0 0 1 | left mixer input select |lrfg | left ADC gain | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 04 | 0 | 1 0 1 1 | right line mixer gain | right aux1 mixer gain |rmute| ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 05 | 0 | 1 1 0 1 | right aux2 mixer gain | left 2 right mic gain |test | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 06 | 0 | 1 1 1 1 | right mic mixer gain | right mic |right mixer gain |rbyps| ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 07 | 1 | 0 0 0 1 | right mixer select |rrfg | right ADC gain | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 08 | 1 | 0 0 1 1 | mono mixer gain |right ADC mux sel|left ADC mux sel | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 09 | 1 | 0 1 0 1 |loopb|left linout|loop|ADCch|TxFch|OffCD|test |loopb|loopb|osamp| ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0a | 0 | left PCM channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0b | 0 | right PCM channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0c | 0 | left FM channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0d | 0 | right FM channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0e | 0 | left wavetable channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 0f | 0 | right wavetable channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 10 | 0 | left PCM expansion channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 11 | 0 | right PCM expansion channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 12 | 0 | left FM expansion channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ 13 | 0 | right FM expansion channel volume | ----+---+------------+-----+-----+-----+----+-----+-----+-----+-----+-----+-----+-----+ lmute: left mute mmute: mono mute dith: dithds lrfg: rmute: right mute rbyps: right bypass rrfg: ADCch: TxFch: OffCD: osamp: And the following diagram is derived from the description in the CVS archive: MIC L (mouthpiece) +------+ -->PreAmp>-\ +--^---+ | | | r2b4-5 | +--------+ /----*-------------------------------->5 | | | | | /----------------------------------->4 | | | | | | | /--------------------------------->3 1of5 | +---+ | | | | mux >-->AMP>--> ADC L | | | /------------------------------->2 | +-^-+ | | | | | | | Line | | | | +----+ +------+ +---+ /---->1 | r3b3-0 ------------*->mute>--> Gain >--> | | | | L | | | +----+ +------+ | | | *->0 | | | | | | | +---^----+ Aux2 | | | +----+ +------+ | | | | ----------*--->mute>--> Gain >--> M | | r8b0-2 L | | +----+ +------+ | | | | | | | \------\ Aux1 | | +----+ +------+ | | | --------*----->mute>--> Gain >--> I | | L | +----+ +------+ | | | | | | | | +----+ +------+ | | +---+ | *------->mute>--> Gain >--> X >-->AMP>--* | +----+ +------+ | | +-^-+ | | | | | | | +----+ +------+ | | r2b1-3 | | /----->mute>--> Gain >--> E | | | | +----+ +------+ | | | | | | | | | | +----+ +------+ | | | | | /--->mute>--> Gain >--> R | | | | | +----+ +------+ | | | | | | | | | r9b8-9 | | | +----+ +------+ | | | | | | | /->mute>--> Gain >--> | | +---v---+ | | | | +----+ +------+ +---+ /-*->0 | DAC | | | | | | | ------------*----------------------------------->? | +----+ L | | | | | Mux >-->mute>--> L output | | | | /->? | +--^-+ | | | | | | | | | | | /--------->? | r0b0 | | | | | | +-------+ | | | | | | Mono | | | | | | +-------+ ----------* | \---> | +----+ | | | | | | Mix >-->mute>--> Mono output | | | | *-> | +--^-+ | | | | | +-------+ | | | | | | r1b0 DAC | | | | | +-------+ ------------*-------------------------*--------->1 | +----+ R | | | | | | Mux >-->mute>--> R output | | | | +----+ +------+ +---+ *->0 | +--^-+ | | | \->mute>--> Gain >--> | | +---^---+ | | | | +----+ +------+ | | | | r5b0 | | | | | | r6b0 | | | +----+ +------+ | | | | | \--->mute>--> Gain >--> M | | | | +----+ +------+ | | | | | | | | | | +----+ +------+ | | | | *----->mute>--> Gain >--> I | | | | +----+ +------+ | | | | | | | | | | +----+ +------+ | | +---+ | \------->mute>--> Gain >--> X >-->AMP>--* | +----+ +------+ | | +-^-+ | /--/ | | | | Aux1 | +----+ +------+ | | r6b1-3 | -------*------>mute>--> Gain >--> E | | R | | +----+ +------+ | | | | | | | | Aux2 | | +----+ +------+ | | /------/ ---------*---->mute>--> Gain >--> R | | R | | | +----+ +------+ | | | | | | | | | +--------+ Line | | | +----+ +------+ | | | *->0 | -----------*-->mute>--> Gain >--> | | | | R | | | | +----+ +------+ +---+ \---->1 | | | | | | | | | | \-------------------------------->2 | +---+ | | | | Mux >-->AMP>--> ADC R | | \---------------------------------->3 | +-^-+ | | | | | | \------------------------------------>4 | r7b3-0 | | | \-----*-------------------------------->5 | | +---^----+ r6b4-5 | | | | r8b3-5 +--v---+ | -->PreAmp>-/ +------+ MIC R (electret mic) --- NEW FILE --- Intro ===== people start bugging me about this with questions, looks like I should write up some documentation for this beast. That way I don't have to answer that much mails I hope. Yes, I'm lazy... You might have noticed that the bt878 grabber cards have actually _two_ PCI functions: $ lspci [ ... ] 00:0a.0 Multimedia video controller: Brooktree Corporation Bt878 (rev 02) 00:0a.1 Multimedia controller: Brooktree Corporation Bt878 (rev 02) [ ... ] The first does video, it is backward compatible to the bt848. The second does audio. btaudio is a driver for the second function. It's a sound driver which can be used for recording sound (and _only_ recording, no playback). As most TV cards come with a short cable which can be plugged into your sound card's line-in you probably don't need this driver if all you want to do is just watching TV... Driver Status ============= Still somewhat experimental. The driver should work stable, i.e. it should'nt crash your box. It might not work as expected, have bugs, not being fully OSS API compilant, ... Latest versions are available from http://bytesex.org/bttv/, the driver is in the bttv tarball. Kernel patches might be available too, have a look at http://bytesex.org/bttv/listing.html. The chip knows two different modes. btaudio registers two dsp devices, one for each mode. They can not be used at the same time. Digital audio mode ================== The chip gives you 16 bit stereo sound. The sample rate depends on the external source which feeds the bt878 with digital sound via I2S interface. There is a insmod option (rate) to tell the driver which sample rate the hardware uses (32000 is the default). One possible source for digital sound is the msp34xx audio processor chip which provides digital sound via I2S with 32 kHz sample rate. My Hauppauge board works this way. The Osprey-200 reportly gives you digital sound with 44100 Hz sample rate. It is also possible that you get no sound at all. analog mode (A/D) ================= You can tell the driver to use this mode with the insmod option "analog=1". The chip has three analog inputs. Consequently you'll get a mixer device to control these. The analog mode supports mono only. Both 8 + 16 bit. Both are _signed_ int, which is uncommon for the 8 bit case. Sample rate range is 119 kHz to 448 kHz. Yes, the number of digits is correct. The driver supports downsampling by powers of two, so you can ask for more usual sample rates like 44 kHz too. With my Hauppauge I get noisy sound on the second input (mapped to line2 by the mixer device). Others get a useable signal on line1. some examples ============= * read audio data from btaudio (dsp2), send to es1730 (dsp,dsp1): $ sox -w -r 32000 -t ossdsp /dev/dsp2 -t ossdsp /dev/dsp * read audio data from btaudio, send to esound daemon (which might be running on another host): $ sox -c 2 -w -r 32000 -t ossdsp /dev/dsp2 -t sw - | esdcat -r 32000 $ sox -c 1 -w -r 32000 -t ossdsp /dev/dsp2 -t sw - | esdcat -m -r 32000 Have fun, Gerd -- Gerd Knorr <kr...@by...> --- NEW FILE --- Documentation for the Cirrus Logic/Crystal SoundFusion cs46xx/cs4280 audio controller chips (2001/05/11) The cs46xx audio driver supports the DSP line of Cirrus controllers. Specifically, the cs4610, cs4612, cs4614, cs4622, cs4624, cs4630 and the cs4280 products. This driver uses the generic ac97_codec driver for AC97 codec support. Features: Full Duplex Playback/Capture supported from 8k-48k. 16Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported. APM/PM - 2.2.x PM is enabled and functional. APM can also be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro definition. DMA playback buffer size is configurable from 16k (defaultorder=2) up to 2Meg (defaultorder=11). DMA capture buffer size is fixed at a single 4k page as two 2k fragments. MMAP seems to work well with QuakeIII, and test XMMS plugin. Myth2 works, but the polling logic is not fully correct, but is functional. The 2.4.4-ac6 gameport code in the cs461x joystick driver has been tested with a Microsoft Sidewinder joystick (cs461x.o and sidewinder.o). This audio driver must be loaded prior to the joystick driver to enable the DSP task image supporting the joystick device. Limitations: SPDIF is currently not supported. Primary codec support only. No secondary codec support is implemented. NOTES: Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp, and has been tested. Module parameter hercules_egpio_disable set to 1, will force a 0 to EGPIODR to disable the external amplifier. VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control the external amplifier for the "back" speakers, since we do not support the secondary codec then this external amp is not turned on. The primary codec external amplifier is supported but note that the AC97 EAPD bit is inverted logic (amp_voyetra()). DMA buffer size - there are issues with many of the Linux applications concerning the optimal buffer size. Several applications request a certain fragment size and number and then do not verify that the driver has the ability to support the requested configuration. SNDCTL_DSP_SETFRAGMENT ioctl is used to request a fragment size and number of fragments. Some applications exit if an error is returned on this particular ioctl. Therefore, in alignment with the other OSS audio drivers, no error is returned when a SETFRAGs IOCTL is received, but the values passed from the app are not used in any buffer calculation (ossfragshift/ossmaxfrags are not used). Use the "defaultorder=N" module parameter to change the buffer size if you have an application that requires a specific number of fragments or a specific buffer size (see below). Debug Interface --------------- There is an ioctl debug interface to allow runtime modification of the debug print levels. This debug interface code can be disabled from the compilation process with commenting the following define: #define CSDEBUG_INTERFACE 1 There is also a debug print methodolgy to select printf statements from different areas of the driver. A debug print level is also used to allow additional printfs to be active. Comment out the following line in the driver to disable compilation of the CS_DBGOUT print statements: #define CSDEBUG 1 Please see the defintions for cs_debuglevel and cs_debugmask for additional information on the debug levels and sections. There is also a csdbg executable to allow runtime manipulation of these parameters. for a copy email: tw...@cr... MODULE_PARMS definitions ------------------------ MODULE_PARM(defaultorder, "i"); defaultorder=N where N is a value from 1 to 12 The buffer order determines the size of the dma buffer for the driver. under Linux, a smaller buffer allows more responsiveness from many of the applications (e.g. games). A larger buffer allows some of the apps (esound) to not underrun the dma buffer as easily. As default, use 32k (order=3) rather than 64k as some of the games work more responsively. (2^N) * PAGE_SIZE = allocated buffer size MODULE_PARM(cs_debuglevel, "i"); MODULE_PARM(cs_debugmask, "i"); cs_debuglevel=N cs_debugmask=0xMMMMMMMM where N is a value from 0 (no debug printfs), to 9 (maximum) 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). MODULE_PARM(hercules_egpio_disable, "i"); hercules_egpio_disable=N where N is a 0 (enable egpio), or a 1 (disable egpio support) MODULE_PARM(initdelay, "i"); initdelay=N This value is used to determine the millescond delay during the initialization code prior to powering up the PLL. On laptops this value can be used to assist with errors on resume, mostly with IBM laptops. Basically, if the system is booted under battery power then the mdelay()/udelay() functions fail to properly delay the required time. Also, if the system is booted under AC power and then the power removed, the mdelay()/udelay() functions will not delay properly. MODULE_PARM(powerdown, "i"); powerdown=N where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) MODULE_PARM(external_amp, "i"); external_amp=1 if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. override the detection logic and force the external amp bit in the AC97 0x26 register to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz card has inverted logic, so there is a special function for these cards. MODULE_PARM(thinkpad, "i"); thinkpad=1 if N is set to 1, then force enabling the clkrun functionality. Currently, when the part is being used, then clkrun is disabled for the entire system, but re-enabled when the driver is released or there is no outstanding open count. Index: CMI8338 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/CMI8338,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- CMI8338 14 Jan 2001 20:05:06 -0000 1.1.1.1 +++ CMI8338 9 Apr 2002 16:55:46 -0000 1.2 @@ -8,59 +8,78 @@ On-board C-Media chips -WHAT'S NEW +STEPS TO BUILD DRIVER ================================================================================ - 1. Support modem interface for 8738. (select in kernel configuration) - 2. Enable S/PDIF-in to S/PDIF-out (S/PDIF loop). - 3. Enable 4 channels analog duplicate mode on 3 jack or 4 jack - configuration. + 1. Backup the Config.in and Makefile in the sound driver directory + (/usr/src/linux/driver/sound). + The Configure.help provide help when you config driver in step + 4, please backup the original one (/usr/src/linux/Document) and + copy this file. + The cmpci is document for the driver in detail, please copy it + to /usr/src/linux/Document/sound so you can refer it. Backup if + there is already one. + 2. Extract the tar file by 'tar xvzf cmpci-xx.tar.gz' in the above + directory. - Be aware: C-Media Electronics Inc. is basically an IC design house, - and whose development of software drivers is mainly for use by its OEM - customers in their products. C-Media Electronics Inc. itself does not - manufacture end-user products, such as PC or sound cards, so it can - not fully control the drivers provided to consumers. Drivers provided - at this site, therefore, MAY NOT BE APPLICABLE to all sound cards. - Drivers you download from this site may function well at certain - situation, but C-Media Electronics Inc. does not give any guarantee or - assurances. Please be aware that these drivers might cause some - technical difficulties when installed + 3. Change directory to /usr/src/linux + 4. Config cm8338 driver by 'make menuconfig', 'make config' or + 'make xconfig' command. -1. Config cm8338 driver by 'make menuconfig' or 'make config' command. + 5. Please select Sound Card (CONFIG_SOUND=m) support and CMPCI + driver (CONFIG_SOUND_CMPCI=m) as modules. Resident mode not tested. + For driver option, please refer 'DRIVER PARAMETER' -2. Please select Sound Card (CONFIG_SOUND=m) support and CMPCI driver (CONFIG_SOUND_CMPCI=m) as modules. Resident mode not tested. + 6. Compile the kernel if necessary. -3. Compile the kernel if necessary. + 7. Compile the modules by 'make modules'. -4. Compile the modules by 'make modules'. + 8. Install the modules by 'make modules_install' -5. Install the modules by 'make modules_install' -6. Before first time to run the driver, create module dependency by 'depmod -a' +INSTALL DRIVER +================================================================================ + + 1. Before first time to run the driver, create module dependency by + 'depmod -a' + + 2. To install the driver manually, enter 'modprobe cmpci'. + + 3. Driver installation for various distributions: -7. To install the driver, enter 'modprobe cmpci'. + a. Slackware 4.0 + Add the 'modprobe cmpci' command in your /etc/rc.d/rc.modules + file.so you can start the driver automatically each time booting. + b. Caldera OpenLinux 2.2 + Use LISA to load the cmpci module. -DRIVER PARAMETERS + c. RedHat 6.0 and S.u.S.E. 6.1 + Add following command in /etc/conf.modules: + + alias sound cmpci + + also visit http://www.cmedia.com.tw for installation instruction. + +DRIVER PARAMETER ================================================================================ Some functions for the cm8738 can be configured in Kernel Configuration or modules parameters. Set these parameters to 1 to enable. + mpuio: I/O ports base for MPU-401, 0 if disabled. + fmio: I/O ports base for OPL-3, 0 if disabled. + spdif_inverse:Inverse the S/PDIF-in signal, this depends on your + CD-ROM or DVD-ROM. spdif_loop: Enable S/PDIF loop, this route S/PDIF-in to S/PDIF-out directly. - four_ch: Enable 4 channels mode, rear-out or line-in will output - the same as line-out. - rear_out: Enable this if you have independent rear-out jacket on - your sound card, otherwise line-in will be used as + speakers: Number of speakers used. + use_line_as_rear:Enable this if you want to use line-in as rear-out. - modem: You will need to set this parameter if you want to use - the HSP modem. You need install the pctel.o, the modem - driver itself. - - (You will need to get the pctel driver (binary only) and the support for - this option from the CMI site. It is not included in the Linux kernel - proper as it is non-free). + use_line_as_bass:Enable this if you want to use line-in as + bass-out. + joystick: Enable joystick. You will need to install Linux joystick + driver. + Index: MAD16 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/MAD16,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- MAD16 14 Jan 2001 20:04:37 -0000 1.1.1.1 +++ MAD16 9 Apr 2002 16:55:46 -0000 1.2 @@ -1,3 +1,5 @@ +(This recipe has been edited to update the configuration symbols.) + From: Shaw Carruthers <sh...@sh...> I have been using mad16 sound for some time now with no problems, current @@ -14,9 +16,9 @@ .config has: CONFIG_SOUND=m -CONFIG_ADLIB=m -CONFIG_MAD16=m -CONFIG_YM3812=m +CONFIG_SOUND_ADLIB=m +CONFIG_SOUND_MAD16=m +CONFIG_SOUND_YM3812=m modules.conf has: Index: OPL3-SA2 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/OPL3-SA2,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- OPL3-SA2 25 Feb 2001 23:15:25 -0000 1.1.1.2 +++ OPL3-SA2 9 Apr 2002 16:55:47 -0000 1.2 @@ -21,7 +21,7 @@ different chipset, the OPL3-SAx. After an email exhange with Yamaha, however, it turns out that the 719 is just a re-badged 715, and the chipsets are identical. The chipset detection code -has been updated to refkect this. +has been updated to reflect this. Anyways, all of these chipsets implement the following devices: Index: Opti =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/Opti,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Opti 14 Jan 2001 20:04:39 -0000 1.1.1.1 +++ Opti 9 Apr 2002 16:55:47 -0000 1.2 @@ -29,21 +29,21 @@ Sound card support should be enabled as a module (chose m). Answer 'm' for these items: - Generic OPL2/OPL3 FM synthesizer support (CONFIG_ADLIB) - Microsoft Sound System support (CONFIG_MSS) - Support for OPTi MAD16 and/or Mozart based cards (CONFIG_MAD16) - FM synthesizer (YM3812/OPL-3) support (CONFIG_YM3812) + Generic OPL2/OPL3 FM synthesizer support (CONFIG_SOUND_ADLIB) + Microsoft Sound System support (CONFIG_SOUND_MSS) + Support for OPTi MAD16 and/or Mozart based cards (CONFIG_SOUND_MAD16) + FM synthesizer (YM3812/OPL-3) support (CONFIG_SOUND_YM3812) The configuration menu may ask for addresses, IRQ lines or DMA channels. If the card is used as a module the module loading options will override these values. For the OPTi 931 you can answer 'n' to: - Support MIDI in older MAD16 based cards (requires SB) (CONFIG_MAD16_OLDCARD) + Support MIDI in older MAD16 based cards (requires SB) (CONFIG_SOUND_MAD16_OLDCARD) If you do need MIDI support in a Mozart or C928 based card you need to answer 'm' to the above question. In that case you will also need to answer 'm' to: - '100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' (CONFIG_SB) + '100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' (CONFIG_SOUND_SB) Go on and compile your kernel and modules. Install the modules. Run depmod -a. Index: PAS16 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/PAS16,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- PAS16 14 Jan 2001 20:05:12 -0000 1.1.1.1 +++ PAS16 9 Apr 2002 16:55:47 -0000 1.2 @@ -1,7 +1,7 @@ Pro Audio Spectrum 16 for 2.3.99 and later ========================================= by Thomas Molina (tm...@ho...) -last modified 26 Mar 2000 +last modified 3 Mar 2001 Acknowledgement to Axel Boldt (bo...@ma...) for stuff taken from Configure.help, Riccardo Facchetti for stuff from README.OSS, and others whose names I could not find. @@ -48,14 +48,6 @@ if you want to use the SB emulation of PAS16. It's also possible to the emulation if you want to use a true SB card together with PAS16 (there is another question about this that is asked later). - "Sound Blaster support", - - Answer 'y' if you have an original SB card made by Creative Labs - or a full 100% hardware compatible clone (like Thunderboard or - SM Games). If your card was in the list of supported cards (above), - please look at the card specific instructions later in this file - before answering this question. For an unknown card you may answer - 'y' if the card claims to be SB compatible. - Enable this option also with PAS16. "Generic OPL2/OPL3 FM synthesizer support", - Answer 'y' if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). @@ -113,27 +105,13 @@ Answer Y only if you have a Pro Audio Spectrum 16, ProAudio Studio 16 or Logitech SoundMan 16 sound card. Don't answer Y if you have some other card made by Media Vision or Logitech since they are not - PAS16 compatible. + PAS16 compatible. It is not necessary to enable the separate + Sound Blaster support; it is included in the PAS driver. + If you compile the driver into the kernel, you have to add "pas2=<io>,<irq>,<dma>,<dma2>,<sbio>,<sbirq>,<sbdma>,<sbdma2> to the kernel command line. -100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support -CONFIG_SOUND_SB - Answer Y if you have an original Sound Blaster card made by Creative - Labs or a 100% hardware compatible clone (like the Thunderboard or - SM Games). For an unknown card you may answer Y if the card claims - to be Sound Blaster-compatible. The PAS16 has 8-bit Soundblaster - support, so you can answer Y here for it. - - Please read the file Documentation/sound/Soundblaster. - - If you compile the driver into the kernel and don't want to use isapnp, - you have to add "sb=<io>,<irq>,<dma>,<dma2>" to the kernel command line. - - You can say M here to compile this driver as a module; the module is - called sb.o. - FM Synthesizer (YM3812/OPL-3) support CONFIG_SOUND_YM3812 Answer Y if your card has a FM chip made by Yamaha (OPL2/OPL3/OPL4). @@ -167,7 +145,7 @@ CONFIG_SOUND_TRACEINIT=y CONFIG_SOUND_DMAP=y CONFIG_SOUND_PAS=y -CONFIG_SOUND_SB=y +CONFIG_SOUND_SB=n CONFIG_SOUND_YM3812=m I have also included the following append line in /etc/lilo.conf: Index: README.OSS =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/README.OSS,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- README.OSS 14 Jan 2001 20:05:04 -0000 1.1.1.1 +++ README.OSS 9 Apr 2002 16:55:47 -0000 1.2 @@ -17,6 +17,7 @@ document can be still interesting and very helpful. [ File edited 17.01.1999 - Riccardo Facchetti ] +[ Edited miroSOUND section 19.04.2001 - Robert Siemer ] OSS/Free version 3.8 release notes ---------------------------------- @@ -1325,26 +1326,37 @@ miroSOUND --------- -The miroSOUND PCM12 has been used successfully. This card is based on -the MAD16, OPL4, and CS4231A chips and everything said in the section -about MAD16 cards applies here, too. The only major difference between -the PCM12 and other MAD16 cards is that instead of the mixer in the -CS4231 codec a separate mixer controlled by an on-board 80C32 -microcontroller is used. Control of the mixer takes place via the ACI -(miro's audio control interface) protocol that is implemented in a -separate lowlevel driver. Make sure you compile this ACI driver -together with the normal MAD16 support when you use a miroSOUND PCM12 -card. The ACI mixer is controlled by /dev/mixer and the CS4231 mixer -by /dev/mixer2. You usually don't want to change anything on the -CS4231 mixer. - -The miroSOUND PCM12 is capable of full duplex operation (simultaneous -PCM replay and recording), which allows you to implement nice -real-time signal processing audio effect software and network -telephones. The ACI mixer has to be configured into a special "solo" +The miroSOUND PCM1-pro, PCM12 and PCM20 radio has been used +successfully. These cards are based on the MAD16, OPL4, and CS4231A chips +and everything said in the section about MAD16 cards applies here, +too. The only major difference between the PCMxx and other MAD16 cards +is that instead of the mixer in the CS4231 codec a separate mixer +controlled by an on-board 80C32 microcontroller is used. Control of +the mixer takes place via the ACI (miro's audio control interface) +protocol that is implemented in a separate lowlevel driver. Make sure +you compile this ACI driver together with the normal MAD16 support +when you use a miroSOUND PCMxx card. The ACI mixer is controlled by +/dev/mixer and the CS4231 mixer by /dev/mixer1 (depends on load +time). Only in special cases you want to change something regularly on +the CS4231 mixer. + +The miroSOUND PCM12 and PCM20 radio is capable of full duplex +operation (simultaneous PCM replay and recording), which allows you to +implement nice real-time signal processing audio effect software and +network telephones. The ACI mixer has to be switched into the "solo" mode for duplex operation in order to avoid feedback caused by the -mixer (input hears output signal). See lowlevel/aci.c for details on -the ioctl() for activating the "solo" mode. +mixer (input hears output signal). You can de-/activate this mode +through toggleing the record button for the wave controller with an +OSS-mixer. + +The PCM20 contains a radio tuner, which is also controlled by +ACI. This radio tuner is supported by the ACI driver together with the +miropcm20.o module. Also the 7-band equalizer is integrated +(limited by the OSS-design). Developement has started and maybe +finished for the RDS decoder on this card, too. You will be able to +read RadioText, the Programme Service name, Programme TYpe and +others. Even the v4l radio module benefits from it with a refined +strength value. See aci.[ch] and miropcm20*.[ch] for more details. The following configuration parameters have worked fine for the PCM12 in Markus Kuhn's system, many other configurations might work, too: @@ -1352,13 +1364,8 @@ CONFIG_MAD16_DMA2=0, CONFIG_MAD16_MPU_BASE=0x330, CONFIG_MAD16_MPU_IRQ=10, DSP_BUFFSIZE=65536, SELECTED_SOUND_OPTIONS=0x00281000. -The miroSOUND PCM1 pro and the PCM20 are very similar to the PCM12. -Perhaps the same ACI driver also works for these cards, however this -has never actually been tested. The PCM20 contains a radio tuner, -which is also controlled by ACI. This radio tuner is currently not -supported by the ACI driver, but documentation for it was provided by -miro and ACI tuner support could easily be added if someone is really -interested. +Bas van der Linden is using his PCM1-pro with a configuration that +differs in: CONFIG_MAD16_IRQ=7, CONFIG_MAD16_DMA=1, CONFIG_MAD16_MPU_IRQ=9 Compaq Deskpro XL ----------------- Index: es1370 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/es1370,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- es1370 14 Jan 2001 20:04:46 -0000 1.1.1.1 +++ es1370 9 Apr 2002 16:55:47 -0000 1.2 @@ -1,3 +1,11 @@ +/proc/sound, /dev/sndstat +------------------------- + +/proc/sound and /dev/sndstat is not supported by the +driver. To find out whether the driver succeeded loading, +check the kernel log (dmesg). + + ALaw/uLaw sample formats ------------------------ @@ -59,4 +67,4 @@ Thomas Sailer -s...@if... +t....@al... Index: es1371 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/es1371,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- es1371 14 Jan 2001 20:04:46 -0000 1.1.1.1 +++ es1371 9 Apr 2002 16:55:47 -0000 1.2 @@ -1,3 +1,11 @@ +/proc/sound, /dev/sndstat +------------------------- + +/proc/sound and /dev/sndstat is not supported by the +driver. To find out whether the driver succeeded loading, +check the kernel log (dmesg). + + ALaw/uLaw sample formats ------------------------ @@ -53,4 +61,4 @@ Thomas Sailer -s...@if... +t....@al... Index: solo1 =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/solo1,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- solo1 14 Jan 2001 20:05:08 -0000 1.1.1.1 +++ solo1 9 Apr 2002 16:55:47 -0000 1.2 @@ -1,3 +1,25 @@ +Recording +--------- + +Recording does not work on the author's card, but there +is at least one report of it working on later silicon. +The chip behaves differently than described in the data sheet, +likely due to a chip bug. Working around this would require +the help of ESS (for example by publishing an errata sheet), +but ESS has not done so so far. + +Also, the chip only supports 24 bit addresses for recording, +which means it cannot work on some Alpha mainboards. + + +/proc/sound, /dev/sndstat +------------------------- + +/proc/sound and /dev/sndstat is not supported by the +driver. To find out whether the driver succeeded loading, +check the kernel log (dmesg). + + ALaw/uLaw sample formats ------------------------ @@ -45,4 +67,4 @@ The card has an OPL compatible FM synthesizer. Thomas Sailer -s...@if... +t....@al... Index: sonicvibes =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sound/sonicvibes,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sonicvibes 14 Jan 2001 20:04:46 -0000 1.1.1.1 +++ sonicvibes 9 Apr 2002 16:55:47 -0000 1.2 @@ -1,3 +1,11 @@ +/proc/sound, /dev/sndstat +------------------------- + +/proc/sound and /dev/sndstat is not supported by the +driver. To find out whether the driver succeeded loading, +check the kernel log (dmesg). + + ALaw/uLaw sample formats ------------------------ @@ -70,4 +78,4 @@ Thomas Sailer -s...@if... +t....@al... --- PCM1-pro DELETED --- --- via82cxxx.txt DELETED --- |
From: Andy P. <at...@us...> - 2002-04-09 16:55:53
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/video4linux In directory usw-pr-cvs1:/tmp/cvs-serv7449/video4linux Added Files: Zoran meye.txt w9966.txt Removed Files: README.buz Log Message: synch 2.4.15 commit 28 --- NEW FILE --- DC10/DC10plus/LML33/Buz Driver for Linux ========================================= by Rainer Johanni <Ra...@Jo...> (for Iomega Buz Driver) Adapted for DC10/DC10plus by Wolfgang Scherr <sc...@ne...> Further changes for DC10/DC10plus and LML33 cards by Serguei Miridonov <mi...@ci...> Current homepage: http://www.cicese.mx/~mirsev/Linux/DC10plus/ Current maintainer: Serguei Miridonov <mi...@ci...> This is a driver for DC10plus capture cards from Pinnacle Systems Inc., LML33 cards from Linux Media Labs and Buz from Iomega. It also works with many old Miro DC10 cards with SAA7110A TV decoder and ADV7176 TV encoder (please, make sure that your card has these chips, otherwise the driver will not work). The driver is Video4Linux compliant and contains extensions to provide hardware support for full motion MJPEG compression and decompression. Since this driver is a derivative from the driver for Buz Iomega cards written by Dr. Rainer Johanni, http://www.johanni.de/munich-vision/buz/ they both have compatible API. I hope that this API will become a part of V4L standard. Copyright: This driver is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. Please, check http://www.gnu.org/ for details. No warranty: This software is provided on AN "AS-IS" basis WITHOUT WARRANTY OF ANY KIND. YOU USE IT AT YOUR OWN RISK. CONTENTS ~~~~~~~~ Supported Formats Hardware compression Compiling and Loading the Driver Driver Options Tested applications Programming interface Features for testing Mailing lists Bug Reports Supported Formats ================= Card: DC10/DC10plus LML33/Buz TV standard: NTSC/PAL/SECAM(*) NTSC/PAL Format: Square pixel CCIR.601 640x480 NTSC 720x480 NTSC 768x576 PAL/SECAM(*) 720x576 PAL Frame rates: 30 frames/60 fields per second NTSC 25 frames/50 fields per second PAL/SECAM(*) (*) - SECAM is supported for input only in DC10/DC10plus cards. The output of the recorded SECAM video stream will be in PAL standard. Also, please, note that monitoring of the SECAM input signal at the DC10/DC10plus analog output may not be available. Please, use appropriate application like XawTV to watch full color SECAM video at the card input. Hardware compression ==================== Since the card provides hardware compression, even low end machines can be successfully used for movie capture and playback. I'm testing the driver with with 2.2.16 kernel running on 233 MHz Pentium MMX with 64M RAM on 430TX motherboard and with 10GB IDE drive from Western Digital Corp. On one test run with DC10plus card I've got 0 frames dropped during about 20 minutes of full motion NTSC (I live in Mexico) video capture with fully synchronized audio. The command was lavrec -fa -in -d1 -l -1 -q30 -w /dos/g/capture/Linux/test%03d.avi for recording, and lavplay -n128 /dos/g/capture/Linux/test*.avi for playback. (See lavtools distribution for more information). Typical run of similar test can provide as few as 6-8 dropped frames per half of an hour. You mileage may vary, though. Compiling and Loading the Driver ================================ You should run a 2.2.x kernel in order to use this driver. The driver was also tested with 2.4-test6 kernel, so hopefully it will work with 2.4 kernels too. I would recommend to use only official kernels from www.kernel.org and its mirrors. Kernels supplied with some Linux distributions may be patched in some way to meet specific needs of particular Linux distributor and could be incompatible with this driver. As a driver maintainer, I am not able to follow every unofficial kernel release, and no unofficial kernels will be supported. Besides the files in this directory, the driver needs the 'videodev' and the 'i2c' module from the Linux kernel (i2c-old for 2.4 kernels). In order to get these modules available, enable module support for VIDEODEV and BTTV (which implies i2c) in your 2.2.x kernel configuration. You will find these devices in the menu "Character Devices" in your Kernel Configuration. In newer kernels (2.4) instead of BTTV you should enable support for Iomega Buz cards and for Zoran 36060/36067 chipset. This will include i2c or i2c-old modules and Buz/LML33 driver. However, instead of modules for Buz/LML33 driver from the kernel, use modules from _this_ driver. To compile the driver, just type make. Before you load the driver you must have a video device at major device node 81. If you don't have it yet, do the following (as root!): cd /dev mknod video0 c 81 0 ln -s video0 video If you have more than one card, add more nodes in /dev directory: mknod video1 c 81 1 mknod video2 c 81 2 ... The driver should operate properly with several cards. It was tested with one DC10plus and one LML33 cards installed together and the driver correctly identifies both cards and works with both of them. Currently the driver does not support LML33 and Buz cards installed together in the same system. This will be fixed in future versions. Edit the 'update' script if you want to give the driver special options (see below for options descriptions) and then type (as root) ./update <card_list> to insert all necessary modules into the kernel. <card_list> is a list of cards installed in your system separated by white space. Supported cards are dc10, dc10plus, lml33, and buz. For example, if you have both dc10plus and lml33 cards, please type ./update dc10 lml33 If you want to make full use of the Video for Linux _uncompressed_ grabbing facilities, you must either - obtain and install the "big_physarea patch" for your kernel and set aside the necessary memory during boot time. There seem to be several versions of this patch against various kernel versions floating around in the net, you may obtain one e.g. from: http://www.polyware.nl/~middelin/patch/bigphysarea-2.2.1.tar.gz You also have to compile your driver AFTER installing that patch in order to get it working or - start your kernel with the mem=xxx option, where xxx is your real memory minus the memory needed for the buffers. For doing this add an entry in lilo.conf (if you use lilo): append "mem=xxxM" or add a line in your linux.par file (if you use loadlin): mem=xxxM The second method is by far easier, however it is dangerous if more than one driver at a time has the idea to use the memory leftover by setting the mem=xxx parameter below the actual memory size. Read also below how to use this memory! If you use only MJPEG compressed capture provided by the driver, you should not need large memory areas for DMA. In this case, you will be able to capture and playback movies with lavtools, however you will not be able to use capture features of XawTV and other similar programs (you can still watch video on the screen). Driver Options ============== You are able to customize the behavior of the driver by giving it some options at start time. default_input, default_norm --------------------------- As soon as the driver is loaded, the Buz samples video signals from one of its input ports and displays it on its output. The driver uses the Composite Input and the video norm PAL for this. If you want to change this default behavior, set default_input=1 (for S-VHS input) or default_norm=1 for NTSC or default_norm=2 for SECAM (DC10/DC10plus only). lock_norm --------- This option was introduced to disable norm (TV standard) change by some not well behaving programs. For example, if you have some application which was written by somebody who lives in a country with PAL standard, this program may not have NTSC option and may always try to set the driver to PAL. In this case, you may load the driver with default_norm=1 and lock_norm=1 and the card will be forced to work in NTSC standard only. Options: lock_norm=0 default, TV standard change is enabled; lock_norm=1 TV standard change is disabled but the driver will not notify the application about any error; lock_norm=2 TV standard change is disabled and the driver will notify the program that TV standards other than set by default_norm=X option are not supported. pass_through ------------ When the driver is not in use (device is not opened by any program) and pass_through=0 (default) the driver will set the TV encoder to produce color bar signal at the output. If the driver was loaded with pass_through=1, the color bar will be disabled and input signal will be sent to the output even if the driver not in use. If you have LML33 card and wish the color bar signal at the output, you will also need to set lml33dpath=1 (please, see next section). lml33dpath ---------- LML33 card normally (lml33dpath=0) connects its output to the input using analog switch. Additionally, it also allows real-time monitoring of digitized video using TV monitor connected to the output. This "digital path" option can be enabled setting lml33dpath=1. In this mode, the input is connected only to the TV decoder, digital video data is sent via internal video bus to the TV encoder and resulting analog signal is sent to the output. This mode could be very useful for testing and picture adjustment while watching video at the TV monitor connected to the output. However, because of lack of 75 ohm terminating resistors at TV decoder input, the signal will suffer serious distortions. # These distortions could be eliminated by soldering two 75 ohm resistors # in LML33 card: in parallel to capacitors C73 and C82 (see schematics of # H33 board available at www.linuxmedialabs.com and www.zoran.com). Be # aware, however, that doing so will void card warranty and the card, # after this change, must always be used with loading option lml33dpath=1. # # WARNING: I DID NOT TRY THIS CARD CHANGE YET, THIS IS JUST AN ASSUMPTION # AND I WILL NOT BE RESPONSIBLE FOR ANY DAMAGE ASSOCIATED WITH THIS # CHANGE. IF YOU WISH TO TRY IT, DO IT AT YOUR OWN RISK. Please, note that DC10/DC10plus cards always use "digital path" for signal monitoring. Its input and output are both properly terminated and the digitized signal quality does not depend on the connection of the output load. v4l_nbufs, v4l_bufsize ---------------------- In order to make to make full use of the Video for Linux uncompressed picture grabbing facilities of the driver (which are needed by many Video for Linux applications), the driver needs a set of physically contiguous buffers for grabbing. These parameters determine how many buffers of which size the driver will allocate at open (the open will fail if it is unable to do so!). These values do not affect the MJPEG grabbing facilities of the driver, they are needed for uncompressed image grabbing only!!! v4l_nbufs is the number of buffers to allocate, a value of 2 (the default) should be sufficient in almost all cases. Only special applications (streaming captures) will need more buffers and then mostly the MJPEG capturing features of the Buz will be more appropriate. So leave this parameter at it's default unless you know what you do. The things for v4l_bufsize are more complicated: v4l_bufsize is set by default to 128 [KB] which is the maximum amount of physically contiguous memory Linux is able to allocate without kernel changes. This is sufficient for grabbing 24 bit color images up to sizes of approx. 240x180 pixels (240*180*3 = 129600, 128 KB = 131072). In order to be able to capture bigger images you have either to - obtain and install the "big_physarea patch" and set aside the necessary memory during boot time or - start your kernel with the mem=xxx option, where xxx is your real memory minus the memory needed for the buffers. In that case, useful settings for v4l_bufsize are - 1296 [Kb] for grabbing 24 bit images of max size 768*576 - 1728 [Kb] for 32bit images of same size (4*768*576 = 1728 Kb!) You may reduce these numbers accordingly if you know you are only grabbing 720 pixels wide images or NTSC images (max height 480). In some cases it may happen that Linux isn't even able to obtain the default 128 KB buffers. If you don't need uncompressed image grabbing at all, set v4l_bufsize to an arbitrary small value (e.g. 4) in order to be able to open the video device. triton, natoma -------------- The driver tries to detect if you have a triton or natoma chipset in order to take special measures for these chipsets. If this detection fails but you are sure you have such a chipset, set the corresponding variable to 1. This is a very special option and may go away in the future. Tested applications =================== XawTV to watch video on your computer monitor. kwintv the same (you might need to use option lock_norm=1). lavtools To record and playback AVI or Quicktime files. Note: you will need patched version, lavtools-1.2p2 to support new features of this driver. Please visit driver homepage for more info. Broadcast2000 reportedly (I didn't try that) can accept movies recorded by lavrec in Quicktime format for editing and then edited movie can be played back by lavplay program. MainActor 3.5x also can accept movies recorded by lavrec for editing. The driver can to be used by two programs at the same time (please, see warning note below regarding this feature). Using XawTV you can watch what you are recording or playing back with lavtools. I've tested the following sequence and it worked for me: * start xawtv and switch inputs, TV standards, and adjust video (contrast, saturation, etc.). You may also run your favorite audio mixer application to adjust audio inputs. * run lavrec with options: -i<set your input and norm here> (to choose proper input and TV standard) -l -1 (to use audio mixer settings) Other lavrec option can be added at your choice. * watch the movie in xawtv window while recording it as AVI or Quicktime file. * when recording is finished, run lavplay or xlav and watch your clip in xawtv window. * Note: you should not quit xawtv during recording or playing back. If you quit xawtv during recording or playback, another lavtools program will stop and may even crash. I'm not sure that the same will work for you. You can try but, please, be careful. WARNING! This is an experimental feature and I'm not sure if it will be supported in the future. The original driver was not designed to be used like this and it has no protection against any interference between two running programs. THEREFORE, IT IS POTENTIALLY DANGEROUS AND SINCE THE DRIVER OPERATES IN KERNEL SPACE, USING THIS FEATURE MAY CRASH YOUR ENTIRE SYSTEM. Programming interface ===================== This driver should be fully compliant to Video for Linux, so all tools working with Video for Linux should work with (hopefully) no problems. A description of the Video for Linux programming interface can be found at: http://roadrunner.swansea.linux.org.uk/v4lapi.shtml Besides the Video for Linux interface, the driver has a "proprietary" interface for accessing the Buz's MJPEG capture and playback facilities. For a full description of all members and ioctls see "zoran.h" (used to be buz.h or dc10.h in previous versions, so, please, update your programs accordingly). The ioctls for that interface are as follows: BUZIOC_G_PARAMS BUZIOC_S_PARAMS Get and set the parameters of the buz. The user should always do a BUZIOC_G_PARAMS (with a struct buz_params) to obtain the default settings, change what he likes and then make a BUZIOC_S_PARAMS call. BUZIOC_REQBUFS Before being able to capture/playback, the user has to request the buffers he is wanting to use. Fill the structure zoran_requestbuffers with the size (recommended: 256*1024) and the number (recommended 32 up to 256). There are no such restrictions as for the Video for Linux buffers, you should LEAVE SUFFICIENT MEMORY for your system however, else strange things will happen .... On return, the zoran_requestbuffers structure contains number and size of the actually allocated buffers. You should use these numbers for doing a mmap of the buffers into the user space. The BUZIOC_REQBUFS ioctl also makes it happen, that the next mmap maps the MJPEG buffer instead of the V4L buffers. BUZIOC_QBUF_CAPT BUZIOC_QBUF_PLAY Queue a buffer for capture or playback. The first call also starts streaming capture. When streaming capture is going on, you may only queue further buffers or issue syncs until streaming capture is switched off again with a argument of -1 to a BUZIOC_QBUF_CAPT/BUZIOC_QBUF_PLAY ioctl. BUZIOC_SYNC Issue this ioctl when all buffers are queued. This ioctl will block until the first buffer becomes free for saving its data to disk (after BUZIOC_QBUF_CAPT) or for reuse (after BUZIOC_QBUF_PLAY). BUZIOC_G_STATUS Get the status of the input lines (video source connected/norm). This ioctl may be subject to change. For programming example, please, look at lavrec.c and lavplay.c code in lavtools-1.2p2 package (URL: http://www.cicese.mx/~mirsev/DC10plus/) and the 'examples' directory in the original Buz driver distribution. Additional notes for software developers: The driver returns maxwidth and maxheight parameters according to the current TV standard (norm). Therefore, the software which communicates with the driver and "asks" for these parameters should first set the correct norm. Well, it seems logically correct: TV standard is "more constant" for current country than geometry settings of a variety of TV capture cards which may work in ITU or square pixel format. Remember that users now can lock the norm to avoid any ambiguity. Features for testing ==================== When loaded, the driver creates a /proc/zoranX entry for each card: using 'cat /proc/zoran0' for your first card you can see the contents of ZR36057/67 chip registers. It is also possible to modify the contents of some registers directly. WARNING: modified contents is not stored in the driver memory, if you restart any program which uses this driver or even change position or cause redraw of a window of xawtv or other program, the original registers contents will be restored by the driver. However, it can be used to change ZR36067 registers on the fly for fine tuning and then to include these changes into driver code. This feature is very limited and still requires some documentation. However, if you are impatient, look at zoran_procfs.c code and (IMPORTANT!) read ZR36057/67 manual. To set TopField bit, for example, you need to type as root: echo TopField=1 > /proc/zoranX # change X to 0 for your first card, # 1 for second and so on... If you use this feature and have found some interesting result, please, let me know. Mailing lists ============= There are two mailing lists available to discuss application issues and suggest driver improvements: 1. A mailing list buz-linux was set up to discuss Iomega Buz driver. Since this driver is derivative of that driver, you can also post your questions and suggestions there. Subscribe with a message (with "subscribe" in the subject) to buz...@we.... Unsubscribe with a message (with "unsubscribe" in the subject) to buz...@we.... The mailing list archive can be found at http://buz.webmages.com/list/. 2. Video4Linux mailing list is set for more general discussions related to uncompressed video capture, V4L and V4L2 API, many Video4Linux applications, etc. to subscribe to this mailing list, please, visit https://listman.redhat.com/mailman/listinfo/video4linux-list Bug Reports =========== If you have found a bug, please, do the following: 1. Edit first line of zoran.c file and set DEBUGLEVEL to 3; 2. Recompile the driver and install it running update script in the driver directory; 3. Run the application(s) which you used when you had found a suspisious behavior; 4. When application stops, look at you /var/log/messages file (or whatever file you use to log kernel messages) and copy all lines related to the driver activity to a separate file in the same order of their appearence in your log file. 5. Mail a message to <mi...@ci...> with a subject "Linux DC10(plus)/LML33/Buz driver bug report" with a detailed description of your problem, kernel version, application name and attach that file with kernel messages as plain text (please, don't attach it using base64, uuencode, or any other encoding). If you have a Buz card, please, also mail the same message to Wolfgang Scherr <sc...@ne...> --- NEW FILE --- Vaio Picturebook Motion Eye Camera Driver Readme ------------------------------------------------ Copyright (C) 2001 Stelian Pop <ste...@fr...>, Alcôve Copyright (C) 2000 Andrew Tridgell <tr...@sa...> This driver enable the use of video4linux compatible applications with the Motion Eye camera. This driver requires the "Sony Vaio Programmable I/O Control Device" driver (which can be found in the "Character drivers" section of the kernel configuration utility) to be compiled and installed (using its "camera=1" parameter). It can do at maximum 30 fps @ 320x240 or 15 fps @ 640x480. Grabbing is supported in packed YUV colorspace only. MJPEG hardware grabbing is supported via a private API (see below). Module options: --------------- gbuffers: number of capture buffers, default is 2 (32 max) gbufsize: size of each capture buffer, default is 614400 video_nr: video device to register (0 = /dev/video0, etc) Module use: ----------- In order to automatically load the meye module on use, you can put those lines in your /etc/modules.conf file: alias char-major-81 videodev alias char-major-81-0 meye options meye gbuffers=32 Usage: ------ xawtv >= 3.49 (<http://bytesex.org/xawtv/>) for display and uncompressed video capture: xawtv -c /dev/video0 -geometry 640x480 or xawtv -c /dev/video0 -geometry 320x240 motioneye (<http://www.alcove-labs.org/en/software/meye/>) for getting ppm or jpg snapshots, mjpeg video Private API: ------------ The driver supports frame grabbing with the video4linux API, so all video4linux tools (like xawtv) should work with this driver. Besides the video4linux interface, the driver has a private interface for accessing the Motion Eye extended parameters (camera sharpness, agc, video framerate), the shapshot and the MJPEG capture facilities. This interface consists of several ioctls (prototypes and structures can be found in include/linux/meye.h): MEYEIOC_G_PARAMS MEYEIOC_S_PARAMS Get and set the extended parameters of the motion eye camera. The user should always query the current parameters with MEYEIOC_G_PARAMS, change what he likes and then issue the MEYEIOC_S_PARAMS call (checking for -EINVAL). The extended parameters are described by the meye_params structure. MEYEIOC_QBUF_CAPT Queue a buffer for capture (the buffers must have been obtained with a VIDIOCGMBUF call and mmap'ed by the application). The argument to MEYEIOC_QBUF_CAPT is the buffer number to queue (or -1 to end capture). The first call to MEYEIOC_QBUF_CAPT starts the streaming capture. MEYEIOC_SYNC Takes as an argument the buffer number you want to sync. This ioctl blocks untils the buffer is filled and ready for the application to use. It returns the buffer size. MEYEIOC_STILLCAPT MEYEIOC_STILLJCAPT Takes a snapshot in an uncompressed or compressed jpeg format. This ioctl blocks until the snapshot is done and returns (for jpeg snapshot) the size of the image. The image data is available from the first mmap'ed buffer. Look at the 'motioneye' application code for an actual example. Bugs / Todo: ------------ - overlay output is not supported (although the camera is capable of). (it should not be too hard to to it, provided we found how...) - mjpeg hardware playback doesn't work (depends on overlay...) - rewrite the driver to use some commun video4linux API for snapshot and mjpeg capture. Unfortunately, video4linux1 does not permit it, the BUZ API seems to be targeted to TV cards only. The video4linux 2 API may be an option, if it goes into the kernel (maybe 2.5 material ?). --- NEW FILE --- W9966 Camera driver, written by Jakob Kemi (jak...@po...) Ok, after a lot of work in softice, wdasm, reading pdf-files and trial-and-error work I've finally got everything to work. Since I needed some vision for a robotics project I borrowed this camera from a friend and started hacking. Anyway I've converted my original code from the AVR 8bit RISC C/asm into a working linux driver. I would really appreciate _any_ kind of feedback regarding this driver. To get it working quickly configure your kernel to support parport, ieee1284, video4linux, experimental drivers and w9966 If w9966 is statically linked it will perform aggressive probing for the camera. If built as a module you'll have more configuration options. Options: modprobe w9966.o pardev=parport0(or whatever) parmode=0 (0=auto, 1=ecp, 2=epp) voila! you can also type 'modinfo -p w9966.o' for option usage (or checkout w9966.c) I've only tested it with custom built testprograms (http://hem.fyristorg.com/mogul/w9966.html) and with gqcam. (you'll need to tweak the code to qcam a bit to make it work, dimensions and such) The slow framerate is due to missing DMA ECP read support in the parport drivers. I might add working EPP support later. Good luck! /Jakob --- README.buz DELETED --- |
From: Andy P. <at...@us...> - 2002-04-09 16:55:52
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/sysctl In directory usw-pr-cvs1:/tmp/cvs-serv7449/sysctl Modified Files: kernel.txt vm.txt Log Message: synch 2.4.15 commit 28 Index: kernel.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sysctl/kernel.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- kernel.txt 14 Jan 2001 20:04:35 -0000 1.1.1.1 +++ kernel.txt 9 Apr 2002 16:55:47 -0000 1.2 @@ -39,6 +39,7 @@ - rtsig-max - sg-big-buff [ generic SCSI device (sg) ] - shmmax [ sysv ipc ] +- tainted - version - zero-paged [ PPC only ] @@ -217,6 +218,19 @@ on the maximum shared memory segment size that can be created. Shared memory segments up to 1Gb are now supported in the kernel. This value defaults to SHMMAX. + +============================================================== + +tainted: + +Non-zero if the kernel has been tainted. Numeric values, which +can be ORed together: + + 1 - A module with a non-GPL license has been loaded, this + includes modules with no license. + Set by modutils >= 2.4.9. + 2 - A module was force loaded by insmod -f. + Set by modutils >= 2.4.9. ============================================================== Index: vm.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/sysctl/vm.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- vm.txt 14 Jan 2001 20:04:34 -0000 1.1.1.1 +++ vm.txt 9 Apr 2002 16:55:47 -0000 1.2 @@ -32,33 +32,30 @@ This file controls the operation of the bdflush kernel daemon. The source code to this struct can be found in -linux/mm/buffer.c. It currently contains 9 integer values, -of which 6 are actually used by the kernel. +linux/fs/buffer.c. It currently contains 9 integer values, +of which 4 are actually used by the kernel. From linux/fs/buffer.c: -------------------------------------------------------------- -union bdflush_param{ - struct { - int nfract; /* Percentage of buffer cache dirty to - activate bdflush */ - int ndirty; /* Maximum number of dirty blocks to - write out per wake-cycle */ - int nrefill; /* Number of clean buffers to try to - obtain each time we call refill */ - int nref_dirt; /* Dirty buffer threshold for activating - bdflush when trying to refill buffers. */ - 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 dummy2; /* unused */ - int dummy3; /* unused */ - } b_un; - unsigned int data[N_PARAM]; -} bdf_prm = {{40, 500, 64, 256, 15, 30*HZ, 5*HZ, 1884, 2}}; +union bdflush_param { + struct { + int nfract; /* Percentage of buffer cache dirty to + activate bdflush */ + int dummy1; /* old "ndirty" */ + int dummy2; /* old "nrefill" */ + int dummy3; /* unused */ + int interval; /* jiffies delay between kupdate flushes */ + int age_buffer; /* Time for normal buffer to age */ + int nfract_sync;/* Percentage of buffer cache dirty to + activate bdflush synchronously */ + int dummy4; /* unused */ + int dummy5; /* unused */ + } b_un; + unsigned int data[N_PARAM]; +} bdf_prm = {{30, 64, 64, 256, 5*HZ, 30*HZ, 60, 0, 0}}; -------------------------------------------------------------- +int nfract: The first parameter governs the maximum number of dirty buffers in the buffer cache. Dirty means that the contents of the buffer still have to be written to disk (as opposed @@ -66,32 +63,31 @@ Setting this to a high value means that Linux can delay disk writes for a long time, but it also means that it will have to do a lot of I/O at once when memory becomes short. A low -value will spread out disk I/O more evenly. - -The second parameter (ndirty) gives the maximum number of -dirty buffers that bdflush can write to the disk in one time. -A high value will mean delayed, bursty I/O, while a small -value can lead to memory shortage when bdflush isn't woken -up often enough... - -The third parameter (nrefill) is the number of buffers that -bdflush will add to the list of free buffers when -refill_freelist() is called. It is necessary to allocate free -buffers beforehand, since the buffers often are of a different -size than memory pages and some bookkeeping needs to be done -beforehand. The higher the number, the more memory will be -wasted and the less often refill_freelist() will need to run. - -When refill_freelist() comes across more than nref_dirt dirty -buffers, it will wake up bdflush. - -Finally, the age_buffer and age_super parameters govern the -maximum time Linux waits before writing out a dirty buffer -to disk. The value is expressed in jiffies (clockticks), the -number of jiffies per second is 100, except on Alpha machines -(1024). Age_buffer is the maximum age for data blocks, while -age_super is for filesystem metadata. - +value will spread out disk I/O more evenly, at the cost of +more frequent I/O operations. The default value is 30%, +the minimum is 0%, and the maximum is 100%. + +int interval: +The fifth parameter, interval, is the minimum rate at +which kupdate will wake and flush. The value is expressed in +jiffies (clockticks), the number of jiffies per second is +normally 100 (Alpha is 1024). Thus, x*HZ is x seconds. The +default value is 5 seconds, the minimum is 0 seconds, and the +maximum is 600 seconds. + +int age_buffer: +The sixth parameter, age_buffer, governs the maximum time +Linux waits before writing out a dirty buffer to disk. The +value is in jiffies. The default value is 30 seconds, +the minimum is 1 second, and the maximum 6,000 seconds. + +int nfract_sync: +The seventh parameter, nfract_sync, governs the percentage +of buffer cache that is dirty before bdflush activates +synchronously. This can be viewed as the hard limit before +bdflush forces buffers to disk. The default is 60%, the +minimum is 0%, and the maximum is 100%. + ============================================================== buffermem: |
From: Andy P. <at...@us...> - 2002-04-09 16:55:51
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/powerpc In directory usw-pr-cvs1:/tmp/cvs-serv7449/powerpc Modified Files: ppc_htab.txt smp.txt sound.txt zImage_layout.txt Log Message: synch 2.4.15 commit 28 Index: ppc_htab.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/powerpc/ppc_htab.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ppc_htab.txt 14 Jan 2001 20:04:22 -0000 1.1.1.1 +++ ppc_htab.txt 9 Apr 2002 16:55:46 -0000 1.2 @@ -2,7 +2,7 @@ ===================================================================== This document and the related code was written by me (Cort Dougan), please -email me (co...@cs...) if you have questions, comments or corrections. +email me (co...@fs...) if you have questions, comments or corrections. Last Change: 2.16.98 Index: smp.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/powerpc/smp.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- smp.txt 14 Jan 2001 20:04:24 -0000 1.1.1.1 +++ smp.txt 9 Apr 2002 16:55:46 -0000 1.2 @@ -2,7 +2,7 @@ ===================================================================== This document and the related code was written by me -(Cort Dougan, co...@cs...) please email me if you have questions, +(Cort Dougan, co...@fs...) please email me if you have questions, comments or corrections. Last Change: 3.31.99 Index: sound.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/powerpc/sound.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sound.txt 14 Jan 2001 20:04:23 -0000 1.1.1.1 +++ sound.txt 9 Apr 2002 16:55:46 -0000 1.2 @@ -1,7 +1,7 @@ Information about PowerPC Sound support ===================================================================== -Please mail me (Cort Dougan, co...@cs...) if you have questions, +Please mail me (Cort Dougan, co...@fs...) if you have questions, comments or corrections. Last Change: 6.16.99 Index: zImage_layout.txt =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/powerpc/zImage_layout.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- zImage_layout.txt 14 Jan 2001 20:04:24 -0000 1.1.1.1 +++ zImage_layout.txt 9 Apr 2002 16:55:46 -0000 1.2 @@ -1,7 +1,7 @@ Information about the Linux/PPC kernel images ===================================================================== -Please mail me me (Cort Dougan, co...@cs...) if you have questions, +Please mail me (Cort Dougan, co...@fs...) if you have questions, comments or corrections. This document is meant to answer several questions I've had about how |
From: Andy P. <at...@us...> - 2002-04-09 16:55:51
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/power In directory usw-pr-cvs1:/tmp/cvs-serv7449/power Added Files: pci.txt Log Message: synch 2.4.15 commit 28 --- NEW FILE --- PCI Power Management ~~~~~~~~~~~~~~~~~~~~ An overview of the concepts and the related functions in the Linux kernel Patrick Mochel <mo...@tr...> --------------------------------------------------------------------------- 1. Overview 2. How the PCI Subsystem Does Power Management 3. PCI Utility Functions 4. PCI Device Drivers 5. Resources 1. Overview ~~~~~~~~~~~ The PCI Power Management Specification was introduced between the PCI 2.1 and PCI 2.2 Specifications. It a standard interface for controlling various power management operations. Implementation of the PCI PM Spec is optional, as are several sub-components of it. If a device supports the PCI PM Spec, the device will have an 8 byte capability field in its PCI configuration space. This field is used to describe and control the standard PCI power management features. The PCI PM spec defines 4 operating states for devices (D0 - D3) and for buses (B0 - B3). The higher the number, the less power the device consumes. However, the higher the number, the longer the latency is for the device to return to an operational state (D0). Bus power management is not covered in this version of this document. Note that all PCI devices support D0 and D3 by default, regardless of whether or not they implement any of the PCI PM spec. The possible state transitions that a device can undergo are: +---------------------------+ | Current State | New State | +---------------------------+ | D0 | D1, D2, D3| +---------------------------+ | D1 | D2, D3 | +---------------------------+ | D2 | D3 | +---------------------------+ | D1, D2, D3 | D0 | +---------------------------+ Note that when the system is entering a global suspend state, all devices will be placed into D3 and when resuming, all devices will be placed into D0. However, when the system is running, other state transitions are possible. 2. How The PCI Subsystem Handles Power Management ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The PCI suspend/resume functionality is accessed indirectly via the Power Management subsystem. At boot, the PCI driver registers a power management callback with that layer. Upon entering a suspend state, the PM layer iterates through all of its registered callbacks. This currently takes place only during APM state transitions. Upon going to sleep, the PCI subsystem walks its device tree twice. Both times, it does a depth first walk of the device tree. The first walk saves each of the device's state and checks for devices that will prevent the system from entering a global power state. The next walk then places the devices in a low power state. The first walk allows a graceful recovery in the event of a failure, since none of the devices have actually been powered down. In both walks, in particular the second, all children of a bridge are touched before the actual bridge itself. This allows the bridge to retain power while its children are being accessed. Upon resuming from sleep, just the opposite must be true: all bridges must be powered on and restored before their children are powered on. This is easily accomplished with a breadth-first walk of the PCI device tree. 3. PCI Utility Functions ~~~~~~~~~~~~~~~~~~~~~~~~ These are helper functions designed to be called by individual device drivers. Assuming that a device behaves as advertised, these should be applicable in most cases. However, results may vary. Note that these functions are never implicitly called for the driver. The driver is always responsible for deciding when and if to call these. pci_save_state -------------- Usage: pci_save_state(dev, buffer); Description: Save first 64 bytes of PCI config space. Buffer must be allocated by caller. pci_restore_state ----------------- Usage: pci_restore_state(dev,buffer); Description: Restore previously saved config space. (First 64 bytes only); If buffer is NULL, then restore what information we know about the device from bootup: BARs and interrupt line. pci_set_power_state ------------------- Usage: pci_set_power_state(dev,state); Description: Transition device to low power state using PCI PM Capabilities registers. Will fail under one of the following conditions: - If state is less than current state, but not D0 (illegal transition) - Device doesn't support PM Capabilities - Device does not support requested state pci_enable_wake --------------- Usage: pci_enable_wake(dev,state,enable); Description: Enable device to generate PME# during low power state using PCI PM Capabilities. Checks whether if device supports generating PME# from requested state and fail if it does not, unless enable == 0 (request is to disable wake events, which is implicit if it doesn't even support it in the first place). Note that the PMC Register in the device's PM Capabilties has a bitmask of the states it supports generating PME# from. D3hot is bit 3 and D3cold is bit 4. So, while a value of 4 as the state may not seem semantically correct, it is. 4. PCI Device Drivers ~~~~~~~~~~~~~~~~~~~~~ These functions are intended for use by individual drivers, and are defined in struct pci_driver: int (*save_state) (struct pci_dev *dev, u32 state); int (*suspend)(struct pci_dev *dev, u32 state); int (*resume) (struct pci_dev *dev); int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); save_state ---------- Usage: if (dev->driver && dev->driver->save_state) dev->driver->save_state(dev,state); The driver should use this callback to save device state. It should take into account the current state of the device and the requested state in order to avoid any unnecessary operations. For example, a video card that supports all 4 states (D0-D3), all controller context is preserved when entering D1, but the screen is placed into a low power state (blanked). The driver can also interpret this function as a notification that it may be entering a sleep state in the near future. If it knows that the device cannot enter the requested state, either because of lack of support for it, or because the devices is middle of some critical operation, then it should fail. This function should not be used to set any state in the device or the driver because the device may not actually enter the sleep state (e.g. another driver later causes causes a global state transition to fail). Note that in intermediate low power states, a device's I/O and memory spaces may be disabled and may not be available in subsequent transitions to lower power states. suspend ------- Usage: if (dev->driver && dev->driver->suspend) dev->driver->suspend(dev,state); A driver uses this function to actually transition the device into a low power state. This may include disabling I/O, memory and bus-mastering, as well as physically transitioning the device to a lower power state. Bus mastering may be disabled by doing: pci_disable_device(dev); For devices that support the PCI PM Spec, this may be used to set the device's power state: pci_set_power_state(dev,state); The driver is also responsible for disabling any other device-specific features (e.g blanking screen, turning off on-card memory, etc). The driver should be sure to track the current state of the device, as it may obviate the need for some operations. The driver should update the current_state field in its pci_dev structure in this function. resume ------ Usage: if (dev->driver && dev->driver->suspend) dev->driver->resume(dev) The resume callback may be called from any power state, and is always meant to transition the device to the D0 state. The driver is responsible for reenabling any features of the device that had been disabled during previous suspend calls and restoring all state that was saved in previous save_state calls. If the device is currently in D3, it must be completely reinitialized, as it must be assumed that the device has lost all of its context (even that of its PCI config space). For almost all current drivers, this means that the initialization code that the driver does at boot must be separated out and called again from the resume callback. Note that some values for the device may not have to be probed for this time around if they are saved before entering the low power state. If the device supports the PCI PM Spec, it can use this to physically transition the device to D0: pci_set_power_state(dev,0); Note that if the entire system is transitioning out of a global sleep state, all devices will be placed in the D0 state, so this is not necessary. However, in the event that the device is placed in the D3 state during normal operation, this call is necessary. It is impossible to determine which of the two events is taking place in the driver, so it is always a good idea to make that call. The driver should take note of the state that it is resuming from in order to ensure correct (and speedy) operation. The driver should update the current_state field in its pci_dev structure in this function. enable_wake ----------- Usage: if (dev->driver && dev->driver->enable_wake) dev->driver->enable_wake(dev,state,enable); This callback is generally only relevant for devices that support the PCI PM spec and have the ability to generate a PME# (Power Management Event Signal) to wake the system up. (However, it is possible that a device may support some non-standard way of generating a wake event on sleep.) Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's PM Capabilties describe what power states the device supports generating a wake event from: +------------------+ | Bit | State | +------------------+ | 15 | D0 | | 14 | D1 | | 13 | D2 | | 12 | D3hot | | 11 | D3cold | +------------------+ A device can use this to enable wake events: pci_enable_wake(dev,state,enable); Note that to enable PME# from D3cold, a value of 4 should be passed to pci_enable_wake (since it uses an index into a bitmask). If a driver gets a request to enable wake events from D3, two calls should be made to pci_enable_wake (one for both D3hot and D3cold). 5. Resources ~~~~~~~~~~~~ PCI Local Bus Specification PCI Bus Power Management Interface Specification http://pcisig.org |
From: Andy P. <at...@us...> - 2002-04-09 16:55:51
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/parisc In directory usw-pr-cvs1:/tmp/cvs-serv7449/parisc Modified Files: registers Removed Files: mm Log Message: synch 2.4.15 commit 28 Index: registers =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/Documentation/parisc/registers,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- registers 14 Jan 2001 20:07:05 -0000 1.1.1.1 +++ registers 9 Apr 2002 16:55:46 -0000 1.2 @@ -16,17 +16,17 @@ CR11 as specified by ABI CR14 (interruption vector) initialized to fault_vector CR15 (EIEM) initialized to all ones* -CR16 (Interval Timer) timer interrupt +CR16 (Interval Timer) read for cycle count/write starts Interval Tmr CR17-CR22 interruption parameters -CR23 (EIRR) read for pending interrupts +CR23 (EIRR) read for pending interrupts/write clears bits CR24 (TR 0) Kernel Space Page Directory Pointer CR25 (TR 1) User Space Page Directory Pointer -CR26 (TR 2) -CR27 (TR 3) -CR28 (TR 4) used by interruption handlers -CR29 (TR 5) used by interruption handlers +CR26 (TR 2) not used +CR27 (TR 3) Thread descriptor pointer +CR28 (TR 4) not used +CR29 (TR 5) not used CR30 (TR 6) current / 0 -CR31 (TR 7) used by interruption handlers +CR31 (TR 7) Temporary register, used in various places Space Registers (kernel mode) --- mm DELETED --- |
From: Andy P. <at...@us...> - 2002-04-09 16:55:50
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/mips In directory usw-pr-cvs1:/tmp/cvs-serv7449/mips Added Files: GT64120.README time.README Log Message: synch 2.4.15 commit 28 --- NEW FILE --- README for arch/mips/gt64120 directory and subdirectories Jun Sun, js...@mv... or js...@ju... 01/27, 2001 MOTIVATION ---------- Many MIPS boards share the same system controller (or CPU companian chip), such as GT-64120. It is highly desirable to let these boards share the same controller code instead of duplicating them. This directory is meant to hold all MIPS boards that use GT-64120 or GT-64120A. HOW TO ADD A BOARD ------------------ . Create a subdirectory include/asm/gt64120/<board>. . Create a file called gt64120_dep.h under that directory. . Modify include/asm/gt64120/gt64120.h file to include the new gt64120_dep.h based on config options. The board-dep section is at the end of include/asm/gt64120/gt64120.h file. There you can find all required definitions include/asm/gt64120/<board>/gt64120_dep.h file must supply. . Create a subdirectory arch/mips/gt64120/<board> directory to hold board specific routines. . The GT-64120 common code is supplied under arch/mips/gt64120/common directory. It includes: 1) arch/mips/gt64120/pci.c - common PCI routine, include the top-level pcibios_init() 2) arch/mips/gt64120/irq.c - common IRQ routine, include the top-level do_IRQ() [This part really belongs to arch/mips/kernel. jsun] 3) arch/mips/gt64120/gt_irq.c - common IRQ routines for GT-64120 chip. Currently it only handles the timer interrupt. . Board-specific routines are supplied under arch/mips/gt64120/<board> dir. 1) arch/mips/gt64120/<board>/pci.c - it provides bus fixup routine 2) arch/mips/gt64120/<board>/irq.c - it provides enable/disable irqs and board irq setup routine (irq_setup) 3) arch/mips/gt64120/<board>/int-handler.S - The first-level interrupt dispatching routine. 4) a bunch of other "normal" stuff (setup, prom, dbg_io, reset, etc) . Follow other "normal" procedure to modify configuration files, etc. TO-DO LIST ---------- . Expand arch/mips/gt64120/gt_irq.c to handle all GT-64120 interrupts. We probably need to introduce GT_IRQ_BASE in board-dep header file, which is used the starting irq_nr for all GT irqs. A function, gt64120_handle_irq(), will be added so that the first-level irq dispatcher will call this function if it detects an interrupt from GT-64120. . More support for GT-64120 PCI features (2nd PCI bus, perhaps) --- NEW FILE --- README for MIPS time services Jun Sun js...@mv... or js...@ju... ABOUT ----- This file describes the new arch/mips/kernel/time.c, related files and the services they provide. If you are short in patience and just want to know how to use time.c for a new board or convert an existing board, go to the last section. FILES, COMPATABILITY AND CONFIGS --------------------------------- The old arch/mips/kernel/time.c is renamed to old-time.c. A new time.c is put there, together with include/asm-mips/time.h. Two configs variables are introduced, CONFIG_OLD_TIME_C and CONFIG_NEW_TIME_C. So we allow boards using 1) old time.c (CONFIG_OLD_TIME_C) 2) new time.c (CONFIG_NEW_TIME_C) 3) neither (their own private time.c) However, it is expected every board will move to the new time.c in the near future. WHAT THE NEW CODE PROVIDES? --------------------------- The new time code provide the following services: a) Implements functions required by Linux common code: time_init do_gettimeofday do_settimeofday b) provides an abstraction of RTC and null RTC implementation as default. extern unsigned long (*rtc_get_time)(void); extern int (*rtc_set_time)(unsigned long); c) a set of gettimeoffset functions for different CPUs and different needs. d) high-level and low-level timer interrupt routines where the timer interrupt source may or may not be the CPU timer. The high-level routine is dispatched through do_IRQ() while the low-level is dispatched in assemably code (usually int-handler.S) WHAT THE NEW CODE REQUIRES? --------------------------- For the new code to work properly, each board implementation needs to supply the following functions or values: a) board_time_init - a function pointer. Invoked at the beginnig of time_init(). It is optional. 1. (optional) set up RTC routines 2. (optional) calibrate and set the mips_counter_frequency b) board_timer_setup - a function pointer. Invoked at the end of time_init() 1. (optional) over-ride any decisions made in time_init() 2. set up the irqaction for timer interrupt. 3. enable the timer interrupt c) (optional) board-specific RTC routines. d) (optional) mips_counter_frequency - It must be definied if the board is using CPU counter for timer interrupt or it is using fixed rate gettimeoffset(). PORTING GUIDE ------------- Step 1: decide how you like to implement the time services. a) does this board have a RTC? If yes, implement the two RTC funcs. b) does the CPU have counter/compare registers? If the answer is no, you need a timer to provide the timer interrupt at 100 HZ speed. You cannot use the fast gettimeoffset functions, i.e., unsigned long fixed_rate_gettimeoffset(void); unsigned long calibrate_div32_gettimeoffset(void); unsigned long calibrate_div64_gettimeoffset(void); You can use null_gettimeoffset() will gives the same time resolution as jiffy. Or you can implement your own gettimeoffset (probably based on some ad hoc hardware on your machine.) c) The following sub steps assume your CPU has counter register. Do you plan to use the CPU counter register as the timer interrupt or use an exnternal timer? In order to CPU counter register as the timer interrupt source, you must know the counter speed (mips_counter_frequency). It is usually the same as the CPU speed (Or it is ALWAYS the same?) d) decide on whether you want to use high-level or low-level timer interrupt routines. The low-level one is presumably faster, but should not make too mcuh difference. Step 2: the machine setup() function If you supply board_time_init(), set the function poointer. Set the function pointer board_timer_setup() (mandatory) Step 3: implement rtc routines, board_time_init() and board_timer_setup() if needed. board_time_init() - a) (optional) set up RTC routines, b) (optional) calibrate and set the mips_counter_frequency (only needed if you intended to use fixed_rate_gettimeoffset or use cpu counter as timer interrupt source) board_timer_setup() - a) (optional) over-write any choices made above by time_init(). b) machine specific code should setup the timer irqaction. c) enable the timer interrupt If the RTC chip is a common chip, I suggest the routines are put under arch/mips/libs. For example, for DS1386 chip, one would create rtc-ds1386.c under arch/mips/lib directory. Add the following line to the arch/mips/lib/Makefile: obj-$(CONFIG_DDB5476) += rtc-ds1386.o Step 4: if you are using low-level timer interrupt, change your interrupt dispathcing code to check for timer interrupt and jump to ll_timer_interrupt() directly if one is detected. Step 5: Modify arch/mips/config.in and add CONFIG_NEW_TIME_C to your machine. Modify the appropriate defconfig if applicable. Final notes: For some tricky cases, you may need to add your own wrapper functions for some of the functions in time.c. For example, you may define your own timer interrupt routine, which does its own processing and in turn calls timer_interrupt(). You can also over-ride any of the built-in functions (gettimeoffset, RTC routines and/or timer interrupt routine). |
From: Andy P. <at...@us...> - 2002-04-09 16:55:49
|
Update of /cvsroot/linux-vax/kernel-2.4/Documentation/mips/pci In directory usw-pr-cvs1:/tmp/cvs-serv7449/mips/pci Added Files: pci.README Log Message: synch 2.4.15 commit 28 --- NEW FILE --- Pete Popov, pp...@pa... 07/11/2001 This README briefly explains how to use the pci and pci_auto code in arch/mips/kernel. The code was ported from PowerPC and modified slightly. It has been tested pretty well on PPC on some rather complex systems with multiple bridges and devices behind each bridge. However, at the time this README was written, the mips port was tested only on boards with a single pci bus and no P2P bridges. It's very possible that on boards with P2P bridges some modifications have to be made. The code will evolve, no doubt, but currently every single mips board is doing its own pcibios thing and it has become a big mess. This generic pci code is meant to clean up the mips pci mess and make it easier to add pci support to new boards. arch/mips/kernel/pci_auto.c has the pci bus enumeration code. This code scans the pci bus(es) and assigns all of the resources. Thus, you don't need the boot code to that, and many boot codes don't do it correctly anyway. To enable the pci_auto code, add define_bool CONFIG_PCI_AUTO y inside the define for your board in arch/mips/config.in. For example, the Galileo EV96100 board looks like this: if [ "$CONFIG_MIPS_EV96100" = "y" ]; then define_bool CONFIG_PCI y define_bool CONFIG_MIPS_GT96100 y define_bool CONFIG_NEW_PCI y define_bool CONFIG_PCI_AUTO y define_bool CONFIG_SWAP_IO_SPACE y fi Next, if you want to use the arch/mips/kernel/pci code, which has the pcibios_init() function, add define_bool CONFIG_NEW_PCI y inside the define for your board. Again, the EV96100 example above show NEW_PCI turned on. Note that you can enable CONFIG_NEW_PCI code without enabling CONFIG_PCI_AUTO. But you can't do the opposite because the pci_auto routines are called from pcibios_init(), which is part of the CONFIG_NEW_PCI code. Now you need to add your files to hook in your pci configuration cycles. Usually you'll need only a couple of files named something like pci_fixups.c and pci_ops.c. You can copy the templates provided and fill in the code. The file pci_ops.c should contain the pci configuration cycles routines. It also has the mips_pci_channels[] array which contains the descriptors of each pci controller. The file pci_fixups.c contains a few routines to do interrupt fixups, resources fixups, and, if needed, pci bios fixups. Usually you'll put your pci_fixups.c file in your board specific directory, since the functions in that file are board specific. The functions in pci_ops.c, on the other hand, are usually pci controller specific so that file could be shared among a few different boards using the same pci controller. |
From: Andy P. <at...@us...> - 2002-04-09 16:38:56
|
Update of /cvsroot/linux-vax/kernel-2.4/scripts/cramfs In directory usw-pr-cvs1:/tmp/cvs-serv4925/cramfs Modified Files: GNUmakefile mkcramfs.c Added Files: cramfsck.c Log Message: synch 2.4.15 commit 26 --- NEW FILE --- /* * cramfsck - check a cramfs file system * * Copyright (C) 2000-2001 Transmeta Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * 1999/12/03: Linus Torvalds (cramfs tester and unarchive program) * 2000/06/03: Daniel Quinlan (CRC and length checking program) * 2000/06/04: Daniel Quinlan (merged programs, added options, support * for special files, preserve permissions and * ownership, cramfs superblock v2, bogus mode * test, pathname length test, etc.) * 2000/06/06: Daniel Quinlan (support for holes, pretty-printing, * symlink size test) * 2000/07/11: Daniel Quinlan (file length tests, start at offset 0 or 512, * fsck-compatible exit codes) * 2000/07/15: Daniel Quinlan (initial support for block devices) */ /* compile-time options */ #define INCLUDE_FS_TESTS /* include cramfs checking and extraction */ #include <sys/types.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> #include <sys/mman.h> #include <sys/fcntl.h> #include <dirent.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <assert.h> #include <getopt.h> #include <sys/sysmacros.h> #include <utime.h> #include <sys/ioctl.h> #define _LINUX_STRING_H_ #include <linux/fs.h> #include <linux/cramfs_fs.h> #include <zlib.h> static const char *progname = "cramfsck"; static int fd; /* ROM image file descriptor */ static char *filename; /* ROM image filename */ struct cramfs_super *super; /* just find the cramfs superblock once */ static int opt_verbose = 0; /* 1 = verbose (-v), 2+ = very verbose (-vv) */ #ifdef INCLUDE_FS_TESTS static int opt_extract = 0; /* extract cramfs (-x) */ char *extract_dir = NULL; /* extraction directory (-x) */ unsigned long start_inode = 1 << 28; /* start of first non-root inode */ unsigned long end_inode = 0; /* end of the directory structure */ unsigned long start_data = 1 << 28; /* start of the data (256 MB = max) */ unsigned long end_data = 0; /* end of the data */ /* true? cramfs_super < start_inode < end_inode <= start_data <= end_data */ static uid_t euid; /* effective UID */ #define PAD_SIZE 512 #define PAGE_CACHE_SIZE (4096) /* Guarantee access to at least 8kB at a time */ #define ROMBUFFER_BITS 13 #define ROMBUFFERSIZE (1 << ROMBUFFER_BITS) #define ROMBUFFERMASK (ROMBUFFERSIZE-1) static char read_buffer[ROMBUFFERSIZE * 2]; static unsigned long read_buffer_block = ~0UL; /* Uncompressing data structures... */ static char outbuffer[PAGE_CACHE_SIZE*2]; z_stream stream; #endif /* INCLUDE_FS_TESTS */ /* Input status of 0 to print help and exit without an error. */ static void usage(int status) { FILE *stream = status ? stderr : stdout; fprintf(stream, "usage: %s [-hv] [-x dir] file\n" " -h print this help\n" " -x dir extract into dir\n" " -v be more verbose\n" " file file to test\n", progname); exit(status); } #ifdef INCLUDE_FS_TESTS void print_node(char type, struct cramfs_inode *i, char *name) { char info[10]; if (S_ISCHR(i->mode) || (S_ISBLK(i->mode))) { /* major/minor numbers can be as high as 2^12 or 4096 */ snprintf(info, 10, "%4d,%4d", major(i->size), minor(i->size)); } else { /* size be as high as 2^24 or 16777216 */ snprintf(info, 10, "%9d", i->size); } printf("%c %04o %s %5d:%-3d %s\n", type, i->mode & ~S_IFMT, info, i->uid, i->gid, name); } /* * Create a fake "blocked" access */ static void *romfs_read(unsigned long offset) { unsigned int block = offset >> ROMBUFFER_BITS; if (block != read_buffer_block) { read_buffer_block = block; lseek(fd, block << ROMBUFFER_BITS, SEEK_SET); read(fd, read_buffer, ROMBUFFERSIZE * 2); } return read_buffer + (offset & ROMBUFFERMASK); } static struct cramfs_inode *cramfs_iget(struct cramfs_inode * i) { struct cramfs_inode *inode = malloc(sizeof(struct cramfs_inode)); *inode = *i; return inode; } static struct cramfs_inode *iget(unsigned int ino) { return cramfs_iget(romfs_read(ino)); } void iput(struct cramfs_inode *inode) { free(inode); } /* * Return the offset of the root directory, * or 0 if none. */ static struct cramfs_inode *read_super(void) { unsigned long offset; offset = super->root.offset << 2; if (super->magic != CRAMFS_MAGIC) return NULL; if (memcmp(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)) != 0) return NULL; if (offset < sizeof(super)) return NULL; return cramfs_iget(&super->root); } static int uncompress_block(void *src, int len) { int err; stream.next_in = src; stream.avail_in = len; stream.next_out = (unsigned char *) outbuffer; stream.avail_out = PAGE_CACHE_SIZE*2; inflateReset(&stream); err = inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { fprintf(stderr, "%s: error %d while decompressing! %p(%d)\n", filename, err, src, len); exit(4); } return stream.total_out; } static void change_file_status(char *path, struct cramfs_inode *i) { struct utimbuf epoch = { 0, 0 }; if (euid == 0) { if (lchown(path, i->uid, i->gid) < 0) { perror(path); exit(8); } if (S_ISLNK(i->mode)) return; if ((S_ISUID | S_ISGID) & i->mode) { if (chmod(path, i->mode) < 0) { perror(path); exit(8); } } } if (S_ISLNK(i->mode)) return; if (utime(path, &epoch) < 0) { perror(path); exit(8); } } static void do_symlink(char *path, struct cramfs_inode *i) { unsigned long offset = i->offset << 2; unsigned long curr = offset + 4; unsigned long next = *(u32 *) romfs_read(offset); unsigned long size; if (next > end_data) { end_data = next; } size = uncompress_block(romfs_read(curr), next - curr); if (size != i->size) { fprintf(stderr, "%s: size error in symlink `%s'\n", filename, path); exit(4); } outbuffer[size] = 0; if (opt_verbose) { char *str; str = malloc(strlen(outbuffer) + strlen(path) + 5); strcpy(str, path); strncat(str, " -> ", 4); strncat(str, outbuffer, size); print_node('l', i, str); if (opt_verbose > 1) { printf(" uncompressing block at %ld to %ld (%ld)\n", curr, next, next - curr); } } if (opt_extract) { symlink(outbuffer, path); change_file_status(path, i); } } static void do_special_inode(char *path, struct cramfs_inode *i) { dev_t devtype = 0; char type; if (S_ISCHR(i->mode)) { devtype = i->size; type = 'c'; } else if (S_ISBLK(i->mode)) { devtype = i->size; type = 'b'; } else if (S_ISFIFO(i->mode)) type = 'p'; else if (S_ISSOCK(i->mode)) type = 's'; else { fprintf(stderr, "%s: bogus mode on `%s' (%o)\n", filename, path, i->mode); exit(4); } if (opt_verbose) { print_node(type, i, path); } if (opt_extract) { if (mknod(path, i->mode, devtype) < 0) { perror(path); exit(8); } change_file_status(path, i); } } static void do_uncompress(int fd, unsigned long offset, unsigned long size) { unsigned long curr = offset + 4 * ((size + PAGE_CACHE_SIZE - 1) / PAGE_CACHE_SIZE); do { unsigned long out = PAGE_CACHE_SIZE; unsigned long next = *(u32 *) romfs_read(offset); if (next > end_data) { end_data = next; } offset += 4; if (curr == next) { if (opt_verbose > 1) { printf(" hole at %ld (%d)\n", curr, PAGE_CACHE_SIZE); } if (size < PAGE_CACHE_SIZE) out = size; memset(outbuffer, 0x00, out); } else { if (opt_verbose > 1) { printf(" uncompressing block at %ld to %ld (%ld)\n", curr, next, next - curr); } out = uncompress_block(romfs_read(curr), next - curr); } if (size >= PAGE_CACHE_SIZE) { if (out != PAGE_CACHE_SIZE) { fprintf(stderr, "%s: Non-block (%ld) bytes\n", filename, out); exit(4); } } else { if (out != size) { fprintf(stderr, "%s: Non-size (%ld vs %ld) bytes\n", filename, out, size); exit(4); } } size -= out; if (opt_extract) { write(fd, outbuffer, out); } curr = next; } while (size); } static void expand_fs(int pathlen, char *path, struct cramfs_inode *inode) { if (S_ISDIR(inode->mode)) { int count = inode->size; unsigned long offset = inode->offset << 2; char *newpath = malloc(pathlen + 256); if (count > 0 && offset < start_inode) { start_inode = offset; } /* XXX - need to check end_inode for empty case? */ memcpy(newpath, path, pathlen); newpath[pathlen] = '/'; pathlen++; if (opt_verbose) { print_node('d', inode, path); } if (opt_extract) { mkdir(path, inode->mode); change_file_status(path, inode); } while (count > 0) { struct cramfs_inode *child = iget(offset); int size; int newlen = child->namelen << 2; size = sizeof(struct cramfs_inode) + newlen; count -= size; offset += sizeof(struct cramfs_inode); memcpy(newpath + pathlen, romfs_read(offset), newlen); newpath[pathlen + newlen] = 0; if ((pathlen + newlen) - strlen(newpath) > 3) { fprintf(stderr, "%s: invalid cramfs--bad path length\n", filename); exit(4); } expand_fs(strlen(newpath), newpath, child); offset += newlen; if (offset > end_inode) { end_inode = offset; } } return; } if (S_ISREG(inode->mode)) { int fd = 0; unsigned long offset = inode->offset << 2; if (offset > 0 && offset < start_data) { start_data = offset; } if (opt_verbose) { print_node('f', inode, path); } if (opt_extract) { fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, inode->mode); } if (inode->size) { do_uncompress(fd, offset, inode->size); } if (opt_extract) { close(fd); change_file_status(path, inode); } return; } if (S_ISLNK(inode->mode)) { unsigned long offset = inode->offset << 2; if (offset < start_data) { start_data = offset; } do_symlink(path, inode); return; } else { do_special_inode(path, inode); return; } } #endif /* INCLUDE_FS_TESTS */ int main(int argc, char **argv) { void *buf; size_t length; struct stat st; u32 crc_old, crc_new; #ifdef INCLUDE_FS_TESTS struct cramfs_inode *root; #endif /* INCLUDE_FS_TESTS */ int c; /* for getopt */ int start = 0; if (argc) progname = argv[0]; /* command line options */ while ((c = getopt(argc, argv, "hx:v")) != EOF) { switch (c) { case 'h': usage(0); case 'x': #ifdef INCLUDE_FS_TESTS opt_extract = 1; extract_dir = malloc(strlen(optarg) + 1); strcpy(extract_dir, optarg); break; #else /* not INCLUDE_FS_TESTS */ fprintf(stderr, "%s: compiled without -x support\n", progname); exit(16); #endif /* not INCLUDE_FS_TESTS */ case 'v': opt_verbose++; break; } } if ((argc - optind) != 1) usage(16); filename = argv[optind]; /* find the physical size of the file or block device */ if (lstat(filename, &st) < 0) { perror(filename); exit(8); } fd = open(filename, O_RDONLY); if (fd < 0) { perror(filename); exit(8); } if (S_ISBLK(st.st_mode)) { if (ioctl(fd, BLKGETSIZE, &length) < 0) { fprintf(stderr, "%s: warning--unable to determine filesystem size \n", filename); exit(4); } length = length * 512; } else if (S_ISREG(st.st_mode)) { length = st.st_size; } else { fprintf(stderr, "%s is not a block device or file\n", filename); exit(8); } if (length < sizeof(struct cramfs_super)) { fprintf(stderr, "%s: invalid cramfs--file length too short\n", filename); exit(4); } if (S_ISBLK(st.st_mode)) { /* nasty because mmap of block devices fails */ buf = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); read(fd, buf, length); } else { /* nice and easy */ buf = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); } /* XXX - this could be cleaner... */ if (((struct cramfs_super *) buf)->magic == CRAMFS_MAGIC) { start = 0; super = (struct cramfs_super *) buf; } else if (length >= (PAD_SIZE + sizeof(struct cramfs_super)) && ((((struct cramfs_super *) (buf + PAD_SIZE))->magic == CRAMFS_MAGIC))) { start = PAD_SIZE; super = (struct cramfs_super *) (buf + PAD_SIZE); } else { fprintf(stderr, "%s: invalid cramfs--wrong magic\n", filename); exit(4); } if (super->flags & CRAMFS_FLAG_FSID_VERSION_2) { /* length test */ if (length < super->size) { fprintf(stderr, "%s: invalid cramfs--file length too short\n", filename); exit(4); } else if (length > super->size) { fprintf(stderr, "%s: warning--file length too long, padded image?\n", filename); } /* CRC test */ crc_old = super->fsid.crc; super->fsid.crc = crc32(0L, Z_NULL, 0); crc_new = crc32(0L, Z_NULL, 0); crc_new = crc32(crc_new, (unsigned char *) buf+start, super->size - start); if (crc_new != crc_old) { fprintf(stderr, "%s: invalid cramfs--crc error\n", filename); exit(4); } } else { fprintf(stderr, "%s: warning--old cramfs image, no CRC\n", filename); } #ifdef INCLUDE_FS_TESTS super = (struct cramfs_super *) malloc(sizeof(struct cramfs_super)); if (((struct cramfs_super *) buf)->magic == CRAMFS_MAGIC) { memcpy(super, buf, sizeof(struct cramfs_super)); } else if (length >= (PAD_SIZE + sizeof(struct cramfs_super)) && ((((struct cramfs_super *) (buf + PAD_SIZE))->magic == CRAMFS_MAGIC))) { memcpy(super, (buf + PAD_SIZE), sizeof(struct cramfs_super)); } munmap(buf, length); /* file format test, uses fake "blocked" accesses */ root = read_super(); umask(0); euid = geteuid(); if (!root) { fprintf(stderr, "%s: invalid cramfs--bad superblock\n", filename); exit(4); } stream.next_in = NULL; stream.avail_in = 0; inflateInit(&stream); if (!extract_dir) { extract_dir = "root"; } expand_fs(strlen(extract_dir), extract_dir, root); inflateEnd(&stream); if (start_data != 1 << 28 && end_inode != start_data) { fprintf(stderr, "%s: invalid cramfs--directory data end (%ld) != file data start (%ld)\n", filename, end_inode, start_data); exit(4); } if (super->flags & CRAMFS_FLAG_FSID_VERSION_2) { if (end_data > super->size) { fprintf(stderr, "%s: invalid cramfs--invalid file data offset\n", filename); exit(4); } } #endif /* INCLUDE_FS_TESTS */ exit(0); } Index: GNUmakefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/cramfs/GNUmakefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- GNUmakefile 14 Jan 2001 19:57:59 -0000 1.1.1.1 +++ GNUmakefile 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,7 +1,8 @@ -CFLAGS = -Wall -O2 -CPPFLAGS = -I../../fs/cramfs +CC = gcc +CFLAGS = -W -Wall -O2 -g +CPPFLAGS = -I../../include LDLIBS = -lz -PROGS = mkcramfs +PROGS = mkcramfs cramfsck all: $(PROGS) Index: mkcramfs.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/cramfs/mkcramfs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- mkcramfs.c 14 Jan 2001 19:57:59 -0000 1.1.1.1 +++ mkcramfs.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,3 +1,23 @@ +/* + * mkcramfs - make a cramfs file system + * + * Copyright (C) 1999-2001 Transmeta Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include <sys/types.h> #include <stdio.h> #include <sys/stat.h> @@ -9,43 +29,58 @@ #include <errno.h> #include <string.h> #include <assert.h> - -/* zlib required.. */ +#include <getopt.h> +#include <linux/cramfs_fs.h> #include <zlib.h> -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; - -#include "cramfs.h" +#define PAD_SIZE 512 /* only 0 and 512 supported by kernel */ static const char *progname = "mkcramfs"; /* N.B. If you change the disk format of cramfs, please update fs/cramfs/README. */ -static void usage(void) +/* Input status of 0 to print help and exit without an error. */ +static void usage(int status) { - fprintf(stderr, "Usage: '%s dirname outfile'\n" - " where <dirname> is the root of the\n" - " filesystem to be compressed.\n", progname); - exit(1); -} + FILE *stream = status ? stderr : stdout; -/* - * If DO_HOLES is defined, then mkcramfs can create explicit holes in the - * data, which saves 26 bytes per hole (which is a lot smaller a saving than - * most filesystems). - * - * Note that kernels up to at least 2.3.39 don't support cramfs holes, which - * is why this defaults to undefined at the moment. - */ -/* #define DO_HOLES 1 */ + fprintf(stream, "usage: %s [-h] [-e edition] [-i file] [-n name] dirname outfile\n" + " -h print this help\n" + " -E make all warnings errors (non-zero exit status)\n" + " -e edition set edition number (part of fsid)\n" + " -i file insert a file image into the filesystem (requires >= 2.4.0)\n" + " -n name set name of cramfs filesystem\n" + " -p pad by %d bytes for boot code\n" + " -s sort directory entries (old option, ignored)\n" + " -z make explicit holes (requires >= 2.3.39)\n" + " dirname root of the filesystem to be compressed\n" + " outfile output file\n", progname, PAD_SIZE); + + exit(status); +} #define PAGE_CACHE_SIZE (4096) /* The kernel assumes PAGE_CACHE_SIZE as block size. */ static unsigned int blksize = PAGE_CACHE_SIZE; +static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */ +static int image_length = 0; + +/* + * If opt_holes is set, then mkcramfs can create explicit holes in the + * data, which saves 26 bytes per hole (which is a lot smaller a + * saving than most most filesystems). + * + * Note that kernels up to at least 2.3.39 don't support cramfs holes, + * which is why this is turned off by default. + */ +static int opt_edition = 0; +static int opt_errors = 0; +static int opt_holes = 0; +static int opt_pad = 0; +static char *opt_image = NULL; +static char *opt_name = NULL; -static int warn_dev, warn_gid, warn_namelen, warn_size, warn_uid; +static int warn_dev, warn_gid, warn_namelen, warn_skip, warn_size, warn_uid; #ifndef MIN # define MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b)) @@ -70,15 +105,6 @@ }; /* - * Width of various bitfields in struct cramfs_inode. - * Used only to generate warnings. - */ -#define SIZE_WIDTH 24 -#define UID_WIDTH 16 -#define GID_WIDTH 8 -#define OFFSET_WIDTH 26 - -/* * The longest file name component to allow for in the input directory tree. * Ext2fs (and many others) allow up to 255 bytes. A couple of filesystems * allow longer (e.g. smbfs 1024), but there isn't much use in supporting @@ -101,45 +127,60 @@ static void eliminate_doubles(struct entry *root,struct entry *orig) { if(orig) { - if(orig->size && orig->uncompressed) + if(orig->size && orig->uncompressed) find_identical_file(root,orig); eliminate_doubles(root,orig->child); eliminate_doubles(root,orig->next); } } +/* + * We define our own sorting function instead of using alphasort which + * uses strcoll and changes ordering based on locale information. + */ +static int cramsort (const void *a, const void *b) +{ + return strcmp ((*(const struct dirent **) a)->d_name, + (*(const struct dirent **) b)->d_name); +} + static unsigned int parse_directory(struct entry *root_entry, const char *name, struct entry **prev, loff_t *fslen_ub) { - DIR *dir; - int count = 0, totalsize = 0; - struct dirent *dirent; + struct dirent **dirlist; + int totalsize = 0, dircount, dirindex; char *path, *endpath; size_t len = strlen(name); - dir = opendir(name); - if (!dir) { - perror(name); - exit(2); - } - /* Set up the path. */ /* TODO: Reuse the parent's buffer to save memcpy'ing and duplication. */ path = malloc(len + 1 + MAX_INPUT_NAMELEN + 1); if (!path) { perror(NULL); - exit(1); + exit(8); } memcpy(path, name, len); endpath = path + len; *endpath = '/'; endpath++; - while ((dirent = readdir(dir)) != NULL) { + /* read in the directory and sort */ + dircount = scandir(name, &dirlist, 0, cramsort); + + if (dircount < 0) { + perror(name); + exit(8); + } + + /* process directory */ + for (dirindex = 0; dirindex < dircount; dirindex++) { + struct dirent *dirent; struct entry *entry; struct stat st; int size; size_t namelen; + dirent = dirlist[dirindex]; + /* Ignore "." and ".." - we won't be adding them to the archive */ if (dirent->d_name[0] == '.') { if (dirent->d_name[1] == '\0') @@ -155,23 +196,24 @@ "Very long (%u bytes) filename `%s' found.\n" " Please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile. Exiting.\n", namelen, dirent->d_name); - exit(1); + exit(8); } memcpy(endpath, dirent->d_name, namelen + 1); if (lstat(path, &st) < 0) { perror(endpath); + warn_skip = 1; continue; } entry = calloc(1, sizeof(struct entry)); if (!entry) { perror(NULL); - exit(5); + exit(8); } entry->name = strdup(dirent->d_name); if (!entry->name) { perror(NULL); - exit(1); + exit(8); } if (namelen > 255) { /* Can't happen when reading from ext2fs. */ @@ -184,10 +226,10 @@ entry->mode = st.st_mode; entry->size = st.st_size; entry->uid = st.st_uid; - if (entry->uid >= 1 << UID_WIDTH) + if (entry->uid >= 1 << CRAMFS_UID_WIDTH) warn_uid = 1; entry->gid = st.st_gid; - if (entry->gid >= 1 << GID_WIDTH) + if (entry->gid >= 1 << CRAMFS_GID_WIDTH) /* TODO: We ought to replace with a default gid instead of truncating; otherwise there are security problems. Maybe mode should @@ -211,18 +253,19 @@ int fd = open(path, O_RDONLY); if (fd < 0) { perror(path); + warn_skip = 1; continue; } if (entry->size) { - if ((entry->size >= 1 << SIZE_WIDTH)) { + if ((entry->size >= 1 << CRAMFS_SIZE_WIDTH)) { warn_size = 1; - entry->size = (1 << SIZE_WIDTH) - 1; + entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1; } entry->uncompressed = mmap(NULL, entry->size, PROT_READ, MAP_PRIVATE, fd, 0); if (-1 == (int) (long) entry->uncompressed) { perror("mmap"); - exit(5); + exit(8); } } close(fd); @@ -230,63 +273,69 @@ entry->uncompressed = malloc(entry->size); if (!entry->uncompressed) { perror(NULL); - exit(5); + exit(8); } if (readlink(path, entry->uncompressed, entry->size) < 0) { perror(path); + warn_skip = 1; continue; } + } else if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) { + /* maybe we should skip sockets */ + entry->size = 0; } else { entry->size = st.st_rdev; - if (entry->size & -(1<<SIZE_WIDTH)) + if (entry->size & -(1<<CRAMFS_SIZE_WIDTH)) warn_dev = 1; } if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { + int blocks = ((entry->size - 1) / blksize + 1); + /* block pointers & data expansion allowance + data */ - if(entry->size) - *fslen_ub += ((4+26)*((entry->size - 1) / blksize + 1) - + MIN(entry->size + 3, st.st_blocks << 9)); - else - *fslen_ub += MIN(entry->size + 3, st.st_blocks << 9); + if(entry->size) + *fslen_ub += (4+26)*blocks + entry->size + 3; } /* Link it into the list */ *prev = entry; prev = &entry->next; - count++; totalsize += size; } - closedir(dir); free(path); + free(dirlist); /* allocated by scandir() with malloc() */ return totalsize; } -static void set_random(void *area, size_t size) -{ - int fd = open("/dev/random", O_RDONLY); - - if (fd >= 0) { - if (read(fd, area, size) == size) - return; - } - memset(area, 0x00, size); -} - /* Returns sizeof(struct cramfs_super), which includes the root inode. */ -static unsigned int write_superblock(struct entry *root, char *base) +static unsigned int write_superblock(struct entry *root, char *base, int size) { struct cramfs_super *super = (struct cramfs_super *) base; - unsigned int offset = sizeof(struct cramfs_super); + unsigned int offset = sizeof(struct cramfs_super) + image_length; + + if (opt_pad) { + offset += opt_pad; + } super->magic = CRAMFS_MAGIC; - super->flags = 0; - /* Note: 0x10000 is meaningless, which is a bug; but - super->size is never used anyway. */ - super->size = 0x10000; + super->flags = CRAMFS_FLAG_FSID_VERSION_2 | CRAMFS_FLAG_SORTED_DIRS; + if (opt_holes) + super->flags |= CRAMFS_FLAG_HOLES; + if (image_length > 0) + super->flags |= CRAMFS_FLAG_SHIFTED_ROOT_OFFSET; + super->size = size; memcpy(super->signature, CRAMFS_SIGNATURE, sizeof(super->signature)); - set_random(super->fsid, sizeof(super->fsid)); - strncpy(super->name, "Compressed", sizeof(super->name)); + + super->fsid.crc = crc32(0L, Z_NULL, 0); + super->fsid.edition = opt_edition; + super->fsid.blocks = total_blocks; + super->fsid.files = total_nodes; + + memset(super->name, 0x00, sizeof(super->name)); + if (opt_name) + strncpy(super->name, opt_name, sizeof(super->name)); + else + strncpy(super->name, "Compressed", sizeof(super->name)); super->root.mode = root->mode; super->root.uid = root->uid; @@ -300,10 +349,12 @@ static void set_data_offset(struct entry *entry, char *base, unsigned long offset) { struct cramfs_inode *inode = (struct cramfs_inode *) (base + entry->dir_offset); +#ifdef DEBUG assert ((offset & 3) == 0); - if (offset >= (1 << (2 + OFFSET_WIDTH))) { +#endif /* DEBUG */ + if (offset >= (1 << (2 + CRAMFS_OFFSET_WIDTH))) { fprintf(stderr, "filesystem too big. Exiting.\n"); - exit(1); + exit(8); } inode->offset = (offset >> 2); } @@ -337,6 +388,7 @@ write over inode->offset later. */ offset += sizeof(struct cramfs_inode); + total_nodes++; /* another node */ memcpy(base + offset, entry->name, len); /* Pad up the name to a 4-byte boundary */ while (len & 3) { @@ -354,7 +406,7 @@ if (entry->child) { if (stack_entries >= MAXENTRIES) { fprintf(stderr, "Exceeded MAXENTRIES. Raise this value in mkcramfs.c and recompile. Exiting.\n"); - exit(1); + exit(8); } entry_stack[stack_entries] = entry; stack_entries++; @@ -393,26 +445,24 @@ return offset; } -#ifdef DO_HOLES -/* - * Returns non-zero iff the first LEN bytes from BEGIN are all NULs. - */ -static int -is_zero(char const *begin, unsigned len) +static int is_zero(char const *begin, unsigned len) { - return (len-- == 0 || - (begin[0] == '\0' && - (len-- == 0 || - (begin[1] == '\0' && - (len-- == 0 || - (begin[2] == '\0' && - (len-- == 0 || - (begin[3] == '\0' && - memcmp(begin, begin + 4, len) == 0)))))))); -} -#else /* !DO_HOLES */ -# define is_zero(_begin,_len) (0) /* Never create holes. */ -#endif /* !DO_HOLES */ + if (opt_holes) + /* Returns non-zero iff the first LEN bytes from BEGIN are + all NULs. */ + return (len-- == 0 || + (begin[0] == '\0' && + (len-- == 0 || + (begin[1] == '\0' && + (len-- == 0 || + (begin[2] == '\0' && + (len-- == 0 || + (begin[3] == '\0' && + memcmp(begin, begin + 4, len) == 0)))))))); + else + /* Never create holes. */ + return 0; +} /* * One 4-byte pointer per block and then the actual blocked @@ -433,6 +483,8 @@ unsigned long curr = offset + 4 * blocks; int change; + total_blocks += blocks; + do { unsigned long len = 2 * blksize; unsigned int input = size; @@ -448,7 +500,7 @@ if (len > blksize*2) { /* (I don't think this can happen with zlib.) */ printf("AIEEE: block \"compressed\" to > 2*blocklength (%ld)\n", len); - exit(1); + exit(8); } *(u32 *) (base + offset) = curr; @@ -493,6 +545,27 @@ return offset; } +static unsigned int write_file(char *file, char *base, unsigned int offset) +{ + int fd; + char *buf; + + fd = open(file, O_RDONLY); + if (fd < 0) { + perror(file); + exit(8); + } + buf = mmap(NULL, image_length, PROT_READ, MAP_PRIVATE, fd, 0); + memcpy(base + offset, buf, image_length); + munmap(buf, image_length); + close (fd); + /* Pad up the image_length to a 4-byte boundary */ + while (image_length & 3) { + *(base + offset + image_length) = '\0'; + image_length++; + } + return (offset + image_length); +} /* * Maximum size fs you can create is roughly 256MB. (The last file's @@ -501,9 +574,9 @@ * Note that if you want it to fit in a ROM then you're limited to what the * hardware and kernel can support (64MB?). */ -#define MAXFSLEN ((((1 << OFFSET_WIDTH) - 1) << 2) /* offset */ \ - + (1 << SIZE_WIDTH) - 1 /* filesize */ \ - + (1 << SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ ) +#define MAXFSLEN ((((1 << CRAMFS_OFFSET_WIDTH) - 1) << 2) /* offset */ \ + + (1 << CRAMFS_SIZE_WIDTH) - 1 /* filesize */ \ + + (1 << CRAMFS_SIZE_WIDTH) * 4 / PAGE_CACHE_SIZE /* block pointers */ ) /* @@ -517,41 +590,88 @@ */ int main(int argc, char **argv) { - struct stat st; + struct stat st; /* used twice... */ struct entry *root_entry; char *rom_image; - unsigned int offset; - ssize_t written; + ssize_t offset, written; int fd; - loff_t fslen_ub = 0; /* initial guess (upper-bound) of - required filesystem size */ - char const *dirname; + /* initial guess (upper-bound) of required filesystem size */ + loff_t fslen_ub = sizeof(struct cramfs_super); + char const *dirname, *outfile; + u32 crc = crc32(0L, Z_NULL, 0); + int c; /* for getopt */ + + total_blocks = 0; if (argc) progname = argv[0]; - if (argc != 3) - usage(); - if (stat(dirname = argv[1], &st) < 0) { - perror(argv[1]); - exit(1); + /* command line options */ + while ((c = getopt(argc, argv, "hEe:i:n:psz")) != EOF) { + switch (c) { + case 'h': + usage(0); + case 'E': + opt_errors = 1; + break; + case 'e': + opt_edition = atoi(optarg); + break; + case 'i': + opt_image = optarg; + if (lstat(opt_image, &st) < 0) { + perror(opt_image); + exit(16); + } + image_length = st.st_size; /* may be padded later */ + fslen_ub += (image_length + 3); /* 3 is for padding */ + break; + case 'n': + opt_name = optarg; + break; + case 'p': + opt_pad = PAD_SIZE; + fslen_ub += PAD_SIZE; + break; + case 's': + /* old option, ignored */ + break; + case 'z': + opt_holes = 1; + break; + } + } + + if ((argc - optind) != 2) + usage(16); + dirname = argv[optind]; + outfile = argv[optind + 1]; + + if (stat(dirname, &st) < 0) { + perror(dirname); + exit(16); } - fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0666); + fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); root_entry = calloc(1, sizeof(struct entry)); if (!root_entry) { perror(NULL); - exit(5); + exit(8); } root_entry->mode = st.st_mode; root_entry->uid = st.st_uid; root_entry->gid = st.st_gid; - root_entry->size = parse_directory(root_entry, argv[1], &root_entry->child, &fslen_ub); + root_entry->size = parse_directory(root_entry, dirname, &root_entry->child, &fslen_ub); + + /* always allocate a multiple of blksize bytes because that's + what we're going to write later on */ + fslen_ub = ((fslen_ub - 1) | (blksize - 1)) + 1; + if (fslen_ub > MAXFSLEN) { fprintf(stderr, - "warning: guestimate of required size (upper bound) is %luMB, but maximum image size is %uMB. We might die prematurely.\n", - (unsigned long) (fslen_ub >> 20), + "warning: guestimate of required size (upper bound) is %LdMB, but maximum image size is %uMB. We might die prematurely.\n", + fslen_ub >> 20, MAXFSLEN >> 20); fslen_ub = MAXFSLEN; } @@ -560,7 +680,6 @@ possible. */ eliminate_doubles(root_entry,root_entry); - /* TODO: Why do we use a private/anonymous mapping here followed by a write below, instead of just a shared mapping and a couple of ftruncate calls? Is it just to save us @@ -570,13 +689,25 @@ RAM free. If the reason is to be able to write to un-mmappable block devices, then we could try shared mmap and revert to anonymous mmap if the shared mmap fails. */ - rom_image = mmap(NULL, fslen_ub, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + rom_image = mmap(NULL, fslen_ub?fslen_ub:1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (-1 == (int) (long) rom_image) { perror("ROM image map"); - exit(1); + exit(8); + } + + /* Skip the first opt_pad bytes for boot loader code */ + offset = opt_pad; + memset(rom_image, 0x00, opt_pad); + + /* Skip the superblock and come back to write it later. */ + offset += sizeof(struct cramfs_super); + + /* Insert a file image. */ + if (opt_image) { + printf("Including: %s\n", opt_image); + offset = write_file(opt_image, rom_image, offset); } - offset = write_superblock(root_entry, rom_image); - printf("Super block: %d bytes\n", offset); offset = write_directory_structure(root_entry->child, rom_image, offset); printf("Directory data: %d bytes\n", offset); @@ -588,14 +719,30 @@ offset = ((offset - 1) | (blksize - 1)) + 1; printf("Everything: %d kilobytes\n", offset >> 10); + /* Write the superblock now that we can fill in all of the fields. */ + write_superblock(root_entry, rom_image+opt_pad, offset); + printf("Super block: %d bytes\n", sizeof(struct cramfs_super)); + + /* Put the checksum in. */ + crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad)); + ((struct cramfs_super *) (rom_image+opt_pad))->fsid.crc = crc; + printf("CRC: %x\n", crc); + + /* Check to make sure we allocated enough space. */ + if (fslen_ub < offset) { + fprintf(stderr, "not enough space allocated for ROM image (%Ld allocated, %d used)\n", + fslen_ub, offset); + exit(8); + } + written = write(fd, rom_image, offset); if (written < 0) { - perror("rom image"); - exit(1); + perror("ROM image"); + exit(8); } if (offset != written) { fprintf(stderr, "ROM image write failed (%d %d)\n", written, offset); - exit(1); + exit(8); } /* (These warnings used to come at the start, but they scroll off the @@ -603,22 +750,27 @@ if (warn_namelen) /* (can't happen when reading from ext2fs) */ fprintf(stderr, /* bytes, not chars: think UTF8. */ "warning: filenames truncated to 255 bytes.\n"); + if (warn_skip) + fprintf(stderr, "warning: files were skipped due to errors.\n"); if (warn_size) fprintf(stderr, "warning: file sizes truncated to %luMB (minus 1 byte).\n", - 1L << (SIZE_WIDTH - 20)); + 1L << (CRAMFS_SIZE_WIDTH - 20)); if (warn_uid) /* (not possible with current Linux versions) */ fprintf(stderr, "warning: uids truncated to %u bits. (This may be a security concern.)\n", - UID_WIDTH); + CRAMFS_UID_WIDTH); if (warn_gid) fprintf(stderr, "warning: gids truncated to %u bits. (This may be a security concern.)\n", - GID_WIDTH); + CRAMFS_GID_WIDTH); if (warn_dev) fprintf(stderr, "WARNING: device numbers truncated to %u bits. This almost certainly means\n" "that some device files will be wrong.\n", - OFFSET_WIDTH); + CRAMFS_OFFSET_WIDTH); + if (opt_errors && + (warn_namelen||warn_skip||warn_size||warn_uid||warn_gid||warn_dev)) + exit(8); return 0; } |
From: Andy P. <at...@us...> - 2002-04-09 16:38:55
|
Update of /cvsroot/linux-vax/kernel-2.4/scripts/lxdialog In directory usw-pr-cvs1:/tmp/cvs-serv4925/lxdialog Modified Files: checklist.c Log Message: synch 2.4.15 commit 26 Index: checklist.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/lxdialog/checklist.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- checklist.c 25 Feb 2001 23:15:23 -0000 1.1.1.2 +++ checklist.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -211,13 +211,15 @@ status[i+scroll], i, i == choice); } - wnoutrefresh (list); - print_arrows(dialog, choice, item_no, scroll, box_y, box_x + check_x + 5, list_height); print_buttons(dialog, height, width, 0); + wnoutrefresh (list); + wnoutrefresh (dialog); + doupdate (); + while (key != ESC) { key = wgetch (dialog); @@ -355,7 +357,11 @@ case ESC: break; } + + /* Now, update everything... */ + doupdate (); } + delwin (dialog); free (status); |
From: Andy P. <at...@us...> - 2002-04-09 16:38:55
|
Update of /cvsroot/linux-vax/kernel-2.4/scripts In directory usw-pr-cvs1:/tmp/cvs-serv4925 Modified Files: Configure Lindent Menuconfig checkconfig.pl docgen docproc.c header.tk kernel-doc mkdep.c patch-kernel split-include.c tkgen.c ver_linux Added Files: mkspec mkversion Log Message: synch 2.4.15 commit 26 --- NEW FILE --- #!/bin/sh # # Output a simple RPM spec file that uses no fancy features requring # RPM v4. This is intended to work with any RPM distro. # # The only gothic bit here is redefining install_post to avoid # stripping the symbols from files in the kernel which we want # echo "Name: kernel" echo "Summary: The Linux Kernel" echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//" # we need to determine the NEXT version number so that uname and # rpm -q will agree echo "Release: `. scripts/mkversion`" echo "License: GPL" echo "Group: System Environment/Kernel" echo "Vendor: The Linux Community" echo "URL: http://www.kernel.org" echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL" echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//" echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root" echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :" echo "" echo "%description" echo "The Linux Kernel, the operating system core itself" echo "" echo "%prep" echo "%setup -q" echo "" echo "%build" echo "make oldconfig dep clean bzImage modules" echo "" echo "%install" echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install' echo 'cp arch/i386/boot/bzImage $RPM_BUILD_ROOT'"/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" echo "" echo "%clean" echo '#echo -rf $RPM_BUILD_ROOT' echo "" echo "%files" echo '%defattr (-, root, root)' echo "%dir /lib/modules" echo "/lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION" echo "/boot/*" echo "" --- NEW FILE --- if [ ! -f .version ] then echo 1 else expr 0`cat .version` + 1 fi Index: Configure =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/Configure,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Configure 14 Jan 2001 19:57:20 -0000 1.1.1.1 +++ Configure 9 Apr 2002 16:38:51 -0000 1.2 @@ -92,6 +92,7 @@ /^#/b /^[^ ]/q + /<file:\\([^>]*\\)>/s//\\1/g p }" Documentation/Configure.help) if [ -z "$text" ] Index: Lindent =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/Lindent,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Lindent 25 Feb 2001 23:15:23 -0000 1.1.1.1 +++ Lindent 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,2 +1,2 @@ -#!/bin/bash -indent -kr -i8 -ts8 -br -ce -bap -sob -l80 -pcs -cs -ss -bs -di1 -nbc -lp -psl $@ +#!/bin/sh +indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl "$@" Index: Menuconfig =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/Menuconfig,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Menuconfig 14 Jan 2001 19:57:39 -0000 1.1.1.1 +++ Menuconfig 9 Apr 2002 16:38:51 -0000 1.2 @@ -347,7 +347,7 @@ echo -e " function $firstchoice () \ - { l_choice '$title' \"$choices\" $current ;}" >>MCradiolists + { l_choice '$title' \"$choices\" \"$current\" ;}" >>MCradiolists } } # END load_functions() @@ -376,6 +376,7 @@ /^#/b /^[^ ]/q s/^ // + /<file:\\([^>]*\\)>/s//\\1/g p }" Documentation/Configure.help) @@ -1334,7 +1335,7 @@ then echo -e "\n\007Your display is too small to run Menuconfig!" echo "It must be at least 19 lines by 80 columns." - exit 0 + exit 1 fi ROWS=$((ROWS-4)) COLS=$((COLS-5)) Index: checkconfig.pl =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/checkconfig.pl,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- checkconfig.pl 25 Feb 2001 23:15:23 -0000 1.1.1.2 +++ checkconfig.pl 9 Apr 2002 16:38:51 -0000 1.2 @@ -25,6 +25,13 @@ $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next); m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1))); + # Pick up definitions. + if ( m/^\s*#/o ) + { + $iLinuxConfig = $. if m/^\s*#\s*include\s*"linux\/config\.h"/o; + $configList{uc $1} = 1 if m/^\s*#\s*include\s*"config\/(\S*)\.h"/o; + } + # Strip strings. $fInString && (s+^.*?"+ +o ? ($fInString = 0) : next); m+"+o && (s+".*?"+ +go, (s+".*$+ +o && ($fInString = 1))); @@ -52,7 +59,7 @@ # Report superfluous includes. if ( $iLinuxConfig && ! $fUseConfig ) - { print "$file: $iLinuxConfig: <linux/config.h> not needed.\n"; } + { print "$file: $iLinuxConfig: linux/config.h not needed.\n"; } close(FILE); } Index: docgen =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/docgen,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- docgen 14 Jan 2001 19:57:43 -0000 1.1.1.1 +++ docgen 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,3 +1,10 @@ #!/bin/sh -X=`$TOPDIR/scripts/gen-all-syms "$*"` -$TOPDIR/scripts/docproc $X +set -e +if [ -z "$scripts_objtree" ] +then + X=`$TOPDIR/scripts/gen-all-syms "$*"` + $TOPDIR/scripts/docproc $X +else + X=`${scripts_objtree}gen-all-syms "$*"` + TOPDIR=. ${scripts_objtree}docproc $X +fi Index: docproc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/docproc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- docproc.c 14 Jan 2001 19:57:43 -0000 1.1.1.1 +++ docproc.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -18,6 +18,7 @@ char type[64]; int i; int vp=2; + int ret=0; pid_t pid; @@ -96,8 +97,8 @@ perror("exec scripts/kernel-doc"); exit(1); default: - waitpid(pid, NULL,0); + waitpid(pid, &ret ,0); } } - exit(0); + exit(ret); } Index: header.tk =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/header.tk,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- header.tk 14 Jan 2001 19:57:23 -0000 1.1.1.1 +++ header.tk 9 Apr 2002 16:38:51 -0000 1.2 @@ -466,6 +466,7 @@ /^#/b /^\[^ \]/q s/^ // + /<file:\\(\[^>\]*\\)>/s//\\1/g p } " Documentation/Configure.help] Index: kernel-doc =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/kernel-doc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- kernel-doc 14 Jan 2001 19:57:46 -0000 1.1.1.1 +++ kernel-doc 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,16 +1,42 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w + +use strict; ## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## -## Copyright (C) 2000 Tim Waugh <tw...@re...> ## +## Copyright (C) 2000, 1 Tim Waugh <tw...@re...> ## +## Copyright (C) 2001 Simon Huggins ## +## ## +## #define enhancements by Armin Kuster <ak...@mv...> ## [...1633 lines suppressed...] } elsif ($state == 4) { # Documentation block @@ -953,7 +1630,7 @@ $contents = ""; $function = ""; %constants = (); - %parameters = (); + %parameterdescs = (); %parametertypes = (); @parameterlist = (); %sections = (); @@ -973,7 +1650,7 @@ $contents = ""; $function = ""; %constants = (); - %parameters = (); + %parameterdescs = (); %parametertypes = (); @parameterlist = (); %sections = (); Index: mkdep.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/mkdep.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- mkdep.c 14 Jan 2001 19:57:41 -0000 1.1.1.1 +++ mkdep.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -2,7 +2,7 @@ * Originally by Linus Torvalds. * Smart CONFIG_* processing by Werner Almesberger, Michael Chastain. * - * Usage: mkdep file ... + * Usage: mkdep cflags -- file ... * * Read source files and output makefile dependency lines for them. * I make simple dependency lines for #include <*.h> and #include "*.h". @@ -22,10 +22,17 @@ * 2.3.99-pre1, Andrew Morton <an...@uo...> * - Changed so that 'filename.o' depends upon 'filename.[cS]'. This is so that * missing source files are noticed, rather than silently ignored. + * + * 2.4.2-pre3, Keith Owens <ka...@oc...> + * - Accept cflags followed by '--' followed by filenames. mkdep extracts -I + * options from cflags and looks in the specified directories as well as the + * defaults. Only -I is supported, no attempt is made to handle -idirafter, + * -isystem, -I- etc. */ #include <ctype.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -44,11 +51,10 @@ struct path_struct { int len; - char buffer[256-sizeof(int)]; -} path_array[2] = { - { 0, "" }, - { 0, "" } + char *buffer; }; +struct path_struct *path_array; +int paths; /* Current input file */ @@ -181,9 +187,10 @@ /* * Handle an #include line. */ -void handle_include(int type, const char * name, int len) +void handle_include(int start, const char * name, int len) { - struct path_struct *path = path_array+type; + struct path_struct *path; + int i; if (len == 14 && !memcmp(name, "linux/config.h", len)) return; @@ -191,13 +198,58 @@ if (len >= 7 && !memcmp(name, "config/", 7)) define_config(name+7, len-7-2); - memcpy(path->buffer+path->len, name, len); - path->buffer[path->len+len] = '\0'; - if (access(path->buffer, F_OK) != 0) - return; + for (i = start, path = path_array+start; i < paths; ++i, ++path) { + memcpy(path->buffer+path->len, name, len); + path->buffer[path->len+len] = '\0'; + if (access(path->buffer, F_OK) == 0) { + do_depname(); + printf(" \\\n %s", path->buffer); + return; + } + } - do_depname(); - printf(" \\\n %s", path->buffer); +} + + + +/* + * Add a path to the list of include paths. + */ +void add_path(const char * name) +{ + struct path_struct *path; + char resolved_path[PATH_MAX+1]; + const char *name2; + + if (strcmp(name, ".")) { + name2 = realpath(name, resolved_path); + if (!name2) { + fprintf(stderr, "realpath(%s) failed, %m\n", name); + exit(1); + } + } + else { + name2 = ""; + } + + path_array = realloc(path_array, (++paths)*sizeof(*path_array)); + if (!path_array) { + fprintf(stderr, "cannot expand path_arry\n"); + exit(1); + } + + path = path_array+paths-1; + path->len = strlen(name2); + path->buffer = malloc(path->len+1+256+1); + if (!path->buffer) { + fprintf(stderr, "cannot allocate path buffer\n"); + exit(1); + } + strcpy(path->buffer, name2); + if (path->len && *(path->buffer+path->len-1) != '/') { + *(path->buffer+path->len) = '/'; + *(path->buffer+(++(path->len))) = '\0'; + } } @@ -210,7 +262,7 @@ char *pc; int i; - pc = path_array[0].buffer + path_array[0].len; + pc = path_array[paths-1].buffer + path_array[paths-1].len; memcpy(pc, "config/", 7); pc += 7; @@ -228,7 +280,7 @@ define_config(pc, len); do_depname(); - printf(" \\\n $(wildcard %s.h)", path_array[0].buffer); + printf(" \\\n $(wildcard %s.h)", path_array[paths-1].buffer); } @@ -239,7 +291,7 @@ * Thus, there is one memory access per sizeof(unsigned long) characters. */ -#if defined(__alpha__) || defined(__i386__) || defined(__ia64__) || defined(__MIPSEL__) \ +#if defined(__alpha__) || defined(__i386__) || defined(__ia64__) || defined(__x86_64__) || defined(__MIPSEL__) \ || defined(__arm__) #define LE_MACHINE #endif @@ -387,7 +439,7 @@ GETNEXT CASE('\n', start); NOTCASE('"', pound_include_dquote); - handle_include(1, map_dot, next - map_dot - 1); + handle_include(0, map_dot, next - map_dot - 1); goto start; /* #\s*include\s*<(.*)> */ @@ -395,7 +447,7 @@ GETNEXT CASE('\n', start); NOTCASE('>', pound_include_langle); - handle_include(0, map_dot, next - map_dot - 1); + handle_include(1, map_dot, next - map_dot - 1); goto start; /* #\s*d */ @@ -524,7 +576,7 @@ int main(int argc, char **argv) { int len; - char *hpath; + const char *hpath; hpath = getenv("HPATH"); if (!hpath) { @@ -532,12 +584,26 @@ "Don't bypass the top level Makefile.\n", stderr); return 1; } - len = strlen(hpath); - memcpy(path_array[0].buffer, hpath, len); - if (len && hpath[len-1] != '/') - path_array[0].buffer[len++] = '/'; - path_array[0].buffer[len] = '\0'; - path_array[0].len = len; + + add_path("."); /* for #include "..." */ + + while (++argv, --argc > 0) { + if (strncmp(*argv, "-I", 2) == 0) { + if (*((*argv)+2)) { + add_path((*argv)+2); + } + else { + ++argv; + --argc; + add_path(*argv); + } + } + else if (strcmp(*argv, "--") == 0) { + break; + } + } + + add_path(hpath); /* must be last entry, for config files */ while (--argc > 0) { const char * filename = *++argv; Index: patch-kernel =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/patch-kernel,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- patch-kernel 14 Jan 2001 19:57:21 -0000 1.1.1.1 +++ patch-kernel 9 Apr 2002 16:38:51 -0000 1.2 @@ -1,8 +1,22 @@ #! /bin/sh # Script to apply kernel patches. -# usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] ] ] +# usage: patch-kernel [ sourcedir [ patchdir [ stopversion ] [ -acxx ] ] ] # The source directory defaults to /usr/src/linux, and the patch # directory defaults to the current directory. +# e.g. +# scripts/patch-kernel . .. +# Update the kernel tree in the current directory using patches in the +# directory above to the latest Linus kernel +# scripts/patch-kernel . .. -ac +# Get the latest Linux kernel and patch it with the latest ac patch +# scripts/patch-kernel . .. 2.4.9 +# Gets standard kernel 2.4.9 +# scripts/patch-kernel . .. 2.4.9 -ac +# Gets 2.4.9 with latest ac patches +# scripts/patch-kernel . .. 2.4.9 -ac11 +# Gets 2.4.9 with ac patch ac11 +# Note: It uses the patches relative to the Linus kernels, not the +# ac to ac relative patches # # It determines the current kernel version from the top-level Makefile. # It then looks for patches for the next sublevel in the patch directory. @@ -21,74 +35,159 @@ # Put the full version number (i.e. 2.3.31) as the last parameter # Dave Gilbert <li...@tr...>, 11th December 1999. +# Fixed previous patch so that if we are already at the correct version +# not to patch up. +# +# Added -ac option, use -ac or -ac9 (say) to stop at a particular version +# Dave Gilbert <li...@tr...>, 29th September 2001. + # Set directories from arguments, or use defaults. sourcedir=${1-/usr/src/linux} patchdir=${2-.} stopvers=${3-imnotaversion} -# set current VERSION, PATCHLEVEL, SUBLEVEL -eval `sed -n 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' $sourcedir/Makefile` +# See if we have any -ac options +for PARM in $* +do + case $PARM in + -ac*) + gotac=$PARM; + + esac; +done + +# --------------------------------------------------------------------------- +# Find a file, first parameter is basename of file +# it tries many compression mechanisms and sets variables to say how to get it +function findFile { + filebase=$1; + + if [ -r ${filebase}.gz ]; then + ext=".gz" + name="gzip" + uncomp="gunzip -dc" + elif [ -r ${filebase}.bz ]; then + ext=".bz" + name="bzip" + uncomp="bunzip -dc" + elif [ -r ${filebase}.bz2 ]; then + ext=".bz2" + name="bzip2" + uncomp="bunzip2 -dc" + elif [ -r ${filebase}.zip ]; then + ext=".zip" + name="zip" + uncomp="unzip -d" + elif [ -r ${filebase}.Z ]; then + ext=".Z" + name="uncompress" + uncomp="uncompress -c" + elif [ -r ${filebase} ]; then + ext="" + name="plaintext" + uncomp="cat" + else + return 1; + fi + + return 0; +} + +# --------------------------------------------------------------------------- +# Apply a patch and check it goes in cleanly +# First param is patch name (e.g. patch-2.4.9-ac5) - without path or extension + +function applyPatch { + echo -n "Applying $1 (${name})... " + if $uncomp ${patchdir}/$1${ext} | patch -p1 -s -N -E -d $sourcedir + then + echo "done." + else + echo "failed. Clean up yourself." + return 1; + fi + if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] + then + echo "Aborting. Reject files found." + return 1; + fi + # Remove backup files + find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \; + + return 0; +} + +# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION +eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $sourcedir/Makefile` if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] then echo "unable to determine current kernel version" >&2 exit 1 fi -echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL" +echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}" + +if [ x$EXTRAVERSION != "x" ] +then + echo "I'm sorry but patch-kernel can't work with a kernel source tree that is not a base version" + exit 1; +fi while : do + CURRENTFULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" + if [ $stopvers = $CURRENTFULLVERSION ] + then + echo "Stoping at $CURRENTFULLVERSION base as requested." + break + fi + SUBLEVEL=`expr $SUBLEVEL + 1` FULLVERSION="$VERSION.$PATCHLEVEL.$SUBLEVEL" patch=patch-$FULLVERSION - if [ -r $patchdir/${patch}.gz ]; then - ext=".gz" - name="gzip" - uncomp="gunzip -dc" - elif [ -r $patchdir/${patch}.bz ]; then - ext=".bz" - name="bzip" - uncomp="bunzip -dc" - elif [ -r $patchdir/${patch}.bz2 ]; then - ext=".bz2" - name="bzip2" - uncomp="bunzip2 -dc" - elif [ -r $patchdir/${patch}.zip ]; then - ext=".zip" - name="zip" - uncomp="unzip -d" - elif [ -r $patchdir/${patch}.Z ]; then - ext=".Z" - name="uncompress" - uncomp="uncompress -c" - elif [ -r $patchdir/${patch} ]; then - ext="" - name="plaintext" - uncomp="cat" - else - break - fi - echo -n "Applying ${patch} (${name})... " - if $uncomp ${patchdir}/${patch}${ext} | patch -p1 -s -N -E -d $sourcedir - then - echo "done." - else - echo "failed. Clean up yourself." - break - fi - if [ "`find $sourcedir/ '(' -name '*.rej' -o -name '.*.rej' ')' -print`" ] - then - echo "Aborting. Reject files found." - break - fi - # Remove backup files - find $sourcedir/ '(' -name '*.orig' -o -name '.*.orig' ')' -exec rm -f {} \; + # See if the file exists and find extension + findFile $patchdir/${patch} || break - if [ $stopvers = $FULLVERSION ] - then - echo "Stoping at $FULLVERSION as requested. Enjoy." - break - fi + # Apply the patch and check all is OK + applyPatch $patch || break done + +if [ x$gotac != x ]; then + # Out great user wants the -ac patches + # They could have done -ac (get latest) or -acxx where xx=version they want + if [ $gotac == "-ac" ] + then + # They want the latest version + HIGHESTPATCH=0 + for PATCHNAMES in $patchdir/patch-${CURRENTFULLVERSION}-ac*\.* + do + ACVALUE=`echo $PATCHNAMES | sed -e 's/^.*patch-[0-9.]*-ac\([0-9]*\).*/\1/'` + # Check it is actually a recognised patch type + findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${ACVALUE} || break + + if [ $ACVALUE -gt $HIGHESTPATCH ] + then + HIGHESTPATCH=$ACVALUE + fi + done + + if [ $HIGHESTPATCH -ne 0 ] + then + findFile $patchdir/patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} || break + applyPatch patch-${CURRENTFULLVERSION}-ac${HIGHESTPATCH} + else + echo "No ac patches found" + fi + else + # They want an exact version + findFile $patchdir/patch-${CURRENTFULLVERSION}${gotac} || { + echo "Sorry, I couldn't find the $gotac patch for $CURRENTFULLVERSION. Hohum." + exit 1 + } + applyPatch patch-${CURRENTFULLVERSION}${gotac} + fi +fi + + Index: split-include.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/split-include.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- split-include.c 14 Jan 2001 19:57:42 -0000 1.1.1.1 +++ split-include.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -188,7 +188,7 @@ * So by having an initial \n, strstr will find exact matches. */ - fp_find = popen("find * -type f -print", "r"); + fp_find = popen("find * -type f -name \"*.h\" -print", "r"); if (fp_find == 0) ERROR_EXIT( "find" ); Index: tkgen.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/tkgen.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- tkgen.c 14 Jan 2001 19:57:30 -0000 1.1.1.1 +++ tkgen.c 9 Apr 2002 16:38:51 -0000 1.2 @@ -155,7 +155,7 @@ printf("\"catch {focus $oldFocus}; " ); /* * We are checking which windows should be destroyed and which are - * common parrents with the next one. Remember that menu_num field + * common parents with the next one. Remember that menu_num field * in mainmenu_option record reports number of its *parent* menu. */ if ( menu_num < tot_menu_num Index: ver_linux =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/scripts/ver_linux,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ver_linux 14 Jan 2001 19:57:43 -0000 1.1.1.1 +++ ver_linux 9 Apr 2002 16:38:51 -0000 1.2 @@ -5,30 +5,68 @@ # differ on your system. # PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH -echo '-- Versions installed: (if some fields are empty or look' -echo '-- unusual then possibly you have very old versions)' +echo 'If some fields are empty or look unusual you may have an old version.' +echo 'Compare to the current minimal requirements in Documentation/Changes.' +echo ' ' + uname -a -insmod -V 2>&1 | awk 'NR==1 {print "Kernel modules ",$NF}' +echo ' ' + echo "Gnu C " `gcc --version` + make --version 2>&1 | awk -F, '{print $1}' | awk \ - '/GNU Make/{print "Gnu Make ",$NF}' + '/GNU Make/{print "Gnu make ",$NF}' + ld -v 2>&1 | awk -F\) '{print $1}' | awk \ - '/BFD/{print "Binutils ",$NF}' -ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed -e 's/\.so$//' \ - | awk -F'[.-]' '{print "Linux C Library " $(NF-2)"."$(NF-1)"."$NF}' -echo -n "Dynamic linker " -ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -1 + '/BFD/{print "binutils ",$NF}' + +fdformat --version | awk -F\- '{print "util-linux ", $NF}' + +mount --version | awk -F\- '{print "mount ", $NF}' + +insmod -V 2>&1 | awk 'NR==1 {print "modutils ",$NF}' + +tune2fs 2>&1 | grep "^tune2fs" | sed 's/,//' | awk \ +'NR==1 {print "e2fsprogs ", $2}' + +reiserfsck 2>&1 | grep reiserfsprogs | awk \ +'NR==1{print "reiserfsprogs ", $NF}' + +cardmgr -V 2>&1| grep version | awk \ +'NR==1{print "pcmcia-cs ", $3}' + +pppd --version 2>&1| grep version | awk \ +'NR==1{print "PPP ", $3}' + +isdnctrl 2>&1 | grep version | awk \ +'NR==1{print "isdn4k-utils ", $NF}' + +ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \ +-e 's/\.so$//' | awk -F'[.-]' '{print "Linux C Library " \ +$(NF-2)"."$(NF-1)"."$NF}' + +ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -1 | awk \ +'NR==1{print "Dynamic linker (ldd) ", $NF}' + ls -l /usr/lib/lib{g,stdc}++.so 2>/dev/null | awk -F. \ '{print "Linux C++ Library " $4"."$5"."$6}' + ps --version 2>&1 | awk 'NR==1{print "Procps ", $NF}' -mount --version | awk -F\- '{print "Mount ", $NF}' -hostname -V 2>&1 | awk 'NR==1{print "Net-tools ", $NF}' + +ifconfig --version 2>&1 | grep tools | awk \ +'NR==1{print "Net-tools ", $NF}' + # Kbd needs 'loadkeys -h', loadkeys -h 2>&1 | awk \ '(NR==1 && ($3 !~ /option/)) {print "Kbd ", $3}' + # while console-tools needs 'loadkeys -V'. loadkeys -V 2>&1 | awk \ '(NR==1 && ($2 ~ /console-tools/)) {print "Console-tools ", $3}' + expr --v 2>&1 | awk 'NR==1{print "Sh-utils ", $NF}' -X=`cat /proc/modules | sed -e "s/ .*$//"` -echo "Modules Loaded "$X + +if [ -e /proc/modules ]; then + X=`cat /proc/modules | sed -e "s/ .*$//"` + echo "Modules Loaded "$X +fi |
From: Andy P. <at...@us...> - 2002-04-09 16:32:49
|
Update of /cvsroot/linux-vax/kernel-2.4/ipc In directory usw-pr-cvs1:/tmp/cvs-serv3087 Modified Files: msg.c sem.c shm.c util.c Log Message: synch 2.4.15 commit 22 Index: msg.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/ipc/msg.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- msg.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ msg.c 9 Apr 2002 16:32:44 -0000 1.2 @@ -613,7 +613,7 @@ wake_up_process(msr->r_tsk); } else { msr->r_msg = msg; - msq->q_lspid = msr->r_tsk->pid; + msq->q_lrpid = msr->r_tsk->pid; msq->q_rtime = CURRENT_TIME; wake_up_process(msr->r_tsk); return 1; @@ -683,6 +683,9 @@ goto retry; } + msq->q_lspid = current->pid; + msq->q_stime = CURRENT_TIME; + if(!pipelined_send(msq,msg)) { /* noone is waiting for this message, enqueue it */ list_add_tail(&msg->m_list,&msq->q_messages); @@ -694,8 +697,6 @@ err = 0; msg = NULL; - msq->q_lspid = current->pid; - msq->q_stime = CURRENT_TIME; out_unlock_free: msg_unlock(msqid); @@ -742,6 +743,10 @@ if(msq==NULL) return -EINVAL; retry: + err = -EIDRM; + if (msg_checkid(msq,msqid)) + goto out_unlock; + err=-EACCES; if (ipcperms (&msq->q_perm, S_IRUGO)) goto out_unlock; Index: sem.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/ipc/sem.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sem.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ sem.c 9 Apr 2002 16:32:44 -0000 1.2 @@ -53,6 +53,8 @@ * * SMP-threaded, sysctl's added * (c) 1999 Manfred Spraul <man...@co...> + * Enforced range limit on SEM_UNDO + * (c) 2001 Red Hat Inc <al...@re...> */ #include <linux/config.h> @@ -256,8 +258,19 @@ curr->sempid = (curr->sempid << 16) | pid; curr->semval += sem_op; if (sop->sem_flg & SEM_UNDO) - un->semadj[sop->sem_num] -= sem_op; - + { + int undo = un->semadj[sop->sem_num] - sem_op; + /* + * Exceeding the undo range is an error. + */ + if (undo < (-SEMAEM - 1) || undo > SEMAEM) + { + /* Don't undo the undo */ + sop->sem_flg &= ~SEM_UNDO; + goto out_of_range; + } + un->semadj[sop->sem_num] = undo; + } if (curr->semval < 0) goto would_block; if (curr->semval > SEMVMX) Index: shm.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/ipc/shm.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- shm.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ shm.c 9 Apr 2002 16:32:44 -0000 1.2 @@ -71,7 +71,9 @@ void __init shm_init (void) { ipc_init_ids(&shm_ids, 1); +#ifdef CONFIG_PROC_FS create_proc_read_entry("sysvipc/shm", 0, 0, sysvipc_shm_read_proc, NULL); +#endif } static inline int shm_checkid(struct shmid_kernel *s, int id) @@ -346,6 +348,7 @@ static void shm_get_stat (unsigned long *rss, unsigned long *swp) { + struct shmem_inode_info *info; int i; *rss = 0; @@ -359,10 +362,11 @@ if(shp == NULL) continue; inode = shp->shm_file->f_dentry->d_inode; - spin_lock (&inode->u.shmem_i.lock); + info = SHMEM_I(inode); + spin_lock (&info->lock); *rss += inode->i_mapping->nrpages; - *swp += inode->u.shmem_i.swapped; - spin_unlock (&inode->u.shmem_i.lock); + *swp += info->swapped; + spin_unlock (&info->lock); } } @@ -495,14 +499,21 @@ if (shp == NULL) goto out_up; err = shm_checkid(shp, shmid); - if (err == 0) { - if (shp->shm_nattch){ - shp->shm_flags |= SHM_DEST; - /* Do not find it any more */ - shp->shm_perm.key = IPC_PRIVATE; - } else - shm_destroy (shp); + if(err) + goto out_unlock_up; + if (current->euid != shp->shm_perm.uid && + current->euid != shp->shm_perm.cuid && + !capable(CAP_SYS_ADMIN)) { + err=-EPERM; + goto out_unlock_up; } + if (shp->shm_nattch){ + shp->shm_flags |= SHM_DEST; + /* Do not find it any more */ + shp->shm_perm.key = IPC_PRIVATE; + } else + shm_destroy (shp); + /* Unlock */ shm_unlock(shmid); up(&shm_ids.sem); @@ -597,6 +608,11 @@ shp = shm_lock(shmid); if(shp == NULL) return -EINVAL; + err = shm_checkid(shp,shmid); + if (err) { + shm_unlock(shmid); + return err; + } if (ipcperms(&shp->shm_perm, acc_mode)) { shm_unlock(shmid); return -EACCES; @@ -605,9 +621,9 @@ shp->shm_nattch++; shm_unlock(shmid); - down(¤t->mm->mmap_sem); + down_write(¤t->mm->mmap_sem); user_addr = (void *) do_mmap (file, addr, file->f_dentry->d_inode->i_size, prot, flags, 0); - up(¤t->mm->mmap_sem); + up_write(¤t->mm->mmap_sem); down (&shm_ids.sem); if(!(shp = shm_lock(shmid))) @@ -636,14 +652,14 @@ struct mm_struct *mm = current->mm; struct vm_area_struct *shmd, *shmdnext; - down(&mm->mmap_sem); + down_write(&mm->mmap_sem); for (shmd = mm->mmap; shmd; shmd = shmdnext) { shmdnext = shmd->vm_next; if (shmd->vm_ops == &shm_vm_ops && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start); } - up(&mm->mmap_sem); + up_write(&mm->mmap_sem); return 0; } Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/ipc/util.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- util.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ util.c 9 Apr 2002 16:32:44 -0000 1.2 @@ -75,7 +75,7 @@ ids->size = 0; } ids->ary = SPIN_LOCK_UNLOCKED; - for(i=0;i<size;i++) + for(i=0;i<ids->size;i++) ids->entries[i].p = NULL; } |
From: Andy P. <at...@us...> - 2002-04-09 16:31:47
|
Update of /cvsroot/linux-vax/kernel-2.4/init In directory usw-pr-cvs1:/tmp/cvs-serv2666 Modified Files: main.c version.c Log Message: synch 2.4.15 commit 21 Index: main.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/init/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- main.c 18 Feb 2001 20:37:38 -0000 1.2 +++ main.c 9 Apr 2002 16:31:36 -0000 1.3 @@ -21,16 +21,21 @@ #include <linux/utsname.h> #include <linux/ioport.h> #include <linux/init.h> -#include <linux/raid/md.h> #include <linux/smp_lock.h> #include <linux/blk.h> #include <linux/hdreg.h> #include <linux/iobuf.h> #include <linux/bootmem.h> +#include <linux/tty.h> #include <asm/io.h> #include <asm/bugs.h> +#if defined(CONFIG_ARCH_S390) +#include <asm/s390mach.h> +#include <asm/ccwcache.h> +#endif + #ifdef CONFIG_PCI #include <linux/pci.h> #endif @@ -47,10 +52,6 @@ # include <asm/mtrr.h> #endif -#ifdef CONFIG_3215_CONSOLE -extern int con3215_activate(void); -#endif - #ifdef CONFIG_NUBUS #include <linux/nubus.h> #endif @@ -60,10 +61,11 @@ #endif #ifdef CONFIG_IRDA -#include <net/irda/irda_device.h> +extern int irda_proto_init(void); +extern int irda_device_init(void); #endif -#ifdef CONFIG_X86_IO_APIC +#ifdef CONFIG_X86_LOCAL_APIC #include <asm/smp.h> #endif @@ -91,12 +93,9 @@ extern void ppc_init(void); extern void sysctl_init(void); extern void signals_init(void); -extern void bdev_init(void); extern int init_pcmcia_ds(void); -extern void net_notifier_init(void); extern void free_initmem(void); -extern void filesystem_setup(void); #ifdef CONFIG_TC extern void tc_init(void); @@ -111,9 +110,6 @@ #if defined(CONFIG_SYSVIPC) extern void ipc_init(void); #endif -#if defined(CONFIG_QUOTA) -extern void dquot_init_hash(void); -#endif /* * Boot command-line arguments @@ -127,7 +123,7 @@ int rows, cols; #ifdef CONFIG_BLK_DEV_INITRD -kdev_t real_root_dev; +unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ #endif int root_mountflags = MS_RDONLY; @@ -155,6 +151,7 @@ { "nfs", 0x00ff }, { "hda", 0x0300 }, { "hdb", 0x0340 }, + { "loop", 0x0700 }, { "hdc", 0x1600 }, { "hdd", 0x1640 }, { "hde", 0x2100 }, @@ -218,17 +215,7 @@ { "apblock", APBLOCK_MAJOR << 8}, { "ddv", DDV_MAJOR << 8}, { "jsfd", JSFD_MAJOR << 8}, -#ifdef CONFIG_MDISK - { "mnda", (MDISK_MAJOR << MINORBITS)}, - { "mndb", (MDISK_MAJOR << MINORBITS) + 1}, - { "mndc", (MDISK_MAJOR << MINORBITS) + 2}, - { "mndd", (MDISK_MAJOR << MINORBITS) + 3}, - { "mnde", (MDISK_MAJOR << MINORBITS) + 4}, - { "mndf", (MDISK_MAJOR << MINORBITS) + 5}, - { "mndg", (MDISK_MAJOR << MINORBITS) + 6}, - { "mndh", (MDISK_MAJOR << MINORBITS) + 7}, -#endif -#ifdef CONFIG_DASD +#if defined(CONFIG_ARCH_S390) { "dasda", (DASD_MAJOR << MINORBITS) }, { "dasdb", (DASD_MAJOR << MINORBITS) + (1 << 2) }, { "dasdc", (DASD_MAJOR << MINORBITS) + (2 << 2) }, @@ -274,9 +261,15 @@ { "cciss/c0d14p",0x68E0 }, { "cciss/c0d15p",0x68F0 }, #endif -#ifdef CONFIG_NFTL { "nftla", 0x5d00 }, -#endif + { "nftlb", 0x5d10 }, + { "nftlc", 0x5d20 }, + { "nftld", 0x5d30 }, + { "ftla", 0x2c00 }, + { "ftlb", 0x2c08 }, + { "ftlc", 0x2c10 }, + { "ftld", 0x2c18 }, + { "mtdblock", 0x1f00 }, { NULL, 0 } }; @@ -493,12 +486,14 @@ extern void setup_arch(char **); extern void cpu_idle(void); +unsigned long wait_init_idle; + #ifndef CONFIG_SMP -#ifdef CONFIG_X86_IO_APIC +#ifdef CONFIG_X86_LOCAL_APIC static void __init smp_init(void) { - IO_APIC_init_uniprocessor(); + APIC_init_uniprocessor(); } #else #define smp_init() do { } while (0) @@ -506,21 +501,48 @@ #else + /* Called by boot processor to activate the rest. */ static void __init smp_init(void) { /* Get other processors into their bootup holding patterns. */ smp_boot_cpus(); + wait_init_idle = cpu_online_map; + clear_bit(current->processor, &wait_init_idle); /* Don't wait on me! */ + smp_threads_ready=1; smp_commence(); -} + + /* Wait for the other cpus to set up their idle processes */ + printk("Waiting on wait_init_idle (map = 0x%lx)\n", wait_init_idle); + while (wait_init_idle) { + cpu_relax(); + barrier(); + } + printk("All processors have done init_idle\n"); +} #endif /* + * We need to finalize in a non-__init function or else race conditions + * between the root thread and the init thread may cause start_kernel to + * be reaped by free_initmem before the root thread has proceeded to + * cpu_idle. + */ + +static void rest_init(void) +{ + kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); + unlock_kernel(); + current->need_resched = 1; + cpu_idle(); +} + +/* * Activate the first processor. */ - + asmlinkage void __init start_kernel(void) { char * command_line; @@ -538,8 +560,8 @@ trap_init(); init_IRQ(); sched_init(); - time_init(); softirq_init(); + time_init(); /* * HACK ALERT! This is early. We're enabling the console before @@ -573,12 +595,6 @@ #endif mem_init(); kmem_cache_sizes_init(); -#ifdef CONFIG_3215_CONSOLE - con3215_activate(); -#endif -#ifdef CONFIG_PROC_FS - proc_root_init(); -#endif mempages = num_physpages; fork_init(mempages); @@ -586,16 +602,16 @@ vfs_caches_init(mempages); buffer_init(mempages); page_cache_init(mempages); - kiobuf_setup(); +#if defined(CONFIG_ARCH_S390) + ccwcache_init(); +#endif signals_init(); - bdev_init(); - inode_init(mempages); +#ifdef CONFIG_PROC_FS + proc_root_init(); +#endif #if defined(CONFIG_SYSVIPC) ipc_init(); #endif -#if defined(CONFIG_QUOTA) - dquot_init_hash(); -#endif check_bugs(); printk("POSIX conformance testing by UNIFIX\n"); @@ -605,10 +621,7 @@ * make syscalls (and thus be locked). */ smp_init(); - kernel_thread(init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); - unlock_kernel(); - current->need_resched = 1; - cpu_idle(); + rest_init(); } #ifdef CONFIG_BLK_DEV_INITRD @@ -651,9 +664,6 @@ */ static void __init do_basic_setup(void) { -#ifdef CONFIG_BLK_DEV_INITRD - int real_root_mountflags; -#endif /* * Tell the world that we're going to be the grim @@ -682,6 +692,10 @@ * Ok, at this point all CPU's should be initialized, so * we can start looking into devices.. */ +#if defined(CONFIG_ARCH_S390) + s390_init_machine_check(); +#endif + #ifdef CONFIG_PCI pci_init(); #endif @@ -718,25 +732,43 @@ /* Networking initialization needs a process context */ sock_init(); -#ifdef CONFIG_BLK_DEV_INITRD - real_root_dev = ROOT_DEV; - real_root_mountflags = root_mountflags; - if (initrd_start && mount_initrd) root_mountflags &= ~MS_RDONLY; - else mount_initrd =0; -#endif - start_context_thread(); do_initcalls(); - /* .. filesystems .. */ - filesystem_setup(); - #ifdef CONFIG_IRDA + irda_proto_init(); irda_device_init(); /* Must be done after protocol initialization */ #endif #ifdef CONFIG_PCMCIA init_pcmcia_ds(); /* Do this last */ #endif +} + +extern void rd_load(void); +extern void initrd_load(void); + +/* + * Prepare the namespace - decide what/where to mount, load ramdisks, etc. + */ +static void prepare_namespace(void) +{ +#ifdef CONFIG_BLK_DEV_INITRD + int real_root_mountflags = root_mountflags; + if (!initrd_start) + mount_initrd = 0; + if (mount_initrd) + root_mountflags &= ~MS_RDONLY; + real_root_dev = ROOT_DEV; +#endif + +#ifdef CONFIG_BLK_DEV_RAM +#ifdef CONFIG_BLK_DEV_INITRD + if (mount_initrd) + initrd_load(); + else +#endif + rd_load(); +#endif /* Mount the root filesystem.. */ mount_root(); @@ -751,8 +783,12 @@ int i, pid; pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); - if (pid>0) - while (pid != wait(&i)); + if (pid > 0) { + while (pid != wait(&i)) { + current->policy |= SCHED_YIELD; + schedule(); + } + } if (MAJOR(real_root_dev) != RAMDISK_MAJOR || MINOR(real_root_dev) != 0) { error = change_root(real_root_dev,"/initrd"); @@ -768,6 +804,8 @@ { lock_kernel(); do_basic_setup(); + + prepare_namespace(); /* * Ok, we have completed the initial bootup, and Index: version.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/init/version.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- version.c 14 Jan 2001 16:40:58 -0000 1.1.1.1 +++ version.c 9 Apr 2002 16:31:36 -0000 1.2 @@ -1,5 +1,5 @@ /* - * linux/version.c + * linux/init/version.c * * Copyright (C) 1992 Theodore Ts'o * |
From: Andy P. <at...@us...> - 2002-04-09 16:29:16
|
Update of /cvsroot/linux-vax/kernel-2.4/net/unix In directory usw-pr-cvs1:/tmp/cvs-serv32481/unix Modified Files: af_unix.c garbage.c Log Message: synch 2.4.15 commit 21 Index: af_unix.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/unix/af_unix.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_unix.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ af_unix.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -111,8 +111,6 @@ #include <asm/checksum.h> -#define min(a,b) (((a)<(b))?(a):(b)) - int sysctl_unix_max_dgram_qlen = 10; unix_socket *unix_socket_table[UNIX_HASH_SIZE+1]; @@ -674,6 +672,7 @@ atomic_set(&addr->refcnt, 1); if (sunaddr->sun_path[0]) { + unsigned int mode; err = 0; /* * Get the parent directory, calculate the hash for last @@ -713,8 +712,8 @@ /* * All right, let's create it. */ - err = vfs_mknod(nd.dentry->d_inode, dentry, - S_IFSOCK|sock->inode->i_mode, 0); + mode = S_IFSOCK | (sock->inode->i_mode & ~current->fs->umask); + err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); if (err) goto out_mknod_dput; up(&nd.dentry->d_inode->i_sem); @@ -1182,7 +1181,7 @@ if ((unsigned)len > sk->sndbuf - 32) goto out; - skb = sock_alloc_send_skb(sk, len, 0, msg->msg_flags&MSG_DONTWAIT, &err); + skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); if (skb==NULL) goto out; @@ -1285,7 +1284,6 @@ struct sockaddr_un *sunaddr=msg->msg_name; int err,size; struct sk_buff *skb; - int limit=0; int sent=0; err = -EOPNOTSUPP; @@ -1319,37 +1317,26 @@ if (size > sk->sndbuf/2 - 64) size = sk->sndbuf/2 - 64; - if (size > (128 * 1024) / 2) - size = (128 * 1024) / 2; + if (size > SKB_MAX_ALLOC) + size = SKB_MAX_ALLOC; /* - * Keep to page sized kmalloc()'s as various people - * have suggested. Big mallocs stress the vm too - * much. - */ - - if (size > PAGE_SIZE-16) - limit = PAGE_SIZE-16; /* Fall back to a page if we can't grab a big buffer this instant */ - else - limit = 0; /* Otherwise just grab and wait */ - - /* * Grab a buffer */ - skb=sock_alloc_send_skb(sk,size,limit,msg->msg_flags&MSG_DONTWAIT, &err); + skb=sock_alloc_send_skb(sk,size,msg->msg_flags&MSG_DONTWAIT, &err); if (skb==NULL) goto out_err; /* * If you pass two values to the sock_alloc_send_skb - * it tries to grab the large buffer with GFP_BUFFER + * it tries to grab the large buffer with GFP_NOFS * (which can fail easily), and if it fails grab the * fallback size buffer which is under a page and will * succeed. [Alan] */ - size = min(size, skb_tailroom(skb)); + size = min_t(int, size, skb_tailroom(skb)); memcpy(UNIXCREDS(skb), &scm->creds, sizeof(struct ucred)); if (scm->fp) @@ -1581,7 +1568,7 @@ sunaddr = NULL; } - chunk = min(skb->len, size); + chunk = min_t(unsigned int, skb->len, size); if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { skb_queue_head(&sk->receive_queue, skb); if (copied == 0) @@ -1821,6 +1808,7 @@ sendmsg: unix_stream_sendmsg, recvmsg: unix_stream_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; struct proto_ops unix_dgram_ops = { @@ -1841,6 +1829,7 @@ sendmsg: unix_dgram_sendmsg, recvmsg: unix_dgram_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; struct net_proto_family unix_family_ops = { @@ -1852,11 +1841,11 @@ extern void unix_sysctl_register(void); extern void unix_sysctl_unregister(void); #else -static inline unix_sysctl_register() {}; -static inline unix_sysctl_unregister() {}; +static inline void unix_sysctl_register(void) {} +static inline void unix_sysctl_unregister(void) {} #endif -static const char banner[] __initdata = KERN_INFO "NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.\n"; +static char banner[] __initdata = KERN_INFO "NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.\n"; static int __init af_unix_init(void) { Index: garbage.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/unix/garbage.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- garbage.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ garbage.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -296,9 +296,6 @@ * Here we are. Hitlist is filled. Die. */ - while ((skb=__skb_dequeue(&hitlist))!=NULL) { - kfree_skb(skb); - } - + __skb_queue_purge(&hitlist); up(&unix_gc_sem); } |
Update of /cvsroot/linux-vax/kernel-2.4/net/sched In directory usw-pr-cvs1:/tmp/cvs-serv32481/sched Modified Files: Makefile cls_fw.c cls_route.c cls_rsvp.c cls_rsvp6.c cls_tcindex.c cls_u32.c sch_api.c sch_cbq.c sch_csz.c sch_dsmark.c sch_gred.c sch_ingress.c sch_prio.c sch_red.c sch_sfq.c sch_tbf.c sch_teql.c Log Message: synch 2.4.15 commit 21 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:14:26 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:29:01 -0000 1.2 @@ -1,182 +1,34 @@ # # Makefile for the Linux Traffic Control Unit. # -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := sched.o obj-y := sch_generic.o -ifeq ($(CONFIG_NET_SCHED), y) -obj-y += sch_api.o sch_fifo.o - -ifeq ($(CONFIG_NET_ESTIMATOR), y) -obj-y += estimator.o -endif - -ifeq ($(CONFIG_NET_CLS), y) -obj-y += cls_api.o - -ifeq ($(CONFIG_NET_CLS_POLICE), y) -obj-y += police.o -endif - -endif - -ifeq ($(CONFIG_NET_SCH_INGRESS), y) -obj-y += sch_ingress.o -else - ifeq ($(CONFIG_NET_SCH_INGRESS), m) - obj-m += sch_ingress.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_CBQ), y) -obj-y += sch_cbq.o -else - ifeq ($(CONFIG_NET_SCH_CBQ), m) - obj-m += sch_cbq.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_CSZ), y) -obj-y += sch_csz.o -else - ifeq ($(CONFIG_NET_SCH_CSZ), m) - obj-m += sch_csz.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_HPFQ), y) -obj-y += sch_hpfq.o -else - ifeq ($(CONFIG_NET_SCH_HPFQ), m) - obj-m += sch_hpfq.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_HFSC), y) -obj-y += sch_hfsc.o -else - ifeq ($(CONFIG_NET_SCH_HFSC), m) - obj-m += sch_hfsc.o - endif -endif - - -ifeq ($(CONFIG_NET_SCH_SFQ), y) -obj-y += sch_sfq.o -else - ifeq ($(CONFIG_NET_SCH_SFQ), m) - obj-m += sch_sfq.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_RED), y) -obj-y += sch_red.o -else - ifeq ($(CONFIG_NET_SCH_RED), m) - obj-m += sch_red.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_TBF), y) -obj-y += sch_tbf.o -else - ifeq ($(CONFIG_NET_SCH_TBF), m) - obj-m += sch_tbf.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_PRIO), y) -obj-y += sch_prio.o -else - ifeq ($(CONFIG_NET_SCH_PRIO), m) - obj-m += sch_prio.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_TEQL), y) -obj-y += sch_teql.o -else - ifeq ($(CONFIG_NET_SCH_TEQL), m) - obj-m += sch_teql.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_GRED), y) -obj-y += sch_gred.o -else - ifeq ($(CONFIG_NET_SCH_GRED), m) - obj-m += sch_gred.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_DSMARK), y) -obj-y += sch_dsmark.o -else - ifeq ($(CONFIG_NET_SCH_DSMARK), m) - obj-m += sch_dsmark.o - endif -endif - -ifeq ($(CONFIG_NET_CLS_TCINDEX), y) -obj-y += cls_tcindex.o -else - ifeq ($(CONFIG_NET_CLS_TCINDEX), m) - obj-m += cls_tcindex.o - endif -endif - -ifeq ($(CONFIG_NET_SCH_ATM), y) -obj-y += sch_atm.o -endif - -ifeq ($(CONFIG_NET_CLS_U32), y) -obj-y += cls_u32.o -else - ifeq ($(CONFIG_NET_CLS_U32), m) - obj-m += cls_u32.o - endif -endif - -ifeq ($(CONFIG_NET_CLS_RSVP), y) -obj-y += cls_rsvp.o -else - ifeq ($(CONFIG_NET_CLS_RSVP), m) - obj-m += cls_rsvp.o - endif -endif - -ifeq ($(CONFIG_NET_CLS_RSVP6), y) -obj-y += cls_rsvp6.o -else - ifeq ($(CONFIG_NET_CLS_RSVP6), m) - obj-m += cls_rsvp6.o - endif -endif - -ifeq ($(CONFIG_NET_CLS_ROUTE4), y) -obj-y += cls_route.o -else - ifeq ($(CONFIG_NET_CLS_ROUTE4), m) - obj-m += cls_route.o - endif -endif - -ifeq ($(CONFIG_NET_CLS_FW), y) -obj-y += cls_fw.o -else - ifeq ($(CONFIG_NET_CLS_FW), m) - obj-m += cls_fw.o - endif -endif - -endif +obj-$(CONFIG_NET_SCHED) += sch_api.o sch_fifo.o +obj-$(CONFIG_NET_ESTIMATOR) += estimator.o +obj-$(CONFIG_NET_CLS) += cls_api.o +obj-$(CONFIG_NET_CLS_POLICE) += police.o +obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o +obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o +obj-$(CONFIG_NET_SCH_CSZ) += sch_csz.o +obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o +obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o +obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o +obj-$(CONFIG_NET_SCH_RED) += sch_red.o +obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o +obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o +obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o +obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o +obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o +obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o +obj-$(CONFIG_NET_SCH_ATM) += sch_atm.o +obj-$(CONFIG_NET_CLS_U32) += cls_u32.o +obj-$(CONFIG_NET_CLS_RSVP) += cls_rsvp.o +obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o +obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o +obj-$(CONFIG_NET_CLS_FW) += cls_fw.o include $(TOPDIR)/Rules.make Index: cls_fw.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_fw.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cls_fw.c 14 Jan 2001 17:14:52 -0000 1.1.1.1 +++ cls_fw.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -383,3 +383,4 @@ unregister_tcf_proto_ops(&cls_fw_ops); } #endif +MODULE_LICENSE("GPL"); Index: cls_route.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_route.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cls_route.c 14 Jan 2001 17:14:54 -0000 1.1.1.1 +++ cls_route.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -316,13 +316,14 @@ { struct route4_head *head = (struct route4_head*)tp->root; struct route4_filter **fp, *f = (struct route4_filter*)arg; - unsigned h = f->handle; + unsigned h = 0; struct route4_bucket *b; int i; if (!head || !f) return -EINVAL; + h = f->handle; b = f->bkt; for (fp = &b->ht[from_hash(h>>16)]; *fp; fp = &(*fp)->next) { @@ -637,3 +638,4 @@ unregister_tcf_proto_ops(&cls_route4_ops); } #endif +MODULE_LICENSE("GPL"); Index: cls_rsvp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_rsvp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cls_rsvp.c 14 Jan 2001 17:14:55 -0000 1.1.1.1 +++ cls_rsvp.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -39,3 +39,4 @@ #define RSVP_OPS cls_rsvp_ops #include "cls_rsvp.h" +MODULE_LICENSE("GPL"); Index: cls_rsvp6.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_rsvp6.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cls_rsvp6.c 14 Jan 2001 17:14:56 -0000 1.1.1.1 +++ cls_rsvp6.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -40,3 +40,4 @@ #define RSVP_OPS cls_rsvp6_ops #include "cls_rsvp.h" +MODULE_LICENSE("GPL"); Index: cls_tcindex.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_tcindex.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cls_tcindex.c 14 Jan 2001 17:15:04 -0000 1.1.1.1 +++ cls_tcindex.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -76,7 +76,7 @@ struct tcindex_filter *f; if (p->perfect) - return p->perfect[key].res.classid ? p->perfect+key : NULL; + return p->perfect[key].res.class ? p->perfect+key : NULL; if (!p->h) return NULL; for (f = p->h[key % p->hash]; f; f = f->next) { @@ -122,8 +122,14 @@ static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) { + struct tcindex_data *p = PRIV(tp); + struct tcindex_filter_result *r; + DPRINTK("tcindex_get(tp %p,handle 0x%08x)\n",tp,handle); - return (unsigned long) lookup(PRIV(tp),handle); + if (p->perfect && handle >= p->alloc_hash) + return 0; + r = lookup(PRIV(tp),handle); + return r && r->res.class ? (unsigned long) r : 0; } @@ -164,7 +170,7 @@ DPRINTK("tcindex_delete(tp %p,arg 0x%lx),p %p,f %p\n",tp,arg,p,f); if (p->perfect) { - if (!r->res.classid) + if (!r->res.class) return -ENOENT; } else { int i; @@ -212,7 +218,7 @@ struct tcindex_filter *f; struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; struct tcindex_filter **walk; - int hash; + int hash,shift; __u16 mask; DPRINTK("tcindex_change(tp %p,handle 0x%08x,tca %p,arg %p),opt %p," @@ -237,17 +243,22 @@ return -EINVAL; mask = *(__u16 *) RTA_DATA(tb[TCA_TCINDEX_MASK-1]); } - if (p->perfect && hash <= mask) + if (!tb[TCA_TCINDEX_SHIFT-1]) + shift = p->shift; + else { + if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(__u16)) + return -EINVAL; + shift = *(int *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]); + } + if (p->perfect && hash <= (mask >> shift)) return -EBUSY; - if ((p->perfect || p->h) && hash > p->alloc_hash) + if (p->perfect && hash > p->alloc_hash) + return -EBUSY; + if (p->h && hash != p->alloc_hash) return -EBUSY; p->hash = hash; p->mask = mask; - if (tb[TCA_TCINDEX_SHIFT-1]) { - if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT-1]) < sizeof(__u16)) - return -EINVAL; - p->shift = *(int *) RTA_DATA(tb[TCA_TCINDEX_SHIFT-1]); - } + p->shift = shift; if (tb[TCA_TCINDEX_FALL_THROUGH-1]) { if (RTA_PAYLOAD(tb[TCA_TCINDEX_FALL_THROUGH-1]) < sizeof(int)) return -EINVAL; @@ -258,9 +269,9 @@ tb[TCA_TCINDEX_POLICE-1]); if (!tb[TCA_TCINDEX_CLASSID-1] && !tb[TCA_TCINDEX_POLICE-1]) return 0; - if (!p->hash) { - if (p->mask < PERFECT_HASH_THRESHOLD) { - p->hash = p->mask+1; + if (!hash) { + if ((mask >> shift) < PERFECT_HASH_THRESHOLD) { + p->hash = (mask >> shift)+1; } else { p->hash = DEFAULT_HASH_SIZE; } @@ -268,7 +279,7 @@ if (!p->perfect && !p->h) { p->alloc_hash = p->hash; DPRINTK("hash %d mask %d\n",p->hash,p->mask); - if (p->hash > p->mask) { + if (p->hash > (mask >> shift)) { p->perfect = kmalloc(p->hash* sizeof(struct tcindex_filter_result),GFP_KERNEL); if (!p->perfect) @@ -283,7 +294,15 @@ memset(p->h, 0, p->hash*sizeof(struct tcindex_filter *)); } } - if (handle > p->mask) + /* + * Note: this could be as restrictive as + * if (handle & ~(mask >> shift)) + * but then, we'd fail handles that may become valid after some + * future mask change. While this is extremely unlikely to ever + * matter, the check below is safer (and also more + * backwards-compatible). + */ + if (p->perfect && handle >= p->alloc_hash) return -EINVAL; if (p->perfect) { r = p->perfect+handle; @@ -308,17 +327,16 @@ } } #ifdef CONFIG_NET_CLS_POLICE - if (!tb[TCA_TCINDEX_POLICE-1]) { - r->police = NULL; - } else { - struct tcf_police *police = - tcf_police_locate(tb[TCA_TCINDEX_POLICE-1],NULL); + { + struct tcf_police *police; - tcf_tree_lock(tp); + police = tb[TCA_TCINDEX_POLICE-1] ? + tcf_police_locate(tb[TCA_TCINDEX_POLICE-1],NULL) : NULL; + tcf_tree_lock(tp); police = xchg(&r->police,police); - tcf_tree_unlock(tp); + tcf_tree_unlock(tp); tcf_police_release(police); - } + } #endif if (r != &new_filter_result) return 0; @@ -339,13 +357,13 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) { struct tcindex_data *p = PRIV(tp); - struct tcindex_filter *f; + struct tcindex_filter *f,*next; int i; DPRINTK("tcindex_walk(tp %p,walker %p),p %p\n",tp,walker,p); if (p->perfect) { for (i = 0; i < p->hash; i++) { - if (!p->perfect[i].res.classid) + if (!p->perfect[i].res.class) continue; if (walker->count >= walker->skip) { if (walker->fn(tp, @@ -361,7 +379,8 @@ if (!p->h) return; for (i = 0; i < p->hash; i++) { - for (f = p->h[i]; f; f = f->next) { + for (f = p->h[i]; f; f = next) { + next = f->next; if (walker->count >= walker->skip) { if (walker->fn(tp,(unsigned long) &f->result, walker) < 0) { @@ -496,3 +515,4 @@ unregister_tcf_proto_ops(&cls_tcindex_ops); } #endif +MODULE_LICENSE("GPL"); Index: cls_u32.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/cls_u32.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- cls_u32.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ cls_u32.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -162,7 +162,7 @@ if (!(n->sel.flags&(TC_U32_VAROFFSET|TC_U32_OFFSET|TC_U32_EAT))) goto next_ht; - if (n->sel.flags&(TC_U32_EAT|TC_U32_VAROFFSET)) { + if (n->sel.flags&(TC_U32_OFFSET|TC_U32_VAROFFSET)) { off2 = n->sel.off + 3; if (n->sel.flags&TC_U32_VAROFFSET) off2 += ntohs(n->sel.offmask & *(u16*)(ptr+n->sel.offoff)) >>n->sel.offshift; @@ -726,3 +726,4 @@ unregister_tcf_proto_ops(&cls_u32_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_api.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_api.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_api.c 14 Jan 2001 17:14:48 -0000 1.1.1.1 +++ sch_api.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -1145,8 +1145,10 @@ stop = jiffies + HZ/10; PSCHED_GET_TIME(stamp); do_gettimeofday(&tv); - while (time_before(jiffies, stop)) + while (time_before(jiffies, stop)) { barrier(); + cpu_relax(); + } PSCHED_GET_TIME(stamp1); do_gettimeofday(&tv1); Index: sch_cbq.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_cbq.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_cbq.c 14 Jan 2001 17:14:33 -0000 1.1.1.1 +++ sch_cbq.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -282,6 +282,7 @@ case TC_POLICE_SHOT: return NULL; default: + break; } #endif if (cl->level == 0) @@ -506,7 +507,7 @@ } } - q->wd_expires = delay; + q->wd_expires = base_delay; } } @@ -1244,8 +1245,10 @@ cl = cl_head; do { - if (cl->q->ops->drop && cl->q->ops->drop(cl->q)) + if (cl->q->ops->drop && cl->q->ops->drop(cl->q)) { + sch->q.qlen--; return 1; + } } while ((cl = cl->next_alive) != cl_head); } return 0; @@ -1740,9 +1743,13 @@ } for (h = 0; h < 16; h++) { - for (cl = q->classes[h]; cl; cl = cl->next) + struct cbq_class *next; + + for (cl = q->classes[h]; cl; cl = next) { + next = cl->next; if (cl != &q->link) cbq_destroy_class(cl); + } } qdisc_put_rtab(q->link.R_tab); @@ -2113,3 +2120,4 @@ unregister_qdisc(&cbq_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_csz.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_csz.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_csz.c 14 Jan 2001 17:14:36 -0000 1.1.1.1 +++ sch_csz.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -1069,3 +1069,4 @@ unregister_qdisc(&csz_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_dsmark.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_dsmark.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sch_dsmark.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ sch_dsmark.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -84,7 +84,9 @@ static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg) { - return NULL; + struct dsmark_qdisc_data *p = PRIV(sch); + + return p->q; } @@ -187,7 +189,7 @@ struct dsmark_qdisc_data *p = PRIV(sch); struct tcf_result res; int result; - int ret; + int ret = NET_XMIT_POLICED; D2PRINTK("dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n",skb,sch,p); if (p->set_tc_index) { @@ -237,7 +239,7 @@ ((ret = p->q->enqueue(skb,p->q)) != 0)) { sch->stats.drops++; - return 0; + return ret; } sch->stats.bytes += skb->len; sch->stats.packets++; @@ -488,3 +490,4 @@ unregister_qdisc(&dsmark_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_gred.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_gred.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sch_gred.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ sch_gred.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -298,14 +298,11 @@ static void gred_reset(struct Qdisc* sch) { - struct sk_buff *skb; int i; - struct gred_sched_data *q; struct gred_sched *t= (struct gred_sched *)sch->data; - while((skb=__skb_dequeue(&sch->q))!=NULL) - kfree_skb(skb); + __skb_queue_purge(&sch->q); sch->stats.backlog = 0; @@ -635,3 +632,4 @@ unregister_qdisc(&gred_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_ingress.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_ingress.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_ingress.c 14 Jan 2001 17:15:08 -0000 1.1.1.1 +++ sch_ingress.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -392,3 +392,4 @@ unregister_qdisc(&ingress_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_prio.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_prio.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_prio.c 14 Jan 2001 17:14:39 -0000 1.1.1.1 +++ sch_prio.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -421,3 +421,4 @@ } #endif +MODULE_LICENSE("GPL"); Index: sch_red.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_red.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_red.c 14 Jan 2001 17:14:41 -0000 1.1.1.1 +++ sch_red.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -363,10 +363,8 @@ static void red_reset(struct Qdisc* sch) { struct red_sched_data *q = (struct red_sched_data *)sch->data; - struct sk_buff *skb; - while((skb=__skb_dequeue(&sch->q))!=NULL) - kfree_skb(skb); + __skb_queue_purge(&sch->q); sch->stats.backlog = 0; PSCHED_SET_PASTPERFECT(q->qidlestart); q->qave = 0; @@ -499,3 +497,4 @@ unregister_qdisc(&red_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_sfq.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_sfq.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_sfq.c 14 Jan 2001 17:14:42 -0000 1.1.1.1 +++ sch_sfq.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -496,3 +496,4 @@ unregister_qdisc(&sfq_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_tbf.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_tbf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_tbf.c 14 Jan 2001 17:14:44 -0000 1.1.1.1 +++ sch_tbf.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -66,7 +66,7 @@ N(t+delta) = min{B/R, N(t) + delta} If the first packet in queue has length S, it may be - transmited only at the time t_* when S/R <= N(t_*), + transmitted only at the time t_* when S/R <= N(t_*), and in this case N(t) jumps: N(t_* + 0) = N(t_* - 0) - S/R. @@ -227,7 +227,7 @@ } if (!netif_queue_stopped(sch->dev)) { - long delay = PSCHED_US2JIFFIE(max(-toks, -ptoks)); + long delay = PSCHED_US2JIFFIE(max_t(long, -toks, -ptoks)); if (delay == 0) delay = 1; @@ -276,7 +276,7 @@ struct tc_tbf_qopt *qopt; struct qdisc_rate_table *rtab = NULL; struct qdisc_rate_table *ptab = NULL; - int max_size; + int max_size,n; if (rtattr_parse(tb, TCA_TBF_PTAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) || tb[TCA_TBF_PARMS-1] == NULL || @@ -295,15 +295,18 @@ goto done; } - max_size = psched_mtu(sch->dev); + for (n = 0; n < 256; n++) + if (rtab->data[n] > qopt->buffer) break; + max_size = (n << qopt->rate.cell_log)-1; if (ptab) { - int n = max_size>>qopt->peakrate.cell_log; - while (n>0 && ptab->data[n-1] > qopt->mtu) { - max_size -= (1<<qopt->peakrate.cell_log); - n--; - } + int size; + + for (n = 0; n < 256; n++) + if (ptab->data[n] > qopt->mtu) break; + size = (n << qopt->peakrate.cell_log)-1; + if (size < max_size) max_size = size; } - if (rtab->data[max_size>>qopt->rate.cell_log] > qopt->buffer) + if (max_size < 0) goto done; sch_tree_lock(sch); @@ -424,3 +427,4 @@ unregister_qdisc(&tbf_qdisc_ops); } #endif +MODULE_LICENSE("GPL"); Index: sch_teql.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sched/sch_teql.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sch_teql.c 14 Jan 2001 17:14:56 -0000 1.1.1.1 +++ sch_teql.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -493,3 +493,4 @@ rtnl_unlock(); } #endif +MODULE_LICENSE("GPL"); |
From: Andy P. <at...@us...> - 2002-04-09 16:29:14
|
Update of /cvsroot/linux-vax/kernel-2.4/net/packet In directory usw-pr-cvs1:/tmp/cvs-serv32481/packet Modified Files: af_packet.c Log Message: synch 2.4.15 commit 21 Index: af_packet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/packet/af_packet.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_packet.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ af_packet.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -149,7 +149,7 @@ */ /* List of all packet sockets. */ -static struct sock * packet_sklist = NULL; +static struct sock * packet_sklist; static rwlock_t packet_sklist_lock = RW_LOCK_UNLOCKED; atomic_t packet_socks_nr; @@ -404,6 +404,7 @@ struct sockaddr_ll *sll; struct packet_opt *po; u8 * skb_head = skb->data; + int skb_len = skb->len; #ifdef CONFIG_FILTER unsigned snaplen; #endif @@ -461,7 +462,7 @@ if (skb_head != skb->data) { skb->data = skb_head; - skb->len = skb->tail - skb->data; + skb->len = skb_len; } kfree_skb(skb); skb = nskb; @@ -479,8 +480,8 @@ sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr); #ifdef CONFIG_FILTER - if (skb->len > snaplen) - __skb_trim(skb, snaplen); + if (pskb_trim(skb, snaplen)) + goto drop_n_acct; #endif skb_set_owner_r(skb, sk); @@ -502,7 +503,7 @@ #endif if (skb_head != skb->data && skb_shared(skb)) { skb->data = skb_head; - skb->len = skb->tail - skb->data; + skb->len = skb_len; } drop: kfree_skb(skb); @@ -517,6 +518,7 @@ struct sockaddr_ll *sll; struct tpacket_hdr *h; u8 * skb_head = skb->data; + int skb_len = skb->len; unsigned snaplen; unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; unsigned short macoff, netoff; @@ -534,6 +536,8 @@ else if (skb->pkt_type == PACKET_OUTGOING) { /* Special case: outgoing packets have ll header at head */ skb_pull(skb, skb->nh.raw - skb->data); + if (skb->ip_summed == CHECKSUM_HW) + status |= TP_STATUS_CSUMNOTREADY; } } @@ -580,6 +584,8 @@ if ((int)snaplen < 0) snaplen = 0; } + if (snaplen > skb->len-skb->data_len) + snaplen = skb->len-skb->data_len; spin_lock(&sk->receive_queue.lock); h = po->iovec[po->head]; @@ -618,12 +624,24 @@ h->tp_status = status; mb(); + { + struct page *p_start, *p_end; + u8 *h_end = (u8 *)h + macoff + snaplen - 1; + + p_start = virt_to_page(h); + p_end = virt_to_page(h_end); + while (p_start <= p_end) { + flush_dcache_page(p_start); + p_start++; + } + } + sk->data_ready(sk, 0); drop_n_restore: if (skb_head != skb->data && skb_shared(skb)) { skb->data = skb_head; - skb->len = skb->tail - skb->data; + skb->len = skb_len; } drop: kfree_skb(skb); @@ -682,7 +700,7 @@ if (len > dev->mtu+reserve) goto out_unlock; - skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, 0, + skb = sock_alloc_send_skb(sk, len+dev->hard_header_len+15, msg->msg_flags & MSG_DONTWAIT, &err); if (skb==NULL) goto out_unlock; @@ -1051,8 +1069,7 @@ msg->msg_flags|=MSG_TRUNC; } - /* We can't use skb_copy_datagram here */ - err = memcpy_toiovec(msg->msg_iov, skb->data, copied); + err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); if (err) goto out_free; @@ -1318,6 +1335,9 @@ if (get_user(len,optlen)) return -EFAULT; + if (len < 0) + return -EINVAL; + switch(optname) { case PACKET_STATISTICS: { @@ -1399,11 +1419,10 @@ } -static int packet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +static int packet_ioctl(struct socket *sock, unsigned int cmd, + unsigned long arg) { struct sock *sk = sock->sk; - int err; - int pid; switch(cmd) { @@ -1425,25 +1444,26 @@ return put_user(amount, (int *)arg); } case FIOSETOWN: - case SIOCSPGRP: - err = get_user(pid, (int *) arg); - if (err) - return err; + case SIOCSPGRP: { + int pid; + if (get_user(pid, (int *) arg)) + return -EFAULT; if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN)) return -EPERM; sk->proc = pid; - return(0); + break; + } case FIOGETOWN: case SIOCGPGRP: return put_user(sk->proc, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; - err = -EFAULT; - if (!copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval))) - err = 0; - return err; + if (copy_to_user((void *)arg, &sk->stamp, + sizeof(struct timeval))) + return -EFAULT; + break; case SIOCGIFFLAGS: #ifndef CONFIG_INET case SIOCSIFFLAGS: @@ -1480,16 +1500,15 @@ return br_ioctl_hook(arg); #endif #endif + return -ENOPKG; case SIOCGIFDIVERT: case SIOCSIFDIVERT: #ifdef CONFIG_NET_DIVERT - return(divert_ioctl(cmd, (struct divert_cf *) arg)); + return divert_ioctl(cmd, (struct divert_cf *) arg); #else return -ENOPKG; #endif /* CONFIG_NET_DIVERT */ - - return -ENOPKG; #ifdef CONFIG_INET case SIOCADDRT: @@ -1522,8 +1541,7 @@ #endif return -EOPNOTSUPP; } - /*NOTREACHED*/ - return(0); + return 0; } #ifndef CONFIG_PACKET_MMAP @@ -1780,6 +1798,7 @@ sendmsg: packet_sendmsg_spkt, recvmsg: packet_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #endif @@ -1801,17 +1820,16 @@ sendmsg: packet_sendmsg, recvmsg: packet_recvmsg, mmap: packet_mmap, + sendpage: sock_no_sendpage, }; static struct net_proto_family packet_family_ops = { - PF_PACKET, - packet_create + family: PF_PACKET, + create: packet_create, }; -struct notifier_block packet_netdev_notifier={ - packet_notifier, - NULL, - 0 +static struct notifier_block packet_netdev_notifier = { + notifier_call: packet_notifier, }; #ifdef CONFIG_PROC_FS @@ -1864,19 +1882,14 @@ } #endif - - static void __exit packet_exit(void) { -#ifdef CONFIG_PROC_FS remove_proc_entry("net/packet", 0); -#endif unregister_netdevice_notifier(&packet_netdev_notifier); sock_unregister(PF_PACKET); return; } - static int __init packet_init(void) { sock_register(&packet_family_ops); @@ -1886,7 +1899,6 @@ #endif return 0; } - module_init(packet_init); module_exit(packet_exit); |
From: Andy P. <at...@us...> - 2002-04-09 16:29:14
|
Update of /cvsroot/linux-vax/kernel-2.4/net/x25 In directory usw-pr-cvs1:/tmp/cvs-serv32481/x25 Modified Files: af_x25.c x25_link.c x25_out.c x25_subr.c Log Message: synch 2.4.15 commit 21 Index: af_x25.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/x25/af_x25.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_x25.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ af_x25.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -407,8 +407,11 @@ return -ENOPROTOOPT; } - len = min(len, sizeof(int)); + len = min_t(unsigned int, len, sizeof(int)); + if (len < 0) + return -EINVAL; + if (put_user(len, optlen)) return -EFAULT; @@ -912,7 +915,7 @@ size = len + X25_MAX_L2_LEN + X25_EXT_MIN_LEN; - if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) + if ((skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) return err; X25_SKB_CB(skb)->flags = msg->msg_flags; @@ -1283,6 +1286,7 @@ sendmsg: x25_sendmsg, recvmsg: x25_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> Index: x25_link.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/x25/x25_link.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- x25_link.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ x25_link.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -309,10 +309,8 @@ { struct x25_neigh *s; unsigned long flags; - struct sk_buff *skb; - while ((skb = skb_dequeue(&x25_neigh->queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&x25_neigh->queue); x25_stop_t20timer(x25_neigh); Index: x25_out.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/x25/x25_out.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- x25_out.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ x25_out.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -79,7 +79,7 @@ frontlen = skb_headroom(skb); while (skb->len > 0) { - if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, 0, noblock, &err)) == NULL){ + if ((skbn = sock_alloc_send_skb(sk, frontlen + max_len, noblock, &err)) == NULL){ if(err == -EWOULDBLOCK && noblock){ kfree_skb(skb); return sent; Index: x25_subr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/x25/x25_subr.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- x25_subr.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ x25_subr.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -17,6 +17,7 @@ * X.25 002 Jonathan Naylor Centralised disconnection processing. * mar/20/00 Daniela Squassoni Disabling/enabling of facilities * negotiation. + * jun/24/01 Arnaldo C. Melo use skb_queue_purge, cleanups */ #include <linux/errno.h> @@ -45,22 +46,11 @@ */ void x25_clear_queues(struct sock *sk) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&sk->write_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.x25->ack_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.x25->interrupt_in_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.x25->interrupt_out_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.x25->fragment_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&sk->write_queue); + skb_queue_purge(&sk->protinfo.x25->ack_queue); + skb_queue_purge(&sk->protinfo.x25->interrupt_in_queue); + skb_queue_purge(&sk->protinfo.x25->interrupt_out_queue); + skb_queue_purge(&sk->protinfo.x25->fragment_queue); } @@ -72,20 +62,20 @@ void x25_frames_acked(struct sock *sk, unsigned short nr) { struct sk_buff *skb; - int modulus; - - modulus = (sk->protinfo.x25->neighbour->extended) ? X25_EMODULUS : X25_SMODULUS; + int modulus = sk->protinfo.x25->neighbour->extended ? X25_EMODULUS : + X25_SMODULUS; /* * Remove all the ack-ed frames from the ack queue. */ - if (sk->protinfo.x25->va != nr) { - while (skb_peek(&sk->protinfo.x25->ack_queue) != NULL && sk->protinfo.x25->va != nr) { + if (sk->protinfo.x25->va != nr) + while (skb_peek(&sk->protinfo.x25->ack_queue) != NULL && + sk->protinfo.x25->va != nr) { skb = skb_dequeue(&sk->protinfo.x25->ack_queue); kfree_skb(skb); - sk->protinfo.x25->va = (sk->protinfo.x25->va + 1) % modulus; + sk->protinfo.x25->va = (sk->protinfo.x25->va + 1) % + modulus; } - } } void x25_requeue_frames(struct sock *sk) @@ -113,18 +103,15 @@ int x25_validate_nr(struct sock *sk, unsigned short nr) { unsigned short vc = sk->protinfo.x25->va; - int modulus; - - modulus = (sk->protinfo.x25->neighbour->extended) ? X25_EMODULUS : X25_SMODULUS; + int modulus = sk->protinfo.x25->neighbour->extended ? X25_EMODULUS : + X25_SMODULUS; while (vc != sk->protinfo.x25->vs) { if (nr == vc) return 1; vc = (vc + 1) % modulus; } - if (nr == sk->protinfo.x25->vs) return 1; - - return 0; + return nr == sk->protinfo.x25->vs ? 1 : 0; } /* @@ -150,7 +137,8 @@ */ switch (frametype) { case X25_CALL_REQUEST: - len += 1 + X25_ADDR_LEN + X25_MAX_FAC_LEN + X25_MAX_CUD_LEN; + len += 1 + X25_ADDR_LEN + X25_MAX_FAC_LEN + + X25_MAX_CUD_LEN; break; case X25_CALL_ACCEPTED: len += 1 + X25_MAX_FAC_LEN + X25_MAX_CUD_LEN; @@ -167,7 +155,8 @@ case X25_RESET_CONFIRMATION: break; default: - printk(KERN_ERR "X.25: invalid frame type %02X\n", frametype); + printk(KERN_ERR "X.25: invalid frame type %02X\n", + frametype); return; } @@ -262,11 +251,10 @@ /* * Unpick the contents of the passed X.25 Packet Layer frame. */ -int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, int *d, int *m) +int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, + int *d, int *m) { - unsigned char *frame; - - frame = skb->data; + unsigned char *frame = skb->data; *ns = *nr = *q = *d = *m = 0; @@ -323,12 +311,14 @@ } } - printk(KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n", frame[0], frame[1], frame[2]); + printk(KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n", + frame[0], frame[1], frame[2]); return X25_ILLEGAL; } -void x25_disconnect(struct sock *sk, int reason, unsigned char cause, unsigned char diagnostic) +void x25_disconnect(struct sock *sk, int reason, unsigned char cause, + unsigned char diagnostic) { x25_clear_queues(sk); x25_stop_timer(sk); |
From: Andy P. <at...@us...> - 2002-04-09 16:29:14
|
Update of /cvsroot/linux-vax/kernel-2.4/net/wanrouter In directory usw-pr-cvs1:/tmp/cvs-serv32481/wanrouter Modified Files: Makefile patchlevel wanmain.c wanproc.c Added Files: af_wanpipe.c Log Message: synch 2.4.15 commit 21 --- NEW FILE --- /***************************************************************************** * af_wanpipe.c WANPIPE(tm) Secure Socket Layer. * * Author: Nenad Corbic <nc...@sa...> * * Copyright: (c) 2000 Sangoma Technologies Inc. * * 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. * ============================================================================ * Due Credit: * Wanpipe socket layer is based on Packet and * the X25 socket layers. The above sockets were * used for the specific use of Sangoma Technoloiges * API programs. * Packet socket Authors: Ross Biro, Fred N. van Kempen and * Alan Cox. [...2727 lines suppressed...] #ifdef MODULE void cleanup_module(void) { printk(KERN_INFO "wansock: Cleaning up \n"); unregister_netdevice_notifier(&wanpipe_netdev_notifier); sock_unregister(PF_WANPIPE); return; } int init_module(void) { printk(KERN_INFO "wansock: Registering Socket \n"); sock_register(&wanpipe_family_ops); register_netdevice_notifier(&wanpipe_netdev_notifier); return 0; } #endif MODULE_LICENSE("GPL"); Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/wanrouter/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 17:13:49 -0000 1.1.1.1 +++ Makefile 9 Apr 2002 16:29:02 -0000 1.2 @@ -13,8 +13,8 @@ obj-y := wanproc.o wanmain.o obj-m := $(O_TARGET) +ifneq ($(CONFIG_VENDOR_SANGOMA),n) + obj-m += $(O_TARGET) +endif include $(TOPDIR)/Rules.make - -tar: - tar -cvf /dev/f1 . Index: patchlevel =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/wanrouter/patchlevel,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- patchlevel 14 Jan 2001 17:13:50 -0000 1.1.1.1 +++ patchlevel 9 Apr 2002 16:29:02 -0000 1.2 @@ -1 +1 @@ -2.0.3 +2.2.1 Index: wanmain.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/wanrouter/wanmain.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- wanmain.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ wanmain.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -5,7 +5,7 @@ * the following common services for the WAN Link Drivers: * o WAN device managenment (registering, unregistering) * o Network interface management -* o Physical connection management (dial-up, incomming calls) +* o Physical connection management (dial-up, incoming calls) * o Logical connection management (switched virtual circuits) * o Protocol encapsulation/decapsulation * @@ -18,6 +18,14 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Nov 24, 2000 Nenad Corbic Updated for 2.4.X kernels +* Nov 07, 2000 Nenad Corbic Fixed the Mulit-Port PPP for kernels 2.2.16 and +* greater. +* Aug 2, 2000 Nenad Corbic Block the Multi-Port PPP from running on +* kernels 2.2.16 or greater. The SyncPPP +* has changed. +* Jul 13, 2000 Nenad Corbic Added SyncPPP support +* Added extra debugging in device_setup(). * Oct 01, 1999 Gideon Hack Update for s514 PCI card * Dec 27, 1996 Gene Kozin Initial version (based on Sangoma's WANPIPE) * Jan 16, 1997 Gene Kozin router_devlist made public @@ -31,7 +39,6 @@ * Dec 22, 1998 Arnaldo Melo vmalloc/vfree used in device_setup to allocate * kernel memory and copy configuration data to * kernel space (for big firmwares) -* May 19, 1999 Arnaldo Melo __init in wanrouter_init * Jun 02, 1999 Gideon Hack Updates for Linux 2.0.X and 2.2.X kernels. *****************************************************************************/ @@ -44,26 +51,93 @@ #include <linux/slab.h> /* kmalloc(), kfree() */ #include <linux/mm.h> /* verify_area(), etc. */ #include <linux/string.h> /* inline mem*, str* functions */ -#include <linux/vmalloc.h> /* vmalloc, vfree */ -#include <asm/segment.h> /* kernel <-> user copy */ + #include <asm/byteorder.h> /* htons(), etc. */ -#include <asm/uaccess.h> /* copy_to/from_user */ #include <linux/wanrouter.h> /* WAN router API definitions */ -#include <linux/init.h> /* __init et al. */ +#if defined(LINUX_2_4) + #include <linux/vmalloc.h> /* vmalloc, vfree */ + #include <asm/uaccess.h> /* copy_to/from_user */ + #include <linux/init.h> /* __initfunc et al. */ -/* - * Defines and Macros - */ - -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3) + #include <net/syncppp.h> +#else + #include <../drivers/net/wan/syncppp.h> #endif -#ifndef max -#define max(a,b) (((a)>(b))?(a):(b)) + +#elif defined(LINUX_2_1) + #define LINUX_2_1 + #include <linux/vmalloc.h> /* vmalloc, vfree */ + #include <asm/uaccess.h> /* copy_to/from_user */ + #include <linux/init.h> /* __initfunc et al. */ + #include <../drivers/net/syncppp.h> + +#else + #include <asm/segment.h> /* kernel <-> user copy */ #endif +#define KMEM_SAFETYZONE 8 + +/***********FOR DEBUGGING PURPOSES********************************************* +static void * dbg_kmalloc(unsigned int size, int prio, int line) { + int i = 0; + void * v = kmalloc(size+sizeof(unsigned int)+2*KMEM_SAFETYZONE*8,prio); + char * c1 = v; + c1 += sizeof(unsigned int); + *((unsigned int *)v) = size; + + for (i = 0; i < KMEM_SAFETYZONE; i++) { + c1[0] = 'D'; c1[1] = 'E'; c1[2] = 'A'; c1[3] = 'D'; + c1[4] = 'B'; c1[5] = 'E'; c1[6] = 'E'; c1[7] = 'F'; + c1 += 8; + } + c1 += size; + for (i = 0; i < KMEM_SAFETYZONE; i++) { + c1[0] = 'M'; c1[1] = 'U'; c1[2] = 'N'; c1[3] = 'G'; + c1[4] = 'W'; c1[5] = 'A'; c1[6] = 'L'; c1[7] = 'L'; + c1 += 8; + } + v = ((char *)v) + sizeof(unsigned int) + KMEM_SAFETYZONE*8; + printk(KERN_INFO "line %d kmalloc(%d,%d) = %p\n",line,size,prio,v); + return v; +} +static void dbg_kfree(void * v, int line) { + unsigned int * sp = (unsigned int *)(((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8)); + unsigned int size = *sp; + char * c1 = ((char *)v) - KMEM_SAFETYZONE*8; + int i = 0; + for (i = 0; i < KMEM_SAFETYZONE; i++) { + if ( c1[0] != 'D' || c1[1] != 'E' || c1[2] != 'A' || c1[3] != 'D' + || c1[4] != 'B' || c1[5] != 'E' || c1[6] != 'E' || c1[7] != 'F') { + printk(KERN_INFO "kmalloced block at %p has been corrupted (underrun)!\n",v); + printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8, + c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] ); + } + c1 += 8; + } + c1 += size; + for (i = 0; i < KMEM_SAFETYZONE; i++) { + if ( c1[0] != 'M' || c1[1] != 'U' || c1[2] != 'N' || c1[3] != 'G' + || c1[4] != 'W' || c1[5] != 'A' || c1[6] != 'L' || c1[7] != 'L' + ) { + printk(KERN_INFO "kmalloced block at %p has been corrupted (overrun):\n",v); + printk(KERN_INFO " %4x: %2x %2x %2x %2x %2x %2x %2x %2x\n", i*8, + c1[0],c1[1],c1[2],c1[3],c1[4],c1[5],c1[6],c1[7] ); + } + c1 += 8; + } + printk(KERN_INFO "line %d kfree(%p)\n",line,v); + v = ((char *)v) - (sizeof(unsigned int) + KMEM_SAFETYZONE*8); + kfree(v); +} + +#define kmalloc(x,y) dbg_kmalloc(x,y,__LINE__) +#define kfree(x) dbg_kfree(x,__LINE__) +*****************************************************************************/ + + /* * Function Prototypes */ @@ -91,14 +165,18 @@ */ static wan_device_t *find_device (char *name); -static int delete_interface (wan_device_t *wandev, char *name, int force); +static int delete_interface (wan_device_t *wandev, char *name); +void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); +void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags); + + /* * Global Data */ -static char fullname[] = "WAN Router"; -static char copyright[] = "(c) 1995-1999 Sangoma Technologies Inc."; +static char fullname[] = "Sangoma WANPIPE Router"; +static char copyright[] = "(c) 1995-2000 Sangoma Technologies Inc."; static char modname[] = ROUTER_NAME; /* short module name */ wan_device_t* router_devlist = NULL; /* list of registered devices */ static int devcnt = 0; @@ -113,31 +191,41 @@ #endif #ifndef MODULE -int __init wanrouter_init(void) + +int wanrouter_init(void) { int err; - extern int wanpipe_init(void), - cyclomx_init(void); + extern int wanpipe_init(void); + extern int sdladrv_init(void); printk(KERN_INFO "%s v%u.%u %s\n", fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright); + err = wanrouter_proc_init(); - if (err) - printk(KERN_ERR "%s: can't create entry in proc filesystem!\n", modname); + if (err){ + printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", modname); + } + + /* + * Initialise compiled in boards + */ - /* - * Initialise compiled in boards - */ - #ifdef CONFIG_VENDOR_SANGOMA + sdladrv_init(); wanpipe_init(); #endif -#ifdef CONFIG_CYCLADES_SYNC - cyclomx_init(); -#endif + return err; } + +#ifdef LINUX_2_4 +static void __exit wanrouter_cleanup (void) +{ + wanrouter_proc_cleanup(); +} +#endif + #else /* @@ -161,9 +249,13 @@ printk(KERN_INFO "%s v%u.%u %s\n", fullname, ROUTER_VERSION, ROUTER_RELEASE, copyright); + err = wanrouter_proc_init(); - if (err) printk(KERN_ERR + + if (err){ + printk(KERN_INFO "%s: can't create entry in proc filesystem!\n", modname); + } return err; } @@ -207,7 +299,7 @@ if ((wandev == NULL) || (wandev->magic != ROUTER_MAGIC) || (wandev->name == NULL)) return -EINVAL; - + namelen = strlen(wandev->name); if (!namelen || (namelen > WAN_DRVNAME_SZ)) return -EINVAL; @@ -219,12 +311,13 @@ printk(KERN_INFO "%s: registering WAN device %s\n", modname, wandev->name); #endif + /* * Register /proc directory entry */ err = wanrouter_proc_add(wandev); if (err) { - printk(KERN_ERR + printk(KERN_INFO "%s: can't create /proc/net/router/%s entry!\n", modname, wandev->name); return err; @@ -274,17 +367,17 @@ #ifdef WANDEBUG printk(KERN_INFO "%s: unregistering WAN device %s\n", modname, name); #endif - + if (wandev->state != WAN_UNCONFIGURED) { - while(wandev->dev) - delete_interface(wandev, wandev->dev->name, 1); - if (wandev->shutdown) - wandev->shutdown(wandev); + device_shutdown(wandev); } - if (prev) + + if (prev){ prev->next = wandev->next; - else + }else{ router_devlist = wandev->next; + } + --devcnt; wanrouter_proc_delete(wandev); MOD_DEC_USE_COUNT; @@ -302,12 +395,12 @@ */ -int wanrouter_encapsulate (struct sk_buff* skb, struct net_device* dev) +int wanrouter_encapsulate (struct sk_buff *skb, netdevice_t *dev, + unsigned short type) { int hdr_len = 0; - switch (skb->protocol) - { + switch (type) { case ETH_P_IP: /* IP datagram encapsulation */ hdr_len += 1; skb_push(skb, 1); @@ -321,18 +414,19 @@ skb->data[0] = 0; skb->data[1] = NLPID_SNAP; memcpy(&skb->data[2], oui_ether, sizeof(oui_ether)); - *((unsigned short*)&skb->data[5]) = htons(skb->protocol); + *((unsigned short*)&skb->data[5]) = htons(type); break; default: /* Unknown packet type */ printk(KERN_INFO "%s: unsupported Ethertype 0x%04X on interface %s!\n", - modname, skb->protocol, dev->name); + modname, type, dev->name); hdr_len = -EINVAL; } return hdr_len; } + /* * Decapsulate packet. * @@ -344,21 +438,19 @@ */ -unsigned short wanrouter_type_trans (struct sk_buff* skb, struct net_device* dev) +unsigned short wanrouter_type_trans (struct sk_buff *skb, netdevice_t *dev) { int cnt = skb->data[0] ? 0 : 1; /* there may be a pad present */ unsigned short ethertype; - switch (skb->data[cnt]) - { + switch (skb->data[cnt]) { case NLPID_IP: /* IP datagramm */ ethertype = htons(ETH_P_IP); cnt += 1; break; case NLPID_SNAP: /* SNAP encapsulation */ - if (memcmp(&skb->data[cnt + 1], oui_ether, sizeof(oui_ether))) - { + if (memcmp(&skb->data[cnt + 1], oui_ether, sizeof(oui_ether))){ printk(KERN_INFO "%s: unsupported SNAP OUI %02X-%02X-%02X " "on interface %s!\n", modname, @@ -380,8 +472,8 @@ } skb->protocol = ethertype; skb->pkt_type = PACKET_HOST; /* Physically point to point */ - skb->mac.raw = skb->data; skb_pull(skb, cnt); + skb->mac.raw = skb->data; return ethertype; } @@ -399,9 +491,11 @@ struct proc_dir_entry *dent; wan_device_t *wandev; + #if defined (LINUX_2_1) || defined (LINUX_2_4) if (!capable(CAP_NET_ADMIN)){ return -EPERM; } + #endif if ((cmd >> 8) != ROUTER_IOCTL) return -EINVAL; @@ -466,44 +560,105 @@ wandev_conf_t *conf; int err = -EINVAL; - if (wandev->setup == NULL) /* Nothing to do ? */ + if (wandev->setup == NULL){ /* Nothing to do ? */ + printk(KERN_INFO "%s: ERROR, No setup script: wandev->setup()\n", + wandev->name); return 0; + } + + #ifdef LINUX_2_0 + err = verify_area (VERIFY_READ, u_conf, sizeof(wandev_conf_t)); + if(err){ + return err; + } + #endif conf = kmalloc(sizeof(wandev_conf_t), GFP_KERNEL); - if (conf == NULL) + if (conf == NULL){ + printk(KERN_INFO "%s: ERROR, Failed to allocate kernel memory !\n", + wandev->name); return -ENOBUFS; - + } + + #if defined (LINUX_2_1) || defined (LINUX_2_4) if(copy_from_user(conf, u_conf, sizeof(wandev_conf_t))) { + printk(KERN_INFO "%s: Failed to copy user config data to kernel space!\n", + wandev->name); kfree(conf); return -EFAULT; } + #else + memcpy_fromfs ((void *)conf, (void *)u_conf, sizeof(wandev_conf_t)); + #endif - if (conf->magic != ROUTER_MAGIC) { + if (conf->magic != ROUTER_MAGIC){ kfree(conf); + printk(KERN_INFO "%s: ERROR, Invalid MAGIC Number\n", + wandev->name); return -EINVAL; } - if (conf->data_size && conf->data) { + if (conf->data_size && conf->data){ if(conf->data_size > 128000 || conf->data_size < 0) { + printk(KERN_INFO + "%s: ERROR, Invalid firmware data size %i !\n", + wandev->name, conf->data_size); kfree(conf); return -EINVAL;; } +#if defined (LINUX_2_1) || defined (LINUX_2_4) data = vmalloc(conf->data_size); if (data) { if(!copy_from_user(data, conf->data, conf->data_size)){ conf->data=data; err = wandev->setup(wandev,conf); - } - else + }else{ + printk(KERN_INFO + "%s: ERROR, Faild to copy from user data !\n", + wandev->name); err = -EFAULT; - } - else + } + }else{ + printk(KERN_INFO + "%s: ERROR, Faild allocate kernel memory !\n", + wandev->name); err = -ENOBUFS; - - if (data) + } + + if (data){ vfree(data); + } +#else + err = verify_area(VERIFY_READ, conf->data, conf->data_size); + if (!err) { + data = kmalloc(conf->data_size, GFP_KERNEL); + if (data) { + memcpy_fromfs(data, (void*)conf->data, + conf->data_size); + conf->data = data; + }else{ + printk(KERN_INFO + "%s: ERROR, Faild allocate kernel memory !\n",wandev->name); + err = -ENOMEM; + } + }else{ + printk(KERN_INFO + "%s: ERROR, Faild to copy from user data !\n",wandev->name); + } + if (!err){ + err = wandev->setup(wandev, conf); + } + + if (data){ + kfree(data); + } +#endif + }else{ + printk(KERN_INFO + "%s: ERROR, No firmware found ! Firmware size = %i !\n", + wandev->name, conf->data_size); } kfree(conf); @@ -516,27 +671,37 @@ * o call driver's shutdown() entry point */ -static int device_shutdown (wan_device_t* wandev) +static int device_shutdown (wan_device_t *wandev) { - struct net_device* dev; - - if (wandev->state == WAN_UNCONFIGURED) + netdevice_t *dev; + int err=0; + + if (wandev->state == WAN_UNCONFIGURED){ return 0; + } + + printk(KERN_INFO "\n%s: Shutting Down!\n",wandev->name); - for (dev = wandev->dev; dev;) - { - if (delete_interface(wandev, dev->name, 0)) - { - struct net_device **slave = dev->priv; - dev = *slave; + for (dev = wandev->dev; dev;) { + if ((err=delete_interface(wandev, dev->name)) != 0){ + return err; } + + /* The above function deallocates the current dev + * structure. Therefore, we cannot use dev->priv + * as the next element: wandev->dev points to the + * next element */ + dev = wandev->dev; } - if (wandev->ndev) + + if (wandev->ndev){ return -EBUSY; /* there are opened interfaces */ - + } + if (wandev->shutdown) - return wandev->shutdown(wandev); - return 0; + err=wandev->shutdown(wandev); + + return err; } /* @@ -547,6 +712,13 @@ { wandev_stat_t stat; + #ifdef LINUX_2_0 + int err; + err = verify_area(VERIFY_WRITE, u_stat, sizeof(wandev_stat_t)); + if (err) + return err; + #endif + memset(&stat, 0, sizeof(stat)); /* Ask device driver to update device statistics */ @@ -557,8 +729,12 @@ stat.ndev = wandev->ndev; stat.state = wandev->state; + #if defined (LINUX_2_1) || defined (LINUX_2_4) if(copy_to_user(u_stat, &stat, sizeof(stat))) return -EFAULT; + #else + memcpy_tofs((void*)u_stat, (void*)&stat, sizeof(stat)); + #endif return 0; } @@ -573,58 +749,150 @@ * o register network interface */ -static int device_new_if (wan_device_t* wandev, wanif_conf_t* u_conf) +static int device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf) { wanif_conf_t conf; - struct net_device *dev; + netdevice_t *dev=NULL; +#ifdef CONFIG_WANPIPE_MULTPPP + struct ppp_device *pppdev=NULL; +#endif int err; if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL)) return -ENODEV; - + +#if defined (LINUX_2_1) || defined (LINUX_2_4) if(copy_from_user(&conf, u_conf, sizeof(wanif_conf_t))) return -EFAULT; +#else + err = verify_area(VERIFY_READ, u_conf, sizeof(wanif_conf_t)); + if (err) + return err; + memcpy_fromfs((void*)&conf, (void*)u_conf, sizeof(wanif_conf_t)); +#endif if (conf.magic != ROUTER_MAGIC) return -EINVAL; + + err = -EPROTONOSUPPORT; + + +#ifdef CONFIG_WANPIPE_MULTPPP + if (conf.config_id == WANCONFIG_MPPP){ + + pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL); + if (pppdev == NULL){ + return -ENOBUFS; + } + memset(pppdev, 0, sizeof(struct ppp_device)); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,16) + pppdev->dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL); + if (pppdev->dev == NULL){ + kfree(pppdev); + return -ENOBUFS; + } + memset(pppdev->dev, 0, sizeof(netdevice_t)); +#endif - dev = kmalloc(sizeof(struct net_device), GFP_KERNEL); - if (dev == NULL) - return -ENOBUFS; + err = wandev->new_if(wandev, (netdevice_t *)pppdev, &conf); - memset(dev, 0, sizeof(struct net_device)); - err = wandev->new_if(wandev, dev, &conf); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,16) + dev = pppdev->dev; + #else + dev = &pppdev->dev; + #endif + + }else{ + + dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL); + if (dev == NULL){ + return -ENOBUFS; + } + memset(dev, 0, sizeof(netdevice_t)); + err = wandev->new_if(wandev, dev, &conf); + } + +#else + /* Sync PPP is disabled */ + if (conf.config_id != WANCONFIG_MPPP){ + + dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL); + if (dev == NULL){ + return -ENOBUFS; + } + memset(dev, 0, sizeof(netdevice_t)); + err = wandev->new_if(wandev, dev, &conf); + }else{ + printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n", + wandev->name); + return err; + } +#endif + if (!err) { /* Register network interface. This will invoke init() * function supplied by the driver. If device registered * successfully, add it to the interface list. */ - if (dev->name == NULL) + + if (dev->name == NULL){ err = -EINVAL; - - else if (dev_get(dev->name)) + }else if (dev_get(dev->name)){ err = -EEXIST; /* name already exists */ - else { -#ifdef WANDEBUG + }else{ + + #ifdef WANDEBUG printk(KERN_INFO "%s: registering interface %s...\n", modname, dev->name); -#endif + #endif + err = register_netdev(dev); if (!err) { - struct net_device **slave = dev->priv; + netdevice_t *slave=NULL; + unsigned long smp_flags=0; + + lock_adapter_irq(&wandev->lock, &smp_flags); + + if (wandev->dev == NULL){ + wandev->dev = dev; + }else{ + for (slave=wandev->dev; + *((netdevice_t**)slave->priv); + slave=*((netdevice_t**)slave->priv)); - cli(); /***** critical section start *****/ - *slave = wandev->dev; - wandev->dev = dev; + *((netdevice_t**)slave->priv) = dev; + } ++wandev->ndev; - sti(); /****** critical section end ******/ + + unlock_adapter_irq(&wandev->lock, &smp_flags); return 0; /* done !!! */ } } if (wandev->del_if) wandev->del_if(wandev, dev); } - kfree(dev); + + /* This code has moved from del_if() function */ + if (dev->priv){ + kfree(dev->priv); + dev->priv=NULL; + } + + + #ifdef CONFIG_WANPIPE_MULTPPP + if (conf.config_id == WANCONFIG_MPPP){ + kfree(pppdev); + }else{ + kfree(dev); + } + #else + /* Sync PPP is disabled */ + if (conf.config_id != WANCONFIG_MPPP){ + kfree(dev); + } + #endif + return err; } @@ -638,15 +906,43 @@ static int device_del_if (wan_device_t *wandev, char *u_name) { char name[WAN_IFNAME_SZ + 1]; + int err = 0; if (wandev->state == WAN_UNCONFIGURED) return -ENODEV; + #ifdef LINUX_2_0 + err = verify_area(VERIFY_READ, u_name, WAN_IFNAME_SZ); + if (err) + return err; + #endif + memset(name, 0, sizeof(name)); + #if defined (LINUX_2_1) || defined (LINUX_2_4) if(copy_from_user(name, u_name, WAN_IFNAME_SZ)) return -EFAULT; - return delete_interface(wandev, name, 0); + #else + memcpy_fromfs((void*)name, (void*)u_name, WAN_IFNAME_SZ); + #endif + + err = delete_interface(wandev, name); + if (err) + return(err); + + /* If last interface being deleted, shutdown card + * This helps with administration at leaf nodes + * (You can tell if the person at the other end of the phone + * has an interface configured) and avoids DoS vulnerabilities + * in binary driver files - this fixes a problem with the current + * Sangoma driver going into strange states when all the network + * interfaces are deleted and the link irrecoverably disconnected. + */ + + if (!wandev->ndev && wandev->shutdown){ + err = wandev->shutdown(wandev); + } + return err; } @@ -685,59 +981,102 @@ * sure that opened interfaces are not removed! */ -static int delete_interface (wan_device_t *wandev, char *name, int force) +static int delete_interface (wan_device_t *wandev, char *name) { - struct net_device *dev, *prev; + netdevice_t *dev=NULL, *prev=NULL; + unsigned long smp_flags=0; + lock_adapter_irq(&wandev->lock, &smp_flags); dev = wandev->dev; prev = NULL; while (dev && strcmp(name, dev->name)) { - struct net_device **slave = dev->priv; - + netdevice_t **slave = dev->priv; prev = dev; dev = *slave; } - - if (dev == NULL) + unlock_adapter_irq(&wandev->lock, &smp_flags); + + if (dev == NULL){ return -ENODEV; /* interface not found */ - - if (netif_running(dev)) { - if (force) { - printk(KERN_WARNING - "%s: deleting opened interface %s!\n", - modname, name); - } - else - return -EBUSY; /* interface in use */ + } + + #ifdef LINUX_2_4 + if (netif_running(dev)){ + #else + if (dev->start) { + #endif + return -EBUSY; /* interface in use */ } if (wandev->del_if) wandev->del_if(wandev, dev); - cli(); /***** critical section start *****/ + lock_adapter_irq(&wandev->lock, &smp_flags); if (prev) { - struct net_device **prev_slave = prev->priv; - struct net_device **slave = dev->priv; + netdevice_t **prev_slave = prev->priv; + netdevice_t **slave = dev->priv; *prev_slave = *slave; } else { - struct net_device **slave = dev->priv; - + netdevice_t **slave = dev->priv; wandev->dev = *slave; } --wandev->ndev; - sti(); /****** critical section end ******/ + unlock_adapter_irq(&wandev->lock, &smp_flags); + + printk(KERN_INFO "%s: unregistering '%s'\n", wandev->name, dev->name); + + /* Due to new interface linking method using dev->priv, + * this code has moved from del_if() function.*/ + if (dev->priv){ + kfree(dev->priv); + dev->priv=NULL; + } - printk("Unregistering '%s'\n", dev->name); unregister_netdev(dev); + + #ifdef LINUX_2_4 kfree(dev); + #else + if (dev->name){ + kfree(dev->name); + } + kfree(dev); + #endif + return 0; } +void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) +{ + #ifdef LINUX_2_0 + save_flags(*smp_flags); + cli(); + #else + spin_lock_irqsave(lock, *smp_flags); + #endif +} + + +void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags) +{ + #ifdef LINUX_2_0 + restore_flags(*smp_flags); + #else + spin_unlock_irqrestore(lock, *smp_flags); + #endif +} + + + +#if defined (LINUX_2_1) || defined (LINUX_2_4) EXPORT_SYMBOL(register_wan_device); EXPORT_SYMBOL(unregister_wan_device); EXPORT_SYMBOL(wanrouter_encapsulate); EXPORT_SYMBOL(wanrouter_type_trans); +EXPORT_SYMBOL(lock_adapter_irq); +EXPORT_SYMBOL(unlock_adapter_irq); +#endif /* * End Index: wanproc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/wanrouter/wanproc.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- wanproc.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ wanproc.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -13,7 +13,6 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ -* Jan 20, 2001 Arnaldo C.Melo Fix leak on error in router_proc_read, cleanups * Jun 02, 1999 Gideon Hack Updates for Linux 2.2.X kernels. * Jun 29, 1997 Alan Cox Merged with 1.0.3 vendor code * Jan 29, 1997 Gene Kozin v1.0.1. Implemented /proc read routines @@ -29,393 +28,1010 @@ #include <linux/slab.h> /* kmalloc(), kfree() */ #include <linux/mm.h> /* verify_area(), etc. */ #include <linux/string.h> /* inline mem*, str* functions */ [...1342 lines suppressed...] + int err = verify_area(VERIFY_READ, buf, count); + struct proc_dir_entry* dent; + wan_device_t* wandev; + + if (err) return err; + + dent = inode->u.generic_ip; + if ((dent == NULL) || (dent->data == NULL)) + return -ENODATA; + + wandev = dent->data; + + printk(KERN_ERR "%s: writing %d bytes to %s...\n", + name_root, count, dent->name); + + return 0; +} #endif /* |
From: Andy P. <at...@us...> - 2002-04-09 16:29:14
|
Update of /cvsroot/linux-vax/kernel-2.4/net/sunrpc In directory usw-pr-cvs1:/tmp/cvs-serv32481/sunrpc Modified Files: auth.c auth_null.c auth_unix.c clnt.c pmap_clnt.c sched.c stats.c sunrpc_syms.c svc.c svcsock.c sysctl.c xdr.c xprt.c Log Message: synch 2.4.15 commit 21 Index: auth.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/auth.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- auth.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ auth.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -69,7 +69,7 @@ auth->au_ops->destroy(auth); } -spinlock_t rpc_credcache_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t rpc_credcache_lock = SPIN_LOCK_UNLOCKED; /* * Initialize RPC credential cache @@ -81,42 +81,61 @@ auth->au_nextgc = jiffies + (auth->au_expire >> 1); } +/* + * Destroy an unreferenced credential + */ static inline void -rpcauth_crdestroy(struct rpc_auth *auth, struct rpc_cred *cred) +rpcauth_crdestroy(struct rpc_cred *cred) { #ifdef RPC_DEBUG if (cred->cr_magic != RPCAUTH_CRED_MAGIC) BUG(); cred->cr_magic = 0; + if (atomic_read(&cred->cr_count) || cred->cr_auth) + BUG(); #endif - if (auth->au_ops->crdestroy) - auth->au_ops->crdestroy(cred); - else - rpc_free(cred); + cred->cr_ops->crdestroy(cred); } /* - * Clear the RPC credential cache + * Destroy a list of credentials + */ +static inline +void rpcauth_destroy_credlist(struct rpc_cred *head) +{ + struct rpc_cred *cred; + + while ((cred = head) != NULL) { + head = cred->cr_next; + rpcauth_crdestroy(cred); + } +} + +/* + * Clear the RPC credential cache, and delete those credentials + * that are not referenced. */ void rpcauth_free_credcache(struct rpc_auth *auth) { - struct rpc_cred **q, *cred; - void (*destroy)(struct rpc_cred *); + struct rpc_cred **q, *cred, *free = NULL; int i; - if (!(destroy = auth->au_ops->crdestroy)) - destroy = (void (*)(struct rpc_cred *)) rpc_free; - spin_lock(&rpc_credcache_lock); for (i = 0; i < RPC_CREDCACHE_NR; i++) { q = &auth->au_credcache[i]; while ((cred = *q) != NULL) { *q = cred->cr_next; - destroy(cred); + cred->cr_auth = NULL; + if (atomic_read(&cred->cr_count) == 0) { + cred->cr_next = free; + free = cred; + } else + cred->cr_next = NULL; } } spin_unlock(&rpc_credcache_lock); + rpcauth_destroy_credlist(free); } /* @@ -133,9 +152,10 @@ for (i = 0; i < RPC_CREDCACHE_NR; i++) { q = &auth->au_credcache[i]; while ((cred = *q) != NULL) { - if (!cred->cr_count && + if (!atomic_read(&cred->cr_count) && time_before(cred->cr_expire, jiffies)) { *q = cred->cr_next; + cred->cr_auth = NULL; cred->cr_next = free; free = cred; continue; @@ -144,10 +164,7 @@ } } spin_unlock(&rpc_credcache_lock); - while ((cred = free) != NULL) { - free = cred->cr_next; - rpcauth_crdestroy(auth, cred); - } + rpcauth_destroy_credlist(free); auth->au_nextgc = jiffies + auth->au_expire; } @@ -163,8 +180,8 @@ spin_lock(&rpc_credcache_lock); cred->cr_next = auth->au_credcache[nr]; auth->au_credcache[nr] = cred; - cred->cr_count++; - cred->cr_expire = jiffies + auth->au_expire; + cred->cr_auth = auth; + get_rpccred(cred); spin_unlock(&rpc_credcache_lock); } @@ -187,7 +204,7 @@ q = &auth->au_credcache[nr]; while ((cred = *q) != NULL) { if (!(cred->cr_flags & RPCAUTH_CRED_DEAD) && - auth->au_ops->crmatch(cred, taskflags)) { + cred->cr_ops->crmatch(cred, taskflags)) { *q = cred->cr_next; break; } @@ -213,23 +230,23 @@ * Remove cred handle from cache */ static void -rpcauth_remove_credcache(struct rpc_auth *auth, struct rpc_cred *cred) +rpcauth_remove_credcache(struct rpc_cred *cred) { + struct rpc_auth *auth = cred->cr_auth; struct rpc_cred **q, *cr; int nr; nr = (cred->cr_uid & RPC_CREDCACHE_MASK); - spin_lock(&rpc_credcache_lock); q = &auth->au_credcache[nr]; while ((cr = *q) != NULL) { if (cred == cr) { *q = cred->cr_next; cred->cr_next = NULL; + cred->cr_auth = NULL; break; } q = &cred->cr_next; } - spin_unlock(&rpc_credcache_lock); } struct rpc_cred * @@ -258,7 +275,7 @@ { dprintk("RPC: matching %s cred %d\n", auth->au_ops->au_name, taskflags); - return auth->au_ops->crmatch(cred, taskflags); + return cred->cr_ops->crmatch(cred, taskflags); } void @@ -266,26 +283,25 @@ { dprintk("RPC: %4d holding %s cred %p\n", task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred); - if (task->tk_msg.rpc_cred) { - spin_lock(&rpc_credcache_lock); - task->tk_msg.rpc_cred->cr_count++; - task->tk_msg.rpc_cred->cr_expire = jiffies + task->tk_auth->au_expire; - spin_unlock(&rpc_credcache_lock); - } + if (task->tk_msg.rpc_cred) + get_rpccred(task->tk_msg.rpc_cred); } void -rpcauth_releasecred(struct rpc_auth *auth, struct rpc_cred *cred) +put_rpccred(struct rpc_cred *cred) { - spin_lock(&rpc_credcache_lock); - if (cred != NULL && cred->cr_count > 0) { - if (!--cred->cr_count && (cred->cr_flags & RPCAUTH_CRED_DEAD)) { - spin_unlock(&rpc_credcache_lock); - rpcauth_remove_credcache(auth, cred); - rpcauth_crdestroy(auth, cred); - return; - } + if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock)) + return; + + if (cred->cr_auth && cred->cr_flags & RPCAUTH_CRED_DEAD) + rpcauth_remove_credcache(cred); + + if (!cred->cr_auth) { + spin_unlock(&rpc_credcache_lock); + rpcauth_crdestroy(cred); + return; } + cred->cr_expire = jiffies + cred->cr_auth->au_expire; spin_unlock(&rpc_credcache_lock); } @@ -298,7 +314,7 @@ dprintk("RPC: %4d releasing %s cred %p\n", task->tk_pid, auth->au_ops->au_name, cred); - rpcauth_releasecred(auth, cred); + put_rpccred(cred); task->tk_msg.rpc_cred = NULL; } @@ -306,10 +322,11 @@ rpcauth_marshcred(struct rpc_task *task, u32 *p) { struct rpc_auth *auth = task->tk_auth; + struct rpc_cred *cred = task->tk_msg.rpc_cred; dprintk("RPC: %4d marshaling %s cred %p\n", - task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred); - return auth->au_ops->crmarshal(task, p, + task->tk_pid, auth->au_ops->au_name, cred); + return cred->cr_ops->crmarshal(task, p, task->tk_flags & RPC_CALL_REALUID); } @@ -317,20 +334,22 @@ rpcauth_checkverf(struct rpc_task *task, u32 *p) { struct rpc_auth *auth = task->tk_auth; + struct rpc_cred *cred = task->tk_msg.rpc_cred; dprintk("RPC: %4d validating %s cred %p\n", - task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred); - return auth->au_ops->crvalidate(task, p); + task->tk_pid, auth->au_ops->au_name, cred); + return cred->cr_ops->crvalidate(task, p); } int rpcauth_refreshcred(struct rpc_task *task) { struct rpc_auth *auth = task->tk_auth; + struct rpc_cred *cred = task->tk_msg.rpc_cred; dprintk("RPC: %4d refreshing %s cred %p\n", - task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred); - task->tk_status = auth->au_ops->crrefresh(task); + task->tk_pid, auth->au_ops->au_name, cred); + task->tk_status = cred->cr_ops->crrefresh(task); return task->tk_status; } Index: auth_null.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/auth_null.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- auth_null.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ auth_null.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -17,6 +17,8 @@ # define RPCDBG_FACILITY RPCDBG_AUTH #endif +static struct rpc_credops null_credops; + static struct rpc_auth * nul_create(struct rpc_clnt *clnt) { @@ -52,9 +54,10 @@ if (!(cred = (struct rpc_cred *) rpc_allocate(flags, sizeof(*cred)))) return NULL; - cred->cr_count = 0; + atomic_set(&cred->cr_count, 0); cred->cr_flags = RPCAUTH_CRED_UPTODATE; cred->cr_uid = current->uid; + cred->cr_ops = &null_credops; return cred; } @@ -124,7 +127,11 @@ #endif nul_create, nul_destroy, - nul_create_cred, + nul_create_cred +}; + +static +struct rpc_credops null_credops = { nul_destroy_cred, nul_match, nul_marshal, Index: auth_unix.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/auth_unix.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- auth_unix.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ auth_unix.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -33,6 +33,8 @@ # define RPCDBG_FACILITY RPCDBG_AUTH #endif +static struct rpc_credops unix_credops; + static struct rpc_auth * unx_create(struct rpc_clnt *clnt) { @@ -71,7 +73,7 @@ if (!(cred = (struct unx_cred *) rpc_allocate(flags, sizeof(*cred)))) return NULL; - cred->uc_count = 0; + atomic_set(&cred->uc_count, 0); cred->uc_flags = RPCAUTH_CRED_UPTODATE; if (flags & RPC_TASK_ROOTCREDS) { cred->uc_uid = cred->uc_fsuid = 0; @@ -91,6 +93,7 @@ if (i < NFS_NGROUPS) cred->uc_gids[i] = NOGROUP; } + cred->uc_base.cr_ops = &unix_credops; return (struct rpc_cred *) cred; } @@ -106,7 +109,7 @@ if (!(cred = (struct unx_cred *) rpc_malloc(task, sizeof(*cred)))) return NULL; - cred->uc_count = 1; + atomic_set(&cred->uc_count, 1); cred->uc_flags = RPCAUTH_CRED_DEAD|RPCAUTH_CRED_UPTODATE; cred->uc_uid = uid; cred->uc_gid = gid; @@ -236,7 +239,11 @@ #endif unx_create, unx_destroy, - unx_create_cred, + unx_create_cred +}; + +static +struct rpc_credops unix_credops = { unx_destroy_cred, unx_match, unx_marshal, Index: clnt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/clnt.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- clnt.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ clnt.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -55,6 +55,8 @@ static void call_refreshresult(struct rpc_task *task); static void call_timeout(struct rpc_task *task); static void call_reconnect(struct rpc_task *task); +static void child_reconnect(struct rpc_task *); +static void child_reconnect_status(struct rpc_task *); static u32 * call_header(struct rpc_task *task); static u32 * call_verify(struct rpc_task *task); @@ -79,7 +81,6 @@ #ifdef RPC_DEBUG rpc_register_sysctl(); #endif - xdr_init(); if (!xprt) goto out; @@ -526,6 +527,7 @@ call_reconnect(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; + struct rpc_task *child; dprintk("RPC: %4d call_reconnect status %d\n", task->tk_pid, task->tk_status); @@ -533,10 +535,31 @@ task->tk_action = call_transmit; if (task->tk_status < 0 || !clnt->cl_xprt->stream) return; - clnt->cl_stats->netreconn++; + + /* Run as a child to ensure it runs as an rpciod task */ + child = rpc_new_child(clnt, task); + if (child) { + child->tk_action = child_reconnect; + rpc_run_child(task, child, NULL); + } +} + +static void child_reconnect(struct rpc_task *task) +{ + task->tk_client->cl_stats->netreconn++; + task->tk_status = 0; + task->tk_action = child_reconnect_status; xprt_reconnect(task); } +static void child_reconnect_status(struct rpc_task *task) +{ + if (task->tk_status == -EAGAIN) + task->tk_action = child_reconnect; + else + task->tk_action = NULL; +} + /* * 5. Transmit the RPC request, and wait for reply */ @@ -694,9 +717,14 @@ } if (task->tk_status < 12) { - printk(KERN_WARNING "%s: too small RPC reply size (%d bytes)\n", - clnt->cl_protname, task->tk_status); - rpc_exit(task, -EIO); + if (!clnt->cl_softrtry) { + task->tk_action = call_transmit; + clnt->cl_stats->rpcretrans++; + } else { + printk(KERN_WARNING "%s: too small RPC reply size (%d bytes)\n", + clnt->cl_protname, task->tk_status); + rpc_exit(task, -EIO); + } return; } Index: pmap_clnt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/pmap_clnt.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- pmap_clnt.c 14 Jan 2001 17:13:59 -0000 1.1.1.1 +++ pmap_clnt.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -31,7 +31,7 @@ static struct rpc_clnt * pmap_create(char *, struct sockaddr_in *, int); static void pmap_getport_done(struct rpc_task *); extern struct rpc_program pmap_program; -spinlock_t pmap_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t pmap_lock = SPIN_LOCK_UNLOCKED; /* * Obtain the port for a given RPC service on a given host. This one can Index: sched.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/sched.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sched.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ sched.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -30,7 +30,7 @@ /* * We give RPC the same get_free_pages priority as NFS */ -#define GFP_RPC GFP_NFS +#define GFP_RPC GFP_NOFS static void __rpc_default_timer(struct rpc_task *task); static void rpciod_killall(void); @@ -76,7 +76,7 @@ /* * Spinlock for other critical sections of code. */ -spinlock_t rpc_sched_lock = SPIN_LOCK_UNLOCKED; +static spinlock_t rpc_sched_lock = SPIN_LOCK_UNLOCKED; /* * This is the last-ditch buffer for NFS swap requests @@ -744,7 +744,7 @@ * for readahead): * * sync user requests: GFP_KERNEL - * async requests: GFP_RPC (== GFP_NFS) + * async requests: GFP_RPC (== GFP_NOFS) * swap requests: GFP_ATOMIC (or new GFP_SWAPPER) */ void * @@ -772,8 +772,8 @@ } if (flags & RPC_TASK_ASYNC) return NULL; - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ>>4); + current->policy |= SCHED_YIELD; + schedule(); } while (!signalled()); return NULL; @@ -1059,17 +1059,13 @@ rpciod_pid = current->pid; up(&rpciod_running); - exit_fs(current); - exit_files(current); - exit_mm(current); + daemonize(); spin_lock_irq(¤t->sigmask_lock); siginitsetinv(¤t->blocked, sigmask(SIGKILL)); recalc_sigpending(current); spin_unlock_irq(¤t->sigmask_lock); - current->session = 1; - current->pgrp = 1; strcpy(current->comm, "rpciod"); dprintk("RPC: rpciod starting (pid %d)\n", rpciod_pid); @@ -1118,8 +1114,8 @@ __rpc_schedule(); if (all_tasks) { dprintk("rpciod_killall: waiting for tasks to exit\n"); - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); + current->policy |= SCHED_YIELD; + schedule(); } } @@ -1189,8 +1185,8 @@ * wait briefly before checking the process id. */ current->sigpending = 0; - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); + current->policy |= SCHED_YIELD; + schedule(); /* * Display a message if we're going to wait longer. */ Index: stats.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/stats.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- stats.c 14 Jan 2001 17:14:00 -0000 1.1.1.1 +++ stats.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -202,3 +202,4 @@ rpc_proc_exit(); } #endif +MODULE_LICENSE("GPL"); Index: sunrpc_syms.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/sunrpc_syms.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sunrpc_syms.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ sunrpc_syms.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -65,7 +65,7 @@ EXPORT_SYMBOL(rpcauth_lookupcred); EXPORT_SYMBOL(rpcauth_bindcred); EXPORT_SYMBOL(rpcauth_matchcred); -EXPORT_SYMBOL(rpcauth_releasecred); +EXPORT_SYMBOL(put_rpccred); /* RPC server stuff */ EXPORT_SYMBOL(svc_create); @@ -92,18 +92,11 @@ EXPORT_SYMBOL(xdr_encode_array); EXPORT_SYMBOL(xdr_encode_string); EXPORT_SYMBOL(xdr_decode_string); +EXPORT_SYMBOL(xdr_decode_string_inplace); EXPORT_SYMBOL(xdr_decode_netobj); EXPORT_SYMBOL(xdr_encode_netobj); -EXPORT_SYMBOL(xdr_zero); -EXPORT_SYMBOL(xdr_one); -EXPORT_SYMBOL(xdr_two); EXPORT_SYMBOL(xdr_shift_iovec); EXPORT_SYMBOL(xdr_zero_iovec); - -/* RPC errors */ -EXPORT_SYMBOL(rpc_success); -EXPORT_SYMBOL(rpc_garbage_args); -EXPORT_SYMBOL(rpc_system_err); /* Debugging symbols */ #ifdef RPC_DEBUG Index: svc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/svc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- svc.c 14 Jan 2001 17:14:09 -0000 1.1.1.1 +++ svc.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -31,7 +31,6 @@ { struct svc_serv *serv; - xdr_init(); #ifdef RPC_DEBUG rpc_register_sysctl(); #endif @@ -368,7 +367,9 @@ err_bad_prog: #ifdef RPC_PARANOIA - printk("svc: unknown program %d (me %d)\n", prog, progp->pg_prog); + if (prog != 100227 || progp->pg_prog != 100003) + printk("svc: unknown program %d (me %d)\n", prog, progp->pg_prog); + /* else it is just a Solaris client seeing if ACLs are supported */ #endif serv->sv_stats->rpcbadfmt++; svc_putlong(resp, rpc_prog_unavail); Index: svcsock.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/svcsock.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- svcsock.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ svcsock.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -212,16 +212,20 @@ svc_sock_release(struct svc_rqst *rqstp) { struct svc_sock *svsk = rqstp->rq_sock; + struct svc_serv *serv = svsk->sk_server; - if (!svsk) - return; svc_release_skb(rqstp); rqstp->rq_sock = NULL; + + spin_lock_bh(&serv->sv_lock); if (!--(svsk->sk_inuse) && svsk->sk_dead) { + spin_unlock_bh(&serv->sv_lock); dprintk("svc: releasing dead socket\n"); sock_release(svsk->sk_sock); kfree(svsk); } + else + spin_unlock_bh(&serv->sv_lock); } /* @@ -377,10 +381,17 @@ dprintk("svc: recvfrom returned error %d\n", -err); } + /* Sorry. */ + if (skb_is_nonlinear(skb)) { + if (skb_linearize(skb, GFP_KERNEL) != 0) { + kfree_skb(skb); + svc_sock_received(svsk, 0); + return 0; + } + } + if (skb->ip_summed != CHECKSUM_UNNECESSARY) { - unsigned int csum = skb->csum; - csum = csum_partial(skb->h.raw, skb->len, csum); - if ((unsigned short)csum_fold(csum)) { + if ((unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum))) { skb_free_datagram(svsk->sk_sk, skb); svc_sock_received(svsk, 0); return 0; @@ -391,7 +402,7 @@ svsk->sk_data = 1; len = skb->len - sizeof(struct udphdr); - data = (u32 *) (skb->h.raw + sizeof(struct udphdr)); + data = (u32 *) (skb->data + sizeof(struct udphdr)); rqstp->rq_skbuff = skb; rqstp->rq_argbuf.base = data; @@ -451,11 +462,11 @@ } /* - * A state change on a listening socket means there's a connection - * pending. + * A data_ready event on a listening socket means there's a connection + * pending. Do not use state_change as a substitute for it. */ static void -svc_tcp_state_change1(struct sock *sk) +svc_tcp_listen_data_ready(struct sock *sk, int count_unused) { struct svc_sock *svsk; @@ -483,7 +494,7 @@ * A state change on a connected socket means it's dying or dead. */ static void -svc_tcp_state_change2(struct sock *sk) +svc_tcp_state_change(struct sock *sk) { struct svc_sock *svsk; @@ -766,10 +777,10 @@ if (sk->state == TCP_LISTEN) { dprintk("setting up TCP socket for listening\n"); - sk->state_change = svc_tcp_state_change1; + sk->data_ready = svc_tcp_listen_data_ready; } else { dprintk("setting up TCP socket for reading\n"); - sk->state_change = svc_tcp_state_change2; + sk->state_change = svc_tcp_state_change; sk->data_ready = svc_tcp_data_ready; svsk->sk_reclen = 0; @@ -1034,14 +1045,15 @@ if (svsk->sk_qued) rpc_remove_list(&serv->sv_sockets, svsk); - spin_unlock_bh(&serv->sv_lock); svsk->sk_dead = 1; if (!svsk->sk_inuse) { + spin_unlock_bh(&serv->sv_lock); sock_release(svsk->sk_sock); kfree(svsk); } else { + spin_unlock_bh(&serv->sv_lock); printk(KERN_NOTICE "svc: server socket destroy delayed\n"); /* svsk->sk_server = NULL; */ } Index: sysctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/sysctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- sysctl.c 14 Jan 2001 17:14:11 -0000 1.1.1.1 +++ sysctl.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -63,7 +63,7 @@ { char tmpbuf[20], *p, c; unsigned int value; - int left, len; + size_t left, len; if ((file->f_pos && !write) || !*lenp) { *lenp = 0; Index: xdr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/xdr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- xdr.c 14 Jan 2001 17:14:11 -0000 1.1.1.1 +++ xdr.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -14,41 +14,6 @@ #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/msg_prot.h> -u32 rpc_success, rpc_prog_unavail, rpc_prog_mismatch, rpc_proc_unavail, - rpc_garbage_args, rpc_system_err; -u32 rpc_auth_ok, rpc_autherr_badcred, rpc_autherr_rejectedcred, - rpc_autherr_badverf, rpc_autherr_rejectedverf, rpc_autherr_tooweak; -u32 xdr_zero, xdr_one, xdr_two; - -void -xdr_init(void) -{ - static int inited = 0; - - if (inited) - return; - - xdr_zero = htonl(0); - xdr_one = htonl(1); - xdr_two = htonl(2); - - rpc_success = htonl(RPC_SUCCESS); - rpc_prog_unavail = htonl(RPC_PROG_UNAVAIL); - rpc_prog_mismatch = htonl(RPC_PROG_MISMATCH); - rpc_proc_unavail = htonl(RPC_PROC_UNAVAIL); - rpc_garbage_args = htonl(RPC_GARBAGE_ARGS); - rpc_system_err = htonl(RPC_SYSTEM_ERR); - - rpc_auth_ok = htonl(RPC_AUTH_OK); - rpc_autherr_badcred = htonl(RPC_AUTH_BADCRED); - rpc_autherr_rejectedcred = htonl(RPC_AUTH_REJECTEDCRED); - rpc_autherr_badverf = htonl(RPC_AUTH_BADVERF); - rpc_autherr_rejectedverf = htonl(RPC_AUTH_REJECTEDVERF); - rpc_autherr_tooweak = htonl(RPC_AUTH_TOOWEAK); - - inited = 1; -} - /* * XDR functions for basic NFS types */ @@ -121,6 +86,19 @@ *sp = string; return p + XDR_QUADLEN(len); } + +u32 * +xdr_decode_string_inplace(u32 *p, char **sp, int *lenp, int maxlen) +{ + unsigned int len; + + if ((len = ntohl(*p++)) > maxlen) + return NULL; + *lenp = len; + *sp = (char *) p; + return p + XDR_QUADLEN(len); +} + /* * Realign the iovec if the server missed out some reply elements Index: xprt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sunrpc/xprt.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- xprt.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ xprt.c 9 Apr 2002 16:29:02 -0000 1.2 @@ -75,20 +75,11 @@ * Local variables */ -/* Spinlock for critical sections in the code. */ -spinlock_t xprt_sock_lock = SPIN_LOCK_UNLOCKED; -spinlock_t xprt_lock = SPIN_LOCK_UNLOCKED; - #ifdef RPC_DEBUG # undef RPC_DEBUG_DATA # define RPCDBG_FACILITY RPCDBG_XPRT #endif -#ifndef MAX -# define MAX(a, b) ((a) > (b)? (a) : (b)) -# define MIN(a, b) ((a) < (b)? (a) : (b)) -#endif - /* * Local functions */ @@ -177,6 +168,44 @@ } /* + * Serialize write access to sockets, in order to prevent different + * requests from interfering with each other. + * Also prevents TCP socket reconnections from colliding with writes. + */ +static int +xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) +{ + int retval; + spin_lock_bh(&xprt->sock_lock); + if (!xprt->snd_task) + xprt->snd_task = task; + else if (xprt->snd_task != task) { + dprintk("RPC: %4d TCP write queue full (task %d)\n", + task->tk_pid, xprt->snd_task->tk_pid); + task->tk_timeout = 0; + task->tk_status = -EAGAIN; + rpc_sleep_on(&xprt->sending, task, NULL, NULL); + } + retval = xprt->snd_task == task; + spin_unlock_bh(&xprt->sock_lock); + return retval; +} + +/* + * Releases the socket for use by other requests. + */ +static void +xprt_release_write(struct rpc_xprt *xprt, struct rpc_task *task) +{ + spin_lock_bh(&xprt->sock_lock); + if (xprt->snd_task == task) { + xprt->snd_task = NULL; + rpc_wake_up_next(&xprt->sending); + } + spin_unlock_bh(&xprt->sock_lock); +} + +/* * Write data to socket. */ static inline int @@ -290,7 +319,10 @@ if (xprt->nocong) return; - spin_lock_bh(&xprt_sock_lock); + /* + * Note: we're in a BH context + */ + spin_lock(&xprt->xprt_lock); cwnd = xprt->cwnd; if (result >= 0) { if (xprt->cong < cwnd || time_before(jiffies, xprt->congtime)) @@ -318,7 +350,7 @@ xprt->cwnd = cwnd; out: - spin_unlock_bh(&xprt_sock_lock); + spin_unlock(&xprt->xprt_lock); } /* @@ -399,6 +431,8 @@ /* * Reconnect a broken TCP connection. + * + * Note: This cannot collide with the TCP reads, as both run from rpciod */ void xprt_reconnect(struct rpc_task *task) @@ -421,15 +455,10 @@ return; } - spin_lock(&xprt_lock); - if (xprt->connecting) { - task->tk_timeout = 0; - rpc_sleep_on(&xprt->reconn, task, NULL, NULL); - spin_unlock(&xprt_lock); + if (!xprt_lock_write(xprt, task)) return; - } - xprt->connecting = 1; - spin_unlock(&xprt_lock); + if (xprt_connected(xprt)) + goto out_write; status = -ENOTCONN; if (!inet) { @@ -444,6 +473,7 @@ /* Reset TCP record info */ xprt->tcp_offset = 0; + xprt->tcp_reclen = 0; xprt->tcp_copied = 0; xprt->tcp_more = 0; @@ -472,24 +502,22 @@ dprintk("RPC: %4d connect status %d connected %d\n", task->tk_pid, status, xprt_connected(xprt)); - spin_lock_bh(&xprt_sock_lock); + spin_lock_bh(&xprt->sock_lock); if (!xprt_connected(xprt)) { task->tk_timeout = xprt->timeout.to_maxval; - rpc_sleep_on(&xprt->reconn, task, xprt_reconn_status, NULL); - spin_unlock_bh(&xprt_sock_lock); + rpc_sleep_on(&xprt->sending, task, xprt_reconn_status, NULL); + spin_unlock_bh(&xprt->sock_lock); return; } - spin_unlock_bh(&xprt_sock_lock); + spin_unlock_bh(&xprt->sock_lock); } defer: - spin_lock(&xprt_lock); - xprt->connecting = 0; if (status < 0) { rpc_delay(task, 5*HZ); task->tk_status = -ENOTCONN; } - rpc_wake_up(&xprt->reconn); - spin_unlock(&xprt_lock); + out_write: + xprt_release_write(xprt, task); } /* @@ -504,10 +532,7 @@ dprintk("RPC: %4d xprt_reconn_timeout %d\n", task->tk_pid, task->tk_status); - spin_lock(&xprt_lock); - xprt->connecting = 0; - rpc_wake_up(&xprt->reconn); - spin_unlock(&xprt_lock); + xprt_release_write(xprt, task); } /* @@ -591,7 +616,7 @@ struct sk_buff *skb, int copied) { - __u8 *pkt_data = skb->h.raw + sizeof(struct udphdr); + int offset = sizeof(struct udphdr); __u8 *cur_ptr = iov->iov_base; __kernel_size_t cur_len = iov->iov_len; unsigned int csum = skb->csum; @@ -599,18 +624,18 @@ int slack = skb->len - copied - sizeof(struct udphdr); if (need_csum) - csum = csum_partial(skb->h.raw, sizeof(struct udphdr), csum); + csum = csum_partial(skb->data, sizeof(struct udphdr), csum); while (copied > 0) { if (cur_len) { int to_move = cur_len; if (to_move > copied) to_move = copied; if (need_csum) - csum = csum_partial_copy_nocheck(pkt_data, cur_ptr, - to_move, csum); + csum = skb_copy_and_csum_bits(skb, offset, cur_ptr, + to_move, csum); else - memcpy(cur_ptr, pkt_data, to_move); - pkt_data += to_move; + skb_copy_bits(skb, offset, cur_ptr, to_move); + offset += to_move; copied -= to_move; cur_ptr += to_move; cur_len -= to_move; @@ -623,7 +648,7 @@ } if (need_csum) { if (slack > 0) - csum = csum_partial(pkt_data, slack, csum); + csum = skb_checksum(skb, offset, slack, csum); if ((unsigned short)csum_fold(csum)) return -1; } @@ -704,10 +729,6 @@ struct iovec riov; int want, result; - if (xprt->tcp_offset >= xprt->tcp_reclen + sizeof(xprt->tcp_recm)) { - xprt->tcp_offset = 0; - xprt->tcp_reclen = 0; - } if (xprt->tcp_offset >= sizeof(xprt->tcp_recm)) goto done; @@ -723,10 +744,6 @@ want -= result; } while (want); - /* Is this another fragment in the last message */ - if (!xprt->tcp_more) - xprt->tcp_copied = 0; /* No, so we're reading a new message */ - /* Get the record length and mask out the last fragment bit */ xprt->tcp_reclen = ntohl(xprt->tcp_recm); xprt->tcp_more = (xprt->tcp_reclen & 0x80000000) ? 0 : 1; @@ -749,7 +766,7 @@ if (xprt->tcp_copied >= sizeof(xprt->tcp_xid) || !avail) goto done; - want = MIN(sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail); + want = min_t(unsigned int, sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail); do { dprintk("RPC: reading xid (%d bytes)\n", want); riov.iov_base = ((u8*) &xprt->tcp_xid) + xprt->tcp_copied; @@ -776,7 +793,7 @@ if (req->rq_rlen <= xprt->tcp_copied || !avail) goto done; - want = MIN(req->rq_rlen - xprt->tcp_copied, avail); + want = min_t(unsigned int, req->rq_rlen - xprt->tcp_copied, avail); do { dprintk("RPC: %4d TCP receiving %d bytes\n", req->rq_task->tk_pid, want); @@ -810,7 +827,7 @@ int want, result = 0; while (avail) { - want = MIN(avail, sizeof(dummy)); + want = min_t(unsigned int, avail, sizeof(dummy)); riov.iov_base = dummy; riov.iov_len = want; dprintk("RPC: TCP skipping %d bytes\n", want); @@ -848,14 +865,15 @@ /* Read in a new fragment marker if necessary */ /* Can we ever really expect to get completely empty fragments? */ - if ((result = tcp_read_fraghdr(xprt)) <= 0) + if ((result = tcp_read_fraghdr(xprt)) < 0) return result; avail = result; /* Read in the xid if necessary */ - if ((result = tcp_read_xid(xprt, avail)) <= 0) + if ((result = tcp_read_xid(xprt, avail)) < 0) return result; - avail = result; + if (!(avail = result)) + goto out_ok; /* Find and lock the request corresponding to this xid */ req = xprt_lookup_rqst(xprt, xprt->tcp_xid); @@ -873,9 +891,14 @@ if ((result = tcp_read_discard(xprt, avail)) < 0) return result; + out_ok: dprintk("RPC: tcp_input_record done (off %d reclen %d copied %d)\n", xprt->tcp_offset, xprt->tcp_reclen, xprt->tcp_copied); result = xprt->tcp_reclen; + xprt->tcp_reclen = 0; + xprt->tcp_offset = 0; + if (!xprt->tcp_more) + xprt->tcp_copied = 0; return result; } @@ -890,11 +913,19 @@ rpciod_wake_up(); } +int xprt_tcp_pending(void) +{ + int retval; + + spin_lock_bh(&rpc_queue_lock); + retval = !list_empty(&rpc_xprt_pending); + spin_unlock_bh(&rpc_queue_lock); + return retval; +} + static inline void xprt_append_pending(struct rpc_xprt *xprt) { - if (!list_empty(&xprt->rx_pending)) - return; spin_lock_bh(&rpc_queue_lock); if (list_empty(&xprt->rx_pending)) { list_add(&xprt->rx_pending, rpc_xprt_pending.prev); @@ -1008,11 +1039,10 @@ case TCP_ESTABLISHED: if (xprt_test_and_set_connected(xprt)) break; - spin_lock_bh(&xprt_sock_lock); + spin_lock(&xprt->sock_lock); if (xprt->snd_task && xprt->snd_task->tk_rpcwait == &xprt->sending) rpc_wake_up_task(xprt->snd_task); - rpc_wake_up(&xprt->reconn); - spin_unlock_bh(&xprt_sock_lock); + spin_unlock(&xprt->sock_lock); break; case TCP_SYN_SENT: case TCP_SYN_RECV: @@ -1046,10 +1076,10 @@ return; if (!xprt_test_and_set_wspace(xprt)) { - spin_lock_bh(&xprt_sock_lock); + spin_lock(&xprt->sock_lock); if (xprt->snd_task && xprt->snd_task->tk_rpcwait == &xprt->sending) rpc_wake_up_task(xprt->snd_task); - spin_unlock_bh(&xprt_sock_lock); + spin_unlock(&xprt->sock_lock); } if (test_bit(SOCK_NOSPACE, &sock->flags)) { @@ -1072,14 +1102,14 @@ /* Wait until we have enough socket memory */ - if (sock_wspace(sk) < min(sk->sndbuf,XPRT_MIN_WRITE_SPACE)) + if (sock_wspace(sk) < min_t(int, sk->sndbuf,XPRT_MIN_WRITE_SPACE)) return; if (!xprt_test_and_set_wspace(xprt)) { - spin_lock_bh(&xprt_sock_lock); + spin_lock(&xprt->sock_lock); if (xprt->snd_task && xprt->snd_task->tk_rpcwait == &xprt->sending) rpc_wake_up_task(xprt->snd_task); - spin_unlock_bh(&xprt_sock_lock); + spin_unlock(&xprt->sock_lock); } if (sk->sleep && waitqueue_active(sk->sleep)) @@ -1105,51 +1135,6 @@ rpc_wake_up_task(task); } - -/* - * Serialize access to sockets, in order to prevent different - * requests from interfering with each other. - */ -static int -xprt_down_transmit(struct rpc_task *task) -{ - struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; - struct rpc_rqst *req = task->tk_rqstp; - - spin_lock(&xprt_lock); - if (xprt->snd_task && xprt->snd_task != task) { - dprintk("RPC: %4d TCP write queue full (task %d)\n", - task->tk_pid, xprt->snd_task->tk_pid); - task->tk_timeout = 0; - task->tk_status = -EAGAIN; - rpc_sleep_on(&xprt->sending, task, NULL, NULL); - } else if (!xprt->snd_task) { - xprt->snd_task = task; -#ifdef RPC_PROFILE - req->rq_xtime = jiffies; -#endif - req->rq_bytes_sent = 0; - } - spin_unlock(&xprt_lock); - return xprt->snd_task == task; -} - -/* - * Releases the socket for use by other requests. - */ -static inline void -xprt_up_transmit(struct rpc_task *task) -{ - struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt; - - if (xprt->snd_task && xprt->snd_task == task) { - spin_lock(&xprt_lock); - xprt->snd_task = NULL; - rpc_wake_up_next(&xprt->sending); - spin_unlock(&xprt_lock); - } -} - /* * Place the actual RPC call. * We have to copy the iovec because sendmsg fiddles with its contents. @@ -1183,9 +1168,12 @@ *marker = htonl(0x80000000|(req->rq_slen-sizeof(*marker))); } - if (!xprt_down_transmit(task)) + if (!xprt_lock_write(xprt, task)) return; +#ifdef RPC_PROFILE + req->rq_xtime = jiffies; +#endif do_xprt_transmit(task); } @@ -1253,12 +1241,12 @@ switch (status) { case -ENOMEM: /* Protect against (udp|tcp)_write_space */ - spin_lock_bh(&xprt_sock_lock); + spin_lock_bh(&xprt->sock_lock); if (!xprt_wspace(xprt)) { task->tk_timeout = req->rq_timeout.to_current; rpc_sleep_on(&xprt->sending, task, NULL, NULL); } - spin_unlock_bh(&xprt_sock_lock); + spin_unlock_bh(&xprt->sock_lock); return; case -EAGAIN: /* Keep holding the socket if it is blocked */ @@ -1269,6 +1257,9 @@ if (!xprt->stream) return; default: + if (xprt->stream) + xprt_disconnect(xprt); + req->rq_bytes_sent = 0; goto out_release; } @@ -1279,7 +1270,7 @@ rpc_add_timer(task, xprt_timer); rpc_unlock_task(task); out_release: - xprt_up_transmit(task); + xprt_release_write(xprt, task); } /* @@ -1314,7 +1305,7 @@ dprintk("RPC: %4d xprt_reserve cong = %ld cwnd = %ld\n", task->tk_pid, xprt->cong, xprt->cwnd); - spin_lock_bh(&xprt_sock_lock); + spin_lock_bh(&xprt->xprt_lock); xprt_reserve_status(task); if (task->tk_rqstp) { task->tk_timeout = 0; @@ -1325,7 +1316,7 @@ task->tk_status = -EAGAIN; rpc_sleep_on(&xprt->backlog, task, NULL, NULL); } - spin_unlock_bh(&xprt_sock_lock); + spin_unlock_bh(&xprt->xprt_lock); dprintk("RPC: %4d xprt_reserve returns %d\n", task->tk_pid, task->tk_status); return task->tk_status; @@ -1398,7 +1389,11 @@ struct rpc_xprt *xprt = task->tk_xprt; struct rpc_rqst *req; - xprt_up_transmit(task); + if (xprt->snd_task == task) { + if (xprt->stream) + xprt_disconnect(xprt); + xprt_release_write(xprt, task); + } if (!(req = task->tk_rqstp)) return; task->tk_rqstp = NULL; @@ -1406,13 +1401,7 @@ dprintk("RPC: %4d release request %p\n", task->tk_pid, req); - /* remove slot from queue of pending */ - if (task->tk_rpcwait) { - printk("RPC: task of released request still queued!\n"); - rpc_remove_wait_queue(task); - } - - spin_lock_bh(&xprt_sock_lock); + spin_lock_bh(&xprt->xprt_lock); req->rq_next = xprt->free; xprt->free = req; @@ -1420,7 +1409,7 @@ xprt->cong -= RPC_CWNDSCALE; xprt_clear_backlog(xprt); - spin_unlock_bh(&xprt_sock_lock); + spin_unlock_bh(&xprt->xprt_lock); } /* @@ -1477,6 +1466,8 @@ } else xprt->cwnd = RPC_INITCWND; xprt->congtime = jiffies; + spin_lock_init(&xprt->sock_lock); + spin_lock_init(&xprt->xprt_lock); init_waitqueue_head(&xprt->cong_wait); /* Set timeout parameters */ @@ -1490,7 +1481,6 @@ xprt->pending = RPC_INIT_WAITQ("xprt_pending"); xprt->sending = RPC_INIT_WAITQ("xprt_sending"); xprt->backlog = RPC_INIT_WAITQ("xprt_backlog"); - xprt->reconn = RPC_INIT_WAITQ("xprt_reconn"); /* initialize free list */ for (i = 0, req = xprt->slot; i < RPC_MAXREQS-1; i++, req++) @@ -1626,7 +1616,6 @@ rpc_wake_up(&xprt->sending); rpc_wake_up(&xprt->pending); rpc_wake_up(&xprt->backlog); - rpc_wake_up(&xprt->reconn); if (waitqueue_active(&xprt->cong_wait)) wake_up(&xprt->cong_wait); } |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net/rose In directory usw-pr-cvs1:/tmp/cvs-serv32481/rose Modified Files: af_rose.c rose_dev.c rose_route.c rose_subr.c Log Message: synch 2.4.15 commit 21 Index: af_rose.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/rose/af_rose.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- af_rose.c 14 Jan 2001 17:13:39 -0000 1.1.1.1 +++ af_rose.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -70,7 +70,7 @@ int sysctl_rose_maximum_vcs = ROSE_DEFAULT_MAXVC; int sysctl_rose_window_size = ROSE_DEFAULT_WINDOW_SIZE; -static struct sock *volatile rose_list = NULL; +static struct sock *rose_list; static struct proto_ops rose_proto_ops; @@ -471,7 +471,10 @@ if (get_user(len, optlen)) return -EFAULT; - + + if (len < 0) + return -EINVAL; + switch (optname) { case ROSE_DEFER: val = sk->protinfo.rose->defer; @@ -505,7 +508,7 @@ return -ENOPROTOOPT; } - len = min(len, sizeof(int)); + len = min_t(unsigned int, len, sizeof(int)); if (put_user(len, optlen)) return -EFAULT; @@ -1056,7 +1059,7 @@ SOCK_DEBUG(sk, "ROSE: sendto: building packet.\n"); size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN; - if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) + if ((skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) return err; skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN); @@ -1118,7 +1121,7 @@ frontlen = skb_headroom(skb); while (skb->len > 0) { - if ((skbn = sock_alloc_send_skb(sk, frontlen + ROSE_PACLEN, 0, 0, &err)) == NULL) + if ((skbn = sock_alloc_send_skb(sk, frontlen + ROSE_PACLEN, 0, &err)) == NULL) return err; skbn->sk = sk; @@ -1392,8 +1395,8 @@ } static struct net_proto_family rose_family_ops = { - PF_ROSE, - rose_create + family: PF_ROSE, + create: rose_create, }; static struct proto_ops SOCKOPS_WRAPPED(rose_proto_ops) = { @@ -1414,24 +1417,31 @@ sendmsg: rose_sendmsg, recvmsg: rose_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> SOCKOPS_WRAP(rose_proto, PF_ROSE); static struct notifier_block rose_dev_notifier = { - rose_device_event, - 0 + notifier_call: rose_device_event, }; static struct net_device *dev_rose; +static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n"; + static int __init rose_proto_init(void) { int i; rose_callsign = null_ax25_address; + if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device)) { + printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); + return -1; + } + if ((dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device), GFP_KERNEL)) == NULL) { printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); return -1; @@ -1447,7 +1457,7 @@ sock_register(&rose_family_ops); register_netdevice_notifier(&rose_dev_notifier); - printk(KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n"); + printk(banner); ax25_protocol_register(AX25_P_ROSE, rose_route_frame); ax25_linkfail_register(rose_link_failed); Index: rose_dev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/rose/rose_dev.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rose_dev.c 14 Jan 2001 17:13:40 -0000 1.1.1.1 +++ rose_dev.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -121,6 +121,7 @@ if (!rose_route_frame(skbn, NULL)) { kfree_skb(skbn); stats->tx_errors++; + return 1; } stats->tx_packets++; @@ -199,8 +200,6 @@ memset(dev->priv, 0, sizeof(struct net_device_stats)); dev->get_stats = rose_get_stats; - - dev_init_buffers(dev); return 0; }; Index: rose_route.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/rose/rose_route.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rose_route.c 14 Jan 2001 17:13:47 -0000 1.1.1.1 +++ rose_route.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -221,13 +221,11 @@ { struct rose_neigh *s; unsigned long flags; - struct sk_buff *skb; rose_stop_ftimer(rose_neigh); rose_stop_t0timer(rose_neigh); - while ((skb = skb_dequeue(&rose_neigh->queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&rose_neigh->queue); save_flags(flags); cli(); @@ -684,15 +682,13 @@ static void rose_del_route_by_neigh(struct rose_neigh *rose_neigh) { struct rose_route *rose_route, *s; - struct sk_buff *skb; rose_neigh->restarted = 0; rose_stop_t0timer(rose_neigh); rose_start_ftimer(rose_neigh); - while ((skb = skb_dequeue(&rose_neigh->queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&rose_neigh->queue); rose_route = rose_route_list; Index: rose_subr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/rose/rose_subr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rose_subr.c 14 Jan 2001 17:13:49 -0000 1.1.1.1 +++ rose_subr.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -42,13 +42,8 @@ */ void rose_clear_queues(struct sock *sk) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&sk->write_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.rose->ack_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&sk->write_queue); + skb_queue_purge(&sk->protinfo.rose->ack_queue); } /* |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net/netlink In directory usw-pr-cvs1:/tmp/cvs-serv32481/netlink Modified Files: af_netlink.c netlink_dev.c Log Message: synch 2.4.15 commit 21 Index: af_netlink.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netlink/af_netlink.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- af_netlink.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ af_netlink.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -9,6 +9,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * + * Tue Jun 26 14:36:48 MEST 2001 Herbert "herp" Rosmanith + * added netlink_proto_exit + * */ #include <linux/config.h> @@ -962,6 +965,7 @@ sendmsg: netlink_sendmsg, recvmsg: netlink_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; struct net_proto_family netlink_family_ops = { @@ -984,4 +988,11 @@ return 0; } +static void __exit netlink_proto_exit(void) +{ + sock_unregister(PF_NETLINK); + remove_proc_entry("net/netlink", NULL); +} + module_init(netlink_proto_init); +module_exit(netlink_proto_exit); Index: netlink_dev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netlink/netlink_dev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- netlink_dev.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ netlink_dev.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -28,10 +28,11 @@ #include <linux/devfs_fs_kernel.h> #include <linux/smp_lock.h> +#include <asm/bitops.h> #include <asm/system.h> #include <asm/uaccess.h> -static unsigned open_map; +static long open_map; static struct socket *netlink_user[MAX_LINKS]; /* @@ -111,11 +112,9 @@ if (minor>=MAX_LINKS) return -ENODEV; - if (open_map&(1<<minor)) + if (test_and_set_bit(minor, &open_map)) return -EBUSY; - open_map |= (1<<minor); - err = sock_create(PF_NETLINK, SOCK_RAW, minor, &sock); if (err < 0) goto out; @@ -132,7 +131,7 @@ return 0; out: - open_map &= ~(1<<minor); + clear_bit(minor, &open_map); return err; } @@ -141,11 +140,9 @@ unsigned int minor = MINOR(inode->i_rdev); struct socket *sock; - lock_kernel(); sock = netlink_user[minor]; netlink_user[minor] = NULL; - open_map &= ~(1<<minor); - unlock_kernel(); + clear_bit(minor, &open_map); sock_release(sock); return 0; } |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net/khttpd In directory usw-pr-cvs1:/tmp/cvs-serv32481/khttpd Modified Files: datasending.c main.c prototypes.h rfc.c security.h waitheaders.c Log Message: synch 2.4.15 commit 21 Index: datasending.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/datasending.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- datasending.c 14 Jan 2001 17:16:59 -0000 1.1.1.1 +++ datasending.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -105,8 +105,8 @@ Space = sock_wspace(CurrentRequest->sock->sk); - ReadSize = min(4*4096,CurrentRequest->FileLength - CurrentRequest->BytesSent); - ReadSize = min(ReadSize , Space ); + ReadSize = min_t(int, 4 * 4096, CurrentRequest->FileLength - CurrentRequest->BytesSent); + ReadSize = min_t(int, ReadSize, Space); if (ReadSize>0) { Index: main.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/main.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- main.c 14 Jan 2001 17:17:01 -0000 1.1.1.1 +++ main.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -138,7 +138,7 @@ changes +=DataSending(CPUNR); changes +=Userspace(CPUNR); changes +=Logging(CPUNR); - /* Test for incomming connections _again_, because it is possible + /* Test for incoming connections _again_, because it is possible one came in during the other steps, and the wakeup doesn't happen then. */ Index: prototypes.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/prototypes.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- prototypes.h 14 Jan 2001 17:17:03 -0000 1.1.1.1 +++ prototypes.h 9 Apr 2002 16:29:01 -0000 1.2 @@ -19,17 +19,6 @@ #define CONFIG_KHTTPD_NUMCPU 16 /* Maximum number of threads */ -/* the TCP/IP stack defines a __BROKEN__ set of min/max functions !! */ -/* So we better define our own. */ - -/* Broken means: working on unsigned data only, which is not acceptable - for kHTTPd and probably a lot of other functions. */ - -#undef min -#undef max -#define min(a,b) ( (a) < (b) ? (a) : (b) ) -#define max(a,b) ( (a) > (b) ? (a) : (b) ) - #ifdef OOPSTRACE #define EnterFunction(x) printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__) #define LeaveFunction(x) printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__) Index: rfc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/rfc.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- rfc.c 25 Feb 2001 23:14:57 -0000 1.1.1.2 +++ rfc.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -101,7 +101,7 @@ /* The returned string is for READ ONLY, ownership of the memory is NOT - transfered. + transferred. */ { @@ -326,9 +326,9 @@ strncpy(Head->FileName,sysctl_khttpd_docroot,sizeof(Head->FileName)); PrefixLen = strlen(sysctl_khttpd_docroot); - Head->FileNameLength = min(255,tmp-Buffer+PrefixLen); + Head->FileNameLength = min_t(unsigned int, 255, tmp - Buffer + PrefixLen); - strncat(Head->FileName,Buffer,min(255-PrefixLen,tmp-Buffer)); + strncat(Head->FileName,Buffer,min_t(unsigned int, 255 - PrefixLen, tmp - Buffer)); Buffer=EOL+1; #ifdef BENCHMARK @@ -341,7 +341,7 @@ { Buffer+=19; - strncpy(Head->IMS,Buffer,min(127,EOL-Buffer-1)); + strncpy(Head->IMS,Buffer,min_t(unsigned int, 127,EOL-Buffer-1)); Buffer=EOL+1; continue; @@ -351,7 +351,7 @@ { Buffer+=12; - strncpy(Head->Agent,Buffer,min(127,EOL-Buffer-1)); + strncpy(Head->Agent,Buffer,min_t(unsigned int, 127,EOL-Buffer-1)); Buffer=EOL+1; continue; @@ -362,7 +362,7 @@ { Buffer+=6; - strncpy(Head->Host,Buffer,min(127,EOL-Buffer-1)); + strncpy(Head->Host,Buffer,min_t(unsigned int, 127,EOL-Buffer-1)); Buffer=EOL+1; continue; Index: security.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/security.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- security.h 14 Jan 2001 17:17:05 -0000 1.1.1.1 +++ security.h 9 Apr 2002 16:29:01 -0000 1.2 @@ -9,4 +9,4 @@ char value[32-sizeof(void*)]; /* fill 1 cache-line */ }; -#endif \ No newline at end of file +#endif Index: waitheaders.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/khttpd/waitheaders.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- waitheaders.c 14 Jan 2001 17:17:08 -0000 1.1.1.1 +++ waitheaders.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -244,7 +244,7 @@ Request->Time = Request->filp->f_dentry->d_inode->i_mtime; Request->IMS_Time = mimeTime_to_UnixTime(Request->IMS); sprintf(Request->LengthS,"%i",Request->FileLength); - time_Unix2RFC(min(Request->Time,CurrentTime_i),Request->TimeS); + time_Unix2RFC(min_t(unsigned int, Request->Time,CurrentTime_i),Request->TimeS); /* The min() is required by rfc1945, section 10.10: It is not allowed to send a filetime in the future */ |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net In directory usw-pr-cvs1:/tmp/cvs-serv32481 Modified Files: netsyms.c socket.c sysctl_net.c Log Message: synch 2.4.15 commit 21 Index: netsyms.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netsyms.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- netsyms.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ netsyms.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -30,6 +30,7 @@ #include <net/pkt_sched.h> #include <net/scm.h> #include <linux/if_bridge.h> +#include <linux/if_vlan.h> #include <linux/random.h> #ifdef CONFIG_NET_DIVERT #include <linux/divert.h> @@ -61,6 +62,7 @@ #include <net/ipv6.h> #include <net/ndisc.h> #include <net/transp_v6.h> +#include <net/addrconf.h> extern int sysctl_local_port_range[2]; extern int tcp_port_rover; @@ -130,15 +132,28 @@ EXPORT_SYMBOL(sock_no_sendmsg); EXPORT_SYMBOL(sock_no_recvmsg); EXPORT_SYMBOL(sock_no_mmap); +EXPORT_SYMBOL(sock_no_sendpage); EXPORT_SYMBOL(sock_rfree); EXPORT_SYMBOL(sock_wfree); EXPORT_SYMBOL(sock_wmalloc); EXPORT_SYMBOL(sock_rmalloc); +EXPORT_SYMBOL(skb_linearize); +EXPORT_SYMBOL(skb_checksum); +EXPORT_SYMBOL(skb_checksum_help); EXPORT_SYMBOL(skb_recv_datagram); EXPORT_SYMBOL(skb_free_datagram); EXPORT_SYMBOL(skb_copy_datagram); EXPORT_SYMBOL(skb_copy_datagram_iovec); +EXPORT_SYMBOL(skb_copy_and_csum_datagram_iovec); +EXPORT_SYMBOL(skb_copy_bits); +EXPORT_SYMBOL(skb_copy_and_csum_bits); +EXPORT_SYMBOL(skb_copy_and_csum_dev); EXPORT_SYMBOL(skb_copy_expand); +EXPORT_SYMBOL(___pskb_trim); +EXPORT_SYMBOL(__pskb_pull_tail); +EXPORT_SYMBOL(pskb_expand_head); +EXPORT_SYMBOL(pskb_copy); +EXPORT_SYMBOL(skb_realloc_headroom); EXPORT_SYMBOL(datagram_poll); EXPORT_SYMBOL(put_cmsg); EXPORT_SYMBOL(sock_kmalloc); @@ -146,6 +161,7 @@ #ifdef CONFIG_FILTER EXPORT_SYMBOL(sk_run_filter); +EXPORT_SYMBOL(sk_chk_filter); #endif EXPORT_SYMBOL(neigh_table_init); @@ -190,7 +206,6 @@ EXPORT_SYMBOL(scm_fp_dup); EXPORT_SYMBOL(files_stat); EXPORT_SYMBOL(memcpy_toiovec); -EXPORT_SYMBOL(csum_partial); #ifdef CONFIG_IPX_MODULE EXPORT_SYMBOL(make_8023_client); @@ -199,6 +214,12 @@ EXPORT_SYMBOL(destroy_EII_client); #endif +/* for 801q VLAN support */ +#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) +EXPORT_SYMBOL(dev_change_flags); +EXPORT_SYMBOL(vlan_ioctl_hook); +#endif + EXPORT_SYMBOL(sklist_destroy_socket); EXPORT_SYMBOL(sklist_insert_socket); @@ -222,10 +243,11 @@ EXPORT_SYMBOL(inetdev_lock); EXPORT_SYMBOL(inet_add_protocol); EXPORT_SYMBOL(inet_del_protocol); +EXPORT_SYMBOL(inet_register_protosw); +EXPORT_SYMBOL(inet_unregister_protosw); EXPORT_SYMBOL(ip_route_output_key); EXPORT_SYMBOL(ip_route_input); EXPORT_SYMBOL(icmp_send); -EXPORT_SYMBOL(icmp_reply); EXPORT_SYMBOL(ip_options_compile); EXPORT_SYMBOL(ip_options_undo); EXPORT_SYMBOL(arp_send); @@ -238,6 +260,7 @@ EXPORT_SYMBOL(ip_mc_inc_group); EXPORT_SYMBOL(ip_mc_dec_group); EXPORT_SYMBOL(ip_finish_output); +EXPORT_SYMBOL(inet_stream_ops); EXPORT_SYMBOL(inet_dgram_ops); EXPORT_SYMBOL(ip_cmsg_recv); EXPORT_SYMBOL(inet_addr_type); @@ -265,10 +288,12 @@ #ifdef CONFIG_IPV6 EXPORT_SYMBOL(ipv6_addr_type); EXPORT_SYMBOL(icmpv6_send); +EXPORT_SYMBOL(ndisc_mc_map); +EXPORT_SYMBOL(register_inet6addr_notifier); +EXPORT_SYMBOL(unregister_inet6addr_notifier); #endif #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE) /* inet functions common to v4 and v6 */ -EXPORT_SYMBOL(inet_stream_ops); EXPORT_SYMBOL(inet_release); EXPORT_SYMBOL(inet_stream_connect); EXPORT_SYMBOL(inet_dgram_connect); @@ -295,7 +320,6 @@ EXPORT_SYMBOL(ip_queue_xmit); EXPORT_SYMBOL(memcpy_fromiovecend); EXPORT_SYMBOL(csum_partial_copy_fromiovecend); -EXPORT_SYMBOL(copy_and_csum_toiovec); EXPORT_SYMBOL(tcp_v4_lookup_listener); /* UDP/TCP exported functions for TCPv6 */ EXPORT_SYMBOL(udp_ioctl); @@ -362,8 +386,7 @@ EXPORT_SYMBOL(sysctl_tcp_wmem); EXPORT_SYMBOL(sysctl_tcp_ecn); EXPORT_SYMBOL(tcp_cwnd_application_limited); - -EXPORT_SYMBOL(xrlim_allow); +EXPORT_SYMBOL(tcp_sendpage); EXPORT_SYMBOL(tcp_write_xmit); @@ -416,6 +439,9 @@ EXPORT_SYMBOL(rtnl_lock); EXPORT_SYMBOL(rtnl_unlock); +/* ABI emulation layers need this */ +EXPORT_SYMBOL(move_addr_to_kernel); +EXPORT_SYMBOL(move_addr_to_user); /* Used by at least ipip.c. */ EXPORT_SYMBOL(ipv4_config); @@ -423,6 +449,7 @@ /* Used by other modules */ EXPORT_SYMBOL(in_ntoa); +EXPORT_SYMBOL(xrlim_allow); EXPORT_SYMBOL(ip_rcv); EXPORT_SYMBOL(arp_rcv); @@ -432,17 +459,7 @@ #endif /* CONFIG_INET */ #ifdef CONFIG_TR -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_FC -EXPORT_SYMBOL(register_fcdev); -EXPORT_SYMBOL(unregister_fcdev); -EXPORT_SYMBOL(init_fcdev); #endif /* Device callback registration */ @@ -451,14 +468,10 @@ /* support for loadable net drivers */ #ifdef CONFIG_NET -EXPORT_SYMBOL(init_etherdev); EXPORT_SYMBOL(loopback_dev); EXPORT_SYMBOL(register_netdevice); EXPORT_SYMBOL(unregister_netdevice); -EXPORT_SYMBOL(register_netdev); -EXPORT_SYMBOL(unregister_netdev); EXPORT_SYMBOL(netdev_state_change); -EXPORT_SYMBOL(ether_setup); EXPORT_SYMBOL(dev_new_index); EXPORT_SYMBOL(dev_get_by_index); EXPORT_SYMBOL(__dev_get_by_index); @@ -469,8 +482,6 @@ EXPORT_SYMBOL(eth_type_trans); #ifdef CONFIG_FDDI EXPORT_SYMBOL(fddi_type_trans); -EXPORT_SYMBOL(fddi_setup); -EXPORT_SYMBOL(init_fddidev); #endif /* CONFIG_FDDI */ #if 0 EXPORT_SYMBOL(eth_copy_and_sum); @@ -503,16 +514,12 @@ EXPORT_SYMBOL(dev_mc_add); EXPORT_SYMBOL(dev_mc_delete); EXPORT_SYMBOL(dev_mc_upload); -EXPORT_SYMBOL(n_tty_ioctl); -EXPORT_SYMBOL(tty_register_ldisc); EXPORT_SYMBOL(__kill_fasync); EXPORT_SYMBOL(if_port_text); #ifdef CONFIG_HIPPI EXPORT_SYMBOL(hippi_type_trans); -EXPORT_SYMBOL(init_hippi_dev); -EXPORT_SYMBOL(unregister_hipdev); #endif #ifdef CONFIG_SYSCTL @@ -523,12 +530,6 @@ #endif #endif -#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) -#include<linux/if_ltalk.h> -EXPORT_SYMBOL(ltalk_setup); -#endif - - /* Packet scheduler modules want these. */ EXPORT_SYMBOL(qdisc_destroy); EXPORT_SYMBOL(qdisc_reset); @@ -574,6 +575,7 @@ EXPORT_SYMBOL(nf_hooks); EXPORT_SYMBOL(nf_setsockopt); EXPORT_SYMBOL(nf_getsockopt); +EXPORT_SYMBOL(ip_ct_attach); #endif EXPORT_SYMBOL(register_gifconf); Index: socket.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/socket.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- socket.c 14 Jan 2001 17:06:56 -0000 1.1.1.1 +++ socket.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -71,6 +71,7 @@ #include <linux/poll.h> #include <linux/cache.h> #include <linux/module.h> +#include <linux/highmem.h> #if defined(CONFIG_KMOD) && defined(CONFIG_NET) #include <linux/kmod.h> @@ -104,6 +105,8 @@ unsigned long count, loff_t *ppos); static ssize_t sock_writev(struct file *file, const struct iovec *vector, unsigned long count, loff_t *ppos); +static ssize_t sock_sendpage(struct file *file, struct page *page, + int offset, size_t size, loff_t *ppos, int more); /* @@ -122,7 +125,8 @@ release: sock_close, fasync: sock_fasync, readv: sock_readv, - writev: sock_writev + writev: sock_writev, + sendpage: sock_sendpage }; /* @@ -299,8 +303,7 @@ } static struct vfsmount *sock_mnt; -static DECLARE_FSTYPE(sock_fs_type, "sockfs", sockfs_read_super, - FS_NOMOUNT|FS_SINGLE); +static DECLARE_FSTYPE(sock_fs_type, "sockfs", sockfs_read_super, FS_NOMOUNT); static int sockfs_delete_dentry(struct dentry *dentry) { return 1; @@ -602,6 +605,24 @@ return sock_sendmsg(sock, &msg, size); } +ssize_t sock_sendpage(struct file *file, struct page *page, + int offset, size_t size, loff_t *ppos, int more) +{ + struct socket *sock; + int flags; + + if (ppos != &file->f_pos) + return -ESPIPE; + + sock = socki_lookup(file->f_dentry->d_inode); + + flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; + if (more) + flags |= MSG_MORE; + + return sock->ops->sendpage(sock, page, offset, size, flags); +} + int sock_readv_writev(int type, struct inode * inode, struct file * file, const struct iovec * iov, long count, long size) { @@ -819,8 +840,10 @@ /* * Check protocol is in range */ - if(family<0 || family>=NPROTO) + if (family < 0 || family >= NPROTO) return -EAFNOSUPPORT; + if (type < 0 || type >= SOCK_MAX) + return -EINVAL; /* Compatibility. @@ -1181,13 +1204,14 @@ msg.msg_iovlen=1; msg.msg_control=NULL; msg.msg_controllen=0; - msg.msg_namelen=addr_len; + msg.msg_namelen=0; if(addr) { err = move_addr_to_kernel(addr, addr_len, address); if (err < 0) goto out_put; msg.msg_name=address; + msg.msg_namelen=addr_len; } if (sock->file->f_flags & O_NONBLOCK) flags |= MSG_DONTWAIT; @@ -1269,7 +1293,10 @@ { int err; struct socket *sock; - + + if (optlen < 0) + return -EINVAL; + if ((sock = sockfd_lookup(fd, &err))!=NULL) { if (level == SOL_SOCKET) @@ -1643,6 +1670,10 @@ extern void wanrouter_init(void); #endif +#ifdef CONFIG_BLUEZ +extern void bluez_init(void); +#endif + void __init sock_init(void) { int i; @@ -1701,6 +1732,10 @@ #endif #ifdef CONFIG_NETFILTER netfilter_init(); +#endif + +#ifdef CONFIG_BLUEZ + bluez_init(); #endif } Index: sysctl_net.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/sysctl_net.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- sysctl_net.c 25 Feb 2001 23:14:55 -0000 1.1.1.2 +++ sysctl_net.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -5,8 +5,8 @@ * Added /proc/sys/net directories for each protocol family. [MS] * * $Log$ - * Revision 1.1.1.2 2001/02/25 23:14:55 kenn - * Import official 2.4.2 Linus tree + * Revision 1.2 2002/04/09 16:29:01 atp + * synch 2.4.15 commit 21 * * Revision 1.2 1996/05/08 20:24:40 shaver * Added bits for NET_BRIDGE and the NET_IPV4_ARP stuff and @@ -23,10 +23,6 @@ extern ctl_table ipv4_table[]; #endif -#ifdef CONFIG_IPX -extern ctl_table ipx_table[]; -#endif - extern ctl_table core_table[]; #ifdef CONFIG_NET @@ -41,10 +37,6 @@ extern ctl_table tr_table[]; #endif -#ifdef CONFIG_ECONET -extern ctl_table econet_table[]; -#endif - ctl_table net_table[] = { {NET_CORE, "core", NULL, 0, 0555, core_table}, #ifdef CONFIG_NET @@ -54,17 +46,11 @@ #ifdef CONFIG_INET {NET_IPV4, "ipv4", NULL, 0, 0555, ipv4_table}, #endif -#ifdef CONFIG_IPX - {NET_IPX, "ipx", NULL, 0, 0555, ipx_table}, -#endif #ifdef CONFIG_IPV6 {NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table}, #endif #ifdef CONFIG_TR {NET_TR, "token-ring", NULL, 0, 0555, tr_table}, -#endif -#ifdef CONFIG_ECONET - {NET_ECONET, "econet", NULL, 0, 0555, econet_table}, #endif {0} }; |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net/netrom In directory usw-pr-cvs1:/tmp/cvs-serv32481/netrom Modified Files: af_netrom.c nr_dev.c nr_loopback.c nr_out.c nr_subr.c Log Message: synch 2.4.15 commit 21 Index: af_netrom.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netrom/af_netrom.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- af_netrom.c 14 Jan 2001 17:11:19 -0000 1.1.1.1 +++ af_netrom.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -407,6 +407,9 @@ if (get_user(len, optlen)) return -EFAULT; + if (len < 0) + return -EINVAL; + switch (optname) { case NETROM_T1: val = sk->protinfo.nr->t1 / HZ; @@ -432,7 +435,7 @@ return -ENOPROTOOPT; } - len = min(len, sizeof(int)); + len = min_t(unsigned int, len, sizeof(int)); if (put_user(len, optlen)) return -EFAULT; @@ -1010,7 +1013,7 @@ SOCK_DEBUG(sk, "NET/ROM: sendto: building packet.\n"); size = len + AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + NR_NETWORK_LEN + NR_TRANSPORT_LEN; - if ((skb = sock_alloc_send_skb(sk, size, 0, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) + if ((skb = sock_alloc_send_skb(sk, size, msg->msg_flags & MSG_DONTWAIT, &err)) == NULL) return err; skb_reserve(skb, size - len); @@ -1224,10 +1227,9 @@ return(len); } -static struct net_proto_family nr_family_ops = -{ - PF_NETROM, - nr_create +static struct net_proto_family nr_family_ops = { + family: PF_NETROM, + create: nr_create, }; static struct proto_ops SOCKOPS_WRAPPED(nr_proto_ops) = { @@ -1248,22 +1250,29 @@ sendmsg: nr_sendmsg, recvmsg: nr_recvmsg, mmap: sock_no_mmap, + sendpage: sock_no_sendpage, }; #include <linux/smp_lock.h> SOCKOPS_WRAP(nr_proto, PF_NETROM); static struct notifier_block nr_dev_notifier = { - nr_device_event, - 0 + notifier_call: nr_device_event, }; static struct net_device *dev_nr; +static char banner[] __initdata = KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n"; + static int __init nr_proto_init(void) { int i; + if (nr_ndevs > 0x7fffffff/sizeof(struct net_device)) { + printk(KERN_ERR "NET/ROM: nr_proto_init - nr_ndevs parameter to large\n"); + return -1; + } + if ((dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device), GFP_KERNEL)) == NULL) { printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n"); return -1; @@ -1279,7 +1288,7 @@ sock_register(&nr_family_ops); register_netdevice_notifier(&nr_dev_notifier); - printk(KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n"); + printk(banner); ax25_protocol_register(AX25_P_NETROM, nr_route_frame); ax25_linkfail_register(nr_link_failed); Index: nr_dev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netrom/nr_dev.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- nr_dev.c 14 Jan 2001 17:11:19 -0000 1.1.1.1 +++ nr_dev.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -89,6 +89,7 @@ struct net_device_stats *stats = (struct net_device_stats *)dev->priv; struct sk_buff *skbn; unsigned char *bp = skb->data; + int len; if (arp_find(bp + 7, skb)) { return 1; @@ -113,13 +114,15 @@ kfree_skb(skb); + len = skbn->len; + if (!nr_route_frame(skbn, NULL)) { kfree_skb(skbn); stats->tx_errors++; } stats->tx_packets++; - stats->tx_bytes += skbn->len; + stats->tx_bytes += len; return 1; } @@ -230,8 +233,6 @@ memset(dev->priv, 0, sizeof(struct net_device_stats)); dev->get_stats = nr_get_stats; - - dev_init_buffers(dev); return 0; }; Index: nr_loopback.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netrom/nr_loopback.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- nr_loopback.c 14 Jan 2001 17:11:27 -0000 1.1.1.1 +++ nr_loopback.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -92,10 +92,6 @@ void __exit nr_loopback_clear(void) { - struct sk_buff *skb; - del_timer(&loopback_timer); - - while ((skb = skb_dequeue(&loopback_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&loopback_queue); } Index: nr_out.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netrom/nr_out.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- nr_out.c 14 Jan 2001 17:11:20 -0000 1.1.1.1 +++ nr_out.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -56,7 +56,7 @@ frontlen = skb_headroom(skb); while (skb->len > 0) { - if ((skbn = sock_alloc_send_skb(sk, frontlen + NR_MAX_PACKET_SIZE, 0, 0, &err)) == NULL) + if ((skbn = sock_alloc_send_skb(sk, frontlen + NR_MAX_PACKET_SIZE, 0, &err)) == NULL) return; skb_reserve(skbn, frontlen); Index: nr_subr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/netrom/nr_subr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- nr_subr.c 14 Jan 2001 17:11:23 -0000 1.1.1.1 +++ nr_subr.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -42,19 +42,10 @@ */ void nr_clear_queues(struct sock *sk) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&sk->write_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.nr->ack_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.nr->reseq_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&sk->protinfo.nr->frag_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&sk->write_queue); + skb_queue_purge(&sk->protinfo.nr->ack_queue); + skb_queue_purge(&sk->protinfo.nr->reseq_queue); + skb_queue_purge(&sk->protinfo.nr->frag_queue); } /* |
From: Andy P. <at...@us...> - 2002-04-09 16:29:07
|
Update of /cvsroot/linux-vax/kernel-2.4/net/lapb In directory usw-pr-cvs1:/tmp/cvs-serv32481/lapb Modified Files: lapb_iface.c lapb_subr.c Log Message: synch 2.4.15 commit 21 Index: lapb_iface.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/lapb/lapb_iface.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- lapb_iface.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ lapb_iface.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -15,7 +15,6 @@ * 2000-10-29 Henner Eisen lapb_data_indication() return status. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/types.h> @@ -398,7 +397,7 @@ EXPORT_SYMBOL(lapb_data_request); EXPORT_SYMBOL(lapb_data_received); -static const char banner[] __initdata = KERN_INFO "NET4: LAPB for Linux. Version 0.01 for NET4.0\n"; +static char banner[] __initdata = KERN_INFO "NET4: LAPB for Linux. Version 0.01 for NET4.0\n"; static int __init lapb_init(void) { Index: lapb_subr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/net/lapb/lapb_subr.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- lapb_subr.c 25 Feb 2001 23:14:56 -0000 1.1.1.2 +++ lapb_subr.c 9 Apr 2002 16:29:01 -0000 1.2 @@ -38,13 +38,8 @@ */ void lapb_clear_queues(lapb_cb *lapb) { - struct sk_buff *skb; - - while ((skb = skb_dequeue(&lapb->write_queue)) != NULL) - kfree_skb(skb); - - while ((skb = skb_dequeue(&lapb->ack_queue)) != NULL) - kfree_skb(skb); + skb_queue_purge(&lapb->write_queue); + skb_queue_purge(&lapb->ack_queue); } /* |