Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
734e34f1
Commit
734e34f1
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 2.0.21
parent
5fec1cd9
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
794 additions
and
321 deletions
+794
-321
CREDITS
CREDITS
+10
-5
Documentation/cdrom/ide-cd
Documentation/cdrom/ide-cd
+7
-2
Documentation/digiboard.txt
Documentation/digiboard.txt
+1
-1
Makefile
Makefile
+9
-10
Rules.make
Rules.make
+1
-1
arch/i386/kernel/setup.c
arch/i386/kernel/setup.c
+2
-2
drivers/block/ide-cd.c
drivers/block/ide-cd.c
+40
-14
drivers/block/ide_modes.h
drivers/block/ide_modes.h
+2
-0
drivers/block/ll_rw_blk.c
drivers/block/ll_rw_blk.c
+11
-3
drivers/char/mem.c
drivers/char/mem.c
+1
-0
drivers/char/random.c
drivers/char/random.c
+3
-1
drivers/net/3c509.c
drivers/net/3c509.c
+2
-2
drivers/scsi/README.ncr53c8xx
drivers/scsi/README.ncr53c8xx
+88
-88
drivers/scsi/g_NCR5380.h
drivers/scsi/g_NCR5380.h
+2
-0
drivers/scsi/scsi.c
drivers/scsi/scsi.c
+16
-2
drivers/scsi/sd.c
drivers/scsi/sd.c
+1
-1
drivers/scsi/sr.c
drivers/scsi/sr.c
+2
-2
drivers/scsi/wd7000.c
drivers/scsi/wd7000.c
+211
-129
drivers/sound/Readme.cards
drivers/sound/Readme.cards
+1
-1
drivers/sound/dev_table.h
drivers/sound/dev_table.h
+1
-0
fs/binfmt_java.c
fs/binfmt_java.c
+1
-2
fs/buffer.c
fs/buffer.c
+60
-12
fs/ext2/namei.c
fs/ext2/namei.c
+1
-1
fs/locks.c
fs/locks.c
+35
-32
fs/namei.c
fs/namei.c
+1
-1
fs/super.c
fs/super.c
+3
-3
include/asm-i386/semaphore.h
include/asm-i386/semaphore.h
+2
-2
include/linux/cdrom.h
include/linux/cdrom.h
+2
-0
include/linux/fs.h
include/linux/fs.h
+2
-2
include/net/ip_masq.h
include/net/ip_masq.h
+1
-1
scripts/Menuconfig
scripts/Menuconfig
+1
-1
scripts/mkdep.c
scripts/mkdep.c
+274
-0
No files found.
CREDITS
View file @
734e34f1
...
...
@@ -53,7 +53,8 @@ S: University of Calgary
S: Calgary, Alberta, Canada
N: Ralf Baechle
E: ralf@waldorf-gmbh.de
E: ralf@gnu.ai.mit.edu
P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE C8 BA 9C FC 88 DE 32 C3
D: Linux/MIPS port
D: Linux/68k hacker
S: Hauptstrasse 19
...
...
@@ -802,10 +803,10 @@ S: Nepean, Ontario
S: Canada K2H 6S3
N: Warner Losh
E: imp@
boulder.parcplace.com
D:
Provided OI/OB for Linux, general hacker
S:
4909 Pearl East Circle, Suite 200
S:
Boulder, Colorado 803
03
E: imp@
village.org
D:
Linux/MIPS Deskstation support, Provided OI/OB for Linux
S:
8786 Niwot Rd
S:
Niwot, CO 805
03
S: USA
N: H.J. Lu
...
...
@@ -1407,6 +1408,10 @@ S: Germany
N: Jeffrey A. Uphoff
E: juphoff@nrao.edu
E: jeff.uphoff@linux.org
P: 1024/9ED505C5 D7 BB CA AA 10 45 40 1B 16 19 0A C0 38 A0 3E CB
D: Linux Security/Alert mailing lists' moderator/maintainer.
D: NSM (rpc.statd) developer.
D: PAM S/Key module developer.
D: 'dip' contributor.
D: AIPS port, astronomical community support.
S: National Radio Astronomy Observatory
...
...
Documentation/cdrom/ide-cd
View file @
734e34f1
...
...
@@ -182,6 +182,10 @@ NO_DOOR_LOCKING
If this is set, the driver will never attempt to lock the door of
the drive.
CDROM_NBLOCKS_BUFFER
This sets the size of the buffer to be used for a CDROMREADAUDIO
ioctl. The default is 8.
TEST
This presently enables an additional ioctl which enables a user-mode
program to execute an arbitrary packet command. See the source for
...
...
@@ -366,6 +370,7 @@ e. Directory listings are unpredictably truncated, and `dmesg' shows
#include <unistd.h>
#include <stdio.h>
#include <linux/cdrom.h>
#include <linux/ucdrom.h>
int
...
...
@@ -396,10 +401,10 @@ main (int argc, char **argv)
}
/* load */
status = ioctl (fd, CDROM
LOADFROMSLOT
, x_slot);
status = ioctl (fd, CDROM
_SELECT_DISC
, x_slot);
if (status != 0) {
fprintf (stderr,
"%s: CDROM
LOADFROMSLOT
ioctl failed for `%s': %s\n",
"%s: CDROM
_SELECT_DISC
ioctl failed for `%s': %s\n",
program, device, strerror (errno));
exit (1);
}
...
...
Documentation/digiboard.txt
View file @
734e34f1
...
...
@@ -60,7 +60,7 @@ do
for c in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15;
do
name=`expr $boardnum \* 16 + $c`
mknod /dev/cud$name c $DIGI
_CU
MAJOR $name
mknod /dev/cud$name c $DIGI
CU_
MAJOR $name
mknod /dev/ttyD$name c $DIGI_MAJOR $name
done
boardnum=`expr $boardnum + 1`
...
...
Makefile
View file @
734e34f1
VERSION
=
2
PATCHLEVEL
=
0
SUBLEVEL
=
2
0
SUBLEVEL
=
2
1
ARCH
=
i386
...
...
@@ -24,9 +24,10 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
TOPDIR
:=
$(
shell
if
[
"
$$
PWD"
!=
""
]
;
then
echo
$$
PWD
;
else
pwd
;
fi
)
HPATH
=
$(TOPDIR)
/include
FINDHPATH
=
$(HPATH)
/asm
$(HPATH)
/linux
$(HPATH)
/scsi
$(HPATH)
/net
HOSTCC
=
gcc
-I
$(HPATH)
HOSTCFLAGS
=
HOSTCFLAGS
=
-O2
-fomit-frame-pointer
CROSS_COMPILE
=
...
...
@@ -38,7 +39,6 @@ AR =$(CROSS_COMPILE)ar
NM
=
$(CROSS_COMPILE)
nm
STRIP
=
$(CROSS_COMPILE)
strip
MAKE
=
make
AWK
=
gawk
all
:
do-it-all
...
...
@@ -327,7 +327,7 @@ mrproper: clean
rm
-f
.menuconfig .menuconfig.log
rm
-f
include/asm
rm
-f
.depend
`
find
.
-name
.depend
-print
`
rm
-f
.hdepend
rm
-f
.hdepend
scripts/mkdep
rm
-f
$(TOPDIR)
/include/linux/modversions.h
rm
-f
$(TOPDIR)
/include/linux/modules/
*
...
...
@@ -344,8 +344,9 @@ backup: mrproper
sums
:
find
.
-type
f
-print
|
sort
| xargs
sum
>
.SUMS
dep-files
:
archdep .hdepend include/linux/version.h
$(AWK)
-f
scripts/depend.awk init/
*
.c
>
.tmpdepend
dep-files
:
scripts/mkdep archdep include/linux/version.h
scripts/mkdep init/
*
.c
>
.tmpdepend
scripts/mkdep
`
find
$(FINDHPATH)
-follow
-name
\*
.h
!
-name
modversions.h
-print
`
>
.hdepend
set
-e
;
for
i
in
$(SUBDIRS)
;
do
$(MAKE)
-C
$$
i fastdep
;
done
mv
.tmpdepend .depend
...
...
@@ -383,7 +384,5 @@ include Rules.make
# This generates dependencies for the .h files.
#
.hdepend
:
dummy
rm
-f
$@
$(AWK)
-f
scripts/depend.awk
`
find
$(HPATH)
-name
\*
.h
!
-name
modversions.h
-print
`
>
.
$@
mv
.
$@
$@
scripts/mkdep
:
scripts/mkdep.c
$(HOSTCC)
$(HOSTCFLAGS)
-o
scripts/mkdep scripts/mkdep.c
Rules.make
View file @
734e34f1
...
...
@@ -83,7 +83,7 @@ endif
#
fastdep
:
dummy
if
[
-n
"
$(
wildcard
*.[chS]
)
"
]
;
then
\
$(
AWK)
-f
$(TOPDIR)
/scripts/depend.awk
*
.[chS]
>
.depend
;
fi
$(
TOPDIR)
/scripts/mkdep
*
.[chS]
>
.depend
;
fi
ifdef
ALL_SUB_DIRS
set
-e
;
for
i
in
$(ALL_SUB_DIRS)
;
do
$(MAKE)
-C
$$
i fastdep
;
done
endif
...
...
arch/i386/kernel/setup.c
View file @
734e34f1
...
...
@@ -327,8 +327,8 @@ int get_cpuinfo(char * buffer)
}
len
+=
sprintf
(
buffer
+
len
,
"
\n
bogomips
\t
: %lu.%02lu
\n
"
,
CD
(
loops_per_sec
)
/
500000
,
(
CD
(
loops_per_sec
)
/
5000
)
%
100
);
CD
(
loops_per_sec
+
2500
)
/
500000
,
(
CD
(
loops_per_sec
+
2500
)
/
5000
)
%
100
);
#ifdef __SMP__
}
}
...
...
drivers/block/ide-cd.c
View file @
734e34f1
...
...
@@ -106,6 +106,8 @@
* <jeffml@netcom.com>
* 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification
* 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl.
* 3.17 Sep 17, 1996 -- Tweak audio reads for some drives.
* Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC.
*
* NOTE: Direct audio reads will only work on some types of drive.
* So far, i've received reports of success for Sony and Toshiba drives.
...
...
@@ -132,6 +134,7 @@
#include <linux/errno.h>
#include <linux/hdreg.h>
#include <linux/cdrom.h>
#include <linux/ucdrom.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <asm/byteorder.h>
...
...
@@ -168,6 +171,13 @@
#endif
/* Size of buffer to allocate, in blocks, for audio reads. */
#ifndef CDROM_NBLOCKS_BUFFER
#define CDROM_NBLOCKS_BUFFER 8
#endif
/************************************************************************/
#define SECTOR_SIZE 512
...
...
@@ -1918,7 +1928,7 @@ int cdrom_get_toc_entry (ide_drive_t *drive, int track,
static
int
cdrom_read_block
(
ide_drive_t
*
drive
,
int
format
,
int
lba
,
cdrom_read_block
(
ide_drive_t
*
drive
,
int
format
,
int
lba
,
int
nblocks
,
char
*
buf
,
int
buflen
,
struct
atapi_request_sense
*
reqbuf
)
{
...
...
@@ -1944,8 +1954,13 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba,
pc
.
c
[
1
]
=
(
format
<<
2
);
put_unaligned
(
htonl
(
lba
),
(
unsigned
int
*
)
&
pc
.
c
[
2
]);
pc
.
c
[
8
]
=
1
;
/* one block */
pc
.
c
[
9
]
=
0x10
;
pc
.
c
[
8
]
=
(
nblocks
&
0xff
);
pc
.
c
[
7
]
=
((
nblocks
>>
8
)
&
0xff
);
pc
.
c
[
6
]
=
((
nblocks
>>
16
)
&
0xff
);
if
(
format
<=
1
)
pc
.
c
[
9
]
=
0xf0
;
else
pc
.
c
[
9
]
=
0x10
;
stat
=
cdrom_queue_packet_command
(
drive
,
&
pc
);
...
...
@@ -1959,8 +1974,8 @@ cdrom_read_block (ide_drive_t *drive, int format, int lba,
"trying opcode 0xd4
\n
"
,
drive
->
name
);
CDROM_CONFIG_FLAGS
(
drive
)
->
old_readcd
=
1
;
return
cdrom_read_block
(
drive
,
format
,
lba
,
buf
,
buflen
,
reqbuf
);
return
cdrom_read_block
(
drive
,
format
,
lba
,
nblocks
,
buf
,
buflen
,
reqbuf
);
}
#endif
/* not STANDARD_ATAPI */
...
...
@@ -2343,19 +2358,25 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
if
(
lba
<
0
||
lba
>=
toc
->
capacity
)
return
-
EINVAL
;
buf
=
(
char
*
)
kmalloc
(
CD_FRAMESIZE_RAW
,
GFP_KERNEL
);
buf
=
(
char
*
)
kmalloc
(
CDROM_NBLOCKS_BUFFER
*
CD_FRAMESIZE_RAW
,
GFP_KERNEL
);
if
(
buf
==
NULL
)
return
-
ENOMEM
;
while
(
ra
.
nframes
>
0
)
{
stat
=
cdrom_read_block
(
drive
,
1
,
lba
,
buf
,
CD_FRAMESIZE_RAW
,
NULL
);
int
this_nblocks
=
ra
.
nframes
;
if
(
this_nblocks
>
CDROM_NBLOCKS_BUFFER
)
this_nblocks
=
CDROM_NBLOCKS_BUFFER
;
stat
=
cdrom_read_block
(
drive
,
1
,
lba
,
this_nblocks
,
buf
,
this_nblocks
*
CD_FRAMESIZE_RAW
,
NULL
);
if
(
stat
)
break
;
memcpy_tofs
(
ra
.
buf
,
buf
,
CD_FRAMESIZE_RAW
);
ra
.
buf
+=
CD_FRAMESIZE_RAW
;
--
ra
.
nframes
;
++
lba
;
memcpy_tofs
(
ra
.
buf
,
buf
,
this_nblocks
*
CD_FRAMESIZE_RAW
);
ra
.
buf
+=
this_nblocks
*
CD_FRAMESIZE_RAW
;
ra
.
nframes
-=
this_nblocks
;
lba
+=
this_nblocks
;
}
kfree
(
buf
);
...
...
@@ -2399,7 +2420,7 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
if
(
buf
==
NULL
)
return
-
ENOMEM
;
stat
=
cdrom_read_block
(
drive
,
format
,
lba
,
buf
,
blocksize
,
stat
=
cdrom_read_block
(
drive
,
format
,
lba
,
1
,
buf
,
blocksize
,
NULL
);
if
(
stat
==
0
)
memcpy_tofs
((
char
*
)
arg
,
buf
,
blocksize
);
...
...
@@ -2432,7 +2453,12 @@ int ide_cdrom_ioctl (ide_drive_t *drive, struct inode *inode,
return
stat
;
}
case
CDROMLOADFROMSLOT
:
{
case
CDROMLOADFROMSLOT
:
printk
(
"%s: Use CDROM_SELECT_DISC "
" instead of CDROMLOADFROMSLOT.
\n
"
,
drive
->
name
);
/* Fall through. */
case
CDROM_SELECT_DISC
:
{
struct
atapi_request_sense
my_reqbuf
;
int
stat
;
...
...
drivers/block/ide_modes.h
View file @
734e34f1
...
...
@@ -6,6 +6,8 @@
* Copyright (C) 1996 Linus Torvalds, Igor Abramov, and Mark Lord
*/
#include <linux/config.h>
/*
* Shared data/functions for determining best PIO mode for an IDE drive.
* Most of this stuff originally lived in cmd640.c, and changes to the
...
...
drivers/block/ll_rw_blk.c
View file @
734e34f1
...
...
@@ -349,6 +349,10 @@ static void make_request(int major,int rw, struct buffer_head * bh)
}
/* look for a free request. */
/* Loop uses two requests, 1 for loop and 1 for the real device.
* Cut max_req in half to avoid running out and deadlocking. */
if
(
major
==
LOOP_MAJOR
)
max_req
>>=
1
;
/*
* Try to coalesce the new request with old requests
...
...
@@ -508,7 +512,6 @@ void ll_rw_block(int rw, int nr, struct buffer_head * bh[])
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
if
(
bh
[
i
])
{
set_bit
(
BH_Req
,
&
bh
[
i
]
->
b_state
);
make_request
(
MAJOR
(
bh
[
i
]
->
b_rdev
),
rw
,
bh
[
i
]);
}
}
...
...
@@ -528,6 +531,7 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
{
int
i
,
j
;
int
buffersize
;
int
max_req
;
unsigned
long
rsector
;
kdev_t
rdev
;
struct
request
*
req
[
8
];
...
...
@@ -539,10 +543,12 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
" nonexistent block-device
\n
"
);
return
;
}
max_req
=
NR_REQUEST
;
switch
(
rw
)
{
case
READ
:
break
;
case
WRITE
:
max_req
=
(
NR_REQUEST
*
2
)
/
3
;
if
(
is_read_only
(
dev
))
{
printk
(
KERN_NOTICE
"Can't swap to read-only device %s
\n
"
,
...
...
@@ -555,6 +561,8 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
}
buffersize
=
PAGE_SIZE
/
nb
;
if
(
major
==
LOOP_MAJOR
)
max_req
>>=
1
;
for
(
j
=
0
,
i
=
0
;
i
<
nb
;)
{
for
(;
j
<
8
&&
i
<
nb
;
j
++
,
i
++
,
buf
+=
buffersize
)
...
...
@@ -572,10 +580,10 @@ void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buf)
#endif
if
(
j
==
0
)
{
req
[
j
]
=
get_request_wait
(
NR_REQUEST
,
rdev
);
req
[
j
]
=
get_request_wait
(
max_req
,
rdev
);
}
else
{
cli
();
req
[
j
]
=
get_request
(
NR_REQUEST
,
rdev
);
req
[
j
]
=
get_request
(
max_req
,
rdev
);
sti
();
if
(
req
[
j
]
==
NULL
)
break
;
...
...
drivers/char/mem.c
View file @
734e34f1
...
...
@@ -196,6 +196,7 @@ static int mmap_zero(struct inode * inode, struct file * file, struct vm_area_st
static
int
read_full
(
struct
inode
*
node
,
struct
file
*
file
,
char
*
buf
,
int
count
)
{
file
->
f_pos
+=
count
;
return
count
;
}
...
...
drivers/char/random.c
View file @
734e34f1
...
...
@@ -1002,6 +1002,8 @@ static int extract_entropy(struct random_bucket *r, char * buf,
nbytes
-=
i
;
buf
+=
i
;
add_timer_randomness
(
r
,
&
extract_timer_state
,
nbytes
);
if
(
to_user
&&
need_resched
)
schedule
();
}
/* Wipe data from memory */
...
...
@@ -1229,7 +1231,7 @@ random_ioctl(struct inode * inode, struct file * file,
return
-
EINVAL
;
size
=
get_user
(
p
++
);
retval
=
random_write
(
0
,
file
,
(
const
char
*
)
p
,
size
);
if
(
retval
)
if
(
retval
<
0
)
return
retval
;
/*
* Add ent_count to entropy_count, limiting the result to be
...
...
drivers/net/3c509.c
View file @
734e34f1
...
...
@@ -312,7 +312,7 @@ static ushort read_eeprom(short ioaddr, int index)
{
outw
(
EEPROM_READ
+
index
,
ioaddr
+
10
);
/* Pause for at least 162 us. for the read to take place. */
udelay
(
2
00
);
udelay
(
3
00
);
return
inw
(
ioaddr
+
12
);
}
...
...
@@ -326,7 +326,7 @@ static ushort id_read_eeprom(int index)
outb
(
EEPROM_READ
+
index
,
id_port
);
/* Pause for at least 162 us. for the read to take place. */
udelay
(
2
00
);
udelay
(
3
00
);
for
(
bit
=
15
;
bit
>=
0
;
bit
--
)
word
=
(
word
<<
1
)
+
(
inb
(
id_port
)
&
0x01
);
...
...
drivers/scsi/README.ncr53c8xx
View file @
734e34f1
This diff is collapsed.
Click to expand it.
drivers/scsi/g_NCR5380.h
View file @
734e34f1
...
...
@@ -32,6 +32,8 @@
#ifndef GENERIC_NCR5380_H
#define GENERIC_NCR5380_H
#include <linux/config.h>
#define GENERIC_NCR5380_PUBLIC_RELEASE 1
#ifdef NCR53C400
...
...
drivers/scsi/scsi.c
View file @
734e34f1
...
...
@@ -2116,7 +2116,19 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags)
host
->
last_reset
=
jiffies
;
temp
=
host
->
hostt
->
reset
(
SCpnt
,
reset_flags
);
host
->
last_reset
=
jiffies
;
/*
This test allows the driver to introduce an additional bus
settle time delay by setting last_reset up to 20 seconds in
the future. In the normal case where the driver does not
modify last_reset, it must be assumed that the actual bus
reset occurred immediately prior to the return to this code,
and so last_reset must be updated to the current time, so
that the delay in internal_cmnd will guarantee at least a
MIN_RESET_DELAY bus settle time.
*/
if
((
host
->
last_reset
<
jiffies
)
||
(
host
->
last_reset
>
(
jiffies
+
20
*
HZ
)))
host
->
last_reset
=
jiffies
;
}
else
{
...
...
@@ -2125,7 +2137,9 @@ int scsi_reset (Scsi_Cmnd * SCpnt, unsigned int reset_flags)
host
->
last_reset
=
jiffies
;
SCpnt
->
flags
|=
(
WAS_RESET
|
IS_RESETTING
);
temp
=
host
->
hostt
->
reset
(
SCpnt
,
reset_flags
);
host
->
last_reset
=
jiffies
;
if
((
host
->
last_reset
<
jiffies
)
||
(
host
->
last_reset
>
(
jiffies
+
20
*
HZ
)))
host
->
last_reset
=
jiffies
;
if
(
!
host
->
block
)
host
->
host_busy
--
;
}
...
...
drivers/scsi/sd.c
View file @
734e34f1
...
...
@@ -428,7 +428,7 @@ static void rw_intr (Scsi_Cmnd *SCpnt)
SCpnt
->
host
->
host_no
,
(
int
)
SCpnt
->
channel
,
(
int
)
SCpnt
->
target
,
(
int
)
SCpnt
->
lun
);
print_command
(
SCpnt
->
cmnd
);
print_sense
(
"s
r
"
,
SCpnt
);
print_sense
(
"s
d
"
,
SCpnt
);
SCpnt
=
end_scsi_request
(
SCpnt
,
0
,
block_sectors
);
requeue_sd_request
(
SCpnt
);
return
;
...
...
drivers/scsi/sr.c
View file @
734e34f1
...
...
@@ -859,8 +859,8 @@ void requeue_sr_request (Scsi_Cmnd * SCpnt)
if
(
count
+
1
!=
SCpnt
->
use_sg
)
panic
(
"Bad sr request list"
);
break
;
};
if
(((
long
)
sgpnt
[
count
].
address
)
+
sgpnt
[
count
].
length
>
ISA_DMA_THRESHOLD
&&
SCpnt
->
host
->
unchecked_isa_dma
)
{
if
(((
long
)
sgpnt
[
count
].
address
)
+
sgpnt
[
count
].
length
-
1
>
ISA_DMA_THRESHOLD
&&
SCpnt
->
host
->
unchecked_isa_dma
)
{
sgpnt
[
count
].
alt_address
=
sgpnt
[
count
].
address
;
/* We try to avoid exhausting the DMA pool, since it is easier
* to control usage here. In other places we might have a more
...
...
drivers/scsi/wd7000.c
View file @
734e34f1
This diff is collapsed.
Click to expand it.
drivers/sound/Readme.cards
View file @
734e34f1
...
...
@@ -1036,5 +1036,5 @@ www home page of USS/Lite: http://www.4front-tech.com/usslite
European/Finnish mirror: http://personal.eunet.fi/pp/voxware
www home page of commercial
UNIX
Sound System drivers: http://www.4front-tech.com/uss.html
Open
Sound System drivers: http://www.4front-tech.com/uss.html
drivers/sound/dev_table.h
View file @
734e34f1
...
...
@@ -15,6 +15,7 @@
#ifndef _DEV_TABLE_H_
#define _DEV_TABLE_H_
#include <linux/config.h>
/*
* Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
...
...
fs/binfmt_java.c
View file @
734e34f1
...
...
@@ -10,7 +10,6 @@
#include <linux/stat.h>
#include <linux/malloc.h>
#include <linux/binfmts.h>
#include <paths.h>
#define _PATH_JAVA "/usr/bin/java"
#define _PATH_APPLET "/usr/bin/appletviewer"
...
...
@@ -93,7 +92,7 @@ static int do_load_applet(struct linux_binprm *bprm,struct pt_regs *regs)
/*
* OK, we've set the interpreter name
* Splice in (1) the interpreter's name for argv[0] (_PATH_
BSHELL
)
* Splice in (1) the interpreter's name for argv[0] (_PATH_
SH
)
* (2) the name of the appletviewer wrapper for argv[1] (_PATH_APPLET)
* (3) filename of html file (replace argv[0])
*
...
...
fs/buffer.c
View file @
734e34f1
...
...
@@ -69,6 +69,7 @@ int buffers_lav[NR_SIZES] = {0,}; /* Load average of buffer usage */
int
nr_free
[
NR_SIZES
]
=
{
0
,};
int
buffermem
=
0
;
int
nr_buffer_heads
=
0
;
int
refilled
=
0
;
/* Set NZ when a buffer freelist is refilled */
extern
int
*
blksize_size
[];
/* Here is the parameter block for the bdflush process. If you add or
...
...
@@ -493,7 +494,7 @@ struct buffer_head * get_hash_table(kdev_t dev, int block, int size)
bh
->
b_count
++
;
wait_on_buffer
(
bh
);
if
(
bh
->
b_dev
==
dev
&&
bh
->
b_blocknr
==
block
&&
bh
->
b_size
==
size
)
&&
bh
->
b_size
==
size
)
return
bh
;
bh
->
b_count
--
;
}
...
...
@@ -512,7 +513,7 @@ void set_blocksize(kdev_t dev, int size)
switch
(
size
)
{
default:
panic
(
"Invalid blocksize passed to set_blocksize"
);
case
512
:
case
1024
:
case
2048
:
case
4096
:
case
8192
:
;
case
512
:
case
1024
:
case
2048
:
case
4096
:
case
8192
:
;
}
if
(
blksize_size
[
MAJOR
(
dev
)][
MINOR
(
dev
)]
==
0
&&
size
==
BLOCK_SIZE
)
{
...
...
@@ -568,6 +569,7 @@ void refill_freelist(int size)
if
(
nr_free
[
isize
]
>
100
)
return
;
++
refilled
;
/* If there are too many dirty buffers, we wake up the update process
now so as to ensure that there are still clean buffers available
for user processes to use (and dirty) */
...
...
@@ -723,7 +725,7 @@ void refill_freelist(int size)
if
(
nr_free_pages
>
min_free_pages
+
5
)
{
if
(
grow_buffers
(
GFP_BUFFER
,
size
))
{
needed
-=
PAGE_SIZE
;
needed
-=
PAGE_SIZE
;
goto
repeat0
;
};
}
...
...
@@ -810,6 +812,7 @@ void set_writetime(struct buffer_head * buf, int flag)
void
refile_buffer
(
struct
buffer_head
*
buf
)
{
int
dispose
;
int
isize
;
if
(
buf
->
b_dev
==
B_FREE
)
{
printk
(
"Attempt to refile free buffer
\n
"
);
...
...
@@ -835,10 +838,21 @@ void refile_buffer(struct buffer_head * buf)
remove_from_queues
(
buf
);
buf
->
b_list
=
dispose
;
insert_into_queues
(
buf
);
if
(
dispose
==
BUF_DIRTY
&&
nr_buffers_type
[
BUF_DIRTY
]
>
if
(
dispose
==
BUF_DIRTY
)
{
/* This buffer is dirty, maybe we need to start flushing. */
/* If too high a percentage of the buffers are dirty... */
if
(
nr_buffers_type
[
BUF_DIRTY
]
>
(
nr_buffers
-
nr_buffers_type
[
BUF_SHARED
])
*
bdf_prm
.
b_un
.
nfract
/
100
)
wakeup_bdflush
(
0
);
/* If this is a loop device, and
* more than half of the buffers of this size are dirty... */
/* (Prevents no-free-buffers deadlock with loop device.) */
isize
=
BUFSIZE_INDEX
(
buf
->
b_size
);
if
(
MAJOR
(
buf
->
b_dev
)
==
LOOP_MAJOR
&&
nr_buffers_st
[
isize
][
BUF_DIRTY
]
*
2
>
nr_buffers_size
[
isize
])
wakeup_bdflush
(
1
);
}
}
}
...
...
@@ -924,7 +938,7 @@ struct buffer_head * breada(kdev_t dev, int block, int bufsize,
index
=
BUFSIZE_INDEX
(
bh
->
b_size
);
if
(
buffer_uptodate
(
bh
))
return
(
bh
);
return
(
bh
);
else
ll_rw_block
(
READ
,
1
,
&
bh
);
blocks
=
(
filesize
-
pos
)
>>
(
9
+
index
);
...
...
@@ -952,7 +966,7 @@ struct buffer_head * breada(kdev_t dev, int block, int bufsize,
if
(
j
>
1
)
ll_rw_block
(
READA
,
(
j
-
1
),
bhlist
+
1
);
for
(
i
=
1
;
i
<
j
;
i
++
)
brelse
(
bhlist
[
i
]);
brelse
(
bhlist
[
i
]);
/* Wait for this buffer, and then continue on */
bh
=
bhlist
[
0
];
...
...
@@ -1371,7 +1385,7 @@ static int grow_buffers(int pri, int size)
tmp
=
bh
;
while
(
1
)
{
nr_free
[
isize
]
++
;
nr_free
[
isize
]
++
;
if
(
insert_point
)
{
tmp
->
b_next_free
=
insert_point
->
b_next_free
;
tmp
->
b_prev_free
=
insert_point
;
...
...
@@ -1383,6 +1397,7 @@ static int grow_buffers(int pri, int size)
}
insert_point
=
tmp
;
++
nr_buffers
;
++
nr_buffers_size
[
isize
];
if
(
tmp
->
b_this_page
)
tmp
=
tmp
->
b_this_page
;
else
...
...
@@ -1412,7 +1427,7 @@ int try_to_free_buffer(struct buffer_head * bh, struct buffer_head ** bhp,
{
unsigned
long
page
;
struct
buffer_head
*
tmp
,
*
p
;
int
isize
=
BUFSIZE_INDEX
(
bh
->
b_size
);
int
isize
=
BUFSIZE_INDEX
(
bh
->
b_size
);
*
bhp
=
bh
;
page
=
(
unsigned
long
)
bh
->
b_data
;
...
...
@@ -1607,8 +1622,8 @@ static int shrink_specific_buffers(unsigned int priority, int size)
continue
;
}
/* At priority 6, only consider really old
(age==0) buffers for reclaiming. At
priority 0, consider any buffers. */
(age==0) buffers for reclaiming. At
priority 0, consider any buffers. */
if
((
age_of
((
unsigned
long
)
bh
->
b_data
)
>>
(
6
-
priority
))
>
0
)
continue
;
...
...
@@ -1733,7 +1748,7 @@ static int reassign_cluster(kdev_t dev,
unsigned
int
starting_block
,
int
size
)
{
struct
buffer_head
*
bh
;
int
isize
=
BUFSIZE_INDEX
(
size
);
int
isize
=
BUFSIZE_INDEX
(
size
);
int
i
;
/* We want to give ourselves a really good shot at generating
...
...
@@ -1759,7 +1774,7 @@ static int reassign_cluster(kdev_t dev,
static
unsigned
long
try_to_generate_cluster
(
kdev_t
dev
,
int
block
,
int
size
)
{
struct
buffer_head
*
bh
,
*
tmp
,
*
arr
[
MAX_BUF_PER_PAGE
];
int
isize
=
BUFSIZE_INDEX
(
size
);
int
isize
=
BUFSIZE_INDEX
(
size
);
unsigned
long
offset
;
unsigned
long
page
;
int
nblock
;
...
...
@@ -1886,9 +1901,12 @@ void buffer_init(void)
*/
struct
wait_queue
*
bdflush_wait
=
NULL
;
struct
wait_queue
*
bdflush_done
=
NULL
;
struct
task_struct
*
bdflush_tsk
=
0
;
static
void
wakeup_bdflush
(
int
wait
)
{
if
(
current
==
bdflush_tsk
)
return
;
wake_up
(
&
bdflush_wait
);
if
(
wait
)
{
run_task_queue
(
&
tq_disk
);
...
...
@@ -2018,6 +2036,14 @@ asmlinkage int sys_bdflush(int func, long data)
* the syscall above, but now we launch it ourselves internally with
* kernel_thread(...) directly after the first thread in init/main.c */
/* To prevent deadlocks for a loop device:
* 1) Do non-blocking writes to loop (avoids deadlock with running
* out of request blocks).
* 2) But do a blocking write if the only dirty buffers are loop buffers
* (otherwise we go into an infinite busy-loop).
* 3) Quit writing loop blocks if a freelist went low (avoids deadlock
* with running out of free buffers for loop's "real" device).
*/
int
bdflush
(
void
*
unused
)
{
int
i
;
...
...
@@ -2025,6 +2051,8 @@ int bdflush(void * unused)
int
nlist
;
int
ncount
;
struct
buffer_head
*
bh
,
*
next
;
int
major
;
int
wrta_cmd
=
WRITEA
;
/* non-blocking write for LOOP */
/*
* We have a bare-bones task_struct, and really should fill
...
...
@@ -2035,6 +2063,7 @@ int bdflush(void * unused)
current
->
session
=
1
;
current
->
pgrp
=
1
;
sprintf
(
current
->
comm
,
"kflushd"
);
bdflush_tsk
=
current
;
/*
* As a kernel thread we want to tamper with system buffers
...
...
@@ -2060,6 +2089,7 @@ int bdflush(void * unused)
#endif
{
ndirty
=
0
;
refilled
=
0
;
repeat:
bh
=
lru_list
[
nlist
];
if
(
bh
)
...
...
@@ -2082,11 +2112,21 @@ int bdflush(void * unused)
if
(
buffer_locked
(
bh
)
||
!
buffer_dirty
(
bh
))
continue
;
major
=
MAJOR
(
bh
->
b_dev
);
/* Should we write back buffers that are shared or not??
currently dirty buffers are not shared, so it does not matter */
if
(
refilled
&&
major
==
LOOP_MAJOR
)
continue
;
bh
->
b_count
++
;
ndirty
++
;
bh
->
b_flushtime
=
0
;
if
(
major
==
LOOP_MAJOR
)
{
ll_rw_block
(
wrta_cmd
,
1
,
&
bh
);
wrta_cmd
=
WRITEA
;
if
(
buffer_dirty
(
bh
))
--
ndirty
;
}
else
ll_rw_block
(
WRITE
,
1
,
&
bh
);
#ifdef DEBUG
if
(
nlist
!=
BUF_DIRTY
)
ncount
++
;
...
...
@@ -2098,6 +2138,14 @@ int bdflush(void * unused)
if
(
ncount
)
printk
(
"sys_bdflush: %d dirty buffers not on dirty list
\n
"
,
ncount
);
printk
(
"sleeping again.
\n
"
);
#endif
/* If we didn't write anything, but there are still
* dirty buffers, then make the next write to a
* loop device to be a blocking write.
* This lets us block--which we _must_ do! */
if
(
ndirty
==
0
&&
nr_buffers_type
[
BUF_DIRTY
]
>
0
)
{
wrta_cmd
=
WRITE
;
continue
;
}
run_task_queue
(
&
tq_disk
);
wake_up
(
&
bdflush_done
);
...
...
fs/ext2/namei.c
View file @
734e34f1
...
...
@@ -519,7 +519,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode)
inode
->
i_nlink
=
2
;
mark_buffer_dirty
(
dir_block
,
1
);
brelse
(
dir_block
);
inode
->
i_mode
=
S_IFDIR
|
(
mode
&
S_IRWXUGO
&
~
current
->
fs
->
umask
);
inode
->
i_mode
=
S_IFDIR
|
(
mode
&
(
S_IRWXUGO
|
S_ISVTX
)
&
~
current
->
fs
->
umask
);
if
(
dir
->
i_mode
&
S_ISGID
)
inode
->
i_mode
|=
S_ISGID
;
inode
->
i_dirt
=
1
;
...
...
fs/locks.c
View file @
734e34f1
...
...
@@ -128,21 +128,20 @@ static void locks_delete_lock(struct file_lock **fl, unsigned int wait);
static
char
*
lock_get_status
(
struct
file_lock
*
fl
,
char
*
p
,
int
id
,
char
*
pfx
);
static
struct
file_lock
*
file_lock_table
=
NULL
;
static
struct
file_lock
*
unused_file_locks
=
NULL
;
/* Free lock not inserted in any queue */
/*
* Free lock not inserted in any queue
*
* Careful! We can't just "kfree()" it: there may be other processes
* that have yet to remove themselves from the wait queues. Thus the
* internal memory management.
*/
static
inline
void
locks_free_lock
(
struct
file_lock
*
fl
)
{
/*
* CAREFUL! We can't free it until everybody waiting for
* this block have removed themselves from the wait queue
*/
if
(
fl
->
fl_wait
)
{
struct
wait_queue
*
head
=
WAIT_QUEUE_HEAD
(
&
fl
->
fl_wait
);
while
(
fl
->
fl_wait
!=
head
)
schedule
();
}
kfree
(
fl
);
return
;
struct
file_lock
*
next
=
unused_file_locks
;
unused_file_locks
=
fl
;
fl
->
fl_next
=
next
;
}
/* Add lock fl to the blocked list pointed to by block.
...
...
@@ -914,26 +913,30 @@ static int posix_lock_file(struct file *filp, struct file_lock *caller,
static
struct
file_lock
*
locks_alloc_lock
(
struct
file_lock
*
fl
)
{
struct
file_lock
*
tmp
;
/* Okay, let's make a new file_lock structure... */
if
((
tmp
=
(
struct
file_lock
*
)
kmalloc
(
sizeof
(
struct
file_lock
),
GFP_ATOMIC
))
==
NULL
)
return
(
tmp
);
tmp
->
fl_nextlink
=
NULL
;
tmp
->
fl_prevlink
=
NULL
;
tmp
->
fl_next
=
NULL
;
tmp
->
fl_block
=
NULL
;
tmp
->
fl_flags
=
fl
->
fl_flags
;
tmp
->
fl_owner
=
fl
->
fl_owner
;
tmp
->
fl_file
=
fl
->
fl_file
;
tmp
->
fl_wait
=
NULL
;
tmp
->
fl_type
=
fl
->
fl_type
;
tmp
->
fl_start
=
fl
->
fl_start
;
tmp
->
fl_end
=
fl
->
fl_end
;
return
(
tmp
);
struct
file_lock
*
retval
;
retval
=
unused_file_locks
;
if
(
retval
)
{
unused_file_locks
=
retval
->
fl_next
;
goto
init_file_lock
;
}
retval
=
(
struct
file_lock
*
)
kmalloc
(
sizeof
(
struct
file_lock
),
GFP_ATOMIC
);
if
(
retval
)
{
retval
->
fl_wait
=
NULL
;
init_file_lock:
retval
->
fl_next
=
NULL
;
retval
->
fl_nextlink
=
NULL
;
retval
->
fl_prevlink
=
NULL
;
retval
->
fl_block
=
NULL
;
retval
->
fl_owner
=
fl
->
fl_owner
;
retval
->
fl_file
=
fl
->
fl_file
;
retval
->
fl_flags
=
fl
->
fl_flags
;
retval
->
fl_type
=
fl
->
fl_type
;
retval
->
fl_start
=
fl
->
fl_start
;
retval
->
fl_end
=
fl
->
fl_end
;
}
return
retval
;
}
/* Insert file lock fl into an inode's lock list at the position indicated
...
...
fs/namei.c
View file @
734e34f1
...
...
@@ -585,7 +585,7 @@ static int do_mkdir(const char * pathname, int mode)
if
(
dir
->
i_sb
&&
dir
->
i_sb
->
dq_op
)
dir
->
i_sb
->
dq_op
->
initialize
(
dir
,
-
1
);
down
(
&
dir
->
i_sem
);
error
=
dir
->
i_op
->
mkdir
(
dir
,
basename
,
namelen
,
mode
&
0777
&
~
current
->
fs
->
umask
);
error
=
dir
->
i_op
->
mkdir
(
dir
,
basename
,
namelen
,
mode
&
0
1
777
&
~
current
->
fs
->
umask
);
up
(
&
dir
->
i_sem
);
iput
(
dir
);
return
error
;
...
...
fs/super.c
View file @
734e34f1
...
...
@@ -948,7 +948,7 @@ static void do_mount_root(void)
current
->
fs
->
root
=
inode
;
ROOT_DEV
=
sb
->
s_dev
;
printk
(
KERN_NOTICE
"VFS: Mounted root (nfs filesystem).
\n
"
);
vfsmnt
=
add_vfsmnt
(
ROOT_DEV
,
"
rootfs
"
,
"/"
);
vfsmnt
=
add_vfsmnt
(
ROOT_DEV
,
"
/dev/root
"
,
"/"
);
if
(
!
vfsmnt
)
panic
(
"VFS: add_vfsmnt failed for NFS root.
\n
"
);
vfsmnt
->
mnt_sb
=
sb
;
...
...
@@ -1010,7 +1010,7 @@ static void do_mount_root(void)
printk
(
"VFS: Mounted root (%s filesystem)%s.
\n
"
,
fs_type
->
name
,
(
sb
->
s_flags
&
MS_RDONLY
)
?
" readonly"
:
""
);
vfsmnt
=
add_vfsmnt
(
ROOT_DEV
,
"
rootfs
"
,
"/"
);
vfsmnt
=
add_vfsmnt
(
ROOT_DEV
,
"
/dev/root
"
,
"/"
);
if
(
!
vfsmnt
)
panic
(
"VFS: add_vfsmnt failed for root fs"
);
vfsmnt
->
mnt_sb
=
sb
;
...
...
@@ -1075,7 +1075,7 @@ int change_root(kdev_t new_root_dev,const char *put_old)
}
iput
(
old_root
);
/* sb->s_covered */
remove_vfsmnt
(
old_root_dev
);
vfsmnt
=
add_vfsmnt
(
old_root_dev
,
"
old_rootfs
"
,
put_old
);
vfsmnt
=
add_vfsmnt
(
old_root_dev
,
"
/dev/root.old
"
,
put_old
);
if
(
!
vfsmnt
)
printk
(
KERN_CRIT
"Trouble: add_vfsmnt failed
\n
"
);
else
{
vfsmnt
->
mnt_sb
=
old_root
->
i_sb
;
...
...
include/asm-i386/semaphore.h
View file @
734e34f1
...
...
@@ -34,7 +34,7 @@ extern inline void down(struct semaphore * sem)
__asm__
__volatile__
(
"# atomic down operation
\n
"
"1:
\n\t
"
"
leal
1b,%%eax
\n\t
"
"
movl $
1b,%%eax
\n\t
"
#ifdef __SMP__
"lock ; "
#endif
...
...
@@ -55,7 +55,7 @@ extern inline void up(struct semaphore * sem)
{
__asm__
__volatile__
(
"# atomic up operation
\n\t
"
"
leal
1f,%%eax
\n\t
"
"
movl $
1f,%%eax
\n\t
"
#ifdef __SMP__
"lock ; "
#endif
...
...
include/linux/cdrom.h
View file @
734e34f1
...
...
@@ -280,6 +280,8 @@ struct cdrom_multisession
/*
* For controlling a changer. (Used by ATAPI driver.)
* This ioctl is depreciated in favor of CDROM_SELECT_DISC from
* ucdrom.h. It will probably be deleted during the 2.1 kernel series.
*/
#define CDROMLOADFROMSLOT 0x531a
/* LOAD disk from slot*/
...
...
include/linux/fs.h
View file @
734e34f1
...
...
@@ -50,8 +50,8 @@ extern int max_files, nr_files;
#define READ 0
#define WRITE 1
#define READA 2
/* read-ahead
- don't pause
*/
#define WRITEA 3
/*
"write-ahead" - silly, but somewhat useful
*/
#define READA 2
/* read-ahead
- don't block if no resources
*/
#define WRITEA 3
/*
write-ahead - don't block if no resources
*/
#ifndef NULL
#define NULL ((void *) 0)
...
...
include/net/ip_masq.h
View file @
734e34f1
...
...
@@ -14,7 +14,7 @@
* I used an extra 4K port-space
*/
#define PORT_MASQ_BEGIN 6
0
000
#define PORT_MASQ_BEGIN 6
1
000
#define PORT_MASQ_END (PORT_MASQ_BEGIN+4096)
#define MASQUERADE_EXPIRE_TCP 15*60*HZ
...
...
scripts/Menuconfig
View file @
734e34f1
...
...
@@ -546,7 +546,7 @@ function parser(ifile,menu) {
printf("}\n") >>menu
return
}
else if ($0 ~ /^#|$MAKE|mainmenu_name/) {
else if ($0 ~ /^#|
\
$MAKE|mainmenu_name/) {
printf("") >>menu
}
else if ($1 == "source") {
...
...
scripts/mkdep.c
0 → 100644
View file @
734e34f1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
char
*
filename
,
*
command
,
__depname
[
256
]
=
"
\n\t
@touch "
;
int
needsconfig
,
hasconfig
,
hasdep
;
#define depname (__depname+9)
struct
path_struct
{
int
len
;
char
buffer
[
256
-
sizeof
(
int
)];
}
path_array
[
2
]
=
{
{
23
,
"/usr/src/linux/include/"
},
{
0
,
""
}
};
static
void
handle_include
(
int
type
,
char
*
name
,
int
len
)
{
int
plen
;
struct
path_struct
*
path
=
path_array
+
type
;
if
(
len
==
14
&&
!
memcmp
(
name
,
"linux/config.h"
,
len
))
hasconfig
=
1
;
plen
=
path
->
len
;
memcpy
(
path
->
buffer
+
plen
,
name
,
len
);
len
+=
plen
;
path
->
buffer
[
len
]
=
'\0'
;
if
(
access
(
path
->
buffer
,
F_OK
))
return
;
if
(
!
hasdep
)
{
hasdep
=
1
;
printf
(
"%s:"
,
depname
);
}
printf
(
"
\\\n
%s"
,
path
->
buffer
);
}
static
void
handle_config
(
void
)
{
needsconfig
=
1
;
if
(
!
hasconfig
)
fprintf
(
stderr
,
"%s needs config but has not included config file
\n
"
,
filename
);
}
#if defined(__alpha__) || defined(__i386__)
#define LE_MACHINE
#endif
#ifdef LE_MACHINE
#define first_byte(x) current = (unsigned char) x; x >>= 8;
#else
#define first_byte(x) current = x >> 8*(sizeof(unsigned long)-1); x <<= 8;
#endif
#define GETNEXT { \
if (!__buf) { \
__buf = *(unsigned long *) next; \
if (!__buf) \
break; \
} first_byte(__buf); next++; }
#define CASE(c,label) if (current == c) goto label
#define NOTCASE(c,label) if (current != c) goto label
static
void
state_machine
(
char
*
next
)
{
for
(;;)
{
unsigned
long
__buf
=
0
;
unsigned
char
current
;
normal:
GETNEXT
__normal:
CASE
(
'/'
,
slash
);
CASE
(
'"'
,
string
);
CASE
(
'\''
,
char_const
);
CASE
(
'#'
,
preproc
);
goto
normal
;
slash:
GETNEXT
CASE
(
'*'
,
comment
);
goto
__normal
;
string:
GETNEXT
CASE
(
'"'
,
normal
);
NOTCASE
(
'\\'
,
string
);
GETNEXT
goto
string
;
char_const:
GETNEXT
CASE
(
'\''
,
normal
);
NOTCASE
(
'\\'
,
char_const
);
GETNEXT
goto
char_const
;
comment:
GETNEXT
__comment:
NOTCASE
(
'*'
,
comment
);
GETNEXT
CASE
(
'/'
,
normal
);
goto
__comment
;
preproc:
GETNEXT
CASE
(
'\n'
,
normal
);
CASE
(
' '
,
preproc
);
CASE
(
'\t'
,
preproc
);
CASE
(
'i'
,
i_preproc
);
GETNEXT
skippreproc:
CASE
(
'\n'
,
normal
);
CASE
(
'\\'
,
skippreprocslash
);
GETNEXT
goto
skippreproc
;
skippreprocslash:
GETNEXT
;
GETNEXT
;
goto
skippreproc
;
i_preproc:
GETNEXT
CASE
(
'f'
,
if_line
);
NOTCASE
(
'n'
,
skippreproc
);
GETNEXT
NOTCASE
(
'c'
,
skippreproc
);
GETNEXT
NOTCASE
(
'l'
,
skippreproc
);
GETNEXT
NOTCASE
(
'u'
,
skippreproc
);
GETNEXT
NOTCASE
(
'd'
,
skippreproc
);
GETNEXT
NOTCASE
(
'e'
,
skippreproc
);
/* "# include" found */
include_line:
GETNEXT
CASE
(
'\n'
,
normal
);
CASE
(
'<'
,
std_include_file
);
NOTCASE
(
'"'
,
include_line
);
/* "local" include file */
{
char
*
incname
=
next
;
local_include_name:
GETNEXT
CASE
(
'\n'
,
normal
);
NOTCASE
(
'"'
,
local_include_name
);
handle_include
(
1
,
incname
,
next
-
incname
-
1
);
goto
skippreproc
;
}
/* <std> include file */
std_include_file:
{
char
*
incname
=
next
;
std_include_name:
GETNEXT
CASE
(
'\n'
,
normal
);
NOTCASE
(
'>'
,
std_include_name
);
handle_include
(
0
,
incname
,
next
-
incname
-
1
);
goto
skippreproc
;
}
if_line:
if
(
needsconfig
)
goto
skippreproc
;
if_start:
if
(
!
memcmp
(
"CONFIG_"
,
next
,
7
))
{
handle_config
();
goto
skippreproc
;
}
GETNEXT
CASE
(
'\n'
,
normal
);
CASE
(
'_'
,
if_middle
);
if
(
current
>=
'a'
&&
current
<=
'z'
)
goto
if_middle
;
if
(
current
<
'A'
||
current
>
'Z'
)
goto
if_start
;
if_middle:
GETNEXT
CASE
(
'\n'
,
normal
);
CASE
(
'_'
,
if_middle
);
if
(
current
>=
'a'
&&
current
<=
'z'
)
goto
if_middle
;
if
(
current
<
'A'
||
current
>
'Z'
)
goto
if_start
;
goto
if_middle
;
}
}
static
void
do_depend
(
void
)
{
char
*
map
;
int
mapsize
;
int
pagesizem1
=
getpagesize
()
-
1
;
int
fd
=
open
(
filename
,
O_RDONLY
);
struct
stat
st
;
if
(
fd
<
0
)
{
perror
(
"mkdep: open"
);
return
;
}
fstat
(
fd
,
&
st
);
mapsize
=
st
.
st_size
+
2
*
sizeof
(
unsigned
long
);
mapsize
=
(
mapsize
+
pagesizem1
)
&
~
pagesizem1
;
map
=
mmap
(
NULL
,
mapsize
,
PROT_READ
,
MAP_PRIVATE
,
fd
,
0
);
if
(
-
1
==
(
long
)
map
)
{
perror
(
"mkdep: mmap"
);
close
(
fd
);
return
;
}
close
(
fd
);
state_machine
(
map
);
munmap
(
map
,
mapsize
);
if
(
hasdep
)
puts
(
command
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
len
;
char
*
hpath
;
hpath
=
getenv
(
"HPATH"
);
if
(
!
hpath
)
hpath
=
"/usr/src/linux/include"
;
len
=
strlen
(
hpath
);
memcpy
(
path_array
[
0
].
buffer
,
hpath
,
len
);
if
(
len
&&
hpath
[
len
-
1
]
!=
'/'
)
{
path_array
[
0
].
buffer
[
len
]
=
'/'
;
len
++
;
}
path_array
[
0
].
buffer
[
len
]
=
'\0'
;
path_array
[
0
].
len
=
len
;
while
(
--
argc
>
0
)
{
int
len
;
char
*
name
=
*++
argv
;
filename
=
name
;
len
=
strlen
(
name
);
memcpy
(
depname
,
name
,
len
+
1
);
command
=
__depname
;
if
(
len
>
2
&&
name
[
len
-
2
]
==
'.'
)
{
switch
(
name
[
len
-
1
])
{
case
'c'
:
case
'S'
:
depname
[
len
-
1
]
=
'o'
;
command
=
""
;
}
}
needsconfig
=
hasconfig
=
hasdep
=
0
;
do_depend
();
if
(
hasconfig
&&
!
needsconfig
)
fprintf
(
stderr
,
"%s doesn't need config
\n
"
,
filename
);
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment