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:
......
Notes on Linux's SG driver version 2.1.34
Notes on Linux's SG driver version 2.1.36
-----------------------------------------
990606
20000110
Introduction
============
Sg is one of the four "high level" SCSI device drivers along with
sd, st and sr (disk, tape and CDROM respectively). Sg is more generalized
(but lower level) than its siblings and tends to be used on SCSI devices
that don't fit into the already serviced categories. Thus sg is used for
scanners, cd writers and reading audio cds digitally amongst other things.
The SCSI Generic driver (sg) is one of the four "high level" SCSI device
drivers along with sd, st and sr (disk, tape and CDROM respectively). Sg
is more generalized (but lower level) than its siblings and tends to be
used on SCSI devices that don't fit into the already serviced categories.
Thus sg is used for scanners, cd writers and reading audio cds digitally
amongst other things.
These are notes on the Linux SCSI generic packet device driver (sg)
describing version 2.1.34 . The original driver was written by Lawrence
describing version 2.1.36 . The original driver was written by Lawrence
Foard and remained in place with minimal changes since circa 1992.
Version 2 of this driver remains backward compatible (binary and
source **) with the original. It adds scatter gather, command queuing,
......@@ -27,12 +28,12 @@ by Heiko Eissfeldt in a HOWTO called SCSI-Programming-HOWTO. My copy
of the document is version 1.5 dated 7th May 1996. It can found at
ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO-SCSI-Programming-HOWTO .
A copy of this document can be found at:
http://www.torque.net/sg/p/original/HOWTO-SCSI-Programming-HOWTO .
http://www.torque.net/sg/p/original/HOWTO-SCSI-Programming-HOWTO.txt .
** It is possible to write applications that perform differently
depending on whether they are using the original or this version of
the sg device driver. The author is not aware of any useful
pre-existing applications that have problems with version 2 (yet).
the sg device driver. The author is not aware of any useful
pre-existing applications that have problems with version 2.
Architecture
......@@ -52,12 +53,12 @@ Since sg is a character device it supports the traditional Unix
system calls of open(), close(), read(), write() and ioctl(). Two other
related system calls: poll() and fcntl() are added to this list and
how they interact with the sg device driver is documented later.
An SG device is accessed by write()ing SCSI commands plus any associated
An SG device is accessed by write()ing SCSI commands plus any associated
outgoing data to it; the resulting status codes and any incoming data are
then obtained by a read() call. The device can be opened O_NONBLOCK
(non-blocking) and poll() used to monitor its progress. The device may be
opened O_EXCL which excludes other "sg" users from this device (but not
opened O_EXCL which excludes other "sg" users from this device (but not
"sd", "st" or "sr" users). The buffer given to the write() call is made
up as follows:
- struct sg_header image (see below)
......@@ -71,6 +72,12 @@ The buffer received from the corresponding read() call contains:
The given SCSI command has its LUN field overwritten by the LUN value of
the associated sg device that has been open()ed.
SCSI commands are only attempted once (i.e. there are no internal
retries). If appropriate (e.g. a SCSI READ) the data buffer is copied back
to user space irrespective of the values of the various SCSI related
error/status codes. [Some adapters that use an old error interface in
the SCSI mid level ignore the retry count and retry certain errors.]
sg_header
=========
......@@ -96,11 +103,11 @@ The 'pack_len' is bizarre and ends up having the 'reply_len' put in it
input variable, it is not read by sg internally (only written).
The 'reply_len' is the length of the data the corresponding read()
will/should request (including the sg_header).
will/should request (including the sg_header).
The 'pack_id' is not acted upon by the sg device driver but is conveyed
back to the corresponding read() so it can be used for sequencing by an
application.
application.
The 'result' is also bizarre, turning certain types of host codes to 0 (no
error), EBUSY or EIO. With better error reporting now available, the
......@@ -138,7 +145,7 @@ struct sg_header
unsigned int driver_status:8; /* [o] driver status+suggestion */
unsigned int other_flags:10; /* unused */
unsigned char sense_buffer[SG_MAX_SENSE]; /* [o] Output in 3 cases:
when target_status is CHECK_CONDITION or
when target_status is CHECK_CONDITION or
when target_status is COMMAND_TERMINATED or
when (driver_status & DRIVER_SENSE) is true. */
}; /* This structure is 36 bytes long on i386 */
......@@ -164,7 +171,7 @@ The 'target_status' field is always output and is the (masked and shifted
values are (found in <scsi/scsi.h>):
/* N.B. 1 bit offset from usual SCSI status values */
#define GOOD 0x00
#define CHECK_CONDITION 0x01
#define CHECK_CONDITION 0x01
#define CONDITION_GOOD 0x02
#define BUSY 0x04
#define INTERMEDIATE_GOOD 0x08
......@@ -175,7 +182,7 @@ values are (found in <scsi/scsi.h>):
When the 'target_status' is CHECK_CONDITION or COMMAND_TERMINATED the
'sense_buffer' is output. Note that when (driver_status & DRIVER_SENSE)
is true then the 'sense_buffer' is also output (this seems to occur when
the ide-scsi emulation is used). When the 'sense_buffer' is output the
the ide-scsi emulation is used). When the 'sense_buffer' is output the
SCSI Sense Key can be found at (sense_buffer[2] & 0x0f) .
The 'host_status' field is always output and has the following values
......@@ -269,12 +276,12 @@ The reserved buffer will be used if:
Returns a file descriptor if >= 0 , otherwise -1 implies an error.
Error codes (value in 'errno' after -1 returned):
EACCES Either the user doesn't have appropriate permissions on
EACCES Either the user doesn't have appropriate permissions on
'filename' or attempted to use both O_RDONLY and O_EXCL
EBUSY O_NONBLOCK set and some user of this sg device has O_EXCL
set while someone is already using this device
EINTR while waiting for an "exclusive" lock to clear, a signal
is received, just try again ...
is received, just try again ...
ENODEV sg not compiled into kernel or the kernel cannot find the
sg module (or it can't initialize itself (low memory??))
ENOENT given filename not found
......@@ -320,12 +327,13 @@ EAGAIN SCSI mid-level out of command blocks (rare), try again.
This is more likely to happen when queuing commands,
so wait a bit (eg usleep(10000) ) before trying again
EDOM a) command queuing off: a packet is already queued
b) command queuing on: too many packets queued
b) command queuing on: too many packets queued
(SG_MAX_QUEUE exceeded)
c) SCSI command length given in SG_NEXT_CMD_LEN too long
EFAULT 'buffer' for 'count' bytes is an invalid memory range
EIO incoming buffer too short. It should be at least (6 +
sizeof(struct sg_header))==42 bytes long
EIO a) incoming buffer too short. It should be at least
(6 + sizeof(struct sg_header))==42 bytes long
b) SCSI command length given in SG_NEXT_CMD_LEN too long
c) reply_len negative
ENOMEM can't get memory for DMA. Take evasive action ...
ENXIO either scsi sub-system is currently processing some error
(eg doing a device reset) or the sg driver/module removed
......@@ -334,7 +342,7 @@ ENXIO either scsi sub-system is currently processing some error
read(int sg_fd, void * buffer, size_t count)
--------------------------------------------
Read() is used to receive a packet containing 1 mandatory part and 1
Read() is used to receive a packet containing 1 mandatory part and 1
optional part. The mandatory part is:
- a control block (an instance of struct sg_header)
The optional part is:
......@@ -343,7 +351,7 @@ The buffer given to a read() and its corresponding count should be
sufficient to accommodate this packet to avoid truncation. Truncation occurs
if count < sg_header::replylen .
By default, read() will return the oldest packet queued up. If the
By default, read() will return the oldest packet queued up. If the
SG_SET_FORCE_PACK_ID,1 ioctl() is active then read() will attempt to
fetch the packet whose pack_id (given earlier to write()) matches the
sg_header::pack_id given to this read(). If not available it will either
......@@ -356,12 +364,16 @@ same as the count argument. It is not the actual number of bytes
DMA-ed by the SCSI device. This driver is currently unable to provide
such an underrun indication.
If the SCSI device reports an error then a REQUEST SENSE is automatically
done and the output is placed in the sense_buffer array which is in the
control block. This action is sometimes called "auto-sense".
Error codes (value in 'errno' after -1 returned):
EAGAIN either no waiting packet or requested packet is not
available while O_NONBLOCK flag was set
EFAULT 'buffer' for 'count' bytes is an invalid memory range
EINTR while waiting for a packet, a signal is received, just
try again ...
try again ...
EIO if the 'count' given to read() is < sizeof(struct sg_header)
and the 'result' element in sg_header is non-zero. Not a
recommended error reporting technique
......@@ -380,11 +392,11 @@ arrange for an orderly cleanup of those packets that are still "in
flight".
A process that has an open file descriptor to an sg device may be aborted
(eg by a kill signal). In this case, the kernel automatically calls close
(eg by a kill signal). In this case, the kernel automatically calls close
(which is called 'sg_release()' in the version 2 driver) to facilitate
the cleanup mentioned above.
A problem persists in version 2.1.34 if the sg driver is a module and is
A problem persists in version 2.1.36 if the sg driver is a module and is
removed while packets are still "in flight".
Returns 0 if successful, otherwise -1 implies an error.
......@@ -394,7 +406,7 @@ ENXIO sg driver/module removed or corrupted
ioctl(int sg_fd, int command, ...) [sg specific]
-------------------------------------------------
Ken Thompson (or perhaps some other Unix luminary) described ioctl() as
Ken Thompson (or perhaps some other Unix luminary) described ioctl() as
the "garbage bin of Unix". This driver compounds the situation by adding
more ...
If a ioctl command is not recognized by sg (and the various lower levels
......@@ -417,7 +429,8 @@ Assumes 3rd argument points to an int containing the new timeout value
for this file descriptor. The unit is a "jiffy". Packets that are
already "in flight" will not be affected. The default value is set
on open() and is SG_DEFAULT_TIMEOUT (defined in sg.h). This default is
currently 1 minute and may not be long enough for formats.
currently 1 minute and may not be long enough for formats. Negative
values will yield an EIO error.
SG_EMULATED_HOST:
Assumes 3rd argument points to an int and outputs a flag indicating
......@@ -426,33 +439,31 @@ emulated one (eg ide-scsi device driver). A value of 1 means emulated
while 0 is not.
SG_SET_TRANSFORM W:
Third argument is ignored. Only is meaningful when SG_EMULATED host has
yielded 1 (ie the low-level is the ide-scsi device driver); otherwise
an EINVAL error occurs. The default state is to _not_ transform SCSI
commands to the corresponding ATAPI commands but pass them straight
through as is. [Only certain classes of SCSI commands need to be
transformed to their ATAPI equivalents.] Making this ioctl command causes
transforms to occur thereafter. Subsequent calls to this ioctl command
have no additional effect. Beware, this state will affect all devices
(and hence all related sg file descriptors) associated with this ide-scsi
"bus".
The author of ide-scsi has pointed out that this is not the intended
behaviour which is a 3rd argument of 0 to disable transforms and 1 to
enable transforms. Note the 3rd argument is an 'int' not a 'int *'.
Perhaps the intended behaviour will be implemented soon.
Only is meaningful when SG_EMULATED host has yielded 1 (i.e. the low-level
is the ide-scsi device driver); otherwise an EINVAL error occurs. The
default state is to _not_ transform SCSI commands to the corresponding
ATAPI commands but pass them straight through as is. [Only certain classes
of SCSI commands need to be transformed to their ATAPI equivalents.]
The third argument is interpreted as an integer. When it is non-zero then
a flag is set inside the ide-scsi driver that transforms subsequent
commands sent to this driver. When zero is passed as the 3rd argument to
this ioctl then the flag within the ide-scsi driver is cleared and
subsequent commands are not transformed. Beware, this state will affect
all devices (and hence all related sg file descriptors) associated with
this ide-scsi "bus".
SG_GET_TRANSFORM:
Third argument is ignored. Only is meaningful when SG_EMULATED host has
yielded 1 (ie the low-level is the ide-scsi device driver); otherwise
an EINVAL error occurs. Returns 0 to indicate _not_ transforming SCSI
to ATAPI commands (default). Returns 1 when it is transforming.
to ATAPI commands (default). Returns 1 when it is transforming them.
SG_SET_FORCE_LOW_DMA +:
Assumes 3rd argument points to an int containing 0 or 1. 0 (default)
means sg decides whether to use memory above 16 Mbyte level (on i386)
based on the host adapter being used by this SCSI device. Typically
PCI SCSI adapters will indicate they can DMA to the whole 32 bit address
space.
space.
If 1 is given then the host adapter is overridden and only memory below
the 16MB level is used for DMA. A requirement for this should be
extremely rare. If the "reserved" buffer allocated on open() is not in
......@@ -469,15 +480,21 @@ adapters setting has been overridden by SG_SET_FORCE_LOW_DMA,1 .
SG_GET_SCSI_ID +:
Assumes 3rd argument is pointing to an object of type Sg_scsi_id (see
sg.h) and populates it. That structure contains ints for host_no,
channel, scsi_id, lun and scsi_type. Most of this information is
available from other sources (eg SCSI_IOCTL_GET_IDLUN and
SCSI_IOCTL_GET_BUS_NUMBER) but tends to be awkward to collect.
sg.h) and populates it. That structure contains ints for host_no,
channel, scsi_id, lun, scsi_type, allowable commands per lun and
queue_depth. Most of this information is available from other sources
(eg SCSI_IOCTL_GET_IDLUN and SCSI_IOCTL_GET_BUS_NUMBER) but tends to be
awkward to collect.
Allowable commands per lun and queue_depth give an insight to the
command queuing capabilities of the adapters and the device. The latter
overrides the former (logically) and the former is only of interest
if it is equal to queue_depth which probably indicates the device
does not support queueing commands (e.g. most scanners).
SG_SET_FORCE_PACK_ID +:
Assumes 3rd argument is pointing to an int. 0 (default) instructs read()
to return the oldest (written) packet if multiple packets are
waiting to be read (when command queuing is being used).
waiting to be read (when command queuing is being used).
1 instructs read() to view the sg_header::pack_id as input and return the
oldest packet matching that pack_id or wait until it arrives (or yield
EAGAIN if O_NONBLOCK is in force). As a special case the pack_id of -1
......@@ -524,7 +541,7 @@ state and there is one or more _other_ file descriptors using this sg
device then an EBUSY error occurs. Per device sequencing was the original
semantics and allowed, for example different processes to "share" the
device, one perhaps write()ing with the other one read()ing. This command
is supplied if anyone needs those semantics. Per file descriptor
is supplied if anyone needs those semantics. Per file descriptor
sequencing, perhaps with the use of the O_EXCL flag, seems more sensible.
SG_GET_MERGE_FD +:
......@@ -548,7 +565,7 @@ queuing is on.
SG_SET_UNDERRUN_FLAG +:
Assumes 3rd argument is pointing to an int. 0 (current default, set by
SG_DEF_UNDERRUN_FLAG in sg.h) requests underruns be ignored. 1 requests
that underruns be flagged. [The only low level driver that acts on this
that underruns be flagged. [The only low level driver that acts on this
at the moment is the aic7xxx which yields a DID_ERROR error on underrun.]
Only the current file descriptor is affected by this command (unless
"per device" sequencing has been selected).
......@@ -571,7 +588,13 @@ this ioctl().
SG_GET_VERSION_NUM +:
Assumes 3rd argument points to an int. The version number is then placed
in that int. A sg version such as 2.1.34 will yield "20134" from this ioctl.
in that int. A sg version such as 2.1.36 will yield "20136" from this ioctl.
SG_SCSI_RESET +:
Assumes 3rd argument points to an int. Unfortunately doesn't currently
do much (may in the future after other issues are resolved). Yields an
EBUSY error if the SCSI bus or the associated device is being reset
when this ioctl() is called, otherwise returns 0.
SG_SET_DEBUG +:
Assumes 3rd argument is pointing to an int. 0 (default) turns debugging
......@@ -641,13 +664,16 @@ fcntl(sg_fd, F_SETFL, flags | O_ASYNC)
Utility and Test Programs
=========================
See the README file in the sg_utils<date>.tgz tarball. At the time of
writing this was sg_utils990527.tgz .
See the README file in the sg_utils<date>.tgz tarball. Look on the
http://www.torque.net/sg website for the latest version.
Briefly, that tarball contains the following utilities:
sg_dd512 'dd' like program that assumes 512 byte blocks size
sg_dd2048 'dd' like program that assumes 2048 byte blocks size
sg_dd2352 'dd' like program that assumes 2352 byte blocks size
sgq_dd512 like 'sg_dd512' but does command queuing on "if"
sgp_dd probably the most flexible 'dd' variant. It uses POSIX
threads, block size set by "bs=..." plus other options.
sg_scan outputs information (optionally Inquiry) on SCSI devices
sg_rbuf tests SCSI bus transfer speed (without physical IO)
sg_whoami outputs info (optionally capacity) of given SCSI device
......@@ -657,6 +683,9 @@ sginfo outputs "mode" information about SCSI devices (it is a
It also contains the following test programs:
sg_debug outputs sg driver state to console/log file
sg_poll tests asynchronous notification
sg_runt_ex example run time selection program for application authors
sg_simple1 example program first time users
sg_simple2 like sg_simple1 but with more primitive error processing
sg_inquiry does a SCSI Inquiry command (from original HOWTO)
sg_tst_med checks presence of media (from original HOWTO)
......@@ -664,36 +693,40 @@ There are also 2 source files (sg_err.[hc]) for outputting and categorizing
SCSI 2 errors and warnings. This code is used by most of the above
utility and test programs.
The following programs: sg_dd512, sg_dd2048, sg_scan, sg_rbuf, sg_tst_med,
sg_inquiry and sginfo, can be compiled either for this new sg driver _or_
the original sg driver.
The following programs: sg_dd512, sg_dd2048, sg_dd2352, sg_scan, sg_runt_ex,
sg_rbuf, sg_tst_med, sg_inquiry and sginfo, can be compiled either for this
new sg driver _or_ the original sg driver (in 2.0 or 2.2 series kernels).
sg_runt_ex can be run on 2.0, 2.2 or 2.3 series kernels even if it is
compiled on a different series (eg compiled on 2.0, run on 2.2).
Header files
============
User applications need to find the correct "sg.h" header file matching
their kernel in order to write code using the sg device driver. This is
their kernel in order to write code using the sg device driver. This is
sometimes more difficult than it should be. The correct "sg.h" will usually
be found at /usr/src/linux/include/scsi/sg.h . Another important header
be found at /usr/src/linux/include/scsi/sg.h . Another important header
file is "scsi.h" which will be in the same directory.
Several distributions have taken their own copies of these files and placed
them in /usr/include/scsi which is where "#include <scsi/sg.h>" would go
looking. The directory /usr/include/scsi _should_ be a symbolic link to
/usr/src/linux/include/scsi/ . It was is Redhat 5.1 and 5.2 but it is
not is Redhat 6.0 . Some other distributions have the same problem. To
solve this (as root) do the following:
When "#include <scsi/sg.h>" is written in an application then this refers
to the file /usr/include/scsi/sg.h . A problem sometimes arises because
the files in the /usr/include/scsi directory are controlled by the GNU
library people who maintain glibc. Unfortunately these 2 versions of
the sg.h header file are not always in sync. [This was the case in Redhat
6.0 and 6.1 .] Glibc 2.1.3 and later versions should get this right.
# cd /usr/include
# mv scsi scsi_orig
# ln -s ../src/linux/include/scsi scsi
If this is a problem, the user may need to copy sg.h (and scsi.h) from
the kernel source includes to /usr/include scsi. If the user can change
the effected source code then another approach is to rely on the fact that
/usr/src/linux is a symbolic link to /usr/src/linux/include/linux and
change the sg.h include to look like:
#include <linux/../scsi/sg.h>
This solution is used by the author of cdparanoia (Monty) in his application.
This doesn't seem to be a problem with /usr/include/linux (at least in
Redhat where it is a symbolic link) so it is hard to understand why
/usr/include/scsi is defined the way it is. The fact the
/usr/include/linux is a symbolic link opens up the following solution
proposed by the author of cdparanoia (Monty):
#include <linux/../scsi/sg.h>
[Former scsi generic documents suggested adding a symbolic link to
bypass this problem but that is not popular with the glibc maintainers.
I would like to thank Andreas Jaeger <aj@suse.de> for his contributions
on this subject.]
Extra information in scsi-generic_long.txt
......@@ -711,6 +744,27 @@ The longer document contains additional sections on:
- an appendix with some SCSI 2 information in it
References
==========
http://www.t10.org Very important site for SCSI related information.
Contains SCSI 2 and 3 draft standards.
http://www.andante.org/scsi.html
This is Eric Youngdale's site. Eric is primarily
responsible for the Linux SCSI architecture and
its mid-level implementation.
http://www.kernel.dk Jens Axboe's site for Linux cdrom matters including
the SCSI "sr" driver.
http://www.torque.net/sg
My site with sg related information.
newsgroup:linux-scsi@vger.rutgers.edu
Newsgroup for Linux related SCSI matters
/usr/src/linux/MAINTAINERS
This is a file in the Linux kernel source that
contains up to date information about who maintains
what and where information can be found. Links to
SCSI adapter information are also here.
Conclusion
==========
The SCSI generic packet device driver attempts to make as few assumptions
......
......@@ -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