Commit 9636d570 authored by Linus Torvalds's avatar Linus Torvalds

[PATCH] Linux-0.99.12 (August 14, 1993)

CDU31A and MCD CD-ROM drivers.  Ahh, the bad old days of every sound
card manufacturer having their own CD interface.

Much nicer keymaps for keyboards.

Many more network drivers by Donald Becker for the improving NET-2 code.

Eric Youngdale makes executables and libraries use the new mmap()
functionality.  The old special-cased sharing goes away.  Hurray! This
also means that mmap gets a lot more testing.  It also means that NFS
has to be fixed to allow mmaps. Done.

"sys_modify_ldt()" appears, the extended DOS emulators want it.

Still using C++ to compile the kernel.

Original changelog:

 - The memory manager cleanup has continued, and seems to be mostly
   ready, as proven by the ease of adding mmap() over NFS with the new
   routines.  So yes, the pl12 kernel will demand-load your binaries
   over NFS, sharing code and clean data, as well as running shared
   libraries over NFS.  Memory management by Eric and me, while the NFS
   mmap code was written by Jon Tombs,

 - ** IMPORTANT **: The keyboard driver has been enhanced even further,
   and almost everything is completely re-mappable.  This means that
   there is a new version of 'loadkeys' and 'dumpkeys' that you must use
   with this kernel or you'll have problems.  The default keyboard is
   still the US mapping, but if you want to create your own mappings
   you'll have to load them with the new binaries.  Get the 'kbd.tar.gz'
   archive from the same place you get the kernel.

   The new keymappings allow things like function key string changes,
   remapping of the control keys, and freedom to remap any of the normal
   keyboard functions: including special features like rebooting,
   console switching etc.  The keyboard remapping code has been done
   mostly by Risto Kankkunen (Risto.Kankkunen@Helsinki.FI).

 - updated network drivers by Donald Becker

 - updated serial drivers - tytso@Athena.mit.edu

 - updated 387 emulation (Bill Metzenthen).  The updated emulator code
   has more exact trigonometric functions and improved exception
   handling.  It now behaves very much like a real 486, with only small
   changes (greater accuracy, slightly different denormal NaN handling
   etc - hard to detect the differences even if you are looking for
   them).

 - network timer fixes by Florian La Roche (much cleaned up net/inet/timer.c
   and some bad race-conditions fixed).

 - Scsi code updates by Eric Youngdale and others

 - Sony CDU-31A CDROM driver by Corey Minyard added to the standard
   kernel distribution.

 - The Mitsumi CDROM driver is now part of the standard kernel.  Driver
   by Martin Harriss with patches by stud11@cc4.kuleuven.ac.be (yes, he
   probably has a real name, but no, I haven't found it) and Jon Tombs.

 - various other minor patches (preliminary ldt support etc)
parent 9a2aa682
......@@ -3,7 +3,7 @@ all: Version zImage
.EXPORT_ALL_VARIABLES:
BASH = $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
......@@ -96,13 +96,8 @@ KERNELHDRS =/usr/src/linux/include
Version: dummy
rm -f tools/version.h
lilo: $(CONFIGURE) Image
if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
cat Image > /vmlinux
/etc/lilo/install
config:
$(BASH) Configure $(OPTS) < config.in
$(CONFIG_SHELL) Configure $(OPTS) < config.in
mv .config~ .config
$(MAKE) soundconf
......@@ -116,20 +111,13 @@ tools/./version.h: tools/version.h
tools/version.h: $(CONFIGURE) Makefile
@./makever.sh
@echo \#define UTS_RELEASE \"0.99.11\" > tools/version.h
@echo \#define UTS_RELEASE \"0.99.12\" > tools/version.h
@echo \#define UTS_VERSION \"\#`cat .version` `date`\" >> tools/version.h
@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
@echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" >> tools/version.h
Image: $(CONFIGURE) boot/bootsect boot/setup tools/system tools/build
tools/build boot/bootsect boot/setup tools/system $(ROOT_DEV) > Image
sync
disk: Image
dd bs=8192 if=Image of=/dev/fd0
tools/build: $(CONFIGURE) tools/build.c
$(HOSTCC) $(CFLAGS) \
-o tools/build tools/build.c
......@@ -246,3 +234,27 @@ else
dummy:
endif
#
# Leave these dummy entries for now to tell people that they are going away..
#
lilo:
@echo
@echo Uncompressed kernel images no longer supported. Use
@echo \"make zlilo\" instead.
@echo
@exit 1
Image:
@echo
@echo Uncompressed kernel images no longer supported. Use
@echo \"make zImage\" instead.
@echo
@exit 1
disk:
@echo
@echo Uncompressed kernel images no longer supported. Use
@echo \"make zdisk\" instead.
@echo
@exit 1
This diff is collapsed.
......@@ -35,6 +35,20 @@ startup_32:
mov %ax,%fs
mov %ax,%gs
lss _stack_start,%esp
/*
* Clear BSS first so that there are no surprises...
*/
xorl %eax,%eax
movl $__edata,%edi
movl $__end,%ecx
subl %edi,%ecx
cld
rep
stosb
/*
* start system 32-bit setup. We need to re-do some of the things done
* in 16-bit mode for the "real" operations.
*/
call setup_idt
xorl %eax,%eax
1: incl %eax # check that A20 really IS enabled
......@@ -72,16 +86,6 @@ startup_32:
rep
movsb
1:
/*
* Clear BSS
*/
xorl %eax,%eax
movl $__edata,%edi
movl $__end,%ecx
subl %edi,%ecx
cld
rep
stosb
/* check if it is 486 or 386. */
/*
* XXX - this does a lot of unnecessary setup. Alignment checks don't
......@@ -90,6 +94,7 @@ startup_32:
*/
movl %esp,%edi # save stack pointer
andl $0xfffffffc,%esp # align stack to avoid AC fault
movl $3,_x86
pushfl # push EFLAGS
popl %eax # get EFLAGS
movl %eax,%ecx # save original EFLAGS
......@@ -100,28 +105,31 @@ startup_32:
popl %eax # put it in eax
xorl %ecx,%eax # change in flags
andl $0x40000,%eax # check if AC bit changed
jnz 1f # 486
pushl %ecx # restore original EFLAGS
je is386
movl $4,_x86
movl %ecx,%eax
xorl $0x200000,%eax # check ID flag
pushl %eax
popfl # if we are on a 486,
pushfl # we can't change it
popl %eax
xorl %ecx,%eax
andl $0x200000,%eax
je is486
movl $5,_x86 # 586 setup same as 486 at least for now
is486: pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 386
movl %cr0,%eax # 486
andl $0x80000011,%eax # Save PG,PE,ET
orl $2,%eax # set MP
jmp 2f
/*
* NOTE! 486 should set bit 16, to check for write-protect in supervisor
* mode. Then it would be unnecessary with the "verify_area()"-calls.
* 486 users probably want to set the NE (#5) bit also, so as to use
* int 16 for math errors.
* XXX - the above is out of date. We set all the bits, but don't take
* advantage of WP (26 Dec 92).
*/
1: pushl %ecx # restore original EFLAGS
orl $0x50022,%eax # set AM, WP, NE and MP
jmp 2f
is386: pushl %ecx # restore original EFLAGS
popfl
movl %edi,%esp # restore esp
movl %cr0,%eax # 486
movl %cr0,%eax # 386
andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP
orl $2,%eax # set MP
2: movl %eax,%cr0
call check_x87
call setup_paging
......@@ -134,9 +142,11 @@ startup_32:
mov %ax,%fs
mov %ax,%gs
lss _stack_start,%esp
pushl $0 # These are the parameters to main :-)
pushl $0
pushl $0
xorl %eax,%eax
lldt %ax
pushl %eax # These are the parameters to main :-)
pushl %eax
pushl %eax
cld # gcc2 wants the direction flag cleared at all times
call _start_kernel
L6:
......@@ -148,6 +158,7 @@ L6:
*/
check_x87:
movl $0,_hard_math
clts
fninit
fstsw %ax
cmpb $0,%al
......
......@@ -5,7 +5,7 @@
*
* General setup
*
bool 'Kernel math emulation' CONFIG_MATH_EMULATION n
bool 'Kernel math emulation' CONFIG_MATH_EMULATION y
bool 'Normal harddisk support' CONFIG_BLK_DEV_HD y
bool 'XT harddisk support' CONFIG_BLK_DEV_XD n
bool 'TCP/IP networking' CONFIG_INET y
......@@ -18,7 +18,7 @@ bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y
bool 'SCSI support?' CONFIG_SCSI n
if [ "$CONFIG_SCSI" = "n" ]
:
: Skipping SCSI onfiguration options...
: Skipping SCSI configuration options...
:
else
*
......@@ -38,6 +38,32 @@ bool 'UltraStor SCSI support' CONFIG_SCSI_ULTRASTOR n
bool '7000FASST SCSI support' CONFIG_SCSI_7000FASST n
fi
*
* Network device support
*
bool 'Network device support?' CONFIG_ETHERCARDS y
if [ "$CONFIG_ETHERCARDS" = "n" ]
:
: Skipping ethercard configuration options...
:
else
bool 'SLIP (serial line) support' CONFIG_SLIP n
bool 'PLIP (parallel port) support' CONFIG_PLIP n
bool 'NE2000/NE1000 support' CONFIG_NE2000 y
bool 'WD80*3 support' CONFIG_WD80x3 y
#bool '3c501 support' CONFIG_EL1 n
bool '3c503 support' CONFIG_EL2 y
#bool '3c509 support' CONFIG_EL3 n
bool 'HP PCLAN support' CONFIG_HPLAN y
bool 'AT1500 and NE2100 support' CONFIG_AT1500 y
#bool 'DEPCA support' CONFIG_DEPCA n
bool 'D-Link DE600 pocket adaptor support' CONFIG_DE600 y
#bool 'AT-LAN-TEC pocket adaptor support' CONFIG_ATP n
#bool 'EtherExpress support' CONFIG_EEXPRESS n
fi
*
bool 'Sony CDU31A CDROM driver support' CONFIG_CDU31A n
bool 'Mitsumi CDROM driver support' CONFIG_MCD n
*
* Filesystems
*
bool 'Standard (minix) fs support' CONFIG_MINIX_FS y
......@@ -46,12 +72,13 @@ bool 'Second extended fs support' CONFIG_EXT2_FS n
bool 'xiafs filesystem support' CONFIG_XIA_FS n
bool 'msdos fs support' CONFIG_MSDOS_FS y
bool '/proc filesystem support' CONFIG_PROC_FS y
bool 'NFS filesystem support' CONFIG_NFS_FS n
bool 'NFS filesystem support' CONFIG_NFS_FS y
bool 'ISO9660 cdrom filesystem support' CONFIG_ISO9660_FS n
*
* character devices
*
bool 'Keyboard meta-key sends ESC-prefix' CONFIG_KBD_META y
bool 'Keyboard Num Lock on by default' CONFIG_KBD_NUML y
bool 'Logitech busmouse support' CONFIG_BUSMOUSE n
bool 'PS/2 mouse (aka "auxiliary device") support' CONFIG_PSMOUSE n
bool 'Microsoft busmouse support' CONFIG_MS_BUSMOUSE n
......@@ -67,4 +94,6 @@ bool 'Sound card support (distributed separately)' CONFIG_SOUND n
*
bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC n
bool 'Kernel profiling support' CONFIG_PROFILE n
if [ "$CONFIG_SCSI" = "y" ]
bool 'Verbose scsi error reporting (kernel size +=12K)' CONFIG_SCSI_CONSTANTS n
fi
......@@ -44,7 +44,7 @@ int block_write(struct inode * inode, struct file * filp, char * buf, int count)
if (blk_size[MAJOR(dev)])
size = (blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS) >> blocksize_bits;
else
size = 0x7fffffff;
size = INT_MAX;
while (count>0) {
if (block >= size)
return written;
......@@ -106,7 +106,7 @@ int block_read(struct inode * inode, struct file * filp, char * buf, int count)
if (blk_size[MAJOR(dev)])
size = blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS;
else
size = 0x7fffffff;
size = INT_MAX;
if (offset > size)
left = 0;
......
......@@ -6,7 +6,7 @@
/*
* 'buffer.c' implements the buffer-cache functions. Race-conditions have
* been avoided by NEVER letting a interrupt change a buffer (except for the
* been avoided by NEVER letting an interrupt change a buffer (except for the
* data, of course), but instead letting the caller do it.
*/
......@@ -38,6 +38,12 @@ extern int check_scsidisk_media_change(int, int);
extern int revalidate_scsidisk(int, int);
#endif
#endif
#ifdef CONFIG_CDU31A
extern int check_cdu31a_media_change(int, int);
#endif
#ifdef CONFIG_MCD
extern int check_mcd_media_change(int, int);
#endif
static struct buffer_head * hash_table[NR_HASH];
static struct buffer_head * free_list = NULL;
......@@ -233,6 +239,18 @@ void check_disk_change(dev_t dev)
break;
#endif
#if defined(CONFIG_CDU31A)
case 15: /* Sony CDROM */
i = check_cdu31a_media_change(dev, 0);
break;
#endif
#if defined(CONFIG_MCD)
case 23: /* Sony CDROM */
i = check_mcd_media_change(dev, 0);
break;
#endif
default:
return;
};
......@@ -379,13 +397,15 @@ void set_blocksize(dev_t dev, int size)
if (!blksize_size[MAJOR(dev)])
return;
if (size != 512 && size != 1024 && size != 2048 && size != 4096)
panic("Invalid blocksize passed to set_blocksize");
switch(size) {
default: panic("Invalid blocksize passed to set_blocksize");
case 512: case 1024: case 2048: case 4096:;
}
if (blksize_size[MAJOR(dev)][MINOR(dev)] == 0 && size == BLOCK_SIZE) {
blksize_size[MAJOR(dev)][MINOR(dev)] = size;
return;
};
}
if (blksize_size[MAJOR(dev)][MINOR(dev)] == size)
return;
sync_buffers(dev, 2);
......@@ -437,7 +457,7 @@ struct buffer_head * getblk(dev_t dev, int block, int size)
grow_size -= size;
if (nr_free_pages > min_free_pages && grow_size <= 0) {
grow_buffers(size);
grow_size = 4096;
grow_size = PAGE_SIZE;
}
buffers = nr_buffers;
bh = NULL;
......@@ -588,19 +608,18 @@ static void put_unused_buffer_head(struct buffer_head * bh)
static void get_more_buffer_heads(void)
{
unsigned long page;
int i;
struct buffer_head * bh;
if (unused_list)
return;
page = get_free_page(GFP_BUFFER);
if (!page)
if(! (bh = (struct buffer_head*) get_free_page(GFP_BUFFER)))
return;
bh = (struct buffer_head *) page;
while ((unsigned long) (bh+1) <= page+4096) {
put_unused_buffer_head(bh);
bh++;
nr_buffer_heads++;
for (nr_buffer_heads+=i=PAGE_SIZE/sizeof*bh ; i>0; i--) {
bh->b_next_free = unused_list; /* only make link */
unused_list = bh++;
}
}
......@@ -632,8 +651,8 @@ static struct buffer_head * create_buffers(unsigned long page, unsigned long siz
unsigned long offset;
head = NULL;
offset = 4096;
while ((offset -= size) < 4096) {
offset = PAGE_SIZE;
while ((offset -= size) < PAGE_SIZE) {
bh = get_unused_buffer_head();
if (!bh)
goto no_grow;
......@@ -685,14 +704,14 @@ static unsigned long check_aligned(struct buffer_head * first, unsigned long add
int nrbuf;
page = (unsigned long) first->b_data;
if (page & 0xfff) {
if (page & ~PAGE_MASK) {
brelse(first);
return 0;
}
mem_map[MAP_NR(page)]++;
bh[0] = first;
nrbuf = 1;
for (offset = size ; offset < 4096 ; offset += size) {
for (offset = size ; offset < PAGE_SIZE ; offset += size) {
block = *++b;
if (!block)
goto no_go;
......@@ -728,7 +747,7 @@ static unsigned long try_to_load_aligned(unsigned long address,
if (!bh)
return 0;
p = b;
for (offset = 0 ; offset < 4096 ; offset += size) {
for (offset = 0 ; offset < PAGE_SIZE ; offset += size) {
block = *(p++);
if (!block)
goto not_aligned;
......@@ -755,7 +774,7 @@ static unsigned long try_to_load_aligned(unsigned long address,
else
break;
}
buffermem += 4096;
buffermem += PAGE_SIZE;
bh->b_this_page = tmp;
mem_map[MAP_NR(address)]++;
read_buffers(arr,block);
......@@ -847,12 +866,11 @@ void grow_buffers(int size)
unsigned long page;
struct buffer_head *bh, *tmp;
if ((size & 511) || (size > 4096)) {
if ((size & 511) || (size > PAGE_SIZE)) {
printk("VFS: grow_buffers: size = %d\n",size);
return;
}
page = get_free_page(GFP_BUFFER);
if (!page)
if(!(page = __get_free_page(GFP_BUFFER)))
return;
bh = create_buffers(page, size);
if (!bh) {
......@@ -878,7 +896,7 @@ void grow_buffers(int size)
break;
}
tmp->b_this_page = bh;
buffermem += 4096;
buffermem += PAGE_SIZE;
return;
}
......@@ -893,7 +911,7 @@ static int try_to_free(struct buffer_head * bh, struct buffer_head ** bhp)
*bhp = bh;
page = (unsigned long) bh->b_data;
page &= 0xfffff000;
page &= PAGE_MASK;
tmp = bh;
do {
if (!tmp)
......@@ -912,7 +930,7 @@ static int try_to_free(struct buffer_head * bh, struct buffer_head ** bhp)
remove_from_queues(p);
put_unused_buffer_head(p);
} while (tmp != bh);
buffermem -= 4096;
buffermem -= PAGE_SIZE;
free_page(page);
return !mem_map[MAP_NR(page)];
}
......
This diff is collapsed.
......@@ -12,6 +12,7 @@
#include <linux/sched.h>
#include <linux/ext2_fs.h>
#include <linux/errno.h>
#include <linux/stat.h>
/*
* ext2_permission ()
......@@ -30,7 +31,7 @@ int ext2_permission (struct inode * inode, int mask)
mode >>= 6;
else if (in_group_p (inode->i_gid))
mode >>= 3;
if (((mode & mask & 0007) == mask))
if (((mode & mask & S_IRWXO) == mask))
return 1;
else
return 0;
......
......@@ -35,7 +35,7 @@
"rep\n\t" \
"stosl" \
: \
:"a" (0), "c" (size/4), "D" ((long) (addr)) \
:"a" (0), "c" (size / 4), "D" ((long) (addr)) \
:"cx", "di")
static inline int find_first_zero_bit (unsigned long * addr, unsigned size)
......@@ -58,7 +58,7 @@ static inline int find_first_zero_bit (unsigned long * addr, unsigned size)
shll $3,%%edi
addl %%edi,%%edx"
:"=d" (res)
:"c" ((size+31)>>5), "D" (addr), "b" (addr)
:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
:"ax", "bx", "cx", "di");
return res;
}
......@@ -239,13 +239,12 @@ void ext2_free_block (struct super_block * sb, unsigned long block)
return;
}
lock_super (sb);
if (block < sb->u.ext2_sb.s_first_data_block ||
block >= sb->u.ext2_sb.s_blocks_count) {
es = sb->u.ext2_sb.s_es;
if (block < es->s_first_data_block || block >= es->s_blocks_count) {
printk ("ext2_free_block: block not in datazone\n");
unlock_super (sb);
return;
}
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
#ifdef EXT2FS_DEBUG
printk ("ext2_free_block: freeing block %d\n", block);
#endif
......@@ -253,10 +252,9 @@ void ext2_free_block (struct super_block * sb, unsigned long block)
if (bh)
bh->b_dirt = 0;
brelse (bh);
block_group = (block - sb->u.ext2_sb.s_first_data_block) /
block_group = (block - es->s_first_data_block) /
EXT2_BLOCKS_PER_GROUP(sb);
bit = (block - sb->u.ext2_sb.s_first_data_block) %
EXT2_BLOCKS_PER_GROUP(sb);
bit = (block - es->s_first_data_block) % EXT2_BLOCKS_PER_GROUP(sb);
bitmap_nr = load_block_bitmap (sb, block_group);
bh = sb->u.ext2_sb.s_block_bitmap[bitmap_nr];
if (!bh) {
......@@ -275,11 +273,11 @@ void ext2_free_block (struct super_block * sb, unsigned long block)
panic ("ext2_free_block: Group descriptor not loaded");
}
gdp = (struct ext2_group_desc *) bh2->b_data;
gdp[desc].bg_free_blocks_count ++;
gdp[desc].bg_free_blocks_count++;
bh2->b_dirt = 1;
}
bh->b_dirt = 1;
es->s_free_blocks_count ++;
es->s_free_blocks_count++;
sb->u.ext2_sb.s_sbh->b_dirt = 1;
sb->s_dirt = 1;
unlock_super (sb);
......@@ -313,7 +311,7 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
return 0;
}
lock_super (sb);
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
es = sb->u.ext2_sb.s_es;
if (es->s_free_blocks_count <= es->s_r_blocks_count && !suser()) {
unlock_super (sb);
return 0;
......@@ -325,8 +323,7 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
repeat:
/* First, test whether the goal block is free. */
i = ((goal - sb->u.ext2_sb.s_first_data_block) /
EXT2_BLOCKS_PER_GROUP(sb));
i = ((goal - es->s_first_data_block) / EXT2_BLOCKS_PER_GROUP(sb));
group_desc = i / EXT2_DESC_PER_BLOCK(sb);
desc = i % EXT2_DESC_PER_BLOCK(sb);
gdp = (struct ext2_group_desc *)
......@@ -335,7 +332,7 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
panic ("ext2_new_block: Descriptor not loaded");
}
if (gdp[desc].bg_free_blocks_count > 0) {
j = ((goal - sb->u.ext2_sb.s_first_data_block) %
j = ((goal - es->s_first_data_block) %
EXT2_BLOCKS_PER_GROUP(sb));
#ifdef EXT2FS_DEBUG
if (j)
......@@ -475,8 +472,8 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
#ifdef EXT2FS_DEBUG
printk ("ext2_new_block: found bit %d\n", j);
#endif
j += i * EXT2_BLOCKS_PER_GROUP(sb) + sb->u.ext2_sb.s_first_data_block;
if (j >= sb->u.ext2_sb.s_blocks_count) {
j += i * EXT2_BLOCKS_PER_GROUP(sb) + es->s_first_data_block;
if (j >= es->s_blocks_count) {
printk ("block_group = %d,block=%d\n", i, j);
printk ("ext2_new_block: block >= blocks count");
unlock_super (sb);
......@@ -495,9 +492,9 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
printk("ext2_new_block: allocating block %d. "
"Goal hits %d of %d.\n", j, goal_hits, goal_attempts);
#endif
gdp[desc].bg_free_blocks_count --;
gdp[desc].bg_free_blocks_count--;
sb->u.ext2_sb.s_group_desc[group_desc]->b_dirt = 1;
es->s_free_blocks_count --;
es->s_free_blocks_count--;
sb->u.ext2_sb.s_sbh->b_dirt = 1;
sb->s_dirt = 1;
unlock_super (sb);
......@@ -506,8 +503,8 @@ int ext2_new_block (struct super_block * sb, unsigned long goal)
unsigned long ext2_count_free_blocks (struct super_block *sb)
{
struct ext2_super_block * es;
#ifdef EXT2FS_DEBUG
struct ext2_super_block * es;
unsigned long desc_count, bitmap_count, x;
unsigned long group_desc;
unsigned long desc;
......@@ -516,7 +513,7 @@ unsigned long ext2_count_free_blocks (struct super_block *sb)
int i;
lock_super (sb);
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
es = sb->u.ext2_sb.s_es;
desc_count = 0;
bitmap_count = 0;
group_desc = 0;
......@@ -545,9 +542,9 @@ unsigned long ext2_count_free_blocks (struct super_block *sb)
printk ("group %d: stored = %d, counted = %d\n",
i, gdp[desc].bg_free_blocks_count, x);
bitmap_count += x;
desc ++;
desc++;
if (desc == EXT2_DESC_PER_BLOCK(sb)) {
group_desc ++;
group_desc++;
desc = 0;
gdp = NULL;
}
......@@ -557,7 +554,6 @@ unsigned long ext2_count_free_blocks (struct super_block *sb)
unlock_super (sb);
return bitmap_count;
#else
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
return es->s_free_blocks_count;
return sb->u.ext2_sb.s_es->s_free_blocks_count;
#endif
}
......@@ -25,15 +25,15 @@ struct dir_cache_entry {
unsigned long ino;
char name[EXT2_NAME_LEN];
int len;
struct dir_cache_entry *queue_prev;
struct dir_cache_entry *queue_next;
struct dir_cache_entry *prev;
struct dir_cache_entry *next;
struct dir_cache_entry * queue_prev;
struct dir_cache_entry * queue_next;
struct dir_cache_entry * prev;
struct dir_cache_entry * next;
};
static struct dir_cache_entry *first = NULL;
static struct dir_cache_entry *last = NULL;
static struct dir_cache_entry *first_free = NULL;
static struct dir_cache_entry * first = NULL;
static struct dir_cache_entry * last = NULL;
static struct dir_cache_entry * first_free = NULL;
static int cache_initialized = 0;
#ifdef EXT2FS_DEBUG_CACHE
static int hits = 0;
......@@ -46,8 +46,8 @@ static struct dir_cache_entry dcache[CACHE_SIZE];
#define HASH_QUEUES 16
static struct dir_cache_entry *queue_head[HASH_QUEUES];
static struct dir_cache_entry *queue_tail[HASH_QUEUES];
static struct dir_cache_entry * queue_head[HASH_QUEUES];
static struct dir_cache_entry * queue_tail[HASH_QUEUES];
#define hash(dev,dir) ((dev ^ dir) % HASH_QUEUES)
......@@ -78,14 +78,15 @@ static void init_cache (void)
/*
* Find a name in the cache
*/
static struct dir_cache_entry *find_name (int queue, unsigned short dev,
unsigned long dir, const char *name,
int len)
static struct dir_cache_entry * find_name (int queue, unsigned short dev,
unsigned long dir,
const char * name, int len)
{
struct dir_cache_entry *p;
struct dir_cache_entry * p;
for (p = queue_head[queue]; p!= NULL && (p->dev != dev ||
p->dir != dir || p->len != len || strncmp (name, p->name, p->len));
for (p = queue_head[queue]; p != NULL && (p->dev != dev ||
p->dir != dir || p->len != len ||
strncmp (name, p->name, p->len) != 0);
p = p->queue_next)
;
return p;
......@@ -95,9 +96,9 @@ static struct dir_cache_entry *find_name (int queue, unsigned short dev,
/*
* List the cache entries for debugging
*/
static void show_cache (const char *func_name)
static void show_cache (const char * func_name)
{
struct dir_cache_entry *p;
struct dir_cache_entry * p;
printk ("%s: cache status\n", func_name);
for (p = first; p != NULL; p = p->next)
......@@ -109,7 +110,7 @@ static void show_cache (const char *func_name)
/*
* Add an entry at the beginning of the cache
*/
static void add_to_cache (struct dir_cache_entry *p)
static void add_to_cache (struct dir_cache_entry * p)
{
p->prev = NULL;
p->next = first;
......@@ -123,7 +124,7 @@ static void add_to_cache (struct dir_cache_entry *p)
/*
* Add an entry at the beginning of a queue
*/
static void add_to_queue (int queue, struct dir_cache_entry *p)
static void add_to_queue (int queue, struct dir_cache_entry * p)
{
p->queue_prev = NULL;
p->queue_next = queue_head[queue];
......@@ -137,7 +138,7 @@ static void add_to_queue (int queue, struct dir_cache_entry *p)
/*
* Remove an entry from the cache
*/
static void remove_from_cache (struct dir_cache_entry *p)
static void remove_from_cache (struct dir_cache_entry * p)
{
if (p->prev)
p->prev->next = p->next;
......@@ -152,7 +153,7 @@ static void remove_from_cache (struct dir_cache_entry *p)
/*
* Remove an entry from a queue
*/
static void remove_from_queue (int queue, struct dir_cache_entry *p)
static void remove_from_queue (int queue, struct dir_cache_entry * p)
{
if (p->queue_prev)
p->queue_prev->queue_next = p->queue_next;
......@@ -170,8 +171,8 @@ static void remove_from_queue (int queue, struct dir_cache_entry *p)
*/
void ext2_dcache_invalidate (unsigned short dev)
{
struct dir_cache_entry *p;
struct dir_cache_entry *p2;
struct dir_cache_entry * p;
struct dir_cache_entry * p2;
if (!cache_initialized)
init_cache ();
......@@ -193,11 +194,11 @@ void ext2_dcache_invalidate (unsigned short dev)
* Lookup a directory entry in the cache
*/
unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
const char *name, int len)
const char * name, int len)
{
char our_name[EXT2_NAME_LEN];
int queue;
struct dir_cache_entry *p;
struct dir_cache_entry * p;
if (!cache_initialized)
init_cache ();
......@@ -208,7 +209,7 @@ unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
#ifdef EXT2FS_DEBUG_CACHE
printk ("dcache_lookup (%04x, %d, %s, %d)\n", dev, dir, our_name, len);
#endif
queue = hash(dev, dir);
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, our_name, len))) {
if (p != first) {
remove_from_cache (p);
......@@ -219,7 +220,7 @@ unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
add_to_queue (queue, p);
}
#ifdef EXT2FS_DEBUG_CACHE
hits ++;
hits++;
printk ("dcache_lookup: %s,hit,inode=%d,hits=%d,misses=%d\n",
our_name, p->ino, hits, misses);
show_cache ("dcache_lookup");
......@@ -227,7 +228,7 @@ unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
return p->ino;
} else {
#ifdef EXT2FS_DEBUG_CACHE
misses ++;
misses++;
printk ("dcache_lookup: %s,miss,hits=%d,misses=%d\n",
our_name, hits, misses);
show_cache ("dcache_lookup");
......@@ -242,10 +243,10 @@ unsigned long ext2_dcache_lookup (unsigned short dev, unsigned long dir,
* This function is called by ext2_lookup(), ext2_readdir()
* and the functions which create directory entries
*/
void ext2_dcache_add (unsigned short dev, unsigned long dir, const char *name,
void ext2_dcache_add (unsigned short dev, unsigned long dir, const char * name,
int len, int ino)
{
struct dir_cache_entry *p;
struct dir_cache_entry * p;
int queue;
if (!cache_initialized)
......@@ -256,7 +257,7 @@ void ext2_dcache_add (unsigned short dev, unsigned long dir, const char *name,
#endif
if (len > EXT2_NAME_LEN)
len = EXT2_NAME_LEN;
queue = hash(dev, dir);
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, name, len))) {
p->dir = dir;
p->ino = ino;
......@@ -303,9 +304,9 @@ void ext2_dcache_add (unsigned short dev, unsigned long dir, const char *name,
* This function is called by the functions which remove directory entries
*/
void ext2_dcache_remove (unsigned short dev, unsigned long dir,
const char *name, int len)
const char * name, int len)
{
struct dir_cache_entry *p;
struct dir_cache_entry * p;
int queue;
if (!cache_initialized)
......@@ -315,7 +316,7 @@ void ext2_dcache_remove (unsigned short dev, unsigned long dir,
#endif
if (len > EXT2_NAME_LEN)
len = EXT2_NAME_LEN;
queue = hash(dev, dir);
queue = hash (dev, dir);
if ((p = find_name (queue, dev, dir, name, len))) {
remove_from_cache (p);
remove_from_queue (queue, p);
......
......@@ -104,7 +104,8 @@ static int ext2_readdir (struct inode * inode, struct file * filp,
sb = inode->i_sb;
while (filp->f_pos < inode->i_size) {
offset = filp->f_pos & (sb->s_blocksize - 1);
bh = ext2_bread (inode, (filp->f_pos) >> EXT2_BLOCK_SIZE_BITS(sb), 0, &err);
bh = ext2_bread (inode, (filp->f_pos) >> EXT2_BLOCK_SIZE_BITS(sb),
0, &err);
if (!bh) {
filp->f_pos += sb->s_blocksize - offset;
continue;
......
......@@ -44,7 +44,7 @@ static struct file_operations ext2_file_operations = {
ext2_file_write, /* write */
NULL, /* readdir - bad */
NULL, /* select - default */
ext2_ioctl, /* ioctl - default */
ext2_ioctl, /* ioctl */
generic_mmap, /* mmap */
NULL, /* no special open is needed */
NULL, /* release */
......@@ -228,9 +228,6 @@ static int ext2_file_write (struct inode * inode, struct file * filp,
while (written < count) {
bh = ext2_getblk (inode, pos / sb->s_blocksize, 1, &err);
if (!bh) {
#ifdef EXT2FS_DEBUG
printk ("ext2_file_write: ext2_getblk returned NULL\n");
#endif
if (!written)
written = err;
break;
......
......@@ -35,7 +35,7 @@ static int sync_block (struct inode * inode, unsigned long * block, int wait)
if (!*block)
return 0;
tmp = *block;
bh = get_hash_table(inode->i_dev, *block, blocksize);
bh = get_hash_table (inode->i_dev, *block, blocksize);
if (!bh)
return 0;
if (*block != tmp) {
......@@ -43,21 +43,20 @@ static int sync_block (struct inode * inode, unsigned long * block, int wait)
return 1;
}
if (wait && bh->b_req && !bh->b_uptodate) {
brelse(bh);
brelse (bh);
return -1;
}
if (wait || !bh->b_uptodate || !bh->b_dirt)
{
brelse(bh);
if (wait || !bh->b_uptodate || !bh->b_dirt) {
brelse (bh);
return 0;
}
ll_rw_block(WRITE, 1, &bh);
ll_rw_block (WRITE, 1, &bh);
bh->b_count--;
return 0;
}
static int sync_iblock (struct inode * inode, unsigned long * iblock,
struct buffer_head **bh, int wait)
struct buffer_head ** bh, int wait)
{
int rc, tmp;
......@@ -68,9 +67,9 @@ static int sync_iblock (struct inode * inode, unsigned long * iblock,
rc = sync_block (inode, iblock, wait);
if (rc)
return rc;
*bh = bread(inode->i_dev, tmp, blocksize);
*bh = bread (inode->i_dev, tmp, blocksize);
if (tmp != *iblock) {
brelse(*bh);
brelse (*bh);
*bh = NULL;
return 1;
}
......@@ -80,7 +79,7 @@ static int sync_iblock (struct inode * inode, unsigned long * iblock,
}
static int sync_direct(struct inode *inode, int wait)
static int sync_direct (struct inode * inode, int wait)
{
int i;
int rc, err = 0;
......@@ -95,7 +94,8 @@ static int sync_direct(struct inode *inode, int wait)
return err;
}
static int sync_indirect(struct inode *inode, unsigned long *iblock, int wait)
static int sync_indirect (struct inode * inode, unsigned long * iblock,
int wait)
{
int i;
struct buffer_head * ind_bh;
......@@ -114,12 +114,12 @@ static int sync_indirect(struct inode *inode, unsigned long *iblock, int wait)
if (rc)
err = rc;
}
brelse(ind_bh);
brelse (ind_bh);
return err;
}
static int sync_dindirect(struct inode *inode, unsigned long *diblock,
int wait)
static int sync_dindirect (struct inode * inode, unsigned long * diblock,
int wait)
{
int i;
struct buffer_head * dind_bh;
......@@ -138,12 +138,12 @@ static int sync_dindirect(struct inode *inode, unsigned long *diblock,
if (rc)
err = rc;
}
brelse(dind_bh);
brelse (dind_bh);
return err;
}
static int sync_tindirect(struct inode *inode, unsigned long *tiblock,
int wait)
static int sync_tindirect (struct inode * inode, unsigned long * tiblock,
int wait)
{
int i;
struct buffer_head * tind_bh;
......@@ -162,11 +162,11 @@ static int sync_tindirect(struct inode *inode, unsigned long *tiblock,
if (rc)
err = rc;
}
brelse(tind_bh);
brelse (tind_bh);
return err;
}
int ext2_sync_file(struct inode * inode, struct file *file)
int ext2_sync_file (struct inode * inode, struct file * file)
{
int wait, err = 0;
......@@ -179,16 +179,16 @@ int ext2_sync_file(struct inode * inode, struct file *file)
for (wait=0; wait<=1; wait++)
{
err |= sync_direct(inode, wait);
err |= sync_indirect(inode,
inode->u.ext2_i.i_data+EXT2_IND_BLOCK,
wait);
err |= sync_dindirect(inode,
inode->u.ext2_i.i_data+EXT2_DIND_BLOCK,
wait);
err |= sync_tindirect(inode,
inode->u.ext2_i.i_data+EXT2_TIND_BLOCK,
err |= sync_direct (inode, wait);
err |= sync_indirect (inode,
inode->u.ext2_i.i_data+EXT2_IND_BLOCK,
wait);
err |= sync_dindirect (inode,
inode->u.ext2_i.i_data+EXT2_DIND_BLOCK,
wait);
err |= sync_tindirect (inode,
inode->u.ext2_i.i_data+EXT2_TIND_BLOCK,
wait);
}
skip:
err |= ext2_sync_inode (inode);
......
......@@ -221,12 +221,13 @@ void ext2_free_inode (struct inode * inode)
#endif
sb = inode->i_sb;
lock_super (sb);
if (inode->i_ino < 1 || inode->i_ino > sb->u.ext2_sb.s_inodes_count) {
if (inode->i_ino < 1 ||
inode->i_ino > sb->u.ext2_sb.s_es->s_inodes_count) {
printk("free_inode: inode 0 or nonexistent inode\n");
unlock_super (sb);
return;
}
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
es = sb->u.ext2_sb.s_es;
block_group = (inode->i_ino - 1) / EXT2_INODES_PER_GROUP(sb);
bit = (inode->i_ino - 1) % EXT2_INODES_PER_GROUP(sb);
bitmap_nr = load_inode_bitmap (sb, block_group);
......@@ -247,14 +248,14 @@ void ext2_free_inode (struct inode * inode)
panic ("ext2_free_inode: Group descriptor not loaded");
}
gdp = (struct ext2_group_desc *) bh2->b_data;
gdp[desc].bg_free_inodes_count ++;
gdp[desc].bg_free_inodes_count++;
if (S_ISDIR(inode->i_mode))
gdp[desc].bg_used_dirs_count --;
gdp[desc].bg_used_dirs_count--;
bh2->b_dirt = 1;
set_inode_dtime (inode, gdp, desc);
}
bh->b_dirt = 1;
es->s_free_inodes_count ++;
es->s_free_inodes_count++;
sb->u.ext2_sb.s_sbh->b_dirt = 1;
sb->s_dirt = 1;
unlock_super (sb);
......@@ -295,10 +296,11 @@ static void inc_inode_version (struct inode * inode,
brelse (bh);
}
static struct ext2_group_desc * get_group_desc(struct super_block * sb,
int group)
static struct ext2_group_desc * get_group_desc (struct super_block * sb,
int group)
{
struct ext2_group_desc * gdp;
if (group >= sb->u.ext2_sb.s_groups_count || group < 0 )
panic ("ext2: get_group_desc: Invalid group\n");
if (!sb->u.ext2_sb.s_group_desc[group / EXT2_DESC_PER_BLOCK(sb)])
......@@ -335,7 +337,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
inode->i_sb = sb;
inode->i_flags = sb->s_flags;
lock_super (sb);
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
es = sb->u.ext2_sb.s_es;
repeat:
gdp = NULL; i=0;
......@@ -345,7 +347,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
/* I am not yet convinced that this next bit is necessary.
i = dir->u.ext2_i.i_block_group;
for (j = 0; j < sb->u.ext2_sb.s_groups_count; j++) {
tmp = get_group_desc(sb, i);
tmp = get_group_desc (sb, i);
if ((tmp->bg_used_dirs_count << 8) <
tmp->bg_free_inodes_count) {
gdp = tmp;
......@@ -357,7 +359,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
*/
if (!gdp) {
for (j = 0; j < sb->u.ext2_sb.s_groups_count; j++) {
tmp = get_group_desc(sb, j);
tmp = get_group_desc (sb, j);
if (tmp->bg_free_inodes_count &&
tmp->bg_free_inodes_count >= avefreei) {
if (!gdp ||
......@@ -373,7 +375,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
else
{ /* Try to place the inode in it\'s parent directory */
i = dir->u.ext2_i.i_block_group;
tmp = get_group_desc(sb, i);
tmp = get_group_desc (sb, i);
if (tmp->bg_free_inodes_count)
gdp = tmp;
else
......@@ -382,7 +384,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
i += j;
if (i >= sb->u.ext2_sb.s_groups_count)
i -= sb->u.ext2_sb.s_groups_count;
tmp = get_group_desc(sb, i);
tmp = get_group_desc (sb, i);
if (tmp->bg_free_inodes_count) {
gdp = tmp;
break;
......@@ -395,7 +397,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
for (j = 2; j < sb->u.ext2_sb.s_groups_count; j++) {
if (++i >= sb->u.ext2_sb.s_groups_count)
i = 0;
tmp = get_group_desc(sb,i);
tmp = get_group_desc (sb,i);
if (tmp->bg_free_inodes_count) {
gdp = tmp;
break;
......@@ -426,16 +428,18 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
} else
goto repeat;
j += i * EXT2_INODES_PER_GROUP(sb) + 1;
if (j > sb->u.ext2_sb.s_inodes_count) {
if (j > es->s_inodes_count) {
printk ("block_group = %d,inode=%d\n", i, j);
printk ("ext2_new_inode: inode > inodes count");
unlock_super (sb);
iput (inode);
return NULL;
}
gdp->bg_free_inodes_count --;
gdp->bg_free_inodes_count--;
if (S_ISDIR(mode))
gdp->bg_used_dirs_count ++;
gdp->bg_used_dirs_count++;
sb->u.ext2_sb.s_group_desc[i / EXT2_DESC_PER_BLOCK(sb)]->b_dirt = 1;
es->s_free_inodes_count --;
es->s_free_inodes_count--;
sb->u.ext2_sb.s_sbh->b_dirt = 1;
sb->s_dirt = 1;
inode->i_mode = mode;
......@@ -470,8 +474,8 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
unsigned long ext2_count_free_inodes (struct super_block *sb)
{
struct ext2_super_block * es;
#ifdef EXT2FS_DEBUG
struct ext2_super_block * es;
unsigned long desc_count, bitmap_count, x;
unsigned long group_desc;
unsigned long desc;
......@@ -480,7 +484,7 @@ unsigned long ext2_count_free_inodes (struct super_block *sb)
int i;
lock_super (sb);
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
es = sb->u.ext2_sb.s_es;
desc_count = 0;
bitmap_count = 0;
group_desc = 0;
......@@ -507,9 +511,9 @@ unsigned long ext2_count_free_inodes (struct super_block *sb)
printk ("group %d: stored = %d, counted = %d\n",
i, gdp[desc].bg_free_inodes_count, x);
bitmap_count += x;
desc ++;
desc++;
if (desc == EXT2_DESC_PER_BLOCK(sb)) {
group_desc ++;
group_desc++;
desc = 0;
gdp = NULL;
}
......@@ -519,7 +523,6 @@ unsigned long ext2_count_free_inodes (struct super_block *sb)
unlock_super (sb);
return desc_count;
#else
es = (struct ext2_super_block *) sb->u.ext2_sb.s_sbh->b_data;
return es->s_free_inodes_count;
return sb->u.ext2_sb.s_es->s_free_inodes_count;
#endif
}
This diff is collapsed.
......@@ -27,10 +27,6 @@
/* #define NO_TRUNCATE */
/*
* ok, we cannot use strncmp, as the name is not in our data space.
* Thus we'll have to use ext2_match. No big problem. ext2_match also makes
* some sanity tests.
*
* NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
*/
static int ext2_match (int len, const char * const name,
......@@ -261,6 +257,7 @@ static struct buffer_head * ext2_add_entry (struct inode * dir,
for (i = 0; i < namelen ; i++)
de->name[i] = name [i];
dir->i_mtime = dir->i_ctime = CURRENT_TIME;
dir->i_dirt = 1;
bh->b_dirt = 1;
*res_dir = de;
*err = 0;
......@@ -325,7 +322,7 @@ int ext2_create (struct inode * dir,const char * name, int len, int mode,
inode->i_dirt = 1;
bh = ext2_add_entry (dir, name, len, &de, &err);
if (!bh) {
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
iput (dir);
......@@ -388,7 +385,7 @@ int ext2_mknod (struct inode * dir, const char * name, int len, int mode,
inode->i_dirt = 1;
bh = ext2_add_entry (dir, name, len, &de, &err);
if (!bh) {
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
iput (dir);
......@@ -436,7 +433,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode)
dir_block = ext2_bread (inode, 0, 1, &err);
if (!dir_block) {
iput (dir);
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
return err;
......@@ -455,7 +452,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode)
inode->i_nlink = 2;
dir_block->b_dirt = 1;
brelse (dir_block);
inode->i_mode = S_IFDIR | (mode & 0777 & ~current->umask);
inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->umask);
if (dir->i_mode & S_ISGID)
inode->i_mode |= S_ISGID;
inode->i_dirt = 1;
......@@ -472,7 +469,7 @@ int ext2_mkdir (struct inode * dir, const char * name, int len, int mode)
de->inode);
#endif
bh->b_dirt = 1;
dir->i_nlink ++;
dir->i_nlink++;
dir->i_dirt = 1;
iput (dir);
iput (inode);
......@@ -596,7 +593,7 @@ int ext2_rmdir (struct inode * dir, const char * name, int len)
bh->b_dirt = 1;
inode->i_nlink = 0;
inode->i_dirt = 1;
dir->i_nlink --;
dir->i_nlink--;
dir->i_ctime = dir->i_mtime = CURRENT_TIME;
dir->i_dirt = 1;
end_rmdir:
......@@ -651,7 +648,7 @@ int ext2_unlink (struct inode * dir, const char * name, int len)
bh->b_dirt = 1;
dir->i_ctime = dir->i_mtime = CURRENT_TIME;
dir->i_dirt = 1;
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
inode->i_ctime = CURRENT_TIME;
retval = 0;
......@@ -677,7 +674,7 @@ int ext2_symlink (struct inode * dir, const char * name, int len,
iput (dir);
return -ENOSPC;
}
inode->i_mode = S_IFLNK | 0777;
inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &ext2_symlink_inode_operations;
for (l = 0; l < inode->i_sb->s_blocksize - 1 &&
symname [l]; l++)
......@@ -689,7 +686,7 @@ int ext2_symlink (struct inode * dir, const char * name, int len,
name_block = ext2_bread (inode, 0, 1, &err);
if (!name_block) {
iput (dir);
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
return err;
......@@ -702,7 +699,7 @@ int ext2_symlink (struct inode * dir, const char * name, int len,
#endif
}
i = 0;
while (i < inode->i_sb->s_blocksize - 1 && (c = *(symname ++)))
while (i < inode->i_sb->s_blocksize - 1 && (c = *(symname++)))
link[i++] = c;
link[i] = 0;
if (name_block) {
......@@ -713,7 +710,7 @@ int ext2_symlink (struct inode * dir, const char * name, int len,
inode->i_dirt = 1;
bh = ext2_find_entry (dir, name, len, &de);
if (bh) {
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
brelse (bh);
......@@ -722,7 +719,7 @@ int ext2_symlink (struct inode * dir, const char * name, int len,
}
bh = ext2_add_entry (dir, name, len, &de, &err);
if (!bh) {
inode->i_nlink --;
inode->i_nlink--;
inode->i_dirt = 1;
iput (inode);
iput (dir);
......@@ -778,7 +775,7 @@ int ext2_link (struct inode * oldinode, struct inode * dir,
bh->b_dirt = 1;
brelse (bh);
iput (dir);
oldinode->i_nlink ++;
oldinode->i_nlink++;
oldinode->i_ctime = CURRENT_TIME;
oldinode->i_dirt = 1;
iput (oldinode);
......@@ -790,7 +787,7 @@ static int subdir (struct inode * new_inode, struct inode * old_inode)
int ino;
int result;
new_inode->i_count ++;
new_inode->i_count++;
result = 0;
for (;;) {
if (new_inode == old_inode) {
......@@ -937,7 +934,7 @@ static int do_ext2_rename (struct inode * old_dir, const char * old_name,
if (retval)
goto end_rename;
if (new_inode) {
new_inode->i_nlink --;
new_inode->i_nlink--;
new_inode->i_dirt = 1;
}
old_bh->b_dirt = 1;
......@@ -945,8 +942,8 @@ static int do_ext2_rename (struct inode * old_dir, const char * old_name,
if (dir_bh) {
PARENT_INO(dir_bh->b_data) = new_dir->i_ino;
dir_bh->b_dirt = 1;
old_dir->i_nlink --;
new_dir->i_nlink ++;
old_dir->i_nlink--;
new_dir->i_nlink++;
old_dir->i_dirt = 1;
new_dir->i_dirt = 1;
}
......
......@@ -38,7 +38,7 @@ struct inode_operations ext2_symlink_inode_operations = {
NULL, /* rmdir */
NULL, /* mknod */
NULL, /* rename */
ext2_readlink, /* readlink */
ext2_readlink, /* readlink */
ext2_follow_link, /* follow_link */
NULL, /* bmap */
NULL, /* truncate */
......@@ -55,7 +55,7 @@ static int ext2_follow_link(struct inode * dir, struct inode * inode,
*res_inode = NULL;
if (!dir) {
dir = current->root;
dir->i_count ++;
dir->i_count++;
}
if (!inode) {
iput (dir);
......@@ -80,9 +80,9 @@ static int ext2_follow_link(struct inode * dir, struct inode * inode,
link = bh->b_data;
} else
link = (char *) inode->u.ext2_i.i_data;
current->link_count ++;
current->link_count++;
error = open_namei (link, flag, mode, res_inode, dir);
current->link_count --;
current->link_count--;
iput (inode);
if (bh)
brelse (bh);
......@@ -114,7 +114,7 @@ static int ext2_readlink (struct inode * inode, char * buffer, int buflen)
link = (char *) inode->u.ext2_i.i_data;
i = 0;
while (i < buflen && (c = link[i])) {
i ++;
i++;
put_fs_byte (c, buffer++);
}
iput (inode);
......
......@@ -161,7 +161,7 @@ static int trunc_dindirect (struct inode * inode, int offset,
return 0;
}
repeat:
for (i = dindirect_block ; i < addr_per_block ; i ++) {
for (i = dindirect_block ; i < addr_per_block ; i++) {
if (i < 0)
i = 0;
if (i < dindirect_block)
......@@ -218,7 +218,7 @@ static int trunc_tindirect (struct inode * inode)
return 0;
}
repeat:
for (i = tindirect_block ; i < addr_per_block ; i ++) {
for (i = tindirect_block ; i < addr_per_block ; i++) {
if (i < 0)
i = 0;
if (i < tindirect_block)
......
......@@ -99,7 +99,7 @@ static int fifo_open(struct inode * inode,struct file * filp)
}
if (retval || PIPE_BASE(*inode))
return retval;
page = get_free_page(GFP_KERNEL);
page = __get_free_page(GFP_KERNEL);
if (PIPE_BASE(*inode)) {
free_page(page);
return 0;
......
......@@ -42,26 +42,21 @@ static void put_last_free(struct file *file)
void grow_files(void)
{
unsigned long page;
struct file * file;
int i;
page = get_free_page(GFP_BUFFER);
if (!page)
file = (struct file*) __get_free_page(GFP_BUFFER);
if (!file)
return;
file = (struct file *) page;
for (i=0; i < (PAGE_SIZE / sizeof(struct file)); i++, file++)
{
if (!first_file)
{
file->f_next = file;
file->f_prev = file;
first_file = file;
}
else
insert_file_free(file);
}
nr_files += i;
nr_files+=i= PAGE_SIZE/sizeof(struct file);
if (!first_file)
file->f_next = file->f_prev = first_file = file++, i--;
for (; i ; i--)
insert_file_free(file++);
}
unsigned long file_table_init(unsigned long start, unsigned long end)
......
......@@ -17,7 +17,7 @@ static struct inode * first_inode;
static struct wait_queue * inode_wait = NULL;
static int nr_inodes = 0, nr_free_inodes = 0;
static inline int const hashfn(dev_t dev, int i)
static inline int const hashfn(dev_t dev, unsigned int i)
{
return (dev ^ i) % NR_IHASH;
}
......@@ -84,24 +84,21 @@ static void put_last_free(struct inode *inode)
void grow_inodes(void)
{
unsigned long page;
struct inode * inode;
int i;
page = get_free_page(GFP_BUFFER);
if (!page)
if(!(inode = (struct inode*) get_free_page(GFP_KERNEL)))
return;
inode = (struct inode *) page;
for (i=0; i < (PAGE_SIZE / sizeof(struct inode)); i++, inode++) {
if (!first_inode) {
inode->i_next = inode;
inode->i_prev = inode;
first_inode = inode;
} else
insert_inode_free(inode);
}
i=PAGE_SIZE / sizeof(struct inode);
nr_inodes += i;
nr_free_inodes += i;
if (!first_inode)
inode->i_next = inode->i_prev = first_inode = inode++, i--;
for ( ; i ; i-- )
insert_inode_free(inode++);
}
unsigned long inode_init(unsigned long start, unsigned long end)
......@@ -400,7 +397,7 @@ struct inode * get_pipe_inode(void)
if (!(inode = get_empty_inode()))
return NULL;
if (!(PIPE_BASE(*inode) = (char *) get_free_page(GFP_USER))) {
if (!(PIPE_BASE(*inode) = (char*) __get_free_page(GFP_USER))) {
iput(inode);
return NULL;
}
......
......@@ -18,7 +18,15 @@
#include <asm/segment.h>
#include <linux/errno.h>
#if defined(CONFIG_BLK_DEV_SR)
extern int check_cdrom_media_change(int, int);
#endif
#if defined(CONFIG_CDU31A)
extern int check_cdu31a_media_change(int, int);
#endif
#if defined(CONFIG_MCD)
extern int check_mcd_media_change(int, int);
#endif
#ifdef LEAK_CHECK
static int check_malloc = 0;
......@@ -254,11 +262,27 @@ struct super_block *isofs_read_super(struct super_block *s,void *data,
printk("get root inode failed\n");
return NULL;
}
#if defined(CONFIG_BLK_DEV_SR)
if(MAJOR(s->s_dev) == 11) {
/* Chech this one more time. */
/* Check this one more time. */
if(check_cdrom_media_change(s->s_dev, 0))
goto out;
};
#endif
#if defined(CONFIG_CDU31A)
if(MAJOR(s->s_dev) == 15) {
/* Check this one more time. */
if(check_cdu31a_media_change(s->s_dev, 0))
goto out;
};
#endif
#if defined(CONFIG_MCD)
if(MAJOR(s->s_dev) == 23) {
/* Check this one more time. */
if(check_mcd_media_change(s->s_dev, 0))
goto out;
};
#endif
return s;
out: /* Kick out for various error conditions */
brelse(bh);
......@@ -321,15 +345,15 @@ void isofs_read_inode(struct inode * inode)
raw_inode = ((struct iso_directory_record *) pnt);
};
inode->i_mode = 0444; /* Everybody gets to read the file. */
inode->i_mode = S_IRUGO; /* Everybody gets to read the file. */
inode->i_nlink = 1;
if (raw_inode->flags[-high_sierra] & 2) {
inode->i_mode = 0555 | S_IFDIR;
inode->i_mode = S_IRUGO | S_IXUGO | S_IFDIR;
inode->i_nlink = 2; /* There are always at least 2. It is
hard to figure out what is correct*/
} else {
inode->i_mode = 0444; /* Everybody gets to read the file. */
inode->i_mode = S_IRUGO; /* Everybody gets to read the file. */
inode->i_nlink = 1;
inode->i_mode |= S_IFREG;
/* If there are no periods in the name, then set the execute permission bit */
......@@ -337,7 +361,7 @@ void isofs_read_inode(struct inode * inode)
if(raw_inode->name[i]=='.' || raw_inode->name[i]==';')
break;
if(i == raw_inode->name_len[0] || raw_inode->name[i] == ';')
inode->i_mode |= 0111; /* execute permission */
inode->i_mode |= S_IXUGO; /* execute permission */
};
inode->i_uid = 0;
inode->i_gid = 0;
......
......@@ -20,7 +20,7 @@
#include <linux/stat.h>
#include <linux/fcntl.h>
#define OFFSET_MAX 0x7fffffff /* FIXME: move elsewhere? */
#define OFFSET_MAX ((off_t)0x7fffffff) /* FIXME: move elsewhere? */
static int copy_flock(struct file *filp, struct file_lock *fl, struct flock *l);
static int conflict(struct file_lock *caller_fl, struct file_lock *sys_fl);
......
......@@ -14,6 +14,7 @@
#include <asm/system.h>
#include <asm/segment.h>
#include <asm/bitops.h>
void minix_put_inode(struct inode *inode)
{
......@@ -116,8 +117,8 @@ struct super_block *minix_read_super(struct super_block *s,void *data,
printk("MINIX-fs: bad superblock or unable to read bitmaps\n");
return NULL;
}
s->u.minix_sb.s_imap[0]->b_data[0] |= 1;
s->u.minix_sb.s_zmap[0]->b_data[0] |= 1;
set_bit(0,s->u.minix_sb.s_imap[0]->b_data);
set_bit(0,s->u.minix_sb.s_zmap[0]->b_data);
/* set up enough so that it can read an inode */
s->s_dev = dev;
s->s_op = &minix_sops;
......
......@@ -315,7 +315,7 @@ void msdos_read_inode(struct inode *inode)
inode->i_uid = MSDOS_SB(inode->i_sb)->fs_uid;
inode->i_gid = MSDOS_SB(inode->i_sb)->fs_gid;
if (inode->i_ino == MSDOS_ROOT_INO) {
inode->i_mode = (0777 & ~MSDOS_SB(inode->i_sb)->fs_umask) |
inode->i_mode = (S_IRWXUGO & ~MSDOS_SB(inode->i_sb)->fs_umask) |
S_IFDIR;
inode->i_op = &msdos_dir_inode_operations;
inode->i_nlink = msdos_subdirs(inode)+2;
......@@ -339,7 +339,7 @@ void msdos_read_inode(struct inode *inode)
raw_entry = &((struct msdos_dir_entry *) (bh->b_data))
[inode->i_ino & (MSDOS_DPB-1)];
if ((raw_entry->attr & ATTR_DIR) && !IS_FREE(raw_entry->name)) {
inode->i_mode = MSDOS_MKMODE(raw_entry->attr,0777 &
inode->i_mode = MSDOS_MKMODE(raw_entry->attr,S_IRWXUGO &
~MSDOS_SB(inode->i_sb)->fs_umask) | S_IFDIR;
inode->i_op = &msdos_dir_inode_operations;
MSDOS_I(inode)->i_start = CF_LE_W(raw_entry->start);
......@@ -363,7 +363,7 @@ void msdos_read_inode(struct inode *inode)
}
else {
inode->i_mode = MSDOS_MKMODE(raw_entry->attr,(IS_NOEXEC(inode)
? 0666 : 0777) & ~MSDOS_SB(inode->i_sb)->fs_umask) |
? S_IRUGO|S_IWUGO : S_IRWXUGO) & ~MSDOS_SB(inode->i_sb)->fs_umask) |
S_IFREG;
inode->i_op = MSDOS_CAN_BMAP(MSDOS_SB(inode->i_sb)) ?
&msdos_file_inode_operations :
......@@ -436,10 +436,10 @@ int msdos_notify_change(int flags,struct inode *inode)
error = -EPERM;
}
if (IS_NOEXEC(inode) && !S_ISDIR(inode->i_mode))
inode->i_mode &= S_IFMT | 0666;
else inode->i_mode |= 0111;
inode->i_mode &= S_IFMT | S_IRUGO | S_IWUGO;
else inode->i_mode |= S_IXUGO;
inode->i_mode = ((inode->i_mode & S_IFMT) | ((((inode->i_mode & S_IRWXU
& ~MSDOS_SB(inode->i_sb)->fs_umask) | S_IRUSR) >> 6)*0111)) &
& ~MSDOS_SB(inode->i_sb)->fs_umask) | S_IRUSR) >> 6)*S_IXUGO)) &
~MSDOS_SB(inode->i_sb)->fs_umask;
return MSDOS_SB(inode->i_sb)->quiet ? 0 : error;
}
......@@ -15,7 +15,7 @@
/* Well-known binary file extensions */
static char bin_extensions[] =
"EXECOMAPPSYSOVLOBJLIB" /* program code */
"EXECOMBINAPPSYSDRVOVLOVROBJLIBDLLPIF" /* program code */
"ARCZIPLHALZHZOOTARZ ARJ" /* common archivers */
"TZ TAZTZPTPZ" /* abbreviations of tar.Z and tar.zip */
"GIFBMPTIFGL JPGPCX" /* graphics */
......@@ -141,7 +141,7 @@ printk("set to %x\n",fat_access(inode->i_sb,nr,-1));
#endif
last = 0;
if ((current = MSDOS_I(inode)->i_start) != 0) {
cache_lookup(inode,0x7fffffff,&last,&current);
cache_lookup(inode,INT_MAX,&last,&current);
while (current && current != -1)
if (!(current = fat_access(inode->i_sb,
last = current,-1))) {
......
......@@ -44,8 +44,7 @@ int getname(const char * filename, char **result)
c = get_fs_byte(filename++);
if (!c)
return -ENOENT;
page = __get_free_page(GFP_KERNEL);
if (!page)
if(!(page = __get_free_page(GFP_KERNEL)))
return -ENOMEM;
*result = tmp = (char *) page;
while (--i) {
......@@ -283,7 +282,7 @@ int open_namei(const char * pathname, int flag, int mode,
struct inode * dir, *inode;
struct task_struct ** p;
mode &= 07777 & ~current->umask;
mode &= S_IALLUGO & ~current->umask;
mode |= S_IFREG;
error = dir_namei(pathname,&namelen,&basename,base,&dir);
if (error)
......
......@@ -15,7 +15,7 @@
$(AS) -o $*.o $<
OBJS= proc.o sock.o inode.o file.o dir.o \
symlink.o
symlink.o mmap.o
nfs.o: $(OBJS)
$(LD) -r -o nfs.o $(OBJS)
......
......@@ -477,7 +477,7 @@ static int nfs_symlink(struct inode *dir, const char *name, int len,
iput(dir);
return -ENAMETOOLONG;
}
sattr.mode = S_IFLNK | 0777; /* SunOS 4.1.2 crashes without this! */
sattr.mode = S_IFLNK | S_IRWXUGO; /* SunOS 4.1.2 crashes without this! */
sattr.uid = sattr.gid = sattr.size = (unsigned) -1;
sattr.atime.seconds = sattr.mtime.seconds = (unsigned) -1;
error = nfs_proc_symlink(NFS_SERVER(dir), NFS_FH(dir),
......
......@@ -19,6 +19,8 @@
static int nfs_file_read(struct inode *, struct file *, char *, int);
static int nfs_file_write(struct inode *, struct file *, char *, int);
extern int nfs_mmap(struct inode * inode, struct file * file,
unsigned long addr, size_t len, int prot, unsigned long off);
static struct file_operations nfs_file_operations = {
NULL, /* lseek - default */
......@@ -27,7 +29,7 @@ static struct file_operations nfs_file_operations = {
NULL, /* readdir - bad */
NULL, /* select - default */
NULL, /* ioctl - default */
NULL, /* mmap */
nfs_mmap, /* mmap */
NULL, /* no special open is needed */
NULL, /* release */
NULL /* fsync */
......
/*
* fs/nfs/mmap.c by Jon Tombs 15 Aug 1993
*
* This code is from
* linux/mm/mmap.c which was written by obz, Linus and Eric
* and
* linux/mm/memory.c by Linus Torvalds and others
*
* Copyright (C) 1993
*
*/
#include <linux/stat.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/shm.h>
#include <linux/errno.h>
#include <linux/mman.h>
#include <linux/string.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/nfs_fs.h>
extern int share_page(struct vm_area_struct * area, struct task_struct * tsk,
struct inode * inode, unsigned long address, unsigned long error_code,
unsigned long newpage);
extern unsigned long put_page(struct task_struct * tsk,unsigned long page,
unsigned long address,int prot);
static void nfs_file_mmap_nopage(int error_code, struct vm_area_struct * area,
unsigned long address);
extern void file_mmap_free(struct vm_area_struct * area);
extern int file_mmap_share(struct vm_area_struct * from, struct vm_area_struct * to,
unsigned long address);
struct vm_operations_struct nfs_file_mmap = {
NULL, /* open */
file_mmap_free, /* close */
nfs_file_mmap_nopage, /* nopage */
NULL, /* wppage */
file_mmap_share, /* share */
};
/* This is used for a general mmap of a nfs file */
int nfs_mmap(struct inode * inode, struct file * file,
unsigned long addr, size_t len, int prot, unsigned long off)
{
struct vm_area_struct * mpnt;
if (off & (inode->i_sb->s_blocksize - 1))
return -EINVAL;
if (len > high_memory || off > high_memory - len) /* avoid overflow */
return -ENXIO;
if (get_limit(USER_DS) != TASK_SIZE)
return -EINVAL;
if (!inode->i_sb || !S_ISREG(inode->i_mode))
return -EACCES;
if (!IS_RDONLY(inode)) {
inode->i_atime = CURRENT_TIME;
inode->i_dirt = 1;
}
mpnt = (struct vm_area_struct * ) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
if (!mpnt)
return -ENOMEM;
unmap_page_range(addr, len);
mpnt->vm_task = current;
mpnt->vm_start = addr;
mpnt->vm_end = addr + len;
mpnt->vm_page_prot = prot;
mpnt->vm_share = NULL;
mpnt->vm_inode = inode;
inode->i_count++;
mpnt->vm_offset = off;
mpnt->vm_ops = &nfs_file_mmap;
mpnt->vm_next = current->mmap;
current->mmap = mpnt;
#if 0
printk("VFS: Loaded mmap at %08x - %08x\n",
mpnt->vm_start, mpnt->vm_end);
#endif
return 0;
}
static void nfs_file_mmap_nopage(int error_code, struct vm_area_struct * area,
unsigned long address)
{
struct inode * inode = area->vm_inode;
unsigned int clear;
unsigned long page;
unsigned long tmp;
int n;
int i;
int pos;
struct nfs_fattr fattr;
address &= PAGE_MASK;
pos = address - area->vm_start + area->vm_offset;
page = get_free_page(GFP_KERNEL);
if (share_page(area, area->vm_task, inode, address, error_code, page)) {
++area->vm_task->min_flt;
return;
}
++area->vm_task->maj_flt;
if (!page) {
oom(current);
put_page(area->vm_task, BAD_PAGE, address, PAGE_PRIVATE);
return;
}
clear = 0;
if (address + PAGE_SIZE > area->vm_end) {
clear = address + PAGE_SIZE - area->vm_end;
}
n = NFS_SERVER(inode)->rsize; /* what we can read in one go */
for (i = 0; i < (PAGE_SIZE - clear); i += n) {
int hunk, result;
hunk = PAGE_SIZE - i;
if (hunk > n)
hunk = n;
result = nfs_proc_read(NFS_SERVER(inode), NFS_FH(inode),
pos, hunk, (char *) (page + i), &fattr);
if (result < 0)
break;
pos += result;
if (result < n) {
i += result;
break;
}
}
#ifdef doweneedthishere
nfs_refresh_inode(inode, &fattr);
#endif
if (!(error_code & PAGE_RW)) {
if (share_page(area, area->vm_task, inode, address, error_code, page))
return;
}
tmp = page + PAGE_SIZE;
while (clear--) {
*(char *)--tmp = 0;
}
if (put_page(area->vm_task,page,address,area->vm_page_prot))
return;
free_page(page);
oom(current);
}
......@@ -33,6 +33,11 @@ static int proc_debug = 0;
#define PRINTK if (0) printk
#endif
#define PREP_PAGE_RPC(code) \
if (!(p0 = (int*)__get_free_page(GFP_KERNEL)))\
return NFSERR_IO;\
p=nfs_rpc_header(p0,code)
static int *nfs_rpc_header(int *p, int procedure);
static int *nfs_rpc_verify(int *p);
static int nfs_stat_to_errno(int stat);
......@@ -168,8 +173,7 @@ int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call getattr\n");
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_GETATTR);
PREP_PAGE_RPC(NFSPROC_GETATTR);
p = xdr_encode_fhandle(p, fhandle);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
free_page((long) p0);
......@@ -194,8 +198,7 @@ int nfs_proc_setattr(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call setattr\n");
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_SETATTR);
PREP_PAGE_RPC(NFSPROC_SETATTR);
p = xdr_encode_fhandle(p, fhandle);
p = xdr_encode_sattr(p, sattr);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
......@@ -225,8 +228,7 @@ int nfs_proc_lookup(struct nfs_server *server, struct nfs_fh *dir, const char *n
if (!strcmp(name, "xyzzy"))
proc_debug = 1 - proc_debug;
#endif
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_LOOKUP);
PREP_PAGE_RPC(NFSPROC_LOOKUP);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
......@@ -253,8 +255,7 @@ int nfs_proc_readlink(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call readlink\n");
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_READLINK);
PREP_PAGE_RPC(NFSPROC_READLINK);
p = xdr_encode_fhandle(p, fhandle);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
free_page((long) p0);
......@@ -284,8 +285,7 @@ int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle,
int len = 0; /* = 0 is for gcc */
PRINTK("NFS call read %d @ %d\n", count, offset);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_READ);
PREP_PAGE_RPC(NFSPROC_READ);
p = xdr_encode_fhandle(p, fhandle);
*p++ = htonl(offset);
*p++ = htonl(count);
......@@ -318,8 +318,7 @@ int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call write %d @ %d\n", count, offset);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_WRITE);
PREP_PAGE_RPC(NFSPROC_WRITE);
p = xdr_encode_fhandle(p, fhandle);
*p++ = htonl(offset); /* traditional, could be any value */
*p++ = htonl(offset);
......@@ -349,8 +348,7 @@ int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir,
int status;
PRINTK("NFS call create %s\n", name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_CREATE);
PREP_PAGE_RPC(NFSPROC_CREATE);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
p = xdr_encode_sattr(p, sattr);
......@@ -377,8 +375,7 @@ int nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, const char *n
int status;
PRINTK("NFS call remove %s\n", name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_REMOVE);
PREP_PAGE_RPC(NFSPROC_REMOVE);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
......@@ -404,8 +401,7 @@ int nfs_proc_rename(struct nfs_server *server,
int status;
PRINTK("NFS call rename %s -> %s\n", old_name, new_name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_RENAME);
PREP_PAGE_RPC(NFSPROC_RENAME);
p = xdr_encode_fhandle(p, old_dir);
p = xdr_encode_string(p, old_name);
p = xdr_encode_fhandle(p, new_dir);
......@@ -432,8 +428,7 @@ int nfs_proc_link(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call link %s\n", name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_LINK);
PREP_PAGE_RPC(NFSPROC_LINK);
p = xdr_encode_fhandle(p, fhandle);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
......@@ -459,8 +454,7 @@ int nfs_proc_symlink(struct nfs_server *server, struct nfs_fh *dir,
int status;
PRINTK("NFS call symlink %s -> %s\n", name, path);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_SYMLINK);
PREP_PAGE_RPC(NFSPROC_SYMLINK);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
p = xdr_encode_string(p, path);
......@@ -488,8 +482,7 @@ int nfs_proc_mkdir(struct nfs_server *server, struct nfs_fh *dir,
int status;
PRINTK("NFS call mkdir %s\n", name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_MKDIR);
PREP_PAGE_RPC(NFSPROC_MKDIR);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
p = xdr_encode_sattr(p, sattr);
......@@ -516,8 +509,7 @@ int nfs_proc_rmdir(struct nfs_server *server, struct nfs_fh *dir, const char *na
int status;
PRINTK("NFS call rmdir %s\n", name);
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_RMDIR);
PREP_PAGE_RPC(NFSPROC_RMDIR);
p = xdr_encode_fhandle(p, dir);
p = xdr_encode_string(p, name);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
......@@ -546,8 +538,7 @@ int nfs_proc_readdir(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK("NFS call readdir %d @ %d\n", count, cookie);
size = server->rsize;
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_READDIR);
PREP_PAGE_RPC(NFSPROC_READDIR);
p = xdr_encode_fhandle(p, fhandle);
*p++ = htonl(cookie);
*p++ = htonl(size);
......@@ -588,8 +579,7 @@ int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
int status;
PRINTK("NFS call statfs\n");
p = p0 = (int *) get_free_page(GFP_KERNEL);
p = nfs_rpc_header(p, NFSPROC_STATFS);
PREP_PAGE_RPC(NFSPROC_STATFS);
p = xdr_encode_fhandle(p, fhandle);
if ((status = nfs_rpc_call(server, p0, p)) < 0) {
free_page((long) p0);
......
......@@ -120,7 +120,7 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end)
remove_wait_queue(entry.wait_address, &entry.wait);
current->state = TASK_RUNNING;
addrlen = 0;
result = sock->ops->recvfrom(sock, (void *) start, 4096, 1, 0,
result = sock->ops->recvfrom(sock, (void *) start, PAGE_SIZE, 1, 0,
NULL, &addrlen);
if (result < 0) {
if (result == -EAGAIN) {
......
......@@ -153,24 +153,24 @@ extern "C" int sys_utime(char * filename, struct utimbuf * times)
/*
* XXX we should use the real ids for checking _all_ components of the
* path. Now we only use them for the final compenent of the path.
* path. Now we only use them for the final component of the path.
*/
extern "C" int sys_access(const char * filename,int mode)
{
struct inode * inode;
int res, i_mode;
if (mode != (mode & 0007)) /* where's F_OK, X_OK, W_OK, R_OK? */
if (mode != (mode & S_IRWXO)) /* where's F_OK, X_OK, W_OK, R_OK? */
return -EINVAL;
res = namei(filename,&inode);
if (res)
return res;
i_mode = inode->i_mode;
res = i_mode & 0777;
res = i_mode & S_IRWXUGO;
if (current->uid == inode->i_uid)
res >>= 6;
res >>= 6; /* needs cleaning? */
else if (in_group_p(inode->i_gid))
res >>= 3;
res >>= 3; /* needs cleaning? */
iput(inode);
if ((res & mode) == mode)
return 0;
......@@ -184,7 +184,7 @@ extern "C" int sys_access(const char * filename,int mode)
* decomposing the path would be racy.
*/
if ((!current->uid) &&
(S_ISDIR(i_mode) || !(mode & 1) || (i_mode & 0111)))
(S_ISDIR(i_mode) || !(mode & S_IXOTH) || (i_mode & S_IXUGO)))
return 0;
return -EACCES;
}
......@@ -244,7 +244,7 @@ extern "C" int sys_fchmod(unsigned int fd, mode_t mode)
return -EPERM;
if (IS_RDONLY(inode))
return -EROFS;
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
......@@ -268,7 +268,7 @@ extern "C" int sys_chmod(const char * filename, mode_t mode)
iput(inode);
return -EROFS;
}
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
inode->i_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
......@@ -350,11 +350,10 @@ extern "C" int sys_chown(const char * filename, uid_t user, gid_t group)
* for the internal routines (ie open_namei()/follow_link() etc). 00 is
* used by symlinks.
*/
extern "C" int sys_open(const char * filename,int flags,int mode)
int do_open(const char * filename,int flags,int mode)
{
struct inode * inode;
struct file * f;
char * tmp;
int flag,error,fd;
for(fd=0 ; fd<NR_OPEN ; fd++)
......@@ -373,11 +372,7 @@ extern "C" int sys_open(const char * filename,int flags,int mode)
flag++;
if (flag & (O_TRUNC | O_CREAT))
flag |= 2;
error = getname(filename,&tmp);
if (!error) {
error = open_namei(tmp,flag,mode,&inode,NULL);
putname(tmp);
}
error = open_namei(filename,flag,mode,&inode,NULL);
if (error) {
current->filp[fd]=NULL;
f->f_count--;
......@@ -414,6 +409,19 @@ extern "C" int sys_open(const char * filename,int flags,int mode)
return (fd);
}
extern "C" int sys_open(const char * filename,int flags,int mode)
{
char * tmp;
int error;
error = getname(filename, &tmp);
if (error)
return error;
error = do_open(tmp,flags,mode);
putname(tmp);
return error;
}
extern "C" int sys_creat(const char * pathname, int mode)
{
return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
......
......@@ -89,18 +89,16 @@ static unsigned long get_phys_addr(struct task_struct ** p, unsigned long ptr)
if (!p || !*p || ptr >= TASK_SIZE)
return 0;
page = (*p)->tss.cr3;
page += (ptr >> 20) & 0xffc;
page = *(unsigned long *) page;
page = *PAGE_DIR_OFFSET((*p)->tss.cr3,ptr);
if (!(page & 1))
return 0;
page &= 0xfffff000;
page += (ptr >> 10) & 0xffc;
page &= PAGE_MASK;
page += PAGE_PTR(ptr);
page = *(unsigned long *) page;
if (!(page & 1))
return 0;
page &= 0xfffff000;
page += ptr & 0xfff;
page &= PAGE_MASK;
page += ptr & ~PAGE_MASK;
return page;
}
......@@ -128,7 +126,7 @@ static int get_array(struct task_struct ** p, unsigned long start, unsigned long
start++;
if (start >= end)
return result;
} while (!(addr & 0xfff));
} while (!(addr & ~PAGE_MASK));
}
}
......@@ -196,7 +194,7 @@ static int get_stat(int pid, char * buffer)
if (vsize) {
eip = KSTK_EIP(vsize);
esp = KSTK_ESP(vsize);
vsize = (*p)->brk + 4095;
vsize = (*p)->brk + PAGE_SIZE-1;
if (esp)
vsize += TASK_SIZE - esp;
}
......@@ -266,14 +264,14 @@ static int get_statm(int pid, char * buffer)
return 0;
tpag = (*p)->end_code / PAGE_SIZE;
if ((*p)->state != TASK_ZOMBIE) {
pagedir = (unsigned long *)((*p)->tss.cr3 + ((*p)->start_code >> 20));
pagedir = PAGE_DIR_OFFSET((*p)->tss.cr3,(*p)->start_code);
for (i = 0; i < 0x300; ++i) {
if ((ptbl = pagedir[i]) == 0) {
tpag -= 1024;
tpag -= PTRS_PER_PAGE;
continue;
}
buf = (unsigned long *)(ptbl & 0xfffff000);
for (pte = buf; pte < (buf + 1024); ++pte) {
buf = (unsigned long *)(ptbl & PAGE_MASK);
for (pte = buf; pte < (buf + PTRS_PER_PAGE); ++pte) {
if (*pte != 0) {
++size;
if (*pte & 1) {
......@@ -290,7 +288,7 @@ static int get_statm(int pid, char * buffer)
--drs;
}
map_nr = MAP_NR(*pte);
if (map_nr < (high_memory / 4096) && mem_map[map_nr] > 1)
if (map_nr < (high_memory / PAGE_SIZE) && mem_map[map_nr] > 1)
++share;
}
}
......@@ -311,8 +309,7 @@ static int array_read(struct inode * inode, struct file * file,char * buf, int c
if (count < 0)
return -EINVAL;
page = (char *) get_free_page(GFP_KERNEL);
if (!page)
if (!(page = (char*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
type = inode->i_ino;
pid = type >> 16;
......
......@@ -61,7 +61,7 @@ struct super_block *proc_read_super(struct super_block *s,void *data,
void proc_statfs(struct super_block *sb, struct statfs *buf)
{
put_fs_long(PROC_SUPER_MAGIC, &buf->f_type);
put_fs_long(1024, &buf->f_bsize);
put_fs_long(PAGE_SIZE/sizeof(long), &buf->f_bsize);
put_fs_long(0, &buf->f_blocks);
put_fs_long(0, &buf->f_bfree);
put_fs_long(0, &buf->f_bavail);
......@@ -94,7 +94,7 @@ void proc_read_inode(struct inode * inode)
if (!p || i >= NR_TASKS)
return;
if (ino == PROC_ROOT_INO) {
inode->i_mode = S_IFDIR | 0555;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
inode->i_nlink = 2;
for (i = 1 ; i < NR_TASKS ; i++)
if (task[i])
......@@ -103,23 +103,23 @@ void proc_read_inode(struct inode * inode)
return;
}
if ((ino >= 128) && (ino <= 160)) { /* files within /proc/net */
inode->i_mode = S_IFREG | 0444;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_op = &proc_net_inode_operations;
return;
}
if (!pid) {
switch (ino) {
case 5:
inode->i_mode = S_IFREG | 0444;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_op = &proc_kmsg_inode_operations;
break;
case 8: /* for the net directory */
inode->i_mode = S_IFDIR | 0555;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
inode->i_nlink = 2;
inode->i_op = &proc_net_inode_operations;
break;
default:
inode->i_mode = S_IFREG | 0444;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_op = &proc_array_inode_operations;
break;
}
......@@ -131,23 +131,23 @@ void proc_read_inode(struct inode * inode)
switch (ino) {
case 2:
inode->i_nlink = 4;
inode->i_mode = S_IFDIR | 0555;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
inode->i_op = &proc_base_inode_operations;
return;
case 3:
inode->i_op = &proc_mem_inode_operations;
inode->i_mode = S_IFREG | 0600;
inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR;
return;
case 4:
case 5:
case 6:
inode->i_op = &proc_link_inode_operations;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
inode->i_mode = S_IFLNK | S_IRWXU;
return;
case 7:
case 8:
inode->i_mode = S_IFDIR | 0500;
inode->i_mode = S_IFDIR | S_IRUSR | S_IXUSR;
inode->i_op = &proc_fd_inode_operations;
inode->i_nlink = 2;
return;
......@@ -155,7 +155,7 @@ void proc_read_inode(struct inode * inode)
case 10:
case 11:
case 12:
inode->i_mode = S_IFREG | 0444;
inode->i_mode = S_IFREG | S_IRUGO;
inode->i_op = &proc_array_inode_operations;
return;
}
......@@ -166,7 +166,7 @@ void proc_read_inode(struct inode * inode)
return;
inode->i_op = &proc_link_inode_operations;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
inode->i_mode = S_IFLNK | S_IRWXU;
return;
case 2:
ino &= 0xff;
......@@ -181,7 +181,7 @@ void proc_read_inode(struct inode * inode)
}
inode->i_op = &proc_link_inode_operations;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
inode->i_mode = S_IFLNK | S_IRWXU;
return;
}
return;
......
......@@ -24,7 +24,7 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou
{
unsigned long addr, pid, cr3;
char *tmp;
unsigned long pde, pte, page;
unsigned long pte, page;
int i;
if (count < 0)
......@@ -44,18 +44,17 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou
while (count > 0) {
if (current->signal & ~current->blocked)
break;
pde = cr3 + (addr >> 20 & 0xffc);
pte = *(unsigned long *) pde;
pte = *PAGE_DIR_OFFSET(cr3,addr);
if (!(pte & PAGE_PRESENT))
break;
pte &= 0xfffff000;
pte += (addr >> 10) & 0xffc;
pte &= PAGE_MASK;
pte += PAGE_PTR(addr);
page = *(unsigned long *) pte;
if (!(page & 1))
break;
page &= 0xfffff000;
page += addr & 0xfff;
i = 4096-(addr & 0xfff);
page &= PAGE_MASK;
page += addr & ~PAGE_MASK;
i = PAGE_SIZE-(addr & ~PAGE_MASK);
if (i > count)
i = count;
memcpy_tofs(tmp,(void *) page,i);
......@@ -73,7 +72,7 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co
{
unsigned long addr, pid, cr3;
char *tmp;
unsigned long pde, pte, page;
unsigned long pte, page;
int i;
if (count < 0)
......@@ -93,12 +92,11 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co
while (count > 0) {
if (current->signal & ~current->blocked)
break;
pde = cr3 + (addr >> 20 & 0xffc);
pte = *(unsigned long *) pde;
pte = *PAGE_DIR_OFFSET(cr3,addr);
if (!(pte & PAGE_PRESENT))
break;
pte &= 0xfffff000;
pte += (addr >> 10) & 0xffc;
pte &= PAGE_MASK;
pte += PAGE_PTR(addr);
page = *(unsigned long *) pte;
if (!(page & PAGE_PRESENT))
break;
......@@ -106,9 +104,9 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co
do_wp_page(0,addr,current,0);
continue;
}
page &= 0xfffff000;
page += addr & 0xfff;
i = 4096-(addr & 0xfff);
page &= PAGE_MASK;
page += addr & ~PAGE_MASK;
i = PAGE_SIZE-(addr & ~PAGE_MASK);
if (i > count)
i = count;
memcpy_fromfs((void *) page,tmp,i);
......
......@@ -164,8 +164,7 @@ static int proc_readnet(struct inode * inode, struct file * file,
if (count < 0)
return -EINVAL;
page = (char *) get_free_page(GFP_KERNEL);
if (!page)
if (!(page = (char*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
ino = inode->i_ino;
switch (ino) {
......
......@@ -104,8 +104,7 @@ int do_select(int n, fd_set *in, fd_set *out, fd_set *ex,
}
end_check:
n = max + 1;
entry = (struct select_table_entry *) __get_free_page(GFP_KERNEL);
if (!entry)
if(!(entry = (struct select_table_entry*) __get_free_page(GFP_KERNEL)))
return -ENOMEM;
FD_ZERO(res_in);
FD_ZERO(res_out);
......@@ -219,7 +218,7 @@ extern "C" int sys_select( unsigned long *buffer )
if ((i = get_fd_set(n, inp, &in)) ||
(i = get_fd_set(n, outp, &out)) ||
(i = get_fd_set(n, exp, &ex))) return i;
timeout = 0xffffffff;
timeout = ~0UL;
if (tvp) {
i = verify_area(VERIFY_WRITE, tvp, sizeof(*tvp));
if (i)
......
......@@ -176,7 +176,7 @@ static dev_t get_unnamed_dev(void)
memset(unnamed_dev_in_use, 0, sizeof(unnamed_dev_in_use));
unnamed_dev_in_use[0] = 1; /* minor 0 (nodev) is special */
}
for (i = 0; i < 256; i++) {
for (i = 0; i < sizeof unnamed_dev_in_use/sizeof unnamed_dev_in_use[0]; i++) {
if (!unnamed_dev_in_use[i]) {
unnamed_dev_in_use[i] = 1;
return (UNNAMED_MAJOR << 8) | i;
......@@ -254,15 +254,18 @@ extern "C" int sys_umount(char * name)
if (!suser())
return -EPERM;
retval = namei(name,&inode);
if (retval)
return retval;
if (retval) {
retval = lnamei(name,&inode);
if (retval)
return retval;
}
if (S_ISBLK(inode->i_mode)) {
dev = inode->i_rdev;
if (IS_NODEV(inode)) {
iput(inode);
return -EACCES;
}
} else if (S_ISDIR(inode->i_mode)) {
} else {
if (!inode || !inode->i_sb || inode != inode->i_sb->s_mounted) {
iput(inode);
return -EINVAL;
......@@ -272,9 +275,6 @@ extern "C" int sys_umount(char * name)
memset(&dummy_inode, 0, sizeof(dummy_inode));
dummy_inode.i_rdev = dev;
inode = &dummy_inode;
} else {
iput(inode);
return -EINVAL;
}
if (MAJOR(dev) >= MAX_BLKDEV) {
iput(inode);
......@@ -382,7 +382,7 @@ static int do_remount(const char *dir,int flags)
* Flags is a 16-bit value that allows up to 16 non-fs dependent flags to
* be given to the mount() call (ie: read-only, no-dev, no-suid etc).
*
* data is a (void *) that can point to any structure up to 4095 bytes, which
* data is a (void *) that can point to any structure up to PAGE_SIZE-1 bytes, which
* can contain arbitrary fs-dependent information (or be NULL).
*
* NOTE! As old versions of mount() didn't use this setup, the flags has to have
......@@ -458,10 +458,13 @@ extern "C" int sys_mount(char * dev_name, char * dir_name, char * type,
iput(inode);
return -EFAULT;
}
page = get_free_page(GFP_KERNEL);
if (!(page = __get_free_page(GFP_KERNEL))) {
iput(inode);
return -ENOMEM;
}
i = TASK_SIZE - (unsigned long) data;
if (i < 0 || i > 4095)
i = 4095;
if ((unsigned long) i >= PAGE_SIZE)
i = PAGE_SIZE-1;
memcpy_fromfs((void *) page,data,i);
}
}
......
......@@ -373,7 +373,7 @@ int xiafs_mkdir(struct inode * dir, const char * name, int len, int mode)
inode->i_nlink = 2;
dir_block->b_dirt = 1;
brelse(dir_block);
inode->i_mode = S_IFDIR | (mode & 0777 & ~current->umask);
inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->umask);
if (dir->i_mode & S_ISGID)
inode->i_mode |= S_ISGID;
inode->i_dirt = 1;
......@@ -594,7 +594,7 @@ int xiafs_symlink(struct inode * dir, const char * name,
iput(dir);
return -ENOSPC;
}
inode->i_mode = S_IFLNK | 0777;
inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_op = &xiafs_symlink_inode_operations;
name_block = xiafs_bread(inode,0,1);
if (!name_block) {
......
#ifndef _ASM_BITOPS_H
#define _ASM_BITOPS_H
/*
* Copyright 1992, Linus Torvalds.
*/
......@@ -18,7 +19,7 @@
struct __dummy { unsigned long a[100]; };
#define ADDR (*(struct __dummy *) addr)
extern inline int set_bit(int nr, void * addr)
extern __inline__ int set_bit(int nr, void * addr)
{
int oldbit;
......@@ -28,7 +29,7 @@ extern inline int set_bit(int nr, void * addr)
return oldbit;
}
extern inline int clear_bit(int nr, void * addr)
extern __inline__ int clear_bit(int nr, void * addr)
{
int oldbit;
......@@ -42,7 +43,7 @@ extern inline int clear_bit(int nr, void * addr)
* This routine doesn't need to be atomic, but it's faster to code it
* this way.
*/
extern inline int test_bit(int nr, void * addr)
extern __inline__ int test_bit(int nr, void * addr)
{
int oldbit;
......@@ -68,7 +69,7 @@ extern inline int test_bit(int nr, void * addr)
* C language equivalents written by Theodore Ts'o, 9/26/92
*/
extern inline int set_bit(int nr,int * addr)
extern __inline__ int set_bit(int nr,int * addr)
{
int mask, retval;
......@@ -81,7 +82,7 @@ extern inline int set_bit(int nr,int * addr)
return retval;
}
extern inline int clear_bit(int nr, int * addr)
extern __inline__ int clear_bit(int nr, int * addr)
{
int mask, retval;
......@@ -94,7 +95,7 @@ extern inline int clear_bit(int nr, int * addr)
return retval;
}
extern inline int test_bit(int nr, int * addr)
extern __inline__ int test_bit(int nr, int * addr)
{
int mask;
......
#ifndef _ASM_SEGMENT_H
#define _ASM_SEGMENT_H
static inline unsigned char get_fs_byte(const char * addr)
{
register unsigned char _v;
......@@ -164,3 +167,4 @@ static inline void set_fs(unsigned long val)
__asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val));
}
#endif /* _ASM_SEGMENT_H */
......@@ -76,13 +76,13 @@ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
_set_gate(a,12,3,addr)
#define _set_seg_desc(gate_addr,type,dpl,base,limit) {\
*(gate_addr) = ((base) & 0xff000000) | \
*((gate_addr)+1) = ((base) & 0xff000000) | \
(((base) & 0x00ff0000)>>16) | \
((limit) & 0xf0000) | \
((dpl)<<13) | \
(0x00408000) | \
((type)<<8); \
*((gate_addr)+1) = (((base) & 0x0000ffff)<<16) | \
*(gate_addr) = (((base) & 0x0000ffff)<<16) | \
((limit) & 0x0ffff); }
#define _set_tssldt_desc(n,addr,limit,type) \
......@@ -100,6 +100,8 @@ __asm__ __volatile__ ("movw $" #limit ",%1\n\t" \
)
#define set_tss_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),235,"0x89")
#define set_ldt_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),23,"0x82")
#define set_ldt_desc(n,addr,size) \
_set_tssldt_desc(((char *) (n)),((int)(addr)),((size << 3) - 1),"0x82")
#endif
......@@ -134,7 +134,7 @@ enum machine_type {
#endif
#ifdef linux
#define PAGE_SIZE 4096
#include <linux/page.h>
#define SEGMENT_SIZE 1024
#endif
......
#ifndef _LINUX_BINFMTS_H
#define _LINUX_BINFMTS_H
/*
* MAX_ARG_PAGES defines the number of pages allocated for arguments
* and envelope for the new program. 32 should suffice, this gives
* a maximum env+arg of 128kB !
*/
#define MAX_ARG_PAGES 32
/*
* This structure is used to hold the arguments that are used when loading binaries.
*/
struct linux_binprm{
char buf[128];
unsigned long page[MAX_ARG_PAGES];
unsigned long p;
struct inode * inode;
int e_uid, e_gid;
int argc, envc;
char * filename; /* Name of binary */
};
/* This structure defines the functions that are used to load the binary formats that
* linux accepts. */
struct linux_binfmt{
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
int (*load_shlib)(int fd);
};
extern struct linux_binfmt formats[];
#endif
......@@ -83,8 +83,8 @@
struct mouse_status {
char buttons;
char latch_buttons;
unsigned char buttons;
unsigned char latch_buttons;
int dx;
int dy;
int present;
......
/*
* Definitions for a Sony interface CDROM drive.
*
* Corey Minyard (minyard@wf-rch.cirr.com)
*
* Copyright (C) 1993 Corey Minyard
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Offsets (from the base address) and bits for the various write registers
* of the drive.
*/
#define SONY_CMD_REG_OFFSET 0
#define SONY_PARAM_REG_OFFSET 1
#define SONY_WRITE_REG_OFFSET 2
#define SONY_CONTROL_REG_OFFSET 3
# define SONY_ATTN_CLR_BIT 0x01
# define SONY_RES_RDY_CLR_BIT 0x02
# define SONY_DATA_RDY_CLR_BIT 0x04
# define SONY_ATTN_INT_EN_BIT 0x08
# define SONY_RES_RDY_INT_EN_BIT 0x10
# define SONY_DATA_RDY_INT_EN_BIT 0x20
# define SONY_PARAM_CLR_BIT 0x40
# define SONY_DRIVE_RESET_BIT 0x80
/*
* Offsets (from the base address) and bits for the various read registers
* of the drive.
*/
#define SONY_STATUS_REG_OFFSET 0
# define SONY_ATTN_BIT 0x01
# define SONY_RES_RDY_BIT 0x02
# define SONY_DATA_RDY_BIT 0x04
# define SONY_ATTN_INT_ST_BIT 0x08
# define SONY_RES_RDY_INT_ST_BIT 0x10
# define SONY_DATA_RDY_INT_ST_BIT 0x20
# define SONY_DATA_REQUEST_BIT 0x40
# define SONY_BUSY_BIT 0x80
#define SONY_RESULT_REG_OFFSET 1
#define SONY_READ_REG_OFFSET 2
#define SONY_FIFOST_REG_OFFSET 3
# define SONY_PARAM_WRITE_RDY_BIT 0x01
# define SONY_PARAM_REG_EMPTY_BIT 0x02
# define SONY_RES_REG_NOT_EMP_BIT 0x04
# define SONY_RES_REG_FULL_BIT 0x08
#define LOG_START_OFFSET 150 /* Offset of first logical sector */
#define SONY_DETECT_TIMEOUT 80 /* Maximum amount of time
that drive detection code
will wait for response
from drive (in 1/100th's
of seconds). */
#define SONY_JIFFIES_TIMEOUT 500 /* Maximum number of times the
drive will wait/try for an
operation */
#define SONY_RESET_TIMEOUT 100 /* Maximum number of times the
drive will wait/try a reset
operation */
#define SONY_READY_RETRIES 20000 /* How many times to retry a
spin waiting for a register
to come ready */
#define MAX_CDU31A_RETRIES 3 /* How many times to retry an
operation */
/* Commands to request or set drive control parameters and disc information */
#define SONY_REQ_DRIVE_CONFIG_CMD 0x00 /* Returns s_sony_drive_config */
#define SONY_REQ_DRIVE_MODE_CMD 0x01
#define SONY_REQ_DRIVE_PARAM_CMD 0x02
#define SONY_REQ_MECH_STATUS_CMD 0x03
#define SONY_REQ_AUDIO_STATUS_CMD 0x04
#define SONY_SET_DRIVE_PARAM_CMD 0x10
#define SONY_REQ_TOC_DATA_CMD 0x20 /* Returns s_sony_toc */
#define SONY_REQ_SUBCODE_ADDRESS_CMD 0x21 /* Returns s_sony_subcode */
#define SONY_REQ_UPC_EAN_CMD 0x22
#define SONY_REQ_ISRC_CMD 0x23
#define SONY_REQ_TOC_DATA_SPEC_CMD 0x24
/* Commands to request information from the drive */
#define SONY_READ_TOC_CMD 0x30
#define SONY_SEEK_CMD 0x31
#define SONY_READ_CMD 0x32
#define SONY_READ_BLKERR_STAT_CMD 0x34
#define SONY_ABORT_CMD 0x35
#define SONY_READ_TOC_SPEC_CMD 0x36
/* Commands to control audio */
#define SONY_AUDIO_PLAYBACK_CMD 0x40
#define SONY_AUDIO_STOP_CMD 0x41
#define SONY_AUDIO_SCAN_CMD 0x42
/* Miscellaneous control commands */
#define SONY_EJECT_CMD 0x50
#define SONY_SPIN_UP_CMD 0x51
#define SONY_SPIN_DOWN_CMD 0x52
/* Diagnostic commands */
#define SONY_WRITE_BUFFER_CMD 0x60
#define SONY_READ_BUFFER_CMD 0x61
#define SONY_DIAGNOSTICS_CMD 0x62
/*
* The following are command paramters for the set drive parameter command
*/
#define SONY_SD_DECODE_PARAM 0x00
#define SONY_SD_INTERFACE_PARAM 0x01
#define SONY_SD_BUFFERING_PARAM 0x02
#define SONY_SD_AUDIO_PARAM 0x03
#define SONY_SD_AUDIO_VOLUME 0x04
#define SONY_SD_MECH_CONTROL 0x05
#define SONY_SD_AUTO_SPIN_DOWN_TIME 0x06
/*
* The following extract information from the drive configuration about
* the drive itself.
*/
#define SONY_HWC_GET_LOAD_MECH(c) (c.hw_config[0] & 0x03)
#define SONY_HWC_EJECT(c) (c.hw_config[0] & 0x04)
#define SONY_HWC_LED_SUPPORT(c) (c.hw_config[0] & 0x08)
#define SONY_HWC_GET_BUF_MEM_SIZE(c) ((c.hw_config[0] & 0xc0) >> 6)
#define SONY_HWC_AUDIO_PLAYBACK(c) (c.hw_config[1] & 0x01)
#define SONY_HWC_ELECTRIC_VOLUME(c) (c.hw_config[1] & 0x02)
#define SONY_HWC_ELECTRIC_VOLUME_CTL(c) (c.hw_config[1] & 0x04)
#define SONY_HWC_CADDY_LOAD_MECH 0x00
#define SONY_HWC_TRAY_LOAD_MECH 0x01
#define SONY_HWC_POPUP_LOAD_MECH 0x02
#define SONY_HWC_UNKWN_LOAD_MECH 0x03
#define SONY_HWC_8KB_BUFFER 0x00
#define SONY_HWC_32KB_BUFFER 0x01
#define SONY_HWC_64KB_BUFFER 0x02
#define SONY_HWC_UNKWN_BUFFER 0x03
/*
* This is the complete status returned from the drive configuration request
* command.
*/
struct s_sony_drive_config
{
unsigned char exec_status[2];
char vendor_id[8];
char product_id[16];
char product_rev_level[8];
unsigned char hw_config[2];
};
/* The following is returned from the request subcode address command */
struct s_sony_subcode
{
unsigned char exec_status[2];
unsigned char address :4;
unsigned char control :4;
unsigned char track_num;
unsigned char index_num;
unsigned char rel_msf[3];
unsigned char reserved1;
unsigned char abs_msf[3];
};
/*
* The following is returned from the request TOC (Table Of Contents) command.
* (last_track_num-first_track_num+1) values are valid in tracks.
*/
struct s_sony_toc
{
unsigned char exec_status[2];
unsigned char address0 :4;
unsigned char control0 :4;
unsigned char point0;
unsigned char first_track_num;
unsigned char disk_type;
unsigned char dummy0;
unsigned char address1 :4;
unsigned char control1 :4;
unsigned char point1;
unsigned char last_track_num;
unsigned char dummy1;
unsigned char dummy2;
unsigned char address2 :4;
unsigned char control2 :4;
unsigned char point2;
unsigned char lead_out_start_msf[3];
struct
{
unsigned char address :4;
unsigned char control :4;
unsigned char track;
unsigned char track_start_msf[3];
} tracks[100];
unsigned int lead_out_start_lba;
};
/*
* The following are errors returned from the drive.
*/
/* Command error group */
#define SONY_ILL_CMD_ERR 0x10
#define SONY_ILL_PARAM_ERR 0x11
/* Mechanism group */
#define SONY_NOT_LOAD_ERR 0x20
#define SONY_NO_DISK_ERR 0x21
#define SONY_NOT_SPIN_ERR 0x22
#define SONY_SPIN_ERR 0x23
#define SONY_SPINDLE_SERVO_ERR 0x25
#define SONY_FOCUS_SERVO_ERR 0x26
#define SONY_EJECT_MECH_ERR 0x29
#define SONY_AUDIO_PLAYING_ERR 0x2a
#define SONY_EMERGENCY_EJECT_ERR 0x2c
/* Seek error group */
#define SONY_FOCUS_ERR 0x30
#define SONY_FRAME_SYNC_ERR 0x31
#define SONY_SUBCODE_ADDR_ERR 0x32
#define SONY_BLOCK_SYNC_ERR 0x33
#define SONY_HEADER_ADDR_ERR 0x34
/* Read error group */
#define SONY_ILL_TRACK_R_ERR 0x40
#define SONY_MODE_0_R_ERR 0x41
#define SONY_ILL_MODE_R_ERR 0x42
#define SONY_ILL_BLOCK_SIZE_R_ERR 0x43
#define SONY_MODE_R_ERR 0x44
#define SONY_FORM_R_ERR 0x45
#define SONY_LEAD_OUT_R_ERR 0x46
#define SONY_BUFFER_OVERRUN_R_ERR 0x47
/* Data error group */
#define SONY_UNREC_CIRC_ERR 0x53
#define SONY_UNREC_LECC_ERR 0x57
/* Subcode error group */
#define SONY_NO_TOC_ERR 0x60
#define SONY_SUBCODE_DATA_NVAL_ERR 0x61
#define SONY_FOCUS_ON_TOC_READ_ERR 0x63
#define SONY_FRAME_SYNC_ON_TOC_READ_ERR 0x64
#define SONY_TOC_DATA_ERR 0x65
/* Hardware failure group */
#define SONY_HW_FAILURE_ERR 0x70
#define SONY_LEAD_IN_A_ERR 0x91
#define SONY_LEAD_OUT_A_ERR 0x92
#define SONY_DATA_TRACK_A_ERR 0x93
/*
* The following are returned from the Read With Block Error Status command.
* They are not errors but information (Errors from the 0x5x group above may
* also be returned
*/
#define SONY_NO_CIRC_ERR_BLK_STAT 0x50
#define SONY_NO_LECC_ERR_BLK_STAT 0x54
#define SONY_RECOV_LECC_ERR_BLK_STAT 0x55
#define SONY_NO_ERR_DETECTION_STAT 0x59
/*
* The following is not an error returned by the drive, but by the code
* that talks to the drive. It is returned because of a timeout.
*/
#define SONY_TIMEOUT_OP_ERR 0x01
#define SONY_SIGNAL_OP_ERR 0x02
/*
* The following are attention code for asyncronous events from the drive.
*/
/* Standard attention group */
#define SONY_EMER_EJECT_ATTN 0x2c
#define SONY_HW_FAILURE_ATTN 0x70
#define SONY_MECH_LOADED_ATTN 0x80
#define SONY_EJECT_PUSHED_ATTN 0x81
/* Audio attention group */
#define SONY_AUDIO_PLAY_DONE_ATTN 0x90
#define SONY_LEAD_IN_ERR_ATTN 0x91
#define SONY_LEAD_OUT_ERR_ATTN 0x92
#define SONY_DATA_TRACK_ERR_ATTN 0x93
#define SONY_AUDIO_PLAYBACK_ERR_ATTN 0x94
/* Auto spin up group */
#define SONY_SPIN_UP_COMPLETE_ATTN 0x24
#define SONY_SPINDLE_SERVO_ERR_ATTN 0x25
#define SONY_FOCUS_SERVO_ERR_ATTN 0x26
#define SONY_TOC_READ_DONE_ATTN 0x62
#define SONY_FOCUS_ON_TOC_READ_ERR_ATTN 0x63
#define SONY_SYNC_ON_TOC_READ_ERR_ATTN 0x65
/* Auto eject group */
#define SONY_SPIN_DOWN_COMPLETE_ATTN 0x27
#define SONY_EJECT_COMPLETE_ATTN 0x28
#define SONY_EJECT_MECH_ERR_ATTN 0x29
......@@ -13,9 +13,7 @@
#define UTS_NODENAME "(none)" /* set by sethostname() */
#endif
#ifdef CONFIG_M486
#define UTS_MACHINE "i486" /* hardware type */
#else
#ifndef UTS_MACHINE
#define UTS_MACHINE "i386" /* hardware type */
#endif
......
......@@ -28,8 +28,8 @@
/*
* The second extended file system version
*/
#define EXT2FS_DATE "93/06/06"
#define EXT2FS_VERSION "0.3a"
#define EXT2FS_DATE "93/08/05"
#define EXT2FS_VERSION "0.3c"
/*
* Special inodes numbers
......@@ -38,6 +38,7 @@
#define EXT2_ROOT_INO 2 /* Root inode */
#define EXT2_ACL_IDX_INO 3 /* ACL inode */
#define EXT2_ACL_DATA_INO 4 /* ACL inode */
#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
#define EXT2_FIRST_INO 11 /* First non reserved inode */
/*
......@@ -65,7 +66,7 @@
#define EXT2_ACLE_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (unsigned long))
#ifdef __KERNEL__
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->u.ext2_sb.s_log_block_size + 10)
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->u.ext2_sb.s_es->s_log_block_size + 10)
#else
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
#endif
......@@ -98,12 +99,12 @@ struct ext2_acl_header /* Header of Access Control Lists */
struct ext2_acl_entry /* Access Control List Entry */
{
unsigned long acle_size;
unsigned long acle_size;
unsigned short acle_perms; /* Access permissions */
unsigned short acle_type; /* Type of entry */
unsigned short acle_tag; /* User or group identity */
unsigned short acle_pad1;
unsigned long acle_next; /* Pointer on next entry for the */
unsigned long acle_next; /* Pointer on next entry for the */
/* same inode or on next free entry */
};
......@@ -112,23 +113,23 @@ struct ext2_acl_entry /* Access Control List Entry */
*/
struct ext2_old_group_desc
{
unsigned long bg_block_bitmap; /* Blocks bitmap block */
unsigned long bg_inode_bitmap; /* Inodes bitmap block */
unsigned long bg_inode_table; /* Inodes table block */
unsigned long bg_block_bitmap; /* Blocks bitmap block */
unsigned long bg_inode_bitmap; /* Inodes bitmap block */
unsigned long bg_inode_table; /* Inodes table block */
unsigned short bg_free_blocks_count; /* Free blocks count */
unsigned short bg_free_inodes_count; /* Free inodes count */
};
struct ext2_group_desc
{
unsigned long bg_block_bitmap; /* Blocks bitmap block */
unsigned long bg_inode_bitmap; /* Inodes bitmap block */
unsigned long bg_inode_table; /* Inodes table block */
unsigned long bg_block_bitmap; /* Blocks bitmap block */
unsigned long bg_inode_bitmap; /* Inodes bitmap block */
unsigned long bg_inode_table; /* Inodes table block */
unsigned short bg_free_blocks_count; /* Free blocks count */
unsigned short bg_free_inodes_count; /* Free inodes count */
unsigned short bg_used_dirs_count; /* Directories count */
unsigned short bg_pad;
unsigned long bg_reserved[3];
unsigned long bg_reserved[3];
};
/*
......@@ -147,11 +148,11 @@ struct ext2_group_desc
/*
* Constants relative to the data blocks
*/
#define EXT2_NDIR_BLOCKS 12
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
#define EXT2_NDIR_BLOCKS 12
#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
/*
* Structure of an inode on the disk
......@@ -159,50 +160,50 @@ struct ext2_group_desc
struct ext2_inode {
unsigned short i_mode; /* File mode */
unsigned short i_uid; /* Owner Uid */
unsigned long i_size; /* Size in bytes */
unsigned long i_atime; /* Access time */
unsigned long i_ctime; /* Creation time */
unsigned long i_mtime; /* Modification time */
unsigned long i_dtime; /* Deletion Time */
unsigned long i_size; /* Size in bytes */
unsigned long i_atime; /* Access time */
unsigned long i_ctime; /* Creation time */
unsigned long i_mtime; /* Modification time */
unsigned long i_dtime; /* Deletion Time */
unsigned short i_gid; /* Group Id */
unsigned short i_links_count; /* Links count */
unsigned long i_blocks; /* Blocks count */
unsigned long i_flags; /* File flags */
unsigned long i_reserved1;
unsigned long i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
unsigned long i_version; /* File version (for NFS) */
unsigned long i_file_acl; /* File ACL */
unsigned long i_dir_acl; /* Directory ACL */
unsigned long i_faddr; /* Fragment address */
unsigned char i_frag; /* Fragment number */
unsigned char i_fsize; /* Fragment size */
unsigned long i_blocks; /* Blocks count */
unsigned long i_flags; /* File flags */
unsigned long i_reserved1;
unsigned long i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
unsigned long i_version; /* File version (for NFS) */
unsigned long i_file_acl; /* File ACL */
unsigned long i_dir_acl; /* Directory ACL */
unsigned long i_faddr; /* Fragment address */
unsigned char i_frag; /* Fragment number */
unsigned char i_fsize; /* Fragment size */
unsigned short i_pad1;
unsigned long i_reserved2[2];
unsigned long i_reserved2[2];
};
/*
* Structure of the super block
*/
struct ext2_super_block {
unsigned long s_inodes_count; /* Inodes count */
unsigned long s_blocks_count; /* Blocks count */
unsigned long s_r_blocks_count; /* Reserved blocks count */
unsigned long s_free_blocks_count;/* Free blocks count */
unsigned long s_free_inodes_count;/* Free inodes count */
unsigned long s_first_data_block;/* First Data Block */
unsigned long s_log_block_size; /* Block size */
long s_log_frag_size; /* Fragment size */
unsigned long s_blocks_per_group;/* # Blocks per group */
unsigned long s_frags_per_group;/* # Fragments per group */
unsigned long s_inodes_per_group;/* # Inodes per group */
unsigned long s_mtime; /* Mount time */
unsigned long s_wtime; /* Write time */
unsigned long s_pad; /* Padding to get the magic signature*/
unsigned long s_inodes_count; /* Inodes count */
unsigned long s_blocks_count; /* Blocks count */
unsigned long s_r_blocks_count;/* Reserved blocks count */
unsigned long s_free_blocks_count;/* Free blocks count */
unsigned long s_free_inodes_count;/* Free inodes count */
unsigned long s_first_data_block;/* First Data Block */
unsigned long s_log_block_size;/* Block size */
long s_log_frag_size; /* Fragment size */
unsigned long s_blocks_per_group;/* # Blocks per group */
unsigned long s_frags_per_group;/* # Fragments per group */
unsigned long s_inodes_per_group;/* # Inodes per group */
unsigned long s_mtime; /* Mount time */
unsigned long s_wtime; /* Write time */
unsigned long s_pad; /* Padding to get the magic signature*/
/* at the same offset as in the */
/* previous ext fs */
unsigned short s_magic; /* Magic signature */
unsigned short s_valid; /* Flag */
unsigned long s_reserved[243]; /* Padding to the end of the block */
unsigned long s_reserved[243]; /* Padding to the end of the block */
};
/*
......@@ -211,10 +212,10 @@ struct ext2_super_block {
#define EXT2_NAME_LEN 255
struct ext2_dir_entry {
unsigned long inode; /* Inode number */
unsigned short rec_len; /* Directory entry length */
unsigned short name_len; /* Name length */
char name[EXT2_NAME_LEN]; /* File name */
unsigned long inode; /* Inode number */
unsigned short rec_len; /* Directory entry length */
unsigned short name_len; /* Name length */
char name[EXT2_NAME_LEN]; /* File name */
};
/*
......@@ -227,6 +228,7 @@ struct ext2_dir_entry {
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
#ifdef __KERNEL__
/*
* Function prototypes
*/
......@@ -261,7 +263,7 @@ extern int ext2_read (struct inode *, struct file *, char *, int);
extern int ext2_write (struct inode *, struct file *, char *, int);
/* fsync.c */
extern int ext2_sync_file(struct inode *, struct file *);
extern int ext2_sync_file (struct inode *, struct file *);
/* ialloc.c */
extern struct inode * ext2_new_inode (const struct inode *, int);
......@@ -320,3 +322,5 @@ extern struct inode_operations ext2_file_inode_operations;
extern struct inode_operations ext2_symlink_inode_operations;
#endif
#endif
......@@ -5,19 +5,19 @@
* second extended file system inode data in memory
*/
struct ext2_inode_info {
unsigned long i_data[15];
unsigned long i_flags;
unsigned long i_faddr;
unsigned char i_frag;
unsigned char i_fsize;
unsigned long i_data[15];
unsigned long i_flags;
unsigned long i_faddr;
unsigned char i_frag;
unsigned char i_fsize;
unsigned short i_pad1;
unsigned long i_file_acl;
unsigned long i_dir_acl;
unsigned long i_dtime;
unsigned long i_version;
unsigned long i_block_group;
unsigned long i_next_alloc_block;
unsigned long i_next_alloc_goal;
unsigned long i_file_acl;
unsigned long i_dir_acl;
unsigned long i_dtime;
unsigned long i_version;
unsigned long i_block_group;
unsigned long i_next_alloc_block;
unsigned long i_next_alloc_goal;
};
#endif
......@@ -8,12 +8,6 @@
* second extended-fs super-block data in memory
*/
struct ext2_sb_info {
unsigned long s_inodes_count; /* Inodes count */
unsigned long s_blocks_count; /* Blocks count */
unsigned long s_r_blocks_count; /* Reserved blocks count */
unsigned long s_first_data_block;/* First data block */
unsigned long s_log_block_size; /* Log of block size */
long s_log_frag_size; /* Log of fragment size */
unsigned long s_frag_size; /* Size of a fragment in bytes */
unsigned long s_frags_per_block;/* Number of fragments per block */
unsigned long s_inodes_per_block;/* Number of inodes per block */
......@@ -23,6 +17,7 @@ struct ext2_sb_info {
unsigned long s_desc_per_block; /* Number of group descriptors per block */
unsigned long s_groups_count; /* Number of groups in the fs */
struct buffer_head * s_sbh; /* Buffer containing the super block */
struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
struct buffer_head * s_group_desc[EXT2_MAX_GROUP_DESC];
unsigned short s_loaded_inode_bitmaps;
unsigned short s_loaded_block_bitmaps;
......
......@@ -28,7 +28,7 @@
#define NR_SUPER 32
#define NR_HASH 997
#define NR_IHASH 131
#define NR_FILE_LOCKS 32
#define NR_FILE_LOCKS 64
#define BLOCK_SIZE 1024
#define BLOCK_SIZE_BITS 10
#define MAX_CHRDEV 32
......@@ -124,6 +124,12 @@ extern unsigned long file_table_init(unsigned long start, unsigned long end);
#define BLKROGET 4702 /* get read-only status (0 = read_write) */
#define BLKRRPART 4703 /* re-read partition table */
#define BLKGETSIZE 4704 /* return device size */
#define BLKFLSBUF 4705 /* flush buffer cache */
/* These are a few other constants only used by scsi devices */
#define SCSI_IOCTL_GET_IDLUN 0x5382
#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
#define FIBMAP 1 /* bmap access */
......
/* $Id: ioctl.h,v 1.2 1992/11/18 01:31:16 root Exp root $
/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $
*
* linux/ioctl.h for Linux by H.H. Bergman.
*/
......@@ -8,11 +8,13 @@
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
* size of the parameter structure in the upper 14 bits.
* Encoding size in ioctl request is useful for catching old versions
* size of the parameter structure in the lower 14 bits of the
* upper 16 bits.
* Encoding the size of the parameter structure in the ioctl request
* is useful for catching programs compiled with old versions
* and to avoid overwriting user space outside the user buffer area.
* The highest 2 bits are reserved.
* NOTE: This limits the max blocksize to 16kB -1 !
* The highest 2 bits are reserved for indicating the ``access mode''.
* NOTE: This limits the max parameter size to 16kB -1 !
*/
#define IOC_VOID 0x00000000 /* param in size field */
......@@ -24,17 +26,22 @@
#define IOCCMD_MASK 0x0000ffff /* command code */
#define IOCCMD_SHIFT 0
#define _IO(c,d) (IOC_VOID | ((d)<<16) | c) /* param encoded */
/* use _IOXX(magic, subcode, arg_t) where arg_t is the type of the
/* _IO(magic, subcode); size field is zero and the
* subcode determines the command.
*/
#define _IO(c,d) (IOC_VOID | ((c)<<8) | (d)) /* param encoded */
/* _IOXX(magic, subcode, arg_t); where arg_t is the type of the
* (last) argument field in the ioctl call, if present.
*/
#define _IOW(c,d,t) (IOC_IN | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
((c)<<8) | (d))
#define _IOR(c,d,t) (IOC_OUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
((c)<<8) | (d))
/* WR rather than RW to avoid conflict with stdio.h */
#define _IOWR(c,d,t) (IOC_INOUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
((c)<<8) | (d))
#endif /* _LINUX_IOCTL_H */
......@@ -176,4 +176,11 @@ struct kbentry {
#define KDGKBENT 0x4B46 /* gets one entry in translation table */
#define KDSKBENT 0x4B47 /* sets one entry in translation table */
struct kbsentry {
u_char kb_func;
u_char kb_string[512]; /* FUNC_BUFSIZE from keyboard.h */
};
#define KDGKBSENT 0x4B48 /* gets one function key string entry */
#define KDSKBSENT 0x4B49 /* sets one function key string entry */
#endif /* _LINUX_KD_H */
......@@ -9,6 +9,11 @@
#include <linux/config.h>
#define INT_MAX ((int)(~0U>>1))
#define UINT_MAX (~0U)
#define LONG_MAX ((long)(~0UL>>1))
#define ULONG_MAX (~0UL)
#define VERIFY_READ 0
#define VERIFY_WRITE 1
......
......@@ -4,31 +4,6 @@
#include <linux/interrupt.h>
#define set_leds() mark_bh(KEYBOARD_BH)
/*
* Global flags: things that don't change between virtual consoles.
* This includes things like "key-down" flags - if the shift key is
* down when you change a console, it's down in both.
*
* Note that the KG_CAPSLOCK flags is NOT the flag that decides if
* capslock is on or not: it's just a flag about the key being
* physically down. The actual capslock status is in the local flags.
*/
extern unsigned long kbd_flags;
/*
* These are the hardcoded global flags - use the numbers beyond 16
* for non-standard or keyboard-dependent flags
*/
#define KG_LSHIFT 0
#define KG_RSHIFT 1
#define KG_LCTRL 2
#define KG_RCTRL 3
#define KG_LALT 4
#define KG_RALT 5 /* doesn't exist, but.. */
#define KG_LALTGR 6 /* doesn't exist, but.. */
#define KG_RALTGR 7
#define KG_CAPSLOCK 8
/*
* "dead" keys - prefix key values that are valid only for the next
* character code (sticky shift, E0/E1 special scancodes, diacriticals)
......@@ -72,26 +47,6 @@ extern struct kbd_struct kbd_table[];
extern unsigned long kbd_init(unsigned long);
extern inline int kbd_flag(int flag)
{
return kbd_flags & (1 << flag);
}
extern inline void set_kbd_flag(int flag)
{
kbd_flags |= 1 << flag;
}
extern inline void clr_kbd_flag(int flag)
{
kbd_flags &= ~(1 << flag);
}
extern inline void chg_kbd_flag(int flag)
{
kbd_flags ^= 1 << flag;
}
extern inline int kbd_dead(int flag)
{
return kbd_prev_dead_keys & (1 << flag);
......@@ -132,12 +87,17 @@ extern inline void chg_vc_kbd_flag(struct kbd_struct * kbd, int flag)
kbd->flags ^= 1 << flag;
}
#define NR_KEYS 112
#define NR_KEYMAPS 3
#define NR_KEYS 128
#define NR_KEYMAPS 16
extern const int NR_TYPES;
extern const int max_vals[];
extern unsigned short key_map[NR_KEYMAPS][NR_KEYS];
#define NR_FUNC 32
#define FUNC_BUFSIZE 512
extern char func_buf[FUNC_BUFSIZE];
extern char *func_table[NR_FUNC];
#define KT_LATIN 0 /* we depend on this being zero */
#define KT_FN 1
#define KT_SPEC 2
......@@ -146,6 +106,8 @@ extern unsigned short key_map[NR_KEYMAPS][NR_KEYS];
#define KT_CONS 5
#define KT_CUR 6
#define KT_SHIFT 7
#define KT_META 8
#define KT_ASCII 9
#define K(t,v) (((t)<<8)|(v))
#define KTYP(x) ((x) >> 8)
......@@ -188,6 +150,10 @@ extern unsigned short key_map[NR_KEYMAPS][NR_KEYS];
#define K_CAPS K(KT_SPEC,7)
#define K_NUM K(KT_SPEC,8)
#define K_HOLD K(KT_SPEC,9)
#define K_SCROLLFORW K(KT_SPEC,10)
#define K_SCROLLBACK K(KT_SPEC,11)
#define K_BOOT K(KT_SPEC,12)
#define K_CAPSON K(KT_SPEC,13)
#define K_P0 K(KT_PAD,0)
#define K_P1 K(KT_PAD,1)
......@@ -218,16 +184,29 @@ extern unsigned short key_map[NR_KEYMAPS][NR_KEYS];
#define K_RIGHT K(KT_CUR,2)
#define K_UP K(KT_CUR,3)
#define K_LSHIFT K(KT_SHIFT,KG_LSHIFT)
#define K_RSHIFT K(KT_SHIFT,KG_RSHIFT)
#define K_LCTRL K(KT_SHIFT,KG_LCTRL)
#define K_RCTRL K(KT_SHIFT,KG_RCTRL)
#define K_LALT K(KT_SHIFT,KG_LALT)
#define K_RALT K(KT_SHIFT,KG_RALT)
#define K_LALTGR K(KT_SHIFT,KG_LALTGR)
#define K_RALTGR K(KT_SHIFT,KG_RALTGR)
#define K_ALT K_LALT
#define K_ALTGR K_RALTGR
#define KG_SHIFT 0
#define KG_CTRL 2
#define KG_ALT 3
#define KG_ALTGR 1
#define K_SHIFT K(KT_SHIFT,KG_SHIFT)
#define K_CTRL K(KT_SHIFT,KG_CTRL)
#define K_ALT K(KT_SHIFT,KG_ALT)
#define K_ALTGR K(KT_SHIFT,KG_ALTGR)
#define NR_SHIFT 16
#define K_CAPSSHIFT K(KT_SHIFT,NR_SHIFT)
#define K_ASC0 K(KT_ASCII,0)
#define K_ASC1 K(KT_ASCII,1)
#define K_ASC2 K(KT_ASCII,2)
#define K_ASC3 K(KT_ASCII,3)
#define K_ASC4 K(KT_ASCII,4)
#define K_ASC5 K(KT_ASCII,5)
#define K_ASC6 K(KT_ASCII,6)
#define K_ASC7 K(KT_ASCII,7)
#define K_ASC8 K(KT_ASCII,8)
#define K_ASC9 K(KT_ASCII,9)
#endif
/*
* ldt.h
*
* Definitions of structures used with the modify_ldt system call.
*/
#ifndef _LINUX_LDT_H
#define _LINUX_LDT_H
struct modify_ldt_ldt_s {
unsigned int entry_number;
unsigned long base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
};
#define MODIFY_LDT_CONTENTS_DATA 0
#define MODIFY_LDT_CONTENTS_STACK 1
#define MODIFY_LDT_CONTENTS_CODE 2
extern int get_ldt(void *buffer);
extern int set_ldt_entry(int entry, unsigned long base, unsigned int limit,
int seg_32bit_flag, int contents, int read_only_flag,
int limit_in_pages_flag);
#endif
/*
* Definitions for a Mitsumi CD-ROM interface
*
* Copyright (C) 1992 Martin Harriss
*
* martin@bdsi.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* *** change this to set the I/O port address */
#define MCDPORT(x) (0x320 + (x))
/* *** change this to set the interrupt number */
#define MCD_INTR_NR 11
/* status bits */
#define MST_CMD_CHECK 0x01 /* command error */
#define MST_BUSY 0x02 /* now playing */
#define MST_READ_ERR 0x04 /* read error */
#define MST_DSK_TYPE 0x08
#define MST_SERVO_CHECK 0x10
#define MST_DSK_CHG 0x20 /* disk removed or changed */
#define MST_READY 0x40 /* disk in the drive */
#define MST_DOOR_OPEN 0x80 /* door is open */
/* flag bits */
#define MFL_DATA 0x02 /* data available */
#define MFL_STATUS 0x04 /* status available */
/* commands */
#define MCMD_GET_DISK_INFO 0x10 /* read info from disk */
#define MCMD_GET_Q_CHANNEL 0x20 /* read info from q channel */
#define MCMD_GET_STATUS 0x40
#define MCMD_SET_MODE 0x50
#define MCMD_SOFT_RESET 0x60
#define MCMD_STOP 0x70 /* stop play */
#define MCMD_CONFIG_DRIVE 0x90
#define MCMD_SET_VOLUME 0xAE /* set audio level */
#define MCMD_PLAY_READ 0xC0 /* play or read data */
#define MCMD_GET_VERSION 0xDC
/* borrowed from hd.c */
#define READ_DATA(port, buf, nr) \
__asm__("cld;rep;insb": :"d" (port),"D" (buf),"c" (nr):"cx","di")
#define SET_TIMER(func, jifs) \
((timer_table[MCD_TIMER].expires = jiffies + jifs), \
(timer_table[MCD_TIMER].fn = func), \
(timer_active |= 1<<MCD_TIMER))
#define CLEAR_TIMER timer_active &= ~(1<<MCD_TIMER)
#define MAX_TRACKS 104
struct msf {
unsigned char min;
unsigned char sec;
unsigned char frame;
};
struct mcd_Play_msf {
struct msf start;
struct msf end;
};
struct mcd_DiskInfo {
unsigned char first;
unsigned char last;
struct msf diskLength;
struct msf firstTrack;
};
struct mcd_Toc {
unsigned char ctrl_addr;
unsigned char track;
unsigned char pointIndex;
struct msf trackTime;
struct msf diskTime;
};
#ifndef _LINUX_MM_H
#define _LINUX_MM_H
#define PAGE_SIZE 4096
#define PAGE_SHIFT 12
#include <linux/page.h>
#include <linux/fs.h>
#include <linux/kernel.h>
......
......@@ -103,11 +103,11 @@ struct fat_cache {
/* Convert attribute bits and a mask to the UNIX mode. */
#define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? 0555 : 0777))
#define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
/* Convert the UNIX mode to MS-DOS attribute bits. */
#define MSDOS_MKATTR(m) ((m & 0200) ? ATTR_NONE : ATTR_RO)
#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO)
static inline struct buffer_head *msdos_sread(int dev,int sector,void **start)
......
......@@ -48,6 +48,8 @@ struct mtop {
#define MTSETDENSITY 21 /* set tape density (SCSI) */
#define MTSEEK 22 /* seek to block (Tandberg, etc.) */
#define MTTELL 23 /* tell block (Tandber, etc.) */
#define MTSETDRVBUFFER 24 /* set the drive buffering according to SCSI-2 */
/* ordinary buffered operation with code 1 */
/* structure for MTIOCGET - mag tape get status command */
......
......@@ -8,7 +8,7 @@
#define NFS_MAXGROUPS 16
#define NFS_FHSIZE 32
#define NFS_COOKIESIZE 4
#define NFS_FIFO_DEV -1
#define NFS_FIFO_DEV (-1)
#define NFSMODE_FMT 0170000
#define NFSMODE_DIR 0040000
#define NFSMODE_CHR 0020000
......
......@@ -116,4 +116,9 @@ extern struct inode_operations nfs_dir_inode_operations;
extern struct inode_operations nfs_symlink_inode_operations;
/* linux/fs/nfs/mmap.c */
extern int nfs_mmap(struct inode * inode, struct file * file,
unsigned long addr, size_t len, int prot, unsigned long off);
#endif
#ifndef _LINUX_PAGE_H
#define _LINUX_PAGE_H
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE ((unsigned long)1<<PAGE_SHIFT)
#ifdef __KERNEL__
/* number of bits that fit into a memory pointer */
#define BITS_PER_PTR (8*sizeof(unsigned long))
/* to mask away the intra-page address bits */
#define PAGE_MASK (~(PAGE_SIZE-1))
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
/* to align the pointer to a pointer address */
#define PTR_MASK (~(sizeof(void*)-1))
/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
/* 64-bit machines, beware! SRB. */
#define SIZEOF_PTR_LOG2 2
/* to find an entry in a page-table-directory */
#define PAGE_DIR_OFFSET(base,address) ((unsigned long*)((base)+\
((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)*2&PTR_MASK&~PAGE_MASK)))
/* to find an entry in a page-table */
#define PAGE_PTR(address) \
((unsigned long)(address)>>PAGE_SHIFT-SIZEOF_PTR_LOG2&PTR_MASK&~PAGE_MASK)
/* the no. of pointers that fit on a page */
#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*))
#endif /* __KERNEL__ */
#endif /* _LINUX_PAGE_H */
......@@ -12,7 +12,7 @@
#endif
#ifndef NOGROUP
#define NOGROUP -1
#define NOGROUP (-1)
#endif
#define MAXHOSTNAMELEN 64 /* max length of hostname */
......
......@@ -13,8 +13,8 @@
* structure will lose. This reduces the chances of that happening.
*/
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN -1
#define RUSAGE_BOTH -2 /* sys_wait4() uses this */
#define RUSAGE_CHILDREN (-1)
#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
struct rusage {
struct timeval ru_utime; /* user time used */
......@@ -54,14 +54,14 @@ struct rusage {
#define RLIM_NLIMITS 6
#define RLIM_INFINITY 0x7fffffff
#define RLIM_INFINITY LONG_MAX
struct rlimit {
int rlim_cur;
int rlim_max;
};
#define PRIO_MIN -99
#define PRIO_MIN (-99)
#define PRIO_MAX 14
#define PRIO_PROCESS 0
......
#ifndef _LINUX_SCHED_H
#define _LINUX_SCHED_H
#define NEW_SWAP
/*
* define DEBUG if you want the wait-queues to have some extra
* debugging code. It's not normally used, but might catch some
......@@ -165,7 +167,7 @@ struct task_struct {
int elf_executable:1;
int dumpable:1;
int swappable:1;
unsigned long start_code,end_code,end_data,brk,start_stack,start_mmap;
unsigned long start_code,end_code,end_data,start_brk,brk,start_stack,start_mmap;
unsigned long arg_start, arg_end, env_start, env_end;
long pid,pgrp,session,leader;
int groups[NGROUPS];
......@@ -206,10 +208,17 @@ struct task_struct {
struct sem_undo *semun;
struct file * filp[NR_OPEN];
fd_set close_on_exec;
/* ldt for this task - not currently used */
struct desc_struct ldt[32];
/* ldt for this task - used by Wine. If NULL, default_ldt is used */
struct desc_struct *ldt;
/* tss for this task */
struct tss_struct tss;
#ifdef NEW_SWAP
unsigned long old_maj_flt; /* old value of maj_flt */
unsigned long dec_flt; /* page fault count of the last time */
unsigned long swap_cnt; /* number of pages to swap on next pass */
short swap_table; /* current page table */
short swap_page; /* current page */
#endif NEW_SWAP
};
/*
......@@ -236,7 +245,7 @@ struct task_struct {
/* schedlink */ &init_task,&init_task, \
/* signals */ {{ 0, },}, \
/* stack */ 0,0, \
/* ec,brk... */ 0,0,0,0,0,0,0,0,0,0,0, \
/* ec,brk... */ 0,0,0,0,0,0,0,0,0,0,0,0, \
/* argv.. */ 0,0,0,0, \
/* pid etc.. */ 0,0,0,0, \
/* suppl grps*/ {NOGROUP,}, \
......@@ -244,9 +253,9 @@ struct task_struct {
/* uid etc */ 0,0,0,0,0,0, \
/* timeout */ 0,0,0,0,0,0,0,0,0,0,0,0, \
/* min_flt */ 0,0,0,0, \
/* rlimits */ { {0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}, \
{0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}, \
{0x7fffffff, 0x7fffffff}, {0x7fffffff, 0x7fffffff}}, \
/* rlimits */ { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
{LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
{LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}}, \
/* math */ 0, \
/* rss */ 2, \
/* comm */ "swapper", \
......@@ -255,9 +264,7 @@ struct task_struct {
/* ipc */ NULL, NULL, \
/* filp */ {NULL,}, \
/* cloe */ {{ 0, }}, \
{ \
/* ldt */ {0,0}, \
}, \
/* ldt */ NULL, \
/*tss*/ {0,0, \
sizeof(init_kernel_stack) + (long) &init_kernel_stack, KERNEL_DS, 0, \
0,0,0,0,0,0, \
......@@ -266,7 +273,7 @@ struct task_struct {
USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \
_LDT(0),0, \
0, 0x8000, \
/* ioperm */ {0xffffffff, }, \
/* ioperm */ {~0, }, \
_TSS(0), \
/* 387 state */ { { 0, }, } \
} \
......@@ -280,8 +287,11 @@ extern unsigned long volatile jiffies;
extern unsigned long startup_time;
extern int jiffies_offset;
extern int need_resched;
extern int hard_math;
extern int x86;
extern int ignore_irq13;
extern int wp_works_ok;
#define CURRENT_TIME (startup_time+(jiffies+jiffies_offset)/HZ)
......@@ -345,8 +355,6 @@ __asm__("cmpl %%ecx,_current\n\t" \
"c" (tsk) \
:"cx")
#define PAGE_ALIGN(n) (((n)+0xfff)&0xfffff000)
#define _set_base(addr,base) \
__asm__("movw %%dx,%0\n\t" \
"rorl $16,%%edx\n\t" \
......@@ -483,24 +491,39 @@ static inline unsigned long get_limit(unsigned long segment)
return __limit+1;
}
#define REMOVE_LINKS(p) \
#define REMOVE_LINKS(p) do { unsigned long flags; \
save_flags(flags) ; cli(); \
(p)->next_task->prev_task = (p)->prev_task; \
(p)->prev_task->next_task = (p)->next_task; \
restore_flags(flags); \
if ((p)->p_osptr) \
(p)->p_osptr->p_ysptr = (p)->p_ysptr; \
if ((p)->p_ysptr) \
(p)->p_ysptr->p_osptr = (p)->p_osptr; \
else \
(p)->p_pptr->p_cptr = (p)->p_osptr
(p)->p_pptr->p_cptr = (p)->p_osptr; \
} while (0)
#define SET_LINKS(p) \
#define SET_LINKS(p) do { unsigned long flags; \
save_flags(flags); cli(); \
(p)->next_task = &init_task; \
(p)->prev_task = init_task.prev_task; \
init_task.prev_task->next_task = (p); \
init_task.prev_task = (p); \
restore_flags(flags); \
(p)->p_ysptr = NULL; \
if (((p)->p_osptr = (p)->p_pptr->p_cptr) != NULL) \
(p)->p_osptr->p_ysptr = p; \
(p)->p_pptr->p_cptr = p
(p)->p_pptr->p_cptr = p; \
} while (0)
#define for_each_task(p) \
for (p = &init_task ; (p = p->next_task) != &init_task ; )
/*
* This is the ldt that every process will get unless we need
* something other than this.
*/
extern struct desc_struct default_ldt;
#endif
......@@ -15,12 +15,15 @@
*
* For definitions of the flags field, see tty.h
*/
#ifndef _LINUX_SERIAL_H
#define _LINUX_SERIAL_H
struct async_struct {
int baud_base;
int port;
int irq;
int flags; /* defined in tty.h */
int hub6; /* HUB6 plus one */
int type; /* UART type */
struct tty_struct *tty;
int read_status_mask;
......@@ -29,11 +32,14 @@ struct async_struct {
int custom_divisor;
int x_char; /* xon/xoff characater */
int close_delay;
int IER; /* Interrupt Enable Register */
int event;
int line;
int count; /* # of fd on device */
int blocked_open; /* # of blocked opens */
struct wait_queue *open_wait;
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
struct wait_queue *open_wait;
struct async_struct *next_port; /* For the linked list */
struct async_struct *prev_port;
};
......@@ -150,3 +156,5 @@ struct async_struct {
#define UART_MSR_DDSR 0x02 /* Delta DSR */
#define UART_MSR_DCTS 0x01 /* Delta CTS */
#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
#endif /* _LINUX_SERIAL_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -47,6 +47,8 @@
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
/* Used for packet mode */
#define TIOCPKT_FLUSHREAD 1
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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