Commit b0755ed8 authored by Linus Torvalds's avatar Linus Torvalds

[PATCH] Linux-0.99.3 (January 13, 1993)

VFS gets "permission()" virtual function.

[Original announcement below]

Still no 1.0 - I have had a couple of reports of problems, so I'll make
yet another 0.99 release.  The diffs (against 0.99.2) and complete
source can be found at nic.funet.fi: pub/OS/Linux/PEOPLE/Linus as usual,
and will probably show up at the other sites pretty soon.

0.99.3 contains no real new features, but the diffs are pretty big
anyway (100kB+ compressed): various things have moved around a bit and
there are a lot of minor changes.  The changes include (but are not
limited to):

 - the math emulator code now also understands the unofficial codes (in
   case somebody followed the ML math emulator thread).  I'd be
   interested to hear whether ML now works with the emulator.
 - various SCSI driver changes
 - some re-organization of the tty open/close code to remove a few race
   conditions.
 - interrupt handling rewrites (two-level interrupt code cleanups)
 - the serial drivers are tytso's alpha-drivers: they aren't quite
   completed, but as they need the interrupt handling patches to get
   ready, this is probably the least traumatic way of doing it.
 - some more minor keyboard driver changes (mostly taking advantage of
   the two-level interrupts)

+ a lot of other minor changes.  I once more hope people will try it
out, and report any problems or successes to me.

Known problems:
 - there seems to be something weird going on in the ST-0x driver with
   some scsi disks.
 - tcp/ip is reportedly still not quite stable, and I can't even test it
   out.

NOTE! The DMA functions have changed for the high DMA channels - all DMA
functions now take their arguments as the number of bytes instead of the
old way of using bytes for ch 0-3 and words for ch 5-7.  This might lead
to problems with the SoundBlaster driver, which may need editing.

                Linus
parent 9000b87e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# This script is used to configure the linux kernel. # This script is used to configure the linux kernel.
# It's a fast hack - feel free to do something better. # It's a fast hack - feel free to do something better.
CONFIG=.config CONFIG=.config~
CONFIG_H=include/linux/autoconf.h CONFIG_H=include/linux/autoconf.h
echo "#" > $CONFIG echo "#" > $CONFIG
echo "# Automatically generated make config: don't edit" >> $CONFIG echo "# Automatically generated make config: don't edit" >> $CONFIG
......
# #
# Make "config" the default target if there is no configuration file # Make "config" the default target if there is no configuration file or
# "depend" the target if there is no top-level dependency information.
# #
ifeq (.config,$(wildcard .config)) ifeq (.config,$(wildcard .config))
include .config include .config
ifeq (.depend,$(wildcard .depend))
include .depend
else
CONFIGURATION = depend
endif
else else
CONFIGURATION = config CONFIGURATION = config
endif endif
ifdef CONFIGURATION
CONFIGURE = dummy
endif
# #
# ROOT_DEV specifies the default root-device when making the image. # ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, /dev/xxxx or empty, in which case the # This can be either FLOPPY, /dev/xxxx or empty, in which case the
...@@ -20,10 +30,7 @@ ROOT_DEV = /dev/hdb1 ...@@ -20,10 +30,7 @@ ROOT_DEV = /dev/hdb1
# #
# The value of KBDFLAGS should be or'ed together from the following # The value of KBDFLAGS should be or'ed together from the following
# bits, depending on which features you want enabled. # bits, depending on which features you want enabled.
# 0x80 - Off: the Alt key will set bit 7 if pressed together with #
# another key.
# On: the Alt key will NOT set the high bit; an escape
# character is prepended instead.
# The least significant bits control if the following keys are "dead". # The least significant bits control if the following keys are "dead".
# The key is dead by default if the bit is on. # The key is dead by default if the bit is on.
# 0x01 - backquote (`) # 0x01 - backquote (`)
...@@ -118,37 +125,30 @@ KERNELHDRS =/usr/src/linux/include ...@@ -118,37 +125,30 @@ KERNELHDRS =/usr/src/linux/include
all: Version Image all: Version Image
lilo: Image Version: dummy
rm tools/version.h
lilo: $(CONFIGURE) Image
if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
cat Image > /vmlinux cat Image > /vmlinux
/etc/lilo/install /etc/lilo/install
config: config:
ifdef CONFIGURATION
@echo
@echo "You have no .config: running Configure"
@echo
endif
sh Configure < config.in sh Configure < config.in
ifdef CONFIGURATION mv .config~ .config
@echo
@echo "Configure successful. Try re-making (ignore the error that follows)"
@echo
exit 1
endif
linuxsubdirs: dummy linuxsubdirs: dummy
@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done @for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done
Version: dummy tools/version.h: $(CONFIGURE) Makefile
@./makever.sh @./makever.sh
@echo \#define UTS_RELEASE \"0.99.pl2-`cat .version`\" > tools/version.h @echo \#define UTS_RELEASE \"0.99.pl3-`cat .version`\" > tools/version.h
@echo \#define UTS_VERSION \"`date +%D`\" >> tools/version.h @echo \#define UTS_VERSION \"`date +%D`\" >> tools/version.h
@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> 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_BY \"`whoami`\" >> tools/version.h
@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
Image: $(CONFIGURATION) boot/bootsect boot/setup tools/system tools/build Image: $(CONFIGURE) boot/bootsect boot/setup tools/system tools/build
cp tools/system system.tmp cp tools/system system.tmp
$(STRIP) system.tmp $(STRIP) system.tmp
tools/build boot/bootsect boot/setup system.tmp $(ROOT_DEV) > Image tools/build boot/bootsect boot/setup system.tmp $(ROOT_DEV) > Image
...@@ -158,18 +158,18 @@ Image: $(CONFIGURATION) boot/bootsect boot/setup tools/system tools/build ...@@ -158,18 +158,18 @@ Image: $(CONFIGURATION) boot/bootsect boot/setup tools/system tools/build
disk: Image disk: Image
dd bs=8192 if=Image of=/dev/fd0 dd bs=8192 if=Image of=/dev/fd0
tools/build: tools/build.c tools/build: $(CONFIGURE) tools/build.c
$(HOSTCC) $(CFLAGS) \ $(HOSTCC) $(CFLAGS) \
-o tools/build tools/build.c -o tools/build tools/build.c
boot/head.o: boot/head.s boot/head.o: $(CONFIGURE) boot/head.s
boot/head.s: boot/head.S boot/head.s: $(CONFIGURE) boot/head.S
$(CPP) -traditional boot/head.S -o boot/head.s $(CPP) -traditional boot/head.S -o boot/head.s
tools/version.o: tools/version.c tools/version.h tools/version.o: tools/version.c tools/version.h
init/main.o: init/main.c init/main.o: $(CONFIGURE) init/main.c
$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $< $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs
...@@ -185,10 +185,10 @@ boot/setup: boot/setup.s ...@@ -185,10 +185,10 @@ boot/setup: boot/setup.s
$(AS86) -o boot/setup.o boot/setup.s $(AS86) -o boot/setup.o boot/setup.s
$(LD86) -s -o boot/setup boot/setup.o $(LD86) -s -o boot/setup boot/setup.o
boot/setup.s: boot/setup.S include/linux/config.h Makefile boot/setup.s: $(CONFIGURE) boot/setup.S include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/setup.S -o boot/setup.s $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/setup.S -o boot/setup.s
boot/bootsect.s: boot/bootsect.S include/linux/config.h Makefile boot/bootsect.s: $(CONFIGURE) boot/bootsect.S include/linux/config.h Makefile
$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/bootsect.S -o boot/bootsect.s $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/bootsect.S -o boot/bootsect.s
boot/bootsect: boot/bootsect.s boot/bootsect: boot/bootsect.s
...@@ -215,15 +215,26 @@ backup: clean ...@@ -215,15 +215,26 @@ backup: clean
sync sync
depend dep: depend dep:
for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done > .depend for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done > .depend~
for i in tools/*.c;do echo -n "tools/";$(CPP) -M $$i;done >> .depend~
for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done
mv .depend~ .depend
dummy: $(CONFIGURATION) ifdef CONFIGURATION
..$(CONFIGURATION):
@echo
@echo "You have no" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
@echo
$(MAKE) $(CONFIGURATION)
@echo
@echo "Successful. Try re-making (ignore the error that follows)"
@echo
exit 1
# dummy: ..$(CONFIGURATION)
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
else
dummy:
endif
...@@ -8,7 +8,7 @@ TCP/IP ...@@ -8,7 +8,7 @@ TCP/IP
CONFIG_TCPIP y/n y CONFIG_TCPIP y/n y
Kernel profiling support Kernel profiling support
CONFIG_PROFILE y/n n CONFIG_PROFILE y/n n
Limit to memory to low 16MB Limit memory to low 16MB
CONFIG_MAX_16M y/n y CONFIG_MAX_16M y/n y
Use -m486 flag for 486-specific optimizations Use -m486 flag for 486-specific optimizations
CONFIG_M486 y/n y CONFIG_M486 y/n y
...@@ -59,6 +59,8 @@ CONFIG_ISO9660_FS y/n n ...@@ -59,6 +59,8 @@ CONFIG_ISO9660_FS y/n n
. .
Various character device drivers.. Various character device drivers..
. .
Keyboard meta-key sends ESC-prefix
CONFIG_KBD_META y/n y
Autoconfigure serial IRQ lines at bootup Autoconfigure serial IRQ lines at bootup
CONFIG_AUTO_IRQ y/n n CONFIG_AUTO_IRQ y/n n
AST Fourport serial driver support AST Fourport serial driver support
......
...@@ -140,10 +140,10 @@ int core_dump(long signr, struct pt_regs * regs) ...@@ -140,10 +140,10 @@ int core_dump(long signr, struct pt_regs * regs)
dump.u_fpvalid = 0; dump.u_fpvalid = 0;
} }
__asm__("mov %0,%%fs"::"r" ((unsigned short) 0x10)); __asm__("mov %0,%%fs"::"r" ((unsigned short) 0x10));
/* struct user */
DUMP_WRITE(&dump,sizeof(dump)); DUMP_WRITE(&dump,sizeof(dump));
DUMP_SEEK(sizeof(dump)); /* name of the executable */
/* Dump the task struct. Not be used by gdb, but could be useful */ DUMP_WRITE(current->comm,16);
DUMP_WRITE(current,sizeof(*current));
/* Now dump all of the user data. Include malloced stuff as well */ /* Now dump all of the user data. Include malloced stuff as well */
DUMP_SEEK(PAGE_SIZE); DUMP_SEEK(PAGE_SIZE);
/* now we start writing out the user space info */ /* now we start writing out the user space info */
...@@ -160,6 +160,9 @@ int core_dump(long signr, struct pt_regs * regs) ...@@ -160,6 +160,9 @@ int core_dump(long signr, struct pt_regs * regs)
dump_size = dump.u_ssize << 12; dump_size = dump.u_ssize << 12;
DUMP_WRITE(dump_start,dump_size); DUMP_WRITE(dump_start,dump_size);
}; };
/* Finally dump the task struct. Not be used by gdb, but could be useful */
__asm__("mov %0,%%fs"::"r" ((unsigned short) 0x10));
DUMP_WRITE(current,sizeof(*current));
close_coredump: close_coredump:
if (file.f_op->release) if (file.f_op->release)
file.f_op->release(inode,&file); file.f_op->release(inode,&file);
......
...@@ -64,5 +64,6 @@ struct inode_operations ext_blkdev_inode_operations = { ...@@ -64,5 +64,6 @@ struct inode_operations ext_blkdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -64,6 +64,7 @@ struct inode_operations ext_chrdev_inode_operations = { ...@@ -64,6 +64,7 @@ struct inode_operations ext_chrdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -56,7 +56,8 @@ struct inode_operations ext_dir_inode_operations = { ...@@ -56,7 +56,8 @@ struct inode_operations ext_dir_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
ext_truncate /* truncate */ ext_truncate, /* truncate */
NULL /* permission */
}; };
static int ext_readdir(struct inode * inode, struct file * filp, static int ext_readdir(struct inode * inode, struct file * filp,
......
...@@ -23,5 +23,6 @@ struct inode_operations ext_fifo_inode_operations = { ...@@ -23,5 +23,6 @@ struct inode_operations ext_fifo_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -64,7 +64,8 @@ struct inode_operations ext_file_inode_operations = { ...@@ -64,7 +64,8 @@ struct inode_operations ext_file_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
ext_bmap, /* bmap */ ext_bmap, /* bmap */
ext_truncate /* truncate */ ext_truncate, /* truncate */
NULL /* permission */
}; };
static int ext_file_read(struct inode * inode, struct file * filp, char * buf, int count) static int ext_file_read(struct inode * inode, struct file * filp, char * buf, int count)
......
...@@ -40,7 +40,8 @@ struct inode_operations ext_symlink_inode_operations = { ...@@ -40,7 +40,8 @@ struct inode_operations ext_symlink_inode_operations = {
ext_readlink, /* readlink */ ext_readlink, /* readlink */
ext_follow_link, /* follow_link */ ext_follow_link, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int ext_follow_link(struct inode * dir, struct inode * inode, static int ext_follow_link(struct inode * dir, struct inode * inode,
......
...@@ -63,5 +63,6 @@ struct inode_operations isofs_blkdev_inode_operations = { ...@@ -63,5 +63,6 @@ struct inode_operations isofs_blkdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
isofs_bmap, /* bmap */ isofs_bmap, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -63,6 +63,7 @@ struct inode_operations isofs_chrdev_inode_operations = { ...@@ -63,6 +63,7 @@ struct inode_operations isofs_chrdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
isofs_bmap, /* bmap */ isofs_bmap, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -49,7 +49,8 @@ struct inode_operations isofs_dir_inode_operations = { ...@@ -49,7 +49,8 @@ struct inode_operations isofs_dir_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
isofs_bmap, /* bmap */ isofs_bmap, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
/* This is used to speed up lookup. Without this we would need to /* This is used to speed up lookup. Without this we would need to
......
...@@ -23,5 +23,6 @@ struct inode_operations isofs_fifo_inode_operations = { ...@@ -23,5 +23,6 @@ struct inode_operations isofs_fifo_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -60,7 +60,8 @@ struct inode_operations isofs_file_inode_operations = { ...@@ -60,7 +60,8 @@ struct inode_operations isofs_file_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
isofs_bmap, /* bmap */ isofs_bmap, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
/* This is a heuristic to determine if a file is text of binary. If it /* This is a heuristic to determine if a file is text of binary. If it
......
...@@ -37,7 +37,8 @@ struct inode_operations isofs_symlink_inode_operations = { ...@@ -37,7 +37,8 @@ struct inode_operations isofs_symlink_inode_operations = {
isofs_readlink, /* readlink */ isofs_readlink, /* readlink */
isofs_follow_link, /* follow_link */ isofs_follow_link, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int isofs_follow_link(struct inode * dir, struct inode * inode, static int isofs_follow_link(struct inode * dir, struct inode * inode,
......
...@@ -129,7 +129,8 @@ int minix_new_block(struct super_block * sb) ...@@ -129,7 +129,8 @@ int minix_new_block(struct super_block * sb)
} }
bh->b_dirt = 1; bh->b_dirt = 1;
j += i*8192 + sb->u.minix_sb.s_firstdatazone-1; j += i*8192 + sb->u.minix_sb.s_firstdatazone-1;
if (j >= sb->u.minix_sb.s_nzones) if (j < sb->u.minix_sb.s_firstdatazone ||
j >= sb->u.minix_sb.s_nzones)
return 0; return 0;
if (!(bh = getblk(sb->s_dev,j,BLOCK_SIZE))) { if (!(bh = getblk(sb->s_dev,j,BLOCK_SIZE))) {
printk("new_block: cannot get block"); printk("new_block: cannot get block");
...@@ -174,7 +175,7 @@ void minix_free_inode(struct inode * inode) ...@@ -174,7 +175,7 @@ void minix_free_inode(struct inode * inode)
printk("free_inode: inode on nonexistent device\n"); printk("free_inode: inode on nonexistent device\n");
return; return;
} }
if (inode->i_ino < 1 || inode->i_ino > inode->i_sb->u.minix_sb.s_ninodes) { if (inode->i_ino < 1 || inode->i_ino >= inode->i_sb->u.minix_sb.s_ninodes) {
printk("free_inode: inode 0 or nonexistent inode\n"); printk("free_inode: inode 0 or nonexistent inode\n");
return; return;
} }
...@@ -205,7 +206,7 @@ struct inode * minix_new_inode(const struct inode * dir) ...@@ -205,7 +206,7 @@ struct inode * minix_new_inode(const struct inode * dir)
if ((bh = inode->i_sb->u.minix_sb.s_imap[i]) != NULL) if ((bh = inode->i_sb->u.minix_sb.s_imap[i]) != NULL)
if ((j=find_first_zero(bh->b_data))<8192) if ((j=find_first_zero(bh->b_data))<8192)
break; break;
if (!bh || j >= 8192 || j+i*8192 > inode->i_sb->u.minix_sb.s_ninodes) { if (!bh || j >= 8192) {
iput(inode); iput(inode);
return NULL; return NULL;
} }
...@@ -215,13 +216,18 @@ struct inode * minix_new_inode(const struct inode * dir) ...@@ -215,13 +216,18 @@ struct inode * minix_new_inode(const struct inode * dir)
return NULL; return NULL;
} }
bh->b_dirt = 1; bh->b_dirt = 1;
j += i*8192;
if (!j || j >= inode->i_sb->u.minix_sb.s_ninodes) {
iput(inode);
return NULL;
}
inode->i_count = 1; inode->i_count = 1;
inode->i_nlink = 1; inode->i_nlink = 1;
inode->i_dev = sb->s_dev; inode->i_dev = sb->s_dev;
inode->i_uid = current->euid; inode->i_uid = current->euid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid; inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
inode->i_dirt = 1; inode->i_dirt = 1;
inode->i_ino = j + i*8192; inode->i_ino = j;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_op = NULL; inode->i_op = NULL;
inode->i_blocks = inode->i_blksize = 0; inode->i_blocks = inode->i_blksize = 0;
......
...@@ -58,5 +58,6 @@ struct inode_operations minix_blkdev_inode_operations = { ...@@ -58,5 +58,6 @@ struct inode_operations minix_blkdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -58,6 +58,7 @@ struct inode_operations minix_chrdev_inode_operations = { ...@@ -58,6 +58,7 @@ struct inode_operations minix_chrdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -49,7 +49,8 @@ struct inode_operations minix_dir_inode_operations = { ...@@ -49,7 +49,8 @@ struct inode_operations minix_dir_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
minix_truncate /* truncate */ minix_truncate, /* truncate */
NULL /* permission */
}; };
static int minix_readdir(struct inode * inode, struct file * filp, static int minix_readdir(struct inode * inode, struct file * filp,
......
...@@ -23,5 +23,6 @@ struct inode_operations minix_fifo_inode_operations = { ...@@ -23,5 +23,6 @@ struct inode_operations minix_fifo_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -58,7 +58,8 @@ struct inode_operations minix_file_inode_operations = { ...@@ -58,7 +58,8 @@ struct inode_operations minix_file_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
minix_bmap, /* bmap */ minix_bmap, /* bmap */
minix_truncate /* truncate */ minix_truncate, /* truncate */
NULL /* permission */
}; };
static int minix_file_read(struct inode * inode, struct file * filp, char * buf, int count) static int minix_file_read(struct inode * inode, struct file * filp, char * buf, int count)
......
...@@ -309,11 +309,21 @@ void minix_read_inode(struct inode * inode) ...@@ -309,11 +309,21 @@ void minix_read_inode(struct inode * inode)
int block, ino; int block, ino;
ino = inode->i_ino; ino = inode->i_ino;
inode->i_op = NULL;
inode->i_mode = 0;
if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev 0x%04x: %d is out of range\n",
inode->i_dev, ino);
return;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks +
inode->i_sb->u.minix_sb.s_zmap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX_INODES_PER_BLOCK; (ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev,block, BLOCK_SIZE))) if (!(bh=bread(inode->i_dev,block, BLOCK_SIZE))) {
panic("unable to read i-node block"); printk("Major problem: unable to read inode from dev 0x%04x\n",
inode->i_dev);
return;
}
raw_inode = ((struct minix_inode *) bh->b_data) + raw_inode = ((struct minix_inode *) bh->b_data) +
(ino-1)%MINIX_INODES_PER_BLOCK; (ino-1)%MINIX_INODES_PER_BLOCK;
inode->i_mode = raw_inode->i_mode; inode->i_mode = raw_inode->i_mode;
...@@ -328,7 +338,6 @@ void minix_read_inode(struct inode * inode) ...@@ -328,7 +338,6 @@ void minix_read_inode(struct inode * inode)
else for (block = 0; block < 9; block++) else for (block = 0; block < 9; block++)
inode->u.minix_i.i_data[block] = raw_inode->i_zone[block]; inode->u.minix_i.i_data[block] = raw_inode->i_zone[block];
brelse(bh); brelse(bh);
inode->i_op = NULL;
if (S_ISREG(inode->i_mode)) if (S_ISREG(inode->i_mode))
inode->i_op = &minix_file_inode_operations; inode->i_op = &minix_file_inode_operations;
else if (S_ISDIR(inode->i_mode)) else if (S_ISDIR(inode->i_mode))
...@@ -353,14 +362,21 @@ void minix_write_inode(struct inode * inode) ...@@ -353,14 +362,21 @@ void minix_write_inode(struct inode * inode)
{ {
struct buffer_head * bh; struct buffer_head * bh;
struct minix_inode * raw_inode; struct minix_inode * raw_inode;
int block; int ino, block;
ino = inode->i_ino;
if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev 0x%04x: %d is out of range\n",
inode->i_dev, ino);
inode->i_dirt = 0;
return;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks + block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(inode->i_ino-1)/MINIX_INODES_PER_BLOCK; (ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE)))
panic("unable to read i-node block"); panic("unable to read i-node block");
raw_inode = ((struct minix_inode *)bh->b_data) + raw_inode = ((struct minix_inode *)bh->b_data) +
(inode->i_ino-1)%MINIX_INODES_PER_BLOCK; (ino-1)%MINIX_INODES_PER_BLOCK;
raw_inode->i_mode = inode->i_mode; raw_inode->i_mode = inode->i_mode;
raw_inode->i_uid = inode->i_uid; raw_inode->i_uid = inode->i_uid;
raw_inode->i_gid = inode->i_gid; raw_inode->i_gid = inode->i_gid;
......
...@@ -34,7 +34,8 @@ struct inode_operations minix_symlink_inode_operations = { ...@@ -34,7 +34,8 @@ struct inode_operations minix_symlink_inode_operations = {
minix_readlink, /* readlink */ minix_readlink, /* readlink */
minix_follow_link, /* follow_link */ minix_follow_link, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int minix_follow_link(struct inode * dir, struct inode * inode, static int minix_follow_link(struct inode * dir, struct inode * inode,
......
...@@ -48,7 +48,8 @@ struct inode_operations msdos_dir_inode_operations = { ...@@ -48,7 +48,8 @@ struct inode_operations msdos_dir_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
msdos_bmap, /* bmap */ msdos_bmap, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int msdos_readdir(struct inode *inode,struct file *filp, static int msdos_readdir(struct inode *inode,struct file *filp,
......
...@@ -51,7 +51,8 @@ struct inode_operations msdos_file_inode_operations = { ...@@ -51,7 +51,8 @@ struct inode_operations msdos_file_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
msdos_bmap, /* bmap */ msdos_bmap, /* bmap */
msdos_truncate /* truncate */ msdos_truncate, /* truncate */
NULL /* permission */
}; };
/* No bmap for MS-DOS FS' that don't align data at kByte boundaries. */ /* No bmap for MS-DOS FS' that don't align data at kByte boundaries. */
...@@ -70,7 +71,8 @@ struct inode_operations msdos_file_inode_operations_no_bmap = { ...@@ -70,7 +71,8 @@ struct inode_operations msdos_file_inode_operations_no_bmap = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
msdos_truncate /* truncate */ msdos_truncate, /* truncate */
NULL /* permission */
}; };
......
...@@ -39,6 +39,8 @@ int permission(struct inode * inode,int mask) ...@@ -39,6 +39,8 @@ int permission(struct inode * inode,int mask)
/* special case: not even root can read/write a deleted file */ /* special case: not even root can read/write a deleted file */
if (inode->i_dev && !inode->i_nlink) if (inode->i_dev && !inode->i_nlink)
return 0; return 0;
else if (inode->i_op && inode->i_op->permission)
return inode->i_op->permission(inode, mask);
else if (current->euid == inode->i_uid) else if (current->euid == inode->i_uid)
mode >>= 6; mode >>= 6;
else if (in_group_p(inode->i_gid)) else if (in_group_p(inode->i_gid))
......
...@@ -58,5 +58,6 @@ struct inode_operations nfs_blkdev_inode_operations = { ...@@ -58,5 +58,6 @@ struct inode_operations nfs_blkdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -58,6 +58,7 @@ struct inode_operations nfs_chrdev_inode_operations = { ...@@ -58,6 +58,7 @@ struct inode_operations nfs_chrdev_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -64,6 +64,7 @@ struct inode_operations nfs_dir_inode_operations = { ...@@ -64,6 +64,7 @@ struct inode_operations nfs_dir_inode_operations = {
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL, /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int nfs_dir_read(struct inode *inode, struct file *filp, char *buf, static int nfs_dir_read(struct inode *inode, struct file *filp, char *buf,
...@@ -132,9 +133,6 @@ static int nfs_readdir(struct inode *inode, struct file *filp, ...@@ -132,9 +133,6 @@ static int nfs_readdir(struct inode *inode, struct file *filp,
filp->f_pos, NFS_READDIR_CACHE_SIZE, c_entry); filp->f_pos, NFS_READDIR_CACHE_SIZE, c_entry);
if (result < 0) { if (result < 0) {
c_dev = 0; c_dev = 0;
#if 0
printk("nfs_readdir: readdir error = %d\n", result);
#endif
return result; return result;
} }
if (result > 0) { if (result > 0) {
...@@ -171,8 +169,6 @@ static int nfs_readdir(struct inode *inode, struct file *filp, ...@@ -171,8 +169,6 @@ static int nfs_readdir(struct inode *inode, struct file *filp,
* though most of them will fail. * though most of them will fail.
*/ */
#define NFS_LOOKUP_CACHE_SIZE 16
static struct nfs_lookup_cache_entry { static struct nfs_lookup_cache_entry {
int dev; int dev;
int inode; int inode;
...@@ -191,7 +187,7 @@ static struct nfs_lookup_cache_entry *nfs_lookup_cache_index(struct inode *dir, ...@@ -191,7 +187,7 @@ static struct nfs_lookup_cache_entry *nfs_lookup_cache_index(struct inode *dir,
for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) { for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) {
entry = nfs_lookup_cache + i; entry = nfs_lookup_cache + i;
if (entry->dev == dir->i_dev && entry->inode == dir->i_ino if (entry->dev == dir->i_dev && entry->inode == dir->i_ino
&& !strcmp(filename, entry->filename)) && !strncmp(filename, entry->filename, NFS_MAXNAMLEN))
return entry; return entry;
} }
return NULL; return NULL;
...@@ -226,7 +222,6 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename, ...@@ -226,7 +222,6 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename,
struct nfs_fattr *fattr) struct nfs_fattr *fattr)
{ {
static int nfs_lookup_cache_pos = 0; static int nfs_lookup_cache_pos = 0;
struct nfs_lookup_cache_entry *entry; struct nfs_lookup_cache_entry *entry;
/* compensate for bug in SGI NFS server */ /* compensate for bug in SGI NFS server */
...@@ -243,30 +238,47 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename, ...@@ -243,30 +238,47 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename,
strcpy(entry->filename, filename); strcpy(entry->filename, filename);
entry->fhandle = *fhandle; entry->fhandle = *fhandle;
entry->fattr = *fattr; entry->fattr = *fattr;
entry->expiration_date = jiffies + NFS_SERVER(dir)->acregmax; entry->expiration_date = jiffies + (S_ISDIR(fattr->mode)
? NFS_SERVER(dir)->acdirmax : NFS_SERVER(dir)->acregmax);
} }
static void nfs_lookup_cache_remove(struct inode *dir, char *filename) static void nfs_lookup_cache_remove(struct inode *dir, struct inode *inode,
char *filename)
{ {
struct nfs_lookup_cache_entry *entry; struct nfs_lookup_cache_entry *entry;
int dev;
int fileid;
int i;
if ((entry = nfs_lookup_cache_index(dir, filename))) if (inode) {
dev = inode->i_dev;
fileid = inode->i_ino;
}
else if ((entry = nfs_lookup_cache_index(dir, filename))) {
dev = entry->dev;
fileid = entry->fattr.fileid;
}
else
return;
for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) {
entry = nfs_lookup_cache + i;
if (entry->dev == dev && entry->fattr.fileid == fileid)
entry->dev = 0; entry->dev = 0;
}
} }
static void nfs_lookup_cache_refresh(struct inode *file, static void nfs_lookup_cache_refresh(struct inode *file,
struct nfs_fattr *fattr) struct nfs_fattr *fattr)
{ {
struct nfs_lookup_cache_entry *entry; struct nfs_lookup_cache_entry *entry;
int dev = file->i_dev;
int fileid = file->i_ino;
int i; int i;
for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) { for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) {
entry = nfs_lookup_cache + i; entry = nfs_lookup_cache + i;
if (entry->dev == file->i_dev if (entry->dev == dev && entry->fattr.fileid == fileid)
&& entry->fattr.fileid == file->i_ino) {
entry->fattr = *fattr; entry->fattr = *fattr;
break;
}
} }
} }
...@@ -332,11 +344,7 @@ static int nfs_create(struct inode *dir, const char *name, int len, int mode, ...@@ -332,11 +344,7 @@ static int nfs_create(struct inode *dir, const char *name, int len, int mode,
} }
memcpy_fromfs(filename, (char *) name, len); memcpy_fromfs(filename, (char *) name, len);
filename[len] = '\0'; filename[len] = '\0';
#if 0
sattr.mode = mode & 0777;
#else
sattr.mode = mode; sattr.mode = mode;
#endif
sattr.uid = sattr.gid = sattr.size = -1; sattr.uid = sattr.gid = sattr.size = -1;
sattr.atime.seconds = sattr.mtime.seconds = -1; sattr.atime.seconds = sattr.mtime.seconds = -1;
if ((error = nfs_proc_create(NFS_SERVER(dir), NFS_FH(dir), if ((error = nfs_proc_create(NFS_SERVER(dir), NFS_FH(dir),
...@@ -407,11 +415,7 @@ static int nfs_mkdir(struct inode *dir, const char *name, int len, int mode) ...@@ -407,11 +415,7 @@ static int nfs_mkdir(struct inode *dir, const char *name, int len, int mode)
} }
memcpy_fromfs(filename, (char *) name, len); memcpy_fromfs(filename, (char *) name, len);
filename[len] = '\0'; filename[len] = '\0';
#if 0
sattr.mode = mode & 0777;
#else
sattr.mode = mode; sattr.mode = mode;
#endif
sattr.uid = sattr.gid = sattr.size = -1; sattr.uid = sattr.gid = sattr.size = -1;
sattr.atime.seconds = sattr.mtime.seconds = -1; sattr.atime.seconds = sattr.mtime.seconds = -1;
error = nfs_proc_mkdir(NFS_SERVER(dir), NFS_FH(dir), error = nfs_proc_mkdir(NFS_SERVER(dir), NFS_FH(dir),
...@@ -440,7 +444,7 @@ static int nfs_rmdir(struct inode *dir, const char *name, int len) ...@@ -440,7 +444,7 @@ static int nfs_rmdir(struct inode *dir, const char *name, int len)
filename[len] = '\0'; filename[len] = '\0';
error = nfs_proc_rmdir(NFS_SERVER(dir), NFS_FH(dir), filename); error = nfs_proc_rmdir(NFS_SERVER(dir), NFS_FH(dir), filename);
if (!error) if (!error)
nfs_lookup_cache_remove(dir, filename); nfs_lookup_cache_remove(dir, NULL, filename);
iput(dir); iput(dir);
return error; return error;
} }
...@@ -463,7 +467,7 @@ static int nfs_unlink(struct inode *dir, const char *name, int len) ...@@ -463,7 +467,7 @@ static int nfs_unlink(struct inode *dir, const char *name, int len)
filename[len] = '\0'; filename[len] = '\0';
error = nfs_proc_remove(NFS_SERVER(dir), NFS_FH(dir), filename); error = nfs_proc_remove(NFS_SERVER(dir), NFS_FH(dir), filename);
if (!error) if (!error)
nfs_lookup_cache_remove(dir, filename); nfs_lookup_cache_remove(dir, NULL, filename);
iput(dir); iput(dir);
return error; return error;
} }
...@@ -535,6 +539,8 @@ static int nfs_link(struct inode *oldinode, struct inode *dir, ...@@ -535,6 +539,8 @@ static int nfs_link(struct inode *oldinode, struct inode *dir,
filename[len] = '\0'; filename[len] = '\0';
error = nfs_proc_link(NFS_SERVER(oldinode), NFS_FH(oldinode), error = nfs_proc_link(NFS_SERVER(oldinode), NFS_FH(oldinode),
NFS_FH(dir), filename); NFS_FH(dir), filename);
if (!error)
nfs_lookup_cache_remove(dir, oldinode, NULL);
iput(oldinode); iput(oldinode);
iput(dir); iput(dir);
return error; return error;
...@@ -572,7 +578,7 @@ static int nfs_rename(struct inode *old_dir, const char *old_name, int old_len, ...@@ -572,7 +578,7 @@ static int nfs_rename(struct inode *old_dir, const char *old_name, int old_len,
NFS_FH(old_dir), old_filename, NFS_FH(old_dir), old_filename,
NFS_FH(new_dir), new_filename); NFS_FH(new_dir), new_filename);
if (!error) if (!error)
nfs_lookup_cache_remove(old_dir, old_filename); nfs_lookup_cache_remove(old_dir, NULL, old_filename);
iput(old_dir); iput(old_dir);
iput(new_dir); iput(new_dir);
return error; return error;
...@@ -597,10 +603,6 @@ void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) ...@@ -597,10 +603,6 @@ void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
return; return;
} }
was_empty = inode->i_mode == 0; was_empty = inode->i_mode == 0;
#if 0
if (!was_empty && inode->i_atime > fattr->atime.seconds)
return;
#endif
inode->i_mode = fattr->mode; inode->i_mode = fattr->mode;
inode->i_nlink = fattr->nlink; inode->i_nlink = fattr->nlink;
inode->i_uid = fattr->uid; inode->i_uid = fattr->uid;
......
...@@ -23,5 +23,6 @@ struct inode_operations nfs_fifo_inode_operations = { ...@@ -23,5 +23,6 @@ struct inode_operations nfs_fifo_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -133,13 +133,8 @@ void nfs_statfs(struct super_block *sb, struct statfs *buf) ...@@ -133,13 +133,8 @@ void nfs_statfs(struct super_block *sb, struct statfs *buf)
put_fs_long(res.blocks, &buf->f_blocks); put_fs_long(res.blocks, &buf->f_blocks);
put_fs_long(res.bfree, &buf->f_bfree); put_fs_long(res.bfree, &buf->f_bfree);
put_fs_long(res.bavail, &buf->f_bavail); put_fs_long(res.bavail, &buf->f_bavail);
#if 0
put_fs_long(-1, &buf->f_files);
put_fs_long(-1, &buf->f_ffree);
#else
put_fs_long(0, &buf->f_files); put_fs_long(0, &buf->f_files);
put_fs_long(0, &buf->f_ffree); put_fs_long(0, &buf->f_ffree);
#endif
} }
/* /*
......
...@@ -12,7 +12,9 @@ ...@@ -12,7 +12,9 @@
* filesystem and type 'ls xyzzy' to turn on debugging. * filesystem and type 'ls xyzzy' to turn on debugging.
*/ */
#if 0
#define NFS_PROC_DEBUG #define NFS_PROC_DEBUG
#endif
#include <linux/param.h> #include <linux/param.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -24,11 +26,12 @@ ...@@ -24,11 +26,12 @@
#include <netinet/in.h> #include <netinet/in.h>
#ifdef NFS_PROC_DEBUG
static int proc_debug = 0; static int proc_debug = 0;
#ifdef NFS_PROC_DEBUG
#define PRINTK if (proc_debug) printk #define PRINTK if (proc_debug) printk
#else #else
#define PRINTK (void) #define PRINTK if (0) printk
#endif #endif
static int *nfs_rpc_header(int *p, int procedure); static int *nfs_rpc_header(int *p, int procedure);
...@@ -595,22 +598,23 @@ static int *nfs_rpc_verify(int *p) ...@@ -595,22 +598,23 @@ static int *nfs_rpc_verify(int *p)
int n; int n;
p++; p++;
if (ntohl(*p++) != RPC_REPLY) { if ((n = ntohl(*p++)) != RPC_REPLY) {
printk("not an RPC reply\n"); printk("nfs_rpc_verify: not an RPC reply: %d\n", n);
return 0; return 0;
} }
if (ntohl(*p++) != RPC_MSG_ACCEPTED) { if ((n = ntohl(*p++)) != RPC_MSG_ACCEPTED) {
printk("RPC call rejected\n"); printk("nfs_rpc_verify: RPC call rejected: %d\n", n);
return 0; return 0;
} }
if ((n = ntohl(*p++)) != RPC_AUTH_NULL && n != RPC_AUTH_UNIX) { if ((n = ntohl(*p++)) != RPC_AUTH_NULL && n != RPC_AUTH_UNIX) {
printk("reply with unknown RPC authentication type\n"); printk("nfs_rpc_verify: bad RPC authentication type: %d\n",
n);
return 0; return 0;
} }
n = ntohl(*p++); n = ntohl(*p++);
p += (n + 3) >> 2; p += (n + 3) >> 2;
if (ntohl(*p++) != RPC_SUCCESS) { if ((n = ntohl(*p++)) != RPC_SUCCESS) {
printk("RPC call failed\n"); printk("nfs_rpc_verify: RPC call failed: %d\n", n);
return 0; return 0;
} }
return p; return p;
...@@ -646,22 +650,21 @@ static struct { ...@@ -646,22 +650,21 @@ static struct {
{ NFSERR_NOTEMPTY, ENOTEMPTY }, { NFSERR_NOTEMPTY, ENOTEMPTY },
{ NFSERR_DQUOT, EDQUOT }, { NFSERR_DQUOT, EDQUOT },
{ NFSERR_STALE, ESTALE }, { NFSERR_STALE, ESTALE },
{ NFSERR_WFLUSH, EIO }, #ifdef EWFLUSH
{ NFSERR_WFLUSH, EWFLUSH },
#endif
{ -1, EIO } { -1, EIO }
}; };
static int nfs_stat_to_errno(int stat) static int nfs_stat_to_errno(int stat)
{ {
int errno;
int i; int i;
errno = EIO;
for (i = 0; nfs_errtbl[i].stat != -1; i++) { for (i = 0; nfs_errtbl[i].stat != -1; i++) {
if (nfs_errtbl[i].stat == stat) { if (nfs_errtbl[i].stat == stat)
errno = nfs_errtbl[i].errno; return nfs_errtbl[i].errno;
break;
}
} }
return errno; printk("nfs_stat_to_errno: bad nfs status return value: %d\n", stat);
return nfs_errtbl[i].errno;
} }
...@@ -46,6 +46,7 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end) ...@@ -46,6 +46,7 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end)
int major_timeout_seen; int major_timeout_seen;
char *server_name; char *server_name;
int n; int n;
int addrlen;
xid = start[0]; xid = start[0];
len = ((char *) end) - ((char *) start); len = ((char *) end) - ((char *) start);
...@@ -117,7 +118,9 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end) ...@@ -117,7 +118,9 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end)
else if (wait_table.nr) else if (wait_table.nr)
remove_wait_queue(entry.wait_address, &entry.wait); remove_wait_queue(entry.wait_address, &entry.wait);
current->state = TASK_RUNNING; current->state = TASK_RUNNING;
result = sock->ops->recv(sock, (void *) start, 4096, 1, 0); addrlen = 0;
result = sock->ops->recvfrom(sock, (void *) start, 4096, 1, 0,
NULL, &addrlen);
if (result < 0) { if (result < 0) {
if (result == -EAGAIN) { if (result == -EAGAIN) {
printk("nfs_rpc_call: bad select ready\n"); printk("nfs_rpc_call: bad select ready\n");
......
...@@ -35,7 +35,8 @@ struct inode_operations nfs_symlink_inode_operations = { ...@@ -35,7 +35,8 @@ struct inode_operations nfs_symlink_inode_operations = {
nfs_readlink, /* readlink */ nfs_readlink, /* readlink */
nfs_follow_link, /* follow_link */ nfs_follow_link, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int nfs_follow_link(struct inode *dir, struct inode *inode, static int nfs_follow_link(struct inode *dir, struct inode *inode,
......
...@@ -245,6 +245,7 @@ int sys_fchmod(unsigned int fd, mode_t mode) ...@@ -245,6 +245,7 @@ int sys_fchmod(unsigned int fd, mode_t mode)
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777); inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
if (!suser() && !in_group_p(inode->i_gid)) if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID; inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1; inode->i_dirt = 1;
return notify_change(inode); return notify_change(inode);
} }
...@@ -268,6 +269,7 @@ int sys_chmod(const char * filename, mode_t mode) ...@@ -268,6 +269,7 @@ int sys_chmod(const char * filename, mode_t mode)
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777); inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
if (!suser() && !in_group_p(inode->i_gid)) if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID; inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1; inode->i_dirt = 1;
error = notify_change(inode); error = notify_change(inode);
iput(inode); iput(inode);
...@@ -294,6 +296,7 @@ int sys_fchown(unsigned int fd, uid_t user, gid_t group) ...@@ -294,6 +296,7 @@ int sys_fchown(unsigned int fd, uid_t user, gid_t group)
suser()) { suser()) {
inode->i_uid = user; inode->i_uid = user;
inode->i_gid = group; inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1; inode->i_dirt = 1;
return notify_change(inode); return notify_change(inode);
} }
...@@ -321,6 +324,7 @@ int sys_chown(const char * filename, uid_t user, gid_t group) ...@@ -321,6 +324,7 @@ int sys_chown(const char * filename, uid_t user, gid_t group)
suser()) { suser()) {
inode->i_uid = user; inode->i_uid = user;
inode->i_gid = group; inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1; inode->i_dirt = 1;
error = notify_change(inode); error = notify_change(inode);
iput(inode); iput(inode);
...@@ -490,11 +494,13 @@ int sys_vhangup(void) ...@@ -490,11 +494,13 @@ int sys_vhangup(void)
if (!suser()) if (!suser())
return -EPERM; return -EPERM;
/* send the SIGHUP signal. */
kill_pg(current->pgrp, SIGHUP, 0);
/* See if there is a controlling tty. */ /* See if there is a controlling tty. */
if (current->tty < 0) if (current->tty < 0)
return 0; return 0;
/* send the SIGHUP signal. */
tty = TTY_TABLE(current->tty);
if (tty && tty->pgrp > 0)
kill_pg(tty->pgrp, SIGHUP, 0);
for (process = task + 0; process < task + NR_TASKS; process++) { for (process = task + 0; process < task + NR_TASKS; process++) {
for (j = 0; j < NR_OPEN; j++) { for (j = 0; j < NR_OPEN; j++) {
......
...@@ -351,5 +351,6 @@ struct inode_operations proc_array_inode_operations = { ...@@ -351,5 +351,6 @@ struct inode_operations proc_array_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -45,7 +45,8 @@ struct inode_operations proc_base_inode_operations = { ...@@ -45,7 +45,8 @@ struct inode_operations proc_base_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static struct proc_dir_entry base_dir[] = { static struct proc_dir_entry base_dir[] = {
......
...@@ -45,7 +45,8 @@ struct inode_operations proc_fd_inode_operations = { ...@@ -45,7 +45,8 @@ struct inode_operations proc_fd_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int proc_lookupfd(struct inode * dir,const char * name, int len, static int proc_lookupfd(struct inode * dir,const char * name, int len,
......
...@@ -123,7 +123,7 @@ void proc_read_inode(struct inode * inode) ...@@ -123,7 +123,7 @@ void proc_read_inode(struct inode * inode)
case 5: case 5:
case 6: case 6:
inode->i_op = &proc_link_inode_operations; inode->i_op = &proc_link_inode_operations;
inode->i_size = 3; inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700; inode->i_mode = S_IFLNK | 0700;
return; return;
case 7: case 7:
...@@ -146,7 +146,7 @@ void proc_read_inode(struct inode * inode) ...@@ -146,7 +146,7 @@ void proc_read_inode(struct inode * inode)
if (ino >= NR_OPEN || !p->filp[ino]) if (ino >= NR_OPEN || !p->filp[ino])
return; return;
inode->i_op = &proc_link_inode_operations; inode->i_op = &proc_link_inode_operations;
inode->i_size = 3; inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700; inode->i_mode = S_IFLNK | 0700;
return; return;
case 2: case 2:
...@@ -154,7 +154,7 @@ void proc_read_inode(struct inode * inode) ...@@ -154,7 +154,7 @@ void proc_read_inode(struct inode * inode)
if (ino >= p->numlibraries) if (ino >= p->numlibraries)
return; return;
inode->i_op = &proc_link_inode_operations; inode->i_op = &proc_link_inode_operations;
inode->i_size = 3; inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700; inode->i_mode = S_IFLNK | 0700;
return; return;
} }
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/io.h> #include <asm/io.h>
extern unsigned long log_size;
extern struct wait_queue * log_wait;
extern int sys_syslog(int type, char * bug, int count); extern int sys_syslog(int type, char * bug, int count);
static int kmsg_open(struct inode * inode, struct file * file) static int kmsg_open(struct inode * inode, struct file * file)
...@@ -31,12 +34,23 @@ static int kmsg_read(struct inode * inode, struct file * file,char * buf, int co ...@@ -31,12 +34,23 @@ static int kmsg_read(struct inode * inode, struct file * file,char * buf, int co
return sys_syslog(2,buf,count); return sys_syslog(2,buf,count);
} }
static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
{
if (sel_type != SEL_IN)
return 0;
if (log_size)
return 1;
select_wait(&log_wait, wait);
return 0;
}
static struct file_operations proc_kmsg_operations = { static struct file_operations proc_kmsg_operations = {
NULL, /* kmsg_lseek */ NULL, /* kmsg_lseek */
kmsg_read, kmsg_read,
NULL, /* kmsg_write */ NULL, /* kmsg_write */
NULL, /* kmsg_readdir */ NULL, /* kmsg_readdir */
NULL, /* kmsg_select */ kmsg_select, /* kmsg_select */
NULL, /* kmsg_ioctl */ NULL, /* kmsg_ioctl */
NULL, /* mmap */ NULL, /* mmap */
kmsg_open, kmsg_open,
...@@ -57,5 +71,6 @@ struct inode_operations proc_kmsg_inode_operations = { ...@@ -57,5 +71,6 @@ struct inode_operations proc_kmsg_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -34,7 +34,8 @@ struct inode_operations proc_link_inode_operations = { ...@@ -34,7 +34,8 @@ struct inode_operations proc_link_inode_operations = {
proc_readlink, /* readlink */ proc_readlink, /* readlink */
proc_follow_link, /* follow_link */ proc_follow_link, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static int proc_follow_link(struct inode * dir, struct inode * inode, static int proc_follow_link(struct inode * dir, struct inode * inode,
...@@ -92,12 +93,22 @@ static int proc_follow_link(struct inode * dir, struct inode * inode, ...@@ -92,12 +93,22 @@ static int proc_follow_link(struct inode * dir, struct inode * inode,
static int proc_readlink(struct inode * inode, char * buffer, int buflen) static int proc_readlink(struct inode * inode, char * buffer, int buflen)
{ {
int i; int i;
unsigned int dev,ino;
char buf[64];
i = proc_follow_link(NULL, inode, 0, 0, &inode);
if (i)
return i;
if (!inode)
return -EIO;
dev = inode->i_dev;
ino = inode->i_ino;
iput(inode); iput(inode);
if (buflen > 3) i = sprintf(buf,"[%04x]:%u", dev, ino);
buflen = 3; if (buflen > i)
buflen = i;
i = 0; i = 0;
while (i++ < buflen) while (i < buflen)
put_fs_byte('-',buffer++); put_fs_byte(buf[i++],buffer++);
return i; return i;
} }
...@@ -12,6 +12,14 @@ ...@@ -12,6 +12,14 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/io.h> #include <asm/io.h>
/*
* mem_write isn't really a good idea right now. It needs
* to check a lot more: if the process we try to write to
* dies in the middle right now, mem_write will overwrite
* kernel memory.. This disables it altogether.
*/
#define mem_write NULL
static int mem_read(struct inode * inode, struct file * file,char * buf, int count) static int mem_read(struct inode * inode, struct file * file,char * buf, int count)
{ {
unsigned long addr, pid, cr3; unsigned long addr, pid, cr3;
...@@ -59,6 +67,8 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou ...@@ -59,6 +67,8 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou
return tmp-buf; return tmp-buf;
} }
#ifndef mem_write
static int mem_write(struct inode * inode, struct file * file,char * buf, int count) static int mem_write(struct inode * inode, struct file * file,char * buf, int count)
{ {
unsigned long addr, pid, cr3; unsigned long addr, pid, cr3;
...@@ -114,6 +124,8 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co ...@@ -114,6 +124,8 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co
return 0; return 0;
} }
#endif
static int mem_lseek(struct inode * inode, struct file * file, off_t offset, int orig) static int mem_lseek(struct inode * inode, struct file * file, off_t offset, int orig)
{ {
switch (orig) { switch (orig) {
...@@ -154,5 +166,6 @@ struct inode_operations proc_mem_inode_operations = { ...@@ -154,5 +166,6 @@ struct inode_operations proc_mem_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
...@@ -45,7 +45,8 @@ struct inode_operations proc_root_inode_operations = { ...@@ -45,7 +45,8 @@ struct inode_operations proc_root_inode_operations = {
NULL, /* readlink */ NULL, /* readlink */
NULL, /* follow_link */ NULL, /* follow_link */
NULL, /* bmap */ NULL, /* bmap */
NULL /* truncate */ NULL, /* truncate */
NULL /* permission */
}; };
static struct proc_dir_entry root_dir[] = { static struct proc_dir_entry root_dir[] = {
......
/* $Id: dma.h,v 1.5 1992/11/18 02:37:20 root Exp root $ /* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $
* linux/include/asm/dma.h: Defines for using and allocating dma channels. * linux/include/asm/dma.h: Defines for using and allocating dma channels.
* Written by Hennus Bergman, 1992. * Written by Hennus Bergman, 1992.
* High DMA channel support & info by Hannu Savolainen * High DMA channel support & info by Hannu Savolainen
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#define _ASM_DMA_H #define _ASM_DMA_H
#include <asm/io.h> /* need byte IO */ #include <asm/io.h> /* need byte IO */
#include <linux/kernel.h> /* need panic() [FIXME] */
#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
...@@ -143,9 +142,9 @@ static __inline__ void disable_dma(unsigned int dmanr) ...@@ -143,9 +142,9 @@ static __inline__ void disable_dma(unsigned int dmanr)
/* Clear the 'DMA Pointer Flip Flop'. /* Clear the 'DMA Pointer Flip Flop'.
* Write 0 for LSB/MSB, 1 for MSB/LSB access. * Write 0 for LSB/MSB, 1 for MSB/LSB access.
* Use this once to initialize the FF to a know state. * Use this once to initialize the FF to a know state.
* After that, keep track of it. :-) In order to do that, * After that, keep track of it. :-)
* dma_set_addr() and dma_set_count() should only be used wile * --- In order to do that, the DMA routines below should ---
* interrupts are disbled. * --- only be used while interrupts are disbled! ---
*/ */
static __inline__ void clear_dma_ff(unsigned int dmanr) static __inline__ void clear_dma_ff(unsigned int dmanr)
{ {
...@@ -219,7 +218,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) ...@@ -219,7 +218,7 @@ static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
* NOTE: from a manual: "the number of transfers is one more * NOTE: from a manual: "the number of transfers is one more
* than the initial word count"! This is taken into account. * than the initial word count"! This is taken into account.
* Assumes dma flip-flop is clear. * Assumes dma flip-flop is clear.
* NOTE 2: "count" must represent _words_ for channels 5-7. * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
*/ */
static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
{ {
...@@ -228,32 +227,33 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) ...@@ -228,32 +227,33 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
} else { } else {
outb( count & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
outb( (count>>8) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
} }
} }
/* Get DMA residue count. After a DMA transfer, this /* Get DMA residue count. After a DMA transfer, this
* should return zero. Reading this while a DMA transfer is
* should return zero. Reading this while a DMA transfer is * should return zero. Reading this while a DMA transfer is
* still in progress will return unpredictable results. * still in progress will return unpredictable results.
* If called before the channel has been used, it may return 1. * If called before the channel has been used, it may return 1.
* Otherwise, it returns the number of bytes (or words) left to * Otherwise, it returns the number of _bytes_ left to transfer.
* transfer, minus 1, modulo 64k. *
* Assumes DMA flip-flop is clear. * Assumes DMA flip-flop is clear.
*/ */
static __inline__ short int get_dma_residue(unsigned int dmanr) static __inline__ int get_dma_residue(unsigned int dmanr)
{ {
if (dmanr <= 3) { unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
return 1 + inb( ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ) + : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
(inb( ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ) << 8);
} else { /* using short to get 16-bit wrap around */
return 1 + inb( ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ) + short count = 1 + inb(io_port) +
(inb( ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ) << 8); ( inb(io_port) << 8 );
}
return (dmanr<=3)? count : (count<<1);
} }
/* These are in kernel/dma.c: */ /* These are in kernel/dma.c: */
extern int request_dma(unsigned int dmanr); /* reserve a DMA channel */ extern int request_dma(unsigned int dmanr); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */ extern void free_dma(unsigned int dmanr); /* release it again */
......
...@@ -60,10 +60,8 @@ ...@@ -60,10 +60,8 @@
"iret" "iret"
#define ACK_FIRST(mask) \ #define ACK_FIRST(mask) \
"inb $0x21,%al\n\t" \ "orb $" #mask ",_cache_21\n\t" \
"jmp 1f\n" \ "movb _cache_21,%al\n\t" \
"1:\tjmp 1f\n" \
"1:\torb $" #mask ",%al\n\t" \
"outb %al,$0x21\n\t" \ "outb %al,$0x21\n\t" \
"jmp 1f\n" \ "jmp 1f\n" \
"1:\tjmp 1f\n" \ "1:\tjmp 1f\n" \
...@@ -71,10 +69,8 @@ ...@@ -71,10 +69,8 @@
"outb %al,$0x20\n\t" "outb %al,$0x20\n\t"
#define ACK_SECOND(mask) \ #define ACK_SECOND(mask) \
"inb $0xA1,%al\n\t" \ "orb $" #mask ",_cache_A1\n\t" \
"jmp 1f\n" \ "movb _cache_A1,%al\n\t" \
"1:\tjmp 1f\n" \
"1:\torb $" #mask ",%al\n\t" \
"outb %al,$0xA1\n\t" \ "outb %al,$0xA1\n\t" \
"jmp 1f\n" \ "jmp 1f\n" \
"1:\tjmp 1f\n" \ "1:\tjmp 1f\n" \
...@@ -85,17 +81,13 @@ ...@@ -85,17 +81,13 @@
"1:\toutb %al,$0x20\n\t" "1:\toutb %al,$0x20\n\t"
#define UNBLK_FIRST(mask) \ #define UNBLK_FIRST(mask) \
"inb $0x21,%al\n\t" \ "andb $~(" #mask "),_cache_21\n\t" \
"jmp 1f\n" \ "movb _cache_21,%al\n\t" \
"1:\tjmp 1f\n" \
"1:\tandb $~(" #mask "),%al\n\t" \
"outb %al,$0x21\n\t" "outb %al,$0x21\n\t"
#define UNBLK_SECOND(mask) \ #define UNBLK_SECOND(mask) \
"inb $0xA1,%al\n\t" \ "andb $~(" #mask "),_cache_A1\n\t" \
"jmp 1f\n" \ "movb _cache_A1,%al\n\t" \
"1:\tjmp 1f\n" \
"1:\tandb $~(" #mask "),%al\n\t" \
"outb %al,$0xA1\n\t" "outb %al,$0xA1\n\t"
#define IRQ_NAME2(nr) nr##_interrupt() #define IRQ_NAME2(nr) nr##_interrupt()
...@@ -108,7 +100,7 @@ void IRQ_NAME(nr); \ ...@@ -108,7 +100,7 @@ void IRQ_NAME(nr); \
void FAST_IRQ_NAME(nr); \ void FAST_IRQ_NAME(nr); \
void BAD_IRQ_NAME(nr); \ void BAD_IRQ_NAME(nr); \
__asm__( \ __asm__( \
"\n.align 2\n" \ "\n.align 4\n" \
"_IRQ" #nr "_interrupt:\n\t" \ "_IRQ" #nr "_interrupt:\n\t" \
"pushl $-"#nr"-2\n\t" \ "pushl $-"#nr"-2\n\t" \
SAVE_ALL \ SAVE_ALL \
...@@ -124,25 +116,48 @@ __asm__( \ ...@@ -124,25 +116,48 @@ __asm__( \
UNBLK_##chip(mask) \ UNBLK_##chip(mask) \
"decl _intr_count\n\t" \ "decl _intr_count\n\t" \
"jne ret_from_sys_call\n\t" \ "jne ret_from_sys_call\n\t" \
"cmpl $0,_bh_active\n\t" \ "movl _bh_mask,%eax\n\t" \
"andl _bh_active,%eax\n\t" \
"je ret_from_sys_call\n\t" \ "je ret_from_sys_call\n\t" \
"incl _intr_count\n\t" \ "incl _intr_count\n\t" \
"sti\n\t" \ "sti\n\t" \
"bsfl %eax,%eax\n\t" \
"btrl %eax,_bh_active\n\t" \
"pushl %eax\n\t" \
"call _do_bottom_half\n\t" \ "call _do_bottom_half\n\t" \
"addl $4,%esp\n\t" \
"cli\n\t" \ "cli\n\t" \
"decl _intr_count\n\t" \ "decl _intr_count\n\t" \
"jmp ret_from_sys_call\n" \ "jmp ret_from_sys_call\n" \
"\n.align 2\n" \ "\n.align 4\n" \
"_fast_IRQ" #nr "_interrupt:\n\t" \ "_fast_IRQ" #nr "_interrupt:\n\t" \
SAVE_MOST \ SAVE_MOST \
ACK_##chip(mask) \ ACK_##chip(mask) \
"incl _intr_count\n\t" \
"pushl $" #nr "\n\t" \ "pushl $" #nr "\n\t" \
"call _do_fast_IRQ\n\t" \ "call _do_fast_IRQ\n\t" \
"addl $4,%esp\n\t" \ "addl $4,%esp\n\t" \
"cli\n\t" \ "cli\n\t" \
UNBLK_##chip(mask) \ UNBLK_##chip(mask) \
"decl _intr_count\n\t" \
"jne 1f\n\t" \
"movl _bh_mask,%eax\n\t" \
"andl _bh_active,%eax\n\t" \
"jne 2f\n" \
"1:\t" \
RESTORE_MOST \
"\n.align 4\n" \
"2:\tincl _intr_count\n\t" \
"sti\n\t" \
"bsfl %eax,%eax\n\t" \
"btrl %eax,_bh_active\n\t" \
"pushl %eax\n\t" \
"call _do_bottom_half\n\t" \
"addl $4,%esp\n\t" \
"cli\n\t" \
"decl _intr_count\n\t" \
RESTORE_MOST \ RESTORE_MOST \
"\n\n.align 2\n" \ "\n\n.align 4\n" \
"_bad_IRQ" #nr "_interrupt:\n\t" \ "_bad_IRQ" #nr "_interrupt:\n\t" \
"pushl %eax\n\t" \ "pushl %eax\n\t" \
ACK_##chip(mask) \ ACK_##chip(mask) \
......
...@@ -24,7 +24,7 @@ extern inline int tas(char * m) ...@@ -24,7 +24,7 @@ extern inline int tas(char * m)
{ {
char res; char res;
__asm__("xchg %0,%1":"=q" (res),"=m" (*m):"0" (0x1)); __asm__("xchgb %0,%1":"=q" (res),"=m" (*m):"0" (0x1));
return res; return res;
} }
......
...@@ -12,7 +12,13 @@ ...@@ -12,7 +12,13 @@
#ifndef UTS_NODENAME #ifndef UTS_NODENAME
#define UTS_NODENAME "(none)" /* set by sethostname() */ #define UTS_NODENAME "(none)" /* set by sethostname() */
#endif #endif
#ifdef CONFIG_M486
#define UTS_MACHINE "i486" /* hardware type */
#else
#define UTS_MACHINE "i386" /* hardware type */ #define UTS_MACHINE "i386" /* hardware type */
#endif
/* /*
* The definitions for UTS_RELEASE and UTS_VERSION are now defined * The definitions for UTS_RELEASE and UTS_VERSION are now defined
* in linux/version.h, and should only be used by linux/version.c * in linux/version.h, and should only be used by linux/version.c
......
...@@ -256,6 +256,7 @@ struct inode_operations { ...@@ -256,6 +256,7 @@ struct inode_operations {
int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **); int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **);
int (*bmap) (struct inode *,int); int (*bmap) (struct inode *,int);
void (*truncate) (struct inode *); void (*truncate) (struct inode *);
int (*permission) (struct inode *, int);
}; };
struct super_operations { struct super_operations {
......
...@@ -43,12 +43,12 @@ ...@@ -43,12 +43,12 @@
#define WIN_SPECIFY 0x91 #define WIN_SPECIFY 0x91
/* Bits for HD_ERROR */ /* Bits for HD_ERROR */
#define MARK_ERR 0x01 /* Bad address mark ? */ #define MARK_ERR 0x01 /* Bad address mark */
#define TRK0_ERR 0x02 /* couldn't find track 0 */ #define TRK0_ERR 0x02 /* couldn't find track 0 */
#define ABRT_ERR 0x04 /* ? */ #define ABRT_ERR 0x04 /* Command aborted */
#define ID_ERR 0x10 /* ? */ #define ID_ERR 0x10 /* ID field not found */
#define ECC_ERR 0x40 /* ? */ #define ECC_ERR 0x40 /* Uncorrectable ECC error */
#define BBD_ERR 0x80 /* ? */ #define BBD_ERR 0x80 /* block marked bad */
/* HDIO_GETGEO is the preferred choice - HDIO_REQ will be removed at some /* HDIO_GETGEO is the preferred choice - HDIO_REQ will be removed at some
......
...@@ -7,7 +7,8 @@ struct bh_struct { ...@@ -7,7 +7,8 @@ struct bh_struct {
void *data; void *data;
}; };
extern int bh_active; extern unsigned long bh_active;
extern unsigned long bh_mask;
extern struct bh_struct bh_base[32]; extern struct bh_struct bh_base[32];
/* Who gets which entry in bh_base. Things which will occur most often /* Who gets which entry in bh_base. Things which will occur most often
...@@ -20,8 +21,6 @@ enum { ...@@ -20,8 +21,6 @@ enum {
KEYBOARD_BH KEYBOARD_BH
}; };
void do_bottom_half();
extern inline void mark_bh(int nr) extern inline void mark_bh(int nr)
{ {
__asm__ __volatile__("btsl %1,%0":"=m" (bh_active):"ir" (nr)); __asm__ __volatile__("btsl %1,%0":"=m" (bh_active):"ir" (nr));
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#define IOCCMD_MASK 0x0000ffff /* command code */ #define IOCCMD_MASK 0x0000ffff /* command code */
#define IOCCMD_SHIFT 0 #define IOCCMD_SHIFT 0
#define _IO(c,d) (IOC_VOID | (d)<<16) | c) /* param encoded */ #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 /* use _IOXX(magic, subcode, arg_t) where arg_t is the type of the
* (last) argument field in the ioctl call, if present. * (last) argument field in the ioctl call, if present.
*/ */
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define _IOR(c,d,t) (IOC_OUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \ #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 */ /* WR rather than RW to avoid conflict with stdio.h */
#define _IOWR(c,d,t) (IOC_INOUT | (sizeof(t)<<16) & IOCSIZE_MASK) | \ #define _IOWR(c,d,t) (IOC_INOUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d) (c<<8) | d)
#endif /* _LINUX_IOCTL_H */ #endif /* _LINUX_IOCTL_H */
......
#ifndef __LINUX_KEYBOARD_H #ifndef __LINUX_KEYBOARD_H
#define __LINUX_KEYBOARD_H #define __LINUX_KEYBOARD_H
#include <linux/interrupt.h>
#define set_leds() mark_bh(KEYBOARD_BH)
/* /*
* Global flags: things that don't change between virtual consoles. * Global flags: things that don't change between virtual consoles.
* This includes things like "key-down" flags - if the shift key is * This includes things like "key-down" flags - if the shift key is
...@@ -65,10 +68,6 @@ extern struct kbd_struct kbd_table[]; ...@@ -65,10 +68,6 @@ extern struct kbd_struct kbd_table[];
#define LED_MASK 7 #define LED_MASK 7
#ifndef KBD_DEFFLAGS
#define KBD_DEFFLAGS ((1 << VC_NUMLOCK) | (1 << VC_REPEAT))
#endif
extern unsigned long kbd_init(unsigned long); extern unsigned long kbd_init(unsigned long);
extern inline int kbd_flag(int flag) extern inline int kbd_flag(int flag)
......
#ifndef _LINUX_LP_H #ifndef _LINUX_LP_H
#define _LINUX_LP_H #define _LINUX_LP_H
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/segment.h>
/* /*
* usr/include/linux/lp.h c.1991-1992 James Wiegand * usr/include/linux/lp.h c.1991-1992 James Wiegand
* many modifications copyright (C) 1992 Michael K. Johnson * many modifications copyright (C) 1992 Michael K. Johnson
...@@ -71,7 +64,7 @@ ...@@ -71,7 +64,7 @@
#define LP_B(minor) lp_table[(minor)].base /* IO address */ #define LP_B(minor) lp_table[(minor)].base /* IO address */
#define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */ #define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */
#define LP_S(minor) inb(LP_B((minor)) + 1) /* status port */ #define LP_S(minor) inb_p(LP_B((minor)) + 1) /* status port */
#define LP_C(minor) (lp_table[(minor)].base + 2) /* control port */ #define LP_C(minor) (lp_table[(minor)].base + 2) /* control port */
#define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */ #define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */
#define LP_TIME(minor) lp_table[(minor)].time /* wait time */ #define LP_TIME(minor) lp_table[(minor)].time /* wait time */
......
#ifndef _LINUX_NFS_H #ifndef _LINUX_NFS_H
#define _LINUX_NFS_H #define _LINUX_NFS_H
#define RPC_VERSION 2
#define NFS_PORT 2049 #define NFS_PORT 2049
#define NFS_MAXDATA 8192 #define NFS_MAXDATA 8192
#define NFS_MAXPATHLEN 1024 #define NFS_MAXPATHLEN 1024
...@@ -20,6 +18,10 @@ ...@@ -20,6 +18,10 @@
#define NFSMODE_SOCK 0140000 #define NFSMODE_SOCK 0140000
#define NFSMODE_FIFO 0010000 #define NFSMODE_FIFO 0010000
#ifdef KERNEL /* user programs should get these from the rpc header files */
#define RPC_VERSION 2
enum rpc_auth_flavor { enum rpc_auth_flavor {
RPC_AUTH_NULL = 0, RPC_AUTH_NULL = 0,
RPC_AUTH_UNIX = 1, RPC_AUTH_UNIX = 1,
...@@ -33,7 +35,7 @@ enum rpc_msg_type { ...@@ -33,7 +35,7 @@ enum rpc_msg_type {
enum rpc_reply_stat { enum rpc_reply_stat {
RPC_MSG_ACCEPTED = 0, RPC_MSG_ACCEPTED = 0,
RPC_MSG_DENIED, RPC_MSG_DENIED = 1,
}; };
enum rpc_accept_stat { enum rpc_accept_stat {
...@@ -57,6 +59,8 @@ enum rpc_auth_stat { ...@@ -57,6 +59,8 @@ enum rpc_auth_stat {
RPC_AUTH_TOOWEAK = 5, RPC_AUTH_TOOWEAK = 5,
}; };
#endif /* KERNEL */
enum nfs_stat { enum nfs_stat {
NFS_OK = 0, NFS_OK = 0,
NFSERR_PERM = 1, NFSERR_PERM = 1,
......
...@@ -40,6 +40,14 @@ ...@@ -40,6 +40,14 @@
#define NFS_MAX_RPC_TIMEOUT 600 #define NFS_MAX_RPC_TIMEOUT 600
/*
* Size of the lookup cache in units of number of entries cached.
* It is better not to make this too large although the optimimum
* depends on a usage and environment.
*/
#define NFS_LOOKUP_CACHE_SIZE 64
#define NFS_SUPER_MAGIC 0x6969 #define NFS_SUPER_MAGIC 0x6969
#define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* WARNING! Do not delete or change the order of these fields. If * WARNING! Do not delete or change the order of these fields. If
* a new field is required then add it to the end. The version field * a new field is required then add it to the end. The version field
* tracks which fields are present. This will ensure some measure of * tracks which fields are present. This will ensure some measure of
* mount-to-kernel version compatibilty. Most of these are used yet * mount-to-kernel version compatibilty. Some of these aren't used yet
* but here they are anyway. * but here they are anyway.
*/ */
......
...@@ -7,24 +7,6 @@ ...@@ -7,24 +7,6 @@
* Public License (GPL) * Public License (GPL)
*/ */
/*
* This our internal structure for keeping track of interrupt service
* routines.
*/
typedef struct struct_ISR *async_ISR;
struct struct_ISR {
int irq; /* The IRQ assigned for this device */
int port; /* The base port for this device */
/* (use is ISR specific) */
void (*ISR_proc)(async_ISR, int);
int line; /* The serial line (or base */
/* serial line) */
int refcnt; /* How many devices are depending on */
/* this interrupt (multiport boards) */
async_ISR next_ISR; /* For the linked list */
async_ISR prev_ISR;
};
/* /*
* This is our internal structure for each serial port's state. * This is our internal structure for each serial port's state.
* *
...@@ -37,7 +19,7 @@ struct struct_ISR { ...@@ -37,7 +19,7 @@ struct struct_ISR {
struct async_struct { struct async_struct {
int baud_base; int baud_base;
int port; int port;
async_ISR ISR; int irq;
int flags; int flags;
int type; int type;
struct tty_struct *tty; struct tty_struct *tty;
...@@ -48,6 +30,9 @@ struct async_struct { ...@@ -48,6 +30,9 @@ struct async_struct {
int x_char; /* xon/xoff characater */ int x_char; /* xon/xoff characater */
int event; int event;
int line; int line;
struct async_struct *next_port; /* For the linked list */
struct async_struct *prev_port;
}; };
/* /*
...@@ -92,7 +77,7 @@ struct async_struct { ...@@ -92,7 +77,7 @@ struct async_struct {
#define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ #define UART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */
#define UART_FCR_CLEAR_CMD (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT) #define UART_FCR_CLEAR_CMD (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT)
#define UART_FCR_SETUP_CMD (UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_14) #define UART_FCR_SETUP_CMD (UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_8)
/* /*
* These are the definitions for the Line Control Register * These are the definitions for the Line Control Register
......
...@@ -76,7 +76,8 @@ struct serial_struct { ...@@ -76,7 +76,8 @@ struct serial_struct {
int flags; int flags;
int xmit_fifo_size; int xmit_fifo_size;
int custom_divisor; int custom_divisor;
int reserved[8]; int baud_base;
int reserved[7];
}; };
/* /*
...@@ -92,7 +93,6 @@ struct serial_struct { ...@@ -92,7 +93,6 @@ struct serial_struct {
/* /*
* Definitions for async_struct (and serial_struct) flags field * Definitions for async_struct (and serial_struct) flags field
*/ */
#define ASYNC_NOSCRATCH 0x0001 /* 16XXX UART with no scratch register */
#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ #define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ #define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */
...@@ -101,7 +101,10 @@ struct serial_struct { ...@@ -101,7 +101,10 @@ struct serial_struct {
#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ #define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ #define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */
#define ASYNC_FLAGS 0x0037 /* Possible legal async flags */ #define ASYNC_FLAGS 0x0036 /* Possible legal async flags */
/* Internal flags used only by kernel/chr_drv/serial.c */
#define ASYNC_NO_IRQ 0x80000000 /* No IRQ was initialized */
#define IS_A_CONSOLE(min) (((min) & 0xC0) == 0x00) #define IS_A_CONSOLE(min) (((min) & 0xC0) == 0x00)
#define IS_A_SERIAL(min) (((min) & 0xC0) == 0x40) #define IS_A_SERIAL(min) (((min) & 0xC0) == 0x40)
...@@ -244,6 +247,7 @@ struct tty_struct { ...@@ -244,6 +247,7 @@ struct tty_struct {
#define TTY_CR_PENDING 2 #define TTY_CR_PENDING 2
#define TTY_SQ_THROTTLED 3 #define TTY_SQ_THROTTLED 3
#define TTY_RQ_THROTTLED 4 #define TTY_RQ_THROTTLED 4
#define TTY_IO_ERROR 5
#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
#define TTY_READ_FLUSH(tty) tty_read_flush((tty)) #define TTY_READ_FLUSH(tty) tty_read_flush((tty))
......
...@@ -16,6 +16,7 @@ struct vt_mode { ...@@ -16,6 +16,7 @@ struct vt_mode {
#define VT_SETMODE 0x5602 /* set mode of active vt */ #define VT_SETMODE 0x5602 /* set mode of active vt */
#define VT_AUTO 0x00 /* auto vt switching */ #define VT_AUTO 0x00 /* auto vt switching */
#define VT_PROCESS 0x01 /* process controls switching */ #define VT_PROCESS 0x01 /* process controls switching */
#define VT_ACKACQ 0x02 /* acknowledge switch */
struct vt_stat { struct vt_stat {
ushort v_active; /* active vt */ ushort v_active; /* active vt */
...@@ -28,5 +29,6 @@ struct vt_stat { ...@@ -28,5 +29,6 @@ struct vt_stat {
#define VT_RELDISP 0x5605 /* release display */ #define VT_RELDISP 0x5605 /* release display */
#define VT_ACTIVATE 0x5606 /* make vt active */ #define VT_ACTIVATE 0x5606 /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */
#endif /* _LINUX_VT_H */ #endif /* _LINUX_VT_H */
...@@ -128,6 +128,14 @@ void ffree_() ...@@ -128,6 +128,14 @@ void ffree_()
} }
void ffreep()
{
/* ffree st(i) + pop - unofficial code */
st(FPU_rm).tag = TW_Empty;
pop();
}
void fst_i_() void fst_i_()
{ {
/* fst st(i) */ /* fst st(i) */
......
...@@ -37,11 +37,21 @@ ...@@ -37,11 +37,21 @@
#define __BAD__ Un_impl /* Not implemented */ #define __BAD__ Un_impl /* Not implemented */
#define _d9_d8_ fstp_i /* unofficial code (19) */
#define _dc_d0_ fcom_st /* unofficial code (14) */
#define _dc_d8_ fcompst /* unofficial code (1c) */
#define _dd_c8_ fxch_i /* unofficial code (0d) */
#define _de_d0_ fcompst /* unofficial code (16) */
#define _df_c0_ ffreep /* unofficial code (07) ffree + pop */
#define _df_c8_ fxch_i /* unofficial code (0f) */
#define _df_d0_ fstp_i /* unofficial code (17) */
#define _df_d8_ fstp_i /* unofficial code (1f) */
static FUNC st_instr_table[64] = { static FUNC st_instr_table[64] = {
fadd__, fld_i_, __BAD__, __BAD__, fadd_i, ffree_, faddp_, __BAD__, fadd__, fld_i_, __BAD__, __BAD__, fadd_i, ffree_, faddp_, _df_c0_,
fmul__, fxch_i, __BAD__, __BAD__, fmul_i, __BAD__, fmulp_, __BAD__, fmul__, fxch_i, __BAD__, __BAD__, fmul_i, _dd_c8_, fmulp_, _df_c8_,
fcom_st, fp_nop, __BAD__, __BAD__, __BAD__, fst_i_, __BAD__, __BAD__, fcom_st, fp_nop, __BAD__, __BAD__, _dc_d0_, fst_i_, _de_d0_, _df_d0_,
fcompst, __BAD__, __BAD__, __BAD__, __BAD__, fstp_i, fcompp, __BAD__, fcompst, _d9_d8_, __BAD__, __BAD__, _dc_d8_, fstp_i, fcompp, _df_d8_,
fsub__, fp_etc, __BAD__, finit_, fsubri, fucom_, fsubrp, fstsw_, fsub__, fp_etc, __BAD__, finit_, fsubri, fucom_, fsubrp, fstsw_,
fsubr_, fconst, fucompp, __BAD__, fsub_i, fucomp, fsubp_, __BAD__, fsubr_, fconst, fucompp, __BAD__, fsub_i, fucomp, fsubp_, __BAD__,
fdiv__, trig_a, __BAD__, __BAD__, fdivri, __BAD__, fdivrp, __BAD__, fdiv__, trig_a, __BAD__, __BAD__, fdivri, __BAD__, fdivrp, __BAD__,
...@@ -56,10 +66,10 @@ static FUNC st_instr_table[64] = { ...@@ -56,10 +66,10 @@ static FUNC st_instr_table[64] = {
#define _null_ 4 /* Function illegal or not implemented */ #define _null_ 4 /* Function illegal or not implemented */
static unsigned char type_table[64] = { static unsigned char type_table[64] = {
_REGI_, _NONE_, _null_, _null_, _REGI_, _REGi_, _REGI_, _null_, _REGI_, _NONE_, _null_, _null_, _REGI_, _REGi_, _REGI_, _REGi_,
_REGI_, _REGI_, _null_, _null_, _REGI_, _null_, _REGI_, _null_, _REGI_, _REGI_, _null_, _null_, _REGI_, _REGI_, _REGI_, _REGI_,
_REGI_, _NONE_, _null_, _null_, _null_, _REG0_, _null_, _null_, _REGI_, _NONE_, _null_, _null_, _REGI_, _REG0_, _REGI_, _REG0_,
_REGI_, _null_, _null_, _null_, _null_, _REG0_, _REGI_, _null_, _REGI_, _REG0_, _null_, _null_, _REGI_, _REG0_, _REGI_, _REG0_,
_REGI_, _NONE_, _null_, _NONE_, _REGI_, _REGI_, _REGI_, _NONE_, _REGI_, _NONE_, _null_, _NONE_, _REGI_, _REGI_, _REGI_, _NONE_,
_REGI_, _NONE_, _REGI_, _null_, _REGI_, _REGI_, _REGI_, _null_, _REGI_, _NONE_, _REGI_, _null_, _REGI_, _REGI_, _REGI_, _null_,
_REGI_, _NONE_, _null_, _null_, _REGI_, _null_, _REGI_, _null_, _REGI_, _NONE_, _null_, _null_, _REGI_, _null_, _REGI_, _null_,
......
...@@ -36,6 +36,7 @@ extern void fp_nop(void); ...@@ -36,6 +36,7 @@ extern void fp_nop(void);
extern void fld_i_(void); extern void fld_i_(void);
extern void fxch_i(void); extern void fxch_i(void);
extern void ffree_(void); extern void ffree_(void);
extern void ffreep(void);
extern void fst_i_(void); extern void fst_i_(void);
extern void fstp_i(void); extern void fstp_i(void);
/* fpu_entry.c */ /* fpu_entry.c */
......
...@@ -38,9 +38,9 @@ static unsigned char type_table[32] = { ...@@ -38,9 +38,9 @@ static unsigned char type_table[32] = {
_null_, _null_, _null_, _null_, _null_, _null_, _null_, _null_,
_REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_,
_REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_, _REG0_,
_null_, _null_, _NONE_, _PUSH_, _NONE_, _null_, _NONE_, _PUSH_,
_NONE_, _PUSH_, _null_, _PUSH_, _NONE_, _PUSH_, _null_, _PUSH_,
_null_, _null_, _NONE_, _REG0_, _NONE_, _null_, _NONE_, _REG0_,
_NONE_, _REG0_, _NONE_, _REG0_ _NONE_, _REG0_, _NONE_, _REG0_
}; };
......
/* fdomain.c -- Future Domain TMC-1660/TMC-1680 driver /* fdomain.c -- Future Domain TMC-1660/TMC-1680 driver
* Created: Sun May 3 18:53:19 1992 by faith * Created: Sun May 3 18:53:19 1992 by faith
* Revised: Wed Dec 9 21:34:53 1992 by root * Revised: Sun Jan 10 01:23:29 1993 by root
* Author: Rickard E. Faith, faith@cs.unc.edu * Author: Rickard E. Faith, faith@cs.unc.edu
* Copyright 1992 Rickard E. Faith * Copyright 1992, 1993 Rickard E. Faith
* *
* $Log$ * $Log$
...@@ -16,29 +16,88 @@ ...@@ -16,29 +16,88 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* WARNING: THIS IS A BETA VERSION! **************************************************************************
* USE AT YOUR OWN RISK!
* BACKUP YOUR SYSTEM BEFORE USING!
DESCRIPTION:
* I would like to thank Maxtor, whose *free* 206 page manual on the LXT
* drives was very helpful: "LXT SCSI Products: Specifications and OEM This is the Linux low-level SCSI driver for Future Domain TMC-1660/1680
* Technical Manual (Revision B/September 1991)" and TMC-1670 SCSI host adapters.
* I wish that I could thank Future Domain for the necessary documentation,
* but I can't. I used the $25 "TMC-1800 SCSI Chip Specification" document REFERENCES USED:
* (FDC-1800T), which documents the *chip* and not the board. Without it,
* I would have been totally lost, but it would have been nice to have some "TMC-1800 SCSI Chip Specification (FDC-1800T)", Future Domain Corporation,
* example source. (The DOS BIOS source cost $250 and the UN*X driver 1990.
* source was $750 [both required a non-disclosure agreement]. Ever wonder
* why there are no freely available Future Domain drivers?) "LXT SCSI Products: Specifications and OEM Technical Manual (Revision
B/September 1991)", Maxtor Corporation, 1991.
* Thanks to: Todd Carrico (todd@wutc.wustl.edu), Dan Poirier
* (poirier@cs.unc.edu ), Ken Corey (kenc@sol.acs.unt.edu), C. de Bruin "7213S product Manual (Revision P3)", Maxtor Corporation, 1992.
* (bruin@dutiba.tudelft.nl) and Sakari Aaltonen (sakaria@vipunen.hit.fi)
* for alpha testing. Also thanks to Drew Eckhardt (drew@cs.colorado.edu) Private communications, Drew Eckhardt (drew@cs.colorado.edu) and Eric
* and Eric Youngdale (eric@tantalus.nrl.navy.mil) for answering questions, Youngdale (eric@tantalus.nrl.navy.mil), 1992.
* and to Doug Hoffman (hoffman@cs.unc.edu) for lending me SCSI devices to
* make the driver more robust. */
NOTES ON REFERENCES:
The Maxtor manuals were free. Maxtor telephone technical support is
great!
The Future Domain manual is $25. It documents the chip, not the TMC-16x0
boards, so some information I had to guess at. Future Domain sells DOS
BIOS source for $250 and the UN*X driver source was $750, but these
require a non-disclosure agreement, so even if I could afford them, they
would *not* have been useful for writing this publically distributable
driver. Future Domain technical support has provided some information on
the phone, and this has been somewhat helpful.
ALPHA TESTERS:
Todd Carrico (todd@wutc.wustl.edu), Dan Poirier (poirier@cs.unc.edu ), Ken
Corey (kenc@sol.acs.unt.edu), C. de Bruin (bruin@dutiba.tudelft.nl),
Sakari Aaltonen (sakaria@vipunen.hit.fi), John Rice
(rice@xanth.cs.odu.edu), and Brad Yearwood (brad@optilink.com).
NOTES ON USER DEFINABLE OPTIONS:
DEBUG: This turns on the printing of various debug informaiton.
ENABLE_PARITY: This turns on SCSI parity checking. With the current
driver, all attached devices must support SCSI parity. If none of your
devices support parity, then you can probably get the driver to work by
turning this option off. I have no way of testing this, however.
QUEUE: Enable "command queueing." This is supported by the higher level
SCSI code, and allows the kernel to continue to schedule tasks while the
SCSI request is pending. If this option is turned off, then everything
will "freeze" during SCSI requests, and system performance will become
unbearable. Later, this will allow multiple outstanding SCSI requests. I
have received reports that if this option is turned off, the driver will
no longer function correctly. I have not had time to track down this bug,
since I hope to make the driver work for everyone with QUEUE on.
FIFO_COUNT: The host adapter has an 8K cache. When this many 512 byte
blocks are filled by the SCSI device, an interrupt will be raised.
Therefore, this could be as low as 0, or as high as 16. Note, however,
that values which are too high or too low seem to prevent any interrupts
from occuring, and thereby lock up the machine. I have found that 2 is a
good number, but throughput may be increased by changing this value to
values which are close to 2. Please let me know if you try any different
values.
DO_DETECT: This activates some old scan code which was needed before the
high level drivers got fixed. If you are having toruble with the driver,
turning this on should not hurt, and might help. Please let me know if
this is the case, since this code will be removed from future drivers.
RESELECTION: DO *NOT* USE THIS OPTION! This turns on SCSI device
disconnect and reselection, which does not work at this time. When I get
this working, it will support multiple outstanding SCSI commands.
**************************************************************************/
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -49,7 +108,7 @@ ...@@ -49,7 +108,7 @@
#include <asm/system.h> #include <asm/system.h>
#include <linux/errno.h> #include <linux/errno.h>
#define VERSION "3.2" /* Change with each revision */ #define VERSION "3.3" /* Change with each revision */
/* START OF USER DEFINABLE OPTIONS */ /* START OF USER DEFINABLE OPTIONS */
...@@ -154,18 +213,15 @@ static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 }; ...@@ -154,18 +213,15 @@ static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
READ EVERY WORD, ESPECIALLY THE WORD *NOT* READ EVERY WORD, ESPECIALLY THE WORD *NOT*
This driver works *ONLY* for Future Domain cards using the This driver works *ONLY* for Future Domain cards using the TMC-1800 chip.
TMC-1800 chip. This includes models TMC-1660 and TMC-1680 This includes models TMC-1660, 1670, and 1680 *ONLY*.
*ONLY*.
The following BIOS signatures have been tried with this driver. These The following BIOS signatures have been tried with this driver. These
signatures are for boards which do *NOT* work with this driver (but the signatures are for boards which do *NOT* work with this driver (but the
first one should work with the Seagate driver): first one should work with the Seagate driver):
FUTURE DOMAIN COPR. (C) 1986-1989 V6.0A7/28/90 FUTURE DOMAIN COPR. (C) 1986-1989 V6.0A7/28/90
FUTURE DOMAIN CORP. (C) 1986-1990 V6.0209/18/90 FUTURE DOMAIN CORP. (C) 1986-1990 V6.0209/18/90
FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90 FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90
*/ */
...@@ -175,8 +231,10 @@ struct signature { ...@@ -175,8 +231,10 @@ struct signature {
int sig_offset; int sig_offset;
int sig_length; int sig_length;
} signatures[] = { } signatures[] = {
{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.0 7/28/89", 5, 50 }, /* 1 2 3 4 5 6 */
{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800", 5, 37 }, /* 123456789012345678901234567890123456789012345678901234567890 */
{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.07/28/89", 5, 50 },
{ "FUTURE DOMAIN CORP. (C) 1992 V3.00.004/02/92", 5, 44 },
/* READ NOTICE ABOVE *BEFORE* YOU WASTE YOUR TIME ADDING A SIGANTURE */ /* READ NOTICE ABOVE *BEFORE* YOU WASTE YOUR TIME ADDING A SIGANTURE */
}; };
...@@ -510,7 +568,7 @@ int fdomain_16x0_detect( int hostnum ) ...@@ -510,7 +568,7 @@ int fdomain_16x0_detect( int hostnum )
const char *fdomain_16x0_info(void) const char *fdomain_16x0_info(void)
{ {
static char buffer[] = static char buffer[] =
"Future Domain TMC-1660/TMC-1680 SCSI driver version " "Future Domain TMC-16x0 SCSI driver version "
VERSION VERSION
"\n"; "\n";
return buffer; return buffer;
......
/* fdomain.h -- Header for Future Domain TMC-1660/TMC-1680 driver /* fdomain.h -- Header for Future Domain TMC-1660/TMC-1680 driver
* Created: Sun May 3 18:47:33 1992 * Created: Sun May 3 18:47:33 1992
* Revised: Fri Nov 27 22:12:55 1992 by root * Revised: Sun Jan 10 00:54:29 1993 by root
* Author: Rickard E. Faith, faith@cs.unc.edu * Author: Rickard E. Faith, faith@cs.unc.edu
* Copyright 1992 Rickard E. Faith * Copyright 1992, 1993 Rickard E. Faith
* This program comes with ABSOLUTELY NO WARRANTY. * This program comes with ABSOLUTELY NO WARRANTY.
* *
* $Log$ * $Log$
...@@ -19,7 +19,7 @@ int fdomain_16x0_reset( void ); ...@@ -19,7 +19,7 @@ int fdomain_16x0_reset( void );
int fdomain_16x0_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) ); int fdomain_16x0_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) );
int fdomain_16x0_biosparam( int, int, int * ); int fdomain_16x0_biosparam( int, int, int * );
#define FDOMAIN_16X0 { "Future Domain TMC-1660/TMC-1680", \ #define FDOMAIN_16X0 { "Future Domain TMC-16x0", \
fdomain_16x0_detect, \ fdomain_16x0_detect, \
fdomain_16x0_info, \ fdomain_16x0_info, \
fdomain_16x0_command, \ fdomain_16x0_command, \
......
...@@ -107,6 +107,8 @@ extern int last_reset[]; ...@@ -107,6 +107,8 @@ extern int last_reset[];
static struct blist blacklist[] = static struct blist blacklist[] =
{{"TANDBERG","TDC 3600","U07"}, /* Locks up if polled for lun != 0 */ {{"TANDBERG","TDC 3600","U07"}, /* Locks up if polled for lun != 0 */
{"SEAGATE","ST296","921"}, /* Responds to all lun */ {"SEAGATE","ST296","921"}, /* Responds to all lun */
{"SONY","CD-ROM CDU-541","4.3d"},
{"DENON","DRD-25X","V"}, /* A cdrom that locks up when probed at lun != 0 */
{NULL, NULL, NULL}}; {NULL, NULL, NULL}};
static int blacklisted(char * response_data){ static int blacklisted(char * response_data){
...@@ -427,8 +429,10 @@ Scsi_Cmnd * request_queueable (struct request * req, int index) ...@@ -427,8 +429,10 @@ Scsi_Cmnd * request_queueable (struct request * req, int index)
if (req) { if (req) {
memcpy(&SCpnt->request, req, sizeof(struct request)); memcpy(&SCpnt->request, req, sizeof(struct request));
req->dev = -1; req->dev = -1;
} else } else {
SCpnt->request.dev = 0xffff; /* Busy, but no request */ SCpnt->request.dev = 0xffff; /* Busy, but no request */
SCpnt->request.waiting = NULL; /* And no one is waiting for the device either */
};
SCpnt->use_sg = 0; /* Reset the scatter-gather flag */ SCpnt->use_sg = 0; /* Reset the scatter-gather flag */
return SCpnt; return SCpnt;
...@@ -491,6 +495,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, int index, int wait) ...@@ -491,6 +495,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, int index, int wait)
*reqp = req->next; *reqp = req->next;
} else { } else {
SCpnt->request.dev = 0xffff; /* Busy */ SCpnt->request.dev = 0xffff; /* Busy */
SCpnt->request.waiting = NULL; /* And no one is waiting for this to complete */
}; };
sti(); sti();
break; break;
......
...@@ -154,8 +154,16 @@ static struct sigaction seagate_sigaction = { ...@@ -154,8 +154,16 @@ static struct sigaction seagate_sigaction = {
base_address = NULL; base_address = NULL;
#ifdef OVERRIDE #ifdef OVERRIDE
base_address = (void *) OVERRIDE; base_address = (void *) OVERRIDE;
/* CONTROLLER is used to override controller (SEAGATE or FD). PM: 07/01/93 */
#ifdef CONTROLLER
controller_type = CONTROLLER;
#else
#error Please use -DCONTROLLER=SEAGATE or -DCONTROLLER=FD to override controller type
#endif
#ifdef DEBUG #ifdef DEBUG
printk("Base address overridden to %x\n", base_address); printk("Base address overridden to %x, controller type is %s\n",
base_address,controller_type == SEAGATE ? "SEAGATE" : "FD");
#endif #endif
#else #else
/* /*
...@@ -274,8 +282,10 @@ static void seagate_reconnect_intr (int unused) ...@@ -274,8 +282,10 @@ static void seagate_reconnect_intr (int unused)
printk("scsi%d : done_fn(%d,%08x)", hostno, printk("scsi%d : done_fn(%d,%08x)", hostno,
hostno, temp); hostno, temp);
#endif #endif
if(!SCint) panic("SCint == NULL in seagate");
SCint->result = temp; SCint->result = temp;
done_fn (SCint); done_fn (SCint);
SCint = NULL;
} }
else else
printk("done_fn() not defined.\n"); printk("done_fn() not defined.\n");
...@@ -311,6 +321,7 @@ int seagate_st0x_queue_command (Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -311,6 +321,7 @@ int seagate_st0x_queue_command (Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
{ {
SCpnt->result = result; SCpnt->result = result;
done_fn (SCpnt); done_fn (SCpnt);
SCint = NULL;
return 1; return 1;
} }
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
Kai Makisara, Nov 9, 1992 email makisara@vtinsx.ins.vtt.fi or Kai Makisara, Nov 9, 1992 email makisara@vtinsx.ins.vtt.fi or
Kai.Makisara@vtt.fi Kai.Makisara@vtt.fi
Last changes Dec 19, 1992. Last changes Jan 3, 1993.
*/ */
#include <linux/fs.h> #include <linux/fs.h>
...@@ -856,8 +856,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file, ...@@ -856,8 +856,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
dev = dev & 127; dev = dev & 127;
SCpnt = allocate_device(NULL, scsi_tapes[dev].device->index, 1);
memset(cmd, 0, 10); memset(cmd, 0, 10);
switch (cmd_in) { switch (cmd_in) {
case MTFSF: case MTFSF:
...@@ -905,7 +903,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file, ...@@ -905,7 +903,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
cmd[2] = (ltmp >> 16); cmd[2] = (ltmp >> 16);
cmd[3] = (ltmp >> 8); cmd[3] = (ltmp >> 8);
cmd[4] = ltmp; cmd[4] = ltmp;
SCpnt->result = -1;
#ifdef DEBUG #ifdef DEBUG
if (cmd[2] & 0x80) if (cmd[2] & 0x80)
ltmp = 0xff000000; ltmp = 0xff000000;
...@@ -1042,10 +1039,10 @@ static int st_int_ioctl(struct inode * inode,struct file * file, ...@@ -1042,10 +1039,10 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
break; break;
default: default:
printk("st%d: Unknown st_ioctl command %x.\n", dev, cmd_in); printk("st%d: Unknown st_ioctl command %x.\n", dev, cmd_in);
SCpnt->request.dev = -1; /* Mark as not busy */
return (-ENOSYS); return (-ENOSYS);
} }
SCpnt = allocate_device(NULL, scsi_tapes[dev].device->index, 1);
SCpnt->sense_buffer[0] = 0; SCpnt->sense_buffer[0] = 0;
SCpnt->request.dev = dev; SCpnt->request.dev = dev;
scsi_do_cmd(SCpnt, scsi_do_cmd(SCpnt,
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#define NPAR 16 #define NPAR 16
extern void vt_init(void); extern void vt_init(void);
extern void set_leds(void);
unsigned long video_num_columns; /* Number of text columns */ unsigned long video_num_columns; /* Number of text columns */
unsigned long video_num_lines; /* Number of test lines */ unsigned long video_num_lines; /* Number of test lines */
......
...@@ -16,6 +16,15 @@ ...@@ -16,6 +16,15 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/keyboard.h> #include <linux/keyboard.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/config.h>
#ifndef KBD_DEFFLAGS
#ifdef CONFIG_KBD_META
#define KBD_DEFFLAGS ((1 << VC_NUMLOCK) | (1 << VC_REPEAT) | (1 << VC_META))
#else
#define KBD_DEFFLAGS ((1 << VC_NUMLOCK) | (1 << VC_REPEAT))
#endif
#endif
/* /*
* The default IO slowdown is doing 'inb()'s from 0x61, which should be * The default IO slowdown is doing 'inb()'s from 0x61, which should be
...@@ -36,6 +45,7 @@ unsigned long kbd_flags = 0; ...@@ -36,6 +45,7 @@ unsigned long kbd_flags = 0;
unsigned long kbd_dead_keys = 0; unsigned long kbd_dead_keys = 0;
unsigned long kbd_prev_dead_keys = 0; unsigned long kbd_prev_dead_keys = 0;
static int want_console = -1;
struct kbd_struct kbd_table[NR_CONSOLES]; struct kbd_struct kbd_table[NR_CONSOLES];
static struct kbd_struct * kbd = kbd_table; static struct kbd_struct * kbd = kbd_table;
static struct tty_struct * tty = NULL; static struct tty_struct * tty = NULL;
...@@ -50,7 +60,6 @@ static int npadch = 0; ...@@ -50,7 +60,6 @@ static int npadch = 0;
fptr key_table[]; fptr key_table[];
static void put_queue(int); static void put_queue(int);
void set_leds(void);
static void applkey(int); static void applkey(int);
static void cur(int); static void cur(int);
static unsigned int handle_diacr(unsigned int); static unsigned int handle_diacr(unsigned int);
...@@ -136,8 +145,8 @@ static void keyboard_interrupt(int int_pt_regs) ...@@ -136,8 +145,8 @@ static void keyboard_interrupt(int int_pt_regs)
key_table[scancode](scancode); key_table[scancode](scancode);
rep = scancode; rep = scancode;
end_kbd_intr: end_kbd_intr:
do_keyboard_interrupt();
send_cmd(0xAE); send_cmd(0xAE);
mark_bh(KEYBOARD_BH);
} }
static void put_queue(int ch) static void put_queue(int ch)
...@@ -239,7 +248,6 @@ static void caps(int sc) ...@@ -239,7 +248,6 @@ static void caps(int sc)
return; /* key already pressed: defeat repeat */ return; /* key already pressed: defeat repeat */
set_kbd_flag(KG_CAPSLOCK); set_kbd_flag(KG_CAPSLOCK);
chg_vc_kbd_flag(kbd,VC_CAPSLOCK); chg_vc_kbd_flag(kbd,VC_CAPSLOCK);
set_leds();
} }
static void uncaps(int sc) static void uncaps(int sc)
...@@ -272,20 +280,16 @@ static void scroll(int sc) ...@@ -272,20 +280,16 @@ static void scroll(int sc)
show_ptregs(); show_ptregs();
else if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL)) else if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL))
show_state(); show_state();
else { else
chg_vc_kbd_flag(kbd,VC_SCROLLOCK); chg_vc_kbd_flag(kbd,VC_SCROLLOCK);
set_leds();
}
} }
static void num(int sc) static void num(int sc)
{ {
if (vc_kbd_flag(kbd,VC_APPLIC)) if (vc_kbd_flag(kbd,VC_APPLIC))
applkey(0x50); applkey(0x50);
else { else
chg_vc_kbd_flag(kbd,VC_NUMLOCK); chg_vc_kbd_flag(kbd,VC_NUMLOCK);
set_leds();
}
} }
static void applkey(int key) static void applkey(int key)
...@@ -1249,7 +1253,7 @@ static void func(int sc) ...@@ -1249,7 +1253,7 @@ static void func(int sc)
return; return;
} }
if (kbd_flag(KG_ALT)) if (kbd_flag(KG_ALT))
change_console(sc); want_console = sc;
else else
if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT)) /* DEC F11 - F20 */ if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT)) /* DEC F11 - F20 */
puts_queue(func_table[1][sc]); puts_queue(func_table[1][sc]);
...@@ -1334,21 +1338,34 @@ static int send_data(unsigned char data) ...@@ -1334,21 +1338,34 @@ static int send_data(unsigned char data)
return 0; return 0;
} }
/*
* This routine is the bottom half of the keyboard interrupt
* routine, and runs with all interrupts enabled. It does
* console changing, led setting and copy_to_cooked, which can
* take a reasonably long time.
*
* Aside from timing (which isn't really that important for
* keyboard interrupts as they happen often), using the software
* interrupt routines for this thing allows us to easily mask
* this when we don't want any of the above to happen. Not yet
* used, but this allows for easy and efficient race-condition
* prevention later on.
*/
static void kbd_bh(void * unused) static void kbd_bh(void * unused)
{ {
static unsigned char old_leds = -1; static unsigned char old_leds = -1;
unsigned char leds = kbd_table[fg_console].flags & LED_MASK; unsigned char leds = kbd_table[fg_console].flags & LED_MASK;
if (leds == old_leds) if (leds != old_leds) {
return;
old_leds = leds; old_leds = leds;
if (!send_data(0xed) || !send_data(leds)) if (!send_data(0xed) || !send_data(leds))
send_data(0xf4); /* re-enable kbd if any errors */ send_data(0xf4); /* re-enable kbd if any errors */
} }
if (want_console >= 0) {
void set_leds(void) change_console(want_console);
{ want_console = -1;
mark_bh(KEYBOARD_BH); }
do_keyboard_interrupt();
} }
long no_idt[2] = {0, 0}; long no_idt[2] = {0, 0};
...@@ -1363,7 +1380,7 @@ void hard_reset_now(void) ...@@ -1363,7 +1380,7 @@ void hard_reset_now(void)
int i, j; int i, j;
extern unsigned long pg0[1024]; extern unsigned long pg0[1024];
cli(); sti();
/* rebooting needs to touch the page at absolute addr 0 */ /* rebooting needs to touch the page at absolute addr 0 */
pg0[0] = 7; pg0[0] = 7;
*((unsigned short *)0x472) = 0x1234; *((unsigned short *)0x472) = 0x1234;
......
/* Copyright (C) 1992 by Jim Weigand, Linus Torvalds, and Michael K. Johnson /* Copyright (C) 1992 by Jim Weigand, Linus Torvalds, and Michael K. Johnson
*/ */
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/lp.h> #include <linux/lp.h>
/* sched.h is included from lp.h */
#include <asm/io.h>
#include <asm/segment.h>
/* /*
* All my debugging code assumes that you debug with only one printer at * All my debugging code assumes that you debug with only one printer at
...@@ -16,10 +21,10 @@ static int lp_reset(int minor) ...@@ -16,10 +21,10 @@ static int lp_reset(int minor)
int testvalue; int testvalue;
/* reset value */ /* reset value */
outb(0, LP_C(minor)); outb_p(0, LP_C(minor));
for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++) for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++)
; ;
outb(LP_PSELECP | LP_PINITP, LP_C(minor)); outb_p(LP_PSELECP | LP_PINITP, LP_C(minor));
return LP_S(minor); return LP_S(minor);
} }
...@@ -32,7 +37,7 @@ static int lp_char(char lpchar, int minor) ...@@ -32,7 +37,7 @@ static int lp_char(char lpchar, int minor)
int retval = 0, wait = 0; int retval = 0, wait = 0;
unsigned long count = 0; unsigned long count = 0;
outb(lpchar, LP_B(minor)); outb_p(lpchar, LP_B(minor));
do { do {
retval = LP_S(minor); retval = LP_S(minor);
count ++; count ++;
...@@ -54,10 +59,10 @@ static int lp_char(char lpchar, int minor) ...@@ -54,10 +59,10 @@ static int lp_char(char lpchar, int minor)
low, according spec. Some printers need it, others don't. */ low, according spec. Some printers need it, others don't. */
while(wait != LP_WAIT(minor)) wait++; while(wait != LP_WAIT(minor)) wait++;
/* control port takes strobe high */ /* control port takes strobe high */
outb(( LP_PSELECP | LP_PINITP | LP_PSTROBE ), ( LP_C( minor ))); outb_p(( LP_PSELECP | LP_PINITP | LP_PSTROBE ), ( LP_C( minor )));
while(wait) wait--; while(wait) wait--;
/* take strobe low */ /* take strobe low */
outb(( LP_PSELECP | LP_PINITP ), ( LP_C( minor ))); outb_p(( LP_PSELECP | LP_PINITP ), ( LP_C( minor )));
/* get something meaningful for return value */ /* get something meaningful for return value */
return LP_S(minor); return LP_S(minor);
} }
...@@ -152,7 +157,7 @@ static int lp_write(struct inode * inode, struct file * file, char * buf, int co ...@@ -152,7 +157,7 @@ static int lp_write(struct inode * inode, struct file * file, char * buf, int co
static int lp_lseek(struct inode * inode, struct file * file, static int lp_lseek(struct inode * inode, struct file * file,
off_t offset, int origin) off_t offset, int origin)
{ {
return -EINVAL; return -ESPIPE;
} }
static int lp_open(struct inode * inode, struct file * file) static int lp_open(struct inode * inode, struct file * file)
...@@ -232,10 +237,10 @@ long lp_init(long kmem_start) ...@@ -232,10 +237,10 @@ long lp_init(long kmem_start)
/* take on all known port values */ /* take on all known port values */
for (offset = 0; offset < LP_NO; offset++) { for (offset = 0; offset < LP_NO; offset++) {
/* write to port & read back to check */ /* write to port & read back to check */
outb( LP_DUMMY, LP_B(offset)); outb_p( LP_DUMMY, LP_B(offset));
for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++) for (testvalue = 0 ; testvalue < LP_DELAY ; testvalue++)
; ;
testvalue = inb(LP_B(offset)); testvalue = inb_p(LP_B(offset));
if (testvalue != 255) { if (testvalue != 255) {
LP_F(offset) |= LP_EXIST; LP_F(offset) |= LP_EXIST;
lp_reset(offset); lp_reset(offset);
......
This diff is collapsed.
This diff is collapsed.
...@@ -20,24 +20,24 @@ ...@@ -20,24 +20,24 @@
#include "vt_kern.h" #include "vt_kern.h"
/* /*
* Console (vt and kd) routines, as defined by USL SVR4 manual * Console (vt and kd) routines, as defined by USL SVR4 manual, and by
* experimentation and study of X386 SYSV handling.
* *
* One point of difference: SYSV vt's are /dev/vtX, which X >= 0, and * One point of difference: SYSV vt's are /dev/vtX, which X >= 0, and
* /dev/console is a separate ttyp. Under Linux, /dev/tty0 is /dev/console, * /dev/console is a separate ttyp. Under Linux, /dev/tty0 is /dev/console,
* and the vc start at /dev/ttyX, X >= 1. We maintain that here, so we will * and the vc start at /dev/ttyX, X >= 1. We maintain that here, so we will
* always treat our set of vt as numbered 1..NR_CONSOLES (corresponding to * always treat our set of vt as numbered 1..NR_CONSOLES (corresponding to
* ttys 0..NR_CONSOLES-1). * ttys 0..NR_CONSOLES-1). Explicitly naming VT 0 is illegal, but using
* * /dev/tty0 (fg_console) as a target is legal, since an implicit aliasing
* Mostly done for X386, but with some slight differences and omissions. * to the current console is done by the main ioctl code.
* Should be useable by other SYSV programs in the future.
*/ */
struct vt_cons vt_cons[NR_CONSOLES]; struct vt_cons vt_cons[NR_CONSOLES];
extern int sys_ioperm(unsigned long from, unsigned long num, int on); extern int sys_ioperm(unsigned long from, unsigned long num, int on);
extern void set_leds(void);
extern void change_console(unsigned int new_console); extern void change_console(unsigned int new_console);
extern void complete_change_console(unsigned int new_console); extern void complete_change_console(unsigned int new_console);
extern int vt_waitactive(void);
/* /*
* these are the valid i/o ports we're allowed to change. they map all the * these are the valid i/o ports we're allowed to change. they map all the
...@@ -282,6 +282,25 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -282,6 +282,25 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
return 0; return 0;
} }
/*
* Returns global vt state. Note that VT 0 is always open, since
* it's an alias for the current VT, and people can't use it here.
*/
case VT_GETSTATE:
{
struct vt_stat *vtstat = (struct vt_stat *)arg;
unsigned short state, mask;
verify_area((void *)vtstat, sizeof(struct vt_stat));
put_fs_word(fg_console + 1, &vtstat->v_active);
state = 1; /* /dev/tty0 is always open */
for (i = 1, mask = 2; i <= NR_CONSOLES; ++i, mask <<= 1)
if (tty_table[i] && tty_table[i]->count > 0)
state |= mask;
put_fs_word(state, &vtstat->v_state);
return 0;
}
/* /*
* Returns the first available (non-opened) console. * Returns the first available (non-opened) console.
*/ */
...@@ -304,38 +323,69 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -304,38 +323,69 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
change_console(arg - 1); change_console(arg - 1);
return 0; return 0;
/*
* wait until the specified VT has been activated
*/
case VT_WAITACTIVE:
if (arg == 0 || arg > NR_CONSOLES)
return -ENXIO;
while (fg_console != arg - 1)
{
if (vt_waitactive() < 0)
return -EINTR;
}
return 0;
/* /*
* If a vt is under process control, the kernel will not switch to it * If a vt is under process control, the kernel will not switch to it
* immediately, but postpone the operation until the process calls this * immediately, but postpone the operation until the process calls this
* ioctl, allowing the switch to complete. * ioctl, allowing the switch to complete.
* *
* XXX Under X, the switching code calls VT_RELDISP with an arg of 2 * According to the X sources this is the behavior:
* when it has switched back to it's vt. That's not kosher according * 0: pending switch-from not OK
* to my documentation, which says this is only called when releasing * 1: pending switch-from OK
* the vt under your control. * 2: completed switch-to OK
*/ */
case VT_RELDISP: case VT_RELDISP:
if (vt_cons[console].vt_mode.mode != VT_PROCESS || if (vt_cons[console].vt_mode.mode != VT_PROCESS)
vt_cons[console].vt_newvt < 0)
return -EINVAL; return -EINVAL;
if (arg != 0) /*
* Switching-from response
*/
if (vt_cons[console].vt_newvt >= 0)
{
if (arg == 0)
/*
* Switch disallowed, so forget we were trying
* to do it.
*/
vt_cons[console].vt_newvt = -1;
else
{ {
/* /*
* If arg is nonzero, the current vt has been released, * The current vt has been released, so
* so we can go ahead and complete the switch. * complete the switch.
*/ */
int newvt = vt_cons[console].vt_newvt; int newvt = vt_cons[console].vt_newvt;
vt_cons[console].vt_newvt = -1; vt_cons[console].vt_newvt = -1;
complete_change_console(newvt); complete_change_console(newvt);
} }
}
/*
* Switched-to response
*/
else else
{ {
/* /*
* Mark that we've performed our part and return. * If it's just an ACK, ignore it
*/ */
vt_cons[console].vt_newvt = -1; if (arg != VT_ACKACQ)
return -EINVAL;
} }
return 0; return 0;
default: default:
......
...@@ -35,9 +35,11 @@ ...@@ -35,9 +35,11 @@
#define CR0_NE 32 #define CR0_NE 32
static unsigned long intr_count=0; static unsigned long intr_count=0;
static unsigned char cache_21 = 0xff;
static unsigned char cache_A1 = 0xff;
/* I'll use an array for speed. and bitmap for speed. */ unsigned long bh_active = 0;
int bh_active=0; unsigned long bh_mask = 0xFFFFFFFF;
struct bh_struct bh_base[32]; struct bh_struct bh_base[32];
/* /*
...@@ -47,13 +49,10 @@ struct bh_struct bh_base[32]; ...@@ -47,13 +49,10 @@ struct bh_struct bh_base[32];
* called only when bh_active is non-zero and when there aren't any * called only when bh_active is non-zero and when there aren't any
* nested irq's active. * nested irq's active.
*/ */
void do_bottom_half(void) void do_bottom_half(int nr)
{ {
struct bh_struct *bh; struct bh_struct *bh;
int nr;
__asm__ __volatile__("bsfl %1,%0":"=r" (nr):"m" (bh_active));
__asm__ __volatile__("btcl %1,%0":"=m" (bh_active):"r" (nr));
bh = bh_base+nr; bh = bh_base+nr;
if (bh->routine != NULL) if (bh->routine != NULL)
bh->routine(bh->data); bh->routine(bh->data);
...@@ -186,11 +185,14 @@ int irqaction(unsigned int irq, struct sigaction * new) ...@@ -186,11 +185,14 @@ int irqaction(unsigned int irq, struct sigaction * new)
set_intr_gate(0x20+irq,fast_interrupt[irq]); set_intr_gate(0x20+irq,fast_interrupt[irq]);
else else
set_intr_gate(0x20+irq,interrupt[irq]); set_intr_gate(0x20+irq,interrupt[irq]);
if (irq < 8) if (irq < 8) {
outb(inb_p(0x21) & ~(1<<irq),0x21); cache_21 &= ~(1<<irq);
else { outb(cache_21,0x21);
outb(inb_p(0x21) & ~(1<<2),0x21); } else {
outb(inb_p(0xA1) & ~(1<<(irq-8)),0xA1); cache_21 &= ~(1<<2);
cache_A1 &= ~(1<<(irq-8));
outb(cache_21,0x21);
outb(cache_A1,0xA1);
} }
restore_flags(flags); restore_flags(flags);
return 0; return 0;
...@@ -222,10 +224,13 @@ void free_irq(unsigned int irq) ...@@ -222,10 +224,13 @@ void free_irq(unsigned int irq)
} }
save_flags(flags); save_flags(flags);
cli(); cli();
if (irq < 8) if (irq < 8) {
outb(inb_p(0x21) | (1<<irq),0x21); cache_21 |= 1 << irq;
else outb(cache_21,0x21);
outb(inb_p(0xA1) | (1<<(irq-8)),0xA1); } else {
cache_A1 |= 1 << (irq-8);
outb(cache_A1,0xA1);
}
set_intr_gate(0x20+irq,bad_interrupt[irq]); set_intr_gate(0x20+irq,bad_interrupt[irq]);
sa->sa_handler = NULL; sa->sa_handler = NULL;
sa->sa_flags = 0; sa->sa_flags = 0;
......
...@@ -20,8 +20,8 @@ extern void console_print(const char *); ...@@ -20,8 +20,8 @@ extern void console_print(const char *);
static unsigned long log_page = 0; static unsigned long log_page = 0;
static unsigned long log_start = 0; static unsigned long log_start = 0;
static unsigned long log_size = 0; unsigned long log_size = 0;
static struct wait_queue * log_wait = NULL; struct wait_queue * log_wait = NULL;
int sys_syslog(int type, char * buf, int len) int sys_syslog(int type, char * buf, int len)
{ {
......
...@@ -149,9 +149,6 @@ _system_call: ...@@ -149,9 +149,6 @@ _system_call:
call _schedule call _schedule
.align 4,0x90 .align 4,0x90
ret_from_sys_call: ret_from_sys_call:
/*
* XXX - interrupts are masked here about 3 times in 1000. Fishy.
*/
movl EFLAGS(%esp),%eax # check VM86 flag: CS/SS are movl EFLAGS(%esp),%eax # check VM86 flag: CS/SS are
testl $VM_MASK,%eax # different then testl $VM_MASK,%eax # different then
jne 4f jne 4f
...@@ -159,7 +156,8 @@ ret_from_sys_call: ...@@ -159,7 +156,8 @@ ret_from_sys_call:
jne 2f jne 2f
cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ? cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ?
jne 2f jne 2f
4: orl $IF_MASK,%eax # these just try to make sure 4: sti # slow interrupts get here with interrupts disabled
orl $IF_MASK,%eax # these just try to make sure
andl $~NT_MASK,%eax # the program doesn't do anything andl $~NT_MASK,%eax # the program doesn't do anything
movl %eax,EFLAGS(%esp) # stupid movl %eax,EFLAGS(%esp) # stupid
1: cmpl $0,_need_resched 1: cmpl $0,_need_resched
......
...@@ -169,7 +169,7 @@ void do_stack_segment(long esp,long error_code) ...@@ -169,7 +169,7 @@ void do_stack_segment(long esp,long error_code)
void do_coprocessor_error(long esp, long error_code) void do_coprocessor_error(long esp, long error_code)
{ {
send_sig(SIGFPE, last_task_used_math, 1); send_sig(SIGFPE, last_task_used_math, 1);
__asm__("fnclex"); __asm__("fninit");
} }
void do_reserved(long esp, long error_code) void do_reserved(long esp, long error_code)
......
...@@ -75,9 +75,9 @@ struct proto_ops { ...@@ -75,9 +75,9 @@ struct proto_ops {
extern int sock_awaitconn(struct socket *mysock, struct socket *servsock); extern int sock_awaitconn(struct socket *mysock, struct socket *servsock);
#ifdef SOCK_DEBUG #ifdef SOCK_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK (void) #define PRINTK(x) /**/
#endif #endif
#endif /* _KERN_SOCK_H */ #endif /* _KERN_SOCK_H */
This diff is collapsed.
...@@ -59,10 +59,11 @@ ...@@ -59,10 +59,11 @@
#include "arp.h" #include "arp.h"
#undef ARP_DEBUG #undef ARP_DEBUG
#ifdef ARP_DEBUG #ifdef ARP_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
static struct arp_table *arp_table[ARP_TABLE_SIZE] ={NULL, }; static struct arp_table *arp_table[ARP_TABLE_SIZE] ={NULL, };
...@@ -147,33 +148,33 @@ print_arp(struct arp *arp) ...@@ -147,33 +148,33 @@ print_arp(struct arp *arp)
int i; int i;
unsigned long *lptr; unsigned long *lptr;
unsigned char *ptr; unsigned char *ptr;
PRINTK ("arp: \n"); PRINTK (("arp: \n"));
if (arp == NULL) if (arp == NULL)
{ {
PRINTK ("(null)\n"); PRINTK (("(null)\n"));
return; return;
} }
PRINTK (" hrd = %d\n",net16(arp->hrd)); PRINTK ((" hrd = %d\n",net16(arp->hrd)));
PRINTK (" pro = %d\n",net16(arp->pro)); PRINTK ((" pro = %d\n",net16(arp->pro)));
PRINTK (" hlen = %d plen = %d\n",arp->hlen, arp->plen); PRINTK ((" hlen = %d plen = %d\n",arp->hlen, arp->plen));
PRINTK (" op = %d\n", net16(arp->op)); PRINTK ((" op = %d\n", net16(arp->op)));
ptr = (unsigned char *)(arp+1); ptr = (unsigned char *)(arp+1);
PRINTK (" sender haddr = "); PRINTK ((" sender haddr = "));
for (i = 0; i < arp->hlen; i++) for (i = 0; i < arp->hlen; i++)
{ {
PRINTK ("0x%02X ",*ptr++); PRINTK (("0x%02X ",*ptr++));
} }
lptr = (void *)ptr; lptr = (void *)ptr;
PRINTK (" send paddr = %X\n",*lptr); PRINTK ((" send paddr = %X\n",*lptr));
lptr ++; lptr ++;
ptr = (void *)lptr; ptr = (void *)lptr;
PRINTK (" destination haddr = "); PRINTK ((" destination haddr = "));
for (i = 0; i < arp->hlen; i++) for (i = 0; i < arp->hlen; i++)
{ {
PRINTK ("0x%02X ",*ptr++); PRINTK (("0x%02X ",*ptr++));
} }
lptr = (void *)ptr; lptr = (void *)ptr;
PRINTK (" destination paddr = %X\n",*lptr); PRINTK ((" destination paddr = %X\n",*lptr));
} }
static unsigned char * static unsigned char *
...@@ -269,7 +270,7 @@ arp_response (struct arp *arp1, struct device *dev) ...@@ -269,7 +270,7 @@ arp_response (struct arp *arp1, struct device *dev)
skb->arp = 1; /* so the code will know it's not waiting on an arp. */ skb->arp = 1; /* so the code will know it's not waiting on an arp. */
skb->sk = NULL; skb->sk = NULL;
skb->next = NULL; skb->next = NULL;
PRINTK (">>"); PRINTK ((">>"));
print_arp(arp2); print_arp(arp2);
/* send it. */ /* send it. */
dev->queue_xmit (skb, dev, 0); dev->queue_xmit (skb, dev, 0);
...@@ -283,7 +284,7 @@ arp_lookup (unsigned long paddr) ...@@ -283,7 +284,7 @@ arp_lookup (unsigned long paddr)
{ {
unsigned long hash; unsigned long hash;
struct arp_table *apt; struct arp_table *apt;
PRINTK ("arp_lookup(paddr=%X)\n", paddr); PRINTK (("arp_lookup(paddr=%X)\n", paddr));
/* we don't want to arp ourselves. */ /* we don't want to arp ourselves. */
if (my_ip_addr(paddr)) return (NULL); if (my_ip_addr(paddr)) return (NULL);
hash = net32(paddr) & (ARP_TABLE_SIZE - 1); hash = net32(paddr) & (ARP_TABLE_SIZE - 1);
...@@ -306,7 +307,7 @@ arp_destroy(unsigned long paddr) ...@@ -306,7 +307,7 @@ arp_destroy(unsigned long paddr)
unsigned long hash; unsigned long hash;
struct arp_table *apt; struct arp_table *apt;
struct arp_table *lapt; struct arp_table *lapt;
PRINTK ("arp_destroy (paddr=%X)\n",paddr); PRINTK (("arp_destroy (paddr=%X)\n",paddr));
/* we don't want to destroy are own arp */ /* we don't want to destroy are own arp */
if (my_ip_addr(paddr)) return; if (my_ip_addr(paddr)) return;
hash = net32(paddr) & (ARP_TABLE_SIZE - 1); hash = net32(paddr) & (ARP_TABLE_SIZE - 1);
...@@ -369,7 +370,7 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) ...@@ -369,7 +370,7 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
struct arp_table *tbl; struct arp_table *tbl;
int ret; int ret;
PRINTK ("<<\n"); PRINTK (("<<\n"));
arp = skb->h.arp; arp = skb->h.arp;
print_arp(arp); print_arp(arp);
...@@ -427,7 +428,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr) ...@@ -427,7 +428,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr)
struct arp *arp; struct arp *arp;
struct arp_table *apt; struct arp_table *apt;
int tmp; int tmp;
PRINTK ("arp_snd (paddr=%X, dev=%X, saddr=%X)\n",paddr, dev, saddr); PRINTK (("arp_snd (paddr=%X, dev=%X, saddr=%X)\n",paddr, dev, saddr));
/* first we build a dummy arp table entry. */ /* first we build a dummy arp table entry. */
apt = create_arp (paddr, NULL, 0); apt = create_arp (paddr, NULL, 0);
...@@ -465,7 +466,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr) ...@@ -465,7 +466,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr)
*arp_targetp(arp) = paddr; *arp_targetp(arp) = paddr;
memcpy (arp_sourceh(arp), dev->dev_addr, dev->addr_len); memcpy (arp_sourceh(arp), dev->dev_addr, dev->addr_len);
memcpy (arp_targeth(arp), dev->broadcast, dev->addr_len); memcpy (arp_targeth(arp), dev->broadcast, dev->addr_len);
PRINTK(">>\n"); PRINTK((">>\n"));
print_arp(arp); print_arp(arp);
dev->queue_xmit (skb, dev, 0); dev->queue_xmit (skb, dev, 0);
} }
...@@ -475,8 +476,8 @@ arp_find(unsigned char *haddr, unsigned long paddr, struct device *dev, ...@@ -475,8 +476,8 @@ arp_find(unsigned char *haddr, unsigned long paddr, struct device *dev,
unsigned long saddr) unsigned long saddr)
{ {
struct arp_table *apt; struct arp_table *apt;
PRINTK ("arp_find(haddr=%X, paddr=%X, dev=%X, saddr=%X)\n", PRINTK (("arp_find(haddr=%X, paddr=%X, dev=%X, saddr=%X)\n",
haddr, paddr, dev, saddr); haddr, paddr, dev, saddr));
if (my_ip_addr (paddr)) if (my_ip_addr (paddr))
{ {
memcpy (haddr, dev->dev_addr, dev->addr_len); memcpy (haddr, dev->dev_addr, dev->addr_len);
......
...@@ -78,9 +78,9 @@ ...@@ -78,9 +78,9 @@
#undef DEV_DEBUG #undef DEV_DEBUG
#ifdef DEV_DEBUG #ifdef DEV_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
...@@ -157,7 +157,7 @@ void ...@@ -157,7 +157,7 @@ void
dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri) dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
PRINTK ("dev_queue_xmit (skb=%X, dev=%X, pri = %d)\n", skb, dev, pri); PRINTK (("dev_queue_xmit (skb=%X, dev=%X, pri = %d)\n", skb, dev, pri));
if (dev == NULL) if (dev == NULL)
{ {
...@@ -185,7 +185,7 @@ dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri) ...@@ -185,7 +185,7 @@ dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri)
} }
/* put skb into a bidirectional circular linked list. */ /* put skb into a bidirectional circular linked list. */
PRINTK ("dev_queue_xmit dev->buffs[%d]=%X\n",pri, dev->buffs[pri]); PRINTK (("dev_queue_xmit dev->buffs[%d]=%X\n",pri, dev->buffs[pri]));
/* interrupts should already be cleared by hard_start_xmit. */ /* interrupts should already be cleared by hard_start_xmit. */
cli(); cli();
if (dev->buffs[pri] == NULL) if (dev->buffs[pri] == NULL)
...@@ -365,7 +365,7 @@ inet_bh(void *tmp) ...@@ -365,7 +365,7 @@ inet_bh(void *tmp)
if (!flag) if (!flag)
{ {
PRINTK ("discarding packet type = %X\n", type); PRINTK (("discarding packet type = %X\n", type));
kfree_skb (skb, FREE_READ); kfree_skb (skb, FREE_READ);
} }
} }
...@@ -452,7 +452,7 @@ dev_tint(unsigned char *buff, struct device *dev) ...@@ -452,7 +452,7 @@ dev_tint(unsigned char *buff, struct device *dev)
if (buff != NULL) if (buff != NULL)
memcpy (buff, skb + 1, tmp); memcpy (buff, skb + 1, tmp);
PRINTK (">>\n"); PRINTK ((">>\n"));
print_eth ((struct enet_header *)(skb+1)); print_eth ((struct enet_header *)(skb+1));
} }
else else
...@@ -474,7 +474,6 @@ dev_tint(unsigned char *buff, struct device *dev) ...@@ -474,7 +474,6 @@ dev_tint(unsigned char *buff, struct device *dev)
return (tmp); return (tmp);
} }
} }
PRINTK ("dev_tint returning 0 \n"); PRINTK (("dev_tint returning 0 \n"));
return (0); return (0);
} }
...@@ -56,29 +56,29 @@ ...@@ -56,29 +56,29 @@
#undef ETH_DEBUG #undef ETH_DEBUG
#ifdef ETH_DEBUG #ifdef ETH_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
void void
print_eth (struct enet_header *eth) print_eth (struct enet_header *eth)
{ {
int i; int i;
PRINTK ("ether source addr: "); PRINTK (("ether source addr: "));
for (i =0 ; i < ETHER_ADDR_LEN; i++) for (i =0 ; i < ETHER_ADDR_LEN; i++)
{ {
PRINTK ("0x%2X ",eth->saddr[i]); PRINTK (("0x%2X ",eth->saddr[i]));
} }
PRINTK ("\n"); PRINTK (("\n"));
PRINTK ("ether dest addr: "); PRINTK (("ether dest addr: "));
for (i =0 ; i < ETHER_ADDR_LEN; i++) for (i =0 ; i < ETHER_ADDR_LEN; i++)
{ {
PRINTK ("0x%2X ",eth->daddr[i]); PRINTK (("0x%2X ",eth->daddr[i]));
} }
PRINTK ("\n"); PRINTK (("\n"));
PRINTK ("ethertype = %X\n",net16(eth->type)); PRINTK (("ethertype = %X\n",net16(eth->type)));
} }
int int
......
...@@ -74,10 +74,11 @@ ...@@ -74,10 +74,11 @@
#endif #endif
#undef ICMP_DEBUG #undef ICMP_DEBUG
#ifdef ICMP_DEBUG #ifdef ICMP_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
#define min(a,b) ((a)<(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b))
...@@ -103,9 +104,9 @@ struct icmp_err icmp_err_convert[]= ...@@ -103,9 +104,9 @@ struct icmp_err icmp_err_convert[]=
void void
print_icmph (struct icmp_header *icmph) print_icmph (struct icmp_header *icmph)
{ {
PRINTK (" type = %d, code = %d, checksum = %X\n", icmph->type, PRINTK ((" type = %d, code = %d, checksum = %X\n", icmph->type,
icmph->code, icmph->checksum); icmph->code, icmph->checksum));
PRINTK (" gateway = %X\n", icmph->un.gateway); PRINTK ((" gateway = %X\n", icmph->un.gateway));
} }
/* sends an icmp message in response to a packet. */ /* sends an icmp message in response to a packet. */
...@@ -118,8 +119,8 @@ icmp_reply (struct sk_buff *skb_in, int type, int code, struct device *dev) ...@@ -118,8 +119,8 @@ icmp_reply (struct sk_buff *skb_in, int type, int code, struct device *dev)
struct icmp_header *icmph; struct icmp_header *icmph;
int len; int len;
PRINTK ("icmp_reply (skb_in = %X, type = %d, code = %d, dev=%X)\n", PRINTK (("icmp_reply (skb_in = %X, type = %d, code = %d, dev=%X)\n",
skb_in, type, code, dev); skb_in, type, code, dev));
/* get some memory for the reply. */ /* get some memory for the reply. */
len = sizeof (*skb) + 8 /* amount of header to return. */ + len = sizeof (*skb) + 8 /* amount of header to return. */ +
...@@ -196,7 +197,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, ...@@ -196,7 +197,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
if( ip_compute_csum( (unsigned char *)icmph, len ) ) if( ip_compute_csum( (unsigned char *)icmph, len ) )
{ {
/* Failed checksum! */ /* Failed checksum! */
PRINTK("ICMP ECHO failed checksum!\n"); PRINTK(("ICMP ECHO failed checksum!\n"));
skb1->sk = NULL; skb1->sk = NULL;
kfree_skb (skb1, FREE_READ); kfree_skb (skb1, FREE_READ);
return (0); return (0);
...@@ -287,7 +288,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, ...@@ -287,7 +288,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
if (offset < 0) if (offset < 0)
{ {
/* Problems building header */ /* Problems building header */
PRINTK("Could not build IP Header for ICMP ECHO Response\n"); PRINTK(("Could not build IP Header for ICMP ECHO Response\n"));
kfree_s (skb->mem_addr, skb->mem_len); kfree_s (skb->mem_addr, skb->mem_len);
skb1->sk = NULL; skb1->sk = NULL;
kfree_skb (skb1, FREE_READ); kfree_skb (skb1, FREE_READ);
...@@ -317,7 +318,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt, ...@@ -317,7 +318,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
return( 0 ); return( 0 );
default: default:
PRINTK("Unsupported ICMP type = x%x\n", icmph->type ); PRINTK(("Unsupported ICMP type = x%x\n", icmph->type ));
skb1->sk = NULL; skb1->sk = NULL;
kfree_skb (skb1, FREE_READ); kfree_skb (skb1, FREE_READ);
return( 0 ); /* just toss the packet */ return( 0 ); /* just toss the packet */
......
...@@ -68,10 +68,11 @@ ...@@ -68,10 +68,11 @@
unsigned long ip_addr[MAX_IP_ADDRES]={0,0,0}; unsigned long ip_addr[MAX_IP_ADDRES]={0,0,0};
#undef IP_DEBUG #undef IP_DEBUG
#ifdef IP_DEBUG #ifdef IP_DEBUG
#define PRINTK printk #define PRINTK(X) printk X
#else #else
#define PRINTK dummy_routine #define PRINTK(X) /**/
#endif #endif
static struct rtable *rt_base=NULL; /* used to base all the routing data. */ static struct rtable *rt_base=NULL; /* used to base all the routing data. */
...@@ -84,11 +85,11 @@ get_protocol(unsigned char prot) ...@@ -84,11 +85,11 @@ get_protocol(unsigned char prot)
{ {
unsigned char hash; unsigned char hash;
struct ip_protocol *p; struct ip_protocol *p;
PRINTK ("get_protocol (%d)\n ", prot); PRINTK (("get_protocol (%d)\n ", prot));
hash = prot & (MAX_IP_PROTOS -1); hash = prot & (MAX_IP_PROTOS -1);
for (p = ip_protos[hash] ; p != NULL; p=p->next) for (p = ip_protos[hash] ; p != NULL; p=p->next)
{ {
PRINTK ("trying protocol %d\n", p->protocol); PRINTK (("trying protocol %d\n", p->protocol));
if (p->protocol == prot) if (p->protocol == prot)
return (p); return (p);
} }
...@@ -207,20 +208,20 @@ loose_route(struct ip_header *iph, struct options *opt) ...@@ -207,20 +208,20 @@ loose_route(struct ip_header *iph, struct options *opt)
void void
print_rt(struct rtable *rt) print_rt(struct rtable *rt)
{ {
PRINTK ("net = %08X router = %08X\n",rt->net, rt->router); PRINTK (("net = %08X router = %08X\n",rt->net, rt->router));
PRINTK ("dev = %X, next = %X\n",rt->dev, rt->next); PRINTK (("dev = %X, next = %X\n",rt->dev, rt->next));
} }
void void
print_ipprot (struct ip_protocol *ipprot) print_ipprot (struct ip_protocol *ipprot)
{ {
PRINTK ("handler = %X, protocol = %d, copy=%d \n", PRINTK (("handler = %X, protocol = %d, copy=%d \n",
ipprot->handler, ipprot->protocol, ipprot->copy); ipprot->handler, ipprot->protocol, ipprot->copy));
} }
/* This assumes that address are all in net order. */ /* This assumes that address are all in net order. */
static struct device * static struct device *
ip_route(struct options *opt, unsigned long daddr , unsigned long *raddr) ip_route(struct options *opt, unsigned long daddr, unsigned long *raddr)
{ {
struct rtable *rt; struct rtable *rt;
/* look through the routing table for some /* look through the routing table for some
...@@ -230,6 +231,7 @@ ip_route(struct options *opt, unsigned long daddr , unsigned long *raddr) ...@@ -230,6 +231,7 @@ ip_route(struct options *opt, unsigned long daddr , unsigned long *raddr)
/* see if we found one. */ /* see if we found one. */
if (ip_addr_match (rt->net, daddr)) if (ip_addr_match (rt->net, daddr))
{ {
PRINTK (("IP: %X via %s (%X)\n", daddr, rt->dev->name, rt->router));
*raddr = rt->router; *raddr = rt->router;
return (rt->dev); return (rt->dev);
} }
...@@ -243,7 +245,7 @@ add_route (struct rtable *rt) ...@@ -243,7 +245,7 @@ add_route (struct rtable *rt)
int mask; int mask;
struct rtable *r; struct rtable *r;
struct rtable *r1; struct rtable *r1;
PRINTK ("add_route (rt=%X):\n",rt); PRINTK (("add_route (rt=%X):\n",rt));
print_rt(rt); print_rt(rt);
if (rt_base == NULL) if (rt_base == NULL)
...@@ -264,7 +266,7 @@ add_route (struct rtable *rt) ...@@ -264,7 +266,7 @@ add_route (struct rtable *rt)
break; break;
} }
} }
PRINTK ("mask = %X\n",mask); PRINTK (("mask = %X\n",mask));
r1=rt_base; r1=rt_base;
for (r=rt_base; r != NULL; r=r->next) for (r=rt_base; r != NULL; r=r->next)
{ {
...@@ -287,7 +289,7 @@ add_route (struct rtable *rt) ...@@ -287,7 +289,7 @@ add_route (struct rtable *rt)
if (!(r->net & mask)) if (!(r->net & mask))
{ {
PRINTK("adding before r=%X\n",r); PRINTK (("adding before r=%X\n",r));
print_rt(r); print_rt(r);
if (r == rt_base) if (r == rt_base)
{ {
...@@ -301,7 +303,7 @@ add_route (struct rtable *rt) ...@@ -301,7 +303,7 @@ add_route (struct rtable *rt)
} }
r1 = r; r1 = r;
} }
PRINTK ("adding after r1=%X\n",r1); PRINTK (("adding after r1=%X\n",r1));
print_rt(r1); print_rt(r1);
/* goes at the end. */ /* goes at the end. */
rt->next = NULL; rt->next = NULL;
...@@ -328,10 +330,10 @@ ip_set_dev (struct ip_config *u_ipc) ...@@ -328,10 +330,10 @@ ip_set_dev (struct ip_config *u_ipc)
/* see if we need to add a broadcast address. */ /* see if we need to add a broadcast address. */
if (ipc.net != -1) if (ipc.net != -1)
{ {
PRINTK (("new broadcast for %s: %08X\n", dev->name, ipc.net));
arp_add_broad (ipc.net, dev); arp_add_broad (ipc.net, dev);
rt = kmalloc (sizeof (*rt), GFP_KERNEL); rt = kmalloc (sizeof (*rt), GFP_KERNEL);
if (rt == NULL) return (-ENOMEM); if (rt == NULL) return (-ENOMEM);
rt->net = ipc.net; rt->net = ipc.net;
rt->dev = dev; rt->dev = dev;
rt->router = 0; rt->router = 0;
...@@ -341,6 +343,7 @@ ip_set_dev (struct ip_config *u_ipc) ...@@ -341,6 +343,7 @@ ip_set_dev (struct ip_config *u_ipc)
if (ipc.router != -1) if (ipc.router != -1)
{ {
PRINTK (("new router for %s: %08X\n", dev->name, ipc.router));
rt = kmalloc (sizeof (*rt),GFP_KERNEL); rt = kmalloc (sizeof (*rt),GFP_KERNEL);
if (rt == NULL) return (-ENOMEM); if (rt == NULL) return (-ENOMEM);
rt->net = 0; rt->net = 0;
...@@ -351,18 +354,21 @@ ip_set_dev (struct ip_config *u_ipc) ...@@ -351,18 +354,21 @@ ip_set_dev (struct ip_config *u_ipc)
if (dev->loopback) if (dev->loopback)
{ {
PRINTK (("new loopback addr: %08X\n", ipc.paddr));
rt = kmalloc (sizeof (*rt), GFP_KERNEL); rt = kmalloc (sizeof (*rt), GFP_KERNEL);
if (rt == NULL) return (-ENOMEM); if (rt == NULL) return (-ENOMEM);
rt->net = ipc.paddr; rt->net = ipc.paddr;
rt->dev = dev; rt->dev = dev;
rt->router = 0; rt->router = 0;
add_route (rt); add_route (rt);
} }
if (!my_ip_addr (ipc.paddr)) if (!my_ip_addr (ipc.paddr))
{
PRINTK (("new identity: %08X\n", ipc.paddr));
ip_addr[ip_ads++] = ipc.paddr; ip_addr[ip_ads++] = ipc.paddr;
}
dev->up = ipc.up; dev->up = ipc.up;
if (dev->up) if (dev->up)
...@@ -375,8 +381,8 @@ ip_set_dev (struct ip_config *u_ipc) ...@@ -375,8 +381,8 @@ ip_set_dev (struct ip_config *u_ipc)
if (dev->stop) if (dev->stop)
dev->stop(dev); dev->stop(dev);
} }
return (0);
return (0);
} }
/* this routine will check to see if we have lost a gateway. */ /* this routine will check to see if we have lost a gateway. */
...@@ -415,9 +421,9 @@ ip_build_header (struct sk_buff *skb, unsigned long saddr, ...@@ -415,9 +421,9 @@ ip_build_header (struct sk_buff *skb, unsigned long saddr,
unsigned long raddr; /* for the router. */ unsigned long raddr; /* for the router. */
int tmp; int tmp;
if (saddr == 0) saddr = MY_IP_ADDR; if (saddr == 0) saddr = MY_IP_ADDR;
PRINTK ("ip_build_header (skb=%X, saddr=%X, daddr=%X, *dev=%X,\n" PRINTK (("ip_build_header (skb=%X, saddr=%X, daddr=%X, *dev=%X,\n"
" type=%d, opt=%X, len = %d)\n", " type=%d, opt=%X, len = %d)\n",
skb, saddr, daddr, *dev, type, opt, len); skb, saddr, daddr, *dev, type, opt, len));
buff = (unsigned char *)(skb + 1); buff = (unsigned char *)(skb + 1);
/* see if we need to look up the device. */ /* see if we need to look up the device. */
if (*dev == NULL) if (*dev == NULL)
...@@ -712,12 +718,12 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) ...@@ -712,12 +718,12 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
iph=skb->h.iph; iph=skb->h.iph;
PRINTK("<<\n"); PRINTK (("<<\n"));
print_iph(iph); print_iph(iph);
if (ip_csum (iph) || do_options (iph,&opt) || iph->version != 4) if (ip_csum (iph) || do_options (iph,&opt) || iph->version != 4)
{ {
PRINTK ("ip packet thrown out. \n"); PRINTK (("ip packet thrown out. \n"));
skb->sk = NULL; skb->sk = NULL;
kfree_skb(skb, 0); kfree_skb(skb, 0);
return (0); return (0);
...@@ -726,7 +732,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) ...@@ -726,7 +732,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
/* for now we will only deal with packets meant for us. */ /* for now we will only deal with packets meant for us. */
if (!my_ip_addr(iph->daddr)) if (!my_ip_addr(iph->daddr))
{ {
PRINTK ("packet meant for someone else.\n"); PRINTK (("packet meant for someone else.\n"));
skb->sk = NULL; skb->sk = NULL;
kfree_skb(skb, 0); kfree_skb(skb, 0);
return (0); return (0);
...@@ -748,7 +754,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) ...@@ -748,7 +754,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{ {
struct sk_buff *skb2; struct sk_buff *skb2;
if (ipprot->protocol != iph->protocol) continue; if (ipprot->protocol != iph->protocol) continue;
PRINTK ("Using protocol = %X:\n", ipprot); PRINTK (("Using protocol = %X:\n", ipprot));
print_ipprot (ipprot); print_ipprot (ipprot);
/* pass it off to everyone who wants it. */ /* pass it off to everyone who wants it. */
/* we should check the return values here. */ /* we should check the return values here. */
...@@ -811,7 +817,7 @@ ip_queue_xmit (volatile struct sock *sk, struct device *dev, ...@@ -811,7 +817,7 @@ ip_queue_xmit (volatile struct sock *sk, struct device *dev,
skb->free = free; skb->free = free;
skb->dev = dev; skb->dev = dev;
skb->when = jiffies; skb->when = jiffies;
PRINTK(">>\n"); PRINTK ((">>\n"));
ptr = (unsigned char *)(skb + 1); ptr = (unsigned char *)(skb + 1);
ptr += dev->hard_header_len; ptr += dev->hard_header_len;
iph = (struct ip_header *)ptr; iph = (struct ip_header *)ptr;
...@@ -922,13 +928,13 @@ ip_retransmit (volatile struct sock *sk, int all) ...@@ -922,13 +928,13 @@ ip_retransmit (volatile struct sock *sk, int all)
void void
print_iph (struct ip_header *ip) print_iph (struct ip_header *ip)
{ {
PRINTK ("ip header:\n"); PRINTK (("ip header:\n"));
PRINTK (" ihl = %d, version = %d, tos = %d, tot_len = %d\n", PRINTK ((" ihl = %d, version = %d, tos = %d, tot_len = %d\n",
ip->ihl, ip->version, ip->tos, net16(ip->tot_len)); ip->ihl, ip->version, ip->tos, net16(ip->tot_len)));
PRINTK (" id = %x, ttl = %d, prot = %d, check=%x\n", PRINTK ((" id = %x, ttl = %d, prot = %d, check=%x\n",
ip->id, ip->ttl, ip->protocol, ip->check); ip->id, ip->ttl, ip->protocol, ip->check));
PRINTK (" frag_off=%d\n", ip->frag_off); PRINTK ((" frag_off=%d\n", ip->frag_off));
PRINTK (" saddr = %X, daddr = %X\n",ip->saddr, ip->daddr); PRINTK ((" saddr = %X, daddr = %X\n",ip->saddr, ip->daddr));
} }
#if 0 #if 0
......
...@@ -68,9 +68,9 @@ ...@@ -68,9 +68,9 @@
#endif #endif
#ifdef LOOPBACK_DEBUG #ifdef LOOPBACK_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
static int static int
...@@ -83,7 +83,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev) ...@@ -83,7 +83,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
static unsigned char buff[2048]; static unsigned char buff[2048];
unsigned char *tmp; unsigned char *tmp;
PRINTK ("loopback_xmit (dev = %X)\n", dev); PRINTK (("loopback_xmit (dev = %X)\n", dev));
cli(); cli();
if (inuse) if (inuse)
{ {
...@@ -107,7 +107,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev) ...@@ -107,7 +107,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
if (done != -1 && (i = dev_tint (buff,dev)) != 0) if (done != -1 && (i = dev_tint (buff,dev)) != 0)
{ {
/* print out the buffer. */ /* print out the buffer. */
PRINTK ("loopback xmit: \n"); PRINTK (("loopback xmit: \n"));
eth = (struct enet_header *)buff; eth = (struct enet_header *)buff;
print_eth (eth); print_eth (eth);
tmp = buff; tmp = buff;
......
...@@ -74,9 +74,9 @@ ...@@ -74,9 +74,9 @@
#undef RAW_DEBUG #undef RAW_DEBUG
#ifdef RAW_DEBUG #ifdef RAW_DEBUG
#define PRINTK printk #define PRINTK(x) printk x
#else #else
#define PRINTK dummy_routine #define PRINTK(x) /**/
#endif #endif
extern struct proto raw_prot; extern struct proto raw_prot;
...@@ -95,7 +95,7 @@ raw_err (int err, unsigned char *header, unsigned long daddr, ...@@ -95,7 +95,7 @@ raw_err (int err, unsigned char *header, unsigned long daddr,
{ {
volatile struct sock *sk; volatile struct sock *sk;
PRINTK ("raw_err (err=%d, header=%X, daddr=%X, saddr=%X, ip_protocl=%X)\n"); PRINTK (("raw_err (err=%d, header=%X, daddr=%X, saddr=%X, ip_protocl=%X)\n"));
if (protocol == NULL) return; if (protocol == NULL) return;
...@@ -132,9 +132,9 @@ raw_rcv (struct sk_buff *skb, struct device *dev, struct options *opt, ...@@ -132,9 +132,9 @@ raw_rcv (struct sk_buff *skb, struct device *dev, struct options *opt,
volatile struct sock *sk; volatile struct sock *sk;
PRINTK ("raw_rcv (skb=%X, dev=%X, opt=%X, daddr=%X,\n" PRINTK (("raw_rcv (skb=%X, dev=%X, opt=%X, daddr=%X,\n"
" len=%d, saddr=%X, redo=%d, protocol=%X)\n", " len=%d, saddr=%X, redo=%d, protocol=%X)\n",
skb, dev, opt, daddr, len, saddr, redo, protocol); skb, dev, opt, daddr, len, saddr, redo, protocol));
if (skb == NULL) return (0); if (skb == NULL) return (0);
if (protocol == NULL) if (protocol == NULL)
...@@ -162,7 +162,7 @@ raw_rcv (struct sk_buff *skb, struct device *dev, struct options *opt, ...@@ -162,7 +162,7 @@ raw_rcv (struct sk_buff *skb, struct device *dev, struct options *opt,
cli(); cli();
if (sk->inuse) if (sk->inuse)
{ {
PRINTK ("raw_rcv adding to backlog. \n"); PRINTK (("raw_rcv adding to backlog. \n"));
if (sk->back_log == NULL) if (sk->back_log == NULL)
{ {
sk->back_log = skb; sk->back_log = skb;
...@@ -223,9 +223,9 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len, ...@@ -223,9 +223,9 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len,
struct sockaddr_in sin; struct sockaddr_in sin;
int tmp; int tmp;
PRINTK ("raw_sendto (sk=%X, from=%X, len=%d, noblock=%d, flags=%X,\n" PRINTK (("raw_sendto (sk=%X, from=%X, len=%d, noblock=%d, flags=%X,\n"
" usin=%X, addr_len = %d)\n", sk, from, len, noblock, " usin=%X, addr_len = %d)\n", sk, from, len, noblock,
flags, usin, addr_len); flags, usin, addr_len));
/* check the flags. */ /* check the flags. */
if (flags) return (-EINVAL); if (flags) return (-EINVAL);
...@@ -263,7 +263,7 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len, ...@@ -263,7 +263,7 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len,
if (skb == NULL) if (skb == NULL)
{ {
int tmp; int tmp;
PRINTK ("raw_sendto: write buffer full?\n"); PRINTK (("raw_sendto: write buffer full?\n"));
print_sk (sk); print_sk (sk);
if (noblock) return (-EAGAIN); if (noblock) return (-EAGAIN);
tmp = sk->wmem_alloc; tmp = sk->wmem_alloc;
...@@ -295,7 +295,7 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len, ...@@ -295,7 +295,7 @@ raw_sendto (volatile struct sock *sk, unsigned char *from, int len,
sk->protocol, sk->opt, skb->mem_len); sk->protocol, sk->opt, skb->mem_len);
if (tmp < 0) if (tmp < 0)
{ {
PRINTK ("raw_sendto: error building ip header.\n"); PRINTK (("raw_sendto: error building ip header.\n"));
sk->prot->wfree (sk, skb->mem_addr, skb->mem_len); sk->prot->wfree (sk, skb->mem_addr, skb->mem_len);
release_sock (sk); release_sock (sk);
return (tmp); return (tmp);
...@@ -321,10 +321,10 @@ raw_close (volatile struct sock *sk, int timeout) ...@@ -321,10 +321,10 @@ raw_close (volatile struct sock *sk, int timeout)
{ {
sk->inuse = 1; sk->inuse = 1;
sk->state = TCP_CLOSE; sk->state = TCP_CLOSE;
PRINTK ("raw_close: deleting ip_protocol %d\n", PRINTK (("raw_close: deleting ip_protocol %d\n",
((struct ip_protocol *)sk->pair)->protocol); ((struct ip_protocol *)sk->pair)->protocol));
if (delete_ip_protocol ((struct ip_protocol *)sk->pair) < 0) if (delete_ip_protocol ((struct ip_protocol *)sk->pair) < 0)
PRINTK ("raw_close: delete_ip_protocol failed. \n"); PRINTK (("raw_close: delete_ip_protocol failed. \n"));
kfree_s ((void *)sk->pair, sizeof (struct ip_protocol)); kfree_s ((void *)sk->pair, sizeof (struct ip_protocol));
sk->pair = NULL; sk->pair = NULL;
release_sock (sk); release_sock (sk);
...@@ -346,7 +346,7 @@ raw_init (volatile struct sock *sk) ...@@ -346,7 +346,7 @@ raw_init (volatile struct sock *sk)
/* we need to remember this somewhere. */ /* we need to remember this somewhere. */
sk->pair = (volatile struct sock *)p; sk->pair = (volatile struct sock *)p;
PRINTK ("raw init added protocol %d\n", sk->protocol); PRINTK (("raw init added protocol %d\n", sk->protocol));
return (0); return (0);
} }
...@@ -362,9 +362,9 @@ raw_recvfrom (volatile struct sock *sk, unsigned char *to, int len, ...@@ -362,9 +362,9 @@ raw_recvfrom (volatile struct sock *sk, unsigned char *to, int len,
int copied=0; int copied=0;
struct sk_buff *skb; struct sk_buff *skb;
PRINTK ("raw_recvfrom (sk=%X, to=%X, len=%d, noblock=%d, flags=%X,\n" PRINTK (("raw_recvfrom (sk=%X, to=%X, len=%d, noblock=%d, flags=%X,\n"
" sin=%X, addr_len=%X)\n", sk, to, len, noblock, " sin=%X, addr_len=%X)\n", sk, to, len, noblock,
flags, sin, addr_len); flags, sin, addr_len));
if (len == 0) return (0); if (len == 0) return (0);
if (len < 0) return (-EINVAL); if (len < 0) return (-EINVAL);
......
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