Commit aa0faa45 authored by Linus Torvalds's avatar Linus Torvalds

Import 2.3.99pre2

parent 312d62f3
......@@ -8510,7 +8510,7 @@ Linux telephony support
CONFIG_PHONE
This option enable the kernel to manage telephony cards.
There is very few supported cards at this moment.
There are very few supported cards at this moment.
If unsure, say N.
......
......@@ -37,7 +37,7 @@ kernel-api.sgml: kernel-api.tmpl
clean:
rm -f core *~
rm -f $BOOKS
rm -f $(BOOKS)
include $(TOPDIR)/Rules.make
......@@ -89,15 +89,29 @@ ioctl(file,I2C_TENBIT,long select)
ioctl(file,I2C_FUNCS,unsigned long *funcs)
Gets the adapter functionality and puts it in *funcs.
ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset)
Do combined read/write transaction without stop in between.
The argument is a pointer to a struct i2c_ioctl_rdwr_data {
struct i2c_msg *msgs; /* ptr to array of simple messages */
int nmsgs; /* number of messages to exchange */
}
The msgs[] themselves contain further pointers into data buffers.
The function will write or read data to or from that buffers depending
on whether the I2C_M_RD flag is set in a particular message or not.
The slave address and whether to use ten bit address mode has to be
set in each message, overriding the values set with the above ioctl's.
Other values are NOT supported at this moment, except for I2C_SMBUS,
which you should never directly call; instead, use the access functions
below.
You can do plain i2c transactions by using read(2) and write(2) calls.
Combined read/write transactions are not yet supported (they will in
the future, through an ioctl). You do not need to pass the address
byte; instead, set it through ioctl I2C_SLAVE before you try to
access the device.
You do not need to pass the address byte; instead, set it through
ioctl I2C_SLAVE before you try to access the device.
You can do SMBus level transactions (see documentation file smbus-protocol
for details) through the following functions:
......
This diff is collapsed.
......@@ -3,9 +3,9 @@ PATCHLEVEL = 3
SUBLEVEL = 99
EXTRAVERSION = -pre2
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
.EXPORT_ALL_VARIABLES:
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
......@@ -15,22 +15,33 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
HPATH = $(TOPDIR)/include
FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
HOSTCC =gcc
HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
HOSTCC = gcc
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
CROSS_COMPILE =
AS =$(CROSS_COMPILE)as
LD =$(CROSS_COMPILE)ld
CC =$(CROSS_COMPILE)gcc
CPP =$(CC) -E
AR =$(CROSS_COMPILE)ar
NM =$(CROSS_COMPILE)nm
STRIP =$(CROSS_COMPILE)strip
OBJCOPY =$(CROSS_COMPILE)objcopy
OBJDUMP =$(CROSS_COMPILE)objdump
MAKE =make
GENKSYMS=/sbin/genksyms
#
# Include the make variables (CC, etc...)
#
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
MAKE = make
MAKEFILES = $(TOPDIR)/.config
GENKSYMS = /sbin/genksyms
MODFLAGS = -DMODULE
PERL = perl
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
all: do-it-all
......@@ -38,6 +49,7 @@ all: do-it-all
# Make "config" the default target if there is no configuration file or
# "depend" the target if there is no top-level dependency information.
#
ifeq (.config,$(wildcard .config))
include .config
ifeq (.depend,$(wildcard .depend))
......@@ -52,21 +64,12 @@ CONFIGURATION = config
do-it-all: config
endif
#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
# the default of FLOPPY is used by 'build'.
#
ROOT_DEV = CURRENT
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
#
# INSTALL_PATH specifies where to place the updated kernel and system map
# images. Uncomment if you want to place them anywhere other than root.
#
#INSTALL_PATH=/boot
#export INSTALL_PATH=/boot
#
# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
......@@ -74,15 +77,6 @@ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
# makefile but the arguement can be passed to make if needed.
#
#
# If you want to preset the SVGA mode, uncomment the next line and
# set SVGA_MODE to whatever number you want.
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
# The number is the same as you would ordinarily press at bootup.
#
SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
#
# standard CFLAGS
#
......@@ -96,16 +90,35 @@ endif
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
AFLAGS := $(CPPFLAGS)
export CPPFLAGS CFLAGS AFLAGS
#
# if you want the RAM disk device, define this to be the
# size in blocks.
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
# the default of FLOPPY is used by 'build'.
# This is i386 specific.
#
#RAMDISK = -DRAMDISK=512
export ROOT_DEV = CURRENT
# Include the make variables (CC, etc...)
#
# If you want to preset the SVGA mode, uncomment the next line and
# set SVGA_MODE to whatever number you want.
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
# The number is the same as you would ordinarily press at bootup.
# This is i386 specific.
#
export SVGA_MODE = -DSVGA_MODE=NORMAL_VGA
#
# if you want the RAM disk device, define this to be the
# size in blocks.
# This is i386 specific.
#
#export RAMDISK = -DRAMDISK=512
CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
NETWORKS =net/network.a
DRIVERS =drivers/block/block.a \
......@@ -166,6 +179,9 @@ DRIVERS += $(DRIVERS-y)
include arch/$(ARCH)/Makefile
export CORE_FILES NETWORKS DRIVERS LIBS HEAD LDFLAGS LIBS LINKFLAGS \
MAKEBOOT ASFLAGS
# use '-fno-strict-aliasing', but only if the compiler can take it
CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
......@@ -276,7 +292,6 @@ tags: dummy
find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
MODFLAGS += -DMODULE
ifdef CONFIG_MODULES
ifdef CONFIG_MODVERSIONS
MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
......@@ -405,20 +420,21 @@ dep-files: scripts/mkdep archdep include/linux/version.h
scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
MODVERFILE :=
ifdef CONFIG_MODVERSIONS
MODVERFILE := $(TOPDIR)/include/linux/modversions.h
else
MODVERFILE :=
endif
export MODVERFILE
depend dep: dep-files $(MODVERFILE)
# make checkconfig: Prune 'scripts' directory to avoid "false positives".
checkconfig:
find * -name '*.[hcS]' -type f -print | grep -v scripts/ | sort | xargs perl -w scripts/checkconfig.pl
find * -name '*.[hcS]' -type f -print | grep -v scripts/ | sort | xargs $(PERL) -w scripts/checkconfig.pl
checkhelp:
perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
$(PERL) -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
ifdef CONFIGURATION
..$(CONFIGURATION):
......
......@@ -215,10 +215,8 @@ do_entIF(unsigned long type, unsigned long a1,
/* EV4 does not implement anything except normal
rounding. Everything else will come here as
an illegal instruction. Emulate them. */
if (alpha_fp_emul(regs.pc)) {
regs.pc += 4;
if (alpha_fp_emul(regs.pc-4))
return;
}
}
send_sig(SIGILL, current, 1);
break;
......
......@@ -14,7 +14,6 @@
OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
CPP := $(CC) -E
PERL := perl
LINKFLAGS := -p -X -T arch/arm/vmlinux.lds
ARCHCC := $(word 1,$(CC))
......@@ -101,6 +100,8 @@ endif
LIBGCC := $(shell $(CC) $(CFLAGS) --print-libgcc-file-name)
export LIBGCC
ifeq ($(CONFIG_ARCH_A5K),y)
MACHINE = a5k
ARCHDIR = arc
......
......@@ -30,7 +30,8 @@ CFLAGS += $(shell if ! $(CC) -march=i486 -S -o /dev/null -xc /dev/null >/dev/nul
CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)
ifdef CONFIG_M386
CFLAGS := $(CFLAGS) -m386 -DCPU=386
CFLAGS := $(CFLAGS) -DCPU=386
CFLAGS += $(shell if $(CC) -march=i386 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i386"; else echo "-m386"; fi)
AFLAGS := $(AFLAGS) -DCPU=386
endif
......@@ -65,7 +66,7 @@ AFLAGS := $(AFLAGS) -DCPU=586
endif
ifdef CONFIG_MK7
CFLAGS := $(CFLAGS) -DCPU=686 -march=pentiumpro -mpentiumpro -malign-functions=4 -fschedule-insns2 -mwide-multiply -fexpensive-optimizations
CFLAGS := $(CFLAGS) -malign-functions=4 -fschedule-insns2 -mwide-multiply -fexpensive-optimizations -DCPU=686
CFLAGS += $(shell if $(CC) -march=i686 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=i686"; fi)
AFLAGS := $(AFLAGS) -DCPU=686
endif
......
......@@ -49,6 +49,8 @@ SUBDIRS += arch/sparc/boot
CORE_FILES_NO_BTFIX := $(CORE_FILES)
CORE_FILES += arch/sparc/boot/btfix.o
export CORE_FILES_NO_BTFIX
archclean:
rm -f $(TOPDIR)/vmlinux.aout
-$(MAKE) -C arch/sparc/boot clean
......
......@@ -4315,6 +4315,9 @@ static struct pci_board pnp_devices[] __initdata = {
/* Best Data Products Inc. Smart One 336F PnP Modem */
{ ISAPNP_VENDOR('B', 'D', 'P'), ISAPNP_DEVICE(0x3336), 0, 0,
SPCI_FL_BASE0 | SPCI_FL_PNPDEFAULT, 1, 115200 },
/* SupraExpress 28.8 Data/Fax PnP modem */
{ ISAPNP_VENDOR('S', 'U', 'P'), ISAPNP_DEVICE(0x1310), 0, 0,
SPCI_FL_BASE0 | SPCI_FL_PNPDEFAULT, 1, 115200 },
/* These ID's are taken from M$ documentation */
/* Compaq 14400 Modem */
{ ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_DEVICE(0xC000), 0, 0,
......
......@@ -21,9 +21,10 @@
/* ------------------------------------------------------------------------- */
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and
Frodo Looijaard <frodol@dds.nl> */
Frodo Looijaard <frodol@dds.nl> ,and also from Martin Bailey
<mbailey@littlefeet-inc.com> */
/* $Id: i2c-algo-pcf.c,v 1.20 2000/01/24 02:06:33 mds Exp $ */
/* $Id: i2c-algo-pcf.c,v 1.21 2000/03/16 13:07:34 frodo Exp $ */
#include <linux/kernel.h>
#include <linux/module.h>
......@@ -108,10 +109,12 @@ static int wait_for_bb(struct i2c_algo_pcf_data *adap) {
int status;
status = get_pcf(adap, 1);
#ifndef STUB_I2C
while (timeout-- && !(status & I2C_PCF_BB)) {
udelay(1000); /* How much is this? */
status = get_pcf(adap, 1);
}
#endif
if (timeout<=0)
printk("Timeout waiting for Bus Busy\n");
/*
......@@ -132,10 +135,12 @@ static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status) {
int timeout = DEF_TIMEOUT;
*status = get_pcf(adap, 1);
#ifndef STUB_I2C
while (timeout-- && (*status & I2C_PCF_PIN)) {
adap->waitforpin();
*status = get_pcf(adap, 1);
}
#endif
if (timeout <= 0)
return(-1);
else
......@@ -268,7 +273,7 @@ static inline int try_address(struct i2c_algo_pcf_data *adap,
i2c_start(adap);
status = get_pcf(adap, 1);
if (wait_for_pin(adap, &status) >= 0) {
if ((status && I2C_PCF_LRB) == 0) {
if ((status & I2C_PCF_LRB) == 0) {
i2c_stop(adap);
break; /* success! */
}
......@@ -287,25 +292,28 @@ static int pcf_sendbytes(struct i2c_adapter *i2c_adap,const char *buf,
{
struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
int wrcount, status, timeout;
for (wrcount=0; wrcount<count; ++wrcount) {
DEB2(printk("i2c-algo-pcf.o: %s i2c_write: writing %2.2X\n",
i2c_adap->name, buf[wrcount]&0xff));
i2c_adap->name, buf[wrcount]&0xff));
i2c_outb(adap, buf[wrcount]);
timeout = wait_for_pin(adap, &status);
if (timeout) {
printk("i2c-algo-pcf.o: %s i2c_write: error - timeout.\n",
i2c_adap->name);
i2c_stop(adap);
printk("i2c-algo-pcf.o: %s i2c_write: "
"error - timeout.\n", i2c_adap->name);
return -EREMOTEIO; /* got a better one ?? */
}
#ifndef STUB_I2C
if (status & I2C_PCF_LRB) {
printk("i2c-algo-pcf.o: %s i2c_write: error - no ack.\n",
i2c_adap->name);
i2c_stop(adap);
return -EREMOTEIO; /* got a better one ?? */
i2c_stop(adap);
printk("i2c-algo-pcf.o: %s i2c_write: "
"error - no ack.\n", i2c_adap->name);
return -EREMOTEIO; /* got a better one ?? */
}
#endif
}
i2c_stop(adap);
return (wrcount);
}
......@@ -314,34 +322,48 @@ static int pcf_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)
{
int rdcount=0, i, status, timeout, dummy=1;
struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
for (i=0; i<count-1; ++i) {
buf[rdcount] = i2c_inb(adap);
buf[rdcount] = i2c_inb(adap);
if (dummy) {
dummy = 0;
} else
} else {
rdcount++;
}
timeout = wait_for_pin(adap, &status);
if (timeout) {
printk("i2c-algo-pcf.o: i2c_read: i2c_inb timed out.\n");
i2c_stop(adap);
printk("i2c-algo-pcf.o: i2c_read: "
"i2c_inb timed out.\n");
return (-1);
}
#ifndef STUB_I2C
if (status & I2C_PCF_LRB) {
i2c_stop(adap);
printk("i2c-algo-pcf.o: i2c_read: i2c_inb, No ack.\n");
return (-1);
}
#endif
}
set_pcf(adap, 1, I2C_PCF_ESO);
buf[rdcount] = i2c_inb(adap);
if (dummy) {
dummy = 0;
} else
} else {
rdcount++;
}
timeout = wait_for_pin(adap, &status);
if (timeout) {
i2c_stop(adap);
printk("i2c-algo-pcf.o: i2c_read: i2c_inb timed out.\n");
return (-1);
}
i2c_stop(adap);
/* Read final byte from S0 register */
buf[rdcount++] = i2c_inb(adap);
return (rdcount);
}
......@@ -396,45 +418,76 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
{
struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
struct i2c_msg *pmsg;
int i, ret, timeout, status;
int i = 0;
int ret, timeout, status;
pmsg = &msgs[i];
/* Send address here if Read */
if (pmsg->flags & I2C_M_RD) {
ret = pcf_doAddress(adap, pmsg, i2c_adap->retries);
}
/* Check for bus busy */
timeout = wait_for_bb(adap);
if (timeout) {
DEB2(printk("i2c-algo-pcf.o: Timeout waiting for BB in pcf_xfer\n");)
DEB2(printk("i2c-algo-pcf.o: "
"Timeout waiting for BB in pcf_xfer\n");)
return -EIO;
}
/* Send address here if Write */
if (!(pmsg->flags & I2C_M_RD)) {
ret = pcf_doAddress(adap, pmsg, i2c_adap->retries);
}
/* Send START */
i2c_start(adap);
for (i=0; i<num; i++) {
pmsg = &msgs[i];
if (!(pmsg->flags & I2C_M_NOSTART)) {
if (i)
i2c_repstart(adap);
ret = pcf_doAddress(adap, pmsg, i2c_adap->retries);
timeout = wait_for_pin(adap, &status);
if (timeout) {
DEB2(printk("i2c-algo-pcf.o: Timeout waiting for PIN(1) in pcf_xfer\n");)
return (-EREMOTEIO);
}
if (status & I2C_PCF_LRB) {
i2c_stop(adap);
DEB2(printk("i2c-algo-pcf.o: No LRB(1) in pcf_xfer\n");)
return (-EREMOTEIO);
}
}
DEB3(printk("i2c-algo-pcf.o: Msg %d, addr=0x%x, flags=0x%x, len=%d\n",
i, msgs[i].addr, msgs[i].flags, msgs[i].len);)
if (pmsg->flags & I2C_M_RD ) {
/* read bytes into buffer*/
ret = pcf_readbytes(i2c_adap, pmsg->buf, pmsg->len);
/* Wait for PIN (pending interrupt NOT) */
timeout = wait_for_pin(adap, &status);
if (timeout) {
i2c_stop(adap);
DEB2(printk("i2c-algo-pcf.o: Timeout waiting "
"for PIN(1) in pcf_xfer\n");)
return (-EREMOTEIO);
}
#ifndef STUB_I2C
/* Check LRB (last rcvd bit - slave ack) */
if (status & I2C_PCF_LRB) {
i2c_stop(adap);
DEB2(printk("i2c-algo-pcf.o: No LRB(1) in pcf_xfer\n");)
return (-EREMOTEIO);
}
#endif
DEB3(printk("i2c-algo-pcf.o: Msg %d, addr=0x%x, flags=0x%x, len=%d\n",
i, msgs[i].addr, msgs[i].flags, msgs[i].len);)
/* Read */
if (pmsg->flags & I2C_M_RD) {
/* read bytes into buffer*/
ret = pcf_readbytes(i2c_adap, pmsg->buf, pmsg->len);
if (ret != pmsg->len) {
DEB2(printk("i2c-algo-pcf.o: fail: "
"only read %d bytes.\n",ret));
} else {
DEB2(printk("i2c-algo-pcf.o: read %d bytes.\n",ret));
}
} else { /* Write */
/* Write bytes from buffer */
ret = pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len);
if (ret != pmsg->len) {
DEB2(printk("i2c-algo-pcf.o: fail: "
"only wrote %d bytes.\n",ret));
} else {
/* write bytes from buffer */
ret = pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len);
DEB2(printk("i2c-algo-pcf.o: wrote %d bytes.\n",ret));
}
}
i2c_stop(adap);
return (num);
}
......@@ -503,7 +556,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
i2c_outb(pcf_adap, i);
i2c_start(pcf_adap);
if ((wait_for_pin(pcf_adap, &status) >= 0) &&
((status && I2C_PCF_LRB) == 0)) {
((status & I2C_PCF_LRB) == 0)) {
printk("(%02x)",i>>1);
} else {
printk(".");
......@@ -528,7 +581,7 @@ int i2c_pcf_del_bus(struct i2c_adapter *adap)
return 0;
}
int __init i2c_algo_pcf_init (void)
static int __init i2c_algo_pcf_init (void)
{
printk("i2c-algo-pcf.o: i2c pcf8584 algorithm module\n");
return 0;
......
......@@ -20,7 +20,7 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi>.
All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-core.c,v 1.50 2000/02/02 23:29:54 frodo Exp $ */
/* $Id: i2c-core.c,v 1.52 2000/02/27 10:43:29 frodo Exp $ */
#include <linux/module.h>
#include <linux/kernel.h>
......@@ -101,6 +101,12 @@ static struct file_operations i2cproc_operations = {
read: i2cproc_bus_read,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,48))
static struct inode_operations i2cproc_inode_operations = {
&i2cproc_operations
};
#endif
static int i2cproc_initialized = 0;
#else /* undef CONFIG_PROC_FS */
......@@ -159,7 +165,12 @@ int i2c_add_adapter(struct i2c_adapter *adap)
name);
return -ENOENT;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,48))
proc_entry->proc_fops = &i2cproc_operations;
#else
proc_entry->ops = &i2cproc_inode_operations;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27))
proc_entry->owner = THIS_MODULE;
#else
......
......@@ -23,7 +23,9 @@
But I have used so much of his original code and ideas that it seems
only fair to recognize him as co-author -- Frodo */
/* $Id: i2c-dev.c,v 1.25 2000/01/26 14:14:20 frodo Exp $ */
/* The I2C_RDWR ioctl code is written by Kolja Waschk <waschk@telos.de> */
/* $Id: i2c-dev.c,v 1.30 2000/02/28 21:35:05 frodo Exp $ */
#include <linux/kernel.h>
#include <linux/module.h>
......@@ -143,8 +145,8 @@ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
#endif
ret = i2c_master_recv(client,tmp,count);
if (! ret)
ret = copy_to_user(buf,tmp,count)?-EFAULT:0;
if (ret >= 0)
ret = copy_to_user(buf,tmp,count)?-EFAULT:ret;
kfree(tmp);
return ret;
}
......@@ -182,9 +184,11 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
struct i2c_client *client = (struct i2c_client *)file->private_data;
struct i2c_rdwr_ioctl_data rdwr_arg;
struct i2c_smbus_ioctl_data data_arg;
union i2c_smbus_data temp;
int datasize,res;
struct i2c_msg *rdwr_pa;
int i,datasize,res;
unsigned long funcs;
#ifdef DEBUG
......@@ -212,6 +216,67 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
funcs = i2c_get_functionality(client->adapter);
return (copy_to_user((unsigned long *)arg,&funcs,
sizeof(unsigned long)))?-EFAULT:0;
case I2C_RDWR:
copy_from_user_ret(&rdwr_arg,
(struct i2c_rdwr_ioctl_data *)arg,
sizeof(rdwr_arg),
-EFAULT);
rdwr_pa = (struct i2c_msg *)
kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg),
GFP_KERNEL);
if (rdwr_pa == NULL) return -ENOMEM;
res = 0;
for( i=0; i<rdwr_arg.nmsgs; i++ )
{
if(copy_from_user(&(rdwr_pa[i]),
&(rdwr_arg.msgs[i]),
sizeof(rdwr_pa[i])))
{
res = -EFAULT;
break;
}
rdwr_pa[i].buf = kmalloc(rdwr_pa[i].len, GFP_KERNEL);
if(rdwr_pa[i].buf == NULL)
{
res = -ENOMEM;
break;
}
if(copy_from_user(rdwr_pa[i].buf,
rdwr_arg.msgs[i].buf,
rdwr_pa[i].len))
{
kfree(rdwr_pa[i].buf);
res = -EFAULT;
break;
}
}
if (!res)
{
res = i2c_transfer(client->adapter,
rdwr_pa,
rdwr_arg.nmsgs);
}
while(i-- > 0)
{
if( res>=0 && (rdwr_pa[i].flags & I2C_M_RD))
{
if(copy_to_user(
rdwr_arg.msgs[i].buf,
rdwr_pa[i].buf,
rdwr_pa[i].len))
{
res = -EFAULT;
}
}
kfree(rdwr_pa[i].buf);
}
kfree(rdwr_pa);
return res;
case I2C_SMBUS:
copy_from_user_ret(&data_arg,
(struct i2c_smbus_ioctl_data *) arg,
......
......@@ -22,7 +22,7 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-elektor.c,v 1.16 2000/01/24 02:06:33 mds Exp $ */
/* $Id: i2c-elektor.c,v 1.17 2000/03/16 13:07:34 frodo Exp $ */
#include <linux/kernel.h>
#include <linux/ioport.h>
......@@ -73,17 +73,22 @@ static int pcf_pending;
static void pcf_isa_setbyte(void *data, int ctl, int val)
{
if (ctl) {
unsigned long j = jiffies + 10;
if (ctl) {
if (gpi.pi_irq > 0) {
DEB3(printk("i2c-elektor.o: Write control 0x%x\n",
DEB3(printk("i2c-elektor.o: Write Ctrl 0x%02X\n",
val|I2C_PCF_ENI));
DEB3({while (jiffies < j) schedule();})
outb(val | I2C_PCF_ENI, CTRL);
} else {
DEB3(printk("i2c-elektor.o: Write control 0x%x\n", val));
outb(val, CTRL);
DEB3(printk("i2c-elektor.o: Write Ctrl 0x%02X\n", val|I2C_PCF_ENI));
DEB3({while (jiffies < j) schedule();})
outb(val|I2C_PCF_ENI, CTRL);
}
} else {
DEB3(printk("i2c-elektor.o: Write data 0x%x\n", val));
DEB3(printk("i2c-elektor.o: Write Data 0x%02X\n", val&0xff));
DEB3({while (jiffies < j) schedule();})
outb(val, DATA);
}
}
......@@ -94,10 +99,10 @@ static int pcf_isa_getbyte(void *data, int ctl)
if (ctl) {
val = inb(CTRL);
DEB3(printk("i2c-elektor.o: Read control 0x%x\n", val));
DEB3(printk("i2c-elektor.o: Read Ctrl 0x%02X\n", val));
} else {
val = inb(DATA);
DEB3(printk("i2c-elektor.o: Read data 0x%x\n", val));
DEB3(printk("i2c-elektor.o: Read Data 0x%02X\n", val));
}
return (val);
}
......@@ -226,7 +231,7 @@ static struct i2c_adapter pcf_isa_ops = {
pcf_isa_unreg,
};
int __init i2c_pcfisa_init(void)
static int __init i2c_pcfisa_init(void)
{
struct i2c_pcf_isa *pisa = &gpi;
......@@ -277,6 +282,7 @@ MODULE_PARM(base, "i");
MODULE_PARM(irq, "i");
MODULE_PARM(clock, "i");
MODULE_PARM(own, "i");
MODULE_PARM(i2c_debug,"i");
int init_module(void)
{
......@@ -290,5 +296,3 @@ void cleanup_module(void)
}
#endif
......@@ -104,11 +104,11 @@ else
endif
endif
ifeq ($(CONFIG_ATALK),y)
ifeq ($(CONFIG_APPLETALK),y)
SUB_DIRS += appletalk
MOD_IN_SUB_DIRS += appletalk
else
ifeq ($(CONFIG_ATALK),m)
ifeq ($(CONFIG_APPLETALK),m)
MOD_IN_SUB_DIRS += appletalk
endif
endif
......
......@@ -70,10 +70,9 @@ static struct net_device *init_alloc_dev(int sizeof_priv)
{
struct net_device *dev;
int alloc_size;
/* 32-byte alignment */
/* ensure 32-byte alignment of the private area */
alloc_size = sizeof (*dev) + IFNAMSIZ + sizeof_priv + 31;
alloc_size &= ~31;
dev = (struct net_device *) kmalloc (alloc_size, GFP_KERNEL);
if (dev == NULL)
......@@ -85,9 +84,9 @@ static struct net_device *init_alloc_dev(int sizeof_priv)
memset(dev, 0, alloc_size);
if (sizeof_priv)
dev->priv = (void *) (dev + 1);
dev->priv = (void *) (((long)(dev + 1) + 31) & ~31);
dev->name = sizeof_priv + (char *)(dev + 1);
dev->name = sizeof_priv + 31 + (char *)(dev + 1);
return dev;
}
......
......@@ -220,7 +220,7 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
if (ap == 0)
break;
err = -EFAULT;
if (put_user(ppp_channel_index(&ap->chan), (int *) arg))
if (put_user(ppp_unit_number(&ap->chan), (int *) arg))
break;
err = 0;
break;
......
......@@ -1653,13 +1653,13 @@ ppp_register_channel(struct ppp_channel *chan)
}
/*
* Return the index of a channel.
* Return the unit number associated with a channel.
*/
int ppp_channel_index(struct ppp_channel *chan)
int ppp_unit_number(struct ppp_channel *chan)
{
struct channel *pch = chan->ppp;
return pch->file.index;
return pch->ppp->file.index;
}
/*
......@@ -2319,7 +2319,7 @@ module_exit(ppp_cleanup);
EXPORT_SYMBOL(ppp_register_channel);
EXPORT_SYMBOL(ppp_unregister_channel);
EXPORT_SYMBOL(ppp_channel_index);
EXPORT_SYMBOL(ppp_unit_number);
EXPORT_SYMBOL(ppp_input);
EXPORT_SYMBOL(ppp_input_error);
EXPORT_SYMBOL(ppp_output_wakeup);
......
......@@ -420,7 +420,7 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev,
if (via_rhine_chip_info[chip_id].flags & PCI_USES_MASTER)
pci_set_master (pdev);
dev = init_etherdev(NULL, 0);
dev = init_etherdev(NULL, sizeof(*np));
if (dev == NULL) {
printk (KERN_ERR "init_ethernet failed for card #%d\n",
card_idx);
......@@ -466,10 +466,7 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev,
dev->base_addr = ioaddr;
dev->irq = irq;
np = (void *)(((long)kmalloc(sizeof(*np), GFP_KERNEL) + 31) & ~31);
if(np == NULL)
goto err_out_np_failed;
dev->priv = np;
np = dev->priv;
spin_lock_init (&np->lock);
np->chip_id = chip_id;
......@@ -521,7 +518,6 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev,
return 0;
err_out_np_failed:
#ifndef VIA_USE_IO
/* note this is ifdef'd because the ioremap is ifdef'd...
* so additional exit conditions above this must move
......@@ -1177,7 +1173,6 @@ static void __devexit via_rhine_remove_one (struct pci_dev *pdev)
iounmap((char *)(dev->base_addr));
#endif
kfree(dev->priv);
kfree(dev);
}
......
......@@ -709,7 +709,7 @@ include $(TOPDIR)/Rules.make
53c8xx_d.h: 53c7,8xx.scr script_asm.pl
ln -sf 53c7,8xx.scr fake8.c
$(CPP) $(CPPFLAGS) -traditional -DCHIP=810 fake8.c | grep -v '^#' | perl script_asm.pl
$(CPP) $(CPPFLAGS) -traditional -DCHIP=810 fake8.c | grep -v '^#' | $(PERL) script_asm.pl
mv script.h 53c8xx_d.h
mv scriptu.h 53c8xx_u.h
rm fake8.c
......@@ -718,7 +718,7 @@ include $(TOPDIR)/Rules.make
53c7xx_d.h: 53c7xx.scr script_asm.pl
ln -sf 53c7xx.scr fake7.c
$(CPP) $(CPPFLAGS) -traditional -DCHIP=710 fake7.c | grep -v '^#' | perl -s script_asm.pl -ncr7x0_family
$(CPP) $(CPPFLAGS) -traditional -DCHIP=710 fake7.c | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family
mv script.h 53c7xx_d.h
mv scriptu.h 53c7xx_u.h
rm fake7.c
......@@ -729,7 +729,7 @@ include $(TOPDIR)/Rules.make
sim710_d.h: sim710.scr script_asm.pl
ln -sf sim710.scr fake7.c
$(CPP) $(CPPFLAGS) -traditional -DCHIP=710 fake7.c | grep -v '^#' | perl -s script_asm.pl -ncr7x0_family
$(CPP) $(CPPFLAGS) -traditional -DCHIP=710 fake7.c | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family
mv script.h sim710_d.h
mv scriptu.h sim710_u.h
rm fake7.c
......
......@@ -30,6 +30,7 @@
* Christoph Hellwig: Added isapnp support 2000/03/15
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/isapnp.h>
......
......@@ -12,6 +12,8 @@
#include <linux/string.h>
#include <linux/stat.h>
#include <linux/malloc.h>
#include <linux/locks.h>
#include <linux/smp_lock.h>
#include <linux/binfmts.h>
#include <linux/elf.h>
#include <linux/init.h>
......
......@@ -716,6 +716,8 @@ void compute_creds(struct linux_binprm *bprm)
if (current->euid != current->uid || current->egid != current->gid ||
!cap_issubset(new_permitted, current->cap_permitted))
current->dumpable = 0;
current->keep_capabilities = 0;
}
......
......@@ -4,6 +4,7 @@
/* Define to experiment with fitting everything into one 512MB HAE window. */
#define CIA_ONE_HAE_WINDOW 1
#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
......@@ -551,9 +552,9 @@ __EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
# define inb(p) __inb(p)
# define inw(p) __inw(p)
# define inl(p) __inl(p)
# define outb(x,p) __outb((x),(port))
# define outw(x,p) __outw((x),(port))
# define outl(x,p) __outl((x),(port))
# define outb(x,p) __outb((x),(p))
# define outw(x,p) __outw((x),(p))
# define outl(x,p) __outl((x),(p))
# define __raw_readb(a) __readb(a)
# define __raw_readw(a) __readw(a)
# define __raw_readl(a) __readl(a)
......
......@@ -731,7 +731,6 @@ struct file_system_type {
struct file_system_type * next;
};
#ifdef MODULE
#define DECLARE_FSTYPE(var,type,read,flags) \
struct file_system_type var = { \
name: type, \
......@@ -739,14 +738,6 @@ struct file_system_type var = { \
fs_flags: flags, \
owner: THIS_MODULE, \
}
#else
#define DECLARE_FSTYPE(var,type,read,flags) \
struct file_system_type var = { \
name: type, \
read_super: read, \
fs_flags: flags, \
}
#endif
#define DECLARE_FSTYPE_DEV(var,type,read) \
DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV)
......
......@@ -22,10 +22,10 @@
/* With some changes from Kysti Mlkki <kmalkki@cc.hut.fi> and even
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c-algo-pcf.h,v 1.6 1999/12/21 23:45:58 frodo Exp $ */
/* $Id: i2c-algo-pcf.h,v 1.7 2000/02/27 23:02:45 frodo Exp $ */
#ifndef I2C_ALGO_PCF_H
#define I2C_AGLO_PCF_H 1
#define I2C_ALGO_PCF_H 1
/* --- Defines for pcf-adapters --------------------------------------- */
#include <linux/i2c.h>
......
......@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: i2c-dev.h,v 1.6 2000/01/24 21:56:58 frodo Exp $ */
/* $Id: i2c-dev.h,v 1.7 2000/02/15 17:57:27 frodo Exp $ */
#ifndef I2C_DEV_H
#define I2C_DEV_H
......@@ -39,6 +39,12 @@ struct i2c_smbus_ioctl_data {
union i2c_smbus_data *data;
};
/* This is the structure as used in the I2C_RDWR ioctl call */
struct i2c_rdwr_ioctl_data {
struct i2c_msg *msgs; /* pointers to i2c_msgs */
int nmsgs; /* number of i2c_msgs */
};
#ifndef __KERNEL__
#include <sys/ioctl.h>
......
......@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ------------------------------------------------------------------------- */
/* $Id: i2c-id.h,v 1.10 2000/02/04 02:47:41 mds Exp $ */
/* $Id: i2c-id.h,v 1.15 2000/03/16 14:01:57 frodo Exp $ */
#ifndef I2C_ID_H
#define I2C_ID_H
......@@ -92,9 +92,7 @@
#define I2C_ALGO_ATI 0x030000 /* ATI video card */
#define I2C_ALGO_SMBUS 0x040000
#define I2C_ALGO_ISA 0x050000 /* lm_sensors ISA pseudo-adapter */
#define I2C_ALGO_SAA714 0x060000 /* SAA 7146 video decoder bus */
#define I2C_ALGO_SAA7146A 0x060001 /* SAA 7146A - enhanced version */
#define I2C_ALGO_SAA7146 0x060000 /* SAA 7146 video decoder bus */
#define I2C_ALGO_EXP 0x800000 /* experimental */
......@@ -120,6 +118,7 @@
#define I2C_HW_B_HYDRA 0x08 /* Apple Hydra Mac I/O */
#define I2C_HW_B_G400 0x09 /* Matrox G400 */
#define I2C_HW_B_I810 0x0a /* Intel I810 */
#define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */
#define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */
#define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */
......
......@@ -23,7 +23,7 @@
/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
Frodo Looijaard <frodol@dds.nl> */
/* $Id: i2c.h,v 1.36 2000/01/18 23:54:07 frodo Exp $ */
/* $Id: i2c.h,v 1.37 2000/02/15 17:57:27 frodo Exp $ */
#ifndef I2C_H
#define I2C_H
......@@ -441,6 +441,7 @@ union i2c_smbus_data {
#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
#if 0
#define I2C_ACK_TEST 0x0710 /* See if a slave is at a specific adress */
#endif
......@@ -452,7 +453,6 @@ union i2c_smbus_data {
/* written byte (except address) */
#define I2C_MDELAY 0x0706 /* millisec delay between written bytes */
/* ----- I2C-DEV: char device interface stuff ------------------------- */
#define I2C_MAJOR 89 /* Device major number */
......
......@@ -207,15 +207,13 @@ extern struct module __this_module;
#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(THIS_MODULE)
#define MOD_IN_USE __MOD_IN_USE(THIS_MODULE)
#ifndef __NO_VERSION__
#include <linux/version.h>
const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
"kernel_version=" UTS_RELEASE;
#ifdef MODVERSIONS
const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
"using_checksums=1";
#endif
#endif
#else /* MODULE */
......
......@@ -5,8 +5,6 @@
#ifndef __LINUX_FIREWALL_H
#define __LINUX_FIREWALL_H
#include <linux/config.h>
/*
* Definitions for loadable firewall modules
*/
......
......@@ -4,6 +4,7 @@
but required by, the NAT layer; it can also be used by an iptables
extension. */
#include <linux/config.h>
#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
enum ip_conntrack_info
......
......@@ -318,7 +318,6 @@ ipt_get_target(struct ipt_entry *e)
*/
#ifdef __KERNEL__
#include <linux/config.h>
#include <linux/init.h>
extern void ipt_init(void) __init;
......
#ifndef _LISTHELP_H
#define _LISTHELP_H
#include <linux/config.h>
#include <linux/list.h>
#include <linux/netfilter_ipv4/lockhelp.h>
......
......@@ -61,8 +61,8 @@ extern int ppp_register_channel(struct ppp_channel *);
/* Detach a channel from its PPP unit (e.g. on hangup). */
extern void ppp_unregister_channel(struct ppp_channel *);
/* Get the channel number for a channel */
extern int ppp_channel_index(struct ppp_channel *);
/* Get the unit number associated with a channel */
extern int ppp_unit_number(struct ppp_channel *);
/*
* SMP locking notes:
......
......@@ -16,4 +16,8 @@
# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
/* Get/set whether or not to drop capabilities on setuid() away from uid 0 */
#define PR_GET_KEEPCAPS 7
#define PR_SET_KEEPCAPS 8
#endif /* _LINUX_PRCTL_H */
......@@ -326,6 +326,7 @@ struct task_struct {
int ngroups;
gid_t groups[NGROUPS];
kernel_cap_t cap_effective, cap_inheritable, cap_permitted;
int keep_capabilities:1;
struct user_struct *user;
/* limits */
struct rlimit rlim[RLIM_NLIMITS];
......@@ -414,6 +415,7 @@ struct task_struct {
cap_effective: CAP_INIT_EFF_SET, \
cap_inheritable: CAP_INIT_INH_SET, \
cap_permitted: CAP_FULL_SET, \
keep_capabilities: 0, \
rlim: INIT_RLIMITS, \
comm: "swapper", \
thread: INIT_THREAD, \
......
......@@ -20,6 +20,13 @@
* can only be mounted one time.
* 3) Read and write are not implemented (should they?)
* 4) No special nodes are supported
*
* There are the following mount options:
* - nr_blocks (^= shmall) is the number of blocks of size PAGE_SIZE
* we are allowed to allocate
* - nr_inodes (^= shmmni) is the number of files we are allowed to
* allocate
* - mode is the mode for the root directory (default S_IRWXUGO | S_ISVTX)
*/
#include <linux/config.h>
......@@ -46,7 +53,7 @@ static void shm_put_super (struct super_block *);
static int shm_remount_fs (struct super_block *, int *, char *);
static void shm_read_inode (struct inode *);
static void shm_write_inode(struct inode *);
static int shm_statfs (struct super_block *, struct statfs *);
static int shm_statfs (struct super_block *, struct statfs *);
static int shm_create (struct inode *,struct dentry *,int);
static struct dentry *shm_lookup (struct inode *,struct dentry *);
static int shm_unlink (struct inode *,struct dentry *);
......@@ -67,7 +74,6 @@ struct shmid_kernel /* private to the kernel */
unsigned long shm_npages; /* size of segment (pages) */
pte_t **shm_dir; /* ptr to arr of ptrs to frames */
int id;
int destroyed; /* set if the final detach kills */
union permap {
struct shmem {
time_t atime;
......@@ -75,6 +81,7 @@ struct shmid_kernel /* private to the kernel */
time_t ctime;
pid_t cpid;
pid_t lpid;
int unlinked;
int nlen;
char nm[0];
} shmem;
......@@ -92,6 +99,7 @@ struct shmid_kernel /* private to the kernel */
#define shm_lprid permap.shmem.lpid
#define shm_namelen permap.shmem.nlen
#define shm_name permap.shmem.nm
#define shm_unlinked permap.shmem.unlinked
#define zsem permap.zero.sema
#define zero_list permap.zero.list
......@@ -111,7 +119,7 @@ static int newseg (key_t key, const char *name, int namelen, int shmflg, size_t
static void killseg_core(struct shmid_kernel *shp, int doacc);
static void shm_open (struct vm_area_struct *shmd);
static void shm_close (struct vm_area_struct *shmd);
static void shm_remove_name(int id);
static int shm_remove_name(int id);
static struct page * shm_nopage(struct vm_area_struct *, unsigned long, int);
static int shm_swapout(struct page *, struct file *);
#ifdef CONFIG_PROC_FS
......@@ -446,7 +454,7 @@ static int shm_readdir (struct file *filp, void *dirent, filldir_t filldir)
continue;
if (!(shp = shm_get (nr-2)))
continue;
if (shp->shm_perm.mode & SHM_DEST)
if (shp->shm_unlinked)
continue;
if (filldir(dirent, shp->shm_name, shp->shm_namelen, nr, nr) < 0 )
break;;
......@@ -475,7 +483,7 @@ static struct dentry *shm_lookup (struct inode *dir, struct dentry *dent)
continue;
if (!(shp = shm_lock(i)))
continue;
if (!(shp->shm_perm.mode & SHM_DEST) &&
if (!(shp->shm_unlinked) &&
dent->d_name.len == shp->shm_namelen &&
strncmp(dent->d_name.name, shp->shm_name, shp->shm_namelen) == 0)
goto found;
......@@ -513,12 +521,21 @@ static int shm_unlink (struct inode *dir, struct dentry *dent)
down (&shm_ids.sem);
if (!(shp = shm_lock (inode->i_ino)))
BUG();
shp->shm_unlinked = 1;
shp->shm_perm.mode |= SHM_DEST;
shp->shm_perm.key = IPC_PRIVATE; /* Do not find it any more */
shm_unlock (inode->i_ino);
up (&shm_ids.sem);
inode->i_nlink -= 1;
d_delete (dent);
/*
* If it's a reserved name we have to drop the dentry instead
* of creating a negative dentry
*/
if (dent->d_name.len == SHM_FMT_LEN &&
memcmp (SHM_FMT, dent->d_name.name, SHM_FMT_LEN - 8) == 0)
d_drop (dent);
else
d_delete (dent);
return 0;
}
......@@ -644,16 +661,18 @@ static int shm_setattr (struct dentry *dentry, struct iattr *attr)
static inline struct shmid_kernel *newseg_alloc(int numpages, size_t namelen)
{
struct shmid_kernel *shp;
pte_t **dir;
shp = (struct shmid_kernel *) kmalloc (sizeof (*shp) + namelen, GFP_KERNEL);
if (!shp)
return 0;
return ERR_PTR(-ENOMEM);
shp->shm_dir = shm_alloc (numpages);
if (!shp->shm_dir) {
dir = shm_alloc (numpages);
if (IS_ERR(dir)) {
kfree(shp);
return 0;
return ERR_PTR(PTR_ERR(dir));
}
shp->shm_dir = dir;
shp->shm_npages = numpages;
shp->shm_nattch = 0;
shp->shm_namelen = namelen;
......@@ -692,6 +711,7 @@ static int newseg (key_t key, const char *name, int namelen,
shp->shm_atim = shp->shm_dtim = 0;
shp->shm_ctim = CURRENT_TIME;
shp->id = shm_buildid(id,shp->shm_perm.seq);
shp->shm_unlinked = 0;
if (namelen != 0) {
shp->shm_namelen = namelen;
memcpy (shp->shm_name, name, namelen);
......@@ -1030,6 +1050,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
down(&shm_ids.sem);
shp = shm_lock(shmid);
if (shp == NULL) {
up(&shm_ids.sem);
unlock_kernel();
return -EINVAL;
}
......@@ -1038,23 +1059,23 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
if (shp->shm_nattch == 0) {
int id=shp->id;
shm_unlock(shmid);
up(&shm_ids.sem);
/* The kernel lock prevents new attaches from
* being happening. We can't hold shm_lock here
* else we will deadlock in shm_lookup when we
* try to recursively grab it.
*/
shm_remove_name(id);
} else {
/* Do not find me any more */
shp->destroyed = 1;
shp->shm_perm.key = IPC_PRIVATE; /* Do not find it any more */
/* Unlock */
shm_unlock(shmid);
err = shm_remove_name(id);
unlock_kernel();
return err;
}
/* Do not find me any more */
shp->shm_perm.mode |= SHM_DEST;
shp->shm_perm.key = IPC_PRIVATE; /* Do not find it any more */
err = 0;
} else {
shm_unlock(shmid);
}
/* Unlock */
shm_unlock(shmid);
up(&shm_ids.sem);
unlock_kernel();
return err;
......@@ -1155,10 +1176,8 @@ asmlinkage long sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr)
sprintf (name, SHM_FMT, shmid);
lock_kernel();
file = filp_open(name, O_RDWR, 0, dget(shm_sb->s_root));
if (IS_ERR (file)) {
unlock_kernel();
if (IS_ERR (file))
goto bad_file;
}
*raddr = do_mmap (file, addr, file->f_dentry->d_inode->i_size,
(shmflg & SHM_RDONLY ? PROT_READ :
PROT_READ | PROT_WRITE), flags, 0);
......@@ -1171,6 +1190,7 @@ asmlinkage long sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr)
return err;
bad_file:
unlock_kernel();
if ((err = PTR_ERR(file)) == -ENOENT)
return -EINVAL;
return err;
......@@ -1186,13 +1206,11 @@ static void shm_open (struct vm_area_struct *shmd)
* Remove a name. Must be called with lock_kernel
*/
static void shm_remove_name(int id)
static int shm_remove_name(int id)
{
char name[SHM_FMT_LEN+1];
sprintf (name, SHM_FMT, id);
if(do_unlink (name, dget(shm_sb->s_root)))
printk(KERN_ERR "Unlink of SHM object '%s' failed.\n",
name);
return do_unlink (name, dget(shm_sb->s_root));
}
/*
......@@ -1214,9 +1232,9 @@ static void shm_close (struct vm_area_struct *shmd)
shp->shm_lprid = current->pid;
shp->shm_dtim = CURRENT_TIME;
shp->shm_nattch--;
if(shp->shm_nattch == 0 && shp->destroyed) {
if(shp->shm_nattch == 0 && shp->shm_perm.mode & SHM_DEST) {
int pid=shp->id;
shp->destroyed = 0;
int err;
shm_unlock(id);
/* The kernel lock prevents new attaches from
......@@ -1224,7 +1242,10 @@ static void shm_close (struct vm_area_struct *shmd)
* else we will deadlock in shm_lookup when we
* try to recursively grab it.
*/
shm_remove_name(pid);
err = shm_remove_name(pid);
if(err && err != -ENOENT)
printk(KERN_ERR "Unlink of SHM id %d failed (%d).\n", pid, err);
} else {
shm_unlock(id);
}
......@@ -1534,8 +1555,8 @@ static int sysvipc_shm_read_proc(char *buffer, char **start, off_t offset, int l
continue;
shp = shm_lock(i);
if(shp!=NULL) {
#define SMALL_STRING "%10d %10d %4o %10u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu %.*s\n"
#define BIG_STRING "%10d %10d %4o %21u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu %.*s\n"
#define SMALL_STRING "%10d %10d %4o %10u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu %.*s%s\n"
#define BIG_STRING "%10d %10d %4o %21u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu %.*s%s\n"
char *format;
if (sizeof(size_t) <= sizeof(int))
......@@ -1558,7 +1579,8 @@ static int sysvipc_shm_read_proc(char *buffer, char **start, off_t offset, int l
shp->shm_dtim,
shp->shm_ctim,
shp->shm_namelen,
shp->shm_name);
shp->shm_name,
shp->shm_unlinked ? " (deleted)" : "");
shm_unlock(i);
pos += len;
......@@ -1647,8 +1669,8 @@ int map_zero_setup(struct vm_area_struct *vma)
if (!vm_enough_memory((vma->vm_end - vma->vm_start) >> PAGE_SHIFT))
return -ENOMEM;
if (!(shp = newseg_alloc((vma->vm_end - vma->vm_start) / PAGE_SIZE, 0)))
return -ENOMEM;
if (IS_ERR(shp = newseg_alloc((vma->vm_end - vma->vm_start) / PAGE_SIZE, 0)))
return PTR_ERR(shp);
if ((filp = file_setup(vma->vm_file, shp)) == 0) {
killseg_core(shp, 0);
return -ENOMEM;
......
......@@ -336,12 +336,23 @@ asmlinkage long sys_setgid(gid_t gid)
* never happen.
*
* -astor
*
* cevans - New behaviour, Oct '99
* A process may, via prctl(), elect to keep its capabilities when it
* calls setuid() and switches away from uid==0. Both permitted and
* effective sets will be retained.
* Without this change, it was impossible for a daemon to drop only some
* of its privilege. The call to setuid(!=0) would drop all privileges!
* Keeping uid 0 is not an option because uid 0 owns too many vital
* files..
* Thanks to Olaf Kirch and Peter Benie for spotting this.
*/
extern inline void cap_emulate_setxuid(int old_ruid, int old_euid,
int old_suid)
{
if ((old_ruid == 0 || old_euid == 0 || old_suid == 0) &&
(current->uid != 0 && current->euid != 0 && current->suid != 0)) {
(current->uid != 0 && current->euid != 0 && current->suid != 0) &&
!current->keep_capabilities) {
cap_clear(current->cap_permitted);
cap_clear(current->cap_effective);
}
......@@ -1073,6 +1084,17 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
#endif
break;
case PR_GET_KEEPCAPS:
if (current->keep_capabilities)
error = 1;
break;
case PR_SET_KEEPCAPS:
if (arg2 != 0 && arg2 != 1) {
error = -EINVAL;
break;
}
current->keep_capabilities = arg2;
break;
default:
error = -EINVAL;
break;
......
......@@ -93,6 +93,7 @@
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
......
......@@ -10,7 +10,6 @@
#ifdef MODULE
#define EXPORT_SYMTAB
#endif
#include <linux/config.h>
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
......
......@@ -2,7 +2,6 @@
to look as much like the 2.2 infrastructure as possible. */
struct notifier_block;
#include <linux/config.h>
#include <linux/netfilter_ipv4.h>
#include <linux/ip.h>
#include <net/icmp.h>
......
......@@ -7,6 +7,7 @@
FIXME: Timing is overly simplistic. If anyone complains, make it
use conntrack.
*/
#include <linux/config.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
#include <linux/udp.h>
......
/* Everything about the rules for NAT. */
#define __NO_VERSION__
#include <linux/config.h>
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
......@@ -20,7 +19,6 @@
#include <linux/netfilter_ipv4/ip_nat.h>
#include <linux/netfilter_ipv4/ip_nat_core.h>
#include <linux/netfilter_ipv4/ip_nat_rule.h>
#include <linux/netfilter_ipv4/ip_nat_rule.h>
#include <linux/netfilter_ipv4/listhelp.h>
#if 0
......
......@@ -10,7 +10,6 @@
#ifdef MODULE
#define EXPORT_SYMTAB
#endif
#include <linux/config.h>
#include <linux/types.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
......
......@@ -409,7 +409,7 @@ find_inlist_lock_noload(struct list_head *head,
}
#ifndef CONFIG_KMOD
#define find_inlist_lock(h,n,e,p,m) find_inlist_lock_noload((h),(n),(e),(m))
#define find_inlist_lock(h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m))
#else
static void *
find_inlist_lock(struct list_head *head,
......
......@@ -9,7 +9,6 @@
#include <net/udp.h>
#include <net/tcp.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/spinlock.h>
struct in_device;
#include <net/route.h>
......
......@@ -3,7 +3,6 @@
*
* Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/netfilter_ipv4/ip_tables.h>
......
......@@ -3,7 +3,6 @@
*
* Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/netfilter_ipv4/ip_tables.h>
......
......@@ -15,6 +15,7 @@
*/
#define __NO_VERSION__
#include <linux/config.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/types.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment