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 @@
#
# This script is used to configure the linux kernel.
# It's a fast hack - feel free to do something better.
CONFIG=.config
CONFIG=.config~
CONFIG_H=include/linux/autoconf.h
echo "#" > $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))
include .config
ifeq (.depend,$(wildcard .depend))
include .depend
else
CONFIGURATION = depend
endif
else
CONFIGURATION = config
endif
ifdef CONFIGURATION
CONFIGURE = dummy
endif
#
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, /dev/xxxx or empty, in which case the
......@@ -20,10 +30,7 @@ ROOT_DEV = /dev/hdb1
#
# The value of KBDFLAGS should be or'ed together from the following
# 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 key is dead by default if the bit is on.
# 0x01 - backquote (`)
......@@ -118,37 +125,30 @@ KERNELHDRS =/usr/src/linux/include
all: Version Image
lilo: Image
Version: dummy
rm tools/version.h
lilo: $(CONFIGURE) Image
if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
cat Image > /vmlinux
/etc/lilo/install
config:
ifdef CONFIGURATION
@echo
@echo "You have no .config: running Configure"
@echo
endif
sh Configure < config.in
ifdef CONFIGURATION
@echo
@echo "Configure successful. Try re-making (ignore the error that follows)"
@echo
exit 1
endif
mv .config~ .config
linuxsubdirs: dummy
@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done
Version: dummy
tools/version.h: $(CONFIGURE) Makefile
@./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 LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
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
$(STRIP) system.tmp
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
disk: Image
dd bs=8192 if=Image of=/dev/fd0
tools/build: tools/build.c
tools/build: $(CONFIGURE) tools/build.c
$(HOSTCC) $(CFLAGS) \
-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
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 $<
tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs
......@@ -185,10 +185,10 @@ boot/setup: boot/setup.s
$(AS86) -o boot/setup.o boot/setup.s
$(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
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
boot/bootsect: boot/bootsect.s
......@@ -215,15 +215,26 @@ backup: clean
sync
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
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
#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
dummy: ..$(CONFIGURATION)
else
dummy:
endif
......@@ -8,7 +8,7 @@ TCP/IP
CONFIG_TCPIP y/n y
Kernel profiling support
CONFIG_PROFILE y/n n
Limit to memory to low 16MB
Limit memory to low 16MB
CONFIG_MAX_16M y/n y
Use -m486 flag for 486-specific optimizations
CONFIG_M486 y/n y
......@@ -59,6 +59,8 @@ CONFIG_ISO9660_FS y/n n
.
Various character device drivers..
.
Keyboard meta-key sends ESC-prefix
CONFIG_KBD_META y/n y
Autoconfigure serial IRQ lines at bootup
CONFIG_AUTO_IRQ y/n n
AST Fourport serial driver support
......
......@@ -140,10 +140,10 @@ int core_dump(long signr, struct pt_regs * regs)
dump.u_fpvalid = 0;
}
__asm__("mov %0,%%fs"::"r" ((unsigned short) 0x10));
/* struct user */
DUMP_WRITE(&dump,sizeof(dump));
DUMP_SEEK(sizeof(dump));
/* Dump the task struct. Not be used by gdb, but could be useful */
DUMP_WRITE(current,sizeof(*current));
/* name of the executable */
DUMP_WRITE(current->comm,16);
/* Now dump all of the user data. Include malloced stuff as well */
DUMP_SEEK(PAGE_SIZE);
/* now we start writing out the user space info */
......@@ -160,6 +160,9 @@ int core_dump(long signr, struct pt_regs * regs)
dump_size = dump.u_ssize << 12;
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:
if (file.f_op->release)
file.f_op->release(inode,&file);
......
......@@ -64,5 +64,6 @@ struct inode_operations ext_blkdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -64,6 +64,7 @@ struct inode_operations ext_chrdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -56,7 +56,8 @@ struct inode_operations ext_dir_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
ext_truncate /* truncate */
ext_truncate, /* truncate */
NULL /* permission */
};
static int ext_readdir(struct inode * inode, struct file * filp,
......
......@@ -23,5 +23,6 @@ struct inode_operations ext_fifo_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -64,7 +64,8 @@ struct inode_operations ext_file_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
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)
......
......@@ -40,7 +40,8 @@ struct inode_operations ext_symlink_inode_operations = {
ext_readlink, /* readlink */
ext_follow_link, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int ext_follow_link(struct inode * dir, struct inode * inode,
......
......@@ -63,5 +63,6 @@ struct inode_operations isofs_blkdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
isofs_bmap, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -63,6 +63,7 @@ struct inode_operations isofs_chrdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
isofs_bmap, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -49,7 +49,8 @@ struct inode_operations isofs_dir_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
isofs_bmap, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
/* This is used to speed up lookup. Without this we would need to
......
......@@ -23,5 +23,6 @@ struct inode_operations isofs_fifo_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -60,7 +60,8 @@ struct inode_operations isofs_file_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
isofs_bmap, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
/* 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 = {
isofs_readlink, /* readlink */
isofs_follow_link, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int isofs_follow_link(struct inode * dir, struct inode * inode,
......
......@@ -129,7 +129,8 @@ int minix_new_block(struct super_block * sb)
}
bh->b_dirt = 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;
if (!(bh = getblk(sb->s_dev,j,BLOCK_SIZE))) {
printk("new_block: cannot get block");
......@@ -174,7 +175,7 @@ void minix_free_inode(struct inode * inode)
printk("free_inode: inode on nonexistent device\n");
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");
return;
}
......@@ -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 ((j=find_first_zero(bh->b_data))<8192)
break;
if (!bh || j >= 8192 || j+i*8192 > inode->i_sb->u.minix_sb.s_ninodes) {
if (!bh || j >= 8192) {
iput(inode);
return NULL;
}
......@@ -215,13 +216,18 @@ struct inode * minix_new_inode(const struct inode * dir)
return NULL;
}
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_nlink = 1;
inode->i_dev = sb->s_dev;
inode->i_uid = current->euid;
inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->egid;
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_op = NULL;
inode->i_blocks = inode->i_blksize = 0;
......
......@@ -58,5 +58,6 @@ struct inode_operations minix_blkdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -58,6 +58,7 @@ struct inode_operations minix_chrdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -49,7 +49,8 @@ struct inode_operations minix_dir_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
minix_truncate /* truncate */
minix_truncate, /* truncate */
NULL /* permission */
};
static int minix_readdir(struct inode * inode, struct file * filp,
......
......@@ -23,5 +23,6 @@ struct inode_operations minix_fifo_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -58,7 +58,8 @@ struct inode_operations minix_file_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
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)
......
......@@ -309,11 +309,21 @@ void minix_read_inode(struct inode * inode)
int block, 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 +
inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev,block, BLOCK_SIZE)))
panic("unable to read i-node block");
if (!(bh=bread(inode->i_dev,block, BLOCK_SIZE))) {
printk("Major problem: unable to read inode from dev 0x%04x\n",
inode->i_dev);
return;
}
raw_inode = ((struct minix_inode *) bh->b_data) +
(ino-1)%MINIX_INODES_PER_BLOCK;
inode->i_mode = raw_inode->i_mode;
......@@ -328,7 +338,6 @@ void minix_read_inode(struct inode * inode)
else for (block = 0; block < 9; block++)
inode->u.minix_i.i_data[block] = raw_inode->i_zone[block];
brelse(bh);
inode->i_op = NULL;
if (S_ISREG(inode->i_mode))
inode->i_op = &minix_file_inode_operations;
else if (S_ISDIR(inode->i_mode))
......@@ -353,14 +362,21 @@ void minix_write_inode(struct inode * inode)
{
struct buffer_head * bh;
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 +
(inode->i_ino-1)/MINIX_INODES_PER_BLOCK;
(ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE)))
panic("unable to read i-node block");
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_uid = inode->i_uid;
raw_inode->i_gid = inode->i_gid;
......
......@@ -34,7 +34,8 @@ struct inode_operations minix_symlink_inode_operations = {
minix_readlink, /* readlink */
minix_follow_link, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int minix_follow_link(struct inode * dir, struct inode * inode,
......
......@@ -48,7 +48,8 @@ struct inode_operations msdos_dir_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
msdos_bmap, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int msdos_readdir(struct inode *inode,struct file *filp,
......
......@@ -51,7 +51,8 @@ struct inode_operations msdos_file_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
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. */
......@@ -70,7 +71,8 @@ struct inode_operations msdos_file_inode_operations_no_bmap = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
msdos_truncate /* truncate */
msdos_truncate, /* truncate */
NULL /* permission */
};
......
......@@ -39,6 +39,8 @@ int permission(struct inode * inode,int mask)
/* special case: not even root can read/write a deleted file */
if (inode->i_dev && !inode->i_nlink)
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)
mode >>= 6;
else if (in_group_p(inode->i_gid))
......
......@@ -58,5 +58,6 @@ struct inode_operations nfs_blkdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -58,6 +58,7 @@ struct inode_operations nfs_chrdev_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -64,6 +64,7 @@ struct inode_operations nfs_dir_inode_operations = {
NULL, /* follow_link */
NULL, /* bmap */
NULL, /* truncate */
NULL /* permission */
};
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,
filp->f_pos, NFS_READDIR_CACHE_SIZE, c_entry);
if (result < 0) {
c_dev = 0;
#if 0
printk("nfs_readdir: readdir error = %d\n", result);
#endif
return result;
}
if (result > 0) {
......@@ -171,8 +169,6 @@ static int nfs_readdir(struct inode *inode, struct file *filp,
* though most of them will fail.
*/
#define NFS_LOOKUP_CACHE_SIZE 16
static struct nfs_lookup_cache_entry {
int dev;
int inode;
......@@ -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++) {
entry = nfs_lookup_cache + i;
if (entry->dev == dir->i_dev && entry->inode == dir->i_ino
&& !strcmp(filename, entry->filename))
&& !strncmp(filename, entry->filename, NFS_MAXNAMLEN))
return entry;
}
return NULL;
......@@ -226,7 +222,6 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename,
struct nfs_fattr *fattr)
{
static int nfs_lookup_cache_pos = 0;
struct nfs_lookup_cache_entry *entry;
/* compensate for bug in SGI NFS server */
......@@ -243,30 +238,47 @@ static void nfs_lookup_cache_add(struct inode *dir, char *filename,
strcpy(entry->filename, filename);
entry->fhandle = *fhandle;
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;
int dev;
int fileid;
int i;
if ((entry = nfs_lookup_cache_index(dir, filename)))
entry->dev = 0;
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;
}
}
static void nfs_lookup_cache_refresh(struct inode *file,
struct nfs_fattr *fattr)
{
struct nfs_lookup_cache_entry *entry;
int dev = file->i_dev;
int fileid = file->i_ino;
int i;
for (i = 0; i < NFS_LOOKUP_CACHE_SIZE; i++) {
entry = nfs_lookup_cache + i;
if (entry->dev == file->i_dev
&& entry->fattr.fileid == file->i_ino) {
if (entry->dev == dev && entry->fattr.fileid == fileid)
entry->fattr = *fattr;
break;
}
}
}
......@@ -332,11 +344,7 @@ static int nfs_create(struct inode *dir, const char *name, int len, int mode,
}
memcpy_fromfs(filename, (char *) name, len);
filename[len] = '\0';
#if 0
sattr.mode = mode & 0777;
#else
sattr.mode = mode;
#endif
sattr.uid = sattr.gid = sattr.size = -1;
sattr.atime.seconds = sattr.mtime.seconds = -1;
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)
}
memcpy_fromfs(filename, (char *) name, len);
filename[len] = '\0';
#if 0
sattr.mode = mode & 0777;
#else
sattr.mode = mode;
#endif
sattr.uid = sattr.gid = sattr.size = -1;
sattr.atime.seconds = sattr.mtime.seconds = -1;
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)
filename[len] = '\0';
error = nfs_proc_rmdir(NFS_SERVER(dir), NFS_FH(dir), filename);
if (!error)
nfs_lookup_cache_remove(dir, filename);
nfs_lookup_cache_remove(dir, NULL, filename);
iput(dir);
return error;
}
......@@ -463,7 +467,7 @@ static int nfs_unlink(struct inode *dir, const char *name, int len)
filename[len] = '\0';
error = nfs_proc_remove(NFS_SERVER(dir), NFS_FH(dir), filename);
if (!error)
nfs_lookup_cache_remove(dir, filename);
nfs_lookup_cache_remove(dir, NULL, filename);
iput(dir);
return error;
}
......@@ -535,6 +539,8 @@ static int nfs_link(struct inode *oldinode, struct inode *dir,
filename[len] = '\0';
error = nfs_proc_link(NFS_SERVER(oldinode), NFS_FH(oldinode),
NFS_FH(dir), filename);
if (!error)
nfs_lookup_cache_remove(dir, oldinode, NULL);
iput(oldinode);
iput(dir);
return error;
......@@ -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(new_dir), new_filename);
if (!error)
nfs_lookup_cache_remove(old_dir, old_filename);
nfs_lookup_cache_remove(old_dir, NULL, old_filename);
iput(old_dir);
iput(new_dir);
return error;
......@@ -597,10 +603,6 @@ void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
return;
}
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_nlink = fattr->nlink;
inode->i_uid = fattr->uid;
......
......@@ -23,5 +23,6 @@ struct inode_operations nfs_fifo_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -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.bfree, &buf->f_bfree);
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_ffree);
#endif
}
/*
......
......@@ -12,7 +12,9 @@
* filesystem and type 'ls xyzzy' to turn on debugging.
*/
#if 0
#define NFS_PROC_DEBUG
#endif
#include <linux/param.h>
#include <linux/sched.h>
......@@ -24,11 +26,12 @@
#include <netinet/in.h>
#ifdef NFS_PROC_DEBUG
static int proc_debug = 0;
#ifdef NFS_PROC_DEBUG
#define PRINTK if (proc_debug) printk
#else
#define PRINTK (void)
#define PRINTK if (0) printk
#endif
static int *nfs_rpc_header(int *p, int procedure);
......@@ -595,22 +598,23 @@ static int *nfs_rpc_verify(int *p)
int n;
p++;
if (ntohl(*p++) != RPC_REPLY) {
printk("not an RPC reply\n");
if ((n = ntohl(*p++)) != RPC_REPLY) {
printk("nfs_rpc_verify: not an RPC reply: %d\n", n);
return 0;
}
if (ntohl(*p++) != RPC_MSG_ACCEPTED) {
printk("RPC call rejected\n");
if ((n = ntohl(*p++)) != RPC_MSG_ACCEPTED) {
printk("nfs_rpc_verify: RPC call rejected: %d\n", n);
return 0;
}
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;
}
n = ntohl(*p++);
p += (n + 3) >> 2;
if (ntohl(*p++) != RPC_SUCCESS) {
printk("RPC call failed\n");
if ((n = ntohl(*p++)) != RPC_SUCCESS) {
printk("nfs_rpc_verify: RPC call failed: %d\n", n);
return 0;
}
return p;
......@@ -629,39 +633,38 @@ static struct {
enum nfs_stat stat;
int errno;
} nfs_errtbl[] = {
{ NFS_OK, 0 },
{ NFSERR_PERM, EPERM },
{ NFSERR_NOENT, ENOENT },
{ NFSERR_IO, EIO },
{ NFSERR_NXIO, ENXIO },
{ NFSERR_ACCES, EACCES },
{ NFSERR_EXIST, EEXIST },
{ NFSERR_NODEV, ENODEV },
{ NFSERR_NOTDIR, ENOTDIR },
{ NFSERR_ISDIR, EISDIR },
{ NFSERR_FBIG, EFBIG },
{ NFSERR_NOSPC, ENOSPC },
{ NFSERR_ROFS, EROFS },
{ NFSERR_NAMETOOLONG, ENAMETOOLONG },
{ NFSERR_NOTEMPTY, ENOTEMPTY },
{ NFSERR_DQUOT, EDQUOT },
{ NFSERR_STALE, ESTALE },
{ NFSERR_WFLUSH, EIO },
{ -1, EIO }
{ NFS_OK, 0 },
{ NFSERR_PERM, EPERM },
{ NFSERR_NOENT, ENOENT },
{ NFSERR_IO, EIO },
{ NFSERR_NXIO, ENXIO },
{ NFSERR_ACCES, EACCES },
{ NFSERR_EXIST, EEXIST },
{ NFSERR_NODEV, ENODEV },
{ NFSERR_NOTDIR, ENOTDIR },
{ NFSERR_ISDIR, EISDIR },
{ NFSERR_FBIG, EFBIG },
{ NFSERR_NOSPC, ENOSPC },
{ NFSERR_ROFS, EROFS },
{ NFSERR_NAMETOOLONG, ENAMETOOLONG },
{ NFSERR_NOTEMPTY, ENOTEMPTY },
{ NFSERR_DQUOT, EDQUOT },
{ NFSERR_STALE, ESTALE },
#ifdef EWFLUSH
{ NFSERR_WFLUSH, EWFLUSH },
#endif
{ -1, EIO }
};
static int nfs_stat_to_errno(int stat)
{
int errno;
int i;
errno = EIO;
for (i = 0; nfs_errtbl[i].stat != -1; i++) {
if (nfs_errtbl[i].stat == stat) {
errno = nfs_errtbl[i].errno;
break;
}
if (nfs_errtbl[i].stat == stat)
return nfs_errtbl[i].errno;
}
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)
int major_timeout_seen;
char *server_name;
int n;
int addrlen;
xid = start[0];
len = ((char *) end) - ((char *) start);
......@@ -117,7 +118,9 @@ static int do_nfs_rpc_call(struct nfs_server *server, int *start, int *end)
else if (wait_table.nr)
remove_wait_queue(entry.wait_address, &entry.wait);
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 == -EAGAIN) {
printk("nfs_rpc_call: bad select ready\n");
......
......@@ -35,7 +35,8 @@ struct inode_operations nfs_symlink_inode_operations = {
nfs_readlink, /* readlink */
nfs_follow_link, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int nfs_follow_link(struct inode *dir, struct inode *inode,
......
......@@ -245,6 +245,7 @@ int sys_fchmod(unsigned int fd, mode_t mode)
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
return notify_change(inode);
}
......@@ -268,6 +269,7 @@ int sys_chmod(const char * filename, mode_t mode)
inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
if (!suser() && !in_group_p(inode->i_gid))
inode->i_mode &= ~S_ISGID;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
error = notify_change(inode);
iput(inode);
......@@ -294,6 +296,7 @@ int sys_fchown(unsigned int fd, uid_t user, gid_t group)
suser()) {
inode->i_uid = user;
inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
return notify_change(inode);
}
......@@ -321,6 +324,7 @@ int sys_chown(const char * filename, uid_t user, gid_t group)
suser()) {
inode->i_uid = user;
inode->i_gid = group;
inode->i_ctime = CURRENT_TIME;
inode->i_dirt = 1;
error = notify_change(inode);
iput(inode);
......@@ -490,11 +494,13 @@ int sys_vhangup(void)
if (!suser())
return -EPERM;
/* send the SIGHUP signal. */
kill_pg(current->pgrp, SIGHUP, 0);
/* See if there is a controlling tty. */
if (current->tty < 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 (j = 0; j < NR_OPEN; j++) {
......
......@@ -351,5 +351,6 @@ struct inode_operations proc_array_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -45,7 +45,8 @@ struct inode_operations proc_base_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static struct proc_dir_entry base_dir[] = {
......
......@@ -45,7 +45,8 @@ struct inode_operations proc_fd_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
static int proc_lookupfd(struct inode * dir,const char * name, int len,
......
......@@ -123,7 +123,7 @@ void proc_read_inode(struct inode * inode)
case 5:
case 6:
inode->i_op = &proc_link_inode_operations;
inode->i_size = 3;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
return;
case 7:
......@@ -146,7 +146,7 @@ void proc_read_inode(struct inode * inode)
if (ino >= NR_OPEN || !p->filp[ino])
return;
inode->i_op = &proc_link_inode_operations;
inode->i_size = 3;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
return;
case 2:
......@@ -154,7 +154,7 @@ void proc_read_inode(struct inode * inode)
if (ino >= p->numlibraries)
return;
inode->i_op = &proc_link_inode_operations;
inode->i_size = 3;
inode->i_size = 64;
inode->i_mode = S_IFLNK | 0700;
return;
}
......
......@@ -14,6 +14,9 @@
#include <asm/segment.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);
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
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 = {
NULL, /* kmsg_lseek */
kmsg_read,
NULL, /* kmsg_write */
NULL, /* kmsg_readdir */
NULL, /* kmsg_select */
kmsg_select, /* kmsg_select */
NULL, /* kmsg_ioctl */
NULL, /* mmap */
kmsg_open,
......@@ -57,5 +71,6 @@ struct inode_operations proc_kmsg_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -34,7 +34,8 @@ struct inode_operations proc_link_inode_operations = {
proc_readlink, /* readlink */
proc_follow_link, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
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)
{
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);
if (buflen > 3)
buflen = 3;
i = sprintf(buf,"[%04x]:%u", dev, ino);
if (buflen > i)
buflen = i;
i = 0;
while (i++ < buflen)
put_fs_byte('-',buffer++);
while (i < buflen)
put_fs_byte(buf[i++],buffer++);
return i;
}
......@@ -12,6 +12,14 @@
#include <asm/segment.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)
{
unsigned long addr, pid, cr3;
......@@ -59,6 +67,8 @@ static int mem_read(struct inode * inode, struct file * file,char * buf, int cou
return tmp-buf;
}
#ifndef mem_write
static int mem_write(struct inode * inode, struct file * file,char * buf, int count)
{
unsigned long addr, pid, cr3;
......@@ -114,6 +124,8 @@ static int mem_write(struct inode * inode, struct file * file,char * buf, int co
return 0;
}
#endif
static int mem_lseek(struct inode * inode, struct file * file, off_t offset, int orig)
{
switch (orig) {
......@@ -154,5 +166,6 @@ struct inode_operations proc_mem_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
......@@ -45,7 +45,8 @@ struct inode_operations proc_root_inode_operations = {
NULL, /* readlink */
NULL, /* follow_link */
NULL, /* bmap */
NULL /* truncate */
NULL, /* truncate */
NULL /* permission */
};
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.
* Written by Hennus Bergman, 1992.
* High DMA channel support & info by Hannu Savolainen
......@@ -9,7 +9,6 @@
#define _ASM_DMA_H
#include <asm/io.h> /* need byte IO */
#include <linux/kernel.h> /* need panic() [FIXME] */
#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
......@@ -143,9 +142,9 @@ static __inline__ void disable_dma(unsigned int dmanr)
/* Clear the 'DMA Pointer Flip Flop'.
* Write 0 for LSB/MSB, 1 for MSB/LSB access.
* Use this once to initialize the FF to a know state.
* After that, keep track of it. :-) In order to do that,
* dma_set_addr() and dma_set_count() should only be used wile
* interrupts are disbled.
* After that, keep track of it. :-)
* --- In order to do that, the DMA routines below should ---
* --- only be used while interrupts are disbled! ---
*/
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)
* NOTE: from a manual: "the number of transfers is one more
* than the initial word count"! This is taken into account.
* 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)
{
......@@ -227,33 +226,34 @@ static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
if (dmanr <= 3) {
outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
} else {
outb( count & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
outb( (count>>8) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
} else {
outb( (count>>1) & 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
* 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.
* If called before the channel has been used, it may return 1.
* Otherwise, it returns the number of bytes (or words) left to
* transfer, minus 1, modulo 64k.
* Otherwise, it returns the number of _bytes_ left to transfer.
*
* 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) {
return 1 + inb( ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ) +
(inb( ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ) << 8);
} else {
return 1 + inb( ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ) +
(inb( ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ) << 8);
}
unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
: ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
/* using short to get 16-bit wrap around */
short count = 1 + inb(io_port) +
( inb(io_port) << 8 );
return (dmanr<=3)? count : (count<<1);
}
/* These are in kernel/dma.c: */
extern int request_dma(unsigned int dmanr); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
......
......@@ -60,10 +60,8 @@
"iret"
#define ACK_FIRST(mask) \
"inb $0x21,%al\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
"1:\torb $" #mask ",%al\n\t" \
"orb $" #mask ",_cache_21\n\t" \
"movb _cache_21,%al\n\t" \
"outb %al,$0x21\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
......@@ -71,10 +69,8 @@
"outb %al,$0x20\n\t"
#define ACK_SECOND(mask) \
"inb $0xA1,%al\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
"1:\torb $" #mask ",%al\n\t" \
"orb $" #mask ",_cache_A1\n\t" \
"movb _cache_A1,%al\n\t" \
"outb %al,$0xA1\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
......@@ -85,17 +81,13 @@
"1:\toutb %al,$0x20\n\t"
#define UNBLK_FIRST(mask) \
"inb $0x21,%al\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
"1:\tandb $~(" #mask "),%al\n\t" \
"andb $~(" #mask "),_cache_21\n\t" \
"movb _cache_21,%al\n\t" \
"outb %al,$0x21\n\t"
#define UNBLK_SECOND(mask) \
"inb $0xA1,%al\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
"1:\tandb $~(" #mask "),%al\n\t" \
"andb $~(" #mask "),_cache_A1\n\t" \
"movb _cache_A1,%al\n\t" \
"outb %al,$0xA1\n\t"
#define IRQ_NAME2(nr) nr##_interrupt()
......@@ -108,7 +100,7 @@ void IRQ_NAME(nr); \
void FAST_IRQ_NAME(nr); \
void BAD_IRQ_NAME(nr); \
__asm__( \
"\n.align 2\n" \
"\n.align 4\n" \
"_IRQ" #nr "_interrupt:\n\t" \
"pushl $-"#nr"-2\n\t" \
SAVE_ALL \
......@@ -124,25 +116,48 @@ __asm__( \
UNBLK_##chip(mask) \
"decl _intr_count\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" \
"incl _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" \
"jmp ret_from_sys_call\n" \
"\n.align 2\n" \
"\n.align 4\n" \
"_fast_IRQ" #nr "_interrupt:\n\t" \
SAVE_MOST \
ACK_##chip(mask) \
"incl _intr_count\n\t" \
"pushl $" #nr "\n\t" \
"call _do_fast_IRQ\n\t" \
"addl $4,%esp\n\t" \
"cli\n\t" \
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 \
"\n\n.align 2\n" \
"\n\n.align 4\n" \
"_bad_IRQ" #nr "_interrupt:\n\t" \
"pushl %eax\n\t" \
ACK_##chip(mask) \
......
......@@ -24,7 +24,7 @@ extern inline int tas(char * m)
{
char res;
__asm__("xchg %0,%1":"=q" (res),"=m" (*m):"0" (0x1));
__asm__("xchgb %0,%1":"=q" (res),"=m" (*m):"0" (0x1));
return res;
}
......
......@@ -12,7 +12,13 @@
#ifndef UTS_NODENAME
#define UTS_NODENAME "(none)" /* set by sethostname() */
#endif
#ifdef CONFIG_M486
#define UTS_MACHINE "i486" /* hardware type */
#else
#define UTS_MACHINE "i386" /* hardware type */
#endif
/*
* The definitions for UTS_RELEASE and UTS_VERSION are now defined
* in linux/version.h, and should only be used by linux/version.c
......
......@@ -256,6 +256,7 @@ struct inode_operations {
int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **);
int (*bmap) (struct inode *,int);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int);
};
struct super_operations {
......
......@@ -43,12 +43,12 @@
#define WIN_SPECIFY 0x91
/* 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 ABRT_ERR 0x04 /* ? */
#define ID_ERR 0x10 /* ? */
#define ECC_ERR 0x40 /* ? */
#define BBD_ERR 0x80 /* ? */
#define ABRT_ERR 0x04 /* Command aborted */
#define ID_ERR 0x10 /* ID field not found */
#define ECC_ERR 0x40 /* Uncorrectable ECC error */
#define BBD_ERR 0x80 /* block marked bad */
/* HDIO_GETGEO is the preferred choice - HDIO_REQ will be removed at some
......
......@@ -7,7 +7,8 @@ struct bh_struct {
void *data;
};
extern int bh_active;
extern unsigned long bh_active;
extern unsigned long bh_mask;
extern struct bh_struct bh_base[32];
/* Who gets which entry in bh_base. Things which will occur most often
......@@ -20,8 +21,6 @@ enum {
KEYBOARD_BH
};
void do_bottom_half();
extern inline void mark_bh(int nr)
{
__asm__ __volatile__("btsl %1,%0":"=m" (bh_active):"ir" (nr));
......
......@@ -24,7 +24,7 @@
#define IOCCMD_MASK 0x0000ffff /* command code */
#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
* (last) argument field in the ioctl call, if present.
*/
......@@ -33,7 +33,7 @@
#define _IOR(c,d,t) (IOC_OUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
/* WR rather than RW to avoid conflict with stdio.h */
#define _IOWR(c,d,t) (IOC_INOUT | (sizeof(t)<<16) & IOCSIZE_MASK) | \
#define _IOWR(c,d,t) (IOC_INOUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
#endif /* _LINUX_IOCTL_H */
......
#ifndef __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.
* This includes things like "key-down" flags - if the shift key is
......@@ -65,10 +68,6 @@ extern struct kbd_struct kbd_table[];
#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 inline int kbd_flag(int flag)
......
#ifndef _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
* many modifications copyright (C) 1992 Michael K. Johnson
......@@ -71,7 +64,7 @@
#define LP_B(minor) lp_table[(minor)].base /* IO address */
#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_CHAR(minor) lp_table[(minor)].chars /* busy timeout */
#define LP_TIME(minor) lp_table[(minor)].time /* wait time */
......
#ifndef _LINUX_NFS_H
#define _LINUX_NFS_H
#define RPC_VERSION 2
#define NFS_PORT 2049
#define NFS_MAXDATA 8192
#define NFS_MAXPATHLEN 1024
......@@ -20,6 +18,10 @@
#define NFSMODE_SOCK 0140000
#define NFSMODE_FIFO 0010000
#ifdef KERNEL /* user programs should get these from the rpc header files */
#define RPC_VERSION 2
enum rpc_auth_flavor {
RPC_AUTH_NULL = 0,
RPC_AUTH_UNIX = 1,
......@@ -33,7 +35,7 @@ enum rpc_msg_type {
enum rpc_reply_stat {
RPC_MSG_ACCEPTED = 0,
RPC_MSG_DENIED,
RPC_MSG_DENIED = 1,
};
enum rpc_accept_stat {
......@@ -56,6 +58,8 @@ enum rpc_auth_stat {
RPC_AUTH_REJECTEDVERF = 4,
RPC_AUTH_TOOWEAK = 5,
};
#endif /* KERNEL */
enum nfs_stat {
NFS_OK = 0,
......
......@@ -40,6 +40,14 @@
#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_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server)
......
......@@ -13,7 +13,7 @@
* 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
* 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.
*/
......
......@@ -7,24 +7,6 @@
* 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.
*
......@@ -37,7 +19,7 @@ struct struct_ISR {
struct async_struct {
int baud_base;
int port;
async_ISR ISR;
int irq;
int flags;
int type;
struct tty_struct *tty;
......@@ -48,6 +30,9 @@ struct async_struct {
int x_char; /* xon/xoff characater */
int event;
int line;
struct async_struct *next_port; /* For the linked list */
struct async_struct *prev_port;
};
/*
......@@ -92,7 +77,7 @@ struct async_struct {
#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_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
......
......@@ -76,7 +76,8 @@ struct serial_struct {
int flags;
int xmit_fifo_size;
int custom_divisor;
int reserved[8];
int baud_base;
int reserved[7];
};
/*
......@@ -92,7 +93,6 @@ struct serial_struct {
/*
* 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_SAK 0x0004 /* Secure Attention Key (Orange book) */
......@@ -101,7 +101,10 @@ struct serial_struct {
#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
#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_SERIAL(min) (((min) & 0xC0) == 0x40)
......@@ -244,6 +247,7 @@ struct tty_struct {
#define TTY_CR_PENDING 2
#define TTY_SQ_THROTTLED 3
#define TTY_RQ_THROTTLED 4
#define TTY_IO_ERROR 5
#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
#define TTY_READ_FLUSH(tty) tty_read_flush((tty))
......
......@@ -16,6 +16,7 @@ struct vt_mode {
#define VT_SETMODE 0x5602 /* set mode of active vt */
#define VT_AUTO 0x00 /* auto vt switching */
#define VT_PROCESS 0x01 /* process controls switching */
#define VT_ACKACQ 0x02 /* acknowledge switch */
struct vt_stat {
ushort v_active; /* active vt */
......@@ -28,5 +29,6 @@ struct vt_stat {
#define VT_RELDISP 0x5605 /* release display */
#define VT_ACTIVATE 0x5606 /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */
#endif /* _LINUX_VT_H */
......@@ -128,6 +128,14 @@ void ffree_()
}
void ffreep()
{
/* ffree st(i) + pop - unofficial code */
st(FPU_rm).tag = TW_Empty;
pop();
}
void fst_i_()
{
/* fst st(i) */
......
......@@ -37,11 +37,21 @@
#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] = {
fadd__, fld_i_, __BAD__, __BAD__, fadd_i, ffree_, faddp_, __BAD__,
fmul__, fxch_i, __BAD__, __BAD__, fmul_i, __BAD__, fmulp_, __BAD__,
fcom_st, fp_nop, __BAD__, __BAD__, __BAD__, fst_i_, __BAD__, __BAD__,
fcompst, __BAD__, __BAD__, __BAD__, __BAD__, fstp_i, fcompp, __BAD__,
fadd__, fld_i_, __BAD__, __BAD__, fadd_i, ffree_, faddp_, _df_c0_,
fmul__, fxch_i, __BAD__, __BAD__, fmul_i, _dd_c8_, fmulp_, _df_c8_,
fcom_st, fp_nop, __BAD__, __BAD__, _dc_d0_, fst_i_, _de_d0_, _df_d0_,
fcompst, _d9_d8_, __BAD__, __BAD__, _dc_d8_, fstp_i, fcompp, _df_d8_,
fsub__, fp_etc, __BAD__, finit_, fsubri, fucom_, fsubrp, fstsw_,
fsubr_, fconst, fucompp, __BAD__, fsub_i, fucomp, fsubp_, __BAD__,
fdiv__, trig_a, __BAD__, __BAD__, fdivri, __BAD__, fdivrp, __BAD__,
......@@ -56,10 +66,10 @@ static FUNC st_instr_table[64] = {
#define _null_ 4 /* Function illegal or not implemented */
static unsigned char type_table[64] = {
_REGI_, _NONE_, _null_, _null_, _REGI_, _REGi_, _REGI_, _null_,
_REGI_, _REGI_, _null_, _null_, _REGI_, _null_, _REGI_, _null_,
_REGI_, _NONE_, _null_, _null_, _null_, _REG0_, _null_, _null_,
_REGI_, _null_, _null_, _null_, _null_, _REG0_, _REGI_, _null_,
_REGI_, _NONE_, _null_, _null_, _REGI_, _REGi_, _REGI_, _REGi_,
_REGI_, _REGI_, _null_, _null_, _REGI_, _REGI_, _REGI_, _REGI_,
_REGI_, _NONE_, _null_, _null_, _REGI_, _REG0_, _REGI_, _REG0_,
_REGI_, _REG0_, _null_, _null_, _REGI_, _REG0_, _REGI_, _REG0_,
_REGI_, _NONE_, _null_, _NONE_, _REGI_, _REGI_, _REGI_, _NONE_,
_REGI_, _NONE_, _REGI_, _null_, _REGI_, _REGI_, _REGI_, _null_,
_REGI_, _NONE_, _null_, _null_, _REGI_, _null_, _REGI_, _null_,
......
......@@ -36,6 +36,7 @@ extern void fp_nop(void);
extern void fld_i_(void);
extern void fxch_i(void);
extern void ffree_(void);
extern void ffreep(void);
extern void fst_i_(void);
extern void fstp_i(void);
/* fpu_entry.c */
......
......@@ -38,9 +38,9 @@ static unsigned char type_table[32] = {
_null_, _null_, _null_, _null_,
_REG0_, _REG0_, _REG0_, _REG0_,
_REG0_, _REG0_, _REG0_, _REG0_,
_null_, _null_, _NONE_, _PUSH_,
_NONE_, _null_, _NONE_, _PUSH_,
_NONE_, _PUSH_, _null_, _PUSH_,
_null_, _null_, _NONE_, _REG0_,
_NONE_, _null_, _NONE_, _REG0_,
_NONE_, _REG0_, _NONE_, _REG0_
};
......
/* fdomain.c -- Future Domain TMC-1660/TMC-1680 driver
* 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
* Copyright 1992 Rickard E. Faith
* Copyright 1992, 1993 Rickard E. Faith
*
* $Log$
......@@ -16,29 +16,88 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* WARNING: THIS IS A BETA VERSION!
* USE AT YOUR OWN RISK!
* BACKUP YOUR SYSTEM BEFORE USING!
* I would like to thank Maxtor, whose *free* 206 page manual on the LXT
* drives was very helpful: "LXT SCSI Products: Specifications and OEM
* Technical Manual (Revision B/September 1991)"
* 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
* (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
* example source. (The DOS BIOS source cost $250 and the UN*X driver
* source was $750 [both required a non-disclosure agreement]. Ever wonder
* why there are no freely available Future Domain drivers?)
* Thanks to: 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) and Sakari Aaltonen (sakaria@vipunen.hit.fi)
* for alpha testing. Also thanks to Drew Eckhardt (drew@cs.colorado.edu)
* and Eric Youngdale (eric@tantalus.nrl.navy.mil) for answering questions,
* and to Doug Hoffman (hoffman@cs.unc.edu) for lending me SCSI devices to
* make the driver more robust. */
**************************************************************************
DESCRIPTION:
This is the Linux low-level SCSI driver for Future Domain TMC-1660/1680
and TMC-1670 SCSI host adapters.
REFERENCES USED:
"TMC-1800 SCSI Chip Specification (FDC-1800T)", Future Domain Corporation,
1990.
"LXT SCSI Products: Specifications and OEM Technical Manual (Revision
B/September 1991)", Maxtor Corporation, 1991.
"7213S product Manual (Revision P3)", Maxtor Corporation, 1992.
Private communications, Drew Eckhardt (drew@cs.colorado.edu) and Eric
Youngdale (eric@tantalus.nrl.navy.mil), 1992.
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 <asm/io.h>
......@@ -49,14 +108,14 @@
#include <asm/system.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 */
#define DEBUG 1 /* Enable debugging output */
#define ENABLE_PARITY 1 /* Enable SCSI Parity */
#define QUEUE 1 /* Enable command queueing */
#define FIFO_COUNT 2 /* Number of 512 byte blocks before INTR */
#define FIFO_COUNT 2 /* Number of 512 byte blocks before INTR */
#define DO_DETECT 0 /* Do device detection here (see scsi.c) */
#define RESELECTION 0 /* Support RESELECTION PHASE (NOT stable) */
......@@ -66,8 +125,8 @@
#define EVERY_ACCESS 0 /* Write a line on every scsi access */
#define ERRORS_ONLY 1 /* Only write a line if there is an error */
#define DEBUG_DETECT 0 /* Debug fdomain_16x0_detect() */
#define DEBUG_MESSAGES 0 /* Debug MESSAGE IN PHASE */
#define DEBUG_ABORT 1 /* Debug abort() routine */
#define DEBUG_MESSAGES 0 /* Debug MESSAGE IN PHASE */
#define DEBUG_ABORT 1 /* Debug abort() routine */
#else
#define EVERY_ACCESS 0 /* LEAVE THESE ALONE--CHANGE THE ONES ABOVE */
#define ERRORS_ONLY 0
......@@ -154,19 +213,16 @@ static unsigned short ints[] = { 3, 5, 10, 11, 12, 14, 15, 0 };
READ EVERY WORD, ESPECIALLY THE WORD *NOT*
This driver works *ONLY* for Future Domain cards using the
TMC-1800 chip. This includes models TMC-1660 and TMC-1680
*ONLY*.
This driver works *ONLY* for Future Domain cards using the TMC-1800 chip.
This includes models TMC-1660, 1670, and 1680 *ONLY*.
The following BIOS signatures have been tried with this driver. These
signatures are for boards which do *NOT* work with this driver (but the
first one should work with the Seagate driver):
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 V7.009/18/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 V7.009/18/90
*/
......@@ -175,8 +231,10 @@ struct signature {
int sig_offset;
int sig_length;
} signatures[] = {
{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800-V2.0 7/28/89", 5, 50 },
{ "FUTURE DOMAIN CORP. (C) 1986-1990 1800", 5, 37 },
/* 1 2 3 4 5 6 */
/* 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 */
};
......@@ -510,7 +568,7 @@ int fdomain_16x0_detect( int hostnum )
const char *fdomain_16x0_info(void)
{
static char buffer[] =
"Future Domain TMC-1660/TMC-1680 SCSI driver version "
"Future Domain TMC-16x0 SCSI driver version "
VERSION
"\n";
return buffer;
......
/* fdomain.h -- Header for Future Domain TMC-1660/TMC-1680 driver
* 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
* Copyright 1992 Rickard E. Faith
* Copyright 1992, 1993 Rickard E. Faith
* This program comes with ABSOLUTELY NO WARRANTY.
*
* $Log$
......@@ -19,7 +19,7 @@ int fdomain_16x0_reset( void );
int fdomain_16x0_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) );
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_info, \
fdomain_16x0_command, \
......
......@@ -107,6 +107,8 @@ extern int last_reset[];
static struct blist blacklist[] =
{{"TANDBERG","TDC 3600","U07"}, /* Locks up if polled for lun != 0 */
{"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}};
static int blacklisted(char * response_data){
......@@ -427,8 +429,10 @@ Scsi_Cmnd * request_queueable (struct request * req, int index)
if (req) {
memcpy(&SCpnt->request, req, sizeof(struct request));
req->dev = -1;
} else
} else {
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 */
return SCpnt;
......@@ -491,6 +495,7 @@ Scsi_Cmnd * allocate_device (struct request ** reqp, int index, int wait)
*reqp = req->next;
} else {
SCpnt->request.dev = 0xffff; /* Busy */
SCpnt->request.waiting = NULL; /* And no one is waiting for this to complete */
};
sti();
break;
......
......@@ -153,9 +153,17 @@ static struct sigaction seagate_sigaction = {
base_address = NULL;
#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
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
#else
/*
......@@ -274,8 +282,10 @@ static void seagate_reconnect_intr (int unused)
printk("scsi%d : done_fn(%d,%08x)", hostno,
hostno, temp);
#endif
if(!SCint) panic("SCint == NULL in seagate");
SCint->result = temp;
done_fn (SCint);
SCint = NULL;
}
else
printk("done_fn() not defined.\n");
......@@ -311,6 +321,7 @@ int seagate_st0x_queue_command (Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
{
SCpnt->result = result;
done_fn (SCpnt);
SCint = NULL;
return 1;
}
}
......
......@@ -30,7 +30,7 @@
Kai Makisara, Nov 9, 1992 email makisara@vtinsx.ins.vtt.fi or
Kai.Makisara@vtt.fi
Last changes Dec 19, 1992.
Last changes Jan 3, 1993.
*/
#include <linux/fs.h>
......@@ -856,8 +856,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
dev = dev & 127;
SCpnt = allocate_device(NULL, scsi_tapes[dev].device->index, 1);
memset(cmd, 0, 10);
switch (cmd_in) {
case MTFSF:
......@@ -905,7 +903,6 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
cmd[2] = (ltmp >> 16);
cmd[3] = (ltmp >> 8);
cmd[4] = ltmp;
SCpnt->result = -1;
#ifdef DEBUG
if (cmd[2] & 0x80)
ltmp = 0xff000000;
......@@ -1042,10 +1039,10 @@ static int st_int_ioctl(struct inode * inode,struct file * file,
break;
default:
printk("st%d: Unknown st_ioctl command %x.\n", dev, cmd_in);
SCpnt->request.dev = -1; /* Mark as not busy */
return (-ENOSYS);
}
SCpnt = allocate_device(NULL, scsi_tapes[dev].device->index, 1);
SCpnt->sense_buffer[0] = 0;
SCpnt->request.dev = dev;
scsi_do_cmd(SCpnt,
......
......@@ -54,7 +54,6 @@
#define NPAR 16
extern void vt_init(void);
extern void set_leds(void);
unsigned long video_num_columns; /* Number of text columns */
unsigned long video_num_lines; /* Number of test lines */
......
......@@ -16,6 +16,15 @@
#include <linux/ptrace.h>
#include <linux/keyboard.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
......@@ -36,6 +45,7 @@ unsigned long kbd_flags = 0;
unsigned long kbd_dead_keys = 0;
unsigned long kbd_prev_dead_keys = 0;
static int want_console = -1;
struct kbd_struct kbd_table[NR_CONSOLES];
static struct kbd_struct * kbd = kbd_table;
static struct tty_struct * tty = NULL;
......@@ -50,7 +60,6 @@ static int npadch = 0;
fptr key_table[];
static void put_queue(int);
void set_leds(void);
static void applkey(int);
static void cur(int);
static unsigned int handle_diacr(unsigned int);
......@@ -136,8 +145,8 @@ static void keyboard_interrupt(int int_pt_regs)
key_table[scancode](scancode);
rep = scancode;
end_kbd_intr:
do_keyboard_interrupt();
send_cmd(0xAE);
mark_bh(KEYBOARD_BH);
}
static void put_queue(int ch)
......@@ -239,7 +248,6 @@ static void caps(int sc)
return; /* key already pressed: defeat repeat */
set_kbd_flag(KG_CAPSLOCK);
chg_vc_kbd_flag(kbd,VC_CAPSLOCK);
set_leds();
}
static void uncaps(int sc)
......@@ -272,20 +280,16 @@ static void scroll(int sc)
show_ptregs();
else if (kbd_flag(KG_LCTRL) || kbd_flag(KG_RCTRL))
show_state();
else {
else
chg_vc_kbd_flag(kbd,VC_SCROLLOCK);
set_leds();
}
}
static void num(int sc)
{
if (vc_kbd_flag(kbd,VC_APPLIC))
applkey(0x50);
else {
else
chg_vc_kbd_flag(kbd,VC_NUMLOCK);
set_leds();
}
}
static void applkey(int key)
......@@ -1249,7 +1253,7 @@ static void func(int sc)
return;
}
if (kbd_flag(KG_ALT))
change_console(sc);
want_console = sc;
else
if (kbd_flag(KG_LSHIFT) || kbd_flag(KG_RSHIFT)) /* DEC F11 - F20 */
puts_queue(func_table[1][sc]);
......@@ -1334,21 +1338,34 @@ static int send_data(unsigned char data)
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 unsigned char old_leds = -1;
unsigned char leds = kbd_table[fg_console].flags & LED_MASK;
if (leds == old_leds)
return;
old_leds = leds;
if (!send_data(0xed) || !send_data(leds))
send_data(0xf4); /* re-enable kbd if any errors */
}
void set_leds(void)
{
mark_bh(KEYBOARD_BH);
if (leds != old_leds) {
old_leds = leds;
if (!send_data(0xed) || !send_data(leds))
send_data(0xf4); /* re-enable kbd if any errors */
}
if (want_console >= 0) {
change_console(want_console);
want_console = -1;
}
do_keyboard_interrupt();
}
long no_idt[2] = {0, 0};
......@@ -1363,7 +1380,7 @@ void hard_reset_now(void)
int i, j;
extern unsigned long pg0[1024];
cli();
sti();
/* rebooting needs to touch the page at absolute addr 0 */
pg0[0] = 7;
*((unsigned short *)0x472) = 0x1234;
......
/* 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>
/* 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
......@@ -16,10 +21,10 @@ static int lp_reset(int minor)
int testvalue;
/* reset value */
outb(0, LP_C(minor));
outb_p(0, LP_C(minor));
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);
}
......@@ -32,7 +37,7 @@ static int lp_char(char lpchar, int minor)
int retval = 0, wait = 0;
unsigned long count = 0;
outb(lpchar, LP_B(minor));
outb_p(lpchar, LP_B(minor));
do {
retval = LP_S(minor);
count ++;
......@@ -54,10 +59,10 @@ static int lp_char(char lpchar, int minor)
low, according spec. Some printers need it, others don't. */
while(wait != LP_WAIT(minor)) wait++;
/* 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--;
/* 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 */
return LP_S(minor);
}
......@@ -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,
off_t offset, int origin)
{
return -EINVAL;
return -ESPIPE;
}
static int lp_open(struct inode * inode, struct file * file)
......@@ -232,10 +237,10 @@ long lp_init(long kmem_start)
/* take on all known port values */
for (offset = 0; offset < LP_NO; offset++) {
/* 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++)
;
testvalue = inb(LP_B(offset));
testvalue = inb_p(LP_B(offset));
if (testvalue != 255) {
LP_F(offset) |= LP_EXIST;
lp_reset(offset);
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,24 +20,24 @@
#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
* /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
* always treat our set of vt as numbered 1..NR_CONSOLES (corresponding to
* ttys 0..NR_CONSOLES-1).
*
* Mostly done for X386, but with some slight differences and omissions.
* Should be useable by other SYSV programs in the future.
* 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
* to the current console is done by the main ioctl code.
*/
struct vt_cons vt_cons[NR_CONSOLES];
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 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
......@@ -282,6 +282,25 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
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.
*/
......@@ -304,38 +323,69 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
change_console(arg - 1);
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
* immediately, but postpone the operation until the process calls this
* ioctl, allowing the switch to complete.
*
* XXX Under X, the switching code calls VT_RELDISP with an arg of 2
* when it has switched back to it's vt. That's not kosher according
* to my documentation, which says this is only called when releasing
* the vt under your control.
* According to the X sources this is the behavior:
* 0: pending switch-from not OK
* 1: pending switch-from OK
* 2: completed switch-to OK
*/
case VT_RELDISP:
if (vt_cons[console].vt_mode.mode != VT_PROCESS ||
vt_cons[console].vt_newvt < 0)
if (vt_cons[console].vt_mode.mode != VT_PROCESS)
return -EINVAL;
if (arg != 0)
/*
* Switching-from response
*/
if (vt_cons[console].vt_newvt >= 0)
{
/*
* If arg is nonzero, the current vt has been released,
* so we can go ahead and complete the switch.
*/
int newvt = vt_cons[console].vt_newvt;
vt_cons[console].vt_newvt = -1;
complete_change_console(newvt);
if (arg == 0)
/*
* Switch disallowed, so forget we were trying
* to do it.
*/
vt_cons[console].vt_newvt = -1;
else
{
/*
* The current vt has been released, so
* complete the switch.
*/
int newvt = vt_cons[console].vt_newvt;
vt_cons[console].vt_newvt = -1;
complete_change_console(newvt);
}
}
/*
* Switched-to response
*/
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;
default:
......
......@@ -35,9 +35,11 @@
#define CR0_NE 32
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. */
int bh_active=0;
unsigned long bh_active = 0;
unsigned long bh_mask = 0xFFFFFFFF;
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
* nested irq's active.
*/
void do_bottom_half(void)
void do_bottom_half(int nr)
{
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;
if (bh->routine != NULL)
bh->routine(bh->data);
......@@ -186,11 +185,14 @@ int irqaction(unsigned int irq, struct sigaction * new)
set_intr_gate(0x20+irq,fast_interrupt[irq]);
else
set_intr_gate(0x20+irq,interrupt[irq]);
if (irq < 8)
outb(inb_p(0x21) & ~(1<<irq),0x21);
else {
outb(inb_p(0x21) & ~(1<<2),0x21);
outb(inb_p(0xA1) & ~(1<<(irq-8)),0xA1);
if (irq < 8) {
cache_21 &= ~(1<<irq);
outb(cache_21,0x21);
} else {
cache_21 &= ~(1<<2);
cache_A1 &= ~(1<<(irq-8));
outb(cache_21,0x21);
outb(cache_A1,0xA1);
}
restore_flags(flags);
return 0;
......@@ -222,10 +224,13 @@ void free_irq(unsigned int irq)
}
save_flags(flags);
cli();
if (irq < 8)
outb(inb_p(0x21) | (1<<irq),0x21);
else
outb(inb_p(0xA1) | (1<<(irq-8)),0xA1);
if (irq < 8) {
cache_21 |= 1 << irq;
outb(cache_21,0x21);
} else {
cache_A1 |= 1 << (irq-8);
outb(cache_A1,0xA1);
}
set_intr_gate(0x20+irq,bad_interrupt[irq]);
sa->sa_handler = NULL;
sa->sa_flags = 0;
......
......@@ -20,8 +20,8 @@ extern void console_print(const char *);
static unsigned long log_page = 0;
static unsigned long log_start = 0;
static unsigned long log_size = 0;
static struct wait_queue * log_wait = NULL;
unsigned long log_size = 0;
struct wait_queue * log_wait = NULL;
int sys_syslog(int type, char * buf, int len)
{
......
......@@ -149,9 +149,6 @@ _system_call:
call _schedule
.align 4,0x90
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
testl $VM_MASK,%eax # different then
jne 4f
......@@ -159,7 +156,8 @@ ret_from_sys_call:
jne 2f
cmpw $0x17,OLDSS(%esp) # was stack segment = 0x17 ?
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
movl %eax,EFLAGS(%esp) # stupid
1: cmpl $0,_need_resched
......
......@@ -169,7 +169,7 @@ void do_stack_segment(long esp,long error_code)
void do_coprocessor_error(long esp, long error_code)
{
send_sig(SIGFPE, last_task_used_math, 1);
__asm__("fnclex");
__asm__("fninit");
}
void do_reserved(long esp, long error_code)
......
......@@ -75,9 +75,9 @@ struct proto_ops {
extern int sock_awaitconn(struct socket *mysock, struct socket *servsock);
#ifdef SOCK_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK (void)
#define PRINTK(x) /**/
#endif
#endif /* _KERN_SOCK_H */
This diff is collapsed.
......@@ -59,10 +59,11 @@
#include "arp.h"
#undef ARP_DEBUG
#ifdef ARP_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK dummy_routine
#define PRINTK(x) /**/
#endif
static struct arp_table *arp_table[ARP_TABLE_SIZE] ={NULL, };
......@@ -147,33 +148,33 @@ print_arp(struct arp *arp)
int i;
unsigned long *lptr;
unsigned char *ptr;
PRINTK ("arp: \n");
PRINTK (("arp: \n"));
if (arp == NULL)
{
PRINTK ("(null)\n");
PRINTK (("(null)\n"));
return;
}
PRINTK (" hrd = %d\n",net16(arp->hrd));
PRINTK (" pro = %d\n",net16(arp->pro));
PRINTK (" hlen = %d plen = %d\n",arp->hlen, arp->plen);
PRINTK (" op = %d\n", net16(arp->op));
PRINTK ((" hrd = %d\n",net16(arp->hrd)));
PRINTK ((" pro = %d\n",net16(arp->pro)));
PRINTK ((" hlen = %d plen = %d\n",arp->hlen, arp->plen));
PRINTK ((" op = %d\n", net16(arp->op)));
ptr = (unsigned char *)(arp+1);
PRINTK (" sender haddr = ");
PRINTK ((" sender haddr = "));
for (i = 0; i < arp->hlen; i++)
{
PRINTK ("0x%02X ",*ptr++);
PRINTK (("0x%02X ",*ptr++));
}
lptr = (void *)ptr;
PRINTK (" send paddr = %X\n",*lptr);
PRINTK ((" send paddr = %X\n",*lptr));
lptr ++;
ptr = (void *)lptr;
PRINTK (" destination haddr = ");
PRINTK ((" destination haddr = "));
for (i = 0; i < arp->hlen; i++)
{
PRINTK ("0x%02X ",*ptr++);
PRINTK (("0x%02X ",*ptr++));
}
lptr = (void *)ptr;
PRINTK (" destination paddr = %X\n",*lptr);
PRINTK ((" destination paddr = %X\n",*lptr));
}
static unsigned char *
......@@ -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->sk = NULL;
skb->next = NULL;
PRINTK (">>");
PRINTK ((">>"));
print_arp(arp2);
/* send it. */
dev->queue_xmit (skb, dev, 0);
......@@ -283,7 +284,7 @@ arp_lookup (unsigned long paddr)
{
unsigned long hash;
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. */
if (my_ip_addr(paddr)) return (NULL);
hash = net32(paddr) & (ARP_TABLE_SIZE - 1);
......@@ -306,7 +307,7 @@ arp_destroy(unsigned long paddr)
unsigned long hash;
struct arp_table *apt;
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 */
if (my_ip_addr(paddr)) return;
hash = net32(paddr) & (ARP_TABLE_SIZE - 1);
......@@ -369,7 +370,7 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
struct arp_table *tbl;
int ret;
PRINTK ("<<\n");
PRINTK (("<<\n"));
arp = skb->h.arp;
print_arp(arp);
......@@ -427,7 +428,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr)
struct arp *arp;
struct arp_table *apt;
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. */
apt = create_arp (paddr, NULL, 0);
......@@ -465,7 +466,7 @@ arp_snd (unsigned long paddr, struct device *dev, unsigned long saddr)
*arp_targetp(arp) = paddr;
memcpy (arp_sourceh(arp), dev->dev_addr, dev->addr_len);
memcpy (arp_targeth(arp), dev->broadcast, dev->addr_len);
PRINTK(">>\n");
PRINTK((">>\n"));
print_arp(arp);
dev->queue_xmit (skb, dev, 0);
}
......@@ -475,8 +476,8 @@ arp_find(unsigned char *haddr, unsigned long paddr, struct device *dev,
unsigned long saddr)
{
struct arp_table *apt;
PRINTK ("arp_find(haddr=%X, paddr=%X, dev=%X, saddr=%X)\n",
haddr, paddr, dev, saddr);
PRINTK (("arp_find(haddr=%X, paddr=%X, dev=%X, saddr=%X)\n",
haddr, paddr, dev, saddr));
if (my_ip_addr (paddr))
{
memcpy (haddr, dev->dev_addr, dev->addr_len);
......
......@@ -78,9 +78,9 @@
#undef DEV_DEBUG
#ifdef DEV_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK dummy_routine
#define PRINTK(x) /**/
#endif
......@@ -157,7 +157,7 @@ void
dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri)
{
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)
{
......@@ -185,7 +185,7 @@ dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri)
}
/* 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. */
cli();
if (dev->buffs[pri] == NULL)
......@@ -365,7 +365,7 @@ inet_bh(void *tmp)
if (!flag)
{
PRINTK ("discarding packet type = %X\n", type);
PRINTK (("discarding packet type = %X\n", type));
kfree_skb (skb, FREE_READ);
}
}
......@@ -452,7 +452,7 @@ dev_tint(unsigned char *buff, struct device *dev)
if (buff != NULL)
memcpy (buff, skb + 1, tmp);
PRINTK (">>\n");
PRINTK ((">>\n"));
print_eth ((struct enet_header *)(skb+1));
}
else
......@@ -474,7 +474,6 @@ dev_tint(unsigned char *buff, struct device *dev)
return (tmp);
}
}
PRINTK ("dev_tint returning 0 \n");
PRINTK (("dev_tint returning 0 \n"));
return (0);
}
......@@ -56,29 +56,29 @@
#undef ETH_DEBUG
#ifdef ETH_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK dummy_routine
#define PRINTK(x) /**/
#endif
void
print_eth (struct enet_header *eth)
{
int i;
PRINTK ("ether source addr: ");
PRINTK (("ether source addr: "));
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++)
{
PRINTK ("0x%2X ",eth->daddr[i]);
PRINTK (("0x%2X ",eth->daddr[i]));
}
PRINTK ("\n");
PRINTK ("ethertype = %X\n",net16(eth->type));
PRINTK (("\n"));
PRINTK (("ethertype = %X\n",net16(eth->type)));
}
int
......
......@@ -74,10 +74,11 @@
#endif
#undef ICMP_DEBUG
#ifdef ICMP_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK dummy_routine
#define PRINTK(x) /**/
#endif
#define min(a,b) ((a)<(b)?(a):(b))
......@@ -103,9 +104,9 @@ struct icmp_err icmp_err_convert[]=
void
print_icmph (struct icmp_header *icmph)
{
PRINTK (" type = %d, code = %d, checksum = %X\n", icmph->type,
icmph->code, icmph->checksum);
PRINTK (" gateway = %X\n", icmph->un.gateway);
PRINTK ((" type = %d, code = %d, checksum = %X\n", icmph->type,
icmph->code, icmph->checksum));
PRINTK ((" gateway = %X\n", icmph->un.gateway));
}
/* 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)
struct icmp_header *icmph;
int len;
PRINTK ("icmp_reply (skb_in = %X, type = %d, code = %d, dev=%X)\n",
skb_in, type, code, dev);
PRINTK (("icmp_reply (skb_in = %X, type = %d, code = %d, dev=%X)\n",
skb_in, type, code, dev));
/* get some memory for the reply. */
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,
if( ip_compute_csum( (unsigned char *)icmph, len ) )
{
/* Failed checksum! */
PRINTK("ICMP ECHO failed checksum!\n");
PRINTK(("ICMP ECHO failed checksum!\n"));
skb1->sk = NULL;
kfree_skb (skb1, FREE_READ);
return (0);
......@@ -287,7 +288,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
if (offset < 0)
{
/* 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);
skb1->sk = NULL;
kfree_skb (skb1, FREE_READ);
......@@ -317,7 +318,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
return( 0 );
default:
PRINTK("Unsupported ICMP type = x%x\n", icmph->type );
PRINTK(("Unsupported ICMP type = x%x\n", icmph->type ));
skb1->sk = NULL;
kfree_skb (skb1, FREE_READ);
return( 0 ); /* just toss the packet */
......
......@@ -68,10 +68,11 @@
unsigned long ip_addr[MAX_IP_ADDRES]={0,0,0};
#undef IP_DEBUG
#ifdef IP_DEBUG
#define PRINTK printk
#define PRINTK(X) printk X
#else
#define PRINTK dummy_routine
#define PRINTK(X) /**/
#endif
static struct rtable *rt_base=NULL; /* used to base all the routing data. */
......@@ -84,11 +85,11 @@ get_protocol(unsigned char prot)
{
unsigned char hash;
struct ip_protocol *p;
PRINTK ("get_protocol (%d)\n ", prot);
PRINTK (("get_protocol (%d)\n ", prot));
hash = prot & (MAX_IP_PROTOS -1);
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)
return (p);
}
......@@ -207,20 +208,20 @@ loose_route(struct ip_header *iph, struct options *opt)
void
print_rt(struct rtable *rt)
{
PRINTK ("net = %08X router = %08X\n",rt->net, rt->router);
PRINTK ("dev = %X, next = %X\n",rt->dev, rt->next);
PRINTK (("net = %08X router = %08X\n",rt->net, rt->router));
PRINTK (("dev = %X, next = %X\n",rt->dev, rt->next));
}
void
print_ipprot (struct ip_protocol *ipprot)
{
PRINTK ("handler = %X, protocol = %d, copy=%d \n",
ipprot->handler, ipprot->protocol, ipprot->copy);
PRINTK (("handler = %X, protocol = %d, copy=%d \n",
ipprot->handler, ipprot->protocol, ipprot->copy));
}
/* This assumes that address are all in net order. */
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;
/* look through the routing table for some
......@@ -230,6 +231,7 @@ ip_route(struct options *opt, unsigned long daddr , unsigned long *raddr)
/* see if we found one. */
if (ip_addr_match (rt->net, daddr))
{
PRINTK (("IP: %X via %s (%X)\n", daddr, rt->dev->name, rt->router));
*raddr = rt->router;
return (rt->dev);
}
......@@ -243,7 +245,7 @@ add_route (struct rtable *rt)
int mask;
struct rtable *r;
struct rtable *r1;
PRINTK ("add_route (rt=%X):\n",rt);
PRINTK (("add_route (rt=%X):\n",rt));
print_rt(rt);
if (rt_base == NULL)
......@@ -264,7 +266,7 @@ add_route (struct rtable *rt)
break;
}
}
PRINTK ("mask = %X\n",mask);
PRINTK (("mask = %X\n",mask));
r1=rt_base;
for (r=rt_base; r != NULL; r=r->next)
{
......@@ -287,7 +289,7 @@ add_route (struct rtable *rt)
if (!(r->net & mask))
{
PRINTK("adding before r=%X\n",r);
PRINTK (("adding before r=%X\n",r));
print_rt(r);
if (r == rt_base)
{
......@@ -301,7 +303,7 @@ add_route (struct rtable *rt)
}
r1 = r;
}
PRINTK ("adding after r1=%X\n",r1);
PRINTK (("adding after r1=%X\n",r1));
print_rt(r1);
/* goes at the end. */
rt->next = NULL;
......@@ -328,10 +330,10 @@ ip_set_dev (struct ip_config *u_ipc)
/* see if we need to add a broadcast address. */
if (ipc.net != -1)
{
PRINTK (("new broadcast for %s: %08X\n", dev->name, ipc.net));
arp_add_broad (ipc.net, dev);
rt = kmalloc (sizeof (*rt), GFP_KERNEL);
if (rt == NULL) return (-ENOMEM);
rt->net = ipc.net;
rt->dev = dev;
rt->router = 0;
......@@ -341,6 +343,7 @@ ip_set_dev (struct ip_config *u_ipc)
if (ipc.router != -1)
{
PRINTK (("new router for %s: %08X\n", dev->name, ipc.router));
rt = kmalloc (sizeof (*rt),GFP_KERNEL);
if (rt == NULL) return (-ENOMEM);
rt->net = 0;
......@@ -351,18 +354,21 @@ ip_set_dev (struct ip_config *u_ipc)
if (dev->loopback)
{
PRINTK (("new loopback addr: %08X\n", ipc.paddr));
rt = kmalloc (sizeof (*rt), GFP_KERNEL);
if (rt == NULL) return (-ENOMEM);
rt->net = ipc.paddr;
rt->dev = dev;
rt->router = 0;
add_route (rt);
}
if (!my_ip_addr (ipc.paddr))
ip_addr[ip_ads++] = ipc.paddr;
{
PRINTK (("new identity: %08X\n", ipc.paddr));
ip_addr[ip_ads++] = ipc.paddr;
}
dev->up = ipc.up;
if (dev->up)
......@@ -375,8 +381,8 @@ ip_set_dev (struct ip_config *u_ipc)
if (dev->stop)
dev->stop(dev);
}
return (0);
return (0);
}
/* 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,
unsigned long raddr; /* for the router. */
int tmp;
if (saddr == 0) saddr = MY_IP_ADDR;
PRINTK ("ip_build_header (skb=%X, saddr=%X, daddr=%X, *dev=%X,\n"
" type=%d, opt=%X, len = %d)\n",
skb, saddr, daddr, *dev, type, opt, len);
PRINTK (("ip_build_header (skb=%X, saddr=%X, daddr=%X, *dev=%X,\n"
" type=%d, opt=%X, len = %d)\n",
skb, saddr, daddr, *dev, type, opt, len));
buff = (unsigned char *)(skb + 1);
/* see if we need to look up the device. */
if (*dev == NULL)
......@@ -712,12 +718,12 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
iph=skb->h.iph;
PRINTK("<<\n");
PRINTK (("<<\n"));
print_iph(iph);
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;
kfree_skb(skb, 0);
return (0);
......@@ -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. */
if (!my_ip_addr(iph->daddr))
{
PRINTK ("packet meant for someone else.\n");
PRINTK (("packet meant for someone else.\n"));
skb->sk = NULL;
kfree_skb(skb, 0);
return (0);
......@@ -748,7 +754,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
struct sk_buff *skb2;
if (ipprot->protocol != iph->protocol) continue;
PRINTK ("Using protocol = %X:\n", ipprot);
PRINTK (("Using protocol = %X:\n", ipprot));
print_ipprot (ipprot);
/* pass it off to everyone who wants it. */
/* we should check the return values here. */
......@@ -811,7 +817,7 @@ ip_queue_xmit (volatile struct sock *sk, struct device *dev,
skb->free = free;
skb->dev = dev;
skb->when = jiffies;
PRINTK(">>\n");
PRINTK ((">>\n"));
ptr = (unsigned char *)(skb + 1);
ptr += dev->hard_header_len;
iph = (struct ip_header *)ptr;
......@@ -922,13 +928,13 @@ ip_retransmit (volatile struct sock *sk, int all)
void
print_iph (struct ip_header *ip)
{
PRINTK ("ip header:\n");
PRINTK (" ihl = %d, version = %d, tos = %d, tot_len = %d\n",
ip->ihl, ip->version, ip->tos, net16(ip->tot_len));
PRINTK (" id = %x, ttl = %d, prot = %d, check=%x\n",
ip->id, ip->ttl, ip->protocol, ip->check);
PRINTK (" frag_off=%d\n", ip->frag_off);
PRINTK (" saddr = %X, daddr = %X\n",ip->saddr, ip->daddr);
PRINTK (("ip header:\n"));
PRINTK ((" ihl = %d, version = %d, tos = %d, tot_len = %d\n",
ip->ihl, ip->version, ip->tos, net16(ip->tot_len)));
PRINTK ((" id = %x, ttl = %d, prot = %d, check=%x\n",
ip->id, ip->ttl, ip->protocol, ip->check));
PRINTK ((" frag_off=%d\n", ip->frag_off));
PRINTK ((" saddr = %X, daddr = %X\n",ip->saddr, ip->daddr));
}
#if 0
......
......@@ -68,9 +68,9 @@
#endif
#ifdef LOOPBACK_DEBUG
#define PRINTK printk
#define PRINTK(x) printk x
#else
#define PRINTK dummy_routine
#define PRINTK(x) /**/
#endif
static int
......@@ -83,7 +83,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
static unsigned char buff[2048];
unsigned char *tmp;
PRINTK ("loopback_xmit (dev = %X)\n", dev);
PRINTK (("loopback_xmit (dev = %X)\n", dev));
cli();
if (inuse)
{
......@@ -107,7 +107,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
if (done != -1 && (i = dev_tint (buff,dev)) != 0)
{
/* print out the buffer. */
PRINTK ("loopback xmit: \n");
PRINTK (("loopback xmit: \n"));
eth = (struct enet_header *)buff;
print_eth (eth);
tmp = buff;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment