Thomas Bogendörfer (tsbogend@bigbug.franken.de)
Tester, lots of bugfixes and hints.
-Alan Cox (alan@cymru.net)
+Alan Cox (alan@redhat.com)
For help getting into standard-kernel.
Henner Eisen (eis@baty.hanse.de)
--- /dev/null
+June 1999 Kernel Parameters v2.2.9
+ ~~~~~~~~~~~~~~~~~
+
+The following is a consolidated list of the kernel parameters as defined
+in the file init/main.c and sorted into English Dictionary order (defined
+as ignoring all punctuation and sorting digits before letters in a case
+insensitive manner), and with descriptions where known.
+
+The text in square brackets at the beginning of the description state the
+restrictions on the kernel for the said kernel parameter to be valid. The
+restrictions referred to are that the relevant option is valid if:
+
+ APIC APIC support is enabled.
+ APM Automatic Power Management support is enabled.
+ AX25 Appropriate AX.25 support is enabled.
+ CD Appropriate CD support is enabled.
+ EIDE EIDE/ATAPI support is enabled.
+ FB The frame buffer device is enabled.
+ HW Appropriate hardware is enabled.
+ ISDN Appropriate ISDN support is enabled.
+ JOY Appropriate joystick support is enabled.
+ LPT Printer support is enabled.
+ MCA MCA bus support is enabled.
+ MDA The MDA console is enabled.
+ MOUSE Appropriate mouse support is enabled.
+ NET Appropriate network support is enabled.
+ NFS Appropriate NFS support is enabled.
+ PARIDE The ParIDE subsystem is enabled.
+ PCI PCI bus support is enabled.
+ PCMCIA The PCMCIA subsystem is enabled.
+ PNP Plug & Play support is enabled.
+ PS2 Appropriate PS/2 support is enabled.
+ RAM RAMdisc support is enabled.
+ SCSI Appropriate SCSI support is enabled.
+ SERIAL Serial support is enabled.
+ SMP The kernel is an SMP kernel.
+ SOUND Appropriate sound system support is enabled.
+ VGA The VGA console has been enabled.
+ VT Virtual terminal support is enabled.
+ XT IBM PC/XT support is enabled.
+
+In addition, the following text indicates that the option:
+
+ BUGS= Relates to possible processor bugs on the said processor.
+ KNL Is a kernel start-up parameter.
+
+Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
+a trailing = on the name of any parameter states that that parameter will
+be entered as an environment variable, whereas its absence indicates that
+it will appear as a kernel argument readable via /proc/cmdline by programs
+running once the system is up.
+
+ 53c7xx= [HW,SCSI]
+
+ adb_buttons= [HW,MOUSE]
+
+ advansys= [HW,SCSI]
+
+ aha152x= [HW,SCSI]
+
+ aha1542= [HW,SCSI]
+
+ aic7xxx= [HW,SCSI]
+
+ AM53C974= [HW,SCSI]
+
+ apm= [APM] Automatic Power Management.
+
+ arcrimi= [HW,NET]
+
+ atamouse= [HW,MOUSE] Atari Mouse.
+
+ atascsi= [HW,SCSI] Atari SCSI.
+
+ aztcd= [HW,CD] Aztec CD driver.
+
+ baycom_par= [HW,AX25] BayCom Parallel Port AX.25 Modem.
+
+ baycom_ser_fdx= [HW,AX25] BayCom Serial Port AX.25 Modem in Full
+ Duplex Mode.
+
+ baycom_ser_hdx= [HW,AX25] BayCom Serial Port AX.25 Modem in Half
+ Duplex Mode.
+
+ bmouse= [HW,MOUSE,PS2] Bus mouse.
+
+ BusLogic= [HW,SCSI]
+
+ cdu31a= [HW,CD]
+
+ cm206= [HW,CD]
+
+ com20020= [HW,NET]
+
+ com90io= [HW,NET]
+
+ com90xx= [HW,NET]
+
+ console=
+
+ cyclades= [HW,SERIAL] Cyclades multi-serial port adapter.
+
+ debug [KNL] Enable kernel debugging.
+
+ decnet= [HW,NET]
+
+ digi= [HW,SERIAL]
+
+ digiepca= [HW,SERIAL]
+
+ dmascc= [HW,AX25,SERIAL] AX.25 Z80SCC driver with DMA
+ support available.
+
+ dmasound= [HW,SOUND]
+
+ dtc3181e= [HW,SCSI]
+
+ eata= [HW,SCSI]
+
+ eda= [HW,PS2]
+
+ edb= [HW,PS2]
+
+ ether= [HW,NET] Ethernet.
+
+ fd_mcs= [HW,SCSI]
+
+ fdomain= [HW,SCSI]
+
+ floppy= [HW]
+
+ ftape= [HW] Floppy Tape subsystem.
+
+ gdth= [HW,SCSI]
+
+ gscd= [HW,CD]
+
+ gvp11= [HW,SCSI]
+
+ hd= [EIDE] IDE and EIDE hard drive subsystem.
+
+ hfmodem= [HW,AX25]
+
+ HiSax= [HW,ISDN]
+
+ hisax= [HW,ISDN]
+
+ ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter.
+
+ icn= [HW,ISDN]
+
+ in2000= [HW,SCSI]
+
+ init= [KNL]
+
+ ip= [PNP]
+
+ isp16= [HW,CD]
+
+ js_14= [HW,JOY]
+
+ js_am= [HW,JOY]
+
+ js_an= [HW,JOY]
+
+ js_as= [HW.JOY]
+
+ js_console= [HW,JOY]
+
+ js_console2= [HW,JOY]
+
+ js_console3= [HW,JOY]
+
+ js_db9= [HW,JOY]
+
+ js_db9_2= [HW,JOY]
+
+ js_db9_3= [HW,JOY]
+
+ js_tg= [HW,JOY]
+
+ js_tg_2= [HW,JOY]
+
+ js_tg_3= [HW,JOY]
+
+ kbd-reset [VT]
+
+ load_ramdisk= [RAM]
+
+ lp= [LPT] Parallel Printer.
+
+ ltpc= [HW]
+
+ mac5380= [HW,SCSI]
+
+ maxcpus= [SMP] States the maximum number of processors that
+ an SMP kernel should make use of.
+
+ max_scsi_luns= [SCSI]
+
+ mca-pentium [BUGS=ix86]
+
+ mcd= [HW,CD]
+
+ mcdx= [HW,CD]
+
+ md= [HW]
+
+ mdacon= [MDA]
+
+ msmouse= [HW,MOUSE] Microsoft Mouse.
+
+ ncr5380= [HW,SCSI]
+
+ ncr53c400= [HW,SCSI]
+
+ ncr53c400a= [HW,SCSI]
+
+ ncr53c406a= [HW,SCSI]
+
+ ncr53c8xx= [HW,SCSI]
+
+ nfsaddrs= [NFS]
+
+ nfsroot= [NFS]
+
+ no387 [BUGS=ix86] Tells the kernel to use the 387 maths
+ emulation library even if a 387 maths coprocessor
+ is present.
+
+ noapic [SMP,APIC] Tells the kernel not to make use of any
+ APIC that may be present on the system.
+
+ no-halt [BUGS=ix86]
+
+ noinitrd [RAM] Tells the kernel not to load any configured
+ initial ramdisc.
+
+ no-scroll [VGA]
+
+ nosmp [SMP] Tells an SMP kernel to act as a UP kernel.
+
+ optcd= [HW,CD]
+
+ panic=
+
+ parport= [HW,LP]
+
+ pas16= [HW,SCSI]
+
+ pcbit= [HW,ISDN]
+
+ pcd. [PARIDE]
+
+ pci= [PCI]
+
+ pd. [PARIDE]
+
+ pf. [PARIDE]
+
+ pg. [PARIDE]
+
+ pirq= [SMP,APIC]
+
+ plip= [LP,NET] Parallel port network link.
+
+ profile=
+
+ prompt_ramdisk= [RAM] Whether to prompt for ramdisk before loading
+ its contents into memory.
+
+ pt. [PARIDE]
+
+ ramdisk= [RAM]
+
+ ramdisk_size= [RAM]
+
+ ramdisk_start= [RAM]
+
+ reboot= [BUGS=ix86]
+
+ reserve=
+
+ riscom8= [HW,SERIAL]
+
+ ro [KNL] Mount root device read-only on boot.
+
+ root=
+
+ rw [KNL] Mount root device read-write on boot.
+
+ sbpcd= [HW,CD] Soundblaster CD adapter.
+
+ scsi_logging= [SCSI]
+
+ sjcd= [HW,CD]
+
+ sonycd535= [HW,CD]
+
+ sound= [SOUND]
+
+ soundmodem= [HW,AX25,SOUND] Sound cards used as AX.25 modems.
+
+ specialix= [HW,SERIAL] Specialix multi-serial port adapter.
+
+ st= [HW]
+
+ st0x= [HW,SCSI]
+
+ stram_swap= [HW]
+
+ sym53c416= [HW,SCSI]
+
+ sym53c8xx= [HW,SCSI]
+
+ t128= [HW,SCSI]
+
+ tmc8xx= [HW,SCSI]
+
+ tmscsim= [HW,SCSI]
+
+ tp720= [HW,PS2]
+
+ u14-34f= [HW,SCSI]
+
+ video= [FB]
+
+ wd33c93= [HW,SCSI]
+
+ wd7000= [HW,SCSI]
+
+ wdt= [HW]
+
+ xd= [HW,XT]
+
+ xd_geo= [HW,XT]
Michael Chu <mmchu@pobox.com>
AverMedia fix and more flexible card recognition
-Alan Cox <alan@cymru.net>
+Alan Cox <alan@redhat.com>
Video4Linux interface and 2.1.x kernel adaptation
Chris Kleitsch
--- /dev/null
+
+Support for the Leadtek WinView 601 TV/FM by Jon Tombs <jon@gte.esi.us.es>
+
+This card is basically the same as all the rest (Bt484A, Philips tuner),
+the main difference is that they have attached a programmable attenuator to 3
+GPIO lines in order to give some volume control. They have also stuck an
+infra-red remote control decoded on the board, I will add support for this
+when I get time (it simple generates an interrupt for each key press, with
+the key code is placed in the GPIO port).
+
+I don't yet have any application to test the radio support. The tuner
+frequency setting should work but it is possible that the audio multiplexer
+is wrong. If it doesn't work, send me email.
+
+
+- No Thanks to Leadtek they refused to answer any questions about their
+hardware. The driver was written by visual inspection of the card. If you
+use this driver, send an email insult to them, and tell them you won't
+continue buying their hardware unless they support Linux.
+
+- Little thanks to Princeton Technology Corp (http://www.princeton.com.tw)
+who make the audio attenuator. Their publicly available data-sheet available
+on their web site doesn't include the chip programming information! Hidden
+on their server are the full data-sheets, but don't ask how I found it.
+
+To use the driver I use the following options, the tuner and pll settings might
+be different in your country
+
+insmod videodev
+insmod i2c scan=1 i2c_debug=0 verbose=0
+insmod tuner type=1 debug=0
+insmod bttv pll=1 radio=1 card=17
+
VERSION = 2
PATCHLEVEL = 3
-SUBLEVEL = 4
+SUBLEVEL = 5
EXTRAVERSION =
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
CONFIG_USB_UHCI=y
# CONFIG_USB_OHCI is not set
# CONFIG_USB_OHCI_HCD is not set
+CONFIG_USB_HUB=y
CONFIG_USB_MOUSE=y
CONFIG_USB_KBD=y
-CONFIG_USB_HUB=y
# CONFIG_USB_AUDIO is not set
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
# CONFIG_MAC_PARTITION is not set
# CONFIG_SMD_DISKLABEL is not set
# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_SGI_DISKLABEL is not set
# CONFIG_NLS is not set
#
* Intel MP v1.1/v1.4 specification support routines for multi-pentium
* hosts.
*
- * (c) 1995 Alan Cox, CymruNET Ltd <alan@cymru.net>
+ * (c) 1995 Alan Cox, Building #3 <alan@redhat.com>
* (c) 1998 Ingo Molnar
*
* Supported by Caldera http://www.caldera.com.
* 12-09-1997 RMK Added interrupt enable/disable
*/
+#include <linux/string.h>
#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/malloc.h>
*
* Based on wdt.c. Original copyright messages:
*
- * (c) Copyright 1996 Alan Cox <alan@cymru.net>, All Rights Reserved.
- * http://www.cymru.net
+ * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
+ * http://www.redhat.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* warranty for any of this software. This material is provided
* "AS-IS" and at no charge.
*
- * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
+ * (c) Copyright 1995 Alan Cox <alan@redhat.com>
*
*/
* This is read internally and used to synthesize a stream of
* triples in the form expected from a PS/2 device.
*
- * 0.0 1997-05-16 Alan Cox <alan@cymru.net> - Pad reader
+ * 0.0 1997-05-16 Alan Cox <alan@redhat.com> - Pad reader
* 0.1 1997-05-19 Robin O'Leary <robin@acm.org> - PS/2 emulation
* 0.2 1997-06-03 Robin O'Leary <robin@acm.org> - tap gesture
- * 0.3 1997-06-27 Alan Cox <alan@cymru.net> - 2.1 commit
- * 0.4 1997-11-09 Alan Cox <alan@cymru.net> - Single Unix VFS API changes
+ * 0.3 1997-06-27 Alan Cox <alan@redhat.com> - 2.1 commit
+ * 0.4 1997-11-09 Alan Cox <alan@redhat.com> - Single Unix VFS API changes
*/
#include <linux/module.h>
* 14478 Potsdam, Germany
*
* Most of this code is directly derived from his userspace driver.
- * His driver works so send any reports to alan@cymru.net unless the
+ * His driver works so send any reports to alan@redhat.com unless the
* userspace driver also doesnt work for you...
*/
/*
* SoftDog 0.05: A Software Watchdog Device
*
- * (c) Copyright 1996 Alan Cox <alan@cymru.net>, All Rights Reserved.
- * http://www.cymru.net
+ * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
+ * http://www.redhat.com
*
* 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.
*
- * Author: Alan Cox, <alan@cymru.net>
+ * Author: Alan Cox, <alan@redhat.com>
*
* Fixes:
*/
/*
* Industrial Computer Source WDT500/501 driver for Linux 2.1.x
*
- * (c) Copyright 1996-1997 Alan Cox <alan@cymru.net>, All Rights Reserved.
- * http://www.cymru.net
+ * (c) Copyright 1996-1997 Alan Cox <alan@redhat.com>, All Rights Reserved.
+ * http://www.redhat.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk>
*
- * Release 0.07.
+ * Release 0.08.
*
* Fixes
* Dave Gregorich : Modularisation and minor bugs
* Matt Crocker).
* Alan Cox : Added wdt= boot option
* Alan Cox : Cleaned up copy/user stuff
+ * Tim Hockin : Added insmod parameters, comment cleanup
+ * Parameterized timeout
*/
#include <linux/config.h>
*/
#include <linux/config.h>
+#include <linux/string.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
*
*/
+#include <linux/string.h>
+
static inline void
waitforCEC(struct IsdnCardState *cs, int hscx)
*/
#define __NO_VERSION__
#include <linux/config.h>
+#include <linux/string.h>
#include "hisax.h"
#include "isac.h"
#include "hscx.h"
* Grant Guenther <grant@torque.net>
*/
+#include <linux/string.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/errno.h>
* Cleaned up include files - Russell King <linux@arm.uk.linux.org>
*/
+#include <linux/string.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/config.h>
+#include <linux/string.h>
+
#include <linux/tasks.h>
#include <linux/parport.h>
static char *version =
"ptifddi.c:v1.0 10/Dec/96 David S. Miller (davem@caipfs.rutgers.edu)\n";
+#include <linux/string.h>
#include <linux/init.h>
#include "ptifddi.h"
/*
* Simple traffic shaper for Linux NET3.
*
- * (c) Copyright 1996 Alan Cox <alan@cymru.net>, All Rights Reserved.
- * http://www.cymru.net
+ * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved.
+ * http://www.redhat.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*/
#include <linux/config.h>
+#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/init.h>
* Thomas Sailer : use more logical O_NONBLOCK semantics
* Daniel Rodriksson: reworked the use of the device specific copy_user
* still generic
+ * Horst von Brand: Add missing #include <linux/string.h>
*/
#include <linux/config.h>
#include <linux/stddef.h>
+#include <linux/string.h>
#include <linux/kmod.h>
#include "sound_config.h"
#include <stdio.h>
+#include <string.h>
int main( int argc, const char * argv [] )
{
*/
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#define ABANDON(why) { fprintf(stderr, "%s\n", why); exit(1); }
* Thomas Sailer : ioctl code reworked (vmalloc/vfree removed)
*/
#include <linux/config.h>
+#include <linux/string.h>
#include "sound_config.h"
* more details.
*/
+#include <linux/string.h>
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/fb.h>
struct file * file;
int fd;
unsigned long error;
- unsigned long p = bprm->p;
unsigned long fd_offset;
unsigned long rlim;
int retval;
set_brk(current->mm->start_brk, current->mm->brk);
- p = setup_arg_pages(p, bprm);
+ retval = setup_arg_pages(bprm);
+ if (retval < 0) {
+ /* Someone check-me: is this error path enough? */
+ send_sig(SIGKILL, current, 0);
+ return retval;
+ }
- p = (unsigned long) create_aout_tables((char *)p, bprm);
- current->mm->start_stack = p;
+ current->mm->start_stack = create_aout_tables(bprm->p, bprm);
#ifdef __alpha__
regs->gp = ex.a_gpvalue;
#endif
- start_thread(regs, ex.a_entry, p);
+ start_thread(regs, ex.a_entry, current->mm->start_stack);
if (current->flags & PF_PTRACED)
send_sig(SIGTRAP, current, 0);
return 0;
passed_p = passed_fileno;
if (elf_interpreter) {
- bprm->p = copy_strings(1,&passed_p,bprm->page,bprm->p,2);
+ retval = copy_strings_kernel(1,&passed_p,bprm);
+ if (retval)
+ goto out_free_dentry;
bprm->argc++;
}
}
- retval = -E2BIG;
- if (!bprm->p)
- goto out_free_dentry;
}
/* Flush all traces of the currently running executable */
/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
current->mm->rss = 0;
- bprm->p = setup_arg_pages(bprm->p, bprm);
+ setup_arg_pages(bprm); /* XXX: check error */
current->mm->start_stack = bprm->p;
/* Try and get dynamic programs out of the way of the default mmap
* user environment and arguments are stored.
*/
remove_arg_zero(bprm);
- bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &bprm->filename, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
if (i_arg) {
- bprm->p = copy_strings(1, &i_arg, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_arg, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
}
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
- if (!bprm->p)
- return -E2BIG;
+
/*
* OK, now restart the process with the interpreter's inode.
* Note that we use open_namei() as the name is now in kernel
i_name++;
else
i_name = bprm->filename;
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval < 0)
+ return retval;
bprm->argc++;
i_name = binfmt_java_interpreter;
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval < 0)
+ return retval;
bprm->argc++;
- if (!bprm->p)
- return -E2BIG;
/*
* OK, now restart the process with the interpreter's dentry.
*/
*/
remove_arg_zero(bprm);
i_name = bprm->filename;
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
i_name = binfmt_java_appletviewer;
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
- if (!bprm->p)
- return -E2BIG;
/*
* OK, now restart the process with the interpreter's dentry.
*/
/* Build args for interpreter */
remove_arg_zero(bprm);
- bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &bprm->filename, bprm);
+ if (retval < 0) goto _ret;
bprm->argc++;
- bprm->p = copy_strings(1, &iname_addr, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &iname_addr, bprm);
+ if (retval < 0) goto _ret;
bprm->argc++;
- retval = -E2BIG;
- if (!bprm->p)
- goto _ret;
bprm->filename = iname; /* for binfmt_script */
dentry = open_namei(iname, 0, 0);
* user environment and arguments are stored.
*/
remove_arg_zero(bprm);
- bprm->p = copy_strings(1, &bprm->filename, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &bprm->filename, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
if (i_arg) {
- bprm->p = copy_strings(1, &i_arg, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_arg, bprm);
+ if (retval < 0) return retval;
bprm->argc++;
}
- bprm->p = copy_strings(1, &i_name, bprm->page, bprm->p, 2);
+ retval = copy_strings_kernel(1, &i_name, bprm);
+ if (retval) return retval;
bprm->argc++;
- if (!bprm->p)
- return -E2BIG;
/*
* OK, now restart the process with the interpreter's dentry.
*/
*/
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/time.h>
#include <linux/coda.h>
* An implementation of a loadable kernel mode driver providing
* multiple kernel/user space bidirectional communications links.
*
- * Author: Alan Cox <alan@cymru.net>
+ * Author: Alan Cox <alan@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <linux/module.h>
+#include <linux/string.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kdev_t.h>
* Portions derived from work (c) 1995,1996 Christian Vogelgsang.
*/
+#include <linux/string.h>
#include <linux/efs_fs.h>
static efs_ino_t efs_find_entry(struct inode *inode, const char *name, int len) {
* Portions derived from work (c) 1995,1996 Christian Vogelgsang.
*/
+#include <linux/string.h>
#include <linux/malloc.h>
#include <linux/efs_fs.h>
}
/*
- * 'copy_string()' copies argument/envelope strings from user
+ * 'copy_strings()' copies argument/envelope strings from user
* memory to free pages in kernel mem. These are in a format ready
* to be put directly into the top of new user memory.
- *
- * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
- * whether the string and the string array are from user or kernel segments:
- *
- * from_kmem argv * argv **
- * 0 user space user space
- * 1 kernel space user space
- * 2 kernel space kernel space
- *
- * We do this by playing games with the fs segment register. Since it
- * is expensive to load a segment register, we try to avoid calling
- * set_fs() unless we absolutely have to.
*/
-unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
- unsigned long p, int from_kmem)
+int copy_strings(int argc,char ** argv, struct linux_binprm *bprm)
{
- char *str;
- mm_segment_t old_fs;
-
- if (!p)
- return 0; /* bullet-proofing */
- old_fs = get_fs();
- if (from_kmem==2)
- set_fs(KERNEL_DS);
while (argc-- > 0) {
+ char *str;
int len;
unsigned long pos;
- if (from_kmem == 1)
- set_fs(KERNEL_DS);
- get_user(str, argv+argc);
- if (!str)
- panic("VFS: argc is wrong");
- if (from_kmem == 1)
- set_fs(old_fs);
- len = strlen_user(str); /* includes the '\0' */
- if (p < len) { /* this shouldn't happen - 128kB */
- set_fs(old_fs);
- return 0;
- }
- p -= len;
- pos = p;
+ if (get_user(str, argv+argc) || !str || !(len = strlen_user(str)))
+ return -EFAULT;
+ if (bprm->p < len)
+ return -E2BIG;
+
+ bprm->p -= len;
+ /* XXX: add architecture specific overflow check here. */
+
+ pos = bprm->p;
while (len) {
char *pag;
int offset, bytes_to_copy;
offset = pos % PAGE_SIZE;
- if (!(pag = (char *) page[pos/PAGE_SIZE]) &&
- !(pag = (char *) page[pos/PAGE_SIZE] =
- (unsigned long *) get_free_page(GFP_USER))) {
- if (from_kmem==2)
- set_fs(old_fs);
- return 0;
- }
+ if (!(pag = (char *) bprm->page[pos/PAGE_SIZE]) &&
+ !(pag = (char *) bprm->page[pos/PAGE_SIZE] =
+ (unsigned long *) get_free_page(GFP_USER)))
+ return -ENOMEM;
+
bytes_to_copy = PAGE_SIZE - offset;
if (bytes_to_copy > len)
bytes_to_copy = len;
- copy_from_user(pag + offset, str, bytes_to_copy);
+ if (copy_from_user(pag + offset, str, bytes_to_copy))
+ return -EFAULT;
+
pos += bytes_to_copy;
str += bytes_to_copy;
len -= bytes_to_copy;
}
}
- if (from_kmem==2)
- set_fs(old_fs);
- return p;
+ return 0;
}
-unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm)
+/*
+ * Like copy_strings, but get argv and its values from kernel memory.
+ */
+int copy_strings_kernel(int argc,char ** argv, struct linux_binprm *bprm)
+{
+ int r;
+ mm_segment_t oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ r = copy_strings(argc, argv, bprm);
+ set_fs(oldfs);
+ return r;
+}
+
+int setup_arg_pages(struct linux_binprm *bprm)
{
unsigned long stack_base;
struct vm_area_struct *mpnt;
stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE;
- p += stack_base;
+ bprm->p += stack_base;
if (bprm->loader)
bprm->loader += stack_base;
bprm->exec += stack_base;
mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
- if (mpnt) {
+ if (!mpnt)
+ return -ENOMEM;
+
+ {
mpnt->vm_mm = current->mm;
- mpnt->vm_start = PAGE_MASK & (unsigned long) p;
+ mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
mpnt->vm_end = STACK_TOP;
mpnt->vm_page_prot = PAGE_COPY;
mpnt->vm_flags = VM_STACK_FLAGS;
mpnt->vm_pte = 0;
insert_vm_struct(current->mm, mpnt);
current->mm->total_vm = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
- }
+ }
for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
if (bprm->page[i]) {
}
stack_base += PAGE_SIZE;
}
- return p;
+
+ return 0;
}
/*
int i;
bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
- for (i=0 ; i<MAX_ARG_PAGES ; i++) /* clear page-table */
- bprm.page[i] = 0;
+ memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
dentry = open_namei(filename, 0, 0);
retval = PTR_ERR(dentry);
}
retval = prepare_binprm(&bprm);
-
- if (retval >= 0) {
- bprm.p = copy_strings(1, &bprm.filename, bprm.page, bprm.p, 2);
- bprm.exec = bprm.p;
- bprm.p = copy_strings(bprm.envc,envp,bprm.page,bprm.p,0);
- bprm.p = copy_strings(bprm.argc,argv,bprm.page,bprm.p,0);
- if (!bprm.p)
- retval = -E2BIG;
- }
+ if (retval < 0)
+ goto out;
- if (retval >= 0)
- retval = search_binary_handler(&bprm,regs);
+ retval = copy_strings_kernel(1, &bprm.filename, &bprm);
+ if (retval < 0)
+ goto out;
+
+ bprm.exec = bprm.p;
+ retval = copy_strings(bprm.envc, envp, &bprm);
+ if (retval < 0)
+ goto out;
+
+ retval = copy_strings(bprm.argc, argv, &bprm);
+ if (retval < 0)
+ goto out;
+
+ retval = search_binary_handler(&bprm,regs);
if (retval >= 0)
/* execve success */
return retval;
+out:
/* Something went wrong, return the inode and free the argument pages*/
if (bprm.dentry)
dput(bprm.dentry);
+ /* Assumes that free_page() can take a NULL argument. */
+ /* I hope this is ok for all architectures */
for (i=0 ; i<MAX_ARG_PAGES ; i++)
free_page(bprm.page[i]);
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
*/
+#include <linux/string.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/init.h>
* general buffer i/o
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
void hpfs_lock_creation(struct super_block *s)
* handling extended attributes
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
/* Remove external extended attributes. ano specifies wheter a is a
* file VFS functions
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
int hpfs_open(struct inode *i, struct file *f)
* operations with filenames
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
char *text_postfix[]={
* adding & removing files & directories
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
* mouning, unmounting, error handling
*/
+#include <linux/string.h>
#include "hpfs_fn.h"
#include <linux/module.h>
* extensions to iso9660
*/
+#include <linux/string.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/unistd.h>
+#include <linux/string.h>
#include <linux/malloc.h>
#include <linux/sunrpc/clnt.h>
*/
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/sched.h>
#include <linux/in.h>
#include <linux/sunrpc/svc.h>
#include <linux/ncp_fs.h>
#include "ncplib_kernel.h"
-static inline int min(int a, int b)
+static inline unsigned int min(unsigned int a, unsigned int b)
{
return a < b ? a : b;
}
struct inode *inode = dentry->d_inode;
size_t already_read = 0;
off_t pos;
- int bufsize, error;
+ size_t bufsize;
+ int error;
void* freepage;
- int freelen;
+ size_t freelen;
DPRINTK(KERN_DEBUG "ncp_file_read: enter %s/%s\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
goto out;
}
- pos = file->f_pos;
+ pos = *ppos;
+/* leave it out on server ...
if (pos + count > inode->i_size) {
count = inode->i_size - pos;
}
+*/
error = 0;
if (!count) /* size_t is never < 0 */
goto out;
/* First read in as much as possible for each bufsize. */
while (already_read < count) {
int read_this_time;
- int to_read = min(bufsize - (pos % bufsize),
+ size_t to_read = min(bufsize - (pos % bufsize),
count - already_read);
error = ncp_read_bounce(NCP_SERVER(inode),
buf += read_this_time;
already_read += read_this_time;
- if (read_this_time < to_read) {
+ if (read_this_time != to_read) {
break;
}
}
kfree(freepage);
- file->f_pos = pos;
+ *ppos = pos;
if (!IS_RDONLY(inode)) {
inode->i_atime = CURRENT_TIME;
struct inode *inode = dentry->d_inode;
size_t already_written = 0;
off_t pos;
- int bufsize, errno;
+ size_t bufsize;
+ int errno;
void* bouncebuffer;
DPRINTK(KERN_DEBUG "ncp_file_write: enter %s/%s\n",
printk(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
return errno;
}
- pos = file->f_pos;
+ pos = *ppos;
if (file->f_flags & O_APPEND) {
pos = inode->i_size;
return -EIO; /* -ENOMEM */
while (already_written < count) {
int written_this_time;
- int to_write = min(bufsize - (pos % bufsize),
+ size_t to_write = min(bufsize - (pos % bufsize),
count - already_written);
if (copy_from_user(bouncebuffer, buf, to_write)) {
buf += written_this_time;
already_written += written_this_time;
- if (written_this_time < to_write) {
+ if (written_this_time != to_write) {
break;
}
}
kfree(bouncebuffer);
inode->i_mtime = inode->i_atime = CURRENT_TIME;
- file->f_pos = pos;
+ *ppos = pos;
if (pos > inode->i_size) {
inode->i_size = pos;
#include <linux/pagemap.h>
#include <linux/lockd/bind.h>
+#include <asm/uaccess.h>
#include <asm/segment.h>
#include <asm/system.h>
NULL, /* truncate */
NULL, /* permission */
NULL, /* smap */
- nfs_updatepage, /* updatepage */
+ NULL, /* updatepage */
nfs_revalidate, /* revalidate */
};
return status;
}
+/*
+ * This does the "real" work of the write. The generic routine has
+ * allocated the page, locked it, done all the page alignment stuff
+ * calculations etc. Now we should just copy the data from user
+ * space and write it back to the real medium..
+ *
+ * If the writer ends up delaying the write, the writer needs to
+ * increment the page use counts until he is done with the page.
+ */
+static long nfs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
+{
+ long status;
+
+ bytes -= copy_from_user((u8*)page_address(page) + offset, buf, bytes);
+ status = -EFAULT;
+ if (bytes)
+ status = nfs_updatepage(file, page, offset, bytes);
+ return status;
+}
/*
* Write to a file (through the page cache).
if (!count)
goto out;
- result = generic_file_write(file, buf, count, ppos);
+ result = generic_file_write(file, buf, count, ppos, nfs_write_one_page);
out:
return result;
* things with a page scheduled for an RPC call (e.g. invalidate it).
*/
int
-nfs_updatepage(struct file *file, struct page *page, unsigned long offset, unsigned int count, int sync)
+nfs_updatepage(struct file *file, struct page *page, unsigned long offset, unsigned int count)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
struct nfs_wreq *req;
- int synchronous = sync;
+ int synchronous = file->f_flags & O_SYNC;
int retval;
- dprintk("NFS: nfs_updatepage(%s/%s %d@%ld, sync=%d)\n",
+ dprintk("NFS: nfs_updatepage(%s/%s %d@%ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- count, page->offset+offset, sync);
+ count, page->offset+offset);
/*
* Try to find a corresponding request on the writeback queue.
file->f_count++;
/* Schedule request */
- synchronous = schedule_write_request(req, sync);
+ synchronous = schedule_write_request(req, synchronous);
updated:
if (req->wb_bytes == PAGE_SIZE)
#include "struct.h"
#include "util.h"
+#include <linux/string.h>
#include <linux/errno.h>
/* FreeBSD doesn't seem to have EILSEQ in errno.h */
#ifndef EILSEQ
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/errno.h>
#include <linux/malloc.h>
#include <linux/qnx4_fs.h>
/* THIS FILE HAS TO BE REWRITTEN */
+#include <linux/string.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/fs.h>
}
static int
-smb_updatepage(struct file *file, struct page *page, unsigned long offset, unsigned int count, int sync)
+smb_updatepage(struct file *file, struct page *page, unsigned long offset, unsigned int count)
{
struct dentry *dentry = file->f_dentry;
- pr_debug("SMBFS: smb_updatepage(%s/%s %d@%ld, sync=%d)\n",
+ pr_debug("SMBFS: smb_updatepage(%s/%s %d@%ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
- count, page->offset+offset, sync);
+ count, page->offset+offset);
return smb_writepage_sync(dentry, page, offset, count);
}
return status;
}
+/*
+ * This does the "real" work of the write. The generic routine has
+ * allocated the page, locked it, done all the page alignment stuff
+ * calculations etc. Now we should just copy the data from user
+ * space and write it back to the real medium..
+ *
+ * If the writer ends up delaying the write, the writer needs to
+ * increment the page use counts until he is done with the page.
+ */
+static long smb_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf)
+{
+ long status;
+
+ bytes -= copy_from_user((u8*)page_address(page) + offset, buf, bytes);
+ status = -EFAULT;
+ if (bytes)
+ status = smb_updatepage(file, page, offset, bytes);
+ return status;
+}
+
/*
* Write to a file (through the page cache).
*/
if (count > 0)
{
- result = generic_file_write(file, buf, count, ppos);
+ result = generic_file_write(file, buf, count, ppos, smb_write_one_page);
#ifdef SMBFS_DEBUG_VERBOSE
printk("smb_file_write: pos=%ld, size=%ld, mtime=%ld, atime=%ld\n",
(long) file->f_pos, dentry->d_inode->i_size, dentry->d_inode->i_mtime,
NULL, /* truncate */
smb_file_permission, /* permission */
NULL, /* smap */
- smb_updatepage, /* updatepage */
+ NULL, /* updatepage */
smb_revalidate_inode, /* revalidate */
};
* Charles University, Faculty of Mathematics and Physics
*/
+#include <linux/string.h>
#include <linux/malloc.h>
#include <linux/locks.h>
* SMP locks primitives for building ix86 locks
* (not yet used).
*
- * Alan Cox, alan@cymru.net, 1995
+ * Alan Cox, alan@redhat.com, 1995
*/
/*
extern unsigned int local_bh_count[NR_CPUS];
+#define cpu_bh_disable(cpu) do { local_bh_count[(cpu)]++; barrier(); } while (0)
+#define cpu_bh_enable(cpu) do { barrier(); local_bh_count[(cpu)]--; } while (0)
+
+#define cpu_bh_trylock(cpu) (local_bh_count[(cpu)] ? 0 : (local_bh_count[(cpu)] = 1))
+#define cpu_bh_endlock(cpu) (local_bh_count[(cpu)] = 0)
+
+#define local_bh_disable() cpu_bh_disable(smp_processor_id())
+#define local_bh_enable() cpu_bh_enable(smp_processor_id())
+
#define get_active_bhs() (bh_mask & bh_active)
#define clear_active_bhs(x) atomic_clear_mask((x),&bh_active)
extern void synchronize_bh(void);
-/*
- * This is suboptimal. We only need to disable bh's locally
- * on this CPU...
- */
-#define local_bh_disable() atomic_inc(&global_bh_lock)
-#define local_bh_enable() atomic_dec(&global_bh_lock)
-
static inline void start_bh_atomic(void)
{
atomic_inc(&global_bh_lock);
/* These are for the IRQs testing the lock */
static inline int softirq_trylock(int cpu)
{
- if (!test_and_set_bit(0,&global_bh_count)) {
- if (atomic_read(&global_bh_lock) == 0) {
- ++local_bh_count[cpu];
- return 1;
+ if (cpu_bh_trylock(cpu)) {
+ if (!test_and_set_bit(0,&global_bh_count)) {
+ if (atomic_read(&global_bh_lock) == 0)
+ return 1;
+ clear_bit(0,&global_bh_count);
}
- clear_bit(0,&global_bh_count);
+ cpu_bh_endlock(cpu);
}
return 0;
}
static inline void softirq_endlock(int cpu)
{
- local_bh_count[cpu]--;
+ cpu_bh_enable(cpu);
clear_bit(0,&global_bh_count);
}
extern inline void start_bh_atomic(void)
{
- local_bh_count[smp_processor_id()]++;
+ local_bh_disable();
barrier();
}
extern inline void end_bh_atomic(void)
{
barrier();
- local_bh_count[smp_processor_id()]--;
+ local_bh_enable();
}
-#define local_bh_disable() (local_bh_count[smp_processor_id()]++)
-#define local_bh_enable() (local_bh_count[smp_processor_id()]--)
-
/* These are for the irq's testing the lock */
-#define softirq_trylock(cpu) (local_bh_count[cpu] ? 0 : (local_bh_count[cpu]=1))
-#define softirq_endlock(cpu) (local_bh_count[cpu] = 0)
+#define softirq_trylock(cpu) (cpu_bh_trylock(cpu))
+#define softirq_endlock(cpu) (cpu_bh_endlock(cpu))
#define synchronize_bh() barrier()
#endif /* SMP */
struct linux_binprm{
char buf[128];
unsigned long page[MAX_ARG_PAGES];
- unsigned long p;
+ unsigned long p; /* current top of mem */
int sh_bang;
int java; /* Java binary, prevent recursive invocation */
struct dentry * dentry;
extern void remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
extern int flush_old_exec(struct linux_binprm * bprm);
-extern unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm);
-extern unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
- unsigned long p, int from_kmem);
-
+extern int setup_arg_pages(struct linux_binprm * bprm);
+extern int copy_strings(int argc,char ** argv,struct linux_binprm *bprm);
+extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
extern void compute_creds(struct linux_binprm *binprm);
-/* this eventually goes away */
+
+#if 0
+/* this went away now */
#define change_ldt(a,b) setup_arg_pages(a,b)
+#endif
#endif /* __KERNEL__ */
#endif /* _LINUX_BINFMTS_H */
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int);
int (*smap) (struct inode *,int);
- int (*updatepage) (struct file *, struct page *, unsigned long, unsigned int, int);
+ int (*updatepage) (struct file *, struct page *, unsigned long, unsigned int);
int (*revalidate) (struct dentry *);
};
extern int brw_page(int, struct page *, kdev_t, int [], int, int);
+typedef long (*writepage_t)(struct file *, struct page *, unsigned long, unsigned long, const char *);
+
extern int generic_readpage(struct file *, struct page *);
extern int generic_file_mmap(struct file *, struct vm_area_struct *);
extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
-extern ssize_t generic_file_write(struct file *, const char*, size_t, loff_t*);
+extern ssize_t generic_file_write(struct file *, const char*, size_t, loff_t *, writepage_t);
extern struct super_block *get_super(kdev_t dev);
extern void put_super(kdev_t dev);
*
* Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Donald Becker, <becker@super.org>
- * Alan Cox, <alan@cymru.net>
+ * Alan Cox, <alan@redhat.com>
* Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
*
* This program is free software; you can redistribute it and/or
* if_fddi.h is based on previous if_ether.h and if_tr.h work by
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Donald Becker, <becker@super.org>
- * Alan Cox, <alan@cymru.net>
+ * Alan Cox, <alan@redhat.com>
* Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
* Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
*
*
* Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
* Donald Becker, <becker@super.org>
- * Alan Cox, <alan@cymru.net>
+ * Alan Cox, <alan@redhat.com>
* Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
* Jes Sorensen, <Jes.Sorensen@cern.ch>
*
* back first..
*/
extern void nfs_inval(struct inode *);
-extern int nfs_updatepage(struct file *, struct page *, unsigned long, unsigned int, int);
+extern int nfs_updatepage(struct file *, struct page *, unsigned long, unsigned int);
/*
* linux/fs/nfs/read.c
/*
* Generic SMP support
- * Alan Cox. <alan@cymru.net>
+ * Alan Cox. <alan@redhat.com>
*/
#ifdef __SMP__
#include <linux/config.h>
#include <linux/proc_fs.h>
#include <linux/unistd.h>
+#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/utsname.h>
*/
ssize_t
generic_file_write(struct file *file, const char *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos,
+ writepage_t write_one_page)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
struct page *page, **hash;
unsigned long page_cache = 0;
unsigned long written;
- long status, sync;
-
- if (!inode->i_op || !inode->i_op->updatepage)
- return -EIO;
+ long status;
if (file->f_error) {
int error = file->f_error;
return error;
}
- sync = file->f_flags & O_SYNC;
written = 0;
if (file->f_flags & O_APPEND)
wait_on_page(page);
set_bit(PG_locked, &page->flags);
- /*
- * Do the real work.. If the writer ends up delaying the write,
- * the writer needs to increment the page use counts until he
- * is done with the page.
- */
- bytes -= copy_from_user((u8*)page_address(page) + offset, buf, bytes);
- status = -EFAULT;
- if (bytes)
- status = inode->i_op->updatepage(file, page, offset, bytes, sync);
+ status = write_one_page(file, page, offset, bytes, buf);
/* Mark it unlocked again and drop the page.. */
clear_bit(PG_locked, &page->flags);
* Alan Cox : Chainsawed to Linux format
* Added llc_ to names
* Started restructuring handlers
+ *
+ * Horst von Brand : Add #include <linux/string.h>
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/unistd.h>
+#include <linux/string.h>
#include <linux/netdevice.h>
#include <linux/init.h>
#include <net/p8022.h>
* This is used because UDP, RAW, PACKET, DDP, IPX, AX.25 and NetROM layer all have identical poll code and mostly
* identical recvmsg() code. So we share it here. The poll was shared before but buried in udp.c so I moved it.
*
- * Authors: Alan Cox <alan@cymru.net>. (datagram_poll() from old udp.c code)
+ * Authors: Alan Cox <alan@redhat.com>. (datagram_poll() from old udp.c code)
*
* Fixes:
* Alan Cox : NULL return from skb_peek_copy() understood
dev_do_clear_fastroute(dev);
} else {
read_lock_bh(&dev_base_lock);
- for (dev = dev_base; dev; dev = dev->next) {
- read_unlock_bh(&dev_base_lock);
+ for (dev = dev_base; dev; dev = dev->next)
dev_do_clear_fastroute(dev);
- read_lock_bh(&dev_base_lock);
- }
read_unlock_bh(&dev_base_lock);
}
}
if (copy_from_user(&ifc, arg, sizeof(struct ifconf)))
return -EFAULT;
- pos = ifc.ifc_buf;
len = ifc.ifc_len;
+ if (ifc.ifc_buf) {
+ pos = (char *) kmalloc(len, GFP_KERNEL);
+ if(pos == NULL)
+ return -ENOBUFS;
+ } else
+ pos = NULL;
/*
* Loop over the interfaces, and write an info block for each.
total = 0;
read_lock_bh(&dev_base_lock);
for (dev = dev_base; dev != NULL; dev = dev->next) {
- read_unlock_bh(&dev_base_lock);
for (i=0; i<NPROTO; i++) {
if (gifconf_list[i]) {
int done;
} else {
done = gifconf_list[i](dev, pos+total, len-total);
}
- if (done<0) {
- return -EFAULT;
- }
total += done;
}
}
- read_lock_bh(&dev_base_lock);
}
read_unlock_bh(&dev_base_lock);
+ if(pos != NULL) {
+ int err = copy_to_user(ifc.ifc_buf, pos, total);
+
+ kfree(pos);
+ if(err)
+ return -EFAULT;
+ }
+
/*
* All done. Write the updated control block back to the caller.
*/
*/
dp = &dev_base;
- write_lock_bh(&dev_base_lock);
while ((dev = *dp) != NULL) {
dev->iflink = -1;
if (dev->init && dev->init(dev)) {
*dp = dev->next;
} else {
dp = &dev->next;
- write_unlock_bh(&dev_base_lock);
dev->ifindex = dev_new_index();
- write_lock_bh(&dev_base_lock);
if (dev->iflink == -1)
dev->iflink = dev->ifindex;
dev_init_scheduler(dev);
}
}
- write_unlock_bh(&dev_base_lock);
#ifdef CONFIG_PROC_FS
proc_net_register(&proc_net_dev);
*
* Fixes:
* Vitaly E. Lavrov releasing NULL neighbor in neigh_add.
+ * Horst von Brand Add #include <linux/string.h>
*/
#include <linux/config.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/socket.h>
#include <linux/sched.h>
{
struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
struct dn_ifaddr *ifa;
- char buffer[DN_IFREQ_SIZE];
- struct ifreq *ifr = (struct ifreq *)buffer;
+ struct ifreq *ifr = (struct ifreq *)buf;
int done = 0;
if ((dn_db == NULL) || ((ifa = dn_db->ifa_list) == NULL))
return 0;
for(; ifa; ifa = ifa->ifa_next) {
- if (!buf) {
+ if (!ifr) {
done += sizeof(DN_IFREQ_SIZE);
continue;
}
(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_len = 2;
(*(dn_address *)(*(struct sockaddr_dn *) &ifr->ifr_addr).sdn_add.a_addr) = ifa->ifa_local;
- if (copy_to_user(buf, ifr, DN_IFREQ_SIZE))
- return -EFAULT;
-
- buf += DN_IFREQ_SIZE;
+ ifr = (struct ifreq *)((char *)ifr + DN_IFREQ_SIZE);
len -= DN_IFREQ_SIZE;
done += DN_IFREQ_SIZE;
}
if (!str || !*str)
return;
- read_lock_bh(&dev_base_lock);
+
d = dev_base;
while (d)
{
}
d=d->next;
}
- read_unlock_bh(&dev_base_lock);
}
/*
* NET3 IP device support routines.
*
- * Version: $Id: devinet.c,v 1.29 1999/05/27 00:37:57 davem Exp $
+ * Version: $Id: devinet.c,v 1.30 1999/06/01 07:49:59 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
{
struct in_device *in_dev = dev->ip_ptr;
struct in_ifaddr *ifa;
- struct ifreq ifr;
+ struct ifreq *ifr = (struct ifreq *) buf;
int done=0;
if (in_dev==NULL || (ifa=in_dev->ifa_list)==NULL)
return 0;
for ( ; ifa; ifa = ifa->ifa_next) {
- if (!buf) {
+ if (!ifr) {
done += sizeof(ifr);
continue;
}
if (len < (int) sizeof(ifr))
return done;
- memset(&ifr, 0, sizeof(struct ifreq));
+ memset(ifr, 0, sizeof(struct ifreq));
if (ifa->ifa_label)
- strcpy(ifr.ifr_name, ifa->ifa_label);
+ strcpy(ifr->ifr_name, ifa->ifa_label);
else
- strcpy(ifr.ifr_name, dev->name);
+ strcpy(ifr->ifr_name, dev->name);
- (*(struct sockaddr_in *) &ifr.ifr_addr).sin_family = AF_INET;
- (*(struct sockaddr_in *) &ifr.ifr_addr).sin_addr.s_addr = ifa->ifa_local;
+ (*(struct sockaddr_in *) &ifr->ifr_addr).sin_family = AF_INET;
+ (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr = ifa->ifa_local;
- if (copy_to_user(buf, &ifr, sizeof(struct ifreq)))
- return -EFAULT;
- buf += sizeof(struct ifreq);
+ ifr++;
len -= sizeof(struct ifreq);
done += sizeof(struct ifreq);
}
/*
* NET3: Implementation of the ICMP protocol layer.
*
- * Alan Cox, <alan@cymru.net>
+ * Alan Cox, <alan@redhat.com>
*
* Version: $Id: icmp.c,v 1.54 1999/05/30 01:16:22 davem Exp $
*
* http://www.gamers.org/dEngine/quake/spec/
* Harald Hoyer : Check for QUAKE-STRING
* Juan Jose Ciarlante : litl bits for 2.1
+ * Horst von Brand : Add #include <linux/string.h>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include <linux/module.h>
#include <asm/system.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/in.h>
* Fixes: Minor changes for 2.1 by
* Steven Clarke <Steven.Clarke@ThePlanet.Net>, Planet Online Ltd
*
+ * Add missing #include <linux/string.h>
+ * Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
+ *
* 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
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <linux/skbuff.h>
error:
if (skb) {
icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
- kfree_skb(skb);
}
return -EINVAL;
}
/*
* IP multicast routing support for mrouted 3.6/3.8
*
- * (c) 1995 Alan Cox, <alan@cymru.net>
+ * (c) 1995 Alan Cox, <alan@redhat.com>
* Linux Consultancy and Custom Driver Development
*
* This program is free software; you can redistribute it and/or
!(th->fin && TCP_SKB_CB(skb)->end_seq == tp->rcv_nxt)) {
if (!th->rst) {
tcp_send_ack(sk);
- goto discard;
}
+ goto discard;
}
/* step 2: check RST bit */
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/net.h>
* route changes now work.
* ip6_forward does not confuse sniffers.
* etc.
- *
+ *
+ * H. von Brand : Added missing #include <linux/string.h>
*/
#include <linux/errno.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/socket.h>
#include <linux/net.h>
#include <linux/netdevice.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/sched.h>
* Fixes:
* Andi Kleen Make it work with multiple hosts.
* More RFC compliance.
+ *
+ * Horst von Brand Add missing #include <linux/string.h>
*/
#include <linux/errno.h>
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/sched.h>
* Created at: Tue Apr 6 15:33:50 1999
* Modified at: Sun May 9 22:40:43 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
+ * Modified at: Fri May 28 3:11 CST 1999
+ * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
*
*
********************************************************************/
+#include <linux/string.h>
#include <linux/socket.h>
#include <linux/irda.h>
* Created at: Wed Sep 2 20:22:08 1998
* Modified at: Mon May 10 23:02:47 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
+ * Modified at: Fri May 28 3:11 CST 1999
+ * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
*
********************************************************************/
#include <linux/config.h>
+#include <linux/string.h>
#include <linux/proc_fs.h>
#include <linux/skbuff.h>
#include <linux/if.h>
* Created at: Fri Oct 9 09:18:07 1998
* Modified at: Sun May 9 11:37:06 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
+ * Modified at: Fri May 28 3:11 CST 1999
+ * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
* Sources: ppp.c, isdn_ppp.c
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
*
********************************************************************/
+#include <linux/string.h>
+
#include <net/irda/irda.h>
#include <net/irda/irqueue.h>
#include <net/irda/irlap.h>
* Created at: Mon Aug 4 20:40:53 1997
* Modified at: Sun May 2 21:58:00 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
+ * Modified at: Fri May 28 3:11 CST 1999
+ * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*
* Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved.
********************************************************************/
#include <linux/skbuff.h>
+#include <linux/string.h>
#include <asm/byteorder.h>
#include <net/irda/irda.h>
/*
* NETLINK Kernel-user communication protocol.
*
- * Authors: Alan Cox <alan@cymru.net>
+ * Authors: Alan Cox <alan@redhat.com>
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
*
* This program is free software; you can redistribute it and/or
* NETLINK An implementation of a loadable kernel mode driver providing
* multiple kernel/user space bidirectional communications links.
*
- * Author: Alan Cox <alan@cymru.net>
+ * Author: Alan Cox <alan@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Generic RPC authentication API.
*
* Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
+ *
+ * Modified May 1999, Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*/
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/sched.h>
#include <linux/malloc.h>
#include <linux/errno.h>
* UNIX-style authentication; no AUTH_SHORT support
*
* Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
+ *
+ * Modified May 1999 Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
*/
#include <linux/types.h>
+#include <linux/string.h>
#include <linux/malloc.h>
#include <linux/socket.h>
#include <linux/in.h>
#if defined(CONFIG_LLC) || defined(CONFIG_LLC_MODULE)
|| dev->type == ARPHRD_ETHER
#endif
- )) {
- read_unlock_bh(&dev_base_lock);
+ ))
x25_link_device_up(dev);
- read_lock_bh(&dev_base_lock);
- }
}
read_unlock_bh(&dev_base_lock);