diff options
Diffstat (limited to 'include/linux')
221 files changed, 17523 insertions, 4530 deletions
diff --git a/include/linux/a.out.h b/include/linux/a.out.h index ce141e011..172664afa 100644 --- a/include/linux/a.out.h +++ b/include/linux/a.out.h @@ -5,17 +5,7 @@ #ifndef __STRUCT_EXEC_OVERRIDE__ -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; +#include <asm/a.out.h> #endif /* __STRUCT_EXEC_OVERRIDE__ */ @@ -104,15 +94,15 @@ enum machine_type { #endif #if !defined (N_DRELOFF) -#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize) +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) #endif #if !defined (N_SYMOFF) -#define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize) +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) #endif #if !defined (N_STROFF) -#define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms) +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) #endif /* Address of text segment in memory after it is loaded. */ @@ -139,7 +129,13 @@ enum machine_type { #ifdef linux #include <asm/page.h> +#if defined(__i386__) || defined(__mc68000__) #define SEGMENT_SIZE 1024 +#else +#ifndef SEGMENT_SIZE +#define SEGMENT_SIZE PAGE_SIZE +#endif +#endif #endif #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) diff --git a/include/linux/acct.h b/include/linux/acct.h new file mode 100644 index 000000000..99fe14917 --- /dev/null +++ b/include/linux/acct.h @@ -0,0 +1,29 @@ +#ifndef __LINUX_ACCT_H +#define __LINUX_ACCT_H + +#define ACCT_COMM 16 + +struct acct +{ + char ac_comm[ACCT_COMM]; /* Accounting command name */ + time_t ac_utime; /* Accounting user time */ + time_t ac_stime; /* Accounting system time */ + time_t ac_etime; /* Accounting elapsed time */ + time_t ac_btime; /* Beginning time */ + uid_t ac_uid; /* Accounting user ID */ + gid_t ac_gid; /* Accounting group ID */ + dev_t ac_tty; /* controlling tty */ + char ac_flag; /* Accounting flag */ + long ac_minflt; /* Accounting minor pagefaults */ + long ac_majflt; /* Accounting major pagefaults */ + long ac_exitcode; /* Accounting process exitcode */ +}; + +#define AFORK 0001 /* has executed fork, but no exec */ +#define ASU 0002 /* used super-user privileges */ +#define ACORE 0004 /* dumped core */ +#define AXSIG 0010 /* killed by a signal */ + +#define AHZ 100 + +#endif diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h new file mode 100644 index 000000000..0067552fc --- /dev/null +++ b/include/linux/affs_fs.h @@ -0,0 +1,112 @@ +#ifndef _AFFS_FS_H +#define _AFFS_FS_H +/* + * The affs filesystem constants/structures + */ + +#include <linux/types.h> + +#define AFFS_SUPER_MAGIC 0xadff + +/* Get the filesystem block size given an inode. */ +#define AFFS_I2BSIZE(inode) ((inode)->i_sb->s_blocksize) + +/* Get the filesystem hash table size given an inode. */ +#define AFFS_I2HSIZE(inode) ((inode)->i_sb->u.affs_sb.s_hashsize) + +/* Get the block number bits given an inode */ +#define AFFS_I2BITS(inode) ((inode)->i_sb->s_blocksize_bits) + +/* Get the fs type given an inode */ +#define AFFS_I2FSTYPE(inode) ((inode)->i_sb->u.affs_sb.s_flags & SF_INTL) + +struct DateStamp +{ + __u32 ds_Days; + __u32 ds_Minute; + __u32 ds_Tick; +}; + + +/* --- Prototypes ----------------------------------------------------------------------------- */ + +/* amigaffs.c */ + +extern int affs_get_key_entry(int bsize, void *data, int entry_pos); +extern int affs_find_next_hash_entry(int bsize, void *dir_data, int *hash_pos); +extern int affs_get_file_name(int bsize, void *fh_data, char **name); +extern unsigned int affs_checksum_block(int bsize, void *data, int *ptype, int *stype); +extern void affs_fix_checksum(int bsize, void *data, int cspos); +extern void secs_to_datestamp(int secs, struct DateStamp *ds); +extern int prot_to_mode(unsigned int prot); +extern unsigned int mode_to_prot(int mode); +extern int affs_fix_hash_pred(struct inode *startino, int startoffset, + int key, int newkey); +extern int affs_fix_link_pred(struct inode *startino, int key, int newkey); + +/* bitmap. c */ + +extern int affs_count_free_blocks(struct super_block *s); +extern int affs_count_free_bits(int blocksize, const char *data); +extern void affs_free_block(struct super_block *sb, int block); +extern int affs_new_header(struct inode *inode); +extern int affs_new_data(struct inode *inode); +extern void affs_make_zones(struct super_block *sb); + +/* namei.c */ + +extern int affs_hash_name(const char *name, int len, int intl, int hashsize); +extern int affs_lookup(struct inode *dir,const char *name, int len, + struct inode **result); +extern int affs_unlink(struct inode *dir, const char *name, int len); +extern int affs_create(struct inode *dir, const char *name, int len, int mode, + struct inode **result); +extern int affs_mkdir(struct inode *dir, const char *name, int len, int mode); +extern int affs_rmdir(struct inode *dir, const char *name, int len); +extern int affs_link(struct inode *oldinode, struct inode *dir, + const char *name, int len); +extern int affs_symlink(struct inode *dir, const char *name, int len, + const char *symname); +extern int affs_fixup(struct buffer_head *bh, struct inode *inode); +extern int affs_rename(struct inode *old_dir, const char *old_name, int old_len, + struct inode *new_dir, const char *new_name, int new_len, + int must_be_dir); + +/* inode.c */ + +extern struct buffer_head *affs_bread(kdev_t dev, int block, int size); +extern void affs_brelse(struct buffer_head *buf); +extern void affs_put_super(struct super_block *); +extern int affs_parent_ino(struct inode *dir); +extern struct super_block *affs_read_super(struct super_block *,void *, int); +extern void affs_statfs(struct super_block *, struct statfs *, int bufsiz); +extern void affs_read_inode(struct inode *); +extern void affs_write_inode(struct inode *); +extern int affs_notify_change(struct inode *inode, struct iattr *attr); +extern void affs_put_inode(struct inode *); +extern struct inode *affs_new_inode(const struct inode *dir); +extern int affs_add_entry(struct inode *dir, struct inode *link, struct inode *inode, + const char *name, int len, int type); + +/* file.c */ + +extern int affs_bmap(struct inode *inode, int block); +extern struct buffer_head *affs_getblock(struct inode *inode, int block); +extern void affs_truncate(struct inode *); +extern void affs_truncate_ofs(struct inode *); + +/* dir.c */ + +extern void affs_dir_truncate(struct inode *); + +/* jump tables */ + +extern struct inode_operations affs_file_inode_operations; +extern struct inode_operations affs_file_inode_operations_ofs; +extern struct inode_operations affs_dir_inode_operations; +extern struct inode_operations affs_symlink_inode_operations; +extern struct inode_operations affs_chrdev_inode_operations; +extern struct inode_operations affs_blkdev_inode_operations; + +extern int init_affs_fs(void); +#endif diff --git a/include/linux/affs_fs_i.h b/include/linux/affs_fs_i.h new file mode 100644 index 000000000..40b823909 --- /dev/null +++ b/include/linux/affs_fs_i.h @@ -0,0 +1,47 @@ +#ifndef _AFFS_FS_I +#define _AFFS_FS_I + +#include <linux/a.out.h> +#include <linux/time.h> + +#define AFFS_MAX_PREALLOC 16 /* MUST be a power of 2 */ +#define AFFS_KCSIZE 73 /* Allows for 1 extension block at 512 byte-blocks */ + +struct key_cache { + struct timeval kc_lru_time; /* Last time this cache was used */ + int kc_first; /* First cached key */ + int kc_last; /* Last cached key */ + int kc_this_key; /* Key of extension block this data block keys are from */ + int kc_this_seq; /* Sequence number of this extension block */ + int kc_next_key; /* Key of next extension block */ + int kc_keys[AFFS_KCSIZE]; /* Key cache */ +}; + +#define EC_SIZE (PAGE_SIZE - 4 * sizeof(struct key_cache) - 4) / 4 + +struct ext_cache { + struct key_cache kc[4]; /* The 4 key caches */ + __s32 ec[EC_SIZE]; /* Keys of assorted extension blocks */ + int max_ext; /* Index of last known extension block */ +}; + +/* + * affs fs inode data in memory + */ +struct affs_inode_info { + __u32 i_protect; /* unused attribute bits */ + __s32 i_parent; /* parent ino */ + __s32 i_original; /* if != 0, this is the key of the original */ + __s32 i_data[AFFS_MAX_PREALLOC]; /* preallocated blocks */ + struct ext_cache *i_ec; /* Cache gets allocated dynamically */ + int i_cache_users; /* Cache cannot be freed while > 0 */ + int i_lastblock; /* last allocated block */ + short i_pa_cnt; /* number of preallocated blocks */ + short i_pa_next; /* Index of next block in i_data[] */ + short i_pa_last; /* Index of next free slot in i_data[] */ + short i_zone; /* write zone */ + unsigned char i_hlink; /* This is a fake */ + unsigned char i_pad; +}; + +#endif diff --git a/include/linux/affs_fs_sb.h b/include/linux/affs_fs_sb.h new file mode 100644 index 000000000..0ff862d13 --- /dev/null +++ b/include/linux/affs_fs_sb.h @@ -0,0 +1,72 @@ +#ifndef _AFFS_FS_SB +#define _AFFS_FS_SB + +/* + * super-block data in memory + * + * Block numbers are adjusted for their actual size + * + */ + +#define MAX_ZONES 8 +#define AFFS_DATA_MIN_FREE 512 /* Number of free blocks in zone for data blocks */ +#define AFFS_HDR_MIN_FREE 128 /* Same for header blocks */ +#define AFFS_ZONE_SIZE 1024 /* Blocks per alloc zone, must be multiple of 32 */ + +struct affs_bm_info { + struct buffer_head *bm_bh; /* Buffer head if loaded (bm_count > 0) */ + int bm_firstblk; /* Block number of first bit in this map */ + int bm_key; /* Disk block number */ + int bm_count; /* Usage counter */ +}; + +struct affs_alloc_zone { + short az_size; /* Size of this allocation zone in double words */ + short az_count; /* Number of users */ + int az_free; /* Free blocks in here (no. of bits) */ +}; + +struct affs_zone { + unsigned long z_ino; /* Associated inode number */ + struct affs_bm_info *z_bm; /* Zone lies in this bitmap */ + int z_start; /* Index of first word in bitmap */ + int z_end; /* Index of last word in zone + 1 */ + int z_az_no; /* Zone number */ + unsigned long z_lru_time; /* Time of last usage */ +}; + +struct affs_sb_info { + int s_partition_size; /* Partition size in blocks. */ + int s_root_block; /* FFS root block number. */ + int s_hashsize; /* Size of hash table. */ + unsigned long s_flags; /* See below. */ + short s_uid; /* uid to override */ + short s_gid; /* gid to override */ + umode_t s_mode; /* mode to override */ + int s_reserved; /* Number of reserved blocks. */ + struct buffer_head *s_root_bh; /* Cached root block. */ + struct affs_bm_info *s_bitmap; /* Bitmap infos. */ + int s_bm_count; /* Number of bitmap blocks. */ + int s_nextzone; /* Next zone to look for free blocks. */ + int s_num_az; /* Total number of alloc zones. */ + struct affs_zone *s_zones; /* The zones themselves. */ + struct affs_alloc_zone *s_alloc;/* The allocation zones. */ + char *s_zonemap; /* Bitmap for allocation zones. */ + char *s_prefix; /* Prefix for volumes and assigns. */ + int s_prefix_len; /* Length of prefix. */ + char s_volume[32]; /* Volume prefix for absolute symlinks. */ +}; + +#define SF_INTL 0x0001 /* International filesystem. */ +#define SF_BM_VALID 0x0002 /* Bitmap is valid. */ +#define SF_IMMUTABLE 0x0004 /* Protection bits cannot be changed */ +#define SF_QUIET 0x0008 /* chmod errors will be not reported */ +#define SF_SETUID 0x0010 /* Ignore Amiga uid */ +#define SF_SETGID 0x0020 /* Ignore Amiga gid */ +#define SF_SETMODE 0x0040 /* Ignore Amiga protection bits */ +#define SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */ +#define SF_OFS 0x0200 /* Old filesystem */ +#define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */ +#define SF_VERBOSE 0x0800 /* Talk about fs when mounting */ + +#endif diff --git a/include/linux/affs_hardblocks.h b/include/linux/affs_hardblocks.h new file mode 100644 index 000000000..33315488d --- /dev/null +++ b/include/linux/affs_hardblocks.h @@ -0,0 +1,66 @@ +#ifndef AFFS_HARDBLOCKS_H +#define AFFS_HARDBLOCKS_H + +/* Just the needed definitions for the RDB of an Amiga HD. */ + +struct RigidDiskBlock { + __u32 rdb_ID; + __u32 rdb_SummedLongs; + __s32 rdb_ChkSum; + __u32 rdb_HostID; + __u32 rdb_BlockBytes; + __u32 rdb_Flags; + __u32 rdb_BadBlockList; + __u32 rdb_PartitionList; + __u32 rdb_FileSysHeaderList; + __u32 rdb_DriveInit; + __u32 rdb_Reserved1[6]; + __u32 rdb_Cylinders; + __u32 rdb_Sectors; + __u32 rdb_Heads; + __u32 rdb_Interleave; + __u32 rdb_Park; + __u32 rdb_Reserved2[3]; + __u32 rdb_WritePreComp; + __u32 rdb_ReducedWrite; + __u32 rdb_StepRate; + __u32 rdb_Reserved3[5]; + __u32 rdb_RDBBlocksLo; + __u32 rdb_RDBBlocksHi; + __u32 rdb_LoCylinder; + __u32 rdb_HiCylinder; + __u32 rdb_CylBlocks; + __u32 rdb_AutoParkSeconds; + __u32 rdb_HighRDSKBlock; + __u32 rdb_Reserved4; + char rdb_DiskVendor[8]; + char rdb_DiskProduct[16]; + char rdb_DiskRevision[4]; + char rdb_ControllerVendor[8]; + char rdb_ControllerProduct[16]; + char rdb_ControllerRevision[4]; + __u32 rdb_Reserved5[10]; +}; + +#define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */ + +struct PartitionBlock { + __u32 pb_ID; + __u32 pb_SummedLongs; + __s32 pb_ChkSum; + __u32 pb_HostID; + __u32 pb_Next; + __u32 pb_Flags; + __u32 pb_Reserved1[2]; + __u32 pb_DevFlags; + __u8 pb_DriveName[32]; + __u32 pb_Reserved2[15]; + __u32 pb_Environment[17]; + __u32 pb_EReserved[15]; +}; + +#define IDNAME_PARTITION 0x50415254 /* "PART" */ + +#define RDB_ALLOCATION_LIMIT 16 + +#endif /* AFFS_HARDBLOCKS_H */ diff --git a/include/linux/amigaffs.h b/include/linux/amigaffs.h new file mode 100644 index 000000000..679f333e5 --- /dev/null +++ b/include/linux/amigaffs.h @@ -0,0 +1,219 @@ +#ifndef AMIGAFFS_H +#define AMIGAFFS_H + +#include <asm/byteorder.h> +#include <linux/types.h> + +/* Ugly macros make the code more pretty. */ + +#define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st)))) +#define AFFS_GET_HASHENTRY(data,hashkey) htonl(((struct dir_front *)data)->hashtable[hashkey]) +#define AFFS_BLOCK(data,ino,blk) ((struct file_front *)data)->blocks[AFFS_I2HSIZE(ino)-1-(blk)] + +#define FILE_END(p,i) GET_END_PTR(struct file_end,p,AFFS_I2BSIZE(i)) +#define ROOT_END(p,i) GET_END_PTR(struct root_end,p,AFFS_I2BSIZE(i)) +#define DIR_END(p,i) GET_END_PTR(struct dir_end,p,AFFS_I2BSIZE(i)) +#define LINK_END(p,i) GET_END_PTR(struct hlink_end,p,AFFS_I2BSIZE(i)) +#define ROOT_END_S(p,s) GET_END_PTR(struct root_end,p,(s)->s_blocksize) +#define DATA_FRONT(bh) ((struct data_front *)(bh)->b_data) + +/* Only for easier debugging if need be */ +#define affs_bread bread +#define affs_brelse brelse + +#ifdef __LITTLE_ENDIAN +#define BO_EXBITS 0x18UL +#elif defined(__BIG_ENDIAN) +#define BO_EXBITS 0x00UL +#else +#error Endianness must be known for affs to work. +#endif + +#define FS_OFS 0x444F5300 +#define FS_FFS 0x444F5301 +#define FS_INTLOFS 0x444F5302 +#define FS_INTLFFS 0x444F5303 +#define FS_DCOFS 0x444F5304 +#define FS_DCFFS 0x444F5305 +#define MUFS_FS 0x6d754653 /* 'muFS' */ +#define MUFS_OFS 0x6d754600 /* 'muF\0' */ +#define MUFS_FFS 0x6d754601 /* 'muF\1' */ +#define MUFS_INTLOFS 0x6d754602 /* 'muF\2' */ +#define MUFS_INTLFFS 0x6d754603 /* 'muF\3' */ +#define MUFS_DCOFS 0x6d754604 /* 'muF\4' */ +#define MUFS_DCFFS 0x6d754605 /* 'muF\5' */ + +#define T_SHORT 2 +#define T_LIST 16 +#define T_DATA 8 + +#define ST_LINKFILE -4 +#define ST_FILE -3 +#define ST_ROOT 1 +#define ST_USERDIR 2 +#define ST_SOFTLINK 3 +#define ST_LINKDIR 4 + +struct root_front +{ + __s32 primary_type; + __s32 spare1[2]; + __s32 hash_size; + __s32 spare2; + __u32 checksum; + __s32 hashtable[0]; +}; + +struct root_end +{ + __s32 bm_flag; + __s32 bm_keys[25]; + __s32 bm_extend; + struct DateStamp dir_altered; + __u8 disk_name[40]; + struct DateStamp disk_altered; + struct DateStamp disk_made; + __s32 spare1[3]; + __s32 secondary_type; +}; + +struct dir_front +{ + __s32 primary_type; + __s32 own_key; + __s32 spare1[3]; + __u32 checksum; + __s32 hashtable[0]; +}; + +struct dir_end +{ + __s32 spare1; + __s16 owner_uid; + __s16 owner_gid; + __u32 protect; + __s32 spare2; + __u8 comment[92]; + struct DateStamp created; + __u8 dir_name[32]; + __s32 spare3[2]; + __s32 link_chain; + __s32 spare4[5]; + __s32 hash_chain; + __s32 parent; + __s32 spare5; + __s32 secondary_type; +}; + +struct file_front +{ + __s32 primary_type; + __s32 own_key; + __s32 block_count; + __s32 unknown1; + __s32 first_data; + __u32 checksum; + __s32 blocks[0]; +}; + +struct file_end +{ + __s32 spare1; + __s16 owner_uid; + __s16 owner_gid; + __u32 protect; + __s32 byte_size; + __u8 comment[92]; + struct DateStamp created; + __u8 file_name[32]; + __s32 spare2; + __s32 original; /* not really in file_end */ + __s32 link_chain; + __s32 spare3[5]; + __s32 hash_chain; + __s32 parent; + __s32 extension; + __s32 secondary_type; +}; + +struct hlink_front +{ + __s32 primary_type; + __s32 own_key; + __s32 spare1[3]; + __u32 checksum; +}; + +struct hlink_end +{ + __s32 spare1; + __s16 owner_uid; + __s16 owner_gid; + __u32 protect; + __u8 comment[92]; + struct DateStamp created; + __u8 link_name[32]; + __s32 spare2; + __s32 original; + __s32 link_chain; + __s32 spare3[5]; + __s32 hash_chain; + __s32 parent; + __s32 spare4; + __s32 secondary_type; +}; + +struct slink_front +{ + __s32 primary_type; + __s32 own_key; + __s32 spare1[3]; + __s32 checksum; + __u8 symname[288]; /* depends on block size */ +}; + +struct data_front +{ + __s32 primary_type; + __s32 header_key; + __s32 sequence_number; + __s32 data_size; + __s32 next_data; + __s32 checksum; + __u8 data[488]; /* depends on block size */ +}; + +/* Permission bits */ + +#define FIBF_OTR_READ 0x8000 +#define FIBF_OTR_WRITE 0x4000 +#define FIBF_OTR_EXECUTE 0x2000 +#define FIBF_OTR_DELETE 0x1000 +#define FIBF_GRP_READ 0x0800 +#define FIBF_GRP_WRITE 0x0400 +#define FIBF_GRP_EXECUTE 0x0200 +#define FIBF_GRP_DELETE 0x0100 + +#define FIBF_SCRIPT 0x0040 +#define FIBF_PURE 0x0020 /* no use under linux */ +#define FIBF_ARCHIVE 0x0010 /* never set, always cleared on write */ +#define FIBF_READ 0x0008 /* 0 means allowed */ +#define FIBF_WRITE 0x0004 /* 0 means allowed */ +#define FIBF_EXECUTE 0x0002 /* 0 means allowed, ignored under linux */ +#define FIBF_DELETE 0x0001 /* 0 means allowed */ + +#define FIBF_OWNER 0x000F /* Bits pertaining to owner */ + +#define AFFS_UMAYWRITE(prot) (((prot) & (FIBF_WRITE|FIBF_DELETE)) == (FIBF_WRITE|FIBF_DELETE)) +#define AFFS_UMAYREAD(prot) ((prot) & FIBF_READ) +#define AFFS_UMAYEXECUTE(prot) (((prot) & (FIBF_SCRIPT|FIBF_READ)) == (FIBF_SCRIPT|FIBF_READ)) +#define AFFS_GMAYWRITE(prot) (((prot)&(FIBF_GRP_WRITE|FIBF_GRP_DELETE))==\ + (FIBF_GRP_WRITE|FIBF_GRP_DELETE)) +#define AFFS_GMAYREAD(prot) ((prot) & FIBF_GRP_READ) +#define AFFS_GMAYEXECUTE(prot) (((prot)&(FIBF_SCRIPT|FIBF_GRP_READ))==(FIBF_SCRIPT|FIBF_GRP_READ)) +#define AFFS_OMAYWRITE(prot) (((prot)&(FIBF_OTR_WRITE|FIBF_OTR_DELETE))==\ + (FIBF_OTR_WRITE|FIBF_OTR_DELETE)) +#define AFFS_OMAYREAD(prot) ((prot) & FIBF_OTR_READ) +#define AFFS_OMAYEXECUTE(prot) (((prot)&(FIBF_SCRIPT|FIBF_OTR_READ))==(FIBF_SCRIPT|FIBF_OTR_READ)) + +#endif diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h new file mode 100644 index 000000000..326445110 --- /dev/null +++ b/include/linux/apm_bios.h @@ -0,0 +1,141 @@ +#ifndef _LINUX_APM_H +#define _LINUX_APM_H + +/* + * Include file for the interface to an APM BIOS + * Copyright 1994, 1995 Stephen Rothwell (Stephen.Rothwell@pd.necisa.oz.au) + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * $Id: apm_bios.h,v 0.9 1995/03/09 13:50:05 sfr Exp $ + */ + +typedef unsigned short apm_event_t; + +#ifdef __KERNEL__ + +#include <linux/tasks.h> /* for NR_TASKS */ +#include <linux/sched.h> /* for _TSS */ + +#define APM_CS _TSS(NR_TASKS) +#define APM_CS_16 (APM_CS + 8) +#define APM_DS (APM_CS_16 + 8) + +struct apm_bios_info { + unsigned short version; + unsigned short cseg; + unsigned long offset; + unsigned short cseg_16; + unsigned short dseg; + unsigned short flags; + unsigned short cseg_len; + unsigned short dseg_len; +}; + + /* Results of APM Installation Check */ +#define APM_16_BIT_SUPPORT 0x0001 +#define APM_32_BIT_SUPPORT 0x0002 +#define APM_IDLE_SLOWS_CLOCK 0x0004 +#define APM_BIOS_DISABLED 0x0008 +#define APM_BIOS_DISENGAGED 0x0010 + +/* + * Maximum number of events stored + */ +#define APM_MAX_EVENTS 20 + +/* + * The per-file APM data + */ +struct apm_bios_struct { + int magic; + struct apm_bios_struct * next; + int suser; + int suspends_pending; + int standbys_pending; + int suspends_read; + int standbys_read; + int event_head; + int event_tail; + apm_event_t events[APM_MAX_EVENTS]; +}; + +/* + * The magic number in apm_bios_struct + */ +#define APM_BIOS_MAGIC 0x4101 + +/* + * in init/main.c + */ +extern struct apm_bios_info apm_bios_info; + +extern void apm_bios_init(void); + +extern int apm_register_callback(int (*callback)(apm_event_t)); +extern void apm_unregister_callback(int (*callback)(apm_event_t)); + +extern int apm_set_power_state(ushort state); +extern int apm_display_blank(void); +extern int apm_display_unblank(void); + +#endif /* __KERNEL__ */ + +/* + * Power states + */ +#define APM_STATE_READY 0x0000 +#define APM_STATE_STANDBY 0x0001 +#define APM_STATE_SUSPEND 0x0002 +#define APM_STATE_OFF 0x0003 +#define APM_STATE_BUSY 0x0004 +#define APM_STATE_REJECT 0x0005 + +/* + * Events (results of Get PM Event) + */ +#define APM_SYS_STANDBY 0x0001 +#define APM_SYS_SUSPEND 0x0002 +#define APM_NORMAL_RESUME 0x0003 +#define APM_CRITICAL_RESUME 0x0004 +#define APM_LOW_BATTERY 0x0005 +#define APM_POWER_STATUS_CHANGE 0x0006 +#define APM_UPDATE_TIME 0x0007 +#define APM_CRITICAL_SUSPEND 0x0008 +#define APM_USER_STANDBY 0x0009 +#define APM_USER_SUSPEND 0x000a +#define APM_STANDBY_RESUME 0x000b + +/* + * Error codes + */ +#define APM_SUCCESS 0x00 +#define APM_DISABLED 0x01 +#define APM_CONNECTED 0x02 +#define APM_NOT_CONNECTED 0x03 +#define APM_16_CONNECTED 0x05 +#define APM_16_UNSUPPORTED 0x06 +#define APM_32_CONNECTED 0x07 +#define APM_32_UNSUPPORTED 0x08 +#define APM_BAD_DEVICE 0x09 +#define APM_BAD_PARAM 0x0a +#define APM_NOT_ENGAGED 0x0b +#define APM_BAD_STATE 0x60 +#define APM_NO_EVENTS 0x80 +#define APM_NOT_PRESENT 0x86 + +/* ioctl operations */ +#include <linux/ioctl.h> + +#define APM_IOC_STANDBY _IO('A', 1) +#define APM_IOC_SUSPEND _IO('A', 2) + +#endif /* LINUX_APM_H */ diff --git a/include/linux/atalk.h b/include/linux/atalk.h new file mode 100644 index 000000000..9035ddbd8 --- /dev/null +++ b/include/linux/atalk.h @@ -0,0 +1,148 @@ +/* + * Appletalk networking structures + * + * The following are directly referenced from the University Of Michigan + * netatalk for compatibility reasons. + */ + +#ifndef __LINUX_ATALK_H__ +#define __LINUX_ATALK_H__ + +#define ATPORT_FIRST 1 +#define ATPORT_RESERVED 128 +#define ATPORT_LAST 255 +#define ATADDR_ANYNET (__u16)0 +#define ATADDR_ANYNODE (__u8)0 +#define ATADDR_ANYPORT (__u8)0 +#define ATADDR_BCAST (__u8)255 +#define DDP_MAXSZ 587 + +struct at_addr +{ + __u16 s_net; + __u8 s_node; +}; + +struct sockaddr_at +{ + sa_family_t sat_family; + __u8 sat_port; + struct at_addr sat_addr; + char sat_zero[ 8 ]; +}; + +struct netrange +{ + __u8 nr_phase; + __u16 nr_firstnet; + __u16 nr_lastnet; +}; + +struct atalk_route +{ + struct device *dev; + struct at_addr target; + struct at_addr gateway; + int flags; + struct atalk_route *next; +}; + +struct atalk_iface +{ + struct device *dev; + struct at_addr address; /* Our address */ + int status; /* What are we doing ?? */ +#define ATIF_PROBE 1 /* Probing for an address */ +#define ATIF_PROBE_FAIL 2 /* Probe collided */ + struct netrange nets; /* Associated direct netrange */ + struct atalk_iface *next; +}; + +struct atalk_sock +{ + unsigned short dest_net; + unsigned short src_net; + unsigned char dest_node; + unsigned char src_node; + unsigned char dest_port; + unsigned char src_port; +}; + +#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ + +#ifdef __KERNEL__ + +struct ddpehdr +{ + /* FIXME for bigendians */ + /*__u16 deh_pad:2,deh_hops:4,deh_len:10;*/ + __u16 deh_len:10,deh_hops:4,deh_pad:2; + __u16 deh_sum; + __u16 deh_dnet; + __u16 deh_snet; + __u8 deh_dnode; + __u8 deh_snode; + __u8 deh_dport; + __u8 deh_sport; + /* And netatalk apps expect to stick the type in themselves */ +}; + +/* + * Unused (and currently unsupported) + */ + +struct ddpshdr +{ + /* FIXME for bigendians */ + __u16 dsh_len:10, dsh_pad:6; + __u8 dsh_dport; + __u8 dsh_sport; + /* And netatalk apps expect to stick the type in themselves */ +}; + +/* Appletalk AARP headers */ + +struct elapaarp +{ + __u16 hw_type; +#define AARP_HW_TYPE_ETHERNET 1 +#define AARP_HW_TYPE_TOKENRING 2 + __u16 pa_type; + __u8 hw_len; + __u8 pa_len; +#define AARP_PA_ALEN 4 + __u16 function; +#define AARP_REQUEST 1 +#define AARP_REPLY 2 +#define AARP_PROBE 3 + __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); + __u8 pa_src_zero __attribute__ ((packed)); + __u16 pa_src_net __attribute__ ((packed)); + __u8 pa_src_node __attribute__ ((packed)); + __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); + __u8 pa_dst_zero __attribute__ ((packed)); + __u16 pa_dst_net __attribute__ ((packed)); + __u8 pa_dst_node __attribute__ ((packed)); +}; + +typedef struct sock atalk_socket; + +#define AARP_EXPIRY_TIME (5*60*HZ) /* Not specified - how long till we drop a resolved entry */ +#define AARP_HASH_SIZE 16 /* Size of hash table */ +#define AARP_TICK_TIME (HZ/5) /* Fast retransmission timer when resolving */ +#define AARP_RETRANSMIT_LIMIT 10 /* Send 10 requests then give up (2 seconds) */ +#define AARP_RESOLVE_TIME (10*HZ) /* Some value bigger than total retransmit time + a bit for last reply to appear and to stop continual requests */ + +extern struct datalink_proto *ddp_dl, *aarp_dl; +extern void aarp_proto_init(void); +/* Inter module exports */ +extern struct atalk_iface *atalk_find_dev(struct device *dev); +extern struct at_addr *atalk_find_dev_addr(struct device *dev); +extern int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr); +extern void aarp_send_probe(struct device *dev, struct at_addr *addr); +#ifdef MODULE +extern void aarp_cleanup_module(void); +#endif + +#endif +#endif diff --git a/include/linux/ax25.h b/include/linux/ax25.h index f6bce2787..7cf2c6410 100644 --- a/include/linux/ax25.h +++ b/include/linux/ax25.h @@ -1,16 +1,47 @@ +/* + * These are the public elements of the Linux kernel AX.25 code. A similar + * file netrom.h exists for the NET/ROM protocol. + */ + +#ifndef AX25_KERNEL_H +#define AX25_KERNEL_H + #define PF_AX25 AF_AX25 #define AX25_MTU 256 -#define AX25_MAX_DIGIS 8 +#define AX25_MAX_DIGIS 6 /* This is wrong, should be 8 */ -typedef struct -{ +#define AX25_WINDOW 1 +#define AX25_T1 2 +#define AX25_N2 3 +#define AX25_T3 4 +#define AX25_T2 5 +#define AX25_BACKOFF 6 +#define AX25_EXTSEQ 7 +#define AX25_HDRINCL 8 +#define AX25_IDLE 9 +#define AX25_PACLEN 10 +#define AX25_MAXQUEUE 11 + +#define AX25_KILL 99 + +#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0) +#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) +#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) +#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) +#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+4) +#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+5) + +#define AX25_SET_RT_IPMODE 2 + +#define AX25_NOUID_DEFAULT 0 +#define AX25_NOUID_BLOCK 1 + +typedef struct { char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */ -} -ax25_address; +} ax25_address; -struct sockaddr_ax25 -{ - short sax25_family; +struct sockaddr_ax25 { + sa_family_t sax25_family; ax25_address sax25_call; int sax25_ndigis; /* Digipeater ax25_address sets follow */ @@ -18,22 +49,31 @@ struct sockaddr_ax25 #define sax25_uid sax25_ndigis -struct full_sockaddr_ax25 -{ +struct full_sockaddr_ax25 { struct sockaddr_ax25 fsa_ax25; ax25_address fsa_digipeater[AX25_MAX_DIGIS]; }; -#define AX25_WINDOW 1 -#define AX25_T1 2 -#define AX25_N2 3 -#define AX25_T3 4 -#define AX25_T2 5 +struct ax25_routes_struct { + ax25_address port_addr; + ax25_address dest_addr; + unsigned char digi_count; + ax25_address digi_addr[AX25_MAX_DIGIS]; +}; -#define SIOCAX25GETUID (SIOCPROTOPRIVATE) -#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1) -#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2) -#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3) +struct ax25_route_opt_struct { + ax25_address port_addr; + ax25_address dest_addr; + int cmd; + int arg; +}; -#define AX25_NOUID_DEFAULT 0 -#define AX25_NOUID_BLOCK 1 +struct ax25_ctl_struct { + ax25_address port_addr; + ax25_address source_addr; + ax25_address dest_addr; + unsigned int cmd; + unsigned long arg; +}; + +#endif diff --git a/include/linux/aztcd.h b/include/linux/aztcd.h index b85f37ee8..71fe5a0df 100644 --- a/include/linux/aztcd.h +++ b/include/linux/aztcd.h @@ -1,4 +1,5 @@ -/* $Id: aztcd.h,v 1.0 1995/03/25 08:27:19 root Exp $ +/* $Id: aztcd.h,v 2.50 1996/05/17 16:15:43 root Exp root $ + * * Definitions for a AztechCD268 CD-ROM interface * Copyright (C) 1994, 1995 Werner Zimmermann * @@ -22,14 +23,41 @@ * October 1994 Email: zimmerma@rz.fht-esslingen.de */ -/* *** change this to set the I/O port address */ +/* *** change this to set the I/O port address of your CD-ROM drive*/ #define AZT_BASE_ADDR 0x320 -/* Comment this out to prevent tray from locking */ +/* Uncomment this, if your CDROM is connected to a Soundwave32-soundcard + and configure AZT_BASE_ADDR and AZT_SW32_BASE_ADDR */ +/*#define AZT_SW32 1 +*/ + +#ifdef AZT_SW32 +#define AZT_SW32_BASE_ADDR 0x220 /*I/O port base address of your soundcard*/ +#endif + +/* Set this to 1, if you want your tray to be locked, set to 0 to prevent tray + from locking */ #define AZT_ALLOW_TRAY_LOCK 1 -/* use incompatible ioctls for reading in raw and cooked mode */ -#define AZT_PRIVATE_IOCTLS +/*Set this to 1 to allow auto-eject when unmounting a disk, set to 0, if you + don't want the auto-eject feature*/ +#define AZT_AUTO_EJECT 0 + +/*Set this to 1, if you want to use incompatible ioctls for reading in raw and + cooked mode */ +#define AZT_PRIVATE_IOCTLS 1 + +/*Set this to 1, if you want multisession support by the ISO fs. Even if you set + this value to '0' you can use multisession CDs. In that case the drive's firm- + ware will do the appropriate redirection automatically. The CD will then look + like a single session CD (but nevertheless all data may be read). Please read + chapter '5.1 Multisession support' in README.aztcd for details. Normally it's + uncritical to leave this setting untouched */ +#define AZT_MULTISESSION 1 + +/*---------------------------------------------------------------------------*/ +/*-----nothing to be configured for normal applications below this line------*/ + /* Increase this if you get lots of timeouts; if you get kernel panic, replace STEN_LOW_WAIT by STEN_LOW in the source code */ @@ -45,12 +73,18 @@ #define DATA_PORT azt_port #define STATUS_PORT azt_port+1 #define MODE_PORT azt_port+2 +#ifdef AZT_SW32 + #define AZT_SW32_INIT (unsigned int) (0xFF00 & (AZT_BASE_ADDR*16)) + #define AZT_SW32_CONFIG_REG AZT_SW32_BASE_ADDR+0x16 /*Soundwave32 Config. Register*/ + #define AZT_SW32_ID_REG AZT_SW32_BASE_ADDR+0x04 /*Soundwave32 ID Version Register*/ +#endif /* status bits */ -#define AST_CMD_CHECK 0x80 /* command error */ -#define AST_DSK_CHG 0x20 /* disk removed or changed */ -#define AST_NOT_READY 0x02 /* no disk in the drive */ -#define AST_DOOR_OPEN 0x40 /* door is open */ +#define AST_CMD_CHECK 0x80 /* 1 = command error */ +#define AST_DOOR_OPEN 0x40 /* 1 = door is open */ +#define AST_NOT_READY 0x20 /* 1 = no disk in the drive */ +#define AST_DSK_CHG 0x02 /* 1 = disk removed or changed */ +#define AST_MODE 0x01 /* 0=MODE1, 1=MODE2 */ #define AST_MODE_BITS 0x1C /* Mode Bits */ #define AST_INITIAL 0x0C /* initial, only valid ... */ #define AST_BUSY 0x04 /* now playing, only valid @@ -68,7 +102,8 @@ /* commands */ #define ACMD_SOFT_RESET 0x10 /* reset drive */ #define ACMD_PLAY_READ 0x20 /* read data track in cooked mode */ -#define ACMD_DATA_READ_RAW 0x21 /* reading in raw mode*/ +#define ACMD_PLAY_READ_RAW 0x21 /* reading in raw mode*/ +#define ACMD_SEEK 0x30 /* seek msf address*/ #define ACMD_SEEK_TO_LEADIN 0x31 /* seek to leadin track*/ #define ACMD_GET_ERROR 0x40 /* get error code */ #define ACMD_GET_STATUS 0x41 /* get status */ @@ -82,14 +117,7 @@ #define ACMD_PLAY_AUDIO 0x90 /* play audio track */ #define ACMD_SET_VOLUME 0x93 /* set audio level */ #define ACMD_GET_VERSION 0xA0 /* get firmware version */ -#define ACMD_SET_MODE 0xA1 /* set drive mode */ - -#define SET_TIMER(func, jifs) \ - delay_timer.expires = jifs; \ - delay_timer.function = (void *) func; \ - add_timer(&delay_timer); - -#define CLEAR_TIMER del_timer(&delay_timer) +#define ACMD_SET_DISK_TYPE 0xA1 /* set disk data mode */ #define MAX_TRACKS 104 @@ -106,9 +134,15 @@ struct azt_Play_msf { struct azt_DiskInfo { unsigned char first; + unsigned char next; unsigned char last; struct msf diskLength; struct msf firstTrack; + unsigned char multi; + struct msf nextSession; + struct msf lastSession; + unsigned char xa; + unsigned char audio; }; struct azt_Toc { diff --git a/include/linux/baycom.h b/include/linux/baycom.h new file mode 100644 index 000000000..b4108d1df --- /dev/null +++ b/include/linux/baycom.h @@ -0,0 +1,62 @@ +/* + * The Linux BAYCOM driver for the Baycom serial 1200 baud modem + * and the parallel 9600 baud modem + * (C) 1996 by Thomas Sailer, HB9JNX + */ + +#ifndef _BAYCOM_H +#define _BAYCOM_H + +#include <linux/sockios.h> +#include <linux/if_ether.h> + +/* -------------------------------------------------------------------- */ +/* + * structs for the IOCTL commands + */ + +struct baycom_debug_data { + unsigned long debug1; + unsigned long debug2; + long debug3; +}; + +struct baycom_modem_type { + unsigned char modem_type; + unsigned int options; +}; + +struct baycom_ioctl { + int cmd; + union { + struct baycom_modem_type mt; + struct baycom_debug_data dbg; + } data; +}; + +/* -------------------------------------------------------------------- */ + +/* + * modem types + */ +#define BAYCOM_MODEM_INVALID 0 +#define BAYCOM_MODEM_SER12 1 +#define BAYCOM_MODEM_PAR96 2 + +/* + * modem options; bit mask + */ +#define BAYCOM_OPTIONS_SOFTDCD 1 + +/* + * ioctl values change for baycom_net + */ +#define BAYCOMCTL_GETMODEMTYPE 0x90 +#define BAYCOMCTL_SETMODEMTYPE 0x91 +#define BAYCOMCTL_GETDEBUG 0x92 + +/* -------------------------------------------------------------------- */ + +#endif /* _BAYCOM_H */ + +/* --------------------------------------------------------------------- */ diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 832bde64c..6c424fbe9 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -6,7 +6,7 @@ /* * MAX_ARG_PAGES defines the number of pages allocated for arguments * and envelope for the new program. 32 should suffice, this gives - * a maximum env+arg of 128kB ! + * a maximum env+arg of 128kB w/4KB pages! */ #define MAX_ARG_PAGES 32 @@ -18,10 +18,13 @@ struct linux_binprm{ unsigned long page[MAX_ARG_PAGES]; unsigned long p; int sh_bang; + int java; /* Java binary, prevent recursive invocation */ struct inode * inode; int e_uid, e_gid; int argc, envc; - char * filename; /* Name of binary */ + char * filename; /* Name of binary */ + unsigned long loader, exec; + int dont_iput; /* binfmt handler has put inode */ }; /* @@ -30,7 +33,7 @@ struct linux_binprm{ */ struct linux_binfmt { struct linux_binfmt * next; - int *use_count; + long *use_count; int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); int (*load_shlib)(int fd); int (*core_dump)(long signr, struct pt_regs * regs); @@ -40,13 +43,20 @@ extern int register_binfmt(struct linux_binfmt *); extern int unregister_binfmt(struct linux_binfmt *); extern int read_exec(struct inode *inode, unsigned long offset, - char * addr, unsigned long count); + char * addr, unsigned long count, int to_kmem); extern int open_inode(struct inode * inode, int mode); +extern int init_elf_binfmt(void); +extern int init_aout_binfmt(void); +extern int init_script_binfmt(void); +extern int init_java_binfmt(void); + +extern int prepare_binprm(struct linux_binprm *); +extern void remove_arg_zero(struct linux_binprm *); +extern int search_binary_handler(struct linux_binprm *,struct pt_regs *); extern void flush_old_exec(struct linux_binprm * bprm); -extern unsigned long setup_arg_pages(unsigned long text_size,unsigned long * page); -extern unsigned long * create_tables(char * p,int argc,int envc,int ibcs); +extern unsigned long setup_arg_pages(unsigned long p, struct linux_binprm * bprm); extern unsigned long copy_strings(int argc,char ** argv,unsigned long *page, unsigned long p, int from_kmem); diff --git a/include/linux/bios32.h b/include/linux/bios32.h index ee8f862ea..d3632092a 100644 --- a/include/linux/bios32.h +++ b/include/linux/bios32.h @@ -9,11 +9,11 @@ * PCI System Design Guide * * PCI Special Interest Group - * M/S HF3-15A - * 5200 N.E. Elam Young Parkway - * Hillsboro, Oregon 97124-6497 - * +1 (503) 696-2000 - * +1 (800) 433-5177 + * P.O. Box 14070 + * Portland, OR 97214 + * U. S. A. + * Phone: 800-433-5177 / +1-503-797-4207 + * Fax: +1-503-234-6762 * * Manuals are $25 each or $50 for all three, plus $7 shipping * within the United States, $35 abroad. @@ -24,7 +24,7 @@ /* * Error values that may be returned by the PCI bios. Use - * pci_strbioserr() to convert to a printable string. + * pcibios_strerror() to convert to a printable string. */ #define PCIBIOS_SUCCESSFUL 0x00 #define PCIBIOS_FUNC_NOT_SUPPORTED 0x81 @@ -56,5 +56,6 @@ extern int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned short val); extern pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn, unsigned char where, unsigned int val); -extern char *pcibios_strerror (int error); +extern const char *pcibios_strerror (int error); + #endif /* BIOS32_H */ diff --git a/include/linux/blk.h b/include/linux/blk.h new file mode 100644 index 000000000..cd8eb09b3 --- /dev/null +++ b/include/linux/blk.h @@ -0,0 +1,432 @@ +#ifndef _BLK_H +#define _BLK_H + +#include <linux/blkdev.h> +#include <linux/locks.h> +#include <linux/config.h> + +/* + * NR_REQUEST is the number of entries in the request-queue. + * NOTE that writes may use only the low 2/3 of these: reads + * take precedence. + */ +#define NR_REQUEST 64 + +/* + * This is used in the elevator algorithm. We don't prioritise reads + * over writes any more --- although reads are more time-critical than + * writes, by treating them equally we increase filesystem throughput. + * This turns out to give better overall performance. -- sct + */ +#define IN_ORDER(s1,s2) \ +((s1)->rq_dev < (s2)->rq_dev || (((s1)->rq_dev == (s2)->rq_dev && \ +(s1)->sector < (s2)->sector))) + +/* + * These will have to be changed to be aware of different buffer + * sizes etc.. It actually needs a major cleanup. + */ +#if defined(IDE_DRIVER) || defined(MD_DRIVER) +#define SECTOR_MASK ((BLOCK_SIZE >> 9) - 1) +#else +#define SECTOR_MASK (blksize_size[MAJOR_NR] && \ + blksize_size[MAJOR_NR][MINOR(CURRENT->rq_dev)] ? \ + ((blksize_size[MAJOR_NR][MINOR(CURRENT->rq_dev)] >> 9) - 1) : \ + ((BLOCK_SIZE >> 9) - 1)) +#endif /* IDE_DRIVER */ + +#define SUBSECTOR(block) (CURRENT->current_nr_sectors > 0) + +#ifdef CONFIG_CDU31A +extern int cdu31a_init(void); +#endif CONFIG_CDU31A +#ifdef CONFIG_MCD +extern int mcd_init(void); +#endif CONFIG_MCD +#ifdef CONFIG_MCDX +extern int mcdx_init(void); +#endif CONFIG_MCDX +#ifdef CONFIG_SBPCD +extern int sbpcd_init(void); +#endif CONFIG_SBPCD +#ifdef CONFIG_AZTCD +extern int aztcd_init(void); +#endif CONFIG_AZTCD +#ifdef CONFIG_CDU535 +extern int sony535_init(void); +#endif CONFIG_CDU535 +#ifdef CONFIG_GSCD +extern int gscd_init(void); +#endif CONFIG_GSCD +#ifdef CONFIG_CM206 +extern int cm206_init(void); +#endif CONFIG_CM206 +#ifdef CONFIG_OPTCD +extern int optcd_init(void); +#endif CONFIG_OPTCD +#ifdef CONFIG_SJCD +extern int sjcd_init(void); +#endif CONFIG_SJCD +#ifdef CONFIG_CDI_INIT +extern int cdi_init(void); +#endif CONFIG_CDI_INIT +#ifdef CONFIG_BLK_DEV_HD +extern int hd_init(void); +#endif +#ifdef CONFIG_BLK_DEV_IDE +extern int ide_init(void); +#endif +#ifdef CONFIG_BLK_DEV_XD +extern int xd_init(void); +#endif +#ifdef CONFIG_BLK_DEV_LOOP +extern int loop_init(void); +#endif +#ifdef CONFIG_BLK_DEV_MD +extern int md_init(void); +#endif CONFIG_BLK_DEV_MD + +extern void set_device_ro(kdev_t dev,int flag); +void add_blkdev_randomness(int major); + +extern int floppy_init(void); +extern void rd_load(void); +extern int rd_init(void); +extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ +extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ +extern int rd_image_start; /* starting block # of image */ + +#ifdef CONFIG_BLK_DEV_INITRD + +#define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */ + +extern unsigned long initrd_start,initrd_end; +extern int mount_initrd; /* zero if initrd should not be mounted */ +void initrd_init(void); + +#endif + +#define RO_IOCTLS(dev,where) \ + case BLKROSET: { int __val; if (!suser()) return -EACCES; \ + if (get_user(__val, (int *)(where))) return -EFAULT; \ + set_device_ro((dev),__val); return 0; } \ + case BLKROGET: { int __val = (is_read_only(dev) != 0) ; \ + return put_user(__val,(int *) (where)); } + +#if defined(MAJOR_NR) || defined(IDE_DRIVER) + +/* + * Add entries as needed. + */ + +#ifdef IDE_DRIVER + +#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) +#define DEVICE_ON(device) /* nothing */ +#define DEVICE_OFF(device) /* nothing */ + +#elif (MAJOR_NR == RAMDISK_MAJOR) + +/* ram disk */ +#define DEVICE_NAME "ramdisk" +#define DEVICE_REQUEST rd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) +#define DEVICE_NO_RANDOM + +#elif (MAJOR_NR == FLOPPY_MAJOR) + +static void floppy_off(unsigned int nr); + +#define DEVICE_NAME "floppy" +#define DEVICE_INTR do_floppy +#define DEVICE_REQUEST do_fd_request +#define DEVICE_NR(device) ( (MINOR(device) & 3) | ((MINOR(device) & 0x80 ) >> 5 )) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) floppy_off(DEVICE_NR(device)) + +#elif (MAJOR_NR == HD_MAJOR) + +/* harddisk: timeout is 6 seconds.. */ +#define DEVICE_NAME "harddisk" +#define DEVICE_INTR do_hd +#define DEVICE_TIMEOUT HD_TIMER +#define TIMEOUT_VALUE (6*HZ) +#define DEVICE_REQUEST do_hd_request +#define DEVICE_NR(device) (MINOR(device)>>6) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == SCSI_DISK_MAJOR) + +#define DEVICE_NAME "scsidisk" +#define DEVICE_INTR do_sd +#define TIMEOUT_VALUE (2*HZ) +#define DEVICE_REQUEST do_sd_request +#define DEVICE_NR(device) (MINOR(device) >> 4) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +/* Kludge to use the same number for both char and block major numbers */ +#elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER) + +#define DEVICE_NAME "Multiple devices driver" +#define DEVICE_REQUEST do_md_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == SCSI_TAPE_MAJOR) + +#define DEVICE_NAME "scsitape" +#define DEVICE_INTR do_st +#define DEVICE_NR(device) (MINOR(device) & 0x7f) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == SCSI_CDROM_MAJOR) + +#define DEVICE_NAME "CD-ROM" +#define DEVICE_INTR do_sr +#define DEVICE_REQUEST do_sr_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == XT_DISK_MAJOR) + +#define DEVICE_NAME "xt disk" +#define DEVICE_REQUEST do_xd_request +#define DEVICE_NR(device) (MINOR(device) >> 6) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == CDU31A_CDROM_MAJOR) + +#define DEVICE_NAME "CDU31A" +#define DEVICE_REQUEST do_cdu31a_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MITSUMI_CDROM_MAJOR) + +#define DEVICE_NAME "Mitsumi CD-ROM" +/* #define DEVICE_INTR do_mcd */ +#define DEVICE_REQUEST do_mcd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR) + +#define DEVICE_NAME "Mitsumi CD-ROM" +/* #define DEVICE_INTR do_mcdx */ +#define DEVICE_REQUEST do_mcdx_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR) + +#define DEVICE_NAME "Matsushita CD-ROM controller #1" +#define DEVICE_REQUEST do_sbpcd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR) + +#define DEVICE_NAME "Matsushita CD-ROM controller #2" +#define DEVICE_REQUEST do_sbpcd2_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR) + +#define DEVICE_NAME "Matsushita CD-ROM controller #3" +#define DEVICE_REQUEST do_sbpcd3_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR) + +#define DEVICE_NAME "Matsushita CD-ROM controller #4" +#define DEVICE_REQUEST do_sbpcd4_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == AZTECH_CDROM_MAJOR) + +#define DEVICE_NAME "Aztech CD-ROM" +#define DEVICE_REQUEST do_aztcd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == CDU535_CDROM_MAJOR) + +#define DEVICE_NAME "SONY-CDU535" +#define DEVICE_INTR do_cdu535 +#define DEVICE_REQUEST do_cdu535_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR) + +#define DEVICE_NAME "Goldstar R420" +#define DEVICE_REQUEST do_gscd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == CM206_CDROM_MAJOR) +#define DEVICE_NAME "Philips/LMS cd-rom cm206" +#define DEVICE_REQUEST do_cm206_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == OPTICS_CDROM_MAJOR) + +#define DEVICE_NAME "DOLPHIN 8000AT CD-ROM" +#define DEVICE_REQUEST do_optcd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == SANYO_CDROM_MAJOR) + +#define DEVICE_NAME "Sanyo H94A CD-ROM" +#define DEVICE_REQUEST do_sjcd_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#endif /* MAJOR_NR == whatever */ + +#if (MAJOR_NR != SCSI_TAPE_MAJOR) +#if !defined(IDE_DRIVER) + +#ifndef CURRENT +#define CURRENT (blk_dev[MAJOR_NR].current_request) +#endif + +#define CURRENT_DEV DEVICE_NR(CURRENT->rq_dev) + +#ifdef DEVICE_INTR +static void (*DEVICE_INTR)(void) = NULL; +#endif +#ifdef DEVICE_TIMEOUT + +#define SET_TIMER \ +((timer_table[DEVICE_TIMEOUT].expires = jiffies + TIMEOUT_VALUE), \ +(timer_active |= 1<<DEVICE_TIMEOUT)) + +#define CLEAR_TIMER \ +timer_active &= ~(1<<DEVICE_TIMEOUT) + +#define SET_INTR(x) \ +if ((DEVICE_INTR = (x)) != NULL) \ + SET_TIMER; \ +else \ + CLEAR_TIMER; + +#else + +#define SET_INTR(x) (DEVICE_INTR = (x)) + +#endif /* DEVICE_TIMEOUT */ + +static void (DEVICE_REQUEST)(void); + +#ifdef DEVICE_INTR +#define CLEAR_INTR SET_INTR(NULL) +#else +#define CLEAR_INTR +#endif + +#define INIT_REQUEST \ + if (!CURRENT) {\ + CLEAR_INTR; \ + return; \ + } \ + if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) \ + panic(DEVICE_NAME ": request list destroyed"); \ + if (CURRENT->bh) { \ + if (!buffer_locked(CURRENT->bh)) \ + panic(DEVICE_NAME ": block not locked"); \ + } + +#endif /* !defined(IDE_DRIVER) */ + +/* end_request() - SCSI devices have their own version */ +/* - IDE drivers have their own copy too */ + +#if ! SCSI_BLK_MAJOR(MAJOR_NR) + +#if defined(IDE_DRIVER) && !defined(_IDE_C) /* shared copy for IDE modules */ +void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup); +#else + +#ifdef IDE_DRIVER +void ide_end_request(byte uptodate, ide_hwgroup_t *hwgroup) { + struct request *req = hwgroup->rq; +#else +static void end_request(int uptodate) { + struct request *req = CURRENT; +#endif /* IDE_DRIVER */ + struct buffer_head * bh; + + req->errors = 0; + if (!uptodate) { + printk("end_request: I/O error, dev %s, sector %lu\n", + kdevname(req->rq_dev), req->sector); + req->nr_sectors--; + req->nr_sectors &= ~SECTOR_MASK; + req->sector += (BLOCK_SIZE / 512); + req->sector &= ~SECTOR_MASK; + } + + if ((bh = req->bh) != NULL) { + req->bh = bh->b_reqnext; + bh->b_reqnext = NULL; + mark_buffer_uptodate(bh, uptodate); + unlock_buffer(bh); + if ((bh = req->bh) != NULL) { + req->current_nr_sectors = bh->b_size >> 9; + if (req->nr_sectors < req->current_nr_sectors) { + req->nr_sectors = req->current_nr_sectors; + printk("end_request: buffer-list destroyed\n"); + } + req->buffer = bh->b_data; + return; + } + } +#ifndef DEVICE_NO_RANDOM + add_blkdev_randomness(MAJOR(req->rq_dev)); +#endif +#ifdef IDE_DRIVER + blk_dev[MAJOR(req->rq_dev)].current_request = req->next; + hwgroup->rq = NULL; +#else + DEVICE_OFF(req->rq_dev); + CURRENT = req->next; +#endif /* IDE_DRIVER */ + if (req->sem != NULL) + up(req->sem); + req->rq_status = RQ_INACTIVE; + wake_up(&wait_for_request); +} +#endif /* defined(IDE_DRIVER) && !defined(_IDE_C) */ +#endif /* ! SCSI_BLK_MAJOR(MAJOR_NR) */ +#endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */ + +#endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */ + +#endif /* _BLK_H */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 1e0b17c81..e0f578f9b 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -4,6 +4,7 @@ #include <linux/major.h> #include <linux/sched.h> #include <linux/genhd.h> +#include <linux/tqueue.h> /* * Ok, this is an expanded form so that we can use the same @@ -12,7 +13,14 @@ * for read/write completion. */ struct request { - int dev; /* -1 if no request */ + volatile int rq_status; /* should split this into a few status bits */ +#define RQ_INACTIVE (-1) +#define RQ_ACTIVE 1 +#define RQ_SCSI_BUSY 0xffff +#define RQ_SCSI_DONE 0xfffe +#define RQ_SCSI_DISCONNECTING 0xffe0 + + kdev_t rq_dev; int cmd; /* READ or WRITE */ int errors; unsigned long sector; @@ -28,6 +36,8 @@ struct request { struct blk_dev_struct { void (*request_fn)(void); struct request * current_request; + struct request plug; + struct tq_struct plug_tq; }; struct sec_size { @@ -39,6 +49,10 @@ extern struct sec_size * blk_sec[MAX_BLKDEV]; extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; extern struct wait_queue * wait_for_request; extern void resetup_one_dev(struct gendisk *dev, int drive); +extern void unplug_device(void * data); + +/* md needs this function to remap requests */ +extern int md_map (int minor, kdev_t *rdev, unsigned long *rsector, unsigned long size); extern int * blk_size[MAX_BLKDEV]; diff --git a/include/linux/bpqether.h b/include/linux/bpqether.h new file mode 100644 index 000000000..cc7d35831 --- /dev/null +++ b/include/linux/bpqether.h @@ -0,0 +1,41 @@ +#ifndef __BPQETHER_H +#define __BPQETHER_H + +/* + * Defines for the BPQETHER pseudo device driver + */ + +#ifndef __LINUX_IF_ETHER_H +#include <linux/if_ether.h> +#endif + +#define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */ +#define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1) + +struct bpq_ethaddr { + unsigned char destination[ETH_ALEN]; + unsigned char accept[ETH_ALEN]; +}; + +/* + * For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers, + * currently not implemented, though. If someone wants to hook a radio + * to his ethernet card he may find this useful... ;-) + */ + +#define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */ +#define SIOCSBPQETHPARAM 0x5001 /* set */ + +struct bpq_req { + int cmd; + int speed; /* unused */ + int clockmode; /* unused */ + int txdelay; + unsigned char persist; /* unused */ + int slotime; /* unused */ + int squeldelay; + int dmachan; /* unused */ + int irq; /* unused */ +}; + +#endif diff --git a/include/linux/busmouse.h b/include/linux/busmouse.h index 33c6ec7a9..eb71550d3 100644 --- a/include/linux/busmouse.h +++ b/include/linux/busmouse.h @@ -2,7 +2,7 @@ #define _LINUX_BUSMOUSE_H /* - * linux/include/linux/mouse.h: header file for Logitech Bus Mouse driver + * linux/include/linux/busmouse.h: header file for Logitech Bus Mouse driver * by James Banks * * based on information gleamed from various mouse drivers on the net @@ -33,11 +33,13 @@ /*--------- LOGITECH BUSMOUSE ITEMS -------------*/ +#define LOGIBM_BASE 0x23c #define MSE_DATA_PORT 0x23c #define MSE_SIGNATURE_PORT 0x23d #define MSE_CONTROL_PORT 0x23e -#define MSE_INTERRUPT_PORT 0x23e +#define MSE_INTERRUPT_PORT 0x23e #define MSE_CONFIG_PORT 0x23f +#define LOGIBM_EXTENT 0x4 #define MSE_ENABLE_INTERRUPTS 0x00 #define MSE_DISABLE_INTERRUPTS 0x10 @@ -59,10 +61,12 @@ /*--------- MICROSOFT BUSMOUSE ITEMS -------------*/ +#define MSBM_BASE 0x23d #define MS_MSE_DATA_PORT 0x23d #define MS_MSE_SIGNATURE_PORT 0x23e #define MS_MSE_CONTROL_PORT 0x23c #define MS_MSE_CONFIG_PORT 0x23f +#define MSBM_EXTENT 0x3 #define MS_MSE_ENABLE_INTERRUPTS 0x11 #define MS_MSE_DISABLE_INTERRUPTS 0x10 @@ -91,10 +95,10 @@ struct mouse_status { int ready; int active; struct wait_queue *wait; + struct fasync_struct *fasyncptr; }; /* Function Prototypes */ -extern long mouse_init(long); #endif diff --git a/include/linux/cd1400.h b/include/linux/cd1400.h new file mode 100644 index 000000000..b6e5b667b --- /dev/null +++ b/include/linux/cd1400.h @@ -0,0 +1,291 @@ +/*****************************************************************************/ + +/* + * cd1400.h -- cd1400 UART hardware info. + * + * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _CD1400_H +#define _CD1400_H +/*****************************************************************************/ + +/* + * Define the number of async ports per cd1400 uart chip. + */ +#define CD1400_PORTS 4 + +/* + * Define the cd1400 uarts internal FIFO sizes. + */ +#define CD1400_TXFIFOSIZE 12 +#define CD1400_RXFIFOSIZE 12 + +/* + * Local RX FIFO thresh hold level. Also define the RTS thresh hold + * based on the RX thresh hold. + */ +#define FIFO_RXTHRESHOLD 6 +#define FIFO_RTSTHRESHOLD 7 + +/*****************************************************************************/ + +/* + * Define the cd1400 register addresses. These are all the valid + * registers with the cd1400. Some are global, some virtual, some + * per port. + */ +#define GFRCR 0x40 +#define CAR 0x68 +#define GCR 0x4b +#define SVRR 0x67 +#define RICR 0x44 +#define TICR 0x45 +#define MICR 0x46 +#define RIR 0x6b +#define TIR 0x6a +#define MIR 0x69 +#define PPR 0x7e + +#define RIVR 0x43 +#define TIVR 0x42 +#define MIVR 0x41 +#define TDR 0x63 +#define RDSR 0x62 +#define MISR 0x4c +#define EOSRR 0x60 + +#define LIVR 0x18 +#define CCR 0x05 +#define SRER 0x06 +#define COR1 0x08 +#define COR2 0x09 +#define COR3 0x0a +#define COR4 0x1e +#define COR5 0x1f +#define CCSR 0x0b +#define RDCR 0x0e +#define SCHR1 0x1a +#define SCHR2 0x1b +#define SCHR3 0x1c +#define SCHR4 0x1d +#define SCRL 0x22 +#define SCRH 0x23 +#define LNC 0x24 +#define MCOR1 0x15 +#define MCOR2 0x16 +#define RTPR 0x21 +#define MSVR1 0x6c +#define MSVR2 0x6d +#define PSVR 0x6f +#define RBPR 0x78 +#define RCOR 0x7c +#define TBPR 0x72 +#define TCOR 0x76 + +/*****************************************************************************/ + +/* + * Define the set of baud rate clock divisors. + */ +#define CD1400_CLK0 8 +#define CD1400_CLK1 32 +#define CD1400_CLK2 128 +#define CD1400_CLK3 512 +#define CD1400_CLK4 2048 + +#define CD1400_NUMCLKS 5 + +/*****************************************************************************/ + +/* + * Define the clock pre-scalar value to be a 5 ms clock. This should be + * OK for now. It would probably be better to make it 10 ms, but we + * can't fit that divisor into 8 bits! + */ +#define PPR_SCALAR 244 + +/*****************************************************************************/ + +/* + * Define values used to set character size options. + */ +#define COR1_CHL5 0x00 +#define COR1_CHL6 0x01 +#define COR1_CHL7 0x02 +#define COR1_CHL8 0x03 + +/* + * Define values used to set the number of stop bits. + */ +#define COR1_STOP1 0x00 +#define COR1_STOP15 0x04 +#define COR1_STOP2 0x08 + +/* + * Define values used to set the parity scheme in use. + */ +#define COR1_PARNONE 0x00 +#define COR1_PARFORCE 0x20 +#define COR1_PARENB 0x40 +#define COR1_PARIGNORE 0x10 + +#define COR1_PARODD 0x80 +#define COR1_PAREVEN 0x00 + +#define COR2_IXM 0x80 +#define COR2_TXIBE 0x40 +#define COR2_ETC 0x20 +#define COR2_LLM 0x10 +#define COR2_RLM 0x08 +#define COR2_RTSAO 0x04 +#define COR2_CTSAE 0x02 + +#define COR3_SCDRNG 0x80 +#define COR3_SCD34 0x40 +#define COR3_FCT 0x20 +#define COR3_SCD12 0x10 + +/* + * Define values used by COR4. + */ +#define COR4_BRKINT 0x08 +#define COR4_IGNBRK 0x18 + +/*****************************************************************************/ + +/* + * Define the modem control register values. + * Note that the actual hardware is a little different to the conventional + * pin names on the cd1400. + */ +#define MSVR1_DTR 0x01 +#define MSVR1_DSR 0x10 +#define MSVR1_RI 0x20 +#define MSVR1_CTS 0x40 +#define MSVR1_DCD 0x80 + +#define MSVR2_RTS 0x02 +#define MSVR2_DSR 0x10 +#define MSVR2_RI 0x20 +#define MSVR2_CTS 0x40 +#define MSVR2_DCD 0x80 + +#define MCOR1_DCD 0x80 +#define MCOR1_CTS 0x40 +#define MCOR1_RI 0x20 +#define MCOR1_DSR 0x10 + +#define MCOR2_DCD 0x80 +#define MCOR2_CTS 0x40 +#define MCOR2_RI 0x20 +#define MCOR2_DSR 0x10 + +/*****************************************************************************/ + +/* + * Define the bits used with the service (interrupt) enable register. + */ +#define SRER_NNDT 0x01 +#define SRER_TXEMPTY 0x02 +#define SRER_TXDATA 0x04 +#define SRER_RXDATA 0x10 +#define SRER_MODEM 0x80 + +/*****************************************************************************/ + +/* + * Define operational commands for the command register. + */ +#define CCR_RESET 0x80 +#define CCR_CORCHANGE 0x4e +#define CCR_SENDCH 0x20 +#define CCR_CHANCTRL 0x10 + +#define CCR_TXENABLE (CCR_CHANCTRL | 0x08) +#define CCR_TXDISABLE (CCR_CHANCTRL | 0x04) +#define CCR_RXENABLE (CCR_CHANCTRL | 0x02) +#define CCR_RXDISABLE (CCR_CHANCTRL | 0x01) + +#define CCR_SENDSCHR1 (CCR_SENDCH | 0x01) +#define CCR_SENDSCHR2 (CCR_SENDCH | 0x02) +#define CCR_SENDSCHR3 (CCR_SENDCH | 0x03) +#define CCR_SENDSCHR4 (CCR_SENDCH | 0x04) + +#define CCR_RESETCHAN (CCR_RESET | 0x00) +#define CCR_RESETFULL (CCR_RESET | 0x01) +#define CCR_TXFLUSHFIFO (CCR_RESET | 0x02) + +#define CCR_MAXWAIT 10000 + +/*****************************************************************************/ + +/* + * Define the valid acknowledgement types (for hw ack cycle). + */ +#define ACK_TYPMASK 0x07 +#define ACK_TYPTX 0x02 +#define ACK_TYPMDM 0x01 +#define ACK_TYPRXGOOD 0x03 +#define ACK_TYPRXBAD 0x07 + +#define SVRR_RX 0x01 +#define SVRR_TX 0x02 +#define SVRR_MDM 0x04 + +#define ST_OVERRUN 0x01 +#define ST_FRAMING 0x02 +#define ST_PARITY 0x04 +#define ST_BREAK 0x08 +#define ST_SCHAR1 0x10 +#define ST_SCHAR2 0x20 +#define ST_SCHAR3 0x30 +#define ST_SCHAR4 0x40 +#define ST_RANGE 0x70 +#define ST_SCHARMASK 0x70 +#define ST_TIMEOUT 0x80 + +#define MISR_DCD 0x80 +#define MISR_CTS 0x40 +#define MISR_RI 0x20 +#define MISR_DSR 0x10 + +/*****************************************************************************/ + +/* + * Defines for the CCSR status register. + */ +#define CCSR_RXENABLED 0x80 +#define CCSR_RXFLOWON 0x40 +#define CCSR_RXFLOWOFF 0x20 +#define CCSR_TXENABLED 0x08 +#define CCSR_TXFLOWON 0x04 +#define CCSR_TXFLOWOFF 0x02 + +/*****************************************************************************/ + +/* + * Define the embedded commands. + */ +#define ETC_CMD 0x00 +#define ETC_STARTBREAK 0x81 +#define ETC_DELAY 0x82 +#define ETC_STOPBREAK 0x83 + +/*****************************************************************************/ +#endif diff --git a/include/linux/cdk.h b/include/linux/cdk.h new file mode 100644 index 000000000..a3d016791 --- /dev/null +++ b/include/linux/cdk.h @@ -0,0 +1,481 @@ +/*****************************************************************************/ + +/* + * cdk.h -- CDK interface definitions. + * + * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _CDK_H +#define _CDK_H +/*****************************************************************************/ + +#pragma pack(2) + +/* + * The following set of definitions is used to communicate with the + * shared memory interface of the Stallion intelligent multiport serial + * boards. The definitions in this file are taken directly from the + * document titled "Generic Stackable Interface, Downloader and + * Communications Development Kit". + */ + +/* + * Define the set of important shared memory addresses. These are + * required to initialize the board and get things started. All of these + * addresses are relative to the start of the shared memory. + */ +#define CDK_SIGADDR 0x200 +#define CDK_FEATADDR 0x280 +#define CDK_CDKADDR 0x300 +#define CDK_RDYADDR 0x262 + +#define CDK_ALIVEMARKER 13 + +/* + * On hardware power up the ROMs located on the EasyConnection 8/64 will + * fill out the following signature information into shared memory. This + * way the host system can quickly determine that the board is present + * and is operational. + */ +typedef struct cdkecpsig { + unsigned long magic; + unsigned short romver; + unsigned short cputype; + unsigned char panelid[8]; +} cdkecpsig_t; + +#define ECP_MAGIC 0x21504345 + +/* + * On hardware power up the ROMs located on the ONboard, Stallion and + * Brumbys will fill out the following signature information into shared + * memory. This way the host system can quickly determine that the board + * is present and is operational. + */ +typedef struct cdkonbsig { + unsigned short magic0; + unsigned short magic1; + unsigned short magic2; + unsigned short magic3; + unsigned short romver; + unsigned short memoff; + unsigned short memseg; + unsigned short amask0; + unsigned short pic; + unsigned short status; + unsigned short btype; + unsigned short clkticks; + unsigned short clkspeed; + unsigned short amask1; + unsigned short amask2; +} cdkonbsig_t; + +#define ONB_MAGIC0 0xf2a7 +#define ONB_MAGIC1 0xa149 +#define ONB_MAGIC2 0x6352 +#define ONB_MAGIC3 0xf121 + +/* + * Define the feature area structure. The feature area is the set of + * startup parameters used by the slave image when it starts executing. + * They allow for the specification of buffer sizes, debug trace, etc. + */ +typedef struct cdkfeature { + unsigned long debug; + unsigned long banner; + unsigned long etype; + unsigned long nrdevs; + unsigned long brdspec; + unsigned long txrqsize; + unsigned long rxrqsize; + unsigned long flags; +} cdkfeature_t; + +#define ETYP_DDK 0 +#define ETYP_CDK 1 + +/* + * Define the CDK header structure. This is the info that the slave + * environment sets up after it has been downloaded and started. It + * essentially provides a memory map for the shared memory interface. + */ +typedef struct cdkhdr { + unsigned short command; + unsigned short status; + unsigned short port; + unsigned short mode; + unsigned long cmd_buf[14]; + unsigned short alive_cnt; + unsigned short intrpt_mode; + unsigned char intrpt_id[8]; + unsigned char ver_release; + unsigned char ver_modification; + unsigned char ver_fix; + unsigned char deadman_restart; + unsigned short deadman; + unsigned short nrdevs; + unsigned long memp; + unsigned long hostp; + unsigned long slavep; + unsigned char hostreq; + unsigned char slavereq; + unsigned char cmd_reserved[30]; +} cdkhdr_t; + +#define MODE_DDK 0 +#define MODE_CDK 1 + +#define IMD_INTR 0x0 +#define IMD_PPINTR 0x1 +#define IMD_POLL 0xff + +/* + * Define the memory mapping structure. This structure is pointed to by + * the memp field in the stlcdkhdr struct. As many as these structures + * as required are layed out in shared memory to define how the rest of + * shared memory is divided up. There will be one for each port. + */ +typedef struct cdkmem { + unsigned short dtype; + unsigned long offset; +} cdkmem_t; + +#define TYP_UNDEFINED 0x0 +#define TYP_ASYNCTRL 0x1 +#define TYP_ASYNC 0x20 +#define TYP_PARALLEL 0x40 +#define TYP_SYNCX21 0x60 + +/*****************************************************************************/ + +/* + * Following is a set of defines and structures used to actually deal + * with the serial ports on the board. Firstly is the set of commands + * that can be applied to ports. + */ +#define ASYCMD (((unsigned long) 'a') << 8) + +#define A_NULL (ASYCMD | 0) +#define A_FLUSH (ASYCMD | 1) +#define A_BREAK (ASYCMD | 2) +#define A_GETPORT (ASYCMD | 3) +#define A_SETPORT (ASYCMD | 4) +#define A_SETPORTF (ASYCMD | 5) +#define A_SETPORTFTX (ASYCMD | 6) +#define A_SETPORTFRX (ASYCMD | 7) +#define A_GETSIGNALS (ASYCMD | 8) +#define A_SETSIGNALS (ASYCMD | 9) +#define A_SETSIGNALSF (ASYCMD | 10) +#define A_SETSIGNALSFTX (ASYCMD | 11) +#define A_SETSIGNALSFRX (ASYCMD | 12) +#define A_GETNOTIFY (ASYCMD | 13) +#define A_SETNOTIFY (ASYCMD | 14) +#define A_NOTIFY (ASYCMD | 15) +#define A_PORTCTRL (ASYCMD | 16) +#define A_GETSTATS (ASYCMD | 17) +#define A_RQSTATE (ASYCMD | 18) +#define A_FLOWSTATE (ASYCMD | 19) +#define A_CLEARSTATS (ASYCMD | 20) + +/* + * Define those arguments used for simple commands. + */ +#define FLUSHRX 0x1 +#define FLUSHTX 0x2 + +#define BREAKON -1 +#define BREAKOFF -2 + +/* + * Define the port setting structure, and all those defines that go along + * with it. Basically this structure defines the characteristics of this + * port: baud rate, chars, parity, input/output char cooking etc. + */ +typedef struct asyport { + unsigned long baudout; + unsigned long baudin; + unsigned long iflag; + unsigned long oflag; + unsigned long lflag; + unsigned long pflag; + unsigned long flow; + unsigned long spare1; + unsigned short vtime; + unsigned short vmin; + unsigned short txlo; + unsigned short txhi; + unsigned short rxlo; + unsigned short rxhi; + unsigned short rxhog; + unsigned short spare2; + unsigned char csize; + unsigned char stopbs; + unsigned char parity; + unsigned char stopin; + unsigned char startin; + unsigned char stopout; + unsigned char startout; + unsigned char parmark; + unsigned char brkmark; + unsigned char cc[11]; +} asyport_t; + +#define PT_STOP1 0x0 +#define PT_STOP15 0x1 +#define PT_STOP2 0x2 + +#define PT_NOPARITY 0x0 +#define PT_ODDPARITY 0x1 +#define PT_EVENPARITY 0x2 +#define PT_MARKPARITY 0x3 +#define PT_SPACEPARITY 0x4 + +#define F_NONE 0x0 +#define F_IXON 0x1 +#define F_IXOFF 0x2 +#define F_IXANY 0x4 +#define F_IOXANY 0x8 +#define F_RTSFLOW 0x10 +#define F_CTSFLOW 0x20 +#define F_DTRFLOW 0x40 +#define F_DCDFLOW 0x80 +#define F_DSROFLOW 0x100 +#define F_DSRIFLOW 0x200 + +#define FI_NORX 0x1 +#define FI_RAW 0x2 +#define FI_ISTRIP 0x4 +#define FI_UCLC 0x8 +#define FI_INLCR 0x10 +#define FI_ICRNL 0x20 +#define FI_IGNCR 0x40 +#define FI_IGNBREAK 0x80 +#define FI_DSCRDBREAK 0x100 +#define FI_1MARKBREAK 0x200 +#define FI_2MARKBREAK 0x400 +#define FI_XCHNGBREAK 0x800 +#define FI_IGNRXERRS 0x1000 +#define FI_DSCDRXERRS 0x2000 +#define FI_1MARKRXERRS 0x4000 +#define FI_2MARKRXERRS 0x8000 +#define FI_XCHNGRXERRS 0x10000 +#define FI_DSCRDNULL 0x20000 + +#define FO_OLCUC 0x1 +#define FO_ONLCR 0x2 +#define FO_OOCRNL 0x4 +#define FO_ONOCR 0x8 +#define FO_ONLRET 0x10 +#define FO_ONL 0x20 +#define FO_OBS 0x40 +#define FO_OVT 0x80 +#define FO_OFF 0x100 +#define FO_OTAB1 0x200 +#define FO_OTAB2 0x400 +#define FO_OTAB3 0x800 +#define FO_OCR1 0x1000 +#define FO_OCR2 0x2000 +#define FO_OCR3 0x4000 +#define FO_OFILL 0x8000 +#define FO_ODELL 0x10000 + +#define P_RTSLOCK 0x1 +#define P_CTSLOCK 0x2 +#define P_MAPRTS 0x4 +#define P_MAPCTS 0x8 +#define P_LOOPBACK 0x10 +#define P_DTRFOLLOW 0x20 +#define P_FAKEDCD 0x40 + +/* + * Define a structure to communicate serial port signal and data state + * information. + */ +typedef struct asysigs { + unsigned long data; + unsigned long signal; + unsigned long sigvalue; +} asysigs_t; + +#define DT_TXBUSY 0x1 +#define DT_TXEMPTY 0x2 +#define DT_TXLOW 0x4 +#define DT_TXHIGH 0x8 +#define DT_TXFULL 0x10 +#define DT_TXHOG 0x20 +#define DT_TXFLOWED 0x40 +#define DT_TXBREAK 0x80 + +#define DT_RXBUSY 0x100 +#define DT_RXEMPTY 0x200 +#define DT_RXLOW 0x400 +#define DT_RXHIGH 0x800 +#define DT_RXFULL 0x1000 +#define DT_RXHOG 0x2000 +#define DT_RXFLOWED 0x4000 +#define DT_RXBREAK 0x8000 + +#define SG_DTR 0x1 +#define SG_DCD 0x2 +#define SG_RTS 0x4 +#define SG_CTS 0x8 +#define SG_DSR 0x10 +#define SG_RI 0x20 + +/* + * Define the notification setting structure. This is used to tell the + * port what events we want to be informed about. Fields here use the + * same defines as for the asysigs structure above. + */ +typedef struct asynotify { + unsigned long ctrl; + unsigned long data; + unsigned long signal; + unsigned long sigvalue; +} asynotify_t; + +/* + * Define the port control structure. It is used to do fine grain + * control operations on the port. + */ +typedef struct { + unsigned long rxctrl; + unsigned long txctrl; + char rximdch; + char tximdch; + char spare1; + char spare2; +} asyctrl_t; + +#define CT_ENABLE 0x1 +#define CT_DISABLE 0x2 +#define CT_STOP 0x4 +#define CT_START 0x8 +#define CT_STARTFLOW 0x10 +#define CT_STOPFLOW 0x20 +#define CT_SENDCHR 0x40 + +/* + * Define the stats structure kept for each port. This is a useful set + * of data collected for each port on the slave. The A_GETSTATS command + * is used to retrieve this data from the slave. + */ +typedef struct asystats { + unsigned long opens; + unsigned long txchars; + unsigned long rxchars; + unsigned long txringq; + unsigned long rxringq; + unsigned long txmsgs; + unsigned long rxmsgs; + unsigned long txflushes; + unsigned long rxflushes; + unsigned long overruns; + unsigned long framing; + unsigned long parity; + unsigned long ringover; + unsigned long lost; + unsigned long rxstart; + unsigned long rxstop; + unsigned long txstart; + unsigned long txstop; + unsigned long dcdcnt; + unsigned long dtrcnt; + unsigned long ctscnt; + unsigned long rtscnt; + unsigned long dsrcnt; + unsigned long ricnt; + unsigned long txbreaks; + unsigned long rxbreaks; + unsigned long signals; + unsigned long state; + unsigned long hwid; +} asystats_t; + +/*****************************************************************************/ + +/* + * All command and control communication with a device on the slave is + * via a control block in shared memory. Each device has its own control + * block, defined by the following structure. The control block allows + * the host to open, close and control the device on the slave. + */ +typedef struct cdkctrl { + unsigned char open; + unsigned char close; + unsigned long openarg; + unsigned long closearg; + unsigned long cmd; + unsigned long status; + unsigned long args[32]; +} cdkctrl_t; + +/* + * Each device on the slave passes data to and from the host via a ring + * queue in shared memory. Define a ring queue structure to hold the + * vital information about each ring queue. Two ring queues will be + * allocated for each port, one for receive data and one for transmit + * data. + */ +typedef struct cdkasyrq { + unsigned long offset; + unsigned short size; + unsigned short head; + unsigned short tail; +} cdkasyrq_t; + +/* + * Each asynchronous port is defined in shared memory by the following + * structure. It contains a control block to command a device, and also + * the necessary data channel information as well. + */ +typedef struct cdkasy { + cdkctrl_t ctrl; + unsigned short notify; + asynotify_t changed; + unsigned short receive; + cdkasyrq_t rxq; + unsigned short transmit; + cdkasyrq_t txq; +} cdkasy_t; + +#pragma pack() + +/*****************************************************************************/ + +/* + * Define the set of ioctls used by the driver to do special things + * to the board. These include interrupting it, and initializing + * the driver after board startup and shutdown. + */ +#include <linux/ioctl.h> + +#define STL_BINTR _IO('s',20) +#define STL_BSTART _IO('s',21) +#define STL_BSTOP _IO('s',22) +#define STL_BRESET _IO('s',23) + +/* + * Define a set of ioctl extensions, used to get at special stuff. + */ +#define STL_GETPFLAG _IO('s',80) +#define STL_SETPFLAG _IO('s',81) + +/*****************************************************************************/ +#endif diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 1cd8cbeda..aba1458c3 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -1,12 +1,10 @@ -/**************************************************************************************** - * * - * general (not only SCSI) header library for linux CDROM drivers * - * (C) 1992 David Giller rafetmad@oxy.edu * - * 1994 Eberhard Moenkeberg emoenke@gwdg.de ("read audio" and some other stuff) * - * * - * <linux/cdrom.h> -- CD-ROM IOCTLs and structs * - * * - ****************************************************************************************/ +/* + * -- <linux/cdrom.h> + * general (not only SCSI) header library for linux CDROM drivers + * (C) 1992 David Giller rafetmad@oxy.edu + * 1994, 1995 Eberhard Moenkeberg emoenke@gwdg.de + * + */ #ifndef _LINUX_CDROM_H #define _LINUX_CDROM_H @@ -14,229 +12,114 @@ /* * some fix numbers */ -#define CD_MINS 74 /* max. minutes per CD */ -#define CD_SECS 60 /* seconds per minute */ -#define CD_FRAMES 75 /* frames per second */ -#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ -#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ -#define CD_FRAMESIZE 2048 /* bytes per frame, cooked mode */ -#define CD_FRAMESIZE_RAW0 2336 /* bytes per frame, "raw" mode */ -#define CD_FRAMESIZE_XA 2340 /* bytes per frame, "xa" mode */ -#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ -#define CD_FRAMESIZE_SUB 96 /* subchannel data size */ -#define CD_BLOCK_OFFSET 150 /* offset of first logical frame */ -#define CD_XA_HEAD 12 /* header size of XA frame */ -#define CD_XA_TAIL 280 /* tail size of XA frame */ +#define CD_MINS 74 /* max. minutes per CD, not really a limit */ +#define CD_SECS 60 /* seconds per minute */ +#define CD_FRAMES 75 /* frames per second */ + +#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame, not transfered by the drive */ +#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ +#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ +#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ +#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD)/* sync bytes + header of XA frame */ + +#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ +#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ +/* most drives don't deliver everything: */ +#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /* 2340 */ +#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /* 2336 */ +/* Optics drive also has a 'read all' mode: */ +#define CD_FRAMESIZE_RAWER 2646 /* bytes per frame */ + +#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ +#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ +#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ +#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ + +#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ + +#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ +#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ + +#define CD_FRAMESIZE_XA CD_FRAMESIZE_RAW1 /* obsolete name */ +#define CD_BLOCK_OFFSET CD_MSF_OFFSET /* obsolete name */ /* + * the raw frame layout: * - * For IOCTL calls, we will commandeer byte 0x53, or 'S'. + * - audio (red): | audio_sample_bytes | + * | 2352 | * + * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | + * | 12 - 4 - 2048 - 4 - 8 - 276 | + * + * - data (yellow, mode2): | sync - head - data | + * | 12 - 4 - 2336 | + * + * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | + * | 12 - 4 - 8 - 2048 - 4 - 276 | + * + * - XA data (green, mode2 form2): | sync - head - sub - data - EDC | + * | 12 - 4 - 8 - 2324 - 4 | */ /* - * CD-ROM-specific SCSI command opcodes - */ - -/* - * Group 2 (10-byte). All of these are called 'optional' by SCSI-II. - */ - -#define SCMD_READ_TOC 0x43 /* read table of contents */ -#define SCMD_PLAYAUDIO_MSF 0x47 /* play data at time offset */ -#define SCMD_PLAYAUDIO_TI 0x48 /* play data at track/index */ -#define SCMD_PAUSE_RESUME 0x4B /* pause/resume audio */ -#define SCMD_READ_SUBCHANNEL 0x42 /* read SC info on playing disc */ -#define SCMD_PLAYAUDIO10 0x45 /* play data at logical block */ -#define SCMD_READ_HEADER 0x44 /* read TOC header */ - -/* - * Group 5 - */ - -#define SCMD_PLAYAUDIO12 0xA5 /* play data at logical block */ -#define SCMD_PLAYTRACK_REL12 0xA9 /* play track at relative offset*/ - -/* - * Group 6 Commands - */ - -#define SCMD_CD_PLAYBACK_CONTROL 0xC9 /* Sony vendor-specific audio */ -#define SCMD_CD_PLAYBACK_STATUS 0xC4 /* control opcodes. info please!*/ - -/* - * CD-ROM capacity structure. - */ - -struct scsi_capacity - { - u_long capacity; - u_long lbasize; - }; - -/* - * CD-ROM MODE_SENSE/MODE_SELECT parameters - */ - -#define ERR_RECOVERY_PARMS 0x01 -#define DISCO_RECO_PARMS 0x02 -#define FORMAT_PARMS 0x03 -#define GEOMETRY_PARMS 0x04 -#define CERTIFICATION_PARMS 0x06 -#define CACHE_PARMS 0x38 - -/* - * standard mode-select header prepended to all mode-select commands - */ - -struct ccs_modesel_head - { - u_char _r1; /* reserved */ - u_char medium; /* device-specific medium type */ - u_char _r2; /* reserved */ - u_char block_desc_length; /* block descriptor length */ - u_char density; /* device-specific density code */ - u_char number_blocks_hi; /* number of blocks in this block desc */ - u_char number_blocks_med; - u_char number_blocks_lo; - u_char _r3; - u_char block_length_hi; /* block length for blocks in this desc */ - u_short block_length; - }; - -/* - * error recovery parameters - */ - -struct ccs_err_recovery - { - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char awre : 1; /* auto write realloc enabled */ - u_char arre : 1; /* auto read realloc enabled */ - u_char tb : 1; /* transfer block */ - u_char rc : 1; /* read continuous */ - u_char eec : 1; /* enable early correction */ - u_char per : 1; /* post error */ - u_char dte : 1; /* disable transfer on error */ - u_char dcr : 1; /* disable correction */ - u_char retry_count; /* error retry count */ - u_char correction_span; /* largest recov. to be attempted, bits */ - u_char head_offset_count; /* head offset (2's C) for each retry */ - u_char strobe_offset_count; /* data strobe " */ - u_char recovery_time_limit; /* time limit on recovery attempts */ -}; - -/* - * disco/reco parameters + * CDROM IOCTL structures */ -struct ccs_disco_reco - { - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char buffer_full_ratio; /* write buffer reconnect threshold */ - u_char buffer_empty_ratio; /* read " */ - u_short bus_inactivity_limit; /* limit on bus inactivity time */ - u_short disconnect_time_limit; /* minimum disconnect time */ - u_short connect_time_limit; /* minimum connect time */ - u_short _r2; /* reserved */ +struct cdrom_blk +{ + unsigned from; + unsigned short len; }; -/* - * drive geometry parameters - */ - -struct ccs_geometry - { - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char cyl_ub; /* #cyls */ - u_char cyl_mb; - u_char cyl_lb; - u_char heads; /* #heads */ - u_char precomp_cyl_ub; /* precomp start */ - u_char precomp_cyl_mb; - u_char precomp_cyl_lb; - u_char current_cyl_ub; /* reduced current start */ - u_char current_cyl_mb; - u_char current_cyl_lb; - u_short step_rate; /* stepping motor rate */ - u_char landing_cyl_ub; /* landing zone */ - u_char landing_cyl_mb; - u_char landing_cyl_lb; - u_char _r2; - u_char _r3; - u_char _r4; - }; - -/* - * cache parameters - */ - -struct ccs_cache - { - u_char _r1 : 2; /* reserved */ - u_char page_code : 6; /* page code */ - u_char page_length; /* page length */ - u_char mode; /* cache control byte */ - u_char threshold; /* prefetch threshold */ - u_char max_prefetch; /* maximum prefetch size */ - u_char max_multiplier; /* maximum prefetch multiplier */ - u_char min_prefetch; /* minimum prefetch size */ - u_char min_multiplier; /* minimum prefetch multiplier */ - u_char _r2[8]; - }; - -/* - * CDROM IOCTL structures - */ struct cdrom_msf - { - u_char cdmsf_min0; /* start minute */ - u_char cdmsf_sec0; /* start second */ - u_char cdmsf_frame0; /* start frame */ - u_char cdmsf_min1; /* end minute */ - u_char cdmsf_sec1; /* end second */ - u_char cdmsf_frame1; /* end frame */ - }; +{ + u_char cdmsf_min0; /* start minute */ + u_char cdmsf_sec0; /* start second */ + u_char cdmsf_frame0; /* start frame */ + u_char cdmsf_min1; /* end minute */ + u_char cdmsf_sec1; /* end second */ + u_char cdmsf_frame1; /* end frame */ +}; struct cdrom_ti - { - u_char cdti_trk0; /* start track */ - u_char cdti_ind0; /* start index */ - u_char cdti_trk1; /* end track */ - u_char cdti_ind1; /* end index */ - }; +{ + u_char cdti_trk0; /* start track */ + u_char cdti_ind0; /* start index */ + u_char cdti_trk1; /* end track */ + u_char cdti_ind1; /* end index */ +}; struct cdrom_tochdr - { - u_char cdth_trk0; /* start track */ - u_char cdth_trk1; /* end track */ - }; +{ + u_char cdth_trk0; /* start track */ + u_char cdth_trk1; /* end track */ +}; + +struct cdrom_msf0 /* address in MSF format */ +{ + u_char minute; + u_char second; + u_char frame; +}; + +union cdrom_addr /* address in either MSF or logical format */ +{ + struct cdrom_msf0 msf; + int lba; +}; struct cdrom_tocentry - { +{ u_char cdte_track; u_char cdte_adr :4; u_char cdte_ctrl :4; u_char cdte_format; - union - { - struct - { - u_char minute; - u_char second; - u_char frame; - } msf; - int lba; - } cdte_addr; + union cdrom_addr cdte_addr; u_char cdte_datamode; - }; +}; /* * CD-ROM address types (cdrom_tocentry.cdte_format) @@ -245,94 +128,67 @@ struct cdrom_tocentry #define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ /* - * bit to tell whether track is data or audio + * bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ - #define CDROM_DATA_TRACK 0x04 /* * The leadout track is always 0xAA, regardless of # of tracks on disc */ - #define CDROM_LEADOUT 0xAA struct cdrom_subchnl - { +{ u_char cdsc_format; u_char cdsc_audiostatus; u_char cdsc_adr: 4; u_char cdsc_ctrl: 4; u_char cdsc_trk; u_char cdsc_ind; - union - { - struct - { - u_char minute; - u_char second; - u_char frame; - } msf; - int lba; - } cdsc_absaddr; - union - { - struct - { - u_char minute; - u_char second; - u_char frame; - } msf; - int lba; - } cdsc_reladdr; - }; + union cdrom_addr cdsc_absaddr; + union cdrom_addr cdsc_reladdr; +}; + +struct cdrom_mcn { + u_char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ +}; /* - * return value from READ SUBCHANNEL DATA + * audio states (from SCSI-2, but seen with other drives, too) */ - -#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ -#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ -#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ -#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ -#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ -#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ +#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ +#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ +#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ +#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ +#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ +#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ struct cdrom_volctrl - { +{ u_char channel0; u_char channel1; u_char channel2; u_char channel3; - }; +}; struct cdrom_read - { +{ int cdread_lba; caddr_t cdread_bufaddr; int cdread_buflen; - }; +}; /* - * preliminary extensions for transferring audio frames - * currently used by sbpcd.c - * (still may change if other drivers will use it, too): + * extensions for transferring audio frames + * currently used by sbpcd.c, cdu31a.c, ide-cd.c */ struct cdrom_read_audio - { - union - { - struct - { - u_char minute; - u_char second; - u_char frame; - } msf; - int lba; - } addr; /* frame address */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ - int nframes; /* number of 2352-byte-frames to read at once, limited by the drivers */ - u_char *buf; /* frame buffer (size: nframes*2352 bytes) */ - }; +{ + union cdrom_addr addr; /* frame address */ + u_char addr_format; /* CDROM_LBA or CDROM_MSF */ + int nframes; /* number of 2352-byte-frames to read at once, limited by the drivers */ + u_char *buf; /* frame buffer (size: nframes*2352 bytes) */ +}; /* * this has to be the "arg" of the CDROMMULTISESSION ioctl @@ -340,20 +196,11 @@ struct cdrom_read_audio * The returned "addr" is valid only if "xa_flag" is true. */ struct cdrom_multisession - { - union - { - struct - { - u_char minute; - u_char second; - u_char frame; - } msf; - int lba; - } addr; /* frame address: start-of-last-session (not the new "frame 16"!)*/ - u_char xa_flag; /* 1: "is XA disk" */ - u_char addr_format; /* CDROM_LBA or CDROM_MSF */ - }; +{ + union cdrom_addr addr; /* frame address: start-of-last-session (not the new "frame 16"!)*/ + u_char xa_flag; /* 1: "is XA disk" */ + u_char addr_format; /* CDROM_LBA or CDROM_MSF */ +}; #ifdef FIVETWELVE #define CDROM_MODE1_SIZE 512 @@ -364,54 +211,235 @@ struct cdrom_multisession /* * CD-ROM IOCTL commands + * For IOCTL calls, we will commandeer byte 0x53, or 'S'. */ -#define CDROMPAUSE 0x5301 /* pause */ -#define CDROMRESUME 0x5302 /* resume */ +#define CDROMPAUSE 0x5301 +#define CDROMRESUME 0x5302 +#define CDROMPLAYMSF 0x5303 /* (struct cdrom_msf) */ +#define CDROMPLAYTRKIND 0x5304 /* (struct cdrom_ti) */ -#define CDROMPLAYMSF 0x5303 /* (struct cdrom_msf) */ - /* SCMD_PLAY_AUDIO_MSF */ +#define CDROMREADTOCHDR 0x5305 /* (struct cdrom_tochdr) */ +#define CDROMREADTOCENTRY 0x5306 /* (struct cdrom_tocentry) */ -#define CDROMPLAYTRKIND 0x5304 /* (struct cdrom_ti) */ - /* SCMD_PLAY_AUDIO_TI */ +#define CDROMSTOP 0x5307 /* stop the drive motor */ +#define CDROMSTART 0x5308 /* turn the motor on */ -#define CDROMREADTOCHDR 0x5305 /* (struct cdrom_tochdr) */ - /* read the TOC header */ -#define CDROMREADTOCENTRY 0x5306 /* (struct cdrom_tocentry) */ - /* read a TOC entry */ +#define CDROMEJECT 0x5309 /* eject CD-ROM media */ -#define CDROMSTOP 0x5307 /* stop the drive motor */ -#define CDROMSTART 0x5308 /* turn the motor on */ +#define CDROMVOLCTRL 0x530a /* (struct cdrom_volctrl) */ -#define CDROMEJECT 0x5309 /* eject CD-ROM media */ +#define CDROMSUBCHNL 0x530b /* (struct cdrom_subchnl) */ -#define CDROMVOLCTRL 0x530a /* (struct cdrom_volctrl) */ - /* volume control */ +#define CDROMREADMODE2 0x530c /* (struct cdrom_read) */ + /* read type-2 data */ -#define CDROMSUBCHNL 0x530b /* (struct cdrom_subchnl) */ - /* read Q sub-channel data */ +#define CDROMREADMODE1 0x530d /* (struct cdrom_read) */ + /* read type-1 data */ -#define CDROMREADMODE2 0x530c /* (struct cdrom_read) */ - /* read type-2 data (not suppt) */ +#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ -#define CDROMREADMODE1 0x530d /* (struct cdrom_read) */ - /* read type-1 data */ -/* - * preliminary extension for transferring audio frames - * currently used by cdu31a.c and sbpcd.c - * (still may change if other drivers will use it, too): - */ -#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ /* - * preliminary extension for enable (1) / disable (0) auto-ejecting - * currently used by sbpcd.c - * (still may change if other drivers will use it, too): + * enable (1) / disable (0) auto-ejecting */ -#define CDROMEJECT_SW 0x530f /* arg: 0 or 1 */ +#define CDROMEJECT_SW 0x530f /* arg: 0 or 1 */ /* * obtain the start-of-last-session address of multi session disks */ -#define CDROMMULTISESSION 0x5310 /* (struct cdrom_multisession) */ +#define CDROMMULTISESSION 0x5310 /* (struct cdrom_multisession) */ + +/* + * obtain the "universal product code" number + * (only some data disks have it coded) + */ +#define CDROM_GET_UPC 0x5311 /* 8 bytes returned */ + +#define CDROMRESET 0x5312 /* hard-reset the drive */ +#define CDROMVOLREAD 0x5313 /* let the drive tell its volume setting */ + /* (struct cdrom_volctrl) */ + +/* + * these ioctls are used in aztcd.c and optcd.c + */ +#define CDROMREADRAW 0x5314 /* read data in raw mode */ +#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */ +#define CDROMSEEK 0x5316 /* seek msf address */ + +/* + * for playing audio in logical block addressing mode + */ +#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ + +/* + * these ioctls are used in optcd.c + */ +#define CDROMREADALL 0x5318 /* read all 2646 bytes */ +#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ + + +/* + * CD-ROM-specific SCSI command opcodes + */ + +/* + * Group 2 (10-byte). All of these are called 'optional' by SCSI-II. + */ +#define SCMD_READ_TOC 0x43 /* read table of contents */ +#define SCMD_PLAYAUDIO_MSF 0x47 /* play data at time offset */ +#define SCMD_PLAYAUDIO_TI 0x48 /* play data at track/index */ +#define SCMD_PAUSE_RESUME 0x4B /* pause/resume audio */ +#define SCMD_READ_SUBCHANNEL 0x42 /* read SC info on playing disc */ +#define SCMD_PLAYAUDIO10 0x45 /* play data at logical block */ +#define SCMD_READ_HEADER 0x44 /* read TOC header */ + +/* + * Group 5 + */ +#define SCMD_PLAYAUDIO12 0xA5 /* play data at logical block */ +#define SCMD_PLAYTRACK_REL12 0xA9 /* play track at relative offset */ + +/* + * Group 6 Commands + */ +#define SCMD_CD_PLAYBACK_CONTROL 0xC9 /* Sony vendor-specific audio */ +#define SCMD_CD_PLAYBACK_STATUS 0xC4 /* control opcodes */ + +/* + * CD-ROM capacity structure. + */ +struct scsi_capacity +{ + u_long capacity; + u_long lbasize; +}; + +/* + * CD-ROM MODE_SENSE/MODE_SELECT parameters + */ +#define ERR_RECOVERY_PARMS 0x01 +#define DISCO_RECO_PARMS 0x02 +#define FORMAT_PARMS 0x03 +#define GEOMETRY_PARMS 0x04 +#define CERTIFICATION_PARMS 0x06 +#define CACHE_PARMS 0x38 + +/* + * standard mode-select header prepended to all mode-select commands + */ +struct ccs_modesel_head +{ + u_char _r1; /* reserved */ + u_char medium; /* device-specific medium type */ + u_char _r2; /* reserved */ + u_char block_desc_length; /* block descriptor length */ + u_char density; /* device-specific density code */ + u_char number_blocks_hi; /* number of blocks in this block desc */ + u_char number_blocks_med; + u_char number_blocks_lo; + u_char _r3; + u_char block_length_hi; /* block length for blocks in this desc */ + u_short block_length; +}; + +/* + * error recovery parameters + */ +struct ccs_err_recovery +{ + u_char _r1 : 2; /* reserved */ + u_char page_code : 6; /* page code */ + u_char page_length; /* page length */ + u_char awre : 1; /* auto write realloc enabled */ + u_char arre : 1; /* auto read realloc enabled */ + u_char tb : 1; /* transfer block */ + u_char rc : 1; /* read continuous */ + u_char eec : 1; /* enable early correction */ + u_char per : 1; /* post error */ + u_char dte : 1; /* disable transfer on error */ + u_char dcr : 1; /* disable correction */ + u_char retry_count; /* error retry count */ + u_char correction_span; /* largest recov. to be attempted, bits */ + u_char head_offset_count; /* head offset (2's C) for each retry */ + u_char strobe_offset_count; /* data strobe */ + u_char recovery_time_limit; /* time limit on recovery attempts */ +}; + +/* + * disco/reco parameters + */ +struct ccs_disco_reco +{ + u_char _r1 : 2; /* reserved */ + u_char page_code : 6; /* page code */ + u_char page_length; /* page length */ + u_char buffer_full_ratio; /* write buffer reconnect threshold */ + u_char buffer_empty_ratio; /* read */ + u_short bus_inactivity_limit; /* limit on bus inactivity time */ + u_short disconnect_time_limit; /* minimum disconnect time */ + u_short connect_time_limit; /* minimum connect time */ + u_short _r2; /* reserved */ +}; + +/* + * drive geometry parameters + */ +struct ccs_geometry +{ + u_char _r1 : 2; /* reserved */ + u_char page_code : 6; /* page code */ + u_char page_length; /* page length */ + u_char cyl_ub; /* #cyls */ + u_char cyl_mb; + u_char cyl_lb; + u_char heads; /* #heads */ + u_char precomp_cyl_ub; /* precomp start */ + u_char precomp_cyl_mb; + u_char precomp_cyl_lb; + u_char current_cyl_ub; /* reduced current start */ + u_char current_cyl_mb; + u_char current_cyl_lb; + u_short step_rate; /* stepping motor rate */ + u_char landing_cyl_ub; /* landing zone */ + u_char landing_cyl_mb; + u_char landing_cyl_lb; + u_char _r2; + u_char _r3; + u_char _r4; +}; + +/* + * cache parameters + */ +struct ccs_cache +{ + u_char _r1 : 2; /* reserved */ + u_char page_code : 6; /* page code */ + u_char page_length; /* page length */ + u_char mode; /* cache control byte */ + u_char threshold; /* prefetch threshold */ + u_char max_prefetch; /* maximum prefetch size */ + u_char max_multiplier; /* maximum prefetch multiplier */ + u_char min_prefetch; /* minimum prefetch size */ + u_char min_multiplier; /* minimum prefetch multiplier */ + u_char _r2[8]; +}; #endif _LINUX_CDROM_H +/*==========================================================================*/ +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-indent-level: 8 + * c-brace-imaginary-offset: 0 + * c-brace-offset: -8 + * c-argdecl-indent: 8 + * c-label-offset: -8 + * c-continued-statement-offset: 8 + * c-continued-brace-offset: 0 + * End: + */ diff --git a/include/linux/cdu31a.h b/include/linux/cdu31a.h index fc1150fef..269e7b614 100644 --- a/include/linux/cdu31a.h +++ b/include/linux/cdu31a.h @@ -66,16 +66,16 @@ #define LOG_START_OFFSET 150 /* Offset of first logical sector */ -#define SONY_DETECT_TIMEOUT 80 /* Maximum amount of time +#define SONY_DETECT_TIMEOUT (8*HZ/10) /* Maximum amount of time that drive detection code will wait for response from drive (in 1/100th's of seconds). */ -#define SONY_JIFFIES_TIMEOUT 1000 /* Maximum number of times the +#define SONY_JIFFIES_TIMEOUT 1000 /* Maximum number of times the drive will wait/try for an operation */ -#define SONY_RESET_TIMEOUT 100 /* Maximum number of times the +#define SONY_RESET_TIMEOUT 100 /* Maximum number of times the drive will wait/try a reset operation */ #define SONY_READY_RETRIES 20000 /* How many times to retry a @@ -134,6 +134,13 @@ #define SONY_SD_AUTO_SPIN_DOWN_TIME 0x06 /* + * The following are parameter bits for the mechanical control command + */ +#define SONY_AUTO_SPIN_UP_BIT 0x01 +#define SONY_AUTO_EJECT_BIT 0x02 +#define SONY_DOUBLE_SPEED_BIT 0x04 + +/* * The following extract information from the drive configuration about * the drive itself. */ diff --git a/include/linux/cm206.h b/include/linux/cm206.h new file mode 100644 index 000000000..671a46f31 --- /dev/null +++ b/include/linux/cm206.h @@ -0,0 +1,177 @@ +/* cm206.h Header file for cm206.c. + Copyright (c) 1995 David van Leeuwen +*/ + +#ifndef LINUX_CM206_H +#define LINUX_CM206_H + +#include <linux/ioctl.h> + +/* First, the cm260 stuff */ +/* The ports and irq used. Although CM206_BASE and CM206_IRQ are defined + below, the values are not used unless autoprobing is turned off and + no LILO boot options or module command line options are given. Change + these values to your own as last resort if autoprobing and options + don't work. */ + +#define CM206_BASE 0x340 +#define CM206_IRQ 11 + +#define r_data_status (cm206_base) +#define r_uart_receive (cm206_base+0x2) +#define r_fifo_output_buffer (cm206_base+0x4) +#define r_line_status (cm206_base+0x6) +#define r_data_control (cm206_base+0x8) +#define r_uart_transmit (cm206_base+0xa) +#define r_test_clock (cm206_base+0xc) +#define r_test_control (cm206_base+0xe) + +/* the data_status flags */ +#define ds_ram_size 0x4000 +#define ds_toc_ready 0x2000 +#define ds_fifo_empty 0x1000 +#define ds_sync_error 0x800 +#define ds_crc_error 0x400 +#define ds_data_error 0x200 +#define ds_fifo_overflow 0x100 +#define ds_data_ready 0x80 + +/* the line_status flags */ +#define ls_attention 0x10 +#define ls_parity_error 0x8 +#define ls_overrun 0x4 +#define ls_receive_buffer_full 0x2 +#define ls_transmitter_buffer_empty 0x1 + +/* the data control register flags */ +#define dc_read_q_channel 0x4000 +#define dc_mask_sync_error 0x2000 +#define dc_toc_enable 0x1000 +#define dc_no_stop_on_error 0x800 +#define dc_break 0x400 +#define dc_initialize 0x200 +#define dc_mask_transmit_ready 0x100 +#define dc_flag_enable 0x80 + +/* Define the default data control register flags here */ +#define dc_normal (dc_mask_sync_error | dc_no_stop_on_error | \ + dc_mask_transmit_ready) + +/* now some constants related to the cm206 */ +/* another drive status byte, echoed by the cm206 on most commands */ + +#define dsb_error_condition 0x1 +#define dsb_play_in_progress 0x4 +#define dsb_possible_media_change 0x8 +#define dsb_disc_present 0x10 +#define dsb_drive_not_ready 0x20 +#define dsb_tray_locked 0x40 +#define dsb_tray_not_closed 0x80 + +#define dsb_not_useful (dsb_drive_not_ready | dsb_tray_not_closed) + +/* the cm206 command set */ + +#define c_close_tray 0 +#define c_lock_tray 0x01 +#define c_unlock_tray 0x04 +#define c_open_tray 0x05 +#define c_seek 0x10 +#define c_read_data 0x20 +#define c_force_1x 0x21 +#define c_force_2x 0x22 +#define c_auto_mode 0x23 +#define c_play 0x30 +#define c_set_audio_mode 0x31 +#define c_read_current_q 0x41 +#define c_stream_q 0x42 +#define c_drive_status 0x50 +#define c_disc_status 0x51 +#define c_audio_status 0x52 +#define c_drive_configuration 0x53 +#define c_read_upc 0x60 +#define c_stop 0x70 +#define c_calc_checksum 0xe5 + +#define c_gimme 0xf8 + +/* finally, the (error) condition that the drive can be in * + * OK, this is not always an error, but let's prefix it with e_ */ + +#define e_none 0 +#define e_illegal_command 0x01 +#define e_sync 0x02 +#define e_seek 0x03 +#define e_parity 0x04 +#define e_focus 0x05 +#define e_header_sync 0x06 +#define e_code_incompatibility 0x07 +#define e_reset_done 0x08 +#define e_bad_parameter 0x09 +#define e_radial 0x0a +#define e_sub_code 0x0b +#define e_no_data_track 0x0c +#define e_scan 0x0d +#define e_tray_open 0x0f +#define e_no_disc 0x10 +#define e_tray stalled 0x11 + +/* drive configuration masks */ + +#define dcf_revision_code 0x7 +#define dcf_transfer_rate 0x60 +#define dcf_motorized_tray 0x80 + +/* disc status byte */ + +#define cds_multi_session 0x2 +#define cds_all_audio 0x8 +#define cds_xa_mode 0xf0 + +/* finally some ioctls for the driver */ + +#define CM206CTL_GET_STAT _IO( 0x20, 0 ) +#define CM206CTL_GET_LAST_STAT _IO( 0x20, 1 ) + +/* for kernel 1.2.n */ +#if !defined(CDROM_GET_UPC) +#define CDROM_GET_UPC _IO( 'S', 0x11 ) +#define CDROMRESET _IO( 'S', 0x12 ) +#endif + +#ifdef STATISTICS + +/* This is an ugly way to guarantee that the names of the statistics + * are the same in the code and in the diagnostics program. */ + +#ifdef __KERNEL__ +#define x(a) st_ ## a +#define y enum +#else +#define x(a) #a +#define y char * stats_name[] = +#endif + +y {x(interrupt), x(data_ready), x(fifo_overflow), x(data_error), + x(crc_error), x(sync_error), x(lost_intr), x(echo), + x(write_timeout), x(receive_timeout), x(read_timeout), + x(dsb_timeout), x(stop_0xff), x(back_read_timeout), + x(sector_transferred), x(read_restarted), x(read_background), + x(bh), x(open), x(ioctl_multisession), x(attention) +#ifdef __KERNEL__ + , x(last_entry) +#endif + }; + +#ifdef __KERNEL__ +#define NR_STATS st_last_entry +#else +#define NR_STATS (sizeof(stats_name)/sizeof(char*)) +#endif + +#undef y +#undef x + +#endif STATISTICS + +#endif LINUX_CM206_H diff --git a/include/linux/comstats.h b/include/linux/comstats.h new file mode 100644 index 000000000..8f7591f38 --- /dev/null +++ b/include/linux/comstats.h @@ -0,0 +1,118 @@ +/*****************************************************************************/ + +/* + * comstats.h -- Serial Port Stats. + * + * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _COMSTATS_H +#define _COMSTATS_H +/*****************************************************************************/ + +/* + * Serial port stats structure. The structure itself is UART + * independent, but some fields may be UART/driver specific (for + * example state). + */ + +typedef struct { + unsigned long brd; + unsigned long panel; + unsigned long port; + unsigned long hwid; + unsigned long type; + unsigned long txtotal; + unsigned long rxtotal; + unsigned long txbuffered; + unsigned long rxbuffered; + unsigned long rxoverrun; + unsigned long rxparity; + unsigned long rxframing; + unsigned long rxlost; + unsigned long txbreaks; + unsigned long rxbreaks; + unsigned long txxon; + unsigned long txxoff; + unsigned long rxxon; + unsigned long rxxoff; + unsigned long txctson; + unsigned long txctsoff; + unsigned long rxrtson; + unsigned long rxrtsoff; + unsigned long modem; + unsigned long state; + unsigned long flags; + unsigned long ttystate; + unsigned long cflags; + unsigned long iflags; + unsigned long oflags; + unsigned long lflags; + unsigned long signals; +} comstats_t; + + +/* + * Board stats structure. Returns useful info about the board. + */ + +#define COM_MAXPANELS 8 + +typedef struct { + unsigned long panel; + unsigned long type; + unsigned long hwid; + unsigned long nrports; +} companel_t; + +typedef struct { + unsigned long brd; + unsigned long type; + unsigned long hwid; + unsigned long state; + unsigned long ioaddr; + unsigned long ioaddr2; + unsigned long memaddr; + unsigned long irq; + unsigned long nrpanels; + unsigned long nrports; + companel_t panels[COM_MAXPANELS]; +} combrd_t; + + +/* + * Define the ioctl operations for stats stuff. + */ +#include <linux/ioctl.h> + +#define COM_GETPORTSTATS _IO('c',30) +#define COM_CLRPORTSTATS _IO('c',31) +#define COM_GETBRDSTATS _IO('c',32) + + +/* + * Define the set of ioctls that give user level access to the + * private port, panel and board structures. The argument required + * will be driver dependent! + */ +#define COM_READPORT _IO('c',40) +#define COM_READBOARD _IO('c',41) +#define COM_READPANEL _IO('c',42) + +/*****************************************************************************/ +#endif diff --git a/include/linux/config.h b/include/linux/config.h index a54cdff20..790cff448 100644 --- a/include/linux/config.h +++ b/include/linux/config.h @@ -27,7 +27,9 @@ * in linux/version.h, and should only be used by linux/version.c */ -/* Don't touch these, unless you really know what your doing. */ +/* Shouldn't these be defined somewhere in an i386 definition? */ + +/* Don't touch these, unless you really know what you're doing. */ #define DEF_INITSEG 0x9000 #define DEF_SYSSEG 0x1000 #define DEF_SETUPSEG 0x9020 diff --git a/include/linux/console.h b/include/linux/console.h new file mode 100644 index 000000000..80a1c5e69 --- /dev/null +++ b/include/linux/console.h @@ -0,0 +1,124 @@ +/* + * linux/include/linux/console.h + * + * Copyright (C) 1993 Hamish Macdonald + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + * + * Changed: + * 10-Mar-94: Arno Griffioen: Conversion for vt100 emulator port from PC LINUX + */ + +#ifndef _LINUX_CONSOLE_H_ +#define _LINUX_CONSOLE_H_ 1 + +#define NPAR 16 + +struct vc_data { + unsigned long vc_screenbuf_size; + unsigned short vc_num; /* Console number */ + unsigned short vc_video_erase_char; /* Background erase character */ + unsigned char vc_attr; /* Current attributes */ + unsigned char vc_def_color; /* Default colors */ + unsigned char vc_color; /* Foreground & background */ + unsigned char vc_s_color; /* Saved foreground & background */ + unsigned char vc_ulcolor; /* Colour for underline mode */ + unsigned char vc_halfcolor; /* Colour for half intensity mode */ + unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ + unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ + unsigned short *vc_pos; + unsigned long vc_x,vc_y; + unsigned long vc_top,vc_bottom; + unsigned long vc_rows,vc_cols; + unsigned long vc_size_row; + unsigned long vc_state; + unsigned long vc_npar,vc_par[NPAR]; + unsigned short *vc_video_mem_start; + unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ + unsigned long vc_saved_x; + unsigned long vc_saved_y; + /* mode flags */ + unsigned long vc_charset : 1; /* Character set G0 / G1 */ + unsigned long vc_s_charset : 1; /* Saved character set */ + unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ + unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ + unsigned long vc_decscnm : 1; /* Screen Mode */ + unsigned long vc_decom : 1; /* Origin Mode */ + unsigned long vc_decawm : 1; /* Autowrap Mode */ + unsigned long vc_deccm : 1; /* Cursor Visible */ + unsigned long vc_decim : 1; /* Insert Mode */ + unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ + /* attribute flags */ + unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ + unsigned long vc_underline : 1; + unsigned long vc_blink : 1; + unsigned long vc_reverse : 1; + unsigned long vc_s_intensity : 2; /* saved rendition */ + unsigned long vc_s_underline : 1; + unsigned long vc_s_blink : 1; + unsigned long vc_s_reverse : 1; + /* misc */ + unsigned long vc_ques : 1; + unsigned long vc_need_wrap : 1; + unsigned long vc_can_do_color : 1; + unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ + unsigned long vc_kmalloced : 1; /* kfree_s() needed */ + unsigned long vc_report_mouse : 2; + unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ + unsigned char vc_utf_count; + unsigned long vc_utf_char; + unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ + unsigned short *vc_translate; + unsigned char vc_G0_charset; + unsigned char vc_G1_charset; + unsigned char vc_saved_G0; + unsigned char vc_saved_G1; + unsigned int vc_bell_pitch; /* Console bell pitch */ + unsigned int vc_bell_duration; /* Console bell duration */ + struct consw *vc_sw; + /* additional information is in vt_kern.h */ +}; + +/* + * this is what the terminal answers to a ESC-Z or csi0c query. + */ +#define VT100ID "\033[?1;2c" +#define VT102ID "\033[?6c" + +/* DPC: 1994-04-13 !!! con_putcs is new entry !!! */ + +struct consw { + unsigned long (*con_startup)(unsigned long, char **); + void (*con_init)(struct vc_data *); + int (*con_deinit)(struct vc_data *); + int (*con_clear)(struct vc_data *, int, int, int, int); + int (*con_putc)(struct vc_data *, int, int, int); + int (*con_putcs)(struct vc_data *, const char *, int, int, int); + int (*con_cursor)(struct vc_data *, int); + int (*con_scroll)(struct vc_data *, int, int, int, int); + int (*con_bmove)(struct vc_data *, int, int, int, int, int, int); + int (*con_switch)(struct vc_data *); + int (*con_blank)(int); + int (*con_get_font)(struct vc_data *, int *, int *, char *); + int (*con_set_font)(struct vc_data *, int, int, char *); +}; + +extern struct consw *conswitchp; + +/* flag bits */ +#define CON_INITED (1) + +/* scroll */ +#define SM_UP (1) +#define SM_DOWN (2) +#define SM_LEFT (3) +#define SM_RIGHT (4) + +/* cursor */ +#define CM_DRAW (1) +#define CM_ERASE (2) +#define CM_MOVE (3) + +#endif /* linux/console.h */ diff --git a/include/linux/ctype.h b/include/linux/ctype.h index 838ef933d..bac58b52f 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h @@ -1,6 +1,11 @@ #ifndef _LINUX_CTYPE_H #define _LINUX_CTYPE_H +/* + * NOTE! This ctype does not handle EOF like the standarc C + * library is required to. + */ + #define _U 0x01 /* upper */ #define _L 0x02 /* lower */ #define _D 0x04 /* digit */ @@ -11,24 +16,39 @@ #define _SP 0x80 /* hard space (0x20) */ extern unsigned char _ctype[]; -extern char _ctmp; - -#define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D)) -#define isalpha(c) ((_ctype+1)[c]&(_U|_L)) -#define iscntrl(c) ((_ctype+1)[c]&(_C)) -#define isdigit(c) ((_ctype+1)[c]&(_D)) -#define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D)) -#define islower(c) ((_ctype+1)[c]&(_L)) -#define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP)) -#define ispunct(c) ((_ctype+1)[c]&(_P)) -#define isspace(c) ((_ctype+1)[c]&(_S)) -#define isupper(c) ((_ctype+1)[c]&(_U)) -#define isxdigit(c) ((_ctype+1)[c]&(_D|_X)) - -#define isascii(c) (((unsigned) c)<=0x7f) -#define toascii(c) (((unsigned) c)&0x7f) - -#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp) -#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp) + +#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) + +#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) +#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) +#define iscntrl(c) ((__ismask(c)&(_C)) != 0) +#define isdigit(c) ((__ismask(c)&(_D)) != 0) +#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) +#define islower(c) ((__ismask(c)&(_L)) != 0) +#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) +#define ispunct(c) ((__ismask(c)&(_P)) != 0) +#define isspace(c) ((__ismask(c)&(_S)) != 0) +#define isupper(c) ((__ismask(c)&(_U)) != 0) +#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) + +#define isascii(c) (((unsigned char)(c))<=0x7f) +#define toascii(c) (((unsigned char)(c))&0x7f) + +static inline unsigned char __tolower(unsigned char c) +{ + if (isupper(c)) + c -= 'A'-'a'; + return c; +} + +static inline unsigned char __toupper(unsigned char c) +{ + if (islower(c)) + c -= 'a'-'A'; + return c; +} + +#define tolower(c) __tolower(c) +#define toupper(c) __toupper(c) #endif diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 73f01e26a..efed32b4d 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h @@ -1,13 +1,20 @@ -struct cyclades_card { - int base_addr; - int irq; - int num_chips; /* implies card type, 0 if card is absent */ - int first_line; /* line number of first channel of first chip on card */ -}; +/* + * linux/include/linux/cyclades.h + * + * This file is maintained by Marcio Saito <marcio@cyclades.com> and + * Randolph Bentson <bentson@grieg.seaslug.org>. + * + * This file contains the general definitions for the cyclades.c driver + *$Log: cyclades.h,v $ + * Revision 1.5 1995/11/13 21:13:31 bentson + * changes suggested by Michael Chastain <mec@duracef.shout.net> + * to support use of this file in non-kernel applications + * + * + */ -struct cyclades_chip { - int filler; -}; +#ifndef _LINUX_CYCLADES_H +#define _LINUX_CYCLADES_H struct cyclades_monitor { unsigned long int_count; @@ -16,6 +23,34 @@ struct cyclades_monitor { unsigned long char_last; }; +#define CYCLADES_MAGIC 0x4359 + +#define CYGETMON 0x435901 +#define CYGETTHRESH 0x435902 +#define CYSETTHRESH 0x435903 +#define CYGETDEFTHRESH 0x435904 +#define CYSETDEFTHRESH 0x435905 +#define CYGETTIMEOUT 0x435906 +#define CYSETTIMEOUT 0x435907 +#define CYGETDEFTIMEOUT 0x435908 +#define CYSETDEFTIMEOUT 0x435909 + +#ifdef __KERNEL__ + +/* Per card data structure */ + +struct cyclades_card { + int base_addr; + int irq; + int num_chips; /* 0 if card is absent */ + int first_line; /* minor number of first channel on card */ + int bus_index; /* address shift - 0 for ISA, 1 for PCI */ +}; + +struct cyclades_chip { + int filler; +}; + /* * This is our internal structure for each serial port's state. * @@ -62,18 +97,6 @@ struct cyclades_port { struct cyclades_monitor mon; }; -#define CYCLADES_MAGIC 0x4359 - -#define CYGETMON 0x435901 -#define CYGETTHRESH 0x435902 -#define CYSETTHRESH 0x435903 -#define CYGETDEFTHRESH 0x435904 -#define CYSETDEFTHRESH 0x435905 -#define CYGETTIMEOUT 0x435906 -#define CYSETTIMEOUT 0x435907 -#define CYGETDEFTIMEOUT 0x435908 -#define CYSETDEFTIMEOUT 0x435909 - /* * Events are used to schedule things to happen at timer-interrupt * time, instead of at cy interrupt time. @@ -93,6 +116,7 @@ struct cyclades_port { #define CyRegSize 0x0400 #define Cy_HwReset 0x1400 #define Cy_ClrIntr 0x1800 +#define Cy_EpldRev 0x1e00 /* Global Registers */ @@ -255,3 +279,6 @@ struct cyclades_port { #define CyMAX_CHAR_FIFO 12 /***************************************************************************/ + +#endif /* __KERNEL__ */ +#endif /* _LINUX_CYCLADES_H */ diff --git a/include/linux/debugreg.h b/include/linux/debugreg.h index ba93e10c6..d954a54ca 100644 --- a/include/linux/debugreg.h +++ b/include/linux/debugreg.h @@ -21,7 +21,7 @@ /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 - bytes - each field corresponds to one of the four debug registers, + bits - each field corresponds to one of the four debug registers, and indicates what types of access we trap on, and how large the data field is that we are looking at */ diff --git a/include/linux/dirent.h b/include/linux/dirent.h index 219faf1cb..a18f7e463 100644 --- a/include/linux/dirent.h +++ b/include/linux/dirent.h @@ -1,13 +1,11 @@ #ifndef _LINUX_DIRENT_H #define _LINUX_DIRENT_H -#include <linux/limits.h> - struct dirent { long d_ino; - off_t d_off; + __kernel_off_t d_off; unsigned short d_reclen; - char d_name[NAME_MAX+1]; + char d_name[256]; /* We must not include limits.h! */ }; #endif diff --git a/include/linux/elf.h b/include/linux/elf.h index 52dedbda4..3487041ba 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h @@ -1,6 +1,8 @@ #ifndef _LINUX_ELF_H #define _LINUX_ELF_H +#include <asm/elf.h> + typedef unsigned long Elf32_Addr; typedef unsigned short Elf32_Half; typedef unsigned long Elf32_Off; @@ -54,6 +56,25 @@ typedef unsigned long Elf32_Word; #define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */ #define EM_PARISC 15 +#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ + +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ + +#define EM_SPARC64 11 /* SPARC v9 (not official) 64-bit */ + +#define EM_PARISC 15 /* HPPA */ + +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ + +#define EM_PPC 20 /* PowerPC */ + +/* + * This is an interim value that we will use until the committee comes + * up with a final number. + */ +#define EM_ALPHA 0x9026 + + /* This is the info that is needed to parse the dynamic section of the file */ #define DT_NULL 0 #define DT_NEEDED 1 @@ -115,6 +136,23 @@ typedef unsigned long Elf32_Word; #define ELF32_ST_BIND(x) ((x) >> 4) #define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) +/* Symbolic values for the entries in the auxiliary table + put on the initial stack */ +#define AT_NULL 0 /* end of vector */ +#define AT_IGNORE 1 /* entry should be ignored */ +#define AT_EXECFD 2 /* file descriptor of program */ +#define AT_PHDR 3 /* program headers for program */ +#define AT_PHENT 4 /* size of program header entry */ +#define AT_PHNUM 5 /* number of program headers */ +#define AT_PAGESZ 6 /* system page size */ +#define AT_BASE 7 /* base address of interpreter */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point of program */ +#define AT_NOTELF 10 /* program is not ELF */ +#define AT_UID 11 /* real uid */ +#define AT_EUID 12 /* effective uid */ +#define AT_GID 13 /* real gid */ +#define AT_EGID 14 /* effective gid */ typedef struct dynamic{ @@ -125,7 +163,13 @@ typedef struct dynamic{ } d_un; } Elf32_Dyn; -extern Elf32_Dyn _DYNAMIC []; +typedef struct { + unsigned long long d_tag; /* entry tag value */ + union { + unsigned long long d_val; + unsigned long long d_ptr; + } d_un; +} Elf64_Dyn; /* The following are used with relocations */ #define ELF32_R_SYM(x) ((x) >> 8) @@ -168,28 +212,53 @@ extern Elf32_Dyn _DYNAMIC []; #define R_MIPS_GOT_DISP 19 #define R_MIPS_GOT_PAGE 20 #define R_MIPS_GOT_OFST 21 -#define R_MIPS_GOT_HI16 22 -#define R_MIPS_GOT_LO16 23 +/* + * The following two relocation types are specified in the the MIPS ABI + * conformance guide version 1.2 but not yet in the psABI. + */ +#define R_MIPS_GOTHI16 22 +#define R_MIPS_GOTLO16 23 #define R_MIPS_SUB 24 #define R_MIPS_INSERT_A 25 #define R_MIPS_INSERT_B 26 #define R_MIPS_DELETE 27 #define R_MIPS_HIGHER 28 #define R_MIPS_HIGHEST 29 -#define R_MIPS_CALL_HI16 30 -#define R_MIPS_CALL_LO16 31 +/* + * The following two relocation types are specified in the the MIPS ABI + * conformance guide version 1.2 but not yet in the psABI. + */ +#define R_MIPS_CALLHI16 30 +#define R_MIPS_CALLLO16 31 +/* + * This range is reserved for vendor specific relocations. + */ +#define R_MIPS_LOVENDOR 100 +#define R_MIPS_HIVENDOR 127 + typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; +typedef struct elf64_rel { + unsigned long long r_offset; /* Location at which to apply the action */ + unsigned long long r_info; /* index and type of relocation */ +} Elf64_Rel; + typedef struct elf32_rela{ Elf32_Addr r_offset; Elf32_Word r_info; Elf32_Sword r_addend; } Elf32_Rela; +typedef struct elf64_rela { + unsigned long long r_offset; /* Location at which to apply the action */ + unsigned long long r_info; /* index and type of relocation */ + unsigned long long r_addend; /* Constant addend used to compute value */ +} Elf64_Rela; + typedef struct elf32_sym{ Elf32_Word st_name; Elf32_Addr st_value; @@ -199,10 +268,19 @@ typedef struct elf32_sym{ Elf32_Half st_shndx; } Elf32_Sym; +typedef struct elf64_sym { + unsigned int st_name; /* Symbol name, index in string tbl */ + unsigned char st_info; /* Type and binding attributes */ + unsigned char st_other; /* No defined meaning, 0 */ + unsigned short st_shndx; /* Associated section index */ + unsigned long long st_value; /* Value of the symbol */ + unsigned long long st_size; /* Associated symbol size */ +} Elf64_Sym; + #define EI_NIDENT 16 -typedef struct elfhdr{ +typedef struct elf32_hdr{ unsigned char e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; @@ -219,13 +297,30 @@ typedef struct elfhdr{ Elf32_Half e_shstrndx; } Elf32_Ehdr; +typedef struct elf64_hdr { + unsigned char e_ident[16]; /* ELF "magic number" */ + short int e_type; + short unsigned int e_machine; + int e_version; + unsigned long long e_entry; /* Entry point virtual address */ + unsigned long long e_phoff; /* Program header table file offset */ + unsigned long long e_shoff; /* Section header table file offset */ + int e_flags; + short int e_ehsize; + short int e_phentsize; + short int e_phnum; + short int e_shentsize; + short int e_shnum; + short int e_shstrndx; +} Elf64_Ehdr; + /* These constants define the permissions on sections in the program header, p_flags. */ #define PF_R 0x4 #define PF_W 0x2 #define PF_X 0x1 -typedef struct elf_phdr{ +typedef struct elf32_phdr{ Elf32_Word p_type; Elf32_Off p_offset; Elf32_Addr p_vaddr; @@ -236,6 +331,17 @@ typedef struct elf_phdr{ Elf32_Word p_align; } Elf32_Phdr; +typedef struct elf64_phdr { + int p_type; + int p_flags; + unsigned long long p_offset; /* Segment file offset */ + unsigned long long p_vaddr; /* Segment virtual address */ + unsigned long long p_paddr; /* Segment physical address */ + unsigned long long p_filesz; /* Segment size in file */ + unsigned long long p_memsz; /* Segment size in memory */ + unsigned long long p_align; /* Segment alignment, file & memory */ +} Elf64_Phdr; + /* sh_type */ #define SHT_NULL 0 #define SHT_PROGBITS 1 @@ -289,6 +395,19 @@ typedef struct { Elf32_Word sh_entsize; } Elf32_Shdr; +typedef struct elf64_shdr { + unsigned int sh_name; /* Section name, index in string tbl */ + unsigned int sh_type; /* Type of section */ + unsigned long long sh_flags; /* Miscellaneous section attributes */ + unsigned long long sh_addr; /* Section virtual addr at execution */ + unsigned long long sh_offset; /* Section file offset */ + unsigned long long sh_size; /* Size of section in bytes */ + unsigned int sh_link; /* Index of another section */ + unsigned int sh_info; /* Additional section information */ + unsigned long long sh_addralign; /* Section alignment */ + unsigned long long sh_entsize; /* Entry size if section holds table */ +} Elf64_Shdr; + #define EI_MAG0 0 /* e_ident[] indexes */ #define EI_MAG1 1 #define EI_MAG2 2 @@ -325,12 +444,41 @@ typedef struct { #define NT_TASKSTRUCT 4 /* Note header in a PT_NOTE section */ -typedef struct elf_note { +typedef struct elf32_note { Elf32_Word n_namesz; /* Name size */ Elf32_Word n_descsz; /* Content size */ Elf32_Word n_type; /* Content type */ } Elf32_Nhdr; +/* Note header in a PT_NOTE section */ +/* + * For now we use the 32 bit version of the structure until we figure + * out whether we need anything better. Note - on the Alpha, "unsigned int" + * is only 32 bits. + */ +typedef struct elf64_note { + unsigned int n_namesz; /* Name size */ + unsigned int n_descsz; /* Content size */ + unsigned int n_type; /* Content type */ +} Elf64_Nhdr; + #define ELF_START_MMAP 0x80000000 +#if ELF_CLASS == ELFCLASS32 + +extern Elf32_Dyn _DYNAMIC []; +#define elfhdr elf32_hdr +#define elf_phdr elf32_phdr +#define elf_note elf32_note + +#else + +extern Elf64_Dyn _DYNAMIC []; +#define elfhdr elf64_hdr +#define elf_phdr elf64_phdr +#define elf_note elf64_note + +#endif + + #endif /* _LINUX_ELF_H */ diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h new file mode 100644 index 000000000..2fe53ca3d --- /dev/null +++ b/include/linux/elfcore.h @@ -0,0 +1,88 @@ +#ifndef _LINUX_ELFCORE_H +#define _LINUX_ELFCORE_H + +#include <linux/types.h> +#include <linux/signal.h> +#include <linux/time.h> +#include <linux/ptrace.h> +#include <linux/user.h> + +struct elf_siginfo +{ + int si_signo; /* signal number */ + int si_code; /* extra code */ + int si_errno; /* errno */ +}; + +#include <asm/elf.h> + +#ifndef __KERNEL__ +typedef elf_greg_t greg_t; +typedef elf_gregset_t gregset_t; +typedef elf_fpregset_t fpregset_t; +#define NGREG ELF_NGREG +#endif + +/* + * Definitions to generate Intel SVR4-like core files. + * These mostly have the same names as the SVR4 types with "elf_" + * tacked on the front to prevent clashes with linux definitions, + * and the typedef forms have been avoided. This is mostly like + * the SVR4 structure, but more Linuxy, with things that Linux does + * not support and which gdb doesn't really use excluded. + * Fields present but not used are marked with "XXX". + */ +struct elf_prstatus +{ +#if 0 + long pr_flags; /* XXX Process flags */ + short pr_why; /* XXX Reason for process halt */ + short pr_what; /* XXX More detailed reason */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal */ + short pr_cursig; /* Current signal */ + sigset_t pr_sigpend; /* Set of pending signals */ + sigset_t pr_sighold; /* Set of held signals */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info */ + struct sigaction pr_action; /* Signal action for current sig */ +#endif + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct timeval pr_utime; /* User time */ + struct timeval pr_stime; /* System time */ + struct timeval pr_cutime; /* Cumulative user time */ + struct timeval pr_cstime; /* Cumulative system time */ +#if 0 + long pr_instr; /* Current instruction */ +#endif + elf_gregset_t pr_reg; /* GP registers */ + int pr_fpvalid; /* True if math co-processor being used. */ +}; + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo +{ + char pr_state; /* numeric process state */ + char pr_sname; /* char for pr_state */ + char pr_zomb; /* zombie */ + char pr_nice; /* nice val */ + unsigned long pr_flag; /* flags */ + uid_t pr_uid; + gid_t pr_gid; + pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ +}; + +#ifndef __KERNEL__ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; +#define PRARGSZ ELF_PRARGSZ +#endif + +#endif /* _LINUX_ELFCORE_H */ diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 41073fcba..9f8b97ccf 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -28,13 +28,18 @@ #include <linux/if_ether.h> #ifdef __KERNEL__ -extern int eth_header(unsigned char *buff, struct device *dev, +extern int eth_header(struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, - void *saddr, unsigned len, - struct sk_buff *skb); + void *saddr, unsigned len); extern int eth_rebuild_header(void *buff, struct device *dev, - unsigned long raddr, struct sk_buff *skb); + unsigned long dst, struct sk_buff *skb); extern unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev); +extern void eth_header_cache_bind(struct hh_cache ** hhp, struct device *dev, + unsigned short htype, __u32 daddr); +extern void eth_header_cache_update(struct hh_cache *hh, struct device *dev, unsigned char * haddr); +extern void eth_copy_and_sum(struct sk_buff *dest, + unsigned char *src, int length, int base); +extern struct device * init_etherdev(struct device *, int); #endif diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index c96a04dc3..bd87ebcf5 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -28,21 +28,6 @@ #undef EXT2FS_DEBUG /* - * Define EXT2FS_DEBUG_CACHE to produce cache debug messages - */ -#undef EXT2FS_DEBUG_CACHE - -/* - * Define EXT2FS_CHECK_CACHE to add some checks to the name cache code - */ -#undef EXT2FS_CHECK_CACHE - -/* - * Define EXT2FS_PRE_02B_COMPAT to convert ext 2 fs prior to 0.2b - */ -#undef EXT2FS_PRE_02B_COMPAT - -/* * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files */ #define EXT2_PREALLOCATE @@ -50,8 +35,8 @@ /* * The second extended file system version */ -#define EXT2FS_DATE "95/03/19" -#define EXT2FS_VERSION "0.5a" +#define EXT2FS_DATE "95/08/09" +#define EXT2FS_VERSION "0.5b" /* * Debug code @@ -75,12 +60,13 @@ #define EXT2_ACL_DATA_INO 4 /* ACL inode */ #define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ #define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ -#define EXT2_FIRST_INO 11 /* First non reserved inode */ + +/* First non-reserved inode for old ext2 filesystems */ +#define EXT2_GOOD_OLD_FIRST_INO 11 /* * The second extended file system magic number */ -#define EXT2_PRE_02B_MAGIC 0xEF51 #define EXT2_SUPER_MAGIC 0xEF53 /* @@ -102,11 +88,22 @@ #define EXT2_ACLE_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry)) #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) #ifdef __KERNEL__ -# define EXT2_BLOCK_SIZE_BITS(s) ((s)->u.ext2_sb.s_es->s_log_block_size + 10) +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) #else # define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) #endif -#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_inode)) +#ifdef __KERNEL__ +#define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits) +#define EXT2_INODE_SIZE(s) ((s)->u.ext2_sb.s_inode_size) +#define EXT2_FIRST_INO(s) ((s)->u.ext2_sb.s_first_ino) +#else +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_INODE_SIZE : \ + (s)->s_inode_size) +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_FIRST_INO : \ + (s)->s_first_ino) +#endif /* * Macro-instructions used to manage fragments @@ -147,15 +144,6 @@ struct ext2_acl_entry /* Access Control List Entry */ /* * Structure of a blocks group descriptor */ -struct ext2_old_group_desc -{ - __u32 bg_block_bitmap; /* Blocks bitmap block */ - __u32 bg_inode_bitmap; /* Inodes bitmap block */ - __u32 bg_inode_table; /* Inodes table block */ - __u16 bg_free_blocks_count; /* Free blocks count */ - __u16 bg_free_inodes_count; /* Free inodes count */ -}; - struct ext2_group_desc { __u32 bg_block_bitmap; /* Blocks bitmap block */ @@ -175,6 +163,7 @@ struct ext2_group_desc # define EXT2_BLOCKS_PER_GROUP(s) ((s)->u.ext2_sb.s_blocks_per_group) # define EXT2_DESC_PER_BLOCK(s) ((s)->u.ext2_sb.s_desc_per_block) # define EXT2_INODES_PER_GROUP(s) ((s)->u.ext2_sb.s_inodes_per_group) +# define EXT2_DESC_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_desc_per_block_bits) #else # define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) # define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) @@ -200,7 +189,8 @@ struct ext2_group_desc #define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ #define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ - +#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ + /* * ioctl commands */ @@ -347,22 +337,58 @@ struct ext2_super_block { __u16 s_magic; /* Magic signature */ __u16 s_state; /* File system state */ __u16 s_errors; /* Behaviour when detecting errors */ - __u16 s_pad; + __u16 s_minor_rev_level; /* minor revision level */ __u32 s_lastcheck; /* time of last check */ __u32 s_checkinterval; /* max. time between checks */ __u32 s_creator_os; /* OS */ __u32 s_rev_level; /* Revision level */ __u16 s_def_resuid; /* Default uid for reserved blocks */ __u16 s_def_resgid; /* Default gid for reserved blocks */ - __u32 s_reserved[235]; /* Padding to the end of the block */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + __u32 s_first_ino; /* First non-reserved inode */ + __u16 s_inode_size; /* size of inode structure */ + __u16 s_block_group_nr; /* block group # of this superblock */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u32 s_reserved[230]; /* Padding to the end of the block */ }; +/* + * Codes for operating systems + */ #define EXT2_OS_LINUX 0 #define EXT2_OS_HURD 1 #define EXT2_OS_MASIX 2 +#define EXT2_OS_FREEBSD 3 +#define EXT2_OS_LITES 4 + +/* + * Revision levels + */ +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ -#define EXT2_CURRENT_REV 0 +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV +#define EXT2_GOOD_OLD_INODE_SIZE 128 + +/* + * Default values for user and/or group using reserved blocks + */ #define EXT2_DEF_RESUID 0 #define EXT2_DEF_RESGID 0 @@ -388,6 +414,13 @@ struct ext2_dir_entry { #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ ~EXT2_DIR_ROUND) +/* + * Feature set definitions --- none are defined as of now + */ +#define EXT2_FEATURE_COMPAT_SUPP 0 +#define EXT2_FEATURE_INCOMPAT_SUPP 0 +#define EXT2_FEATURE_RO_COMPAT_SUPP 0 + #ifdef __KERNEL__ /* * Function prototypes @@ -397,23 +430,17 @@ struct ext2_dir_entry { * Ok, these declarations are also in <linux/kernel.h> but none of the * ext2 source programs needs to include it so they are duplicated here. */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define NORET_TYPE __volatile__ -# define ATTRIB_NORET /**/ -# define NORET_AND /**/ -#else # define NORET_TYPE /**/ # define ATTRIB_NORET __attribute__((noreturn)) # define NORET_AND noreturn, -#endif /* acl.c */ extern int ext2_permission (struct inode *, int); /* balloc.c */ -extern int ext2_new_block (struct super_block *, unsigned long, - __u32 *, __u32 *); -extern void ext2_free_blocks (struct super_block *, unsigned long, +extern int ext2_new_block (const struct inode *, unsigned long, + __u32 *, __u32 *, int *); +extern void ext2_free_blocks (const struct inode *, unsigned long, unsigned long); extern unsigned long ext2_count_free_blocks (struct super_block *); extern void ext2_check_blocks_bitmap (struct super_block *); @@ -422,7 +449,7 @@ extern void ext2_check_blocks_bitmap (struct super_block *); extern unsigned long ext2_count_free (struct buffer_head *, unsigned); /* dir.c */ -extern int ext2_check_dir_entry (char *, struct inode *, +extern int ext2_check_dir_entry (const char *, struct inode *, struct ext2_dir_entry *, struct buffer_head *, unsigned long); @@ -434,7 +461,7 @@ extern int ext2_write (struct inode *, struct file *, char *, int); extern int ext2_sync_file (struct inode *, struct file *); /* ialloc.c */ -extern struct inode * ext2_new_inode (const struct inode *, int); +extern struct inode * ext2_new_inode (const struct inode *, int, int *); extern void ext2_free_inode (struct inode *); extern unsigned long ext2_count_free_inodes (struct super_block *); extern void ext2_check_inodes_bitmap (struct super_block *); @@ -468,7 +495,7 @@ extern int ext2_symlink (struct inode *, const char *, int, const char *); extern int ext2_link (struct inode *, struct inode *, const char *, int); extern int ext2_mknod (struct inode *, const char *, int, int, int); extern int ext2_rename (struct inode *, const char *, int, - struct inode *, const char *, int); + struct inode *, const char *, int, int); /* super.c */ extern void ext2_error (struct super_block *, const char *, const char *, ...) @@ -482,6 +509,7 @@ extern void ext2_put_super (struct super_block *); extern void ext2_write_super (struct super_block *); extern int ext2_remount (struct super_block *, int *, char *); extern struct super_block * ext2_read_super (struct super_block *,void *,int); +extern int init_ext2_fs(void); extern void ext2_statfs (struct super_block *, struct statfs *, int); /* truncate.c */ diff --git a/include/linux/ext2_fs_i.h b/include/linux/ext2_fs_i.h index f3eca4480..7df902135 100644 --- a/include/linux/ext2_fs_i.h +++ b/include/linux/ext2_fs_i.h @@ -35,6 +35,7 @@ struct ext2_inode_info { __u32 i_next_alloc_goal; __u32 i_prealloc_block; __u32 i_prealloc_count; + int i_new_inode:1; /* Is a freshly allocated inode */ }; #endif /* _LINUX_EXT2_FS_I */ diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h index 685efeb34..dd064b86a 100644 --- a/include/linux/ext2_fs_sb.h +++ b/include/linux/ext2_fs_sb.h @@ -16,6 +16,8 @@ #ifndef _LINUX_EXT2_FS_SB #define _LINUX_EXT2_FS_SB +#include <linux/ext2_fs.h> + /* * The following is not needed anymore since the descriptors buffer * heads are now dynamically allocated @@ -53,6 +55,11 @@ struct ext2_sb_info { unsigned short s_resuid; unsigned short s_resgid; unsigned short s_mount_state; + unsigned short s_pad; + int s_addr_per_block_bits; + int s_desc_per_block_bits; + int s_inode_size; + int s_first_ino; }; #endif /* _LINUX_EXT2_FS_SB */ diff --git a/include/linux/ext_fs.h b/include/linux/ext_fs.h index 52ab5413f..9bca72b0b 100644 --- a/include/linux/ext_fs.h +++ b/include/linux/ext_fs.h @@ -63,7 +63,7 @@ struct ext_dir_entry { extern int ext_open(struct inode * inode, struct file * filp); extern void ext_release(struct inode * inode, struct file * filp); extern int ext_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); + struct inode ** result); extern int ext_create(struct inode * dir,const char * name, int len, int mode, struct inode ** result); extern int ext_mkdir(struct inode * dir, const char * name, int len, int mode); @@ -74,7 +74,7 @@ extern int ext_symlink(struct inode * inode, const char * name, int len, extern int ext_link(struct inode * oldinode, struct inode * dir, const char * name, int len); extern int ext_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int ext_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len); + struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); extern struct inode * ext_new_inode(const struct inode * dir); extern void ext_free_inode(struct inode * inode); extern unsigned long ext_count_free_inodes(struct super_block *sb); @@ -91,6 +91,7 @@ extern void ext_truncate(struct inode *); extern void ext_put_super(struct super_block *); extern void ext_write_super(struct super_block *); extern struct super_block *ext_read_super(struct super_block *,void *,int); +extern int init_ext_fs(void); extern void ext_read_inode(struct inode *); extern void ext_write_inode(struct inode *); extern void ext_put_inode(struct inode *); diff --git a/include/linux/fb.h b/include/linux/fb.h new file mode 100644 index 000000000..f97a313c6 --- /dev/null +++ b/include/linux/fb.h @@ -0,0 +1,288 @@ +#ifndef _LINUX_FB_H +#define _LINUX_FB_H + +/* Definitions of frame buffers */ + +/* ioctls + 0x46 is 'F' */ +#define FBIOGET_VSCREENINFO 0x4600 +#define FBIOPUT_VSCREENINFO 0x4601 +#define FBIOGET_FSCREENINFO 0x4602 +#define FBIOGETCMAP 0x4604 +#define FBIOPUTCMAP 0x4605 +#define FBIOPAN_DISPLAY 0x4606 + +#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ +#define FB_TYPE_PLANES 1 /* Non interleaved planes */ +#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ + +#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ +#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ +#define FB_VISUAL_TRUECOLOR 2 /* True color */ +#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ +#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ +#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ +#define FB_VISUAL_STATIC_DIRECTCOLOR 6 /* Direct color readonly */ + +struct fb_fix_screeninfo { + char id[16]; /* identification string eg "TT Builtin" */ + unsigned long smem_start; /* Start of frame buffer mem */ + unsigned long smem_len; /* Length of frame buffer mem */ + int type; /* see FB_TYPE_* */ + int type_aux; /* Interleave for interleaved Planes */ + int visual; /* see FB_VISUAL_* */ + u_short xpanstep; /* zero if no hardware panning */ + u_short ypanstep; /* zero if no hardware panning */ + u_short ywrapstep; /* zero if no hardware ywrap */ + u_long line_length; /* length of a line in bytes */ + short reserved[9]; /* Reserved for future compatibility */ +}; + +struct fb_bitfield { + int offset; /* beginning of bitfield */ + int length; /* length of bitfield */ + int msb_right; /* != 0 : Most significant bit is */ + /* right */ +}; + +#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */ + +#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/ +#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */ +#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */ +#define FB_ACTIVATE_MASK 15 + /* values */ +#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */ +#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */ + +#define FB_ACCEL_NONE 0 /* no hardware accelerator */ +#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ +#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */ +#define FB_ACCEL_CYBERVISION 3 /* Cybervision64 (S3 Trio64) */ + +#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ +#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ +#define FB_SYNC_EXT 4 /* external sync */ +#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ +#define FB_SYNC_BROADCAST 16 /* broadcast video timings */ + /* vtotal = 144d/288n/576i => PAL */ + /* vtotal = 121d/242n/484i => NTSC */ + +#define FB_VMODE_NONINTERLACED 0 /* non interlaced */ +#define FB_VMODE_INTERLACED 1 /* interlaced */ +#define FB_VMODE_DOUBLE 2 /* double scan */ +#define FB_VMODE_MASK 255 + +#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ +#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ +#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ + +struct fb_var_screeninfo { + int xres; /* visible resolution */ + int yres; + int xres_virtual; /* virtual resolution */ + int yres_virtual; + int xoffset; /* offset from virtual to visible */ + int yoffset; /* resolution */ + + int bits_per_pixel; /* guess what */ + int grayscale; /* != 0 Graylevels instead of colors */ + + struct fb_bitfield red; /* bitfield in fb mem if true color, */ + struct fb_bitfield green; /* else only length is significant */ + struct fb_bitfield blue; + struct fb_bitfield transp; /* transparency */ + + int nonstd; /* != 0 Non standard pixel format */ + + int activate; /* see FB_ACTIVATE_* */ + + int height; /* height of picture in mm */ + int width; /* width of picture in mm */ + + int accel; /* see FB_ACCEL_* */ + + /* Timing: All values in pixclocks, except pixclock (of course) */ + unsigned long pixclock; /* pixel clock in ps (pico seconds) */ + unsigned long left_margin; /* time from sync to picture */ + unsigned long right_margin; /* time from picture to sync */ + unsigned long upper_margin; /* time from sync to picture */ + unsigned long lower_margin; + unsigned long hsync_len; /* length of horizontal sync */ + unsigned long vsync_len; /* length of vertical sync */ + int sync; /* see FB_SYNC_* */ + int vmode; /* see FB_VMODE_* */ + int reserved[6]; /* Reserved for future compatibility */ +}; + +struct fb_cmap { + int start; /* First entry */ + int len; /* Number of entries */ + unsigned short *red; /* Red values */ + unsigned short *green; + unsigned short *blue; + unsigned short *transp; /* transparency, can be NULL */ +}; + +#ifdef __KERNEL__ + +#include <linux/fs.h> + +struct fb_ops { + /* get non settable parameters */ + int (*fb_get_fix) (struct fb_fix_screeninfo *, int); + /* get settable parameters */ + int (*fb_get_var) (struct fb_var_screeninfo *, int); + /* set settable parameters */ + int (*fb_set_var) (struct fb_var_screeninfo *, int); + /* get colormap */ + int (*fb_get_cmap) (struct fb_cmap *, int, int); + /* set colormap */ + int (*fb_set_cmap) (struct fb_cmap *, int, int); + /* pan display */ + int (*fb_pan_display) (struct fb_var_screeninfo *, int); + /* perform fb specific ioctl */ + int (*fb_ioctl)(struct inode *, struct file *, unsigned int, + unsigned long, int); +}; + +int register_framebuffer(char *, int *, struct fb_ops *, int, + struct fb_var_screeninfo *); +int unregister_framebuffer(int); + + /* + * This is the interface between the low-level console driver and the + * low-level frame buffer device + */ + +struct display { + /* Filled in by the frame buffer device */ + + struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ + /* are updated by fbcon.c */ + struct fb_cmap cmap; /* colormap */ + u_char *screen_base; /* pointer to top of virtual screen */ + int visual; + int type; /* see FB_TYPE_* */ + int type_aux; /* Interleave for interleaved Planes */ + u_short ypanstep; /* zero if no hardware ypan */ + u_short ywrapstep; /* zero if no hardware ywrap */ + u_long line_length; /* length of a line in bytes */ + u_short can_soft_blank; /* zero if no hardware blanking */ + u_short inverse; /* != 0 text black on white as default */ + +#if 0 + struct fb_fix_cursorinfo fcrsr; + struct fb_var_cursorinfo *vcrsr; + struct fb_cursorstate crsrstate; +#endif + + /* Filled in by the low-level console driver */ + + struct vc_data *conp; /* pointer to console data */ + int vrows; /* number of virtual rows */ + int cursor_x; /* current cursor position */ + int cursor_y; + int fgcol; /* text colors */ + int bgcol; + u_long next_line; /* offset to one line below */ + u_long next_plane; /* offset to next plane */ + u_char *fontdata; /* Font associated to this display */ + int fontheight; + int fontwidth; + int userfont; /* != 0 if fontdata kmalloc()ed */ + struct display_switch *dispsw; /* low level operations */ + u_short scrollmode; /* Scroll Method */ + short yscroll; /* Hardware scrolling */ +}; + + +struct fb_info { + char modename[40]; /* at boottime detected video mode */ + struct display *disp; /* pointer to display variables */ + char fontname[40]; /* default font name */ + int (*changevar)(int); /* tell console var has changed */ + int (*switch_con)(int); /* tell fb to switch consoles */ + int (*updatevar)(int); /* tell fb to update the vars */ + void (*blank)(int); /* tell fb to (un)blank the screen */ +}; + +#endif /* __KERNEL__ */ + +#if 1 + +#define FBCMD_GET_CURRENTPAR 0xDEAD0005 +#define FBCMD_SET_CURRENTPAR 0xDEAD8005 + +#endif + + +#if 1 /* Preliminary */ + + /* + * Hardware Cursor + */ + +#define FBIOGET_FCURSORINFO 0x4607 +#define FBIOGET_VCURSORINFO 0x4608 +#define FBIOPUT_VCURSORINFO 0x4609 +#define FBIOGET_CURSORSTATE 0x460A +#define FBIOPUT_CURSORSTATE 0x460B + + +struct fb_fix_cursorinfo { + u_short crsr_width; /* width and height of the cursor in */ + u_short crsr_height; /* pixels (zero if no cursor) */ + u_short crsr_xsize; /* cursor size in display pixels */ + u_short crsr_ysize; + u_short crsr_color1; /* colormap entry for cursor color1 */ + u_short crsr_color2; /* colormap entry for cursor color2 */ +}; + +struct fb_var_cursorinfo { + u_short width; + u_short height; + u_short xspot; + u_short yspot; + u_char data[1]; /* field with [height][width] */ +}; + +struct fb_cursorstate { + short xoffset; + short yoffset; + u_short mode; +}; + +#define FB_CURSOR_OFF 0 +#define FB_CURSOR_ON 1 +#define FB_CURSOR_FLASH 2 + +#define FBCMD_DRAWLINE 0x4621 +#define FBCMD_MOVE 0x4622 + +#define FB_LINE_XOR 1 +#define FB_LINE_BOX 2 +#define FB_LINE_FILLED 4 + +struct fb_line { + int start_x; + int start_y; + int end_x; + int end_y; + int color; + int option; +}; + +struct fb_move { + int src_x; + int src_y; + int dest_x; + int dest_y; + int height; + int width; +}; + +#endif /* Preliminary */ + + +#endif /* _LINUX_FB_H */ diff --git a/include/linux/fd.h b/include/linux/fd.h index 044f0bace..a05cf3900 100644 --- a/include/linux/fd.h +++ b/include/linux/fd.h @@ -1,52 +1,26 @@ #ifndef _LINUX_FD_H #define _LINUX_FD_H -#define FDCLRPRM 0 /* clear user-defined parameters */ -#define FDSETPRM 1 /* set user-defined parameters for current media */ -#define FDSETMEDIAPRM 1 -#define FDDEFPRM 2 /* set user-defined parameters until explicitly cleared */ -#define FDDEFMEDIAPRM 2 -#define FDGETPRM 3 /* get disk parameters */ -#define FDGETMEDIAPRM 3 -#define FDMSGON 4 /* issue kernel messages on media type change */ -#define FDMSGOFF 5 /* don't issue kernel messages on media type change */ -#define FDFMTBEG 6 /* begin formatting a disk */ -#define FDFMTTRK 7 /* format the specified track */ -#define FDFMTEND 8 /* end formatting a disk */ -#define FDSETEMSGTRESH 10 /* set fdc error reporting threshold */ -#define FDFLUSH 11 /* flush buffers for media; either for verifying media, or for - handling a media change without closing the file - descriptor */ -#define FDSETMAXERRS 12 /* set abortion and read_track threshold */ -#define FDGETMAXERRS 14 /* get abortion and read_track threshold */ -#define FDGETDRVTYP 16 /* get drive type: 5 1/4 or 3 1/2 */ - -#define FDSETDRVPRM 20 /* set drive parameters */ -#define FDGETDRVPRM 21 /* get drive parameters */ -#define FDGETDRVSTAT 22 /* get drive state */ -#define FDPOLLDRVSTAT 23 /* get drive state */ -#define FDRESET 24 /* reset FDC */ - -#define FD_RESET_IF_NEEDED 0 -#define FD_RESET_IF_RAWCMD 1 -#define FD_RESET_ALWAYS 2 - -#define FDGETFDCSTAT 25 /* get fdc state */ -#define FDWERRORCLR 27 /* clear write error and badness information */ -#define FDWERRORGET 28 /* get write error and badness information */ - -#define FDRAWCMD 30 /* send a raw command to the fdc */ - -#define FDTWADDLE 40 /* flicker motor-on bit before reading a sector */ +#include <linux/ioctl.h> + +/* New file layout: Now the ioctl definitions immediately follow the + * definitions of the structures that they use */ /* - * Maximum number of sectors in a track buffer. Track buffering is disabled - * if tracks are bigger. + * Geometry */ -#define MAX_BUFFER_SECTORS 24 /* was 18 -bb */ +struct floppy_struct { + unsigned int size, /* nr of sectors total */ + sect, /* sectors per track */ + head, /* nr of heads */ + track, /* nr of tracks */ + stretch; /* !=0 means double track steps */ +#define FD_STRETCH 1 +#define FD_SWAPSIDES 2 -#define FD_FILL_BYTE 0xF6 /* format fill byte */ + unsigned char gap, /* gap1 size */ + rate, /* data rate. |= 0x40 for perpendicular */ #define FD_2M 0x4 #define FD_SIZECODEMASK 0x38 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) @@ -54,27 +28,56 @@ 512 : 128 << FD_SIZECODE(floppy) ) #define FD_PERP 0x40 -#ifndef __ASSEMBLY__ -/* the following structure is used by FDSETPRM, FDDEFPRM and FDGETPRM */ -struct floppy_struct { - unsigned int size, /* nr of sectors total */ - sect, /* sectors per track */ - head, /* nr of heads */ - track, /* nr of tracks */ - stretch; /* !=0 means double track steps */ - unsigned char gap, /* gap1 size */ - rate, /* data rate. |= 0x40 for perpendicular */ spec1, /* stepping rate, head unload time */ fmt_gap; /* gap2 size */ - char * name; /* used only for predefined formats */ + const char * name; /* used only for predefined formats */ }; + +/* commands needing write access have 0x40 set */ +/* commands needing super user access have 0x80 set */ + +#define FDCLRPRM _IO(2, 0x41) +/* clear user-defined parameters */ + +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct) +#define FDSETMEDIAPRM FDSETPRM +/* set user-defined parameters for current media */ + +#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) +#define FDGETPRM _IOR(2, 0x04, struct floppy_struct) +#define FDDEFMEDIAPRM FDDEFPRM +#define FDGETMEDIAPRM FDGETPRM +/* set/get disk parameters */ + + +#define FDMSGON _IO(2,0x45) +#define FDMSGOFF _IO(2,0x46) +/* issue/don't issue kernel messages on media type change */ + + +/* + * Formatting (obsolete) + */ +#define FD_FILL_BYTE 0xF6 /* format fill byte. */ + struct format_descr { unsigned int device,head,track; }; +#define FDFMTBEG _IO(2,0x47) +/* begin formatting a disk */ +#define FDFMTTRK _IOW(2,0x48, struct format_descr) +/* format the specified track */ +#define FDFMTEND _IO(2,0x49) +/* end formatting a disk */ + + +/* + * Error thresholds + */ struct floppy_max_errors { - unsigned int + unsigned int abort, /* number of errors to be reached before aborting */ read_track, /* maximal number of errors permitted to read an * entire track at once */ @@ -91,32 +94,55 @@ struct floppy_max_errors { }; -/* the following structure is used by FDSETDRVPRM and FDGETDRVPRM */ +#define FDSETEMSGTRESH _IO(2,0x4a) +/* set fdc error reporting threshold */ + +#define FDFLUSH _IO(2,0x4b) +/* flush buffers for media; either for verifying media, or for + * handling a media change without closing the file descriptor */ + +#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) +#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) +/* set/get abortion and read_track threshold. See also floppy_drive_params + * structure */ + + +typedef char floppy_drive_name[16]; +#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) +/* get drive type: 5 1/4 or 3 1/2 */ + + +/* + * Drive parameters (user modifiable) + */ struct floppy_drive_params { - char cmos; /* cmos type */ - - /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms etc) - * and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). - */ - unsigned long max_dtr; /* Step rate, usec */ - unsigned long hlt; /* Head load/settle time, msec */ - unsigned long hut; /* Head unload time (remnant of 8" drives) */ - unsigned long srt; /* Step rate, usec */ - - unsigned long spinup; /* time needed for spinup ( in jiffies) */ - unsigned long spindown; /* timeout needed for spindown */ - unsigned char spindown_offset;/* decides in which position the disk - * will stop */ - unsigned char select_delay; /* delay to wait after select */ - unsigned char rps; /* rotations per second */ - unsigned char tracks; /* maximum number of tracks */ - unsigned long timeout; /* timeout for interrupt requests */ - - unsigned char interleave_sect;/* if there are more sectors, use interleave */ - - struct floppy_max_errors max_errors; - - char flags; /* various flags, including ftd_msg */ + char cmos; /* cmos type */ + + /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms + * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA). + */ + unsigned long max_dtr; /* Step rate, usec */ + unsigned long hlt; /* Head load/settle time, msec */ + unsigned long hut; /* Head unload time (remnant of + * 8" drives) */ + unsigned long srt; /* Step rate, usec */ + + unsigned long spinup; /* time needed for spinup (expressed + * in jiffies) */ + unsigned long spindown; /* timeout needed for spindown */ + unsigned char spindown_offset; /* decides in which position the disk + * will stop */ + unsigned char select_delay; /* delay to wait after select */ + unsigned char rps; /* rotations per second */ + unsigned char tracks; /* maximum number of tracks */ + unsigned long timeout; /* timeout for interrupt requests */ + + unsigned char interleave_sect; /* if there are more sectors, use + * interleave */ + + struct floppy_max_errors max_errors; + + char flags; /* various flags, including ftd_msg */ /* * Announce successful media type detection and media information loss after * disk changes. @@ -129,29 +155,40 @@ struct floppy_drive_params { #define FD_SILENT_DCL_CLEAR 0x4 #define FD_INVERTED_DCL 0x80 - char read_track; /* use readtrack during probing? */ + char read_track; /* use readtrack during probing? */ /* * Auto-detection. Each drive type has eight formats which are * used in succession to try to read the disk. If the FDC cannot lock onto * the disk, the next format is tried. This uses the variable 'probing'. */ - short autodetect[8]; /* autodetected formats */ - - int checkfreq; /* how often should the drive be checked for disk changes */ - int native_format; /* native format of this drive */ + short autodetect[8]; /* autodetected formats */ + + int checkfreq; /* how often should the drive be checked for disk + * changes */ + int native_format; /* native format of this drive */ }; enum { -FD_NEED_TWADDLE_BIT, /* more magic */ -FD_VERIFY_BIT, /* inquire for write protection */ -FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet to - clear media change status */ -FD_UNUSED_BIT, -FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ -FD_DISK_WRITABLE_BIT /* disk is writable */ + FD_NEED_TWADDLE_BIT, /* more magic */ + FD_VERIFY_BIT, /* inquire for write protection */ + FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet + * to clear media change status */ + FD_UNUSED_BIT, + FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */ + FD_DISK_WRITABLE_BIT /* disk is writable */ }; +#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) +#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) +/* set/get drive parameters */ + + +/* + * Current drive state (not directly modifiable by user, readonly) + */ +struct floppy_drive_struct { + signed char flags; /* values for these flags */ #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) #define FD_VERIFY (1 << FD_VERIFY_BIT) @@ -159,93 +196,182 @@ FD_DISK_WRITABLE_BIT /* disk is writable */ #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) -#define FD_DRIVE_PRESENT 0 /* keep fdpatch utils compiling */ - -struct floppy_drive_struct { - signed char flags; - unsigned long spinup_date; - unsigned long select_date; - unsigned long first_read_date; - short probed_format; - short track; /* current track */ - short maxblock; /* id of highest block read */ - short maxtrack; /* id of highest half track read */ - int generation; /* how many diskchanges? */ + unsigned long spinup_date; + unsigned long select_date; + unsigned long first_read_date; + short probed_format; + short track; /* current track */ + short maxblock; /* id of highest block read */ + short maxtrack; /* id of highest half track read */ + int generation; /* how many diskchanges? */ /* * (User-provided) media information is _not_ discarded after a media change * if the corresponding keep_data flag is non-zero. Positive values are * decremented after each probe. */ - int keep_data; + int keep_data; + + /* Prevent "aliased" accesses. */ + int fd_ref; + int fd_device; + int last_checked; /* when was the drive last checked for a disk + * change? */ + + char *dmabuf; + int bufblocks; +}; - /* Prevent "aliased" accesses. */ - int fd_ref; - int fd_device; - int last_checked; /* when was the drive last checked for a disk change? */ +#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) +#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) +/* get drive state: GET returns the cached state, POLL polls for new state */ +/* + * reset FDC + */ +enum reset_mode { + FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */ + FD_RESET_IF_RAWCMD, /* obsolete */ + FD_RESET_ALWAYS /* reset always */ }; +#define FDRESET _IO(2, 0x54) -struct floppy_write_errors { - /* Write error logging. - * - * These fields can be cleared with the FDWERRORCLR ioctl. - * Only writes that were attempted but failed due to a physical media - * error are logged. write(2) calls that fail and return an error code - * to the user process are not counted. - */ - - unsigned int write_errors; /* number of physical write errors encountered */ - - /* position of first and last write errors */ - unsigned long first_error_sector; - int first_error_generation; - unsigned long last_error_sector; - int last_error_generation; - - unsigned int badness; /* highest retry count for a read or write operation */ -}; +/* + * FDC state + */ struct floppy_fdc_state { - int spec1; /* spec1 value last used */ - int spec2; /* spec2 value last used */ + int spec1; /* spec1 value last used */ + int spec2; /* spec2 value last used */ int dtr; unsigned char version; /* FDC version code */ unsigned char dor; - unsigned int address; /* io address */ + int address; /* io address */ unsigned int rawcmd:2; unsigned int reset:1; unsigned int need_configure:1; unsigned int perp_mode:2; unsigned int has_fifo:1; + unsigned int driver_version; /* version code for floppy driver */ +#define FD_DRIVER_VERSION 0x100 +/* user programs using the floppy API should use floppy_fdc_state to + * get the version number of the floppy driver that they are running + * on. If this version number is bigger than the one compiled into the + * user program (the FD_DRIVER_VERSION define), it should be prepared + * to bigger structures + */ + + unsigned char track[4]; + /* Position of the heads of the 4 units attached to this FDC, + * as stored on the FDC. In the future, the position as stored + * on the FDC might not agree with the actual physical + * position of these drive heads. By allowing such + * disagreement, it will be possible to reset the FDC without + * incurring the expensive cost of repositioning all heads. + * Right now, these positions are hard wired to 0. */ + }; -struct floppy_raw_cmd { - void *data; - long length; - - unsigned char rate; - unsigned char flags; - unsigned char cmd_count; - unsigned char cmd[9]; - unsigned char reply_count; - unsigned char reply[7]; - int track; +#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) + + +/* + * Asynchronous Write error tracking + */ +struct floppy_write_errors { + /* Write error logging. + * + * These fields can be cleared with the FDWERRORCLR ioctl. + * Only writes that were attempted but failed due to a physical media + * error are logged. write(2) calls that fail and return an error code + * to the user process are not counted. + */ + + unsigned int write_errors; /* number of physical write errors + * encountered */ + + /* position of first and last write errors */ + unsigned long first_error_sector; + int first_error_generation; + unsigned long last_error_sector; + int last_error_generation; + + unsigned int badness; /* highest retry count for a read or write + * operation */ }; -#endif -/* meaning of the various bytes */ +#define FDWERRORCLR _IO(2, 0x56) +/* clear write error and badness information */ +#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) +/* get write error and badness information */ + + +/* + * Raw commands + */ +/* new interface flag: now we can do them in batches */ +#define FDHAVEBATCHEDRAWCMD -/* flags */ +struct floppy_raw_cmd { + unsigned int flags; #define FD_RAW_READ 1 #define FD_RAW_WRITE 2 #define FD_RAW_NO_MOTOR 4 -#define FD_RAW_DISK_CHANGE 4 -#define FD_RAW_INTR 8 -#define FD_RAW_SPIN 16 -#define FD_RAW_NO_MOTOR_AFTER 32 -#define FD_RAW_NEED_DISK 64 -#define FD_RAW_NEED_SEEK 128 +#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */ +#define FD_RAW_INTR 8 /* wait for an interrupt */ +#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */ +#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command + * completion */ +#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */ +#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */ + +/* more "in" flags */ +#define FD_RAW_MORE 0x100 /* more records follow */ +#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */ +#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */ +#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure + * detection too */ + +/* more "out" flags */ +#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */ +#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */ + + void *data; + char *kernel_data; /* location of data buffer in the kernel */ + struct floppy_raw_cmd *next; /* used for chaining of raw cmd's + * within the kernel */ + long length; /* in: length of dma transfer. out: remaining bytes */ + long phys_length; /* physical length, if different from dma length */ + int buffer_length; /* length of allocated buffer */ + + unsigned char rate; + unsigned char cmd_count; + unsigned char cmd[16]; + unsigned char reply_count; + unsigned char reply[16]; + int track; + int resultcode; + + int reserved1; + int reserved2; +}; + +#define FDRAWCMD _IO(2, 0x58) +/* send a raw command to the fdc. Structure size not included, because of + * batches */ + +#define FDTWADDLE _IO(2, 0x59) +/* flicker motor-on bit before reading a sector. Experimental */ + + +#define FDEJECT _IO(2, 0x5a) +/* eject the disk */ + + +#ifdef __KERNEL__ +/* eject the boot floppy (if we need the drive for a different root floppy) */ +void floppy_eject(void); +#endif #endif diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h new file mode 100644 index 000000000..bb0b298ee --- /dev/null +++ b/include/linux/fddidevice.h @@ -0,0 +1,42 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Definitions for the FDDI handlers. + * + * Version: @(#)fddidevice.h 1.0.0 08/12/96 + * + * Author: Lawrence V. Stefani, <stefani@lkg.dec.com> + * + * fddidevice.h is based on previous trdevice.h work by + * Ross Biro, <bir7@leland.Stanford.Edu> + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * Alan Cox, <gw4pts@gw4pts.ampr.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_FDDIDEVICE_H +#define _LINUX_FDDIDEVICE_H + +#include <linux/if_fddi.h> + +#ifdef __KERNEL__ +extern int fddi_header(struct sk_buff *skb, + struct device *dev, + unsigned short type, + void *daddr, + void *saddr, + unsigned len); +extern int fddi_rebuild_header(void *buff, + struct device *dev, + unsigned long dest, + struct sk_buff *skb); +extern unsigned short fddi_type_trans(struct sk_buff *skb, + struct device *dev); +#endif + +#endif /* _LINUX_FDDIDEVICE_H */ diff --git a/include/linux/fdreg.h b/include/linux/fdreg.h index 245647bbf..1d9026eed 100644 --- a/include/linux/fdreg.h +++ b/include/linux/fdreg.h @@ -44,7 +44,7 @@ #define ST0_DS 0x03 /* drive select mask */ #define ST0_HA 0x04 /* Head (Address) */ #define ST0_NR 0x08 /* Not Ready */ -#define ST0_ECE 0x10 /* Equipment chech error */ +#define ST0_ECE 0x10 /* Equipment check error */ #define ST0_SE 0x20 /* Seek end */ #define ST0_INTR 0xC0 /* Interrupt code mask */ @@ -92,18 +92,52 @@ #define FD_RSEEK_OUT 0x8f /* seek out (i.e. to lower tracks) */ #define FD_RSEEK_IN 0xcf /* seek in (i.e. to higher tracks) */ +/* the following commands are new in the 82078. They are not used in the + * floppy driver, except the first three. These commands may be useful for apps + * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at + * http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ */ + +#define FD_PARTID 0x18 /* part id ("extended" version cmd) */ +#define FD_SAVE 0x2e /* save fdc regs for later restore */ +#define FD_DRIVESPEC 0x8e /* drive specification: Access to the + * 2 Mbps data transfer rate for tape + * drives */ + +#define FD_RESTORE 0x4e /* later restore */ +#define FD_POWERDOWN 0x27 /* configure FDC's powersave features */ +#define FD_FORMAT_N_WRITE 0xef /* format and write in one go. */ +#define FD_OPTION 0x33 /* ISO format (which is a clean way to + * pack more sectors on a track) */ + /* DMA commands */ #define DMA_READ 0x46 #define DMA_WRITE 0x4A /* FDC version return types */ #define FDC_NONE 0x00 -#define FDC_UNKNOWN 0x10 +#define FDC_UNKNOWN 0x10 /* DO NOT USE THIS TYPE EXCEPT IF IDENTIFICATION + FAILS EARLY */ #define FDC_8272A 0x20 /* Intel 8272a, NEC 765 */ #define FDC_765ED 0x30 /* Non-Intel 1MB-compatible FDC, can't detect */ #define FDC_82072 0x40 /* Intel 82072; 8272a + FIFO + DUMPREGS */ -#define FDC_82077_ORIG 0x50 /* Original version of 82077AA, sans LOCK */ +#define FDC_82072A 0x45 /* 82072A (on Sparcs) */ +#define FDC_82077_ORIG 0x51 /* Original version of 82077AA, sans LOCK */ #define FDC_82077 0x52 /* 82077AA-1 */ +#define FDC_82078_UNKN 0x5f /* Unknown 82078 variant */ +#define FDC_82078 0x60 /* 44pin 82078 or 64pin 82078SL */ +#define FDC_82078_1 0x61 /* 82078-1 (2Mbps fdc) */ +#define FDC_S82078B 0x62 /* S82078B (first seen on Adaptec AVA-2825 VLB + * SCSI/EIDE/Floppy controller) */ +#define FDC_87306 0x63 /* National Semiconductor PC 87306 */ + +/* + * Beware: the fdc type list is roughly sorted by increasing features. + * Presence of features is tested by comparing the FDC version id with the + * "oldest" version that has the needed feature. + * If during FDC detection, an obscure test fails late in the sequence, don't + * assign FDC_UNKNOWN. Else the FDC will be treated as a dumb 8272a, or worse. + * This is especially true if the tests are unneeded. + */ #define FD_RESET_DELAY 20 #endif diff --git a/include/linux/file.h b/include/linux/file.h new file mode 100644 index 000000000..a3297909d --- /dev/null +++ b/include/linux/file.h @@ -0,0 +1,25 @@ +#ifndef __LINUX_FILE_H +#define __LINUX_FILE_H + +extern inline struct file * fget(unsigned long fd) +{ + struct file * file = NULL; + if (fd < NR_OPEN) { + file = current->files->fd[fd]; + if (file) + file->f_count++; + } + return file; +} + +extern void __fput(struct file *, struct inode *); + +extern inline void fput(struct file *file, struct inode *inode) +{ + int count = file->f_count-1; + if (!count) + __fput(file, inode); + file->f_count = count; +} + +#endif diff --git a/include/linux/firewall.h b/include/linux/firewall.h new file mode 100644 index 000000000..e2d1f25e3 --- /dev/null +++ b/include/linux/firewall.h @@ -0,0 +1,41 @@ +#ifndef __LINUX_FIREWALL_H +#define __LINUX_FIREWALL_H + +/* + * Definitions for loadable firewall modules + */ + +#define FW_BLOCK 0 +#define FW_ACCEPT 1 +#define FW_REJECT (-1) +#define FW_REDIRECT 2 +#define FW_MASQUERADE 3 +#define FW_SKIP 4 + +struct firewall_ops +{ + struct firewall_ops *next; + int (*fw_forward)(struct firewall_ops *this, int pf, + struct device *dev, void *phdr, void *arg); + int (*fw_input)(struct firewall_ops *this, int pf, + struct device *dev, void *phdr, void *arg); + int (*fw_output)(struct firewall_ops *this, int pf, + struct device *dev, void *phdr, void *arg); + /* Data falling in the second 486 cache line isn't used directly + during a firewall call and scan, only by insert/delete and other + unusual cases + */ + int fw_pf; /* Protocol family */ + int fw_priority; /* Priority of chosen firewalls */ +}; + +#ifdef __KERNEL__ +extern int register_firewall(int pf, struct firewall_ops *fw); +extern int unregister_firewall(int pf, struct firewall_ops *fw); +extern int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg); +extern int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg); +extern int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg); +extern void fwchain_init(void); +#endif + +#endif diff --git a/include/linux/fs.h b/include/linux/fs.h index 617a11a41..0c64ed100 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -6,12 +6,15 @@ * structures etc. */ +#include <linux/config.h> #include <linux/linkage.h> #include <linux/limits.h> #include <linux/wait.h> #include <linux/types.h> #include <linux/vfs.h> #include <linux/net.h> +#include <linux/kdev_t.h> +#include <linux/ioctl.h> /* * It's silly to have NR_OPEN bigger than NR_FILE, but I'll fix @@ -21,34 +24,32 @@ * Some programs (notably those using select()) may have to be * recompiled to take full advantage of the new limits.. */ + +/* Fixed constants first: */ #undef NR_OPEN #define NR_OPEN 256 -#define NR_INODE 2048 /* this should be bigger than NR_FILE */ -#define NR_FILE 1024 /* this can well be larger on a larger system */ -#define NR_SUPER 32 -#define NR_IHASH 131 +#define NR_SUPER 64 #define BLOCK_SIZE 1024 #define BLOCK_SIZE_BITS 10 +/* And dynamically-tunable limits and defaults: */ +extern int max_inodes, nr_inodes; +extern int max_files, nr_files; +#define NR_INODE 3072 /* this should be bigger than NR_FILE */ +#define NR_FILE 1024 /* this can well be larger on a larger system */ + #define MAY_EXEC 1 #define MAY_WRITE 2 #define MAY_READ 4 +#define FMODE_READ 1 +#define FMODE_WRITE 2 + #define READ 0 #define WRITE 1 -#define READA 2 /* read-ahead - don't pause */ -#define WRITEA 3 /* "write-ahead" - silly, but somewhat useful */ - -extern void buffer_init(void); -extern unsigned long inode_init(unsigned long start, unsigned long end); -extern unsigned long file_table_init(unsigned long start, unsigned long end); -extern unsigned long name_cache_init(unsigned long start, unsigned long end); - -#define MAJOR(a) (int)((unsigned short)(a) >> 8) -#define MINOR(a) (int)((unsigned short)(a) & 0xFF) -#define MKDEV(a,b) ((int)((((a) & 0xff) << 8) | ((b) & 0xff))) -#define NODEV MKDEV(0,0) +#define READA 2 /* read-ahead - don't block if no resources */ +#define WRITEA 3 /* write-ahead - don't block if no resources */ #ifndef NULL #define NULL ((void *) 0) @@ -62,26 +63,27 @@ extern unsigned long name_cache_init(unsigned long start, unsigned long end); /* * These are the fs-independent mount-flags: up to 16 flags are supported */ -#define MS_RDONLY 1 /* mount read-only */ -#define MS_NOSUID 2 /* ignore suid and sgid bits */ -#define MS_NODEV 4 /* disallow access to device special files */ -#define MS_NOEXEC 8 /* disallow program execution */ -#define MS_SYNCHRONOUS 16 /* writes are synced at once */ -#define MS_REMOUNT 32 /* alter flags of a mounted FS */ - -#define S_APPEND 256 /* append-only file */ -#define S_IMMUTABLE 512 /* immutable file */ +#define MS_RDONLY 1 /* Mount read-only */ +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#define MS_NODEV 4 /* Disallow access to device special files */ +#define MS_NOEXEC 8 /* Disallow program execution */ +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#define S_WRITE 128 /* Write on file/directory/symlink */ +#define S_APPEND 256 /* Append-only file */ +#define S_IMMUTABLE 512 /* Immutable file */ /* * Flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY) +#define MS_RMT_MASK (MS_RDONLY|MS_MANDLOCK) /* * Magic mount flag number. Has to be or-ed to the flag values. */ -#define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ -#define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ +#define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ +#define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ /* * Note that read-only etc flags are inode-specific: setting some file-system @@ -96,61 +98,125 @@ extern unsigned long name_cache_init(unsigned long start, unsigned long end); #define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV) #define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC) #define IS_SYNC(inode) ((inode)->i_flags & MS_SYNCHRONOUS) +#define IS_MANDLOCK(inode) ((inode)->i_flags & MS_MANDLOCK) +#define IS_WRITABLE(inode) ((inode)->i_flags & S_WRITE) #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) /* the read-only stuff doesn't really belong here, but any other place is probably as bad and I don't want to create yet another include file. */ -#define BLKROSET 4701 /* set device read-only (0 = read-write) */ -#define BLKROGET 4702 /* get read-only status (0 = read_write) */ -#define BLKRRPART 4703 /* re-read partition table */ -#define BLKGETSIZE 4704 /* return device size */ -#define BLKFLSBUF 4705 /* flush buffer cache */ -#define BLKRASET 4706 /* Set read ahead for block device */ -#define BLKRAGET 4707 /* get current read ahead setting */ - -/* These are a few other constants only used by scsi devices */ - -#define SCSI_IOCTL_GET_IDLUN 0x5382 +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ +#define BLKRRPART _IO(0x12,95) /* re-read partition table */ +#define BLKGETSIZE _IO(0x12,96) /* return device size */ +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ +#define BLKRASET _IO(0x12,98) /* Set read ahead for block device */ +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ -/* Used to turn on and off tagged queuing for scsi devices */ +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ +#define FIBMAP _IO(0x00,1) /* bmap access */ +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ -#define SCSI_IOCTL_TAGGED_ENABLE 0x5383 -#define SCSI_IOCTL_TAGGED_DISABLE 0x5384 +#ifdef __KERNEL__ +#include <asm/semaphore.h> +#include <asm/byteorder.h> +#include <asm/bitops.h> -#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ -#define FIBMAP 1 /* bmap access */ -#define FIGETBSZ 2 /* get the block size used for bmap */ +extern void buffer_init(void); +extern unsigned long inode_init(unsigned long start, unsigned long end); +extern unsigned long file_table_init(unsigned long start, unsigned long end); +extern unsigned long name_cache_init(unsigned long start, unsigned long end); typedef char buffer_block[BLOCK_SIZE]; +/* bh state bits */ +#define BH_Uptodate 0 /* 1 if the buffer contains valid data */ +#define BH_Dirty 1 /* 1 if the buffer is dirty */ +#define BH_Lock 2 /* 1 if the buffer is locked */ +#define BH_Req 3 /* 0 if the buffer has been invalidated */ +#define BH_Touched 4 /* 1 if the buffer has been touched (aging) */ +#define BH_Has_aged 5 /* 1 if the buffer has been aged (aging) */ +#define BH_Protected 6 /* 1 if the buffer is protected */ +#define BH_FreeOnIO 7 /* 1 to discard the buffer_head after IO */ + +/* + * Try to keep the most commonly used fields in single cache lines (16 + * bytes) to improve performance. This ordering should be + * particularly beneficial on 32-bit processors. + * + * We use the first 16 bytes for the data which is used in searches + * over the block hash lists (ie. getblk(), find_buffer() and + * friends). + * + * The second 16 bytes we use for lru buffer scans, as used by + * sync_buffers() and refill_freelist(). -- sct + */ struct buffer_head { - char * b_data; /* pointer to data block (1024 bytes) */ - unsigned long b_size; /* block size */ + /* First cache line: */ unsigned long b_blocknr; /* block number */ - dev_t b_dev; /* device (0 = free) */ - unsigned short b_count; /* users using this block */ - unsigned char b_uptodate; - unsigned char b_dirt; /* 0-clean,1-dirty */ - unsigned char b_lock; /* 0 - ok, 1 -locked */ - unsigned char b_req; /* 0 if the buffer has been invalidated */ - unsigned char b_list; /* List that this buffer appears */ - unsigned char b_retain; /* Expected number of times this will - be used. Put on freelist when 0 */ - unsigned long b_flushtime; /* Time when this (dirty) buffer should be written */ - unsigned long b_lru_time; /* Time when this buffer was last used. */ + kdev_t b_dev; /* device (B_FREE = free) */ + kdev_t b_rdev; /* Real device */ + unsigned long b_rsector; /* Real buffer location on disk */ + struct buffer_head * b_next; /* Hash queue list */ + struct buffer_head * b_this_page; /* circular list of buffers in one page */ + + /* Second cache line: */ + unsigned long b_state; /* buffer state bitmap (see above) */ + struct buffer_head * b_next_free; + unsigned int b_count; /* users using this block */ + unsigned long b_size; /* block size */ + + /* Non-performance-critical data follows. */ + char * b_data; /* pointer to data block (1024 bytes) */ + unsigned int b_list; /* List that this buffer appears */ + unsigned long b_flushtime; /* Time when this (dirty) buffer + * should be written */ + unsigned long b_lru_time; /* Time when this buffer was + * last used. */ struct wait_queue * b_wait; struct buffer_head * b_prev; /* doubly linked list of hash-queue */ - struct buffer_head * b_next; struct buffer_head * b_prev_free; /* doubly linked list of buffers */ - struct buffer_head * b_next_free; - struct buffer_head * b_this_page; /* circular list of buffers in one page */ struct buffer_head * b_reqnext; /* request queue */ }; +static inline int buffer_uptodate(struct buffer_head * bh) +{ + return test_bit(BH_Uptodate, &bh->b_state); +} + +static inline int buffer_dirty(struct buffer_head * bh) +{ + return test_bit(BH_Dirty, &bh->b_state); +} + +static inline int buffer_locked(struct buffer_head * bh) +{ + return test_bit(BH_Lock, &bh->b_state); +} + +static inline int buffer_req(struct buffer_head * bh) +{ + return test_bit(BH_Req, &bh->b_state); +} + +static inline int buffer_touched(struct buffer_head * bh) +{ + return test_bit(BH_Touched, &bh->b_state); +} + +static inline int buffer_has_aged(struct buffer_head * bh) +{ + return test_bit(BH_Has_aged, &bh->b_state); +} + +static inline int buffer_protected(struct buffer_head * bh) +{ + return test_bit(BH_Protected, &bh->b_state); +} + #include <linux/pipe_fs_i.h> #include <linux/minix_fs_i.h> #include <linux/ext_fs_i.h> @@ -162,8 +228,8 @@ struct buffer_head { #include <linux/nfs_fs_i.h> #include <linux/xia_fs_i.h> #include <linux/sysv_fs_i.h> - -#ifdef __KERNEL__ +#include <linux/affs_fs_i.h> +#include <linux/ufs_fs_i.h> /* * Attribute flags. These should be or-ed together to figure out what @@ -178,6 +244,7 @@ struct buffer_head { #define ATTR_CTIME 64 #define ATTR_ATIME_SET 128 #define ATTR_MTIME_SET 256 +#define ATTR_FORCE 512 /* Not a change, but a change it */ /* * This is the Inode Attributes structure, used for notify_change(). It @@ -199,14 +266,16 @@ struct iattr { time_t ia_ctime; }; +#include <linux/quota.h> + struct inode { - dev_t i_dev; + kdev_t i_dev; unsigned long i_ino; umode_t i_mode; nlink_t i_nlink; uid_t i_uid; gid_t i_gid; - dev_t i_rdev; + kdev_t i_rdev; off_t i_size; time_t i_atime; time_t i_mtime; @@ -214,18 +283,20 @@ struct inode { unsigned long i_blksize; unsigned long i_blocks; unsigned long i_version; + unsigned long i_nrpages; struct semaphore i_sem; - struct inode_operations * i_op; - struct super_block * i_sb; - struct wait_queue * i_wait; - struct file_lock * i_flock; - struct vm_area_struct * i_mmap; - struct inode * i_next, * i_prev; - struct inode * i_hash_next, * i_hash_prev; - struct inode * i_bound_to, * i_bound_by; - struct inode * i_mount; + struct inode_operations *i_op; + struct super_block *i_sb; + struct wait_queue *i_wait; + struct file_lock *i_flock; + struct vm_area_struct *i_mmap; + struct page *i_pages; + struct dquot *i_dquot[MAXQUOTAS]; + struct inode *i_next, *i_prev; + struct inode *i_hash_next, *i_hash_prev; + struct inode *i_bound_to, *i_bound_by; + struct inode *i_mount; unsigned short i_count; - unsigned short i_wcount; unsigned short i_flags; unsigned char i_lock; unsigned char i_dirt; @@ -233,6 +304,7 @@ struct inode { unsigned char i_sock; unsigned char i_seek; unsigned char i_update; + unsigned short i_writecount; union { struct pipe_inode_info pipe_i; struct minix_inode_info minix_i; @@ -245,6 +317,8 @@ struct inode { struct nfs_inode_info nfs_i; struct xiafs_inode_info xiafs_i; struct sysv_inode_info sysv_i; + struct affs_inode_info affs_i; + struct ufs_inode_info ufs_i; struct socket socket_i; void * generic_ip; } u; @@ -255,7 +329,7 @@ struct file { loff_t f_pos; unsigned short f_flags; unsigned short f_count; - off_t f_reada; + unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin; struct file *f_next, *f_prev; int f_owner; /* pid or -pgrp where SIGIO should be sent */ struct inode * f_inode; @@ -264,20 +338,66 @@ struct file { void *private_data; /* needed for tty driver, and maybe others */ }; +#define FL_POSIX 1 +#define FL_FLOCK 2 +#define FL_BROKEN 4 /* broken flock() emulation */ +#define FL_ACCESS 8 /* for processes suspended by mandatory locking */ + struct file_lock { struct file_lock *fl_next; /* singly linked list for this inode */ struct file_lock *fl_nextlink; /* doubly linked list of all locks */ struct file_lock *fl_prevlink; /* used to simplify lock removal */ - struct file_lock *fl_block; + struct file_lock *fl_nextblock; /* circular list of blocked processes */ + struct file_lock *fl_prevblock; struct task_struct *fl_owner; struct wait_queue *fl_wait; struct file *fl_file; - char fl_flags; - char fl_type; + unsigned char fl_flags; + unsigned char fl_type; off_t fl_start; off_t fl_end; }; +#include <linux/fcntl.h> + +extern int fcntl_getlk(unsigned int fd, struct flock *l); +extern int fcntl_setlk(unsigned int fd, unsigned int cmd, struct flock *l); +extern void locks_remove_locks(struct task_struct *task, struct file *filp); + +#include <linux/stat.h> + +#define FLOCK_VERIFY_READ 1 +#define FLOCK_VERIFY_WRITE 2 + +extern int locks_mandatory_locked(struct inode *inode); +extern int locks_mandatory_area(int read_write, struct inode *inode, + struct file *filp, unsigned int offset, + unsigned int count); + +extern inline int locks_verify_locked(struct inode *inode) +{ + /* Candidates for mandatory locking have the setgid bit set + * but no group execute bit - an otherwise meaningless combination. + */ + if (IS_MANDLOCK(inode) && + (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) + return (locks_mandatory_locked(inode)); + return (0); +} +extern inline int locks_verify_area(int read_write, struct inode *inode, + struct file *filp, unsigned int offset, + unsigned int count) +{ + /* Candidates for mandatory locking have the setgid bit set + * but no group execute bit - an otherwise meaningless combination. + */ + if (IS_MANDLOCK(inode) && + (inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) + return (locks_mandatory_area(read_write, inode, filp, offset, + count)); + return (0); +} + struct fasync_struct { int magic; struct fasync_struct *fa_next; /* singly linked list */ @@ -286,6 +406,8 @@ struct fasync_struct { #define FASYNC_MAGIC 0x4601 +extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struct **); + #include <linux/minix_fs_sb.h> #include <linux/ext_fs_sb.h> #include <linux/ext2_fs_sb.h> @@ -295,9 +417,11 @@ struct fasync_struct { #include <linux/nfs_fs_sb.h> #include <linux/xia_fs_sb.h> #include <linux/sysv_fs_sb.h> +#include <linux/affs_fs_sb.h> +#include <linux/ufs_fs_sb.h> struct super_block { - dev_t s_dev; + kdev_t s_dev; unsigned long s_blocksize; unsigned char s_blocksize_bits; unsigned char s_lock; @@ -305,6 +429,7 @@ struct super_block { unsigned char s_dirt; struct file_system_type *s_type; struct super_operations *s_op; + struct dquot_operations *dq_op; unsigned long s_flags; unsigned long s_magic; unsigned long s_time; @@ -321,6 +446,8 @@ struct super_block { struct nfs_sb_info nfs_sb; struct xiafs_sb_info xiafs_sb; struct sysv_sb_info sysv_sb; + struct affs_sb_info affs_sb; + struct ufs_sb_info ufs_sb; void *generic_sbp; } u; }; @@ -331,12 +458,12 @@ struct super_block { * This allows the kernel to read directories into kernel space or * to have different dirent layouts depending on the binary type. */ -typedef int (*filldir_t)(void *, char *, int, off_t, ino_t); +typedef int (*filldir_t)(void *, const char *, int, off_t, ino_t); struct file_operations { - int (*lseek) (struct inode *, struct file *, off_t, int); - int (*read) (struct inode *, struct file *, char *, int); - int (*write) (struct inode *, struct file *, char *, int); + long long (*llseek) (struct inode *, struct file *, long long, int); + long (*read) (struct inode *, struct file *, char *, unsigned long); + long (*write) (struct inode *, struct file *, const char *, unsigned long); int (*readdir) (struct inode *, struct file *, void *, filldir_t); int (*select) (struct inode *, struct file *, int, select_table *); int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long); @@ -345,8 +472,8 @@ struct file_operations { void (*release) (struct inode *, struct file *); int (*fsync) (struct inode *, struct file *); int (*fasync) (struct inode *, struct file *, int); - int (*check_media_change) (dev_t dev); - int (*revalidate) (dev_t dev); + int (*check_media_change) (kdev_t dev); + int (*revalidate) (kdev_t dev); }; struct inode_operations { @@ -359,9 +486,11 @@ struct inode_operations { int (*mkdir) (struct inode *,const char *,int,int); int (*rmdir) (struct inode *,const char *,int); int (*mknod) (struct inode *,const char *,int,int,int); - int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int); + int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int, int); int (*readlink) (struct inode *,char *,int); int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **); + int (*readpage) (struct inode *, struct page *); + int (*writepage) (struct inode *, struct page *); int (*bmap) (struct inode *,int); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); @@ -379,9 +508,19 @@ struct super_operations { int (*remount_fs) (struct super_block *, int *, char *); }; +struct dquot_operations { + void (*initialize) (struct inode *, short); + void (*drop) (struct inode *); + int (*alloc_block) (const struct inode *, unsigned long); + int (*alloc_inode) (const struct inode *, unsigned long); + void (*free_block) (const struct inode *, unsigned long); + void (*free_inode) (const struct inode *, unsigned long); + int (*transfer) (struct inode *, struct iattr *, char); +}; + struct file_system_type { struct super_block *(*read_super) (struct super_block *, void *, int); - char *name; + const char *name; int requires_dev; struct file_system_type * next; }; @@ -396,10 +535,11 @@ extern void kill_fasync(struct fasync_struct *fa, int sig); extern int getname(const char * filename, char **result); extern void putname(char * name); - +extern int do_truncate(struct inode *, unsigned long); extern int register_blkdev(unsigned int, const char *, struct file_operations *); extern int unregister_blkdev(unsigned int major, const char * name); extern int blkdev_open(struct inode * inode, struct file * filp); +extern void blkdev_release (struct inode * inode); extern struct file_operations def_blk_fops; extern struct inode_operations blkdev_inode_operations; @@ -410,6 +550,7 @@ extern struct file_operations def_chr_fops; extern struct inode_operations chrdev_inode_operations; extern void init_fifo(struct inode * inode); +extern struct inode_operations fifo_inode_operations; extern struct file_operations connecting_fifo_fops; extern struct file_operations read_fifo_fops; @@ -419,22 +560,20 @@ extern struct file_operations read_pipe_fops; extern struct file_operations write_pipe_fops; extern struct file_operations rdwr_pipe_fops; -extern struct file_system_type *get_fs_type(char *name); +extern struct file_system_type *get_fs_type(const char *name); -extern int fs_may_mount(dev_t dev); -extern int fs_may_umount(dev_t dev, struct inode * mount_root); -extern int fs_may_remount_ro(dev_t dev); +extern int fs_may_mount(kdev_t dev); +extern int fs_may_umount(kdev_t dev, struct inode * mount_root); +extern int fs_may_remount_ro(kdev_t dev); extern struct file *first_file; -extern int nr_files; extern struct super_block super_blocks[NR_SUPER]; -extern int shrink_buffers(unsigned int priority); extern void refile_buffer(struct buffer_head * buf); extern void set_writetime(struct buffer_head * buf, int flag); extern void refill_freelist(int size); +extern int try_to_free_buffer(struct buffer_head*, struct buffer_head**, int); -extern struct buffer_head ** buffer_pages; extern int nr_buffers; extern int buffermem; extern int nr_buffer_heads; @@ -447,39 +586,52 @@ extern int nr_buffer_heads; #define BUF_SHARED 5 /* Buffers shared */ #define NR_LIST 6 +void mark_buffer_uptodate(struct buffer_head * bh, int on); + extern inline void mark_buffer_clean(struct buffer_head * bh) { - if(bh->b_dirt) { - bh->b_dirt = 0; - if(bh->b_list == BUF_DIRTY) refile_buffer(bh); - } + if (clear_bit(BH_Dirty, &bh->b_state)) { + if (bh->b_list == BUF_DIRTY) + refile_buffer(bh); + } } extern inline void mark_buffer_dirty(struct buffer_head * bh, int flag) { - if(!bh->b_dirt) { - bh->b_dirt = 1; - set_writetime(bh, flag); - if(bh->b_list != BUF_DIRTY) refile_buffer(bh); - } + if (!set_bit(BH_Dirty, &bh->b_state)) { + set_writetime(bh, flag); + if (bh->b_list != BUF_DIRTY) + refile_buffer(bh); + } } - -extern int check_disk_change(dev_t dev); -extern void invalidate_inodes(dev_t dev); -extern void invalidate_buffers(dev_t dev); +extern int check_disk_change(kdev_t dev); +extern void invalidate_inodes(kdev_t dev); +extern void invalidate_inode_pages(struct inode *); +extern void invalidate_buffers(kdev_t dev); extern int floppy_is_wp(int minor); -extern void sync_inodes(dev_t dev); -extern void sync_dev(dev_t dev); -extern int fsync_dev(dev_t dev); -extern void sync_supers(dev_t dev); +extern void sync_inodes(kdev_t dev); +extern void sync_dev(kdev_t dev); +extern int fsync_dev(kdev_t dev); +extern void sync_supers(kdev_t dev); extern int bmap(struct inode * inode,int block); extern int notify_change(struct inode *, struct iattr *); +extern int _namei(const char * pathname, struct inode * base, + int follow_links, struct inode ** res_inode); extern int namei(const char * pathname, struct inode ** res_inode); +/* + * knamei() is the same as namei() except that it doesn't attempt + * to copy the pathname from userspace to kernelspace. So it + * can be used for names in kernelspace. + */ +extern inline int knamei(const char *pathname, struct inode **res_inode) +{ + return _namei(pathname, NULL, 1, res_inode); +} extern int lnamei(const char * pathname, struct inode ** res_inode); extern int permission(struct inode * inode,int mask); -extern int get_write_access(struct inode * inode); -extern void put_write_access(struct inode * inode); +extern int get_write_access(struct inode *inode); +extern void put_write_access(struct inode *inode); extern int open_namei(const char * pathname, int flag, int mode, struct inode ** res_inode, struct inode * base); extern int do_mknod(const char * filename, int mode, dev_t dev); @@ -490,34 +642,58 @@ extern struct inode * get_empty_inode(void); extern void insert_inode_hash(struct inode *); extern void clear_inode(struct inode *); extern struct inode * get_pipe_inode(void); +extern int get_unused_fd(void); +extern void put_unused_fd(int); extern struct file * get_empty_filp(void); -extern struct buffer_head * get_hash_table(dev_t dev, int block, int size); -extern struct buffer_head * getblk(dev_t dev, int block, int size); +extern int close_fp(struct file *filp); +extern struct buffer_head * get_hash_table(kdev_t dev, int block, int size); +extern struct buffer_head * getblk(kdev_t dev, int block, int size); extern void ll_rw_block(int rw, int nr, struct buffer_head * bh[]); -extern void ll_rw_page(int rw, int dev, unsigned long nr, char * buffer); -extern void ll_rw_swap_file(int rw, int dev, unsigned int *b, int nb, char *buffer); -extern int is_read_only(int dev); -extern void brelse(struct buffer_head * buf); -extern void set_blocksize(dev_t dev, int size); -extern struct buffer_head * bread(dev_t dev, int block, int size); -extern unsigned long bread_page(unsigned long addr,dev_t dev,int b[],int size,int no_share); -extern struct buffer_head * breada(dev_t dev,int block, int size, +extern void ll_rw_page(int rw, kdev_t dev, unsigned long nr, char * buffer); +extern void ll_rw_swap_file(int rw, kdev_t dev, unsigned int *b, int nb, char *buffer); +extern int is_read_only(kdev_t dev); +extern void __brelse(struct buffer_head *buf); +extern inline void brelse(struct buffer_head *buf) +{ + if (buf) + __brelse(buf); +} +extern void __bforget(struct buffer_head *buf); +extern inline void bforget(struct buffer_head *buf) +{ + if (buf) + __bforget(buf); +} +extern void set_blocksize(kdev_t dev, int size); +extern struct buffer_head * bread(kdev_t dev, int block, int size); +extern struct buffer_head * breada(kdev_t dev,int block, int size, unsigned int pos, unsigned int filesize); -extern void put_super(dev_t dev); -unsigned long generate_cluster(dev_t dev, int b[], int size); -extern dev_t ROOT_DEV; + +extern int brw_page(int, struct page *, kdev_t, int [], int, int); + +extern int generic_readpage(struct inode *, struct page *); +extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struct *); +extern long generic_file_read(struct inode *, struct file *, char *, unsigned long); + +extern void put_super(kdev_t dev); +unsigned long generate_cluster(kdev_t dev, int b[], int size); +unsigned long generate_cluster_swab32(kdev_t dev, int b[], int size); +extern kdev_t ROOT_DEV; extern void show_buffers(void); extern void mount_root(void); -extern int char_read(struct inode *, struct file *, char *, int); -extern int block_read(struct inode *, struct file *, char *, int); -extern int read_ahead[]; +#ifdef CONFIG_BLK_DEV_INITRD +extern kdev_t real_root_dev; +extern int change_root(kdev_t new_root_dev,const char *put_old); +#endif -extern int char_write(struct inode *, struct file *, char *, int); -extern int block_write(struct inode *, struct file *, char *, int); +extern long char_read(struct inode *, struct file *, char *, unsigned long); +extern long block_read(struct inode *, struct file *, char *, unsigned long); +extern int read_ahead[]; -extern int generic_mmap(struct inode *, struct file *, struct vm_area_struct *); +extern long char_write(struct inode *, struct file *, const char *, unsigned long); +extern long block_write(struct inode *, struct file *, const char *, unsigned long); extern int block_fsync(struct inode *, struct file *); extern int file_fsync(struct inode *, struct file *); @@ -530,9 +706,13 @@ extern void inode_setattr(struct inode *, struct iattr *); extern inline struct inode * iget(struct super_block * sb,int nr) { - return __iget(sb,nr,1); + return __iget(sb, nr, 1); } +/* kludge to get SCSI modules working */ +#include <linux/minix_fs.h> +#include <linux/minix_fs_sb.h> + #endif /* __KERNEL__ */ #endif diff --git a/include/linux/ftape.h b/include/linux/ftape.h new file mode 100644 index 000000000..0ce7a1c4b --- /dev/null +++ b/include/linux/ftape.h @@ -0,0 +1,70 @@ +#ifndef _FTAPE_H +#define _FTAPE_H + +/* + * Copyright (C) 1994-1995 Bas Laarhoven. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + + * + $Source: /home/bas/distr/ftape-2.03b/RCS/ftape.h,v $ + $Author: bas $ + * + $Revision: 1.18 $ + $Date: 1995/05/06 16:11:53 $ + $State: Beta $ + * + * This file contains global definitions, typedefs and macro's + * for the QIC-40/80 floppy-tape driver for Linux. + */ + +#include <linux/sched.h> +#include <linux/mm.h> + +#define SECTOR(x) (x+1) /* sector offset into real sector */ +#define SECTOR_SIZE (1024) +#define SECTORS_PER_SEGMENT (32) +#define BUFF_SIZE (SECTORS_PER_SEGMENT * SECTOR_SIZE) +#define FTAPE_UNIT (ftape_unit & 3) +#define RQM_DELAY (12) +#define MILLISECOND (1) +#define SECOND (1000) +#define FOREVER (-1) +#ifndef HZ +# error "HZ undefined." +#endif +#define MSPT (SECOND / HZ) /* milliseconds per tick */ + +/* This defines the number of retries that the driver will allow + * before giving up (and letting a higher level handle the error). + */ +#ifdef TESTING +# define SOFT_RETRIES 1 /* number of low level retries */ +# define RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */ +#else +# define SOFT_RETRIES 6 /* number of low level retries (triple) */ +# define RETRIES_ON_ECC_ERROR 3 /* ecc error when correcting segment */ +#endif +/* some useful macro's + */ +#define ABS(a) ((a) < 0 ? -(a) : (a)) +#define NR_ITEMS(x) (sizeof(x)/ sizeof(*x)) + +typedef unsigned char byte; + +extern int ftape_init(void); + +#endif + diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 8ff890e48..535cdefdc 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -8,8 +8,28 @@ * * <drew@colorado.edu> */ - -#define EXTENDED_PARTITION 5 + +#include <linux/config.h> + +#define CONFIG_MSDOS_PARTITION 1 + +#ifdef __alpha__ +#define CONFIG_OSF_PARTITION 1 +#endif + +#if defined(__sparc__) || defined(CONFIG_SMD_DISKLABEL) +#define CONFIG_SUN_PARTITION 1 +#endif + +/* These two have identical behaviour; use the second one if DOS fdisk gets + confused about extended/logical partitions starting past cylinder 1023. */ +#define DOS_EXTENDED_PARTITION 5 +#define LINUX_EXTENDED_PARTITION 0x85 + +#define DM6_PARTITION 0x54 /* has DDO: use xlated geom & offset */ +#define EZD_PARTITION 0x55 /* EZ-DRIVE: same as DM6 (we think) */ +#define DM6_AUX1PARTITION 0x51 /* no DDO: use xlated geom */ +#define DM6_AUX3PARTITION 0x53 /* no DDO: use xlated geom */ struct partition { unsigned char boot_ind; /* 0x80 - active */ @@ -31,22 +51,84 @@ struct hd_struct { struct gendisk { int major; /* major number of driver */ - char *major_name; /* name of major driver */ + const char *major_name; /* name of major driver */ int minor_shift; /* number of times minor is shifted to get real minor */ int max_p; /* maximum partitions per device */ int max_nr; /* maximum number of real devices */ - void (*init)(void); /* Initialization called before we do our thing */ + void (*init)(struct gendisk *); /* Initialization called before we do our thing */ struct hd_struct *part; /* partition table */ - int *sizes; /* size of device in blocks */ + int *sizes; /* device size in blocks, copied to blk_size[] */ int nr_real; /* number of real devices */ void *real_devices; /* internal use */ struct gendisk *next; }; -extern int NR_GENDISKS; /* total */ +#ifdef CONFIG_BSD_DISKLABEL +/* + * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il> + */ + +#define BSD_PARTITION 0xa5 /* Partition ID */ + +#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */ +#define BSD_MAXPARTITIONS 8 +#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */ +struct bsd_disklabel { + __u32 d_magic; /* the magic number */ + __s16 d_type; /* drive type */ + __s16 d_subtype; /* controller/d_type specific */ + char d_typename[16]; /* type name, e.g. "eagle" */ + char d_packname[16]; /* pack identifier */ + __u32 d_secsize; /* # of bytes per sector */ + __u32 d_nsectors; /* # of data sectors per track */ + __u32 d_ntracks; /* # of tracks per cylinder */ + __u32 d_ncylinders; /* # of data cylinders per unit */ + __u32 d_secpercyl; /* # of data sectors per cylinder */ + __u32 d_secperunit; /* # of data sectors per unit */ + __u16 d_sparespertrack; /* # of spare sectors per track */ + __u16 d_sparespercyl; /* # of spare sectors per cylinder */ + __u32 d_acylinders; /* # of alt. cylinders per unit */ + __u16 d_rpm; /* rotational speed */ + __u16 d_interleave; /* hardware sector interleave */ + __u16 d_trackskew; /* sector 0 skew, per track */ + __u16 d_cylskew; /* sector 0 skew, per cylinder */ + __u32 d_headswitch; /* head switch time, usec */ + __u32 d_trkseek; /* track-to-track seek, usec */ + __u32 d_flags; /* generic flags */ +#define NDDATA 5 + __u32 d_drivedata[NDDATA]; /* drive-type specific information */ +#define NSPARE 5 + __u32 d_spare[NSPARE]; /* reserved for future use */ + __u32 d_magic2; /* the magic number (again) */ + __u16 d_checksum; /* xor of data incl. partitions */ + + /* filesystem and partition information: */ + __u16 d_npartitions; /* number of partitions in following */ + __u32 d_bbsize; /* size of boot area at sn0, bytes */ + __u32 d_sbsize; /* max size of fs superblock, bytes */ + struct bsd_partition { /* the partition table */ + __u32 p_size; /* number of sectors in partition */ + __u32 p_offset; /* starting sector */ + __u32 p_fsize; /* filesystem basic fragment size */ + __u8 p_fstype; /* filesystem type, see below */ + __u8 p_frag; /* filesystem fragments per block */ + __u16 p_cpg; /* filesystem cylinders per group */ + } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */ +}; + +#endif /* CONFIG_BSD_DISKLABEL */ + extern struct gendisk *gendisk_head; /* linked list of disks */ +/* + * disk_name() is used by genhd.c and md.c. + * It formats the devicename of the indicated disk + * into the supplied buffer, and returns a pointer + * to that same buffer (for convenience). + */ +char *disk_name (struct gendisk *hd, int minor, char *buf); + #endif diff --git a/include/linux/gscd.h b/include/linux/gscd.h new file mode 100644 index 000000000..fccc742a5 --- /dev/null +++ b/include/linux/gscd.h @@ -0,0 +1,110 @@ +/* + * Definitions for a GoldStar R420 CD-ROM interface + * + * Copyright (C) 1995 Oliver Raupach <raupach@nwfs1.rz.fh-hannover.de> + * Eberhard Moenkeberg <emoenke@gwdg.de> + * + * Published under the GPL. + * + */ + + +/* The Interface Card default address is 0x340. This will work for most + applications. Address selection is accomplished by jumpers PN801-1 to + PN801-4 on the GoldStar Interface Card. + Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360 + 0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0 */ + +/* insert here the I/O port address */ +#define GSCD_BASE_ADDR 0x340 + +/* change this to set the dma-channel */ +#define GSCD_DMA_CHANNEL 3 /* not used */ + +/************** nothing to set up below here *********************/ + +/* port access macro */ +#define GSCDPORT(x) (gscd_port + (x)) + +/* + * commands + * the lower nibble holds the command length + */ +#define CMD_STATUS 0x01 +#define CMD_READSUBQ 0x02 /* 1: ?, 2: UPC, 5: ? */ +#define CMD_SEEK 0x05 /* read_mode M-S-F */ +#define CMD_READ 0x07 /* read_mode M-S-F nsec_h nsec_l */ +#define CMD_RESET 0x11 +#define CMD_SETMODE 0x15 +#define CMD_PLAY 0x17 /* M-S-F M-S-F */ +#define CMD_LOCK_CTL 0x22 /* 0: unlock, 1: lock */ +#define CMD_IDENT 0x31 +#define CMD_SETSPEED 0x32 /* 0: auto */ /* ??? */ +#define CMD_GETMODE 0x41 +#define CMD_PAUSE 0x51 +#define CMD_READTOC 0x61 +#define CMD_DISKINFO 0x71 +#define CMD_TRAY_CTL 0x81 + +/* + * disk_state: + */ +#define ST_PLAYING 0x80 +#define ST_UNLOCKED 0x40 +#define ST_NO_DISK 0x20 +#define ST_DOOR_OPEN 0x10 +#define ST_x08 0x08 +#define ST_x04 0x04 +#define ST_INVALID 0x02 +#define ST_x01 0x01 + +/* + * cmd_type: + */ +#define TYPE_INFO 0x01 +#define TYPE_DATA 0x02 + +/* + * read_mode: + */ +#define MOD_POLLED 0x80 +#define MOD_x08 0x08 +#define MOD_RAW 0x04 + +#define READ_DATA(port, buf, nr) insb(port, buf, nr) + +#define SET_TIMER(func, jifs) \ + ((timer_table[GSCD_TIMER].expires = jiffies + jifs), \ + (timer_table[GSCD_TIMER].fn = func), \ + (timer_active |= 1<<GSCD_TIMER)) + +#define CLEAR_TIMER timer_active &= ~(1<<GSCD_TIMER) + +#define MAX_TRACKS 104 + +struct msf { + unsigned char min; + unsigned char sec; + unsigned char frame; +}; + +struct gscd_Play_msf { + struct msf start; + struct msf end; +}; + +struct gscd_DiskInfo { + unsigned char first; + unsigned char last; + struct msf diskLength; + struct msf firstTrack; +}; + +struct gscd_Toc { + unsigned char ctrl_addr; + unsigned char track; + unsigned char pointIndex; + struct msf trackTime; + struct msf diskTime; +}; + diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h new file mode 100644 index 000000000..82a35d06d --- /dev/null +++ b/include/linux/hdlcdrv.h @@ -0,0 +1,326 @@ +/* + * hdlcdrv.h -- HDLC packet radio network driver. + * The Linux soundcard driver for 1200 baud and 9600 baud packet radio + * (C) 1996 by Thomas Sailer, HB9JNX/AE4WA + */ + +#ifndef _HDLCDRV_H +#define _HDLCDRV_H + +#include <linux/sockios.h> +#include <linux/if_ether.h> +#include <linux/netdevice.h> + +/* -------------------------------------------------------------------- */ +/* + * structs for the IOCTL commands + */ + +struct hdlcdrv_params { + int iobase; + int irq; + int dma; + int seriobase; + int pariobase; + int midiiobase; +}; + +struct hdlcdrv_channel_params { + int tx_delay; /* the transmitter keyup delay in 10ms units */ + int tx_tail; /* the transmitter keyoff delay in 10ms units */ + int slottime; /* the slottime in 10ms; usually 10 = 100ms */ + int ppersist; /* the p-persistence 0..255 */ + int fulldup; /* some driver do not support full duplex, setting */ + /* this just makes them send even if DCD is on */ +}; + +struct hdlcdrv_channel_state { + int ptt; + int dcd; + int ptt_keyed; + struct enet_statistics stats; +}; + +struct hdlcdrv_ioctl { + int cmd; + union { + struct hdlcdrv_params mp; + struct hdlcdrv_channel_params cp; + struct hdlcdrv_channel_state cs; + unsigned int calibrate; + unsigned char bits; + } data; +}; + +/* -------------------------------------------------------------------- */ + +/* + * ioctl values + */ +#define HDLCDRVCTL_GETMODEMPAR 0 +#define HDLCDRVCTL_SETMODEMPAR 1 +#define HDLCDRVCTL_GETCHANNELPAR 2 +#define HDLCDRVCTL_SETCHANNELPAR 3 +#define HDLCDRVCTL_GETSTAT 4 +#define HDLCDRVCTL_CALIBRATE 5 + +/* + * these are mainly for debugging purposes + */ +#define HDLCDRVCTL_GETSAMPLES 10 +#define HDLCDRVCTL_GETBITS 11 + +/* -------------------------------------------------------------------- */ + +#ifdef __KERNEL__ + +#define HDLCDRV_MAGIC 0x5ac6e778 +#define HDLCDRV_IFNAMELEN 6 +#define HDLCDRV_HDLCBUFFER 16 /* should be a power of 2 for speed reasons */ +#define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */ +#undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */ +#undef HDLCDRV_DEBUG + +/* maximum packet length, excluding CRC */ +#define HDLCDRV_MAXFLEN 400 + + +struct hdlcdrv_hdlcbuffer { + unsigned rd, wr; + unsigned short buf[HDLCDRV_HDLCBUFFER]; +}; + +#ifdef HDLCDRV_DEBUG +struct hdlcdrv_bitbuffer { + unsigned int rd; + unsigned int wr; + unsigned int shreg; + unsigned char buffer[HDLCDRV_BITBUFFER]; +}; + +extern inline void hdlcdrv_add_bitbuffer(struct hdlcdrv_bitbuffer *buf, + unsigned int bit) +{ + unsigned char new; + + new = buf->shreg & 1; + buf->shreg >>= 1; + buf->shreg |= (!!bit) << 7; + if (new) { + buf->buffer[buf->wr] = buf->shreg; + buf->wr = (buf->wr+1) % sizeof(buf->buffer); + buf->shreg = 0x80; + } +} + +extern inline void hdlcdrv_add_bitbuffer_word(struct hdlcdrv_bitbuffer *buf, + unsigned int bits) +{ + buf->buffer[buf->wr] = bits & 0xff; + buf->wr = (buf->wr+1) % sizeof(buf->buffer); + buf->buffer[buf->wr] = (bits >> 8) & 0xff; + buf->wr = (buf->wr+1) % sizeof(buf->buffer); + +} +#endif /* HDLCDRV_DEBUG */ + +/* -------------------------------------------------------------------- */ +/* + * Information that need to be kept for each driver. + */ + +struct hdlcdrv_ops { + /* + * first some informations needed by the hdlcdrv routines + */ + int bitrate; + /* + * the routines called by the hdlcdrv routines + */ + int (*open)(struct device *); + int (*close)(struct device *); + int (*ioctl)(struct device *, struct ifreq *, int); +}; + +struct hdlcdrv_state { + int magic; + + char ifname[HDLCDRV_IFNAMELEN]; + + const struct hdlcdrv_ops *ops; + + struct hdlcdrv_pttoutput { + int seriobase; + int pariobase; + int midiiobase; + unsigned int flags; + } ptt_out; + + struct hdlcdrv_channel_params ch_params; + + struct hdlcdrv_hdlcrx { + struct hdlcdrv_hdlcbuffer hbuf; + int in_hdlc_rx; + /* 0 = sync hunt, != 0 receiving */ + int rx_state; + unsigned int bitstream; + unsigned int bitbuf; + int numbits; + unsigned char dcd; + + int len; + unsigned char *bp; + unsigned char buffer[HDLCDRV_MAXFLEN+2]; + } hdlcrx; + + struct hdlcdrv_hdlctx { + struct hdlcdrv_hdlcbuffer hbuf; + int in_hdlc_tx; + /* + * 0 = send flags + * 1 = send txtail (flags) + * 2 = send packet + */ + int tx_state; + int numflags; + unsigned int bitstream; + unsigned char ptt; + int calibrate; + int slotcnt; + + unsigned int bitbuf; + int numbits; + + int len; + unsigned char *bp; + unsigned char buffer[HDLCDRV_MAXFLEN+2]; + } hdlctx; + +#ifdef HDLCDRV_DEBUG + struct hdlcdrv_bitbuffer bitbuf_channel; + struct hdlcdrv_bitbuffer bitbuf_hdlc; +#endif /* HDLCDRV_DEBUG */ + + struct enet_statistics stats; + int ptt_keyed; + + struct sk_buff_head send_queue; /* Packets awaiting transmission */ +}; + + +/* -------------------------------------------------------------------- */ + +extern inline int hdlcdrv_hbuf_full(struct hdlcdrv_hdlcbuffer *hb) +{ + return !((HDLCDRV_HDLCBUFFER - 1 + hb->rd - hb->wr) + % HDLCDRV_HDLCBUFFER); +} + +/* -------------------------------------------------------------------- */ + +extern inline int hdlcdrv_hbuf_empty(struct hdlcdrv_hdlcbuffer *hb) +{ + return hb->rd == hb->wr; +} + +/* -------------------------------------------------------------------- */ + +extern inline unsigned short hdlcdrv_hbuf_get(struct hdlcdrv_hdlcbuffer *hb) +{ + unsigned newr; + unsigned short val; + unsigned long flags; + + if (hb->rd == hb->wr) + return 0; + save_flags(flags); + cli(); + newr = (hb->rd+1) % HDLCDRV_HDLCBUFFER; + val = hb->buf[hb->rd]; + hb->rd = newr; + restore_flags(flags); + return val; +} + +/* -------------------------------------------------------------------- */ + +extern inline void hdlcdrv_hbuf_put(struct hdlcdrv_hdlcbuffer *hb, + unsigned short val) +{ + unsigned newp; + unsigned long flags; + + save_flags(flags); + cli(); + newp = (hb->wr+1) % HDLCDRV_HDLCBUFFER; + if (newp != hb->rd) { + hb->buf[hb->wr] = val & 0xffff; + hb->wr = newp; + } + restore_flags(flags); +} + +/* -------------------------------------------------------------------- */ + +extern void hdlcdrv_putbits(struct hdlcdrv_state *s, unsigned int bits) +{ + hdlcdrv_hbuf_put(&s->hdlcrx.hbuf, bits); +} + +extern unsigned int hdlcdrv_getbits(struct hdlcdrv_state *s) +{ + unsigned int ret; + + if (hdlcdrv_hbuf_empty(&s->hdlctx.hbuf)) { + if (s->hdlctx.calibrate > 0) + s->hdlctx.calibrate--; + else + s->hdlctx.ptt = 0; + ret = 0; + } else + ret = hdlcdrv_hbuf_get(&s->hdlctx.hbuf); +#ifdef HDLCDRV_LOOPBACK + hdlcdrv_hbuf_put(&s->hdlcrx.hbuf, ret); +#endif /* HDLCDRV_LOOPBACK */ + return ret; +} + +extern void hdlcdrv_channelbit(struct hdlcdrv_state *s, unsigned int bit) +{ +#ifdef HDLCDRV_DEBUG + hdlcdrv_add_bitbuffer(&s->bitbuf_channel, bit); +#endif /* HDLCDRV_DEBUG */ +} + +extern void hdlcdrv_setdcd(struct hdlcdrv_state *s, int dcd) +{ + s->hdlcrx.dcd = !!dcd; +} + +extern int hdlcdrv_ptt(struct hdlcdrv_state *s) +{ + return s->hdlctx.ptt || (s->hdlctx.calibrate > 0); +} + +/* -------------------------------------------------------------------- */ + +void hdlcdrv_receiver(struct device *, struct hdlcdrv_state *); +void hdlcdrv_transmitter(struct device *, struct hdlcdrv_state *); +void hdlcdrv_arbitrate(struct device *, struct hdlcdrv_state *); +int hdlcdrv_register_hdlcdrv(struct device *dev, const struct hdlcdrv_ops *ops, + unsigned int privsize, char *ifname, + unsigned int baseaddr, unsigned int irq, + unsigned int dma); +int hdlcdrv_unregister_hdlcdrv(struct device *dev); + +/* -------------------------------------------------------------------- */ + + + +#endif /* __KERNEL__ */ + +/* -------------------------------------------------------------------- */ + +#endif /* _HDLCDRV_H */ + +/* -------------------------------------------------------------------- */ diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h index 1640a3beb..ba4b62648 100644 --- a/include/linux/hdreg.h +++ b/include/linux/hdreg.h @@ -1,16 +1,16 @@ #ifndef _LINUX_HDREG_H #define _LINUX_HDREG_H -#include <linux/config.h> - /* * This file contains some defines for the AT-hd-controller. - * Various sources. Check out some definitions (see comments with - * a ques). + * Various sources. */ +#define HD_IRQ 14 /* the standard disk interrupt */ + +/* ide.c has its own port definitions in "ide.h" */ + /* Hd controller regs. Ref: IBM AT Bios-listing */ -/* For a second IDE interface, xor all addresses with 0x80 */ #define HD_DATA 0x1f0 /* _CTL when writing */ #define HD_ERROR 0x1f1 /* see err-bits */ #define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */ @@ -26,6 +26,8 @@ #define HD_CMD 0x3f6 /* used for resets */ #define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */ +/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */ + /* Bits of HD_STATUS */ #define ERR_STAT 0x01 #define INDEX_STAT 0x02 @@ -45,16 +47,25 @@ #define WIN_INIT 0x60 #define WIN_SEEK 0x70 #define WIN_DIAGNOSE 0x90 -#define WIN_SPECIFY 0x91 +#define WIN_SPECIFY 0x91 /* set drive geometry translation */ #define WIN_SETIDLE1 0xE3 #define WIN_SETIDLE2 0x97 -#define WIN_PIDENTIFY 0xA1 /* identify ATA-PI device */ -#define WIN_MULTREAD 0xC4 /* read multiple sectors */ -#define WIN_MULTWRITE 0xC5 /* write multiple sectors */ -#define WIN_SETMULT 0xC6 /* enable read multiple */ +#define WIN_DOORLOCK 0xde /* lock door on removable drives */ +#define WIN_DOORUNLOCK 0xdf /* unlock door on removable drives */ + +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode */ +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ -#define WIN_SETFEATURES 0xEF /* set special drive features */ +#define WIN_SETFEATURES 0xEF /* set special drive features */ +#define WIN_READDMA 0xc8 /* read sectors using DMA transfers */ +#define WIN_WRITEDMA 0xca /* write sectors using DMA transfers */ + +/* Additional drive command codes used by ATAPI devices. */ +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ +#define WIN_SRST 0x08 /* ATAPI soft reset command */ +#define WIN_PACKETCMD 0xa0 /* Send a packet command. */ /* Bits for HD_ERROR */ #define MARK_ERR 0x01 /* Bad address mark */ @@ -71,21 +82,26 @@ struct hd_geometry { unsigned long start; }; -/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x30n/0x31n */ -#define HDIO_GETGEO 0x301 /* get device geometry */ -#define HDIO_REQ HDIO_GETGEO /* obsolete, use HDIO_GETGEO */ -#define HDIO_GET_UNMASKINTR 0x302 /* get current unmask setting */ -#define HDIO_GET_MULTCOUNT 0x304 /* get current IDE blockmode setting */ -#define HDIO_GET_IDENTITY 0x307 /* get IDE identification info */ -#define HDIO_GET_KEEPSETTINGS 0x308 /* get keep-settings-on-reset flag */ -#define HDIO_GET_CHIPSET 0x309 /* get current interface type setting */ -#define HDIO_DRIVE_CMD 0x31f /* execute a special drive command */ - -/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x32n/0x33n */ -#define HDIO_SET_MULTCOUNT 0x321 /* set IDE blockmode */ -#define HDIO_SET_UNMASKINTR 0x322 /* permit other irqs during I/O */ -#define HDIO_SET_KEEPSETTINGS 0x323 /* keep ioctl settings on reset */ -#define HDIO_SET_CHIPSET 0x324 /* optimise driver for interface type */ +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ +#define HDIO_GETGEO 0x0301 /* get device geometry */ +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ +#define HDIO_GET_IDENTITY 0x0307 /* get IDE identification info */ +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ +#define HDIO_GET_DMA 0x030b /* get use-dma flag */ +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ + +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ /* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */ struct hd_driveid { @@ -138,18 +154,25 @@ struct hd_driveid { /* unsigned short reservedyy[96];*/ /* reserved (words 160-255) */ }; +#ifdef __KERNEL__ /* * These routines are used for kernel command line parameters from main.c: */ +#include <linux/config.h> + #ifdef CONFIG_BLK_DEV_HD void hd_setup(char *, int *); #endif /* CONFIG_BLK_DEV_HD */ + #ifdef CONFIG_BLK_DEV_IDE -void ide_setup(char *, int *); -void hda_setup(char *, int *); -void hdb_setup(char *, int *); -void hdc_setup(char *, int *); -void hdd_setup(char *, int *); +void ide_setup(char *); #endif /* CONFIG_BLK_DEV_IDE */ +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) +int ide_register(int io_port, int ctl_port, int irq); +void ide_unregister(unsigned int); +#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */ + +#endif /* __KERNEL__ */ + #endif /* _LINUX_HDREG_H */ diff --git a/include/linux/hpfs_fs.h b/include/linux/hpfs_fs.h index 0094c359c..2b7926aba 100644 --- a/include/linux/hpfs_fs.h +++ b/include/linux/hpfs_fs.h @@ -8,5 +8,6 @@ /* The entry point for a VFS */ extern struct super_block *hpfs_read_super (struct super_block *, void *, int); +extern int init_hpfs_fs(void); #endif diff --git a/include/linux/icmp.h b/include/linux/icmp.h index ca1e8c6bf..611c41da8 100644 --- a/include/linux/icmp.h +++ b/include/linux/icmp.h @@ -46,6 +46,10 @@ #define ICMP_HOST_ANO 10 #define ICMP_NET_UNR_TOS 11 #define ICMP_HOST_UNR_TOS 12 +#define ICMP_PKT_FILTERED 13 /* Packet filtered */ +#define ICMP_PREC_VIOLATION 14 /* Precedence violation */ +#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */ +#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */ /* Codes for REDIRECT. */ #define ICMP_REDIR_NET 0 /* Redirect Net */ @@ -59,15 +63,15 @@ struct icmphdr { - unsigned char type; - unsigned char code; - unsigned short checksum; + __u8 type; + __u8 code; + __u16 checksum; union { struct { - unsigned short id; - unsigned short sequence; + __u16 id; + __u16 sequence; } echo; - unsigned long gateway; + __u32 gateway; } un; }; diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h new file mode 100644 index 000000000..d600403c8 --- /dev/null +++ b/include/linux/icmpv6.h @@ -0,0 +1,142 @@ +#ifndef _LINUX_ICMPV6_H +#define _LINUX_ICMPV6_H + +#include <asm/byteorder.h> + +struct icmpv6hdr { + + __u8 type; + __u8 code; + __u16 checksum; + + + union { + struct icmpv6_echo { + __u16 identifier; + __u16 sequence; + } u_echo; + __u32 pointer; + __u32 mtu; + __u32 unused; + + struct icmpv6_nd_advt { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u32 reserved:5, + override:1, + solicited:1, + router:1, + reserved2:24; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u32 router:1, + solicited:1, + override:1, + reserved:29; +#else +#error "Please fix <asm/byteorder.h>" +#endif + } u_nd_advt; + + struct icmpv6_nd_ra { + __u8 hop_limit; +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 reserved:6, + other:1, + managed:1; + +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 managed:1, + other:1, + reserved:6; +#else +#error "Please fix <asm/byteorder.h>" +#endif + __u16 rt_lifetime; + } u_nd_ra; + + } u; + +#define icmp6_identifier u.u_echo.identifier +#define icmp6_sequence u.u_echo.sequence +#define icmp6_pointer u.pointer +#define icmp6_mtu u.mtu +#define icmp6_unused u.unused +#define icmp6_router u.u_nd_advt.router +#define icmp6_solicited u.u_nd_advt.solicited +#define icmp6_override u.u_nd_advt.override +#define icmp6_ndiscreserved u.u_nd_advt.reserved +#define icmp6_hop_limit u.u_nd_ra.hop_limit +#define icmp6_addrconf_managed u.u_nd_ra.managed +#define icmp6_addrconf_other u.u_nd_ra.other +#define icmp6_rt_lifetime u.u_nd_ra.rt_lifetime +}; + + +#define ICMPV6_DEST_UNREACH 1 +#define ICMPV6_PKT_TOOBIG 2 +#define ICMPV6_TIME_EXCEEDED 3 +#define ICMPV6_PARAMETER_PROB 4 + +#define ICMPV6_ECHO_REQUEST 128 +#define ICMPV6_ECHO_REPLY 129 +#define ICMPV6_MEMBERSHIP_QUERY 130 +#define ICMPV6_MEMBERSHIP_REPORT 131 +#define ICMPV6_MEMBERSHIP_REDUCTION 132 + +/* + * Codes for Destination Unreachable + */ +#define ICMPV6_NOROUTE 0 +#define ICMPV6_ADM_PROHIBITED 1 +#define ICMPV6_NOT_NEIGHBOUR 2 +#define ICMPV6_ADDR_UNREACH 3 +#define ICMPV6_PORT_UNREACH 4 + +/* + * Codes for Time Exceeded + */ +#define ICMPV6_EXC_HOPLIMIT 0 +#define ICMPV6_EXC_FRAGTIME 1 + +/* + * Codes for Parameter Problem + */ +#define ICMPV6_HDR_FIELD 0 +#define ICMPV6_UNK_NEXTHDR 1 +#define ICMPV6_UNK_OPTION 2 + +/* + * constants for (set|get)sockopt + */ + +#define ICMPV6_FILTER 1 + +/* + * ICMPV6 filter + */ + +#define ICMPV6_FILTER_BLOCK 1 +#define ICMPV6_FILTER_PASS 2 +#define ICMPV6_FILTER_BLOCKOTHERS 3 +#define ICMPV6_FILTER_PASSONLY 4 + +struct icmp6_filter { + __u32 data[8]; +}; + +#ifdef __KERNEL__ + +#include <linux/netdevice.h> +#include <linux/skbuff.h> + + +extern void icmpv6_send(struct sk_buff *skb, + int type, int code, + __u32 info, + struct device *dev); + +extern void icmpv6_init(struct proto_ops *ops); +extern int icmpv6_err_convert(int type, int code, + int *err); +#endif + +#endif diff --git a/include/linux/if.h b/include/linux/if.h index 13af3bb7e..ffa226a62 100644 --- a/include/linux/if.h +++ b/include/linux/if.h @@ -97,7 +97,6 @@ struct ifreq union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - char ifrn_hwaddr[IFHWADDRLEN]; /* Obsolete */ } ifr_ifrn; union { @@ -107,7 +106,7 @@ struct ifreq struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; - int ifru_metric; + int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ @@ -116,18 +115,18 @@ struct ifreq }; #define ifr_name ifr_ifrn.ifrn_name /* interface name */ -#define old_ifr_hwaddr ifr_ifrn.ifrn_hwaddr /* interface hardware */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ #define ifr_flags ifr_ifru.ifru_flags /* flags */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ +#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ #define ifr_map ifr_ifru.ifru_map /* device map */ #define ifr_slave ifr_ifru.ifru_slave /* slave device */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */ +#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ /* * Structure used in SIOCGIFCONF request. @@ -148,9 +147,4 @@ struct ifconf #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ #define ifc_req ifc_ifcu.ifcu_req /* array of structures */ - -/* BSD UNIX expects to find these here, so here we go: */ -#include <linux/if_arp.h> -#include <linux/route.h> - #endif /* _LINUX_IF_H */ diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 75f86b616..fffb67990 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -11,7 +11,8 @@ * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source. * Ross Biro, <bir7@leland.Stanford.Edu> * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> - * Florian La Roche. + * Florian La Roche, + * Jonathan Layes <layes@loran.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,6 +22,8 @@ #ifndef _LINUX_IF_ARP_H #define _LINUX_IF_ARP_H +#include <linux/netdevice.h> + /* ARP protocol HARDWARE identifiers. */ #define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */ #define ARPHRD_ETHER 1 /* Ethernet 10Mbps */ @@ -28,9 +31,12 @@ #define ARPHRD_AX25 3 /* AX.25 Level 2 */ #define ARPHRD_PRONET 4 /* PROnet token ring */ #define ARPHRD_CHAOS 5 /* Chaosnet */ -#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet- huh? */ +#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */ #define ARPHRD_ARCNET 7 /* ARCnet */ #define ARPHRD_APPLETLK 8 /* APPLEtalk */ +#define ARPHRD_DLCI 15 /* Frame Relay DLCI */ +#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */ + /* Dummy types for non ARP hardware */ #define ARPHRD_SLIP 256 #define ARPHRD_CSLIP 257 @@ -38,8 +44,18 @@ #define ARPHRD_CSLIP6 259 #define ARPHRD_RSRVD 260 /* Notional KISS type */ #define ARPHRD_ADAPT 264 +#define ARPHRD_ROSE 270 +#define ARPHRD_X25 271 /* CCITT X.25 */ #define ARPHRD_PPP 512 + #define ARPHRD_TUNNEL 768 /* IPIP tunnel */ +#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel */ +#define ARPHRD_FRAD 770 /* Frame Relay Access Device */ +#define ARPHRD_SKIP 771 /* SKIP vif */ +#define ARPHRD_LOOPBACK 772 /* Loopback device */ +#define ARPHRD_LOCALTLK 773 /* Localtalk device */ +#define ARPHRD_FDDI 774 /* FDDI interfaces */ +#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */ /* ARP protocol opcodes. */ #define ARPOP_REQUEST 1 /* ARP request */ @@ -54,6 +70,14 @@ struct arpreq { struct sockaddr arp_ha; /* hardware address */ int arp_flags; /* flags */ struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ + char arp_dev[16]; +}; + +struct arpreq_old { + struct sockaddr arp_pa; /* protocol address */ + struct sockaddr arp_ha; /* hardware address */ + int arp_flags; /* flags */ + struct sockaddr arp_netmask; /* netmask (only for proxy arps) */ }; /* ARP Flag values. */ @@ -88,4 +112,20 @@ struct arphdr }; +/* Support for the user space arp daemon, arpd */ + +#define ARPD_UPDATE 0x01 +#define ARPD_LOOKUP 0x02 +#define ARPD_FLUSH 0x03 + +struct arpd_request +{ + unsigned short req; /* request type */ + __u32 ip; /* ip address of entry */ + unsigned long dev; /* Device entry is tied to */ + unsigned long stamp; + unsigned long updated; + unsigned char ha[MAX_ADDR_LEN]; /* Hardware address */ +}; + #endif /* _LINUX_IF_ARP_H */ diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h index 5a03f21c8..320dbebf1 100644 --- a/include/linux/if_eql.h +++ b/include/linux/if_eql.h @@ -2,7 +2,7 @@ * Equalizer Load-balancer for serial network interfaces. * * (c) Copyright 1995 Simon "Guru Aleph-Null" Janes - * NCM: Network and Communications Mangement, Inc. + * NCM: Network and Communications Management, Inc. * * * This software may be used and distributed according to the terms @@ -19,6 +19,8 @@ #ifndef _LINUX_IF_EQL_H #define _LINUX_IF_EQL_H +#include <linux/timer.h> + #define EQL_DEFAULT_SLAVE_PRIORITY 28800 #define EQL_DEFAULT_MAX_SLAVES 4 #define EQL_DEFAULT_MTU 576 diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index eb6a07cce..dd09d8352 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -9,73 +9,111 @@ * * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * Donald Becker, <becker@super.org> + * Alan Cox, <alan@cymru.net> + * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H +/* + * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble + * and FCS/CRC (frame check sequence). + */ -/* IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble - and FCS/CRC (frame check sequence). */ #define ETH_ALEN 6 /* Octets in one ethernet addr */ #define ETH_HLEN 14 /* Total octets in header. */ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500 /* Max. octets in payload */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ +/* + * These are the defined Ethernet Protocol ID's. + */ -/* These are the defined Ethernet Protocol ID's. */ #define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ #define ETH_P_ECHO 0x0200 /* Ethernet Echo packet */ #define ETH_P_PUP 0x0400 /* Xerox PUP packet */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ +#define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ +#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_DEC 0x6000 /* DEC Assigned proto */ +#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ +#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ +#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */ +#define ETH_P_LAT 0x6004 /* DEC LAT */ +#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ +#define ETH_P_CUST 0x6006 /* DEC Customer use */ +#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ -#define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ATALK 0x809B /* Appletalk DDP */ #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ +#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ + +/* + * Non DIX types. Won't clash for 1500 types. + */ + #define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */ #define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */ #define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */ #define ETH_P_802_2 0x0004 /* 802.2 frames */ #define ETH_P_SNAP 0x0005 /* Internal only */ -/* This is an Ethernet frame header. */ -struct ethhdr { - unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ - unsigned char h_source[ETH_ALEN]; /* source ether addr */ - unsigned short h_proto; /* packet type ID field */ +#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */ +#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ +#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ +#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ +#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ + +/* + * This is an Ethernet frame header. + */ + +struct ethhdr +{ + unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ + unsigned char h_source[ETH_ALEN]; /* source ether addr */ + unsigned short h_proto; /* packet type ID field */ }; -/* Ethernet statistics collection data. */ -struct enet_statistics{ - int rx_packets; /* total packets received */ - int tx_packets; /* total packets transmitted */ - int rx_errors; /* bad packets received */ - int tx_errors; /* packet transmit problems */ - int rx_dropped; /* no space in linux buffers */ - int tx_dropped; /* no space available in linux */ - int multicast; /* multicast packets received */ - int collisions; +/* + * Ethernet statistics collection data. + */ + +struct enet_statistics +{ + int rx_packets; /* total packets received */ + int tx_packets; /* total packets transmitted */ + int rx_errors; /* bad packets received */ + int tx_errors; /* packet transmit problems */ + int rx_dropped; /* no space in linux buffers */ + int tx_dropped; /* no space available in linux */ + int multicast; /* multicast packets received */ + int collisions; - /* detailed rx_errors: */ - int rx_length_errors; - int rx_over_errors; /* receiver ring buff overflow */ - int rx_crc_errors; /* recved pkt with crc error */ - int rx_frame_errors; /* recv'd frame alignment error */ - int rx_fifo_errors; /* recv'r fifo overrun */ - int rx_missed_errors; /* receiver missed packet */ + /* detailed rx_errors: */ + int rx_length_errors; + int rx_over_errors; /* receiver ring buff overflow */ + int rx_crc_errors; /* recved pkt with crc error */ + int rx_frame_errors; /* recv'd frame alignment error */ + int rx_fifo_errors; /* recv'r fifo overrun */ + int rx_missed_errors; /* receiver missed packet */ - /* detailed tx_errors */ - int tx_aborted_errors; - int tx_carrier_errors; - int tx_fifo_errors; - int tx_heartbeat_errors; - int tx_window_errors; + /* detailed tx_errors */ + int tx_aborted_errors; + int tx_carrier_errors; + int tx_fifo_errors; + int tx_heartbeat_errors; + int tx_window_errors; }; + #endif /* _LINUX_IF_ETHER_H */ diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h new file mode 100644 index 000000000..6db6745b6 --- /dev/null +++ b/include/linux/if_fddi.h @@ -0,0 +1,202 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the ANSI FDDI interface. + * + * Version: @(#)if_fddi.h 1.0.1 09/16/96 + * + * Author: Lawrence V. Stefani, <stefani@lkg.dec.com> + * + * if_fddi.h is based on previous if_ether.h and if_tr.h work by + * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> + * Donald Becker, <becker@super.org> + * Alan Cox, <alan@cymru.net> + * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> + * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _LINUX_IF_FDDI_H +#define _LINUX_IF_FDDI_H + +/* + * Define max and min legal sizes. The frame sizes do not include + * 4 byte FCS/CRC (frame check sequence). + */ +#define FDDI_K_ALEN 6 /* Octets in one FDDI address */ +#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ +#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ +#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ +#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ +#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ +#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ +#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ +#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ + +/* Define FDDI Frame Control (FC) Byte values */ +#define FDDI_FC_K_VOID 0x00 +#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 +#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 +#define FDDI_FC_K_SMT_MIN 0x41 +#define FDDI_FC_K_SMT_MAX 0x4F +#define FDDI_FC_K_MAC_MIN 0xC1 +#define FDDI_FC_K_MAC_MAX 0xCF +#define FDDI_FC_K_ASYNC_LLC_MIN 0x50 +#define FDDI_FC_K_ASYNC_LLC_DEF 0x54 +#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F +#define FDDI_FC_K_SYNC_LLC_MIN 0xD0 +#define FDDI_FC_K_SYNC_LLC_MAX 0xD7 +#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 +#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F +#define FDDI_FC_K_RESERVED_MIN 0x70 +#define FDDI_FC_K_RESERVED_MAX 0x7F + +/* Define LLC and SNAP constants */ +#define FDDI_EXTENDED_SAP 0xAA +#define FDDI_UI_CMD 0x03 + +/* Define 802.2 Type 1 header */ +struct fddi_8022_1_hdr + { + __u8 dsap; /* destination service access point */ + __u8 ssap; /* source service access point */ + __u8 ctrl; /* control byte #1 */ + } __attribute__ ((packed)); + +/* Define 802.2 Type 2 header */ +struct fddi_8022_2_hdr + { + __u8 dsap; /* destination service access point */ + __u8 ssap; /* source service access point */ + __u8 ctrl_1; /* control byte #1 */ + __u8 ctrl_2; /* control byte #2 */ + } __attribute__ ((packed)); + +/* Define 802.2 SNAP header */ +#define FDDI_K_OUI_LEN 3 +struct fddi_snap_hdr + { + __u8 dsap; /* always 0xAA */ + __u8 ssap; /* always 0xAA */ + __u8 ctrl; /* always 0x03 */ + __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ + __u16 ethertype; /* packet type ID field */ + } __attribute__ ((packed)); + +/* Define FDDI LLC frame header */ +struct fddihdr + { + __u8 fc; /* frame control */ + __u8 daddr[FDDI_K_ALEN]; /* destination address */ + __u8 saddr[FDDI_K_ALEN]; /* source address */ + union + { + struct fddi_8022_1_hdr llc_8022_1; + struct fddi_8022_2_hdr llc_8022_2; + struct fddi_snap_hdr llc_snap; + } hdr; + } __attribute__ ((packed)); + +/* Define FDDI statistics structure */ +struct fddi_statistics + { + __u32 rx_packets; /* total packets received */ + __u32 tx_packets; /* total packets transmitted */ + __u32 rx_errors; /* bad packets received */ + __u32 tx_errors; /* packet transmit problems */ + __u32 rx_dropped; /* no space in linux buffers */ + __u32 tx_dropped; /* no space available in linux */ + __u32 multicast; /* multicast packets received */ + __u32 transmit_collision; /* always 0 for FDDI */ + + /* Detailed FDDI statistics. Adopted from RFC 1512 */ + + __u8 smt_station_id[8]; + __u32 smt_op_version_id; + __u32 smt_hi_version_id; + __u32 smt_lo_version_id; + __u8 smt_user_data[32]; + __u32 smt_mib_version_id; + __u32 smt_mac_cts; + __u32 smt_non_master_cts; + __u32 smt_master_cts; + __u32 smt_available_paths; + __u32 smt_config_capabilities; + __u32 smt_config_policy; + __u32 smt_connection_policy; + __u32 smt_t_notify; + __u32 smt_stat_rpt_policy; + __u32 smt_trace_max_expiration; + __u32 smt_bypass_present; + __u32 smt_ecm_state; + __u32 smt_cf_state; + __u32 smt_remote_disconnect_flag; + __u32 smt_station_status; + __u32 smt_peer_wrap_flag; + __u32 smt_time_stamp; + __u32 smt_transition_time_stamp; + __u32 mac_frame_status_functions; + __u32 mac_t_max_capability; + __u32 mac_tvx_capability; + __u32 mac_available_paths; + __u32 mac_current_path; + __u8 mac_upstream_nbr[FDDI_K_ALEN]; + __u8 mac_downstream_nbr[FDDI_K_ALEN]; + __u8 mac_old_upstream_nbr[FDDI_K_ALEN]; + __u8 mac_old_downstream_nbr[FDDI_K_ALEN]; + __u32 mac_dup_address_test; + __u32 mac_requested_paths; + __u32 mac_downstream_port_type; + __u8 mac_smt_address[FDDI_K_ALEN]; + __u32 mac_t_req; + __u32 mac_t_neg; + __u32 mac_t_max; + __u32 mac_tvx_value; + __u32 mac_frame_cts; + __u32 mac_copied_cts; + __u32 mac_transmit_cts; + __u32 mac_error_cts; + __u32 mac_lost_cts; + __u32 mac_frame_error_threshold; + __u32 mac_frame_error_ratio; + __u32 mac_rmt_state; + __u32 mac_da_flag; + __u32 mac_una_da_flag; + __u32 mac_frame_error_flag; + __u32 mac_ma_unitdata_available; + __u32 mac_hardware_present; + __u32 mac_ma_unitdata_enable; + __u32 path_tvx_lower_bound; + __u32 path_t_max_lower_bound; + __u32 path_max_t_req; + __u32 path_configuration[8]; + __u32 port_my_type[2]; + __u32 port_neighbor_type[2]; + __u32 port_connection_policies[2]; + __u32 port_mac_indicated[2]; + __u32 port_current_path[2]; + __u8 port_requested_paths[3*2]; + __u32 port_mac_placement[2]; + __u32 port_available_paths[2]; + __u32 port_pmd_class[2]; + __u32 port_connection_capabilities[2]; + __u32 port_bs_flag[2]; + __u32 port_lct_fail_cts[2]; + __u32 port_ler_estimate[2]; + __u32 port_lem_reject_cts[2]; + __u32 port_lem_cts[2]; + __u32 port_ler_cutoff[2]; + __u32 port_ler_alarm[2]; + __u32 port_connect_state[2]; + __u32 port_pcm_state[2]; + __u32 port_pc_withhold[2]; + __u32 port_ler_flag[2]; + __u32 port_hardware_present[2]; + }; + +#endif /* _LINUX_IF_FDDI_H */ diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h new file mode 100644 index 000000000..6dcbed815 --- /dev/null +++ b/include/linux/if_frad.h @@ -0,0 +1,194 @@ +/* + * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are + * created for each DLCI associated with a FRAD. The FRAD driver + * is not truly a network device, but the lower level device + * handler. This allows other FRAD manufacturers to use the DLCI + * code, including its RFC1490 encapsulation alongside the current + * implementation for the Sangoma cards. + * + * Version: @(#)if_ifrad.h 0.15 31 Mar 96 + * + * Author: Mike McLagan <mike.mclagan@linux.org> + * + * Changes: + * 0.15 Mike McLagan changed structure defs (packed) + * re-arranged flags + * added DLCI_RET vars + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _FRAD_H_ +#define _FRAD_H_ + +#include <linux/if.h> + +/* Structures and constants associated with the DLCI device driver */ + +struct dlci_add +{ + char devname[IFNAMSIZ]; + short dlci; +}; + +#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2) +#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3) + +/* + * These are related to the Sangoma SDLA and should remain in order. + * Code within the SDLA module is based on the specifics of this + * structure. Change at your own peril. + */ +struct dlci_conf { + short flags; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + +/* these are part of the status read */ + short Tc_fwd; + short Tc_bwd; + short Tf_max; + short Tb_max; + +/* add any new fields here above is a mirror of sdla_dlci_conf */ +}; + +#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4) + +/* configuration flags for DLCI */ +#define DLCI_IGNORE_CIR_OUT 0x0001 +#define DLCI_ACCOUNT_CIR_IN 0x0002 +#define DLCI_BUFFER_IF 0x0008 + +#define DLCI_VALID_FLAGS 0x000B + +/* FRAD driver uses these to indicate what it did with packet */ +#define DLCI_RET_OK 0x00 +#define DLCI_RET_ERR 0x01 +#define DLCI_RET_DROP 0x02 + +/* defines for the actual Frame Relay hardware */ +#define FRAD_GET_CONF (SIOCDEVPRIVATE) +#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1) + +#define FRAD_LAST_IOCTL FRAD_SET_CONF + +/* + * Based on the setup for the Sangoma SDLA. If changes are + * necessary to this structure, a routine will need to be + * added to that module to copy fields. + */ +struct frad_conf +{ + short station; + short flags; + short kbaud; + short clocking; + short mtu; + short T391; + short T392; + short N391; + short N392; + short N393; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + +/* Add new fields here, above is a mirror of the sdla_conf */ + +}; + +#define FRAD_STATION_CPE 0x0000 +#define FRAD_STATION_NODE 0x0001 + +#define FRAD_TX_IGNORE_CIR 0x0001 +#define FRAD_RX_ACCOUNT_CIR 0x0002 +#define FRAD_DROP_ABORTED 0x0004 +#define FRAD_BUFFERIF 0x0008 +#define FRAD_STATS 0x0010 +#define FRAD_MCI 0x0100 +#define FRAD_AUTODLCI 0x8000 +#define FRAD_VALID_FLAGS 0x811F + +#define FRAD_CLOCK_INT 0x0001 +#define FRAD_CLOCK_EXT 0x0000 + +#ifdef __KERNEL__ + +/* these are the fields of an RFC 1490 header */ +struct frhdr +{ + unsigned char control __attribute__((packed)); + + /* for IP packets, this can be the NLPID */ + unsigned char pad __attribute__((packed)); + + unsigned char NLPID __attribute__((packed)); + unsigned char OUI[3] __attribute__((packed)); + unsigned short PID __attribute__((packed)); + +#define IP_NLPID pad +}; + +/* see RFC 1490 for the definition of the following */ +#define FRAD_I_UI 0x03 + +#define FRAD_P_PADDING 0x00 +#define FRAD_P_Q933 0x08 +#define FRAD_P_SNAP 0x80 +#define FRAD_P_CLNP 0x81 +#define FRAD_P_IP 0xCC + +struct dlci_local +{ + struct enet_statistics stats; + struct device *slave; + struct dlci_conf config; + int configured; + + /* callback function */ + void (*receive)(struct sk_buff *skb, struct device *); +}; + +struct frad_local +{ + struct enet_statistics stats; + + /* devices which this FRAD is slaved to */ + struct device *master[CONFIG_DLCI_MAX]; + short dlci[CONFIG_DLCI_MAX]; + + struct frad_conf config; + int configured; /* has this device been configured */ + int initialized; /* mem_start, port, irq set ? */ + + /* callback functions */ + int (*activate)(struct device *, struct device *); + int (*deactivate)(struct device *, struct device *); + int (*assoc)(struct device *, struct device *); + int (*deassoc)(struct device *, struct device *); + int (*dlci_conf)(struct device *, struct device *, int get); + + /* fields that are used by the Sangoma SDLA cards */ + struct timer_list timer; + int type; /* adapter type */ + int state; /* state of the S502/8 control latch */ + int buffer; /* current buffer for S508 firmware */ +}; + +int register_frad(const char *name); +int unregister_frad(const char *name); + +#endif __KERNEL__ + +#endif diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h new file mode 100644 index 000000000..5f6d3e9d5 --- /dev/null +++ b/include/linux/if_packet.h @@ -0,0 +1,11 @@ +#ifndef __LINUX_IF_PACKET_H +#define __LINUX_IF_PACKET_H + +struct sockaddr_pkt +{ + unsigned short spkt_family; + unsigned char spkt_device[14]; + unsigned short spkt_protocol; +}; + +#endif diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index 51389df71..1d3a750d8 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -1,237 +1,151 @@ -#ifndef _LINUX_IF_PPP_H -#define _LINUX_IF_PPP_H - -/* definitions for kernel PPP module - Michael Callahan <callahan@maths.ox.ac.uk> - Nov. 4 1993 */ - -/* how many PPP units? */ -#ifdef CONFIG_PPP_LOTS -#define PPP_NRUNIT 16 -#else -#define PPP_NRUNIT 4 +/* $Id: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp $ */ + +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +/* + * ==FILEVERSION 960109== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * if_ppp.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new if_ppp.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _IF_PPP_H_ +#define _IF_PPP_H_ + +#if defined(__linux__) +#include <linux/if.h> +#include <linux/ioctl.h> +#include <linux/ppp_defs.h> #endif -#define PPP_VERSION "0.2.7" - -/* line discipline number */ -#define N_PPP 3 - -/* Magic value for the ppp structure */ -#define PPP_MAGIC 0x5002 - -#define PPPIOCGFLAGS 0x5490 /* get configuration flags */ -#define PPPIOCSFLAGS 0x5491 /* set configuration flags */ -#define PPPIOCGASYNCMAP 0x5492 /* get async map */ -#define PPPIOCSASYNCMAP 0x5493 /* set async map */ -#define PPPIOCGUNIT 0x5494 /* get ppp unit number */ -#define PPPIOCSINPSIG 0x5495 /* set input ready signal */ -#define PPPIOCSDEBUG 0x5497 /* set debug level */ -#define PPPIOCGDEBUG 0x5498 /* get debug level */ -#define PPPIOCGSTAT 0x5499 /* read PPP statistic information */ -#define PPPIOCGTIME 0x549A /* read time delta information */ -#define PPPIOCGXASYNCMAP 0x549B /* get async table */ -#define PPPIOCSXASYNCMAP 0x549C /* set async table */ -#define PPPIOCSMRU 0x549D /* set receive unit size for PPP */ -#define PPPIOCRASYNCMAP 0x549E /* set receive async map */ -#define PPPIOCSMAXCID 0x549F /* set the maximum compression slot id */ - -/* special characters in the framing protocol */ -#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ -#define PPP_UI 0x03 /* Unnumbered Information */ -#define PPP_FLAG 0x7E /* frame delimiter -- marks frame boundaries */ -#define PPP_ADDRESS 0xFF /* first character of frame <-- (may be */ -#define PPP_CONTROL 0x03 /* second character of frame <-- compressed)*/ -#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ -#define PPP_ESC 0x7d /* escape character -- next character is - data, and the PPP_TRANS bit should be - toggled. PPP_ESC PPP_FLAG is illegal */ - -/* protocol numbers */ -#define PROTO_IP 0x0021 -#define PROTO_VJCOMP 0x002d -#define PROTO_VJUNCOMP 0x002f - -/* FCS support */ -#define PPP_FCS_INIT 0xffff -#define PPP_FCS_GOOD 0xf0b8 - -/* initial MTU */ -#define PPP_MTU 1500 - -/* initial MRU */ -#define PPP_MRU PPP_MTU - -/* flags */ +/* + * Packet sizes + */ + +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#define PPP_MAXMRU 65000 /* Largest MRU we allow */ +#define PPP_VERSION "2.2.0" +#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */ +#define PROTO_IPX 0x002b /* protocol numbers */ +#define PROTO_DNA_RT 0x0027 /* DNA Routing */ + + +/* + * Bit definitions for flags. + */ + #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ #define SC_COMP_AC 0x00000002 /* header compression (output) */ #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ #define SC_NO_TCP_CCID 0x00000008 /* disable VJ connection-id comp. */ #define SC_REJ_COMP_AC 0x00000010 /* reject adrs/ctrl comp. on input */ #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ +#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ +#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ #define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ -#define SC_IP_DOWN 0x00000200 /* give ip frames to pppd */ -#define SC_IP_FLUSH 0x00000400 /* "next time" flag for IP_DOWN */ +#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ +#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_DEBUG 0x00010000 /* enable debug messages */ #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ +#define SC_MASK 0x0fE0ffff /* bits that user can change */ -/* Flag bits to determine state of input characters */ -#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ -#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 0 */ -#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ -#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ - -#define SC_MASK 0x0fffffff /* bits that user can change */ - -/* flag for doing transmitter lockout */ +/* state bits */ +#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ +#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ +#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ #define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ +#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ /* - * This is the format of the data buffer of a LQP packet. The packet data - * is sent/received to the peer. - */ - -struct ppp_lqp_packet_hdr { - unsigned long LastOutLQRs; /* Copied from PeerOutLQRs */ - unsigned long LastOutPackets; /* Copied from PeerOutPackets */ - unsigned long LastOutOctets; /* Copied from PeerOutOctets */ - unsigned long PeerInLQRs; /* Copied from SavedInLQRs */ - unsigned long PeerInPackets; /* Copied from SavedInPackets */ - unsigned long PeerInDiscards; /* Copied from SavedInDiscards */ - unsigned long PeerInErrors; /* Copied from SavedInErrors */ - unsigned long PeerInOctets; /* Copied from SavedInOctets */ - unsigned long PeerOutLQRs; /* Copied from OutLQRs, plus 1 */ - unsigned long PeerOutPackets; /* Current ifOutUniPackets, + 1 */ - unsigned long PeerOutOctets; /* Current ifOutOctets + LQR */ - }; - -/* - * This data is not sent to the remote. It is updated by the driver when - * a packet is received. + * Ioctl definitions. */ -struct ppp_lqp_packet_trailer { - unsigned long SaveInLQRs; /* Current InLQRs on reception */ - unsigned long SaveInPackets; /* Current ifInUniPackets */ - unsigned long SaveInDiscards; /* Current ifInDiscards */ - unsigned long SaveInErrors; /* Current ifInErrors */ - unsigned long SaveInOctets; /* Current ifInOctects */ +struct npioctl { + int protocol; /* PPP protocol, e.g. PPP_IP */ + enum NPmode mode; }; -/* - * PPP LQP packet. The packet is changed by the driver immediately prior - * to transmission and updated upon reception with the current values. - * So, it must be known to the driver as well as the pppd software. - */ - -struct ppp_lpq_packet { - unsigned long magic; /* current magic value */ - struct ppp_lqp_packet_hdr hdr; /* Header fields for structure */ - struct ppp_lqp_packet_trailer tail; /* Trailer fields (not sent) */ +/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ +struct ppp_option_data { + __u8 *ptr; + __u32 length; + int transmit; }; -/* - * PPP interface statistics. (used by LQP / pppstats) - */ - -struct ppp_stats { - unsigned long rbytes; /* bytes received */ - unsigned long rcomp; /* compressed packets received */ - unsigned long runcomp; /* uncompressed packets received */ - unsigned long rothers; /* non-ip frames received */ - unsigned long rerrors; /* received errors */ - unsigned long roverrun; /* "buffer overrun" counter */ - unsigned long tossed; /* packets discarded */ - unsigned long runts; /* frames too short to process */ - unsigned long rgiants; /* frames too large to process */ - unsigned long sbytes; /* bytes sent */ - unsigned long scomp; /* compressed packets sent */ - unsigned long suncomp; /* uncompressed packets sent */ - unsigned long sothers; /* non-ip frames sent */ - unsigned long serrors; /* transmitter errors */ - unsigned long sbusy; /* "transmitter busy" counter */ +struct ifpppstatsreq { + struct ifreq b; + struct ppp_stats stats; /* statistic information */ }; -/* - * Demand dial fields - */ - -struct ppp_ddinfo { - unsigned long ip_sjiffies; /* time when last IP frame sent */ - unsigned long ip_rjiffies; /* time when last IP frame recvd*/ - unsigned long nip_sjiffies; /* time when last NON-IP sent */ - unsigned long nip_rjiffies; /* time when last NON-IP recvd */ +struct ifpppcstatsreq { + struct ifreq b; + struct ppp_comp_stats stats; }; -#ifdef __KERNEL__ - -struct ppp { - int magic; /* magic value for structure */ - - /* Bitmapped flag fields. */ - char inuse; /* are we allocated? */ - char sending; /* "channel busy" indicator */ - char escape; /* 0x20 if prev char was PPP_ESC*/ - char toss; /* toss this frame */ - - unsigned int flags; /* miscellany */ - - unsigned long xmit_async_map[8]; /* 1 bit means that given control - character is quoted on output*/ - - unsigned long recv_async_map; /* 1 bit means that given control - character is ignored on input*/ - int mtu; /* maximum xmit frame size */ - int mru; /* maximum receive frame size */ - unsigned short fcs; /* FCS field of current frame */ - - /* Various fields. */ - int line; /* PPP channel number */ - struct tty_struct *tty; /* ptr to TTY structure */ - struct device *dev; /* easy for intr handling */ - struct slcompress *slcomp; /* for header compression */ - unsigned long last_xmit; /* time of last transmission */ - - /* These are pointers to the malloc()ed frame buffers. - These buffers are used while processing a packet. If a packet - has to hang around for the user process to read it, it lingers in - the user buffers below. */ - unsigned char *rbuff; /* receiver buffer */ - unsigned char *xbuff; /* transmitter buffer */ - unsigned char *cbuff; /* compression buffer */ - - /* These are the various pointers into the buffers. */ - unsigned char *rhead; /* RECV buffer pointer (head) */ - unsigned char *rend; /* RECV buffer pointer (end) */ - int rcount; /* PPP receive counter */ - unsigned char *xhead; /* XMIT buffer pointer (head) */ - unsigned char *xtail; /* XMIT buffer pointer (end) */ - - /* Structures for interfacing with the user process. */ -#define RBUFSIZE 4000 - unsigned char *us_rbuff; /* circular incoming packet buf.*/ - unsigned char *us_rbuff_end; /* end of allocated space */ - unsigned char *us_rbuff_head; /* head of waiting packets */ - unsigned char *us_rbuff_tail; /* tail of waiting packets */ - unsigned char us_rbuff_lock; /* lock: bit 0 head bit 1 tail */ - int inp_sig; /* input ready signal for pgrp */ - int inp_sig_pid; /* process to get notified */ - - /* items to support the select() function */ - struct wait_queue *write_wait; /* queue for reading processes */ - struct wait_queue *read_wait; /* queue for writing processes */ - - /* PPP interface statistics. */ - struct ppp_stats stats; /* statistic information */ - - /* PPP demand dial information. */ - struct ppp_ddinfo ddinfo; /* demand dial information */ -}; +#define ifr__name b.ifr_ifrn.ifrn_name +#define stats_ptr b.ifr_ifru.ifru_data -#endif /* __KERNEL__ */ -#endif /* _LINUX_PPP_H */ +/* + * Ioctl definitions. + */ +#define PPPIOCGFLAGS _IOR('t', 90, int) /* get configuration flags */ +#define PPPIOCSFLAGS _IOW('t', 89, int) /* set configuration flags */ +#define PPPIOCGASYNCMAP _IOR('t', 88, int) /* get async map */ +#define PPPIOCSASYNCMAP _IOW('t', 87, int) /* set async map */ +#define PPPIOCGUNIT _IOR('t', 86, int) /* get ppp unit number */ +#define PPPIOCGRASYNCMAP _IOR('t', 85, int) /* get receive async map */ +#define PPPIOCSRASYNCMAP _IOW('t', 84, int) /* set receive async map */ +#define PPPIOCGMRU _IOR('t', 83, int) /* get max receive unit */ +#define PPPIOCSMRU _IOW('t', 82, int) /* set max receive unit */ +#define PPPIOCSMAXCID _IOW('t', 81, int) /* set VJ max slot ID */ +#define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */ +#define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */ +#define PPPIOCXFERUNIT _IO('t', 78) /* transfer PPP unit */ +#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) +#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ +#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ +#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ +#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ +#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ + +#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) +#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ +#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) + +#if !defined(ifr_mtu) +#define ifr_mtu ifr_ifru.ifru_metric +#endif +#endif /* _IF_PPP_H_ */ diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h new file mode 100644 index 000000000..1c7eb4f6d --- /dev/null +++ b/include/linux/if_pppvar.h @@ -0,0 +1,157 @@ +/* $Id: if_pppvar.h,v 1.2 1995/06/12 11:36:51 paulus Exp $ */ +/* + * if_pppvar.h - private structures and declarations for PPP. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * ==FILEVERSION 960302== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * if_pppvar.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new if_pppvar.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +/* + * Supported network protocols. These values are used for + * indexing sc_npmode. + */ + +#define NP_IP 0 /* Internet Protocol */ +#define NUM_NP 1 /* Number of NPs. */ + +/* + * Buffers for the PPP process have the following structure + */ + +#define RBUFSIZE 2048 /* MUST be a power of 2 and be <= 4095 */ + +struct ppp_buffer { + __s32 size; /* Size of the buffer area */ + __s32 count; /* Count of characters in bufr */ + __s32 head; /* index to head of list */ + __s32 tail; /* index to tail of list */ + __u32 locked; /* Buffer is being sent */ + __s32 type; /* Type of the buffer */ + /* =0, device read buffer */ + /* =1, device write buffer */ + /* =2, daemon write buffer */ + /* =3, daemon read buffer */ + __u16 fcs; /* Frame Check Sequence (CRC) */ + __u8 filler[4]; /* Extra space if needed */ +}; + +/* Given a pointer to the ppp_buffer then return base address of buffer */ +#define buf_base(buf) ((__u8 *) (&buf[1])) + +/* + * Structure describing each ppp unit. + */ + +struct ppp { + __s32 magic; /* magic value for structure */ + + /* Bitmapped flag fields. */ + __u8 inuse; /* are we allocated? */ + __u8 escape; /* 0x20 if prev char was PPP_ESC*/ + __u8 toss; /* toss this frame */ + + __u32 flags; /* miscellany */ + + __u32 xmit_async_map[8]; /* 1 bit means that given control + character is quoted on output*/ + + __u32 recv_async_map; /* 1 bit means that given control + character is ignored on input*/ + __s32 mtu; /* maximum xmit frame size */ + __s32 mru; /* maximum receive frame size */ + + /* Information about the current tty data */ + __s32 line; /* PPP channel number */ + struct tty_struct *tty; /* ptr to TTY structure */ + __s32 bytes_sent; /* Bytes sent on frame */ + __s32 bytes_rcvd; /* Bytes recvd on frame */ + + /* Interface to the network layer */ + struct device *dev; /* easy for intr handling */ + + /* VJ Header compression data */ + struct slcompress *slcomp; /* for header compression */ + + /* Transmission information */ + struct ppp_buffer *xbuf; /* Buffer currently being sent */ + struct ppp_buffer *s1buf; /* Pointer to daemon buffer */ + struct ppp_buffer *s2buf; /* Pointer to device buffer */ + + __u32 last_xmit; /* time of last transmission */ + + /* These are pointers to the malloc()ed frame buffers. + These buffers are used while processing a packet. If a packet + has to hang around for the user process to read it, it lingers in + the user buffers below. */ + + struct ppp_buffer *wbuf; /* Transmission information */ + struct ppp_buffer *tbuf; /* daemon transmission buffer */ + struct ppp_buffer *rbuf; /* Receive information */ + struct ppp_buffer *ubuf; /* User buffer information */ + struct ppp_buffer *cbuf; /* compression buffer */ + + /* Queues for select() functionality */ + struct wait_queue *write_wait; /* queue for reading processes */ + struct wait_queue *read_wait; /* queue for writing processes */ + + /* Statistic information */ + struct pppstat stats; /* statistic information */ + struct ppp_idle ddinfo; /* demand dial information */ + + /* PPP compression protocol information */ + __u32 sc_bytessent; /* count of octets sent */ + __u32 sc_bytesrcvd; /* count of octets received */ + enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */ + struct compressor *sc_xcomp; /* transmit compressor */ + void *sc_xc_state; /* transmit compressor state */ + struct compressor *sc_rcomp; /* receive decompressor */ + void *sc_rc_state; /* receive decompressor state */ + __s32 sc_xfer; /* PID of reserved PPP table */ +}; diff --git a/include/linux/if_slip.h b/include/linux/if_slip.h index 0cb7f71b8..5bd77e520 100644 --- a/include/linux/if_slip.h +++ b/include/linux/if_slip.h @@ -15,5 +15,14 @@ #define SL_OPT_SIXBIT 2 #define SL_OPT_ADAPTIVE 8 +/* + * VSV = ioctl for keepalive & outfill in SLIP driver + */ + +#define SIOCSKEEPALIVE (SIOCDEVPRIVATE) /* Set keepalive timeout in sec */ +#define SIOCGKEEPALIVE (SIOCDEVPRIVATE+1) /* Get keepalive timeout */ +#define SIOCSOUTFILL (SIOCDEVPRIVATE+2) /* Set outfill timeout */ +#define SIOCGOUTFILL (SIOCDEVPRIVATE+3) /* Get outfill timeout */ + #endif diff --git a/include/linux/if_strip.h b/include/linux/if_strip.h new file mode 100644 index 000000000..fb5c5c984 --- /dev/null +++ b/include/linux/if_strip.h @@ -0,0 +1,25 @@ +/* + * if_strip.h -- + * + * Definitions for the STRIP interface + * + * Copyright 1996 The Board of Trustees of The Leland Stanford + * Junior University. All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies. Stanford University + * makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without + * express or implied warranty. + */ + +#ifndef __LINUX_STRIP_H +#define __LINUX_STRIP_H + +typedef struct { + __u8 c[6]; +} MetricomAddress; + +#endif diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 61629332b..545f1b7f0 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h @@ -45,37 +45,36 @@ /* This is an Token-Ring frame header. */ struct trh_hdr { - unsigned char ac; /* access control field */ - unsigned char fc; /* frame control field */ - unsigned char daddr[TR_ALEN]; /* destination address */ - unsigned char saddr[TR_ALEN]; /* source address */ - unsigned short rcf; /* route control field */ - unsigned short rseg[8];/* routing registers */ + __u8 ac; /* access control field */ + __u8 fc; /* frame control field */ + __u8 daddr[TR_ALEN]; /* destination address */ + __u8 saddr[TR_ALEN]; /* source address */ + __u16 rcf; /* route control field */ + __u16 rseg[8]; /* routing registers */ }; /* This is an Token-Ring LLC structure */ struct trllc { - unsigned char dsap; /* destination SAP */ - unsigned char ssap; /* source SAP */ - unsigned char llc; /* LLC control field */ - unsigned char protid[3]; /* protocol id */ - unsigned short ethertype; /* ether type field */ + __u8 dsap; /* destination SAP */ + __u8 ssap; /* source SAP */ + __u8 llc; /* LLC control field */ + __u8 protid[3]; /* protocol id */ + __u16 ethertype; /* ether type field */ }; - /* Token-Ring statistics collection data. */ -struct tr_statistics{ - int rx_packets; /* total packets received */ - int tx_packets; /* total packets transmitted */ - int rx_errors; /* bad packets received */ - int tx_errors; /* packet transmit problems */ - int rx_dropped; /* no space in linux buffers */ - int tx_dropped; /* no space available in linux */ - int multicast; /* multicast packets received */ - int transmit_collision; +struct tr_statistics { + int rx_packets; /* total packets received */ + int tx_packets; /* total packets transmitted */ + int rx_errors; /* bad packets received */ + int tx_errors; /* packet transmit problems */ + int rx_dropped; /* no space in linux buffers */ + int tx_dropped; /* no space available in linux */ + int multicast; /* multicast packets received */ + int transmit_collision; - /* detailed Token-Ring errors. See IBM Token-Ring Network Architecture - for more info */ + /* detailed Token-Ring errors. See IBM Token-Ring Network + Architecture for more info */ int line_errors; int internal_errors; @@ -88,7 +87,6 @@ struct tr_statistics{ int frequency_errors; int token_errors; int dummy1; - }; /* source routing stuff */ diff --git a/include/linux/if_wic.h b/include/linux/if_wic.h new file mode 100644 index 000000000..cca15f85b --- /dev/null +++ b/include/linux/if_wic.h @@ -0,0 +1,102 @@ +#ifndef _LINUX_IF_WIC_H +#define _LINUX_IF_WIC_H + +#include <linux/sockios.h> + +#define SIOCDEVWIC SIOCDEVPRIVATE + +struct wicconf +{ + unsigned char pcmd; + unsigned char data[120]; + unsigned char len; +}; + +/* WIC host to controller commands */ + +#define WIC_AYT 0x10 /* test dki */ +#define WIC_RESET 0x11 /* reset controller */ +#define WIC_SETSN 0x21 /* set station name */ +#define WIC_SETPS 0x22 /* set power saving mode */ +#define WIC_SETAF 0x23 /* set announce filter */ +#define WIC_SETGPF 0x24 /* set GPSP filter */ +#define WIC_GETVERH 0x61 /* get interface controller version */ +#define WIC_GETNL 0x62 /* get neighbor list */ +#define WIC_GETSN 0x65 /* get station name */ +#define WIC_CLRSTATS 0x83 /* clear controller statistics */ +#define WIC_SETNET 0x84 /* set network configuration */ +#define WIC_SETSYS 0x85 /* set system configuration */ +#define WIC_GETSTATS 0xc1 /* get statistics */ +#define WIC_GETVERM 0xc3 /* get MAC version */ +#define WIC_GETNET 0xc4 /* get network configuration */ +#define WIC_GETSYS 0xc5 /* get system configuration */ + +/* + * structure used for the GETNET/SETNET command + */ + +struct wic_net { + unsigned char ula[6]; /* ula of interface */ + unsigned char mode; /* operating mode */ +#define NET_MODE_ME 0x01 /* receive my ula */ +#define NET_MODE_BCAST 0x02 /* receive bcasts */ +#define NET_MODE_MCAST 0x04 /* receive mcasts */ +#define NET_MODE_PROM 0x08 /* promiscuous */ +#define NET_MODE_HC 0x10 /* is a hop coordinator */ +#define NET_MODE_HC_VALID 0x20 /* hc address is valid */ +#define NET_MODE_HCAP 0x40 /* hc is also ap */ +#define NET_MODE_HC_KNOWN 0x80 /* hc is known */ + unsigned char rts_lo; /* rts threshold */ + unsigned char rts_hi; /* rts threshold */ + unsigned char retry; /* retry limit */ + unsigned char hc_ula[6]; /* ula of hc */ + unsigned char key[4]; /* network key */ + unsigned char dsl; /* direct send limit */ + unsigned char res1; /* reserved */ +}; + +/* + * structure used for the GETSYS/SETSYS command + */ + +struct wic_sys { + unsigned char mode; /* set operating mode */ +#define SYS_MODE_ANT_DIV 0x00 /* use antenna diversity */ +#define SYS_MODE_ANT_1 0x01 /* use ant 1 for tx */ +#define SYS_MODE_ANT_2 0x02 /* use ant 2 for tx */ +#define SYS_MODE_HC_LOCK 0x04 /* lock onto current hc */ +#define SYS_MODE_DEBUG 0x08 /* upload failed frames */ +#define SYS_MODE_IAM_AP 0x10 /* I am AP */ +#define SYS_MODE_IAM_HC 0x20 /* I am HC */ +#define SYS_MODE_USE_SKIP 0x40 /* use skipping mechanism */ +#define SYS_MODE_AUTO 0x80 /* station is in auto mode */ + unsigned char switches; /* radio/controller switches */ +#define SYS_SWITCH_STDBY 0x01 /* switch radio to standby */ +#define SYS_SWITCH_TXRX 0x02 /* 1 = tx, manual mode only */ +#define SYS_SWITCH_PA 0x04 /* 1 = enable PA on radio */ +#define SYS_SWITCH_PWR 0x10 /* 1 = hi, 0 = lo power output */ +#define SYS_SWITCH_RES1 0x20 /* reserved, must be 0 */ +#define SYS_SWITCH_LIGHTS 0x40 /* light for tx & rx */ +#define SYS_SWITCH_LIGHTS_HC 0x80 /* light for rx while coordinated */ + unsigned char hop_min; /* hop range */ + unsigned char hop_max; /* hop range */ + unsigned char pre_len; /* preamble length (bytes) */ + unsigned char pre_match; /* valid preamble match (bytes) */ + unsigned char mod; /* data mod: 1 = 8:1, 0 = none */ + unsigned char cca_mode; /* cca flags */ +#define CCA_PKT_DET_BSY 0x01 /* busy if packet is detected */ +#define CCA_VIRT_CARR 0x02 /* use virtual carrier */ +#define CCA_RSSI_BSY 0x04 /* busy if rssi > threshold */ +#define CCA_DATA_BSY 0x08 /* busy if valid data > XXX usec */ + unsigned char dwell_hi; /* dwell time */ + unsigned char dwell_lo; /* dwell time */ + unsigned char hc_timeout; /* HC timeout */ + unsigned char rssi; /* rssi threshold */ + unsigned char hc_rssi; /* rssi of last hc frame */ + unsigned char hc_rssi_chan; /* channel of hc rssi value */ +}; + + +#endif /* _LINUX_IF_WIC_H */ + + diff --git a/include/linux/igmp.h b/include/linux/igmp.h index b8ee985aa..82569a653 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h @@ -1,8 +1,10 @@ /* - * Linux NET3: Internet Gateway Management Protocol [IGMP] + * Linux NET3: Internet Group Management Protocol [IGMP] * * Authors: - * Alan Cox <Alan.Cox@linux.org> + * Alan Cox <Alan.Cox@linux.org> + * + * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 * * * This program is free software; you can redistribute it and/or @@ -21,34 +23,56 @@ /* * Header in on cable format */ - + struct igmphdr { - unsigned char type; - unsigned char unused; - unsigned short csum; - unsigned long group; + __u8 type; + __u8 code; /* For newer IGMP */ + __u16 csum; + __u32 group; }; +#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ +#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ +#define IGMP_DVMRP 0x13 /* DVMRP routing */ +#define IGMP_PIM 0x14 /* PIM routing */ +#define IGMP_TRACE 0x15 /* CISCO trace */ +#define IGMP_HOST_NEW_MEMBERSHIP_REPORT 0x16 /* New version of 0x11 */ +#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* An extra BSD seems to send */ + +#define IGMP_MTRACE_RESP 0x1e +#define IGMP_MTRACE 0x1f + + /* - * Header in host convenient format + * Use the BSD names for these for compatibility */ -struct igmp_header -{ - unsigned char type; - unsigned char unused; - unsigned short csum; - unsigned long group; -}; +#define IGMP_DELAYING_MEMBER 0x01 +#define IGMP_IDLE_MEMBER 0x02 +#define IGMP_LAZY_MEMBER 0x03 +#define IGMP_SLEEPING_MEMBER 0x04 +#define IGMP_AWAKENING_MEMBER 0x05 +#define IGMP_OLD_ROUTER 0x00 +#define IGMP_NEW_ROUTER 0x01 -#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ -#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ -#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* An extra BSD seems to send */ +#define IGMP_MINLEN 8 + +#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */ + /* query (in seconds) */ + +#define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */ + /* specifies time in 10th of seconds */ + +#define IGMP_AGE_THRESHOLD 540 /* If this host don't hear any IGMP V1 */ + /* message in this period of time, */ + /* revert to IGMP v2 router. */ - /* 224.0.0.1 */ #define IGMP_ALL_HOSTS htonl(0xE0000001L) +#define IGMP_ALL_ROUTER htonl(0xE0000002L) +#define IGMP_LOCAL_GROUP htonl(0xE0000000L) +#define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L) /* * struct for keeping the multicast list in @@ -61,24 +85,35 @@ struct ip_mc_socklist struct device *multidev[IP_MAX_MEMBERSHIPS]; }; -struct ip_mc_list +struct ip_mc_list { struct device *interface; unsigned long multiaddr; struct ip_mc_list *next; struct timer_list timer; - int tm_running; + short tm_running; + short reporter; int users; }; - + +struct ip_router_info +{ + struct device *dev; + int type; /* type of router which is querier on this interface */ + int time; /* # of slow timeouts since last old query */ + struct timer_list timer; + struct ip_router_info *next; +}; + extern struct ip_mc_list *ip_mc_head; -extern int igmp_rcv(struct sk_buff *, struct device *, struct options *, unsigned long, unsigned short, - unsigned long, int , struct inet_protocol *); -extern void ip_mc_drop_device(struct device *dev); +extern int igmp_rcv(struct sk_buff *, struct device *, struct options *, __u32, unsigned short, + __u32, int , struct inet_protocol *); +extern void ip_mc_drop_device(struct device *dev); extern int ip_mc_join_group(struct sock *sk, struct device *dev, unsigned long addr); extern int ip_mc_leave_group(struct sock *sk, struct device *dev,unsigned long addr); extern void ip_mc_drop_socket(struct sock *sk); +extern void ip_mr_init(void); #endif #endif diff --git a/include/linux/in.h b/include/linux/in.h index d811239d6..61566713f 100644 --- a/include/linux/in.h +++ b/include/linux/in.h @@ -18,12 +18,13 @@ #ifndef _LINUX_IN_H #define _LINUX_IN_H +#include <linux/types.h> /* Standard well-defined IP protocols. */ enum { IPPROTO_IP = 0, /* Dummy protocol for TCP */ IPPROTO_ICMP = 1, /* Internet Control Message Protocol */ - IPPROTO_IGMP = 2, /* Internet Gateway Management Protocol */ + IPPROTO_IGMP = 2, /* Internet Group Management Protocol */ IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */ IPPROTO_TCP = 6, /* Transmission Control Protocol */ IPPROTO_EGP = 8, /* Exterior Gateway Protocol */ @@ -31,14 +32,17 @@ enum { IPPROTO_UDP = 17, /* User Datagram Protocol */ IPPROTO_IDP = 22, /* XNS IDP protocol */ - IPPROTO_RAW = 255, /* Raw IP packets */ + IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */ + IPPROTO_ICMPV6 = 58, /* ICMPv6 */ + + IPPROTO_RAW = 255, /* Raw IP packets */ IPPROTO_MAX }; /* Internet address. */ struct in_addr { - unsigned long int s_addr; + __u32 s_addr; }; /* Request struct for multicast socket ops */ @@ -53,7 +57,7 @@ struct ip_mreq /* Structure describing an Internet (IP) socket address. */ #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ struct sockaddr_in { - short int sin_family; /* Address family */ + sa_family_t sin_family; /* Address family */ unsigned short int sin_port; /* Port number */ struct in_addr sin_addr; /* Internet address */ @@ -100,21 +104,29 @@ struct sockaddr_in { #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) /* Address indicating an error return. */ -#define INADDR_NONE 0xffffffff +#define INADDR_NONE ((unsigned long int) 0xffffffff) /* Network number for local host loopback. */ #define IN_LOOPBACKNET 127 /* Address to loopback in software to local host. */ #define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */ +#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) /* Defines for Multicast INADDR */ #define INADDR_UNSPEC_GROUP 0xe0000000 /* 224.0.0.0 */ #define INADDR_ALLHOSTS_GROUP 0xe0000001 /* 224.0.0.1 */ #define INADDR_MAX_LOCAL_GROUP 0xe00000ff /* 224.0.0.255 */ -/* <asm/byteorder.h> contains the htonl type stuff.. */ +/* <asm/byteorder.h> contains the htonl type stuff.. */ #include <asm/byteorder.h> +#ifdef __KERNEL__ +/* Some random defines to make it easier in the kernel.. */ +#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) +#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) + +#endif + #endif /* _LINUX_IN_H */ diff --git a/include/linux/in6.h b/include/linux/in6.h new file mode 100644 index 000000000..781d7339d --- /dev/null +++ b/include/linux/in6.h @@ -0,0 +1,114 @@ +/* + * Types and definitions for AF_INET6 + * Linux INET6 implementation + * + * Authors: + * Pedro Roque <roque@di.fc.ul.pt> + * + * Sources: + * IPv6 Program Interfaces for BSD Systems + * <draft-ietf-ipngwg-bsd-api-05.txt> + * + * Advanced Sockets API for IPv6 + * <draft-stevens-advanced-api-00.txt> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IN6_H +#define _LINUX_IN6_H + + +/* + * IPv6 address structure + */ + +struct in6_addr +{ + union + { + __u8 u6_addr8[16]; + __u32 u6_addr32[4]; +#if (~0UL) > 0xffffffff + __u64 u6_addr64[2]; +#endif + } in6_u; +#define s6_addr in6_u.u6_addr8 +#define s6_addr32 in6_u.u6_addr32 +#define s6_addr64 in6_u.u6_addr64 +}; + +struct sockaddr_in6 { + unsigned short int sin6_family; /* AF_INET6 */ + __u16 sin6_port; /* Transport layer port # */ + __u32 sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ +}; + + +struct ipv6_mreq { + /* IPv6 multicast address of group */ + struct in6_addr ipv6mr_multiaddr; + + /* local IPv6 address of interface */ + int ipv6mr_ifindex; +}; + +/* + * Bitmask constant declarations to help applications select out the + * flow label and priority fields. + * + * Note that this are in host byte order while the flowinfo field of + * sockaddr_in6 is in network byte order. + */ + +#define IPV6_FLOWINFO_FLOWLABEL 0x00ff +#define IPV6_FLOWINFO_PRIORITY 0x0f00 + +#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 +#define IPV6_PRIORITY_FILLER 0x0100 +#define IPV6_PRIORITY_UNATTENDED 0x0200 +#define IPV6_PRIORITY_RESERVED1 0x0300 +#define IPV6_PRIORITY_BULK 0x0400 +#define IPV6_PRIORITY_RESERVED2 0x0500 +#define IPV6_PRIORITY_INTERACTIVE 0x0600 +#define IPV6_PRIORITY_CONTROL 0x0700 +#define IPV6_PRIORITY_8 0x0800 +#define IPV6_PRIORITY_9 0x0900 +#define IPV6_PRIORITY_10 0x0a00 +#define IPV6_PRIORITY_11 0x0b00 +#define IPV6_PRIORITY_12 0x0c00 +#define IPV6_PRIORITY_13 0x0d00 +#define IPV6_PRIORITY_14 0x0e00 +#define IPV6_PRIORITY_15 0x0f00 + +/* + * IPV6 socket options + */ + +#define IPV6_ADDRFORM 1 +#define IPV6_RXINFO 2 +#define IPV6_RXHOPOPTS 3 +#define IPV6_RXDSTOPTS 4 +#define IPV6_RXSRCRT 5 +#define IPV6_PKTOPTIONS 6 +#define IPV6_CHECKSUM 7 + +/* + * Alternative names + */ +#define IPV6_TXINFO IPV6_RXINFO +#define SCM_SRCINFO IPV6_TXINFO +#define SCM_SRCRT IPV6_RXSRCRT + +#define IPV6_UNICAST_HOPS 16 +#define IPV6_MULTICAST_IF 17 +#define IPV6_MULTICAST_HOPS 18 +#define IPV6_MULTICAST_LOOP 19 +#define IPV6_ADD_MEMBERSHIP 20 +#define IPV6_DROP_MEMBERSHIP 21 + +#endif diff --git a/include/linux/inet.h b/include/linux/inet.h index 4a7a9f654..9bd28d56e 100644 --- a/include/linux/inet.h +++ b/include/linux/inet.h @@ -46,7 +46,7 @@ extern void inet_proto_init(struct net_proto *pro); extern char *in_ntoa(unsigned long in); -extern unsigned long in_aton(char *str); +extern unsigned long in_aton(const char *str); #endif #endif /* _LINUX_INET_H */ diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 4c4edc82c..77cd07c8f 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -2,17 +2,24 @@ #ifndef _LINUX_INTERRUPT_H #define _LINUX_INTERRUPT_H -#include <linux/linkage.h> +#include <linux/kernel.h> #include <asm/bitops.h> -struct bh_struct { - void (*routine)(void *); - void *data; +struct irqaction { + void (*handler)(int, void *, struct pt_regs *); + unsigned long flags; + unsigned long mask; + const char *name; + void *dev_id; + struct irqaction *next; }; +extern unsigned long intr_count; + +extern int bh_mask_count[32]; extern unsigned long bh_active; extern unsigned long bh_mask; -extern struct bh_struct bh_base[32]; +extern void (*bh_base[32])(void); asmlinkage void do_bottom_half(void); @@ -23,37 +30,57 @@ enum { TIMER_BH = 0, CONSOLE_BH, TQUEUE_BH, + DIGI_BH, SERIAL_BH, + RISCOM8_BH, NET_BH, IMMEDIATE_BH, KEYBOARD_BH, - CYCLADES_BH + CYCLADES_BH, + CM206_BH }; +extern inline void init_bh(int nr, void (*routine)(void)) +{ + bh_base[nr] = routine; + bh_mask_count[nr] = 0; + bh_mask |= 1 << nr; +} + extern inline void mark_bh(int nr) { set_bit(nr, &bh_active); } +/* + * These use a mask count to correctly handle + * nested disable/enable calls + */ extern inline void disable_bh(int nr) { - clear_bit(nr, &bh_mask); + bh_mask &= ~(1 << nr); + bh_mask_count[nr]++; } extern inline void enable_bh(int nr) { - set_bit(nr, &bh_mask); + if (!--bh_mask_count[nr]) + bh_mask |= 1 << nr; } +/* + * start_bh_atomic/end_bh_atomic also nest + * naturally by using a counter + */ extern inline void start_bh_atomic(void) { intr_count++; + barrier(); } extern inline void end_bh_atomic(void) { - if (intr_count == 1 && (bh_active & bh_mask)) - do_bottom_half(); + barrier(); intr_count--; } @@ -77,14 +104,14 @@ extern inline void end_bh_atomic(void) * 7. service the device to clear its pending interrupt. * 8. loop again if paranoia is required. * - * probe_irq_on() returns a mask of snarfed irq's. + * probe_irq_on() returns a mask of allocated irq's. * * probe_irq_off() takes the mask as a parameter, * and returns the irq number which occurred, * or zero if none occurred, or a negative irq number * if more than one irq occurred. */ -extern unsigned int probe_irq_on(void); /* returns 0 on failure */ -extern int probe_irq_off(unsigned int); /* returns 0 or negative on failure */ +extern unsigned long probe_irq_on(void); /* returns 0 on failure */ +extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */ #endif diff --git a/include/linux/ioctl.h b/include/linux/ioctl.h index e76bdb6e0..aa91eb395 100644 --- a/include/linux/ioctl.h +++ b/include/linux/ioctl.h @@ -1,53 +1,7 @@ -/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $ - * - * linux/ioctl.h for Linux by H.H. Bergman. - */ - #ifndef _LINUX_IOCTL_H #define _LINUX_IOCTL_H - -/* ioctl command encoding: 32 bits total, command in lower 16 bits, - * size of the parameter structure in the lower 14 bits of the - * upper 16 bits. - * Encoding the size of the parameter structure in the ioctl request - * is useful for catching programs compiled with old versions - * and to avoid overwriting user space outside the user buffer area. - * The highest 2 bits are reserved for indicating the ``access mode''. - * NOTE: This limits the max parameter size to 16kB -1 ! - */ - -#define IOC_VOID 0x00000000 /* param in size field */ -#define IOC_IN 0x40000000 /* user --> kernel */ -#define IOC_OUT 0x80000000 /* kernel --> user */ -#define IOC_INOUT (IOC_IN | IOC_OUT) /* both */ -#define IOCSIZE_MASK 0x3fff0000 /* size (max 16k-1 bytes) */ -#define IOCSIZE_SHIFT 16 /* how to get the size */ -#define IOCSIZE_MAX ((PAGE_SIZE-1)&(IOCSIZE_MASK >> IOC_SHIFT)) -#define IOCCMD_MASK 0x0000ffff /* command code */ -#define IOCCMD_SHIFT 0 -#define IOCPARM_MASK IOCCMD_MASK -#define IOCPARM_SHIFT IOCCMD_SHIFT - -#define IOC_SIZE(cmd) (((cmd) & IOCSIZE_MASK) >> IOCSIZE_SHIFT) -#define IOCBASECMD(cmd) ((cmd) & ~IOCPARM_MASK) -#define IOCGROUP(cmd) (((cmd) >> 8) & 0xFF) - -/* _IO(magic, subcode); size field is zero and the - * subcode determines the command. - */ -#define _IO(c,d) (IOC_VOID | ((c)<<8) | (d)) /* param encoded */ - -/* _IOXX(magic, subcode, arg_t); where arg_t is the type of the - * (last) argument field in the ioctl call, if present. - */ -#define _IOW(c,d,t) (IOC_IN | ((sizeof(t)<<16) & IOCSIZE_MASK) | \ - ((c)<<8) | (d)) -#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) | \ - ((c)<<8) | (d)) +#include <asm/ioctl.h> #endif /* _LINUX_IOCTL_H */ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 8a019adb6..335e3b65f 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -13,12 +13,11 @@ #define HAVE_PORTRESERVE /* * Call check_region() before probing for your hardware. - * Once you have found you hardware, register it with snarf_region(). + * Once you have found you hardware, register it with request_region(). * If you unload the driver, use release_region to free ports. */ extern void reserve_setup(char *str, int *ints); extern int check_region(unsigned int from, unsigned int extent); -extern void snarf_region(unsigned int from, unsigned int extent); extern void request_region(unsigned int from, unsigned int extent,const char *name); extern void release_region(unsigned int from, unsigned int extent); extern int get_ioport_list(char *); @@ -26,7 +25,7 @@ extern int get_ioport_list(char *); #define HAVE_AUTOIRQ extern void *irq2dev_map[16]; /* Use only if you own the IRQ. */ -extern void autoirq_setup(int waittime); +extern int autoirq_setup(int waittime); extern int autoirq_report(int waittime); #endif /* _LINUX_PORTIO_H */ diff --git a/include/linux/ip.h b/include/linux/ip.h index d12b92b1e..74d0fa81a 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -33,18 +33,15 @@ struct timestamp { __u8 len; __u8 ptr; - union { -#if defined(LITTLE_ENDIAN_BITFIELD) +#if defined(__LITTLE_ENDIAN_BITFIELD) __u8 flags:4, overflow:4; -#elif defined(BIG_ENDIAN_BITFIELD) +#elif defined(__BIG_ENDIAN_BITFIELD) __u8 overflow:4, flags:4; #else #error "Please fix <asm/byteorder.h>" #endif - __u8 full_char; - } x; __u32 data[9]; }; @@ -57,25 +54,44 @@ struct route { unsigned long route[MAX_ROUTE]; }; +#define IPOPT_OPTVAL 0 +#define IPOPT_OLEN 1 +#define IPOPT_OFFSET 2 +#define IPOPT_MINOFF 4 +#define MAX_IPOPTLEN 40 +#define IPOPT_NOP IPOPT_NOOP +#define IPOPT_EOL IPOPT_END +#define IPOPT_TS IPOPT_TIMESTAMP + +#define IPOPT_TS_TSONLY 0 /* timestamps only */ +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define IPOPT_TS_PRESPEC 2 /* specified modules only */ struct options { - struct route record_route; - struct route loose_route; - struct route strict_route; - struct timestamp tstamp; - unsigned short security; - unsigned short compartment; - unsigned short handling; - unsigned short stream; - unsigned tcc; + __u32 faddr; /* Saved first hop address */ + unsigned char optlen; + unsigned char srr; + unsigned char rr; + unsigned char ts; + unsigned char is_setbyuser:1, /* Set by setsockopt? */ + is_data:1, /* Options in __data, rather than skb */ + is_strictroute:1, /* Strict source route */ + srr_is_hit:1, /* Packet destination addr was our one */ + is_changed:1, /* IP checksum more not valid */ + rr_needaddr:1, /* Need to record addr of outgoing dev */ + ts_needtime:1, /* Need to record timestamp */ + ts_needaddr:1; /* Need to record addr of outgoing dev */ + unsigned char __pad1; + unsigned char __pad2; + unsigned char __pad3; + unsigned char __data[0]; }; - struct iphdr { -#if defined(LITTLE_ENDIAN_BITFIELD) +#if defined(__LITTLE_ENDIAN_BITFIELD) __u8 ihl:4, version:4; -#elif defined (BIG_ENDIAN_BITFIELD) +#elif defined (__BIG_ENDIAN_BITFIELD) __u8 version:4, ihl:4; #else @@ -93,5 +109,4 @@ struct iphdr { /*The options start here. */ }; - #endif /* _LINUX_IP_H */ diff --git a/include/linux/ip_fw.h b/include/linux/ip_fw.h index 29bafa34f..3a33555f7 100644 --- a/include/linux/ip_fw.h +++ b/include/linux/ip_fw.h @@ -16,6 +16,13 @@ * * Fixes: * Pauline Middelink : Added masquerading. + * Jos Vos : Separate input and output firewall + * chains, new "insert" and "append" + * commands to replace "add" commands, + * add ICMP header to struct ip_fwpkt. + * Jos Vos : Add support for matching device names. + * Willy Konynenberg : Add transparent proxying support. + * Jos Vos : Add options for input/output accounting. * * All the real work was done by ..... */ @@ -45,12 +52,19 @@ #ifndef _IP_FW_H #define _IP_FW_H +#include <linux/icmp.h> +#include <linux/in.h> +#include <linux/ip.h> +#include <linux/tcp.h> +#include <linux/udp.h> + struct ip_fw { struct ip_fw *fw_next; /* Next firewall on chain */ struct in_addr fw_src, fw_dst; /* Source and destination IP addr */ struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */ struct in_addr fw_via; /* IP address of interface "via" */ + struct device *fw_viadev; /* device of interface "via" */ unsigned short fw_flg; /* Flags word */ unsigned short fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */ /* in ports array (dst ports follow */ @@ -59,35 +73,42 @@ struct ip_fw #define IP_FW_MAX_PORTS 10 /* A reasonable maximum */ unsigned short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */ unsigned long fw_pcnt,fw_bcnt; /* Packet and byte counters */ + unsigned char fw_tosand, fw_tosxor; /* Revised packet priority */ + char fw_vianame[IFNAMSIZ]; /* name of interface "via" */ }; /* * Values for "flags" field . */ -#define IP_FW_F_ALL 0x000 /* This is a universal packet firewall*/ -#define IP_FW_F_TCP 0x001 /* This is a TCP packet firewall */ -#define IP_FW_F_UDP 0x002 /* This is a UDP packet firewall */ -#define IP_FW_F_ICMP 0x003 /* This is a ICMP packet firewall */ -#define IP_FW_F_KIND 0x003 /* Mask to isolate firewall kind */ -#define IP_FW_F_ACCEPT 0x004 /* This is an accept firewall (as * +#define IP_FW_F_ALL 0x0000 /* This is a universal packet firewall*/ +#define IP_FW_F_TCP 0x0001 /* This is a TCP packet firewall */ +#define IP_FW_F_UDP 0x0002 /* This is a UDP packet firewall */ +#define IP_FW_F_ICMP 0x0003 /* This is a ICMP packet firewall */ +#define IP_FW_F_KIND 0x0003 /* Mask to isolate firewall kind */ +#define IP_FW_F_ACCEPT 0x0004 /* This is an accept firewall (as * * opposed to a deny firewall)* * */ -#define IP_FW_F_SRNG 0x008 /* The first two src ports are a min * +#define IP_FW_F_SRNG 0x0008 /* The first two src ports are a min * * and max range (stored in host byte * * order). * * */ -#define IP_FW_F_DRNG 0x010 /* The first two dst ports are a min * +#define IP_FW_F_DRNG 0x0010 /* The first two dst ports are a min * * and max range (stored in host byte * * order). * * (ports[0] <= port <= ports[1]) * * */ -#define IP_FW_F_PRN 0x020 /* In verbose mode print this firewall*/ -#define IP_FW_F_BIDIR 0x040 /* For bidirectional firewalls */ -#define IP_FW_F_TCPSYN 0x080 /* For tcp packets-check SYN only */ -#define IP_FW_F_ICMPRPL 0x100 /* Send back icmp unreachable packet */ -#define IP_FW_F_MASQ 0x200 /* Masquerading */ -#define IP_FW_F_MASK 0x3FF /* All possible flag bits mask */ +#define IP_FW_F_PRN 0x0020 /* In verbose mode print this firewall*/ +#define IP_FW_F_BIDIR 0x0040 /* For bidirectional firewalls */ +#define IP_FW_F_TCPSYN 0x0080 /* For tcp packets-check SYN only */ +#define IP_FW_F_ICMPRPL 0x0100 /* Send back icmp unreachable packet */ +#define IP_FW_F_MASQ 0x0200 /* Masquerading */ +#define IP_FW_F_TCPACK 0x0400 /* For tcp-packets match if ACK is set*/ +#define IP_FW_F_REDIR 0x0800 /* Redirect to local port fw_pts[n] */ +#define IP_FW_F_ACCTIN 0x1000 /* Account incoming packets only. */ +#define IP_FW_F_ACCTOUT 0x2000 /* Account outgoing packets only. */ + +#define IP_FW_F_MASK 0x3FFF /* All possible flag bits mask */ /* * New IP firewall options for [gs]etsockopt at the RAW IP level. @@ -95,25 +116,56 @@ struct ip_fw * a raw socket for this. Instead we check rights in the calls. */ -#define IP_FW_BASE_CTL 64 - -#define IP_FW_ADD_BLK (IP_FW_BASE_CTL) -#define IP_FW_ADD_FWD (IP_FW_BASE_CTL+1) -#define IP_FW_CHK_BLK (IP_FW_BASE_CTL+2) -#define IP_FW_CHK_FWD (IP_FW_BASE_CTL+3) -#define IP_FW_DEL_BLK (IP_FW_BASE_CTL+4) -#define IP_FW_DEL_FWD (IP_FW_BASE_CTL+5) -#define IP_FW_FLUSH_BLK (IP_FW_BASE_CTL+6) -#define IP_FW_FLUSH_FWD (IP_FW_BASE_CTL+7) -#define IP_FW_ZERO_BLK (IP_FW_BASE_CTL+8) -#define IP_FW_ZERO_FWD (IP_FW_BASE_CTL+9) -#define IP_FW_POLICY_BLK (IP_FW_BASE_CTL+10) -#define IP_FW_POLICY_FWD (IP_FW_BASE_CTL+11) - -#define IP_ACCT_ADD (IP_FW_BASE_CTL+16) -#define IP_ACCT_DEL (IP_FW_BASE_CTL+17) -#define IP_ACCT_FLUSH (IP_FW_BASE_CTL+18) -#define IP_ACCT_ZERO (IP_FW_BASE_CTL+19) +#define IP_FW_BASE_CTL 64 /* base for firewall socket options */ + +#define IP_FW_COMMAND 0x00FF /* mask for command without chain */ +#define IP_FW_TYPE 0x0300 /* mask for type (chain) */ +#define IP_FW_SHIFT 8 /* shift count for type (chain) */ + +#define IP_FW_FWD 0 +#define IP_FW_IN 1 +#define IP_FW_OUT 2 +#define IP_FW_ACCT 3 +#define IP_FW_CHAINS 4 /* total number of ip_fw chains */ + +#define IP_FW_INSERT (IP_FW_BASE_CTL) +#define IP_FW_APPEND (IP_FW_BASE_CTL+1) +#define IP_FW_DELETE (IP_FW_BASE_CTL+2) +#define IP_FW_FLUSH (IP_FW_BASE_CTL+3) +#define IP_FW_ZERO (IP_FW_BASE_CTL+4) +#define IP_FW_POLICY (IP_FW_BASE_CTL+5) +#define IP_FW_CHECK (IP_FW_BASE_CTL+6) +#define IP_FW_MASQ_TIMEOUTS (IP_FW_BASE_CTL+7) + +#define IP_FW_INSERT_FWD (IP_FW_INSERT | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_APPEND_FWD (IP_FW_APPEND | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_DELETE_FWD (IP_FW_DELETE | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_FLUSH_FWD (IP_FW_FLUSH | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_ZERO_FWD (IP_FW_ZERO | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_POLICY_FWD (IP_FW_POLICY | (IP_FW_FWD << IP_FW_SHIFT)) +#define IP_FW_CHECK_FWD (IP_FW_CHECK | (IP_FW_FWD << IP_FW_SHIFT)) + +#define IP_FW_INSERT_IN (IP_FW_INSERT | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_APPEND_IN (IP_FW_APPEND | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_DELETE_IN (IP_FW_DELETE | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_FLUSH_IN (IP_FW_FLUSH | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_ZERO_IN (IP_FW_ZERO | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_POLICY_IN (IP_FW_POLICY | (IP_FW_IN << IP_FW_SHIFT)) +#define IP_FW_CHECK_IN (IP_FW_CHECK | (IP_FW_IN << IP_FW_SHIFT)) + +#define IP_FW_INSERT_OUT (IP_FW_INSERT | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_APPEND_OUT (IP_FW_APPEND | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_DELETE_OUT (IP_FW_DELETE | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_FLUSH_OUT (IP_FW_FLUSH | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_ZERO_OUT (IP_FW_ZERO | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_POLICY_OUT (IP_FW_POLICY | (IP_FW_OUT << IP_FW_SHIFT)) +#define IP_FW_CHECK_OUT (IP_FW_CHECK | (IP_FW_OUT << IP_FW_SHIFT)) + +#define IP_ACCT_INSERT (IP_FW_INSERT | (IP_FW_ACCT << IP_FW_SHIFT)) +#define IP_ACCT_APPEND (IP_FW_APPEND | (IP_FW_ACCT << IP_FW_SHIFT)) +#define IP_ACCT_DELETE (IP_FW_DELETE | (IP_FW_ACCT << IP_FW_SHIFT)) +#define IP_ACCT_FLUSH (IP_FW_FLUSH | (IP_FW_ACCT << IP_FW_SHIFT)) +#define IP_ACCT_ZERO (IP_FW_ZERO | (IP_FW_ACCT << IP_FW_SHIFT)) struct ip_fwpkt { @@ -121,63 +173,47 @@ struct ip_fwpkt union { struct tcphdr fwp_tcph; /* TCP header or */ struct udphdr fwp_udph; /* UDP header */ + struct icmphdr fwp_icmph; /* ICMP header */ } fwp_protoh; struct in_addr fwp_via; /* interface address */ + char fwp_vianame[IFNAMSIZ]; /* interface name */ }; /* + * timeouts for ip masquerading + */ + +struct ip_fw_masq; + +/* * Main firewall chains definitions and global var's definitions. */ #ifdef __KERNEL__ -#include <linux/config.h> +/* Modes used in the ip_fw_chk() routine. */ +#define IP_FW_MODE_FW 0x00 /* kernel firewall check */ +#define IP_FW_MODE_ACCT_IN 0x01 /* accounting (incoming) */ +#define IP_FW_MODE_ACCT_OUT 0x02 /* accounting (outgoing) */ +#define IP_FW_MODE_CHK 0x04 /* check requested by user */ -#ifdef CONFIG_IP_MASQUERADE -struct ip_masq { - struct ip_masq *next; /* next member in list */ - struct timer_list timer; /* Expiration timer */ - __u16 protocol; /* Which protocol are we talking? */ - __u32 src, dst; /* Source and destination IP addresses */ - __u16 sport,dport; /* Source and destoination ports */ - __u16 mport; /* Masquaraded port */ - __u32 init_seq; /* Add delta from this seq. on */ - short delta; /* Delta in sequence numbers */ - char sawfin; /* Did we saw an FIN packet? */ -}; -extern struct ip_masq *ip_msq_hosts; -extern void ip_fw_masquerade(struct sk_buff **, struct device *); -extern int ip_fw_demasquerade(struct sk_buff *); -#endif +#include <linux/config.h> #ifdef CONFIG_IP_FIREWALL -extern struct ip_fw *ip_fw_blk_chain; +extern struct ip_fw *ip_fw_in_chain; +extern struct ip_fw *ip_fw_out_chain; extern struct ip_fw *ip_fw_fwd_chain; -extern int ip_fw_blk_policy; +extern int ip_fw_in_policy; +extern int ip_fw_out_policy; extern int ip_fw_fwd_policy; extern int ip_fw_ctl(int, void *, int); #endif #ifdef CONFIG_IP_ACCT extern struct ip_fw *ip_acct_chain; -extern void ip_acct_cnt(struct iphdr *, struct device *, struct ip_fw *); extern int ip_acct_ctl(int, void *, int); #endif -extern int ip_fw_chk(struct iphdr *, struct device *rif,struct ip_fw *, int, int); -#endif /* KERNEL */ - -#ifdef CONFIG_IP_MASQUERADE - -#undef DEBUG_MASQ -#define MASQUERADE_EXPIRE_TCP 15*60*HZ -#define MASQUERADE_EXPIRE_TCP_FIN 2*60*HZ -#define MASQUERADE_EXPIRE_UDP 5*60*HZ - -/* - * Linux ports don't normally get allocated above 32K. I used an extra 4K port-space - */ - -#define PORT_MASQ_BEGIN 60000 -#define PORT_MASQ_END (PORT_MASQ_BEGIN+4096) -#endif +extern int ip_fw_chk(struct iphdr *, struct device *, __u16 *, struct ip_fw *, int, int); +extern void ip_fw_init(void); +#endif /* KERNEL */ #endif /* _IP_FW_H */ diff --git a/include/linux/ipc.h b/include/linux/ipc.h index 3878e0203..9349f0f49 100644 --- a/include/linux/ipc.h +++ b/include/linux/ipc.h @@ -1,22 +1,21 @@ #ifndef _LINUX_IPC_H #define _LINUX_IPC_H + #include <linux/types.h> -typedef int key_t; /* should go in <types.h> type for IPC key */ -#define IPC_PRIVATE ((key_t) 0) +#define IPC_PRIVATE ((__kernel_key_t) 0) struct ipc_perm { - key_t key; - ushort uid; /* owner euid and egid */ - ushort gid; - ushort cuid; /* creator euid and egid */ - ushort cgid; - ushort mode; /* access modes see mode flags below */ - ushort seq; /* sequence number */ + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; + __kernel_mode_t mode; + unsigned short seq; }; - /* resource get request flags */ #define IPC_CREAT 00001000 /* create if key is nonexistent */ #define IPC_EXCL 00002000 /* fail if key exists */ @@ -38,28 +37,6 @@ struct ipc_perm #define IPC_UNUSED ((void *) -1) #define IPC_NOID ((void *) -2) /* being allocated/destroyed */ -/* - * These are used to wrap system calls. See ipc/util.c. - */ -struct ipc_kludge { - struct msgbuf *msgp; - long msgtyp; -}; - -#define SEMOP 1 -#define SEMGET 2 -#define SEMCTL 3 -#define MSGSND 11 -#define MSGRCV 12 -#define MSGGET 13 -#define MSGCTL 14 -#define SHMAT 21 -#define SHMDT 22 -#define SHMGET 23 -#define SHMCTL 24 - -#define IPCCALL(version,op) ((version)<<16 | (op)) - #endif /* __KERNEL__ */ #endif /* _LINUX_IPC_H */ diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h new file mode 100644 index 000000000..b8126a9f2 --- /dev/null +++ b/include/linux/ipv6.h @@ -0,0 +1,105 @@ +#ifndef _IPV6_H +#define _IPV6_H + +#include <linux/in6.h> +#include <asm/byteorder.h> + +/* + * IPv6 fixed header + */ + +struct ipv6hdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 priority:4, + version:4; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 version:4, + priority:4; +#else +#error "Please fix <asm/byteorder.h>" +#endif + __u8 flow_lbl[3]; + + __u16 payload_len; + __u8 nexthdr; + __u8 hop_limit; + + struct in6_addr saddr; + struct in6_addr daddr; +}; + +struct in6_ifreq { + struct in6_addr addr; + __u32 prefix_len; + char devname[8]; +}; + +/* + * Advanced API + * source interface/address selection, source routing, etc... + * *under construction* + */ + + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + int ipi6_ifindex; +}; + +#define IPV6_SRCRT_STRICT 0x01 /* this hop must be a neighbor */ +#define IPV6_SRCRT_TYPE_0 0 /* IPv6 type 0 Routing Header */ + +/* + * routing header + */ +struct ipv6_rt_hdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 type; + __u8 segments_left; + + /* + * type specific data + * variable length field + */ +}; + +/* + * routing header type 0 (used in cmsghdr struct) + */ + +struct rt0_hdr { + struct ipv6_rt_hdr rt_hdr; + __u32 bitmap; /* strict/loose bit map */ + struct in6_addr addr[0]; + +#define rt0_type rt_hdr.type; +}; + +#ifdef __KERNEL__ + +/* + * The length of this struct cannot be greater than the length of + * the proto_priv field in a sk_buff which is currently + * defined to be 16 bytes. + * Pointers take upto 8 bytes (sizeof(void *) is 8 on the alpha). + */ +struct ipv6_options +{ + /* length of extension headers */ + + __u16 opt_flen; /* after fragment hdr */ + __u16 opt_nflen; /* before fragment hdr */ + + /* + * protocol options + * usualy carried in IPv6 extension headers + */ + + struct ipv6_rt_hdr *srcrt; /* Routing Header */ + +}; + +#endif + +#endif diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h new file mode 100644 index 000000000..ef93e022b --- /dev/null +++ b/include/linux/ipv6_route.h @@ -0,0 +1,41 @@ +/* + * Linux INET6 implementation + * + * Authors: + * Pedro Roque <roque@di.fc.ul.pt> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _LINUX_IPV6_ROUTE_H +#define _LINUX_IPV6_ROUTE_H + +#include <linux/route.h> + +#define RTI_DEVRT 0x00010000 /* route lookup, dev must match */ +#define RTI_ALLONLINK 0x00020000 /* all destinations on link */ +#define RTI_DCACHE RTF_DCACHE /* rt6_info is a dcache entry */ +#define RTI_INVALID RTF_INVALID /* invalid route/dcache entry */ + +#define RTI_DYNAMIC RTF_DYNAMIC /* rt6_info created dynamicly */ +#define RTI_GATEWAY RTF_GATEWAY +#define RTI_DYNMOD RTF_MODIFIED /* more specific route may exist*/ + +#define DCF_PMTU RTF_MSS /* dest cache has valid PMTU */ +#define DCF_INVALID RTF_INVALID + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_gateway; + __u32 rtmsg_type; + __u16 rtmsg_prefixlen; + __u16 rtmsg_metric; + unsigned long rtmsg_info; + __u32 rtmsg_flags; + int rtmsg_ifindex; +}; + +#endif diff --git a/include/linux/ipx.h b/include/linux/ipx.h index d3bff83b6..a2d86a983 100644 --- a/include/linux/ipx.h +++ b/include/linux/ipx.h @@ -6,11 +6,11 @@ struct sockaddr_ipx { - short sipx_family; - short sipx_port; - unsigned long sipx_network; - unsigned char sipx_node[IPX_NODE_LEN]; - unsigned char sipx_type; + sa_family_t sipx_family; + __u16 sipx_port; + __u32 sipx_network; + unsigned char sipx_node[IPX_NODE_LEN]; + __u8 sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; @@ -40,6 +40,7 @@ typedef struct ipx_interface_definition #define IPX_FRAME_8022 2 #define IPX_FRAME_ETHERII 3 #define IPX_FRAME_8023 4 +#define IPX_FRAME_TR_8022 5 unsigned char ipx_special; #define IPX_SPECIAL_NONE 0 #define IPX_PRIMARY 1 diff --git a/include/linux/isdn.h b/include/linux/isdn.h new file mode 100644 index 000000000..1408407d9 --- /dev/null +++ b/include/linux/isdn.h @@ -0,0 +1,635 @@ +/* $Id: isdn.h,v 1.16 1996/08/12 16:20:56 hipp Exp $ + * + * Main header for the Linux ISDN subsystem (linklevel). + * + * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de) + * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg + * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Log: isdn.h,v $ + * Revision 1.16 1996/08/12 16:20:56 hipp + * renamed ppp_minor to ppp_slot + * + * Revision 1.15 1996/06/15 14:56:57 fritz + * Added version signatures for data structures used + * by userlevel programs. + * + * Revision 1.14 1996/06/06 21:24:23 fritz + * Started adding support for suspend/resume. + * + * Revision 1.13 1996/06/05 02:18:20 fritz + * Added DTMF decoding stuff. + * + * Revision 1.12 1996/06/03 19:55:08 fritz + * Fixed typos. + * + * Revision 1.11 1996/05/31 01:37:47 fritz + * Minor changes, due to changes in isdn_tty.c + * + * Revision 1.10 1996/05/18 01:37:18 fritz + * Added spelling corrections and some minor changes + * to stay in sync with kernel. + * + * Revision 1.9 1996/05/17 03:58:20 fritz + * Added flags for DLE handling. + * + * Revision 1.8 1996/05/11 21:49:55 fritz + * Removed queue management variables. + * Changed queue management to use sk_buffs. + * + * Revision 1.7 1996/05/07 09:10:06 fritz + * Reorganized tty-related structs. + * + * Revision 1.6 1996/05/06 11:38:27 hipp + * minor change in ippp struct + * + * Revision 1.5 1996/04/30 11:03:16 fritz + * Added Michael's ippp-bind patch. + * + * Revision 1.4 1996/04/29 23:00:02 fritz + * Added variables for voice-support. + * + * Revision 1.3 1996/04/20 16:54:58 fritz + * Increased maximum number of channels. + * Added some flags for isdn_net to handle callback more reliable. + * Fixed delay-definitions to be more accurate. + * Misc. typos + * + * Revision 1.2 1996/02/11 02:10:02 fritz + * Changed IOCTL-names + * Added rx_netdev, st_netdev, first_skb, org_hcb, and org_hcu to + * Netdevice-local struct. + * + * Revision 1.1 1996/01/10 20:55:07 fritz + * Initial revision + * + */ + +#ifndef isdn_h +#define isdn_h + +#include <linux/ioctl.h> + +#define ISDN_TTY_MAJOR 43 +#define ISDN_TTYAUX_MAJOR 44 +#define ISDN_MAJOR 45 + +/* The minor-devicenumbers for Channel 0 and 1 are used as arguments for + * physical Channel-Mapping, so they MUST NOT be changed without changing + * the correspondent code in isdn.c + */ + +#define ISDN_MAX_DRIVERS 32 +#define ISDN_MAX_CHANNELS 64 +#define ISDN_MINOR_B 0 +#define ISDN_MINOR_BMAX (ISDN_MAX_CHANNELS-1) +#define ISDN_MINOR_CTRL ISDN_MAX_CHANNELS +#define ISDN_MINOR_CTRLMAX (2*ISDN_MAX_CHANNELS-1) +#define ISDN_MINOR_PPP (2*ISDN_MAX_CHANNELS) +#define ISDN_MINOR_PPPMAX (3*ISDN_MAX_CHANNELS-1) +#define ISDN_MINOR_STATUS 255 + +/* New ioctl-codes */ +#define IIOCNETAIF _IO('I',1) +#define IIOCNETDIF _IO('I',2) +#define IIOCNETSCF _IO('I',3) +#define IIOCNETGCF _IO('I',4) +#define IIOCNETANM _IO('I',5) +#define IIOCNETDNM _IO('I',6) +#define IIOCNETGNM _IO('I',7) +#define IIOCGETSET _IO('I',8) +#define IIOCSETSET _IO('I',9) +#define IIOCSETVER _IO('I',10) +#define IIOCNETHUP _IO('I',11) +#define IIOCSETGST _IO('I',12) +#define IIOCSETBRJ _IO('I',13) +#define IIOCSIGPRF _IO('I',14) +#define IIOCGETPRF _IO('I',15) +#define IIOCSETPRF _IO('I',16) +#define IIOCGETMAP _IO('I',17) +#define IIOCSETMAP _IO('I',18) +#define IIOCNETASL _IO('I',19) +#define IIOCNETDIL _IO('I',20) +#define IIOCGETCPS _IO('I',21) +#define IIOCGETDVR _IO('I',22) + +#define IIOCNETALN _IO('I',32) +#define IIOCNETDLN _IO('I',33) + +#define IIOCDBGVAR _IO('I',127) + +#define IIOCDRVCTL _IO('I',128) + +/* Packet encapsulations for net-interfaces */ +#define ISDN_NET_ENCAP_ETHER 0 +#define ISDN_NET_ENCAP_RAWIP 1 +#define ISDN_NET_ENCAP_IPTYP 2 +#define ISDN_NET_ENCAP_CISCOHDLC 3 +#define ISDN_NET_ENCAP_SYNCPPP 4 +#define ISDN_NET_ENCAP_UIHDLC 5 + +/* Facility which currently uses an ISDN-channel */ +#define ISDN_USAGE_NONE 0 +#define ISDN_USAGE_RAW 1 +#define ISDN_USAGE_MODEM 2 +#define ISDN_USAGE_NET 3 +#define ISDN_USAGE_VOICE 4 +#define ISDN_USAGE_FAX 5 +#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */ +#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */ +#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */ + +#define ISDN_MODEM_ANZREG 21 /* Number of Modem-Registers */ +#define ISDN_MSNLEN 20 + +typedef struct { + char drvid[25]; + unsigned long arg; +} isdn_ioctl_struct; + +typedef struct { + unsigned long isdndev; + unsigned long atmodem[ISDN_MAX_CHANNELS]; + unsigned long info[ISDN_MAX_CHANNELS]; +} debugvar_addr; + +typedef struct { + char name[10]; + char phone[20]; + int outgoing; +} isdn_net_ioctl_phone; + +#define NET_DV 0x01 /* Data version for net_cfg */ +#define TTY_DV 0x01 /* Data version for iprofd etc. */ + +typedef struct { + char name[10]; /* Name of interface */ + char master[10]; /* Name of Master for Bundling */ + char slave[10]; /* Name of Slave for Bundling */ + char eaz[256]; /* EAZ/MSN */ + char drvid[25]; /* DriverId for Bindings */ + int onhtime; /* Hangup-Timeout */ + int charge; /* Charge-Units */ + int l2_proto; /* Layer-2 protocol */ + int l3_proto; /* Layer-3 protocol */ + int p_encap; /* Encapsulation */ + int exclusive; /* Channel, if bound exclusive */ + int dialmax; /* Dial Retry-Counter */ + int slavedelay; /* Delay until slave starts up */ + int cbdelay; /* Delay before Callback */ + int chargehup; /* Flag: Charge-Hangup */ + int ihup; /* Flag: Hangup-Timeout on incoming line */ + int secure; /* Flag: Secure */ + int callback; /* Flag: Callback */ + int cbhup; /* Flag: Reject Call before Callback */ + int pppbind; /* ippp device for bindings */ +} isdn_net_ioctl_cfg; + +#ifdef __KERNEL__ + +#ifndef STANDALONE +#include <linux/config.h> +#endif +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/major.h> +#include <asm/segment.h> +#include <asm/io.h> +#include <linux/kernel.h> +#include <linux/signal.h> +#include <linux/malloc.h> +#include <linux/mm.h> +#include <linux/timer.h> +#include <linux/wait.h> +#include <linux/tty.h> +#include <linux/tty_flip.h> +#include <linux/serial_reg.h> +#include <linux/fcntl.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/ip.h> +#include <linux/in.h> +#include <linux/netdevice.h> +#include <linux/etherdevice.h> +#include <linux/skbuff.h> +#include <linux/tcp.h> + +#ifdef CONFIG_ISDN_PPP + +#ifdef CONFIG_ISDN_PPP_VJ +# include <net/slhc_vj.h> +#endif + +#include <linux/ppp_defs.h> +#include <linux/if_ppp.h> +#include <linux/if_pppvar.h> + +#include <linux/isdn_ppp.h> +#endif + +#include <linux/isdnif.h> + +#define ISDN_DRVIOCTL_MASK 0x7f /* Mask for Device-ioctl */ + +/* Until now unused */ +#define ISDN_SERVICE_VOICE 1 +#define ISDN_SERVICE_AB 1<<1 +#define ISDN_SERVICE_X21 1<<2 +#define ISDN_SERVICE_G4 1<<3 +#define ISDN_SERVICE_BTX 1<<4 +#define ISDN_SERVICE_DFUE 1<<5 +#define ISDN_SERVICE_X25 1<<6 +#define ISDN_SERVICE_TTX 1<<7 +#define ISDN_SERVICE_MIXED 1<<8 +#define ISDN_SERVICE_FW 1<<9 +#define ISDN_SERVICE_GTEL 1<<10 +#define ISDN_SERVICE_BTXN 1<<11 +#define ISDN_SERVICE_BTEL 1<<12 + +/* Macros checking plain usage */ +#define USG_NONE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NONE) +#define USG_RAW(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_RAW) +#define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) +#define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) +#define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET) +#define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING) +#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \ + ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) ) + +/* Timer-delays and scheduling-flags */ +#define ISDN_TIMER_RES 3 /* Main Timer-Resolution */ +#define ISDN_TIMER_02SEC (HZ/(ISDN_TIMER_RES+1)/5) /* Slow-Timer1 .2 sec */ +#define ISDN_TIMER_1SEC (HZ/(ISDN_TIMER_RES+1)) /* Slow-Timer2 1 sec */ +#define ISDN_TIMER_MODEMREAD 1 +#define ISDN_TIMER_MODEMPLUS 2 +#define ISDN_TIMER_MODEMRING 4 +#define ISDN_TIMER_MODEMXMIT 8 +#define ISDN_TIMER_NETDIAL 16 +#define ISDN_TIMER_NETHANGUP 32 +#define ISDN_TIMER_IPPP 64 +#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \ + ISDN_TIMER_MODEMXMIT) +#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_NETHANGUP | \ + ISDN_TIMER_NETDIAL) + +/* Timeout-Values for isdn_net_dial() */ +#define ISDN_TIMER_DTIMEOUT10 (10*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) +#define ISDN_TIMER_DTIMEOUT15 (15*HZ/(ISDN_TIMER_02SEC*(ISDN_TIMER_RES+1))) + +/* GLOBAL_FLAGS */ +#define ISDN_GLOBAL_STOPPED 1 + +/*=================== Start of ip-over-ISDN stuff =========================*/ + +/* Feature- and status-flags for a net-interface */ +#define ISDN_NET_CONNECTED 0x01 /* Bound to ISDN-Channel */ +#define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */ +#define ISDN_NET_CALLBACK 0x04 /* activate callback */ +#define ISDN_NET_CBHUP 0x08 /* hangup before callback */ +#define ISDN_NET_CBOUT 0x10 /* remote machine does callback */ +#if 0 +/* Unused??? */ +#define ISDN_NET_CLONE 0x08 /* clone a tmp interface when called */ +#define ISDN_NET_TMP 0x10 /* tmp interface until getting an IP */ +#define ISDN_NET_DYNAMIC 0x20 /* this link is dynamically allocated */ +#endif +#define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */ + +/* Phone-list-element */ +typedef struct { + void *next; + char num[20]; +} isdn_net_phone; + +/* Local interface-data */ +typedef struct isdn_net_local_s { + ulong magic; + char name[10]; /* Name of device */ + struct enet_statistics stats; /* Ethernet Statistics */ + int isdn_device; /* Index to isdn-device */ + int isdn_channel; /* Index to isdn-channel */ + int ppp_slot; /* PPPD device slot number */ + int pre_device; /* Preselected isdn-device */ + int pre_channel; /* Preselected isdn-channel */ + int exclusive; /* If non-zero idx to reserved chan.*/ + int flags; /* Connection-flags */ + int dialretry; /* Counter for Dialout-retries */ + int dialmax; /* Max. Number of Dial-retries */ + int cbdelay; /* Delay before Callback starts */ + int dtimer; /* Timeout-counter for dialing */ + char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */ + u_char cbhup; /* Flag: Reject Call before Callback*/ + u_char dialstate; /* State for dialing */ + u_char p_encap; /* Packet encapsulation */ + /* 0 = Ethernet over ISDN */ + /* 1 = RAW-IP */ + /* 2 = IP with type field */ + u_char l2_proto; /* Layer-2-protocol */ + /* See ISDN_PROTO_L2..-constants in */ + /* isdnif.h */ + /* 0 = X75/LAPB with I-Frames */ + /* 1 = X75/LAPB with UI-Frames */ + /* 2 = X75/LAPB with BUI-Frames */ + /* 3 = HDLC */ + u_char l3_proto; /* Layer-3-protocol */ + /* See ISDN_PROTO_L3..-constants in */ + /* isdnif.h */ + /* 0 = Transparent */ + int huptimer; /* Timeout-counter for auto-hangup */ + int charge; /* Counter for charging units */ + int chargetime; /* Timer for Charging info */ + int hupflags; /* Flags for charge-unit-hangup: */ + /* bit0: chargeint is invalid */ + /* bit1: Getting charge-interval */ + /* bit2: Do charge-unit-hangup */ + int outgoing; /* Flag: outgoing call */ + int onhtime; /* Time to keep link up */ + int chargeint; /* Interval between charge-infos */ + int onum; /* Flag: at least 1 outgoing number */ + int cps; /* current speed of this interface */ + int transcount; /* byte-counter for cps-calculation */ + int sqfull; /* Flag: netdev-queue overloaded */ + ulong sqfull_stamp; /* Start-Time of overload */ + ulong slavedelay; /* Dynamic bundling delaytime */ + struct device *srobin; /* Ptr to Master device for slaves */ + isdn_net_phone *phone[2]; /* List of remote-phonenumbers */ + /* phone[0] = Incoming Numbers */ + /* phone[1] = Outgoing Numbers */ + isdn_net_phone *dial; /* Pointer to dialed number */ + struct device *master; /* Ptr to Master device for slaves */ + struct device *slave; /* Ptr to Slave device for masters */ + struct isdn_net_local_s *next; /* Ptr to next link in bundle */ + struct isdn_net_local_s *last; /* Ptr to last link in bundle */ + struct isdn_net_dev_s *netdev; /* Ptr to netdev */ + struct sk_buff *first_skb; /* Ptr to skb that triggers dialing */ + struct sk_buff *sav_skb; /* Ptr to skb, rejected by LL-driver*/ + /* Ptr to orig. header_cache_bind */ + void (*org_hcb)(struct hh_cache **, struct device *, + unsigned short, __u32); + /* Ptr to orig. header_cache_update */ + void (*org_hcu)(struct hh_cache *, struct device *, + unsigned char *); + int pppbind; /* ippp device for bindings */ +} isdn_net_local; + +#ifdef CONFIG_ISDN_PPP +struct ippp_bundle { + int mp_mrru; /* unused */ + struct mpqueue *last; /* currently defined in isdn_net_dev */ + int min; /* currently calculated 'on the fly' */ + long next_num; /* we wanna see this seq.-number next */ + struct sqqueue *sq; + int modify:1; /* set to 1 while modifying sqqueue */ + int bundled:1; /* bundle active ? */ +}; +#endif + +/* the interface itself */ +typedef struct isdn_net_dev_s { + isdn_net_local local; + isdn_net_local *queue; + void *next; /* Pointer to next isdn-interface */ + struct device dev; /* interface to upper levels */ +#ifdef CONFIG_ISDN_PPP + struct mpqueue *mp_last; + struct ippp_bundle ib; +#endif +} isdn_net_dev; + +/*===================== End of ip-over-ISDN stuff ===========================*/ + +/*======================= Start of ISDN-tty stuff ===========================*/ + +#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ +#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */ +#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */ +#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */ +#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */ +#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ +#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ +#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */ +#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */ +#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */ +#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */ +#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */ +#define ISDN_SERIAL_XMIT_SIZE 4000 /* Maximum bufsize for write */ +#define ISDN_SERIAL_TYPE_NORMAL 1 +#define ISDN_SERIAL_TYPE_CALLOUT 2 + +/* Private data of AT-command-interpreter */ +typedef struct atemu { + u_char profile[ISDN_MODEM_ANZREG]; /* Modem-Regs. Profile 0 */ + u_char mdmreg[ISDN_MODEM_ANZREG]; /* Modem-Registers */ + char pmsn[ISDN_MSNLEN]; /* EAZ/MSNs Profile 0 */ + char msn[ISDN_MSNLEN];/* EAZ/MSN */ + u_char vpar[10]; /* Voice-parameters */ + int mdmcmdl; /* Length of Modem-Commandbuffer */ + int pluscount; /* Counter for +++ sequence */ + int lastplus; /* Timestamp of last + */ + int lastDLE; /* Flag for voice-coding: DLE seen */ + char mdmcmd[255]; /* Modem-Commandbuffer */ +} atemu; + +/* Private data (similar to async_struct in <linux/serial.h>) */ +typedef struct modem_info { + int magic; + int flags; /* defined in tty.h */ + int x_char; /* xon/xoff character */ + int mcr; /* Modem control register */ + int msr; /* Modem status register */ + int lsr; /* Line status register */ + int line; + int count; /* # of fd on device */ + int blocked_open; /* # of blocked opens */ + long session; /* Session of opening process */ + long pgrp; /* pgrp of opening process */ + int online; /* B-Channel is up */ + int vonline; /* Voice-channel status */ + int dialing; /* Dial in progress */ + int rcvsched; /* Receive needs schedule */ + int isdn_driver; /* Index to isdn-driver */ + int isdn_channel; /* Index to isdn-channel */ + int drv_index; /* Index to dev->usage */ + int ncarrier; /* Flag: schedule NO CARRIER */ + struct timer_list nc_timer; /* Timer for delayed NO CARRIER */ + int send_outstanding;/* # of outstanding send-requests */ + int xmit_size; /* max. # of chars in xmit_buf */ + int xmit_count; /* # of chars in xmit_buf */ + unsigned char *xmit_buf; /* transmit buffer */ + struct sk_buff_head xmit_queue; /* transmit queue */ + struct sk_buff_head dtmf_queue; /* queue for dtmf results */ + struct tty_struct *tty; /* Pointer to corresponding tty */ + atemu emu; /* AT-emulator data */ + void *adpcms; /* state for adpcm decompression */ + void *adpcmr; /* state for adpcm compression */ + void *dtmf_state; /* state for dtmf decoder */ + struct termios normal_termios; /* For saving termios structs */ + struct termios callout_termios; + struct wait_queue *open_wait; + struct wait_queue *close_wait; +} modem_info; + +#define ISDN_MODEM_WINSIZE 8 + +/* Description of one ISDN-tty */ +typedef struct { + int refcount; /* Number of opens */ + struct tty_driver tty_modem; /* tty-device */ + struct tty_driver cua_modem; /* cua-device */ + struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */ + struct termios *modem_termios[ISDN_MAX_CHANNELS]; + struct termios *modem_termios_locked[ISDN_MAX_CHANNELS]; + modem_info info[ISDN_MAX_CHANNELS]; /* Private data */ +} modem; + +/*======================= End of ISDN-tty stuff ============================*/ + +/*======================= Start of sync-ppp stuff ==========================*/ + + +#define NUM_RCV_BUFFS 64 +#define PPP_HARD_HDR_LEN 4 + +#define IPPP_OPEN 0x1 +#define IPPP_CONNECT 0x2 +#define IPPP_CLOSEWAIT 0x4 +#define IPPP_NOBLOCK 0x8 + +#ifdef CONFIG_ISDN_PPP + +struct sqqueue { + struct sqqueue *next; + int sqno_start; + int sqno_end; + struct sk_buff *skb; + long timer; +}; + +struct mpqueue { + struct mpqueue *next; + struct mpqueue *last; + int sqno; + struct sk_buff *skb; + int BEbyte; + unsigned long time; +}; + +struct ippp_buf_queue { + struct ippp_buf_queue *next; + struct ippp_buf_queue *last; + char *buf; /* NULL here indicates end of queue */ + int len; +}; + +struct ippp_struct { + struct ippp_struct *next_link; + int state; + struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */ + struct ippp_buf_queue *first; /* pointer to (current) first packet */ + struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */ + struct wait_queue *wq; + struct wait_queue *wq1; + struct task_struct *tk; + unsigned int mpppcfg; + unsigned int pppcfg; + unsigned int mru; + unsigned int mpmru; + unsigned int mpmtu; + unsigned int maxcid; + isdn_net_local *lp; + int unit; + int minor; + long last_link_seqno; + long mp_seqno; + long range; +#ifdef CONFIG_ISDN_PPP_VJ + unsigned char *cbuf; + struct slcompress *slcomp; +#endif + unsigned long debug; +}; + +#endif + +/*======================== End of sync-ppp stuff ===========================*/ + +/*======================= Start of general stuff ===========================*/ + +typedef struct { + char *next; + char *private; +} infostruct; + +/* Description of hardware-level-driver */ +typedef struct { + ulong flags; /* Flags */ + int channels; /* Number of channels */ + int reject_bus; /* Flag: Reject rejected call on bus*/ + struct wait_queue *st_waitq; /* Wait-Queue for status-read's */ + int maxbufsize; /* Maximum Buffersize supported */ + unsigned long pktcount; /* Until now: unused */ + int running; /* Flag: Protocolcode running */ + int loaded; /* Flag: Driver loaded */ + int stavail; /* Chars avail on Status-device */ + isdn_if *interface; /* Interface to driver */ + int *rcverr; /* Error-counters for B-Ch.-receive */ + int *rcvcount; /* Byte-counters for B-Ch.-receive */ + unsigned long DLEflag; /* Flags: Insert DLE at next read */ + struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */ + struct wait_queue **rcv_waitq; /* Wait-Queues for B-Channel-Reads */ + struct wait_queue **snd_waitq; /* Wait-Queue for B-Channel-Send's */ + char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */ +} driver; + +/* Main driver-data */ +typedef struct isdn_devt { + unsigned short flags; /* Bitmapped Flags: */ + /* */ + int drivers; /* Current number of drivers */ + int channels; /* Current number of channels */ + int net_verbose; /* Verbose-Flag */ + int modempoll; /* Flag: tty-read active */ + int tflags; /* Timer-Flags: */ + /* see ISDN_TIMER_..defines */ + int global_flags; + infostruct *infochain; /* List of open info-devs. */ + struct wait_queue *info_waitq; /* Wait-Queue for isdninfo */ + struct timer_list timer; /* Misc.-function Timer */ + int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */ + int drvmap[ISDN_MAX_CHANNELS]; /* Map minor->driver-index */ + int usage[ISDN_MAX_CHANNELS]; /* Used by tty/ip/voice */ + char num[ISDN_MAX_CHANNELS][20];/* Remote number of active ch.*/ + int m_idx[ISDN_MAX_CHANNELS]; /* Index for mdm.... */ + driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */ + isdn_net_dev *netdev; /* Linked list of net-if's */ + char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */ + struct task_struct *profd; /* For iprofd */ + modem mdm; /* tty-driver-data */ + isdn_net_dev *rx_netdev[ISDN_MAX_CHANNELS]; /* rx netdev-pointers */ + isdn_net_dev *st_netdev[ISDN_MAX_CHANNELS]; /* stat netdev-pointers */ + ulong ibytes[ISDN_MAX_CHANNELS]; /* Statistics incoming bytes */ + ulong obytes[ISDN_MAX_CHANNELS]; /* Statistics outgoing bytes */ +} isdn_dev; + +extern isdn_dev *dev; + +/* Utility-Macros */ +#define MIN(a,b) ((a<b)?a:b) +#define MAX(a,b) ((a>b)?a:b) + +#endif /* __KERNEL__ */ +#endif /* isdn_h */ diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h new file mode 100644 index 000000000..5ce86f868 --- /dev/null +++ b/include/linux/isdn_ppp.h @@ -0,0 +1,35 @@ +#ifndef _LINUX_ISDN_PPP_H +#define _LINUX_ISDN_PPP_H + +extern int isdn_ppp_dial_slave(char *); +extern int isdn_ppp_hangup_slave(char *); + +struct pppinfo +{ + int type; /* set by user */ + union { + char clid[32]; /* calling ID */ + int bundles; + int linknumber; + } info; +}; + + +#define PPPIOCLINKINFO _IOWR('t',128,struct pppinfo) +#define PPPIOCBUNDLE _IOW('t',129,int) +#define PPPIOCGMPFLAGS _IOR('t',130,int) +#define PPPIOCSMPFLAGS _IOW('t',131,int) +#define PPPIOCSMPMTU _IOW('t',132,int) +#define PPPIOCSMPMRU _IOW('t',133,int) + +#define PPP_MP 0x003d + +#define SC_MP_PROT 0x00000200 +#define SC_REJ_MP_PROT 0x00000400 +#define SC_OUT_SHORT_SEQ 0x00000800 +#define SC_IN_SHORT_SEQ 0x00004000 + +#define MP_END_FRAG 0x40 +#define MP_BEGIN_FRAG 0x80 + +#endif diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h new file mode 100644 index 000000000..113099edf --- /dev/null +++ b/include/linux/isdnif.h @@ -0,0 +1,307 @@ +/* $Id: isdnif.h,v 1.9 1996/06/06 21:24:24 fritz Exp $ + * + * Linux ISDN subsystem + * + * Definition of the interface between the subsystem and its low-level drivers. + * + * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de) + * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Log: isdnif.h,v $ + * Revision 1.9 1996/06/06 21:24:24 fritz + * Started adding support for suspend/resume. + * + * Revision 1.8 1996/05/18 01:45:37 fritz + * More spelling corrections. + * + * Revision 1.7 1996/05/18 01:37:19 fritz + * Added spelling corrections and some minor changes + * to stay in sync with kernel. + * + * Revision 1.6 1996/05/17 03:59:28 fritz + * Marked rcvcallb and writebuf obsolete. + * + * Revision 1.5 1996/05/01 11:43:54 fritz + * Removed STANDALONE + * + * Revision 1.4 1996/05/01 11:38:40 fritz + * Added ISDN_FEATURE_L2_TRANS + * + * Revision 1.3 1996/04/29 22:57:54 fritz + * Added driverId and channel parameters to + * writecmd() and readstat(). + * Added constant for voice-support. + * + * Revision 1.2 1996/04/20 17:02:40 fritz + * Changes to support skbuffs for Lowlevel-Drivers. + * Misc. typos + * + * Revision 1.1 1996/01/09 05:50:51 fritz + * Initial revision + * + */ + +#ifndef isdnif_h +#define isdnif_h + +/* + * Values for general protocol-selection + */ +#define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */ +#define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */ +#define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */ + +/* + * Values for Layer-2-protocol-selection + */ +#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */ +#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */ +#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */ +#define ISDN_PROTO_L2_HDLC 3 /* HDLC */ +#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */ + +/* + * Values for Layer-3-protocol-selection + */ +#define ISDN_PROTO_L3_TRANS 0 /* Transparent */ + +#ifdef __KERNEL__ + +#include <linux/skbuff.h> + +/* + * Commands from linklevel to lowlevel + * + */ +#define ISDN_CMD_IOCTL 0 /* Perform ioctl */ +#define ISDN_CMD_DIAL 1 /* Dial out */ +#define ISDN_CMD_ACCEPTD 2 /* Accept an incoming call on D-Chan. */ +#define ISDN_CMD_ACCEPTB 3 /* Request B-Channel connect. */ +#define ISDN_CMD_HANGUP 4 /* Hangup */ +#define ISDN_CMD_CLREAZ 5 /* Clear EAZ(s) of channel */ +#define ISDN_CMD_SETEAZ 6 /* Set EAZ(s) of channel */ +#define ISDN_CMD_GETEAZ 7 /* Get EAZ(s) of channel */ +#define ISDN_CMD_SETSIL 8 /* Set Service-Indicator-List of channel */ +#define ISDN_CMD_GETSIL 9 /* Get Service-Indicator-List of channel */ +#define ISDN_CMD_SETL2 10 /* Set B-Chan. Layer2-Parameter */ +#define ISDN_CMD_GETL2 11 /* Get B-Chan. Layer2-Parameter */ +#define ISDN_CMD_SETL3 12 /* Set B-Chan. Layer3-Parameter */ +#define ISDN_CMD_GETL3 13 /* Get B-Chan. Layer3-Parameter */ +#define ISDN_CMD_LOCK 14 /* Signal usage by upper levels */ +#define ISDN_CMD_UNLOCK 15 /* Release usage-lock */ +#define ISDN_CMD_SUSPEND 16 /* Suspend connection */ +#define ISDN_CMD_RESUME 17 /* Resume connection */ + +/* + * Status-Values delivered from lowlevel to linklevel via + * statcallb(). + * + */ +#define ISDN_STAT_STAVAIL 256 /* Raw status-data available */ +#define ISDN_STAT_ICALL 257 /* Incoming call detected */ +#define ISDN_STAT_RUN 258 /* Signal protocol-code is running */ +#define ISDN_STAT_STOP 259 /* Signal halt of protocol-code */ +#define ISDN_STAT_DCONN 260 /* Signal D-Channel connect */ +#define ISDN_STAT_BCONN 261 /* Signal B-Channel connect */ +#define ISDN_STAT_DHUP 262 /* Signal D-Channel disconnect */ +#define ISDN_STAT_BHUP 263 /* Signal B-Channel disconnect */ +#define ISDN_STAT_CINF 264 /* Charge-Info */ +#define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */ +#define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */ +#define ISDN_STAT_BSENT 267 /* Signal packet sent */ +#define ISDN_STAT_NODCH 268 /* Signal no D-Channel */ +#define ISDN_STAT_ADDCH 269 /* Add more Channels */ +#define ISDN_STAT_CAUSE 270 /* Cause-Message */ + +/* + * Values for feature-field of interface-struct. + */ +/* Layer 2 */ +#define ISDN_FEATURE_L2_X75I (0x0001 << ISDN_PROTO_L2_X75I) +#define ISDN_FEATURE_L2_X75UI (0x0001 << ISDN_PROTO_L2_X75UI) +#define ISDN_FEATURE_L2_X75BUI (0x0001 << ISDN_PROTO_L2_X75BUI) +#define ISDN_FEATURE_L2_HDLC (0x0001 << ISDN_PROTO_L2_HDLC) +#define ISDN_FEATURE_L2_TRANS (0x0001 << ISDN_PROTO_L2_TRANS) + +/* Layer 3 */ +#define ISDN_FEATURE_L3_TRANS (0x0100 << ISDN_PROTO_L3_TRANS) + +/* Signaling */ +#define ISDN_FEATURE_P_UNKNOWN (0x1000 << ISDN_PTYPE_UNKNOWN) +#define ISDN_FEATURE_P_1TR6 (0x1000 << ISDN_PTYPE_1TR6) +#define ISDN_FEATURE_P_EURO (0x1000 << ISDN_PTYPE_EURO) + +/* + * Structure for exchanging above infos + * + */ +typedef struct { + int driver; /* Lowlevel-Driver-ID */ + int command; /* Command or Status (see above) */ + ulong arg; /* Additional Data */ + char num[50]; /* Additional Data */ +} isdn_ctrl; + +/* + * The interface-struct itself (initialized at load-time of lowlevel-driver) + * + * See Documentation/isdn/INTERFACE for a description, how the communication + * between the ISDN subsystem and its drivers is done. + * + */ +typedef struct { + /* Number of channels supported by this driver + */ + int channels; + + /* + * Maximum Size of transmit/receive-buffer this driver supports. + */ + int maxbufsize; + + /* Feature-Flags for this driver. + * See defines ISDN_FEATURE_... for Values + */ + unsigned long features; + + /* + * Needed for calculating + * dev->hard_header_len = linklayer header + hl_hdrlen; + * Drivers, not supporting sk_buff's should set this to 0. + */ + unsigned short hl_hdrlen; + + /* Receive-Callback + * Parameters: + * int Driver-ID + * int local channel-number (0 ...) + * u_char pointer to received data (in Kernel-Space, volatile) + * int length of data + * + * NOTE: This callback is obsolete, and will be removed when all + * current LL-drivers support rcvcall_skb. Do NOT use for new + * drivers. + */ + void (*rcvcallb)(int, int, u_char*, int); + + /* + * Receive-Callback using sk_buff's + * Parameters: + * int Driver-ID + * int local channel-number (0 ...) + * struct sk_buff *skb received Data + */ + void (*rcvcallb_skb)(int, int, struct sk_buff *); + + /* Status-Callback + * Parameters: + * isdn_ctrl* + * driver = Driver ID. + * command = One of above ISDN_STAT_... constants. + * arg = depending on status-type. + * num = depending on status-type. + */ + int (*statcallb)(isdn_ctrl*); + /* Send command + * Parameters: + * isdn_ctrl* + * driver = Driver ID. + * command = One of above ISDN_CMD_... constants. + * arg = depending on command. + * num = depending on command. + */ + int (*command)(isdn_ctrl*); + /* Send Data + * Parameters: + * int driverId + * int local channel-number (0 ...) + * u_char pointer to data + * int length of data + * int Flag: 0 = Call form Kernel-Space (use memcpy, + * no schedule allowed) + * 1 = Data is in User-Space (use memcpy_fromfs, + * may schedule) + * + * NOTE: This call is obsolete, and will be removed when all + * current LL-drivers support writebuf_skb. Do NOT use for new + * drivers. + */ + int (*writebuf)(int, int, const u_char*, int, int); + + /* + * Send data using sk_buff's + * Parameters: + * int driverId + * int local channel-number (0...) + * struct sk_buff *skb Data to send + */ + int (*writebuf_skb) (int, int, struct sk_buff *); + + /* Send raw D-Channel-Commands + * Parameters: + * u_char pointer data + * int length of data + * int Flag: 0 = Call form Kernel-Space (use memcpy, + * no schedule allowed) + * 1 = Data is in User-Space (use memcpy_fromfs, + * may schedule) + * int driverId + * int local channel-number (0 ...) + */ + int (*writecmd)(const u_char*, int, int, int, int); + /* Read raw Status replies + * u_char pointer data (volatile) + * int length of buffer + * int Flag: 0 = Call form Kernel-Space (use memcpy, + * no schedule allowed) + * 1 = Data is in User-Space (use memcpy_fromfs, + * may schedule) + * int driverId + * int local channel-number (0 ...) + */ + int (*readstat)(u_char*, int, int, int, int); + char id[20]; +} isdn_if; + +/* + * Function which must be called by lowlevel-driver at loadtime with + * the following fields of above struct set: + * + * channels Number of channels that will be supported. + * hl_hdrlen Space to preserve in sk_buff's when sending. Drivers, not + * supporting sk_buff's should set this to 0. + * command Address of Command-Handler. + * features Bitwise coded Features of this driver. (use ISDN_FEATURE_...) + * writebuf Address of Send-Command-Handler. OBSOLETE do NOT use anymore. + * writebuf_skb Address of Skbuff-Send-Handler. (NULL if not supported) + * writecmd " " D-Channel " which accepts raw D-Ch-Commands. + * readstat " " D-Channel " which delivers raw Status-Data. + * + * The linklevel-driver fills the following fields: + * + * channels Driver-ID assigned to this driver. (Must be used on all + * subsequent callbacks. + * rcvcallb Address of handler for received data. OBSOLETE, do NOT use anymore. + * rcvcallb_skb Address of handler for received Skbuff's. (NULL if not supp.) + * statcallb " " " for status-changes. + * + */ +extern int register_isdn(isdn_if*); + +#endif /* __KERNEL__ */ +#endif /* isdnif_h */ + diff --git a/include/linux/iso_fs.h b/include/linux/iso_fs.h index 82a49a3c6..03239cfc3 100644 --- a/include/linux/iso_fs.h +++ b/include/linux/iso_fs.h @@ -122,21 +122,7 @@ struct iso_directory_record { #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) - -#if 0 -#ifdef ISOFS_FIXED_BLOCKSIZE -/* We use these until the buffer cache supports 2048 */ -#define ISOFS_BUFFER_BITS 10 -#define ISOFS_BUFFER_SIZE 1024 - -#define ISOFS_BLOCK_NUMBER(X) (X<<1) -#else -#define ISOFS_BUFFER_BITS 11 -#define ISOFS_BUFFER_SIZE 2048 - -#define ISOFS_BLOCK_NUMBER(X) (X) -#endif -#endif +#define ISOFS_ZONE_BITS(INODE) ((INODE)->i_sb->u.isofs_sb.s_log_zone_size) #define ISOFS_SUPER_MAGIC 0x9660 #define ISOFS_FILE_UNKNOWN 0 @@ -167,7 +153,7 @@ extern int find_rock_ridge_relocation(struct iso_directory_record *, struct inod extern int isofs_open(struct inode * inode, struct file * filp); extern void isofs_release(struct inode * inode, struct file * filp); extern int isofs_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); + struct inode ** result); extern unsigned long isofs_count_free_inodes(struct super_block *sb); extern int isofs_new_block(int dev); extern int isofs_free_block(int dev, int block); @@ -175,6 +161,7 @@ extern int isofs_bmap(struct inode *,int); extern void isofs_put_super(struct super_block *); extern struct super_block *isofs_read_super(struct super_block *,void *,int); +extern int init_iso9660_fs(void); extern void isofs_read_inode(struct inode *); extern void isofs_put_inode(struct inode *); extern void isofs_statfs(struct super_block *, struct statfs *, int); diff --git a/include/linux/iso_fs_sb.h b/include/linux/iso_fs_sb.h index 14f929921..25ebdb8ab 100644 --- a/include/linux/iso_fs_sb.h +++ b/include/linux/iso_fs_sb.h @@ -2,7 +2,7 @@ #define _ISOFS_FS_SB /* - * minix super-block data in memory + * iso9660 super-block data in memory */ struct isofs_sb_info { unsigned long s_ninodes; @@ -15,6 +15,7 @@ struct isofs_sb_info { unsigned char s_mapping; unsigned char s_conversion; unsigned char s_rock; + unsigned char s_name_check; /* r = relaxed, s = strict */ unsigned char s_cruft; /* Broken disks with high byte of length containing junk */ diff --git a/include/linux/isp16.h b/include/linux/isp16.h new file mode 100644 index 000000000..9945bb34c --- /dev/null +++ b/include/linux/isp16.h @@ -0,0 +1,75 @@ +/* -- isp16.h + * + * Header for detection and initialisation of cdrom interface (only) on + * ISP16 (MAD16, Mozart) sound card. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* These are the default values */ +#define ISP16_CDROM_TYPE "Sanyo" +#define ISP16_CDROM_IO_BASE 0x340 +#define ISP16_CDROM_IRQ 0 +#define ISP16_CDROM_DMA 0 + +/* Some (Media)Magic */ +/* define types of drive the interface on an ISP16 card may be looking at */ +#define ISP16_DRIVE_X 0x00 +#define ISP16_SONY 0x02 +#define ISP16_PANASONIC0 0x02 +#define ISP16_SANYO0 0x02 +#define ISP16_MITSUMI 0x04 +#define ISP16_PANASONIC1 0x06 +#define ISP16_SANYO1 0x06 +#define ISP16_DRIVE_NOT_USED 0x08 /* not used */ +#define ISP16_DRIVE_SET_MASK 0xF1 /* don't change 0-bit or 4-7-bits*/ +/* ...for port */ +#define ISP16_DRIVE_SET_PORT 0xF8D +/* set io parameters */ +#define ISP16_BASE_340 0x00 +#define ISP16_BASE_330 0x40 +#define ISP16_BASE_360 0x80 +#define ISP16_BASE_320 0xC0 +#define ISP16_IRQ_X 0x00 +#define ISP16_IRQ_5 0x04 /* shouldn't be used to avoid sound card conflicts */ +#define ISP16_IRQ_7 0x08 /* shouldn't be used to avoid sound card conflicts */ +#define ISP16_IRQ_3 0x0C +#define ISP16_IRQ_9 0x10 +#define ISP16_IRQ_10 0x14 +#define ISP16_IRQ_11 0x18 +#define ISP16_DMA_X 0x03 +#define ISP16_DMA_3 0x00 +#define ISP16_DMA_5 0x00 +#define ISP16_DMA_6 0x01 +#define ISP16_DMA_7 0x02 +#define ISP16_IO_SET_MASK 0x20 /* don't change 5-bit */ +/* ...for port */ +#define ISP16_IO_SET_PORT 0xF8E +/* enable the card */ +#define ISP16_C928__ENABLE_PORT 0xF90 /* ISP16 with OPTi 82C928 chip */ +#define ISP16_C929__ENABLE_PORT 0xF91 /* ISP16 with OPTi 82C929 chip */ +#define ISP16_ENABLE_CDROM 0x80 /* seven bit */ + +/* the magic stuff */ +#define ISP16_CTRL_PORT 0xF8F +#define ISP16_C928__CTRL 0xE2 /* ISP16 with OPTi 82C928 chip */ +#define ISP16_C929__CTRL 0xE3 /* ISP16 with OPTi 82C929 chip */ + +#define ISP16_IO_BASE 0xF8D +#define ISP16_IO_SIZE 5 /* ports used from 0xF8D up to 0xF91 */ + +void isp16_setup(char *str, int *ints); +int isp16_init(void); diff --git a/include/linux/istallion.h b/include/linux/istallion.h new file mode 100644 index 000000000..1cf916ad4 --- /dev/null +++ b/include/linux/istallion.h @@ -0,0 +1,132 @@ +/*****************************************************************************/ + +/* + * istallion.h -- stallion intelligent multiport serial driver. + * + * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _ISTALLION_H +#define _ISTALLION_H +/*****************************************************************************/ + +/* + * Define important driver constants here. + */ +#define STL_MAXBRDS 4 +#define STL_MAXPANELS 4 +#define STL_MAXPORTS 64 +#define STL_MAXCHANS (STL_MAXPORTS + 1) +#define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) + + +/* + * Define a set of structures to hold all the board/panel/port info + * for our ports. These will be dynamically allocated as required at + * driver initialization time. + */ + +/* + * Port and board structures to hold status info about each object. + * The board structure contains pointers to structures for each port + * connected to it. Panels are not distinguished here, since + * communication with the slave board will always be on a per port + * basis. + */ +typedef struct { + unsigned long magic; + int portnr; + int panelnr; + int brdnr; + unsigned long state; + int devnr; + int flags; + int baud_base; + int custom_divisor; + int close_delay; + int closing_wait; + int refcount; + int openwaitcnt; + int rc; + int argsize; + void *argp; + long session; + long pgrp; + unsigned int rxmarkmsk; + struct tty_struct *tty; + struct wait_queue *open_wait; + struct wait_queue *close_wait; + struct wait_queue *raw_wait; + struct tq_struct tqhangup; + struct termios normaltermios; + struct termios callouttermios; + asysigs_t asig; + unsigned long addr; + unsigned long rxoffset; + unsigned long txoffset; + unsigned long sigs; + unsigned long pflag; + unsigned int rxsize; + unsigned int txsize; + unsigned char reqbit; + unsigned char portidx; + unsigned char portbit; +} stliport_t; + +/* + * Use a structure of function pointers to do board level operations. + * These include, enable/disable, paging shared memory, interrupting, etc. + */ +typedef struct stlibrd { + unsigned long magic; + int brdnr; + int brdtype; + int state; + int nrpanels; + int nrports; + int nrdevs; + unsigned int iobase; + unsigned long memaddr; + void *membase; + int memsize; + int pagesize; + int hostoffset; + int slaveoffset; + int bitsize; + int enabval; + int panels[STL_MAXPANELS]; + int panelids[STL_MAXPANELS]; + void (*init)(struct stlibrd *brdp); + void (*enable)(struct stlibrd *brdp); + void (*reenable)(struct stlibrd *brdp); + void (*disable)(struct stlibrd *brdp); + char *(*getmemptr)(struct stlibrd *brdp, unsigned long offset, int line); + void (*intr)(struct stlibrd *brdp); + void (*reset)(struct stlibrd *brdp); + stliport_t *ports[STL_MAXPORTS]; +} stlibrd_t; + + +/* + * Define MAGIC numbers used for above structures. + */ +#define STLI_PORTMAGIC 0xe671c7a1 +#define STLI_BOARDMAGIC 0x4bc6c825 + +/*****************************************************************************/ +#endif diff --git a/include/linux/kbdcntrlr.h b/include/linux/kbdcntrlr.h new file mode 100644 index 000000000..520e73892 --- /dev/null +++ b/include/linux/kbdcntrlr.h @@ -0,0 +1,67 @@ +/* + * Keyboard controller definitions. + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __LINUX_KBDCTRLR_H +#define __LINUX_KBDCTRLR_H + +/* + * keyboard controller registers + */ +#define KBD_STATUS_REG (unsigned int) 0x64 +#define KBD_CNTL_REG (unsigned int) 0x64 +#define KBD_DATA_REG (unsigned int) 0x60 +/* + * controller commands + */ +#define KBD_READ_MODE (unsigned int) 0x20 +#define KBD_WRITE_MODE (unsigned int) 0x60 +#define KBD_SELF_TEST (unsigned int) 0xAA +#define KBD_SELF_TEST2 (unsigned int) 0xAB +#define KBD_CNTL_ENABLE (unsigned int) 0xAE +/* + * keyboard commands + */ +#define KBD_ENABLE (unsigned int) 0xF4 +#define KBD_DISABLE (unsigned int) 0xF5 +#define KBD_RESET (unsigned int) 0xFF +/* + * keyboard replies + */ +#define KBD_ACK (unsigned int) 0xFA +#define KBD_POR (unsigned int) 0xAA +/* + * status register bits + */ +#define KBD_OBF (unsigned int) 0x01 +#define KBD_IBF (unsigned int) 0x02 +#define KBD_GTO (unsigned int) 0x40 +#define KBD_PERR (unsigned int) 0x80 +/* + * keyboard controller mode register bits + */ +#define KBD_EKI (unsigned int) 0x01 +#define KBD_SYS (unsigned int) 0x04 +#define KBD_DMS (unsigned int) 0x20 +#define KBD_KCC (unsigned int) 0x40 + +/* + * Had to increase this value - the speed ratio host cpu/keyboard + * processor on some MIPS machines make the controller initialization + * fail otherwise. -- Ralf + */ +#define TIMEOUT_CONST 1000000 + +/* + * These will be the new keyboard controller access macros. I don't use + * them yet since I want to talk about some details with Linus first. + */ +#define kbd_read_control() kbd_inb_p(0x64) +#define kbd_read_status() kbd_inb_p(0x64) +#define kbd_read_data() kbd_inb_p(0x60) +#define kbd_write_data() kbd_inb_p(0x60) + +#endif /* __LINUX_KBDCTRLR_H */ diff --git a/include/linux/kd.h b/include/linux/kd.h index 8ba56a1f9..0f669cbe6 100644 --- a/include/linux/kd.h +++ b/include/linux/kd.h @@ -7,6 +7,19 @@ #define GIO_FONT 0x4B60 /* gets font in expanded form */ #define PIO_FONT 0x4B61 /* use font in expanded form */ +#define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ +#define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ +struct consolefontdesc { + unsigned short charcount; /* characters in font (256 or 512) */ + unsigned short charheight; /* scan lines per character (1-32) */ + char *chardata; /* font data in expanded form */ +}; + +#define PIO_FONTRESET 0x4B6D /* reset to default font */ + +#define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ +#define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ + #define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ #define KDMKTONE 0x4B30 /* generate tone */ @@ -40,24 +53,29 @@ typedef char scrnmap_t; #define E_TABSZ 256 #define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ #define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ +#define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ +#define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ #define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ struct unipair { - u_short unicode; - u_short fontpos; + unsigned short unicode; + unsigned short fontpos; }; struct unimapdesc { - u_short entry_ct; + unsigned short entry_ct; struct unipair *entries; }; #define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ #define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ struct unimapinit { - u_short advised_hashsize; /* 0 if no opinion */ - u_short advised_hashstep; /* 0 if no opinion */ - u_short advised_hashlevel; /* 0 if no opinion */ + unsigned short advised_hashsize; /* 0 if no opinion */ + unsigned short advised_hashstep; /* 0 if no opinion */ + unsigned short advised_hashlevel; /* 0 if no opinion */ }; +#define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */ +#define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */ + #define K_RAW 0x00 #define K_XLATE 0x01 #define K_MEDIUMRAW 0x02 @@ -77,9 +95,9 @@ struct unimapinit { #define KDSKBLED 0x4B65 /* set led flags (not lights) */ struct kbentry { - u_char kb_table; - u_char kb_index; - u_short kb_value; + unsigned char kb_table; + unsigned char kb_index; + unsigned short kb_value; }; #define K_NORMTAB 0x00 #define K_SHIFTTAB 0x01 @@ -90,14 +108,14 @@ struct kbentry { #define KDSKBENT 0x4B47 /* sets one entry in translation table */ struct kbsentry { - u_char kb_func; - u_char kb_string[512]; + unsigned char kb_func; + unsigned char kb_string[512]; }; #define KDGKBSENT 0x4B48 /* gets one function key string entry */ #define KDSKBSENT 0x4B49 /* sets one function key string entry */ struct kbdiacr { - u_char diacr, base, result; + unsigned char diacr, base, result; }; struct kbdiacrs { unsigned int kb_cnt; /* number of entries in following array */ @@ -116,6 +134,6 @@ struct kbkeycode { /* note: 0x4B00-0x4B4E all have had a value at some time; don't reuse for the time being */ -/* note: 0x4B60-0x4B68 used above */ +/* note: 0x4B60-0x4B6D, 0x4B70, 0x4B71 used above */ #endif /* _LINUX_KD_H */ diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h new file mode 100644 index 000000000..a06cdb9ed --- /dev/null +++ b/include/linux/kdev_t.h @@ -0,0 +1,114 @@ +#ifndef _LINUX_KDEV_T_H +#define _LINUX_KDEV_T_H +#ifdef __KERNEL__ +/* +As a preparation for the introduction of larger device numbers, +we introduce a type kdev_t to hold them. No information about +this type is known outside of this include file. + +Objects of type kdev_t designate a device. Outside of the kernel +the corresponding things are objects of type dev_t - usually an +integral type with the device major and minor in the high and low +bits, respectively. Conversion is done by + +extern kdev_t to_kdev_t(int); + +It is up to the various file systems to decide how objects of type +dev_t are stored on disk. +The only other point of contact between kernel and outside world +are the system calls stat and mknod, new versions of which will +eventually have to be used in libc. + +[Unfortunately, the floppy control ioctls fail to hide the internal +kernel structures, and the fd_device field of a struct floppy_drive_struct +is user-visible. So, it remains a dev_t for the moment, with some ugly +conversions in floppy.c.] + +Inside the kernel, we aim for a kdev_t type that is a pointer +to a structure with information about the device (like major, +minor, size, blocksize, sectorsize, name, read-only flag, +struct file_operations etc.). + +However, for the time being we let kdev_t be almost the same as dev_t: + +typedef struct { unsigned short major, minor; } kdev_t; + +Admissible operations on an object of type kdev_t: +- passing it along +- comparing it for equality with another such object +- storing it in ROOT_DEV, inode->i_dev, inode->i_rdev, sb->s_dev, + bh->b_dev, req->rq_dev, de->dc_dev, tty->device +- using its bit pattern as argument in a hash function +- finding its major and minor +- complaining about it + +An object of type kdev_t is created only by the function MKDEV(), +with the single exception of the constant 0 (no device). + +Right now the other information mentioned above is usually found +in static arrays indexed by major or major,minor. + +An obstacle to immediately using + typedef struct { ... (* lots of information *) } *kdev_t +is the case of mknod used to create a block device that the +kernel doesn't know about at present (but first learns about +when some module is inserted). + +aeb - 950811 +*/ + +/* Since MINOR(dev) is used as index in static arrays, + the kernel is not quite ready yet for larger minors. + However, everything runs fine with an arbitrary kdev_t type. */ + +#define MINORBITS 8 +#define MINORMASK ((1U << MINORBITS) - 1) + +typedef unsigned short kdev_t; + +#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) +#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) +#define HASHDEV(dev) ((unsigned int) (dev)) +#define NODEV 0 +#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) +#define B_FREE 0xffff /* yuk */ + +extern char * kdevname(kdev_t); /* note: returns pointer to static data! */ + +/* +As long as device numbers in the outside world have 16 bits only, +we use these conversions. +*/ + +static inline unsigned int kdev_t_to_nr(kdev_t dev) { + return (MAJOR(dev)<<8) | MINOR(dev); +} + +static inline kdev_t to_kdev_t(int dev) +{ + int major, minor; +#if 0 + major = (dev >> 16); + if (!major) { + major = (dev >> 8); + minor = (dev & 0xff); + } else + minor = (dev & 0xffff); +#else + major = (dev >> 8); + minor = (dev & 0xff); +#endif + return MKDEV(major, minor); +} + +#else /* __KERNEL__ */ + +/* +Some programs want their definitions of MAJOR and MINOR and MKDEV +from the kernel sources. These must be the externally visible ones. +*/ +#define MAJOR(dev) ((dev)>>8) +#define MINOR(dev) ((dev) & 0xff) +#define MKDEV(ma,mi) ((ma)<<8 | (mi)) +#endif /* __KERNEL__ */ +#endif diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 26dd68ef4..51b319891 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -10,6 +10,9 @@ #include <stdarg.h> #include <linux/linkage.h> +/* Optimization barrier */ +#define barrier() __asm__("": : :"memory") + #define INT_MAX ((int)(~0U>>1)) #define UINT_MAX (~0U) #define LONG_MAX ((long)(~0UL>>1)) @@ -26,15 +29,9 @@ #define KERN_INFO "<6>" /* informational */ #define KERN_DEBUG "<7>" /* debug-level messages */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) -# define NORET_TYPE __volatile__ -# define ATTRIB_NORET /**/ -# define NORET_AND /**/ -#else # define NORET_TYPE /**/ # define ATTRIB_NORET __attribute__((noreturn)) # define NORET_AND noreturn, -#endif extern void math_error(void); NORET_TYPE void panic(const char * fmt, ...) @@ -54,17 +51,21 @@ extern int kill_sl(int sess, int sig, int priv); asmlinkage int printk(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))); +#if DEBUG +#define pr_debug(fmt,arg...) \ + printk(KERN_DEBUG fmt,##arg) +#else +#define pr_debug(fmt,arg...) \ + do { } while (0) +#endif + +#define pr_info(fmt,arg...) \ + printk(KERN_INFO fmt,##arg) + /* - * This is defined as a macro, but at some point this might become a - * real subroutine that sets a flag if it returns true (to do - * BSD-style accounting where the process is flagged if it uses root - * privs). The implication of this is that you should do normal - * permissions checks first, and check suser() last. - * * "suser()" checks against the effective user id, while "fsuser()" * is used for file permission checking and checks against the fsuid.. */ -#define suser() (current->euid == 0) #define fsuser() (current->fsuid == 0) #endif /* __KERNEL__ */ diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 4d3f3e941..1966490a7 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -1,6 +1,8 @@ #ifndef _LINUX_KERNEL_STAT_H #define _LINUX_KERNEL_STAT_H +#include <asm/irq.h> + /* * 'kernel_stat.h' contains the definitions needed for doing * some kernel statistics (cpu usage, context switches ...), @@ -12,9 +14,13 @@ struct kernel_stat { unsigned int cpu_user, cpu_nice, cpu_system; unsigned int dk_drive[DK_NDRIVE]; + unsigned int dk_drive_rio[DK_NDRIVE]; + unsigned int dk_drive_wio[DK_NDRIVE]; + unsigned int dk_drive_rblk[DK_NDRIVE]; + unsigned int dk_drive_wblk[DK_NDRIVE]; unsigned int pgpgin, pgpgout; unsigned int pswpin, pswpout; - unsigned int interrupts[16]; + unsigned int interrupts[NR_IRQS]; unsigned int ipackets, opackets; unsigned int ierrors, oerrors; unsigned int collisions; diff --git a/include/linux/kerneld.h b/include/linux/kerneld.h new file mode 100644 index 000000000..5418b60d5 --- /dev/null +++ b/include/linux/kerneld.h @@ -0,0 +1,131 @@ +#ifndef _LINUX_KERNELD_H +#define _LINUX_KERNELD_H + +#define KERNELD_SYSTEM 1 +#define KERNELD_REQUEST_MODULE 2 /* "insmod" */ +#define KERNELD_RELEASE_MODULE 3 /* "rmmod" */ +#define KERNELD_DELAYED_RELEASE_MODULE 4 /* "rmmod" */ +#define KERNELD_CANCEL_RELEASE_MODULE 5 /* "rmmod" */ +#define KERNELD_REQUEST_ROUTE 6 /* from net/ipv4/route.c */ +#define KERNELD_BLANKER 7 /* from drivers/char/console.c */ +#define KERNELD_ARP 256 /* from net/ipv4/arp.c */ + +/* + * Uncomment the following line for the new kerneld protocol + * This includes the pid of the kernel level requester into the kerneld header + */ +/* +#define NEW_KERNELD_PROTOCOL + */ +#ifdef NEW_KERNELD_PROTOCOL +#define OLDIPC_KERNELD 00040000 /* use the kerneld message channel */ +#define IPC_KERNELD 00140000 /* use the kerneld message channel, new protocol */ +#define KDHDR (sizeof(long) + sizeof(short) + sizeof(short)) +#define NULL_KDHDR 0, 2, 0 +#else +#define IPC_KERNELD 00040000 /* use the kerneld message channel */ +#define KDHDR (sizeof(long)) +#define NULL_KDHDR 0 +#endif +#define KERNELD_MAXCMD 0x7ffeffff +#define KERNELD_MINSEQ 0x7fff0000 /* "commands" legal up to 0x7ffeffff */ +#define KERNELD_WAIT 0x80000000 +#define KERNELD_NOWAIT 0 + +struct kerneld_msg { + long mtype; + long id; +#ifdef NEW_KERNELD_PROTOCOL + short version; + short pid; +#endif +#ifdef __KERNEL__ + char *text; +#else + char text[1]; +#endif /* __KERNEL__ */ +}; + +#ifdef __KERNEL__ +extern int kerneld_send(int msgtype, int ret_size, int msgsz, + const char *text, const char *ret_val); + +/* + * Request that a module should be loaded. + * Wait for the exit status from insmod/modprobe. + * If it fails, it fails... at least we tried... + */ +static inline int request_module(const char *name) +{ + return kerneld_send(KERNELD_REQUEST_MODULE, + 0 | KERNELD_WAIT, + strlen(name), name, NULL); +} + +/* + * Request the removal of a module, maybe don't wait for it. + * It doesn't matter if the removal fails, now does it? + */ +static inline int release_module(const char *name, int waitflag) +{ + return kerneld_send(KERNELD_RELEASE_MODULE, + 0 | (waitflag?KERNELD_WAIT:KERNELD_NOWAIT), + strlen(name), name, NULL); +} + +/* + * Request a delayed removal of a module, but don't wait for it. + * The delay is done by kerneld (default: 60 seconds) + */ +static inline int delayed_release_module(const char *name) +{ + return kerneld_send(KERNELD_DELAYED_RELEASE_MODULE, + 0 | KERNELD_NOWAIT, + strlen(name), name, NULL); +} + +/* + * Attempt to cancel a previous request for removal of a module, + * but don't wait for it. + * This call can be made if the kernel wants to prevent a delayed + * unloading of a module. + */ +static inline int cancel_release_module(const char *name) +{ + return kerneld_send(KERNELD_CANCEL_RELEASE_MODULE, + 0 | KERNELD_NOWAIT, + strlen(name), name, NULL); +} + +/* + * Perform an "inverted" system call, maybe return the exit status + */ +static inline int ksystem(const char *cmd, int waitflag) +{ + return kerneld_send(KERNELD_SYSTEM, + 0 | (waitflag?KERNELD_WAIT:KERNELD_NOWAIT), + strlen(cmd), cmd, NULL); +} + +/* + * Try to create a route, possibly by opening a ppp-connection + */ +static inline int kerneld_route(const char *ip_route) +{ + return kerneld_send(KERNELD_REQUEST_ROUTE, + 0 | KERNELD_WAIT, + strlen(ip_route), ip_route, NULL); +} + +/* + * Handle an external screen blanker + */ +static inline int kerneld_blanker(int on_off) /* 0 => "off", else "on" */ +{ + return kerneld_send(KERNELD_BLANKER, + 0 | (on_off?KERNELD_NOWAIT:KERNELD_WAIT), + strlen(on_off?"on":"off"), on_off?"on":"off", NULL); +} + +#endif /* __KERNEL__ */ +#endif diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h index d9f671f98..57a5323e1 100644 --- a/include/linux/keyboard.h +++ b/include/linux/keyboard.h @@ -38,6 +38,7 @@ extern unsigned short plain_map[NR_KEYS]; #define KT_META 8 #define KT_ASCII 9 #define KT_LOCK 10 +#define KT_SLOCK 12 #define K(t,v) (((t)<<8)|(v)) #define KTYP(x) ((x) >> 8) @@ -351,8 +352,9 @@ extern unsigned short plain_map[NR_KEYS]; #define K_DCIRCM K(KT_DEAD,2) #define K_DTILDE K(KT_DEAD,3) #define K_DDIERE K(KT_DEAD,4) +#define K_DCEDIL K(KT_DEAD,5) -#define NR_DEAD 5 +#define NR_DEAD 6 #define K_DOWN K(KT_CUR,0) #define K_LEFT K(KT_CUR,1) @@ -407,6 +409,15 @@ extern unsigned short plain_map[NR_KEYS]; #define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) #define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) +#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) +#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) +#define K_ALT_SLOCK K(KT_SLOCK,KG_ALT) +#define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR) +#define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL) +#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) +#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) +#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) + #define NR_LOCK 8 #define MAX_DIACR 256 diff --git a/include/linux/ldt.h b/include/linux/ldt.h deleted file mode 100644 index 83add4248..000000000 --- a/include/linux/ldt.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ldt.h - * - * Definitions of structures used with the modify_ldt system call. - */ -#ifndef _LINUX_LDT_H -#define _LINUX_LDT_H - -/* Maximum number of LDT entries supported. */ -#define LDT_ENTRIES 8192 -/* The size of each LDT entry. */ -#define LDT_ENTRY_SIZE 8 - -struct modify_ldt_ldt_s { - unsigned int entry_number; - unsigned long base_addr; - unsigned int limit; - unsigned int seg_32bit:1; - unsigned int contents:2; - unsigned int read_exec_only:1; - unsigned int limit_in_pages:1; - unsigned int seg_not_present:1; -}; - -#define MODIFY_LDT_CONTENTS_DATA 0 -#define MODIFY_LDT_CONTENTS_STACK 1 -#define MODIFY_LDT_CONTENTS_CODE 2 - -extern int get_ldt(void *buffer); -extern int set_ldt_entry(int entry, unsigned long base, unsigned int limit, - int seg_32bit_flag, int contents, int read_only_flag, - int limit_in_pages_flag); - -#endif diff --git a/include/linux/limits.h b/include/linux/limits.h index d0f300c4f..14428592c 100644 --- a/include/linux/limits.h +++ b/include/linux/limits.h @@ -11,7 +11,7 @@ #define MAX_CANON 255 /* size of the canonical input queue */ #define MAX_INPUT 255 /* size of the type-ahead buffer */ #define NAME_MAX 255 /* # chars in a file name */ -#define PATH_MAX 1024 /* # chars in a path name */ +#define PATH_MAX 4095 /* # chars in a path name */ #define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ #endif diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 8f5c4d5f2..c8a7a491a 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -7,4 +7,53 @@ #define asmlinkage #endif +#ifdef __ELF__ +#define SYMBOL_NAME_STR(X) #X +#define SYMBOL_NAME(X) X +#ifdef __STDC__ +#define SYMBOL_NAME_LABEL(X) X##: +#else +#define SYMBOL_NAME_LABEL(X) X/**/: +#endif +#else +#define SYMBOL_NAME_STR(X) "_"#X +#ifdef __STDC__ +#define SYMBOL_NAME(X) _##X +#define SYMBOL_NAME_LABEL(X) _##X##: +#else +#define SYMBOL_NAME(X) _/**/X +#define SYMBOL_NAME_LABEL(X) _/**/X/**/: +#endif +#endif + +#if !defined(__i486__) && !defined(__i586__) +#ifdef __ELF__ +#define __ALIGN .align 4,0x90 +#define __ALIGN_STR ".align 4,0x90" +#else /* __ELF__ */ +#define __ALIGN .align 2,0x90 +#define __ALIGN_STR ".align 2,0x90" +#endif /* __ELF__ */ +#else /* __i486__/__i586__ */ +#ifdef __ELF__ +#define __ALIGN .align 16,0x90 +#define __ALIGN_STR ".align 16,0x90" +#else /* __ELF__ */ +#define __ALIGN .align 4,0x90 +#define __ALIGN_STR ".align 4,0x90" +#endif /* __ELF__ */ +#endif /* __i486__/__i586__ */ + +#ifdef __ASSEMBLY__ + +#define ALIGN __ALIGN +#define ALIGN_STRING __ALIGN_STRING + +#define ENTRY(name) \ + .globl SYMBOL_NAME(name); \ + ALIGN; \ + SYMBOL_NAME_LABEL(name) + +#endif + #endif diff --git a/include/linux/lists.h b/include/linux/lists.h new file mode 100644 index 000000000..04f905aaf --- /dev/null +++ b/include/linux/lists.h @@ -0,0 +1,40 @@ +/* + * lists.h: Simple list macros for Linux + */ + +#define DLNODE(ptype) \ + struct { \ + ptype * dl_prev; \ + ptype * dl_next; \ + } + +#define DNODE_SINGLE(node) {(node),(node)} +#define DNODE_NULL {0,0} + +#define DLIST_INIT(listnam) \ + (listnam).dl_prev = &(listnam); \ + (listnam).dl_last = &(listnam); + +#define DLIST_NEXT(listnam) listnam.dl_next +#define DLIST_PREV(listnam) listnam.dl_prev + +#define DLIST_INSERT_AFTER(node, new, listnam) do { \ + (new)->listnam.dl_prev = (node); \ + (new)->listnam.dl_next = (node)->listnam.dl_next; \ + (node)->listnam.dl_next->listnam.dl_prev = (new); \ + (node)->listnam.dl_next = (new); \ + } while (0) + +#define DLIST_INSERT_BEFORE(node, new, listnam) do { \ + (new)->listnam.dl_next = (node); \ + (new)->listnam.dl_prev = (node)->listnam.dl_prev; \ + (node)->listnam.dl_prev->listnam.dl_next = (new); \ + (node)->listnam.dl_prev = (new); \ + } while (0) + +#define DLIST_DELETE(node, listnam) do { \ + node->listnam.dl_prev->listnam.dl_next = \ + node->listnam.dl_next; \ + node->listnam.dl_next->listnam.dl_prev = \ + node->listnam.dl_prev; \ + } while (0) diff --git a/include/linux/locks.h b/include/linux/locks.h index ac9b29076..9735bc630 100644 --- a/include/linux/locks.h +++ b/include/linux/locks.h @@ -1,6 +1,19 @@ #ifndef _LINUX_LOCKS_H #define _LINUX_LOCKS_H +#ifndef _LINUX_MM_H +#include <linux/mm.h> +#endif +#ifndef _LINUX_PAGEMAP_H +#include <linux/pagemap.h> +#endif + +/* + * Unlocked, temporary IO buffer_heads gets moved to the reuse_list + * once their page becomes unlocked. + */ +extern struct buffer_head *reuse_list; + /* * Buffer cache locking - note that interrupts may only unlock, not * lock buffers. @@ -9,22 +22,18 @@ extern void __wait_on_buffer(struct buffer_head *); extern inline void wait_on_buffer(struct buffer_head * bh) { - if (bh->b_lock) + if (test_bit(BH_Lock, &bh->b_state)) __wait_on_buffer(bh); } extern inline void lock_buffer(struct buffer_head * bh) { - if (bh->b_lock) + while (set_bit(BH_Lock, &bh->b_state)) __wait_on_buffer(bh); - bh->b_lock = 1; } -extern inline void unlock_buffer(struct buffer_head * bh) -{ - bh->b_lock = 0; - wake_up(&bh->b_wait); -} +void unlock_buffer(struct buffer_head *); + /* * super-block locking. Again, interrupts may only unlock diff --git a/include/linux/loop.h b/include/linux/loop.h new file mode 100644 index 000000000..be2c1753b --- /dev/null +++ b/include/linux/loop.h @@ -0,0 +1,86 @@ +#ifndef _LINUX_LOOP_H +#define _LINUX_LOOP_H + +/* + * include/linux/loop.h + * + * Written by Theodore Ts'o, 3/29/93. + * + * Copyright 1993 by Theodore Ts'o. Redistribution of this file is + * permitted under the GNU Public License. + */ + +#define LO_NAME_SIZE 64 +#define LO_KEY_SIZE 32 + +#ifdef __KERNEL__ + +struct loop_device { + int lo_number; + struct inode *lo_inode; + int lo_refcnt; + kdev_t lo_device; + int lo_offset; + int lo_encrypt_type; + int lo_encrypt_key_size; + int lo_flags; + int (*transfer)(struct loop_device *, int cmd, + char *raw_buf, char *loop_buf, int size); + char lo_name[LO_NAME_SIZE]; + char lo_encrypt_key[LO_KEY_SIZE]; +#ifdef DES_AVAILABLE + des_key_schedule lo_des_key; + unsigned long lo_des_init[2]; +#endif +#ifdef IDEA_AVAILABLE + idea_key lo_idea_en_key; + idea_key lo_idea_de_key; +#endif +}; + +typedef int (* transfer_proc_t)(struct loop_device *, int cmd, + char *raw_buf, char *loop_buf, int size); + +/* + * Loop flags + */ +#define LO_FLAGS_DO_BMAP 0x00000001 +#define LO_FLAGS_READ_ONLY 0x00000002 + +#endif /* __KERNEL__ */ + +struct loop_info { + int lo_number; /* ioctl r/o */ + dev_t lo_device; /* ioctl r/o */ + unsigned long lo_inode; /* ioctl r/o */ + dev_t lo_rdevice; /* ioctl r/o */ + int lo_offset; + int lo_encrypt_type; + int lo_encrypt_key_size; /* ioctl w/o */ + int lo_flags; /* ioctl r/o */ + char lo_name[LO_NAME_SIZE]; + unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */ + unsigned long lo_init[2]; + char reserved[4]; +}; + +/* + * Loop encryption types --- LO_CRYPT_IDEA isn't supported yet + */ + +#define LO_CRYPT_NONE 0 +#define LO_CRYPT_XOR 1 +#define LO_CRYPT_DES 2 +#define LO_CRYPT_IDEA 3 +#define MAX_LO_CRYPT 4 + +/* + * IOCTL commands --- we will commandeer 0x4C ('L') + */ + +#define LOOP_SET_FD 0x4C00 +#define LOOP_CLR_FD 0x4C01 +#define LOOP_SET_STATUS 0x4C02 +#define LOOP_GET_STATUS 0x4C03 + +#endif diff --git a/include/linux/lp.h b/include/linux/lp.h index 1d3caa28f..6d488f64a 100644 --- a/include/linux/lp.h +++ b/include/linux/lp.h @@ -68,6 +68,8 @@ FALSE to ignore error. Default is ignore. */ #define LPGETSTATUS 0x060b /* return LP_S(minor) */ #define LPRESET 0x060c /* reset printer */ +#define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ +#define LPGETFLAGS 0x060e /* get status flags */ /* timeout for printk'ing a timeout, in jiffies (100ths of a second). This is also used for re-checking error conditions if LP_ABORT is @@ -85,9 +87,19 @@ #define LP_WAIT(minor) lp_table[(minor)].wait /* strobe wait */ #define LP_IRQ(minor) lp_table[(minor)].irq /* interrupt # */ /* 0 means polled */ +#define LP_STAT(minor) lp_table[(minor)].stats /* statistics area */ #define LP_BUFFER_SIZE 256 +struct lp_stats { + unsigned long chars; + unsigned long sleeps; + unsigned int maxrun; + unsigned int maxwait; + unsigned int meanwait; + unsigned int mdev; +}; + struct lp_struct { unsigned int base; unsigned int irq; @@ -97,6 +109,10 @@ struct lp_struct { unsigned int wait; struct wait_queue *lp_wait_q; char *lp_buffer; + unsigned int lastcall; + unsigned int runchars; + unsigned int waittime; + struct lp_stats stats; }; /* @@ -123,11 +139,11 @@ struct lp_struct { * base + 2 * accessed with LP_C(minor) */ -#define LP_PINTEN 0x10 +#define LP_PINTEN 0x10 /* high to read data in or-ed with data out */ #define LP_PSELECP 0x08 /* inverted output, active low */ #define LP_PINITP 0x04 /* unchanged output, active low */ #define LP_PAUTOLF 0x02 /* inverted output, active low */ -#define LP_PSTROBE 0x01 /* inverted output, active low */ +#define LP_PSTROBE 0x01 /* short high output on raising edge */ /* * the value written to ports to test existence. PC-style ports will @@ -137,15 +153,15 @@ struct lp_struct { #define LP_DUMMY 0x00 /* - * This is the port delay time. Your mileage may vary. - * It is used only in the lp_init() routine. + * This is the port delay time, in microseconds. + * It is used only in the lp_init() and lp_reset() routine. */ -#define LP_DELAY 150000 +#define LP_DELAY 50 /* * function prototypes */ -extern long lp_init(long); +extern int lp_init(void); #endif diff --git a/include/linux/lp_intern.h b/include/linux/lp_intern.h new file mode 100644 index 000000000..b6601c0b3 --- /dev/null +++ b/include/linux/lp_intern.h @@ -0,0 +1,22 @@ +#ifndef _LINUX_LP_INTERN_H_ +#define _LINUX_LP_INTERN_H_ + +/* + * split in two parts by Joerg Dorchain + * usr/include/linux/lp.h modified for Amiga by Michael Rausch + * modified for Atari by Andreas Schwab + * bug fixed by Jes Sorensen 18/8-94: + * It was not possible to compile the kernel only for Atari or Amiga. + * + * linux i386 version c.1991-1992 James Wiegand + * many modifications copyright (C) 1992 Michael K. Johnson + * Interrupt support added 1993 Nigel Gamble + */ + +#include <linux/types.h> +#include <linux/lp_m68k.h> + +int lp_internal_init(struct lp_struct *, int, int, int); + +#endif + diff --git a/include/linux/lp_m68k.h b/include/linux/lp_m68k.h new file mode 100644 index 000000000..26d078110 --- /dev/null +++ b/include/linux/lp_m68k.h @@ -0,0 +1,109 @@ +#ifndef _LINUX_LP_H +#define _LINUX_LP_H + +/* + * split in two parts by Joerg Dorchain + * usr/include/linux/lp.h modified for Amiga by Michael Rausch + * modified for Atari by Andreas Schwab + * bug fixed by Jes Sorensen 18/8-94: + * It was not possible to compile the kernel only for Atari or Amiga. + * + * linux i386 version c.1991-1992 James Wiegand + * many modifications copyright (C) 1992 Michael K. Johnson + * Interrupt support added 1993 Nigel Gamble + */ + +#include <linux/autoconf.h> +#include <asm/bootinfo.h> + +/* + * Per POSIX guidelines, this module reserves the LP and lp prefixes + * These are the lp_table[minor].flags flags... + */ +#define LP_EXIST 0x0001 +#define LP_BUSY 0x0004 +#define LP_ABORT 0x0040 +#define LP_CAREFUL 0x0080 +#define LP_ABORTOPEN 0x0100 + +/* timeout for each character. This is relative to bus cycles -- it + * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you + * have extremely slow printing, or if the machine seems to slow down + * a lot when you print. If you have slow printing, increase this + * number and recompile, and if your system gets bogged down, decrease + * this number. This can be changed with the tunelp(8) command as well. + */ + +#define LP_INIT_CHAR 1000 + +/* The parallel port specs apparently say that there needs to be + * a .5usec wait before and after the strobe. Since there are wildly + * different computers running linux, I can't come up with a perfect + * value, but since it worked well on most printers before without, + * I'll initialize it to 0. + */ + +#define LP_INIT_WAIT 0 + +/* This is the amount of time that the driver waits for the printer to + * catch up when the printer's buffer appears to be filled. If you + * want to tune this and have a fast printer (i.e. HPIIIP), decrease + * this number, and if you have a slow printer, increase this number. + * This is in hundredths of a second, the default 2 being .05 second. + * Or use the tunelp(8) command, which is especially nice if you want + * change back and forth between character and graphics printing, which + * are wildly different... + */ + +#define LP_INIT_TIME 40 + +/* IOCTL numbers */ +#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ +#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ +#define LPABORT 0x0604 /* call with TRUE arg to abort on error, + FALSE to retry. Default is retry. */ +#define LPSETIRQ 0x0605 /* call with new IRQ number, + or 0 for polling (no IRQ) */ +#define LPGETIRQ 0x0606 /* get the current IRQ number */ +#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ +#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- + line, and error indicators good on all writes, + FALSE to ignore them. Default is ignore. */ +#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, + FALSE to ignore error. Default is ignore. */ +#define LPGETSTATUS 0x060b /* return LP_S(minor) */ +#define LPRESET 0x060c /* reset printer */ + +/* timeout for printk'ing a timeout, in jiffies (100ths of a second). + This is also used for re-checking error conditions if LP_ABORT is + not set. This is the default behavior. */ + +#define LP_TIMEOUT_INTERRUPT (60 * HZ) +#define LP_TIMEOUT_POLLED (10 * HZ) + + +#define LP_BUFFER_SIZE 1024 /*256*/ + +struct lp_struct { + char *name; + unsigned int irq; + void (*lp_out)(int,int); /*output char function*/ + int (*lp_is_busy)(int); + int (*lp_has_pout)(int); + int (*lp_is_online)(int); + int (*lp_my_interrupt)(int); + int flags; /*for BUSY... */ + unsigned int chars; /*busy timeout */ + unsigned int time; /*wait time */ + unsigned int wait; + struct wait_queue *lp_wait_q; /*strobe wait */ + char lp_buffer[LP_BUFFER_SIZE]; + int do_print; + unsigned long copy_size,bytes_written; +}; + +extern struct lp_struct lp_table[]; + +extern int lp_init(void); + +#endif diff --git a/include/linux/major.h b/include/linux/major.h index 68edd3614..396b33a02 100644 --- a/include/linux/major.h +++ b/include/linux/major.h @@ -2,98 +2,84 @@ #define _LINUX_MAJOR_H /* - * This file has definitions for major device numbers + * This file has definitions for major device numbers. + * For the device number assignments, see Documentation/devices.txt. */ /* limits */ -#define MAX_CHRDEV 64 -#define MAX_BLKDEV 64 - -/* - * assignments - * - * devices are as follows (same as minix, so we can use the minix fs): - * - * character block comments - * -------------------- -------------------- -------------------- - * 0 - unnamed unnamed minor 0 = true nodev - * 1 - /dev/mem ramdisk - * 2 - floppy - * 3 - hd - * 4 - /dev/tty* - * 5 - /dev/tty; /dev/cua* - * 6 - lp - * 7 - /dev/vcs* - * 8 - scsi disk - * 9 - scsi tape - * 10 - mice - * 11 - scsi cdrom - * 12 - qic02 tape - * 13 - xt disk - * 14 - sound card - * 15 - cdu31a cdrom - * 16 - sockets - * 17 - af_unix - * 18 - af_inet - * 19 - cyclades /dev/ttyC* - * 20 - cyclades /dev/cub* - * 21 - scsi generic - * 22 - (at2disk) - * 23 - mitsumi cdrom - * 24 - sony535 cdrom - * 25 - matsushita cdrom minors 0..3 - * 26 - matsushita cdrom 2 minors 0..3 - * 27 - qic117 tape matsushita cdrom 3 minors 0..3 - * 28 - matsushita cdrom 4 minors 0..3 - * 29 - aztech/orchid/okano/wearnes cdrom - */ +#define MAX_CHRDEV 128 +#define MAX_BLKDEV 128 #define UNNAMED_MAJOR 0 #define MEM_MAJOR 1 +#define RAMDISK_MAJOR 1 #define FLOPPY_MAJOR 2 +#define PTY_MASTER_MAJOR 2 #define IDE0_MAJOR 3 +#define PTY_SLAVE_MAJOR 3 #define HD_MAJOR IDE0_MAJOR #define TTY_MAJOR 4 #define TTYAUX_MAJOR 5 #define LP_MAJOR 6 #define VCS_MAJOR 7 +#define LOOP_MAJOR 7 #define SCSI_DISK_MAJOR 8 #define SCSI_TAPE_MAJOR 9 -#define MOUSE_MAJOR 10 +#define MD_MAJOR 9 +#define MISC_MAJOR 10 #define SCSI_CDROM_MAJOR 11 #define QIC02_TAPE_MAJOR 12 #define XT_DISK_MAJOR 13 #define SOUND_MAJOR 14 #define CDU31A_CDROM_MAJOR 15 -#define SOCKET_MAJOR 16 -#define AF_UNIX_MAJOR 17 -#define AF_INET_MAJOR 18 +#define JOYSTICK_MAJOR 15 +#define GOLDSTAR_CDROM_MAJOR 16 +#define OPTICS_CDROM_MAJOR 17 +#define SANYO_CDROM_MAJOR 18 #define CYCLADES_MAJOR 19 #define CYCLADESAUX_MAJOR 20 +#define MITSUMI_X_CDROM_MAJOR 20 #define SCSI_GENERIC_MAJOR 21 +#define Z8530_MAJOR 34 +#define DIGI_MAJOR 23 #define IDE1_MAJOR 22 +#define DIGICU_MAJOR 22 #define MITSUMI_CDROM_MAJOR 23 #define CDU535_CDROM_MAJOR 24 +#define STL_SERIALMAJOR 24 #define MATSUSHITA_CDROM_MAJOR 25 +#define STL_CALLOUTMAJOR 25 #define MATSUSHITA_CDROM2_MAJOR 26 +#define QIC117_TAPE_MAJOR 27 #define MATSUSHITA_CDROM3_MAJOR 27 #define MATSUSHITA_CDROM4_MAJOR 28 -#define QIC117_TAPE_MAJOR 27 +#define STL_SIOMEMMAJOR 28 +#define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 +#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */ +#define CM206_CDROM_MAJOR 32 +#define IDE2_MAJOR 33 +#define IDE3_MAJOR 34 +#define NETLINK_MAJOR 36 +#define IDETAPE_MAJOR 37 +#define Z2RAM_MAJOR 37 +#define RISCOM8_NORMAL_MAJOR 48 +#define RISCOM8_CALLOUT_MAJOR 49 +#define MKISS_MAJOR 55 +#define APBLOCK_MAJOR 60 /* AP1000 Block device */ +#define DDV_MAJOR 61 /* AP1000 DDV block device */ /* * Tests for SCSI devices. */ -#define SCSI_MAJOR(M) \ +#define SCSI_BLK_MAJOR(M) \ ((M) == SCSI_DISK_MAJOR \ - || (M) == SCSI_TAPE_MAJOR \ - || (M) == SCSI_CDROM_MAJOR \ - || (M) == SCSI_GENERIC_MAJOR) + || (M) == SCSI_CDROM_MAJOR) -static inline int scsi_major(int m) { - return SCSI_MAJOR(m); +static __inline__ int scsi_blk_major(int m) { + return SCSI_BLK_MAJOR(m); } #endif diff --git a/include/linux/malloc.h b/include/linux/malloc.h index b0105150c..0ef085783 100644 --- a/include/linux/malloc.h +++ b/include/linux/malloc.h @@ -1,31 +1,11 @@ #ifndef _LINUX_MALLOC_H #define _LINUX_MALLOC_H -#include <linux/config.h> #include <linux/mm.h> -#ifdef CONFIG_DEBUG_MALLOC -#define kmalloc(a,b) deb_kmalloc(__FILE__,__LINE__,a,b) -#define kfree_s(a,b) deb_kfree_s(__FILE__,__LINE__,a,b) - -void *deb_kmalloc(const char *deb_file, unsigned short deb_line,unsigned int size, int priority); -void deb_kfree_s (const char *deb_file, unsigned short deb_line,void * obj, int size); -void deb_kcheck_s(const char *deb_file, unsigned short deb_line,void * obj, int size); - -#define kfree(a) deb_kfree_s(__FILE__,__LINE__, a,0) -#define kcheck(a) deb_kcheck_s(__FILE__,__LINE__, a,0) -#define kcheck_s(a,b) deb_kcheck_s(__FILE__,__LINE__, a,b) - -#else /* !debug */ - void * kmalloc(unsigned int size, int priority); -void kfree_s(void * obj, int size); - -#define kcheck_s(a,b) 0 - -#define kfree(x) kfree_s((x), 0) -#define kcheck(x) kcheck_s((x), 0) +void kfree(void * obj); -#endif +#define kfree_s(a,b) kfree(a) #endif /* _LINUX_MALLOC_H */ diff --git a/include/linux/math_emu.h b/include/linux/math_emu.h deleted file mode 100644 index 0d9606d94..000000000 --- a/include/linux/math_emu.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _LINUX_MATH_EMU_H -#define _LINUX_MATH_EMU_H - -struct fpu_reg { - char sign; - char tag; - long exp; - unsigned sigl; - unsigned sigh; -}; - - -/* This structure matches the layout of the data saved to the stack - following a device-not-present interrupt, part of it saved - automatically by the 80386/80486. - */ -struct info { - long ___orig_eip; - long ___ret_from_system_call; - long ___ebx; - long ___ecx; - long ___edx; - long ___esi; - long ___edi; - long ___ebp; - long ___eax; - long ___ds; - long ___es; - long ___fs; - long ___gs; - long ___orig_eax; - long ___eip; - long ___cs; - long ___eflags; - long ___esp; - long ___ss; - long ___vm86_es; /* This and the following only in vm86 mode */ - long ___vm86_ds; - long ___vm86_fs; - long ___vm86_gs; -}; - -#endif diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h index 5f22761fd..d942ccdc3 100644 --- a/include/linux/mc146818rtc.h +++ b/include/linux/mc146818rtc.h @@ -7,25 +7,10 @@ * in terms of the GNU Library General Public License, Version 2 or later, * at your option. */ - #ifndef _MC146818RTC_H #define _MC146818RTC_H -#include <asm/io.h> - -#ifndef RTC_PORT -#define RTC_PORT(x) (0x70 + (x)) -#define RTC_ADDR(x) (0x80 | (x)) -#define RTC_ALWAYS_BCD 1 -#endif -#define CMOS_READ(addr) ({ \ -outb_p(RTC_ADDR(addr),RTC_PORT(0)); \ -inb_p(RTC_PORT(1)); \ -}) -#define CMOS_WRITE(val, addr) ({ \ -outb_p(RTC_ADDR(addr),RTC_PORT(0)); \ -outb_p(val,RTC_PORT(1)); \ -}) +#include <asm/mc146818rtc.h> /********************************************************************** * register summary @@ -107,4 +92,42 @@ outb_p(val,RTC_PORT(1)); \ #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) #endif +/* + * The struct used to pass data via the following ioctl. Similar to the + * struct tm in <time.h>, but it needs to be here so that the kernel + * source is self contained, allowing cross-compiles, etc. etc. + */ + +struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +/* + * ioctl calls that are permitted to the /dev/rtc interface, if + * CONFIG_RTC was enabled. + */ + +#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ +#define RTC_AIE_OFF _IO('p', 0x02) /* ... off */ +#define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */ +#define RTC_UIE_OFF _IO('p', 0x04) /* ... off */ +#define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */ +#define RTC_PIE_OFF _IO('p', 0x06) /* ... off */ + +#define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */ +#define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */ +#define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */ +#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ +#define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ +#define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ + + #endif /* _MC146818RTC_H */ diff --git a/include/linux/mcd.h b/include/linux/mcd.h index 975a3f840..b87d6bbe4 100644 --- a/include/linux/mcd.h +++ b/include/linux/mcd.h @@ -25,7 +25,11 @@ #define MCD_BASE_ADDR 0x300 /* *** change this to set the interrupt number */ -#define MCD_INTR_NR 10 +#define MCD_INTR_NR 11 + +/* *** make the following line uncommented, if you're sure, + * *** all configuration is done */ +/* #define I_WAS_HERE */ /* Increase this if you get lots of timeouts */ #define MCD_STATUS_DELAY 200 @@ -105,3 +109,8 @@ struct mcd_Toc { struct msf trackTime; struct msf diskTime; }; + +#ifndef I_WAS_HERE +#warning You have not edited mcd.h +#warning Perhaps irq and i/o settings are wrong. +#endif diff --git a/include/linux/mcdx.h b/include/linux/mcdx.h new file mode 100644 index 000000000..b1b431326 --- /dev/null +++ b/include/linux/mcdx.h @@ -0,0 +1,184 @@ +/* + * Definitions for the Mitsumi CDROM interface + * Copyright (C) 1995 1996 Heiko Schlittermann <heiko@lotte.sax.de> + * VERSION: @VERSION@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Thanks to + * The Linux Community at all and ... + * Martin Harris (he wrote the first Mitsumi Driver) + * Eberhard Moenkeberg (he gave me much support and the initial kick) + * Bernd Huebner, Ruediger Helsch (Unifix-Software Gmbh, they + * improved the original driver) + * Jon Tombs, Bjorn Ekwall (module support) + * Daniel v. Mosnenck (he sent me the Technical and Programming Reference) + * Gerd Knorr (he lent me his PhotoCD) + * Nils Faerber and Roger E. Wolff (extensively tested the LU portion) + * Andreas Kies (testing the mysterious hang up's) + * ... somebody forgotten? + * Marcin Dalecki + * + */ + +/* + * The following lines are for user configuration + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * {0|1} -- 1 if you want the driver detect your drive, may crash and + * needs a long time to seek. The higher the address the longer the + * seek. + * + * WARNING: AUTOPROBE doesn't work. + */ +#define MCDX_AUTOPROBE 0 + +/* + * Drive specific settings according to the jumpers on the controller + * board(s). + * o MCDX_NDRIVES : number of used entries of the following table + * o MCDX_DRIVEMAP : table of {i/o base, irq} per controller + * + * NOTE: I didn't get a drive at irq 9(2) working. Not even alone. + */ +#if MCDX_AUTOPROBE == 0 + #define MCDX_NDRIVES 1 + #define MCDX_DRIVEMAP { \ + {0x300, 11}, \ + {0x304, 05}, \ + {0x000, 00}, \ + {0x000, 00}, \ + {0x000, 00}, \ + } +#else + #error Autoprobing is not implemented yet. +#endif + +#ifndef MCDX_QUIET +#define MCDX_QUIET 1 +#endif + +#ifndef MCDX_DEBUG +#define MCDX_DEBUG 0 +#endif + +/* *** make the following line uncommented, if you're sure, + * *** all configuration is done */ +/* #define I_WAS_HERE */ +#define I_WAS_HERE /* delete this line, it's for heiko only */ + +/* The name of the device */ +#define MCDX "mcdx" + +/* Flags for DEBUGGING */ +#define INIT 0 +#define MALLOC 0 +#define IOCTL 0 +#define PLAYTRK 0 +#define SUBCHNL 0 +#define TOCHDR 0 +#define MS 0 +#define PLAYMSF 0 +#define READTOC 0 +#define OPENCLOSE 0 +#define HW 0 +#define TALK 0 +#define IRQ 0 +#define XFER 0 +#define REQUEST 0 +#define SLEEP 0 + +/* The following addresses are taken from the Mitsumi Reference + * and describe the possible i/o range for the controller. + */ +#define MCDX_IO_BEGIN ((char*) 0x300) /* first base of i/o addr */ +#define MCDX_IO_END ((char*) 0x3fc) /* last base of i/o addr */ + +/* Per controller 4 bytes i/o are needed. */ +#define MCDX_IO_SIZE 4 + +/* + * Bits + */ + +/* The status byte, returned from every command, set if + * the description is true */ +#define MCDX_RBIT_OPEN 0x80 /* door is open */ +#define MCDX_RBIT_DISKSET 0x40 /* disk set (recognised) */ +#define MCDX_RBIT_CHANGED 0x20 /* disk was changed */ +#define MCDX_RBIT_CHECK 0x10 /* disk rotates, servo is on */ +#define MCDX_RBIT_AUDIOTR 0x08 /* current track is audio */ +#define MCDX_RBIT_RDERR 0x04 /* read error, refer SENSE KEY */ +#define MCDX_RBIT_AUDIOBS 0x02 /* currently playing audio */ +#define MCDX_RBIT_CMDERR 0x01 /* command, param or format error */ + +/* The I/O Register holding the h/w status of the drive, + * can be read at i/o base + 1 */ +#define MCDX_RBIT_DOOR 0x10 /* door is open */ +#define MCDX_RBIT_STEN 0x04 /* if 0, i/o base contains drive status */ +#define MCDX_RBIT_DTEN 0x02 /* if 0, i/o base contains data */ + +/* + * The commands. + */ + +#define OPCODE 1 /* offset of opcode */ +#define MCDX_CMD_REQUEST_TOC 1, 0x10 +#define MCDX_CMD_REQUEST_STATUS 1, 0x40 +#define MCDX_CMD_RESET 1, 0x60 +#define MCDX_CMD_REQUEST_DRIVE_MODE 1, 0xc2 +#define MCDX_CMD_SET_INTERLEAVE 2, 0xc8, 0 +#define MCDX_CMD_DATAMODE_SET 2, 0xa0, 0 + #define MCDX_DATAMODE1 0x01 + #define MCDX_DATAMODE2 0x02 +#define MCDX_CMD_LOCK_DOOR 2, 0xfe, 0 + +#define READ_AHEAD 4 /* 8 Sectors (4K) */ + +/* Useful macros */ +#define e_door(x) ((x) & MCDX_RBIT_OPEN) +#define e_check(x) (~(x) & MCDX_RBIT_CHECK) +#define e_notset(x) (~(x) & MCDX_RBIT_DISKSET) +#define e_changed(x) ((x) & MCDX_RBIT_CHANGED) +#define e_audio(x) ((x) & MCDX_RBIT_AUDIOTR) +#define e_audiobusy(x) ((x) & MCDX_RBIT_AUDIOBS) +#define e_cmderr(x) ((x) & MCDX_RBIT_CMDERR) +#define e_readerr(x) ((x) & MCDX_RBIT_RDERR) + +/** no drive specific */ +#define MCDX_CDBLK 2048 /* 2048 cooked data each blk */ + +#define MCDX_DATA_TIMEOUT (HZ/10) /* 0.1 second */ + +/* + * Access to the msf array + */ +#define MSF_MIN 0 /* minute */ +#define MSF_SEC 1 /* second */ +#define MSF_FRM 2 /* frame */ + +/* + * Errors + */ +#define MCDX_E 1 /* unspec error */ +#define MCDX_ST_EOM 0x0100 /* end of media */ +#define MCDX_ST_DRV 0x00ff /* mask to query the drive status */ + +#ifndef I_WAS_HERE +#warning You have not edited mcdx.h +#warning Perhaps irq and i/o settings are wrong. +#endif + +/* ex:set ts=4 sw=4: */ diff --git a/include/linux/md.h b/include/linux/md.h new file mode 100644 index 000000000..2777a7191 --- /dev/null +++ b/include/linux/md.h @@ -0,0 +1,115 @@ + +/* + md.h : Multiple Devices driver for Linux + Copyright (C) 1994-96 Marc ZYNGIER + <zyngier@ufr-info-p7.ibp.fr> or + <maz@gloups.fdn.fr> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + You should have received a copy of the GNU General Public License + (for example /usr/src/linux/COPYING); if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _MD_H +#define _MD_H + +#include <linux/major.h> +#include <linux/mm.h> +#include <linux/ioctl.h> + +#define MD_VERSION "0.35" + +/* ioctls */ +#define REGISTER_DEV _IO (MD_MAJOR, 1) +#define START_MD _IO (MD_MAJOR, 2) +#define STOP_MD _IO (MD_MAJOR, 3) + +/* + personalities : + Byte 0 : Chunk size factor + Byte 1 : Fault tolerance count for each physical device + ( 0 means no fault tolerance, + 0xFF means always tolerate faults), not used by now. + Byte 2 : Personality + Byte 3 : Reserved. + */ + +#define FAULT_SHIFT 8 +#define PERSONALITY_SHIFT 16 + +#define FACTOR_MASK 0xFFUL +#define FAULT_MASK 0xFF00UL +#define PERSONALITY_MASK 0xFF0000UL + +#define MD_RESERVED 0 /* Not used by now */ +#define LINEAR (1UL << PERSONALITY_SHIFT) +#define STRIPED (2UL << PERSONALITY_SHIFT) +#define RAID0 STRIPED +#define RAID1 (3UL << PERSONALITY_SHIFT) +#define RAID5 (4UL << PERSONALITY_SHIFT) +#define MAX_PERSONALITY 5 + +#ifdef __KERNEL__ + +#include <linux/types.h> +#include <linux/fs.h> +#include <linux/blkdev.h> + +#define MAX_REAL 8 /* Max number of physical dev per md dev */ +#define MAX_MD_DEV 4 /* Max number of md dev */ + +#define FACTOR(a) ((a)->repartition & FACTOR_MASK) +#define MAX_FAULT(a) (((a)->repartition & FAULT_MASK)>>8) +#define PERSONALITY(a) ((a)->repartition & PERSONALITY_MASK) + +#define FACTOR_SHIFT(a) (PAGE_SHIFT + (a) - 10) + +struct real_dev +{ + kdev_t dev; /* Device number */ + int size; /* Device size (in blocks) */ + int offset; /* Real device offset (in blocks) in md dev + (only used in linear mode) */ + struct inode *inode; /* Lock inode */ +}; + +struct md_dev; + +struct md_personality +{ + char *name; + int (*map)(struct md_dev *md_dev, kdev_t *rdev, + unsigned long *rsector, unsigned long size); + int (*run)(int minor, struct md_dev *md_dev); + int (*stop)(int minor, struct md_dev *md_dev); + int (*status)(char *page, int minor, struct md_dev *md_dev); + int (*ioctl)(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg); + int max_invalid_dev; +}; + +struct md_dev +{ + struct real_dev devices[MAX_REAL]; + struct md_personality *pers; + int repartition; + int busy; + int nb_dev; + void *private; +}; + +extern struct md_dev md_dev[MAX_MD_DEV]; +extern int md_size[MAX_MD_DEV]; + +extern char *partition_name (kdev_t dev); + +extern int register_md_personality (int p_num, struct md_personality *p); +extern int unregister_md_personality (int p_num); + +#endif __KERNEL__ +#endif _MD_H diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 33fd9c1d9..3bc020fcd 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h @@ -8,8 +8,7 @@ /* * Thanks to Kees J Bot for sending me the definitions of the new * minix filesystem (aka V2) with bigger inodes and 32-bit block - * pointers. It's not actually implemented yet, but I'll look into - * it. + * pointers. */ #define MINIX_ROOT_INO 1 @@ -18,14 +17,21 @@ #define MINIX_LINK_MAX 250 #define MINIX_I_MAP_SLOTS 8 -#define MINIX_Z_MAP_SLOTS 8 +#define MINIX_Z_MAP_SLOTS 64 #define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ #define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ -#define NEW_MINIX_SUPER_MAGIC 0x2468 /* minix V2 - not implemented */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ #define MINIX_VALID_FS 0x0001 /* Clean fs. */ #define MINIX_ERROR_FS 0x0002 /* fs has errors. */ #define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) +#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode))) + +#define MINIX_V1 0x0001 /* original minix fs */ +#define MINIX_V2 0x0002 /* minix V2 fs */ + +#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version /* * This is the original minix inode layout on disk. @@ -47,7 +53,7 @@ struct minix_inode { * instead of 7+1+1). Also, some previously 8-bit values are * now 16-bit. The inode is now 64 bytes instead of 32. */ -struct new_minix_inode { +struct minix2_inode { __u16 i_mode; __u16 i_nlinks; __u16 i_uid; @@ -72,6 +78,7 @@ struct minix_super_block { __u32 s_max_size; __u16 s_magic; __u16 s_state; + __u32 s_zones; }; struct minix_dir_entry { @@ -82,7 +89,7 @@ struct minix_dir_entry { #ifdef __KERNEL__ extern int minix_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); + struct inode ** result); extern int minix_create(struct inode * dir,const char * name, int len, int mode, struct inode ** result); extern int minix_mkdir(struct inode * dir, const char * name, int len, int mode); @@ -93,7 +100,7 @@ extern int minix_symlink(struct inode * inode, const char * name, int len, extern int minix_link(struct inode * oldinode, struct inode * dir, const char * name, int len); extern int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int minix_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len); + struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); extern struct inode * minix_new_inode(const struct inode * dir); extern void minix_free_inode(struct inode * inode); extern unsigned long minix_count_free_inodes(struct super_block *sb); @@ -109,6 +116,7 @@ extern struct buffer_head * minix_bread(struct inode *, int, int); extern void minix_truncate(struct inode *); extern void minix_put_super(struct super_block *); extern struct super_block *minix_read_super(struct super_block *,void *,int); +extern int init_minix_fs(void); extern void minix_write_super(struct super_block *); extern int minix_remount (struct super_block * sb, int * flags, char * data); extern void minix_read_inode(struct inode *); diff --git a/include/linux/minix_fs_i.h b/include/linux/minix_fs_i.h index c8677b4b9..c3711e522 100644 --- a/include/linux/minix_fs_i.h +++ b/include/linux/minix_fs_i.h @@ -5,7 +5,10 @@ * minix fs inode data in memory */ struct minix_inode_info { - __u16 i_data[16]; + union { + __u16 i1_data[16]; + __u32 i2_data[16]; + } u; }; #endif diff --git a/include/linux/minix_fs_sb.h b/include/linux/minix_fs_sb.h index a48347980..e77b4efc6 100644 --- a/include/linux/minix_fs_sb.h +++ b/include/linux/minix_fs_sb.h @@ -13,12 +13,13 @@ struct minix_sb_info { unsigned long s_log_zone_size; unsigned long s_max_size; struct buffer_head * s_imap[8]; - struct buffer_head * s_zmap[8]; + struct buffer_head * s_zmap[64]; unsigned long s_dirsize; unsigned long s_namelen; struct buffer_head * s_sbh; struct minix_super_block * s_ms; unsigned short s_mount_state; + unsigned short s_version; }; #endif diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h new file mode 100644 index 000000000..f8ea74922 --- /dev/null +++ b/include/linux/miscdevice.h @@ -0,0 +1,26 @@ +#ifndef _LINUX_MISCDEVICE_H +#define _LINUX_MISCDEVICE_H + +#define BUSMOUSE_MINOR 0 +#define PSMOUSE_MINOR 1 +#define MS_BUSMOUSE_MINOR 2 +#define ATIXL_BUSMOUSE_MINOR 3 +#define AMIGAMOUSE_MINOR 4 +#define ATARIMOUSE_MINOR 5 +#define SUN_MOUSE_MINOR 6 +#define MISC_DYNAMIC_MINOR 255 + +extern int misc_init(void); + +struct miscdevice +{ + int minor; + const char *name; + struct file_operations *fops; + struct miscdevice * next, * prev; +}; + +extern int misc_register(struct miscdevice * misc); +extern int misc_deregister(struct miscdevice * misc); + +#endif diff --git a/include/linux/mm.h b/include/linux/mm.h index c59651f38..149e6eaeb 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4,18 +4,16 @@ #include <linux/sched.h> #include <linux/errno.h> #include <linux/kernel.h> -#include <linux/string.h> - -extern unsigned long high_memory; - -#include <asm/page.h> #ifdef __KERNEL__ -#define VERIFY_READ 0 -#define VERIFY_WRITE 1 +#include <linux/string.h> + +extern unsigned long max_mapnr; +extern void * high_memory; -extern int verify_area(int, const void *, unsigned long); +#include <asm/page.h> +#include <asm/atomic.h> /* * Linux kernel virtual memory manager primitives. @@ -33,7 +31,7 @@ extern int verify_area(int, const void *, unsigned long); * library, the executable area etc). */ struct vm_area_struct { - struct task_struct * vm_task; /* VM area parameters */ + struct mm_struct * vm_mm; /* VM area parameters */ unsigned long vm_start; unsigned long vm_end; pgprot_t vm_page_prot; @@ -71,10 +69,11 @@ struct vm_area_struct { #define VM_GROWSDOWN 0x0100 /* general info on the segment */ #define VM_GROWSUP 0x0200 -#define VM_SHM 0x0400 +#define VM_SHM 0x0400 /* shared memory area, don't swap out */ #define VM_DENYWRITE 0x0800 /* ETXTBSY on write attempts.. */ #define VM_EXECUTABLE 0x1000 +#define VM_LOCKED 0x2000 #define VM_STACK_FLAGS 0x0177 @@ -95,44 +94,136 @@ struct vm_operations_struct { void (*close)(struct vm_area_struct * area); void (*unmap)(struct vm_area_struct *area, unsigned long, size_t); void (*protect)(struct vm_area_struct *area, unsigned long, size_t, unsigned int newprot); - void (*sync)(struct vm_area_struct *area, unsigned long, size_t, unsigned int flags); + int (*sync)(struct vm_area_struct *area, unsigned long, size_t, unsigned int flags); void (*advise)(struct vm_area_struct *area, unsigned long, size_t, unsigned int advise); - unsigned long (*nopage)(struct vm_area_struct * area, unsigned long address, - unsigned long page, int write_access); + unsigned long (*nopage)(struct vm_area_struct * area, unsigned long address, int write_access); unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address, unsigned long page); - void (*swapout)(struct vm_area_struct *, unsigned long, pte_t *); + int (*swapout)(struct vm_area_struct *, unsigned long, pte_t *); pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long); }; -extern mem_map_t * mem_map; - -/* planning stage.. */ -#define P_DIRTY 0x0001 -#define P_LOCKED 0x0002 -#define P_UPTODATE 0x0004 -#define P_RESERVED 0x8000 - -struct page_info { - unsigned short flags; - unsigned short count; - struct inode * inode; +/* + * Try to keep the most commonly accessed fields in single cache lines + * here (16 bytes or greater). This ordering should be particularly + * beneficial on 32-bit processors. + * + * The first line is data used in page cache lookup, the second line + * is used for linear searches (eg. clock algorithm scans). + */ +typedef struct page { + /* these must be first (free area handling) */ + struct page *next; + struct page *prev; + struct inode *inode; unsigned long offset; - struct page_info * next_same_inode; - struct page_info * prev_same_inode; - struct page_info * next_hash; - struct page_info * prev_hash; + struct page *next_hash; + atomic_t count; + unsigned flags; /* atomic flags, some possibly updated asynchronously */ + unsigned dirty:16, + age:8; struct wait_queue *wait; -}; -/* end of planning stage */ + struct page *prev_hash; + struct buffer_head * buffers; + unsigned long swap_unlock_entry; + unsigned long map_nr; /* page->map_nr == page - mem_map */ +} mem_map_t; + +/* Page flag bit values */ +#define PG_locked 0 +#define PG_error 1 +#define PG_referenced 2 +#define PG_uptodate 3 +#define PG_free_after 4 +#define PG_decr_after 5 +#define PG_swap_unlock_after 6 +#define PG_DMA 7 +#define PG_reserved 31 + +/* Make it prettier to test the above... */ +#define PageLocked(page) (test_bit(PG_locked, &(page)->flags)) +#define PageError(page) (test_bit(PG_error, &(page)->flags)) +#define PageReferenced(page) (test_bit(PG_referenced, &(page)->flags)) +#define PageDirty(page) (test_bit(PG_dirty, &(page)->flags)) +#define PageUptodate(page) (test_bit(PG_uptodate, &(page)->flags)) +#define PageFreeAfter(page) (test_bit(PG_free_after, &(page)->flags)) +#define PageDecrAfter(page) (test_bit(PG_decr_after, &(page)->flags)) +#define PageSwapUnlockAfter(page) (test_bit(PG_swap_unlock_after, &(page)->flags)) +#define PageDMA(page) (test_bit(PG_DMA, &(page)->flags)) +#define PageReserved(page) (test_bit(PG_reserved, &(page)->flags)) /* - * Free area management + * page->reserved denotes a page which must never be accessed (which + * may not even be present). + * + * page->dma is set for those pages which lie in the range of + * physical addresses capable of carrying DMA transfers. + * + * Multiple processes may "see" the same page. E.g. for untouched + * mappings of /dev/null, all processes see the same page full of + * zeroes, and text pages of executables and shared libraries have + * only one copy in memory, at most, normally. + * + * For the non-reserved pages, page->count denotes a reference count. + * page->count == 0 means the page is free. + * page->count == 1 means the page is used for exactly one purpose + * (e.g. a private data page of one process). + * + * A page may be used for kmalloc() or anyone else who does a + * get_free_page(). In this case the page->count is at least 1, and + * all other fields are unused but should be 0 or NULL. The + * management of this page is the responsibility of the one who uses + * it. + * + * The other pages (we may call them "process pages") are completely + * managed by the Linux memory manager: I/O, buffers, swapping etc. + * The following discussion applies only to them. + * + * A page may belong to an inode's memory mapping. In this case, + * page->inode is the inode, and page->offset is the file offset + * of the page (not necessarily a multiple of PAGE_SIZE). + * + * A page may have buffers allocated to it. In this case, + * page->buffers is a circular list of these buffer heads. Else, + * page->buffers == NULL. + * + * For pages belonging to inodes, the page->count is the number of + * attaches, plus 1 if buffers are allocated to the page. + * + * All pages belonging to an inode make up a doubly linked list + * inode->i_pages, using the fields page->next and page->prev. (These + * fields are also used for freelist management when page->count==0.) + * There is also a hash table mapping (inode,offset) to the page + * in memory if present. The lists for this hash table use the fields + * page->next_hash and page->prev_hash. + * + * All process pages can do I/O: + * - inode pages may need to be read from disk, + * - inode pages which have been modified and are MAP_SHARED may need + * to be written to disk, + * - private pages which have been modified may need to be swapped out + * to swap space and (later) to be read back into memory. + * During disk I/O, page->locked is true. This bit is set before I/O + * and reset when I/O completes. page->wait is a wait queue of all + * tasks waiting for the I/O on this page to complete. + * page->uptodate tells whether the page's contents is valid. + * When a read completes, the page becomes uptodate, unless a disk I/O + * error happened. + * When a write completes, and page->free_after is true, the page is + * freed without any further delay. + * + * For choosing which pages to swap out, inode pages carry a + * page->referenced bit, which is set any time the system accesses + * that page through the (inode,offset) hash table. + * There is also the page->age counter, which implements a linear + * decay (why not an exponential decay?), see swapctl.h. */ -extern int nr_swap_pages; -extern int nr_free_pages; -extern int min_free_pages; +extern mem_map_t * mem_map; + +/* + * Free area management + */ #define NR_MEM_LISTS 6 @@ -142,23 +233,24 @@ struct mem_list { }; extern struct mem_list free_area_list[NR_MEM_LISTS]; -extern unsigned char * free_area_map[NR_MEM_LISTS]; +extern unsigned int * free_area_map[NR_MEM_LISTS]; /* * This is timing-critical - most of the time in getting a new page * goes to clearing the page. If you want a page without the clearing * overhead, just use __get_free_page() directly.. */ -#define __get_free_page(priority) __get_free_pages((priority),0) -extern unsigned long __get_free_pages(int priority, unsigned long gfporder); -extern unsigned long __get_dma_pages(int priority, unsigned long gfporder); +#define __get_free_page(priority) __get_free_pages((priority),0,0) +#define __get_dma_pages(priority, order) __get_free_pages((priority),(order),1) +extern unsigned long __get_free_pages(int priority, unsigned long gfporder, int dma); + extern inline unsigned long get_free_page(int priority) { unsigned long page; page = __get_free_page(priority); if (page) - memset((void *) page, 0, PAGE_SIZE); + clear_page(page); return page; } @@ -166,22 +258,26 @@ extern inline unsigned long get_free_page(int priority) #define free_page(addr) free_pages((addr),0) extern void free_pages(unsigned long addr, unsigned long order); +extern void __free_page(struct page *); extern void show_free_areas(void); extern unsigned long put_dirty_page(struct task_struct * tsk,unsigned long page, unsigned long address); -extern void free_page_tables(struct task_struct * tsk); +extern void free_page_tables(struct mm_struct * mm); extern void clear_page_tables(struct task_struct * tsk); +extern int new_page_tables(struct task_struct * tsk); extern int copy_page_tables(struct task_struct * to); -extern int clone_page_tables(struct task_struct * to); -extern int unmap_page_range(unsigned long from, unsigned long size); + +extern int zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size); +extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma); extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot); extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot); +extern void vmtruncate(struct inode * inode, unsigned long offset); extern void handle_mm_fault(struct vm_area_struct *vma, unsigned long address, int write_access); -extern void do_wp_page(struct vm_area_struct * vma, unsigned long address, int write_access); -extern void do_no_page(struct vm_area_struct * vma, unsigned long address, int write_access); +extern void do_wp_page(struct task_struct * tsk, struct vm_area_struct * vma, unsigned long address, int write_access); +extern void do_no_page(struct task_struct * tsk, struct vm_area_struct * vma, unsigned long address, int write_access); extern unsigned long paging_init(unsigned long start_mem, unsigned long end_mem); extern void mem_init(unsigned long start_mem, unsigned long end_mem); @@ -189,38 +285,21 @@ extern void show_mem(void); extern void oom(struct task_struct * tsk); extern void si_meminfo(struct sysinfo * val); -/* vmalloc.c */ - -extern void * vmalloc(unsigned long size); -extern void vfree(void * addr); -extern int vread(char *buf, char *addr, int count); - -/* swap.c */ - -extern void swap_free(unsigned long); -extern void swap_duplicate(unsigned long); -extern void swap_in(struct vm_area_struct *, pte_t *, unsigned long id, int write_access); - -extern void si_swapinfo(struct sysinfo * val); -extern void rw_swap_page(int rw, unsigned long nr, char * buf); - /* mmap.c */ extern unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long off); -extern struct vm_area_struct * find_vma (struct task_struct *, unsigned long); -extern struct vm_area_struct * find_vma_intersection (struct task_struct *, unsigned long, unsigned long); -extern void merge_segments(struct task_struct *, unsigned long, unsigned long); -extern void insert_vm_struct(struct task_struct *, struct vm_area_struct *); +extern void merge_segments(struct mm_struct *, unsigned long, unsigned long); +extern void insert_vm_struct(struct mm_struct *, struct vm_area_struct *); extern void remove_shared_vm_struct(struct vm_area_struct *); -extern void build_mmap_avl(struct task_struct *); -extern void exit_mmap(struct task_struct *); +extern void build_mmap_avl(struct mm_struct *); +extern void exit_mmap(struct mm_struct *); extern int do_munmap(unsigned long, size_t); extern unsigned long get_unmapped_area(unsigned long, unsigned long); -#define read_swap_page(nr,buf) \ - rw_swap_page(READ,(nr),(buf)) -#define write_swap_page(nr,buf) \ - rw_swap_page(WRITE,(nr),(buf)) +/* filemap.c */ +extern unsigned long page_unuse(unsigned long); +extern int shrink_mmap(int, int); +extern void truncate_inode_pages(struct inode *, unsigned long); #define GFP_BUFFER 0x00 #define GFP_ATOMIC 0x01 @@ -234,66 +313,64 @@ extern unsigned long get_unmapped_area(unsigned long, unsigned long); #define GFP_DMA 0x80 -/* - * vm_ops not present page codes for shared memory. - * - * Will go away eventually.. - */ -#define SHM_SWP_TYPE 0x41 -extern void shm_no_page (ulong *); - -/* - * swap cache stuff (in swap.c) - */ -#define SWAP_CACHE_INFO +#define GFP_LEVEL_MASK 0xf -extern unsigned long * swap_cache; - -#ifdef SWAP_CACHE_INFO -extern unsigned long swap_cache_add_total; -extern unsigned long swap_cache_add_success; -extern unsigned long swap_cache_del_total; -extern unsigned long swap_cache_del_success; -extern unsigned long swap_cache_find_total; -extern unsigned long swap_cache_find_success; -#endif - -extern inline unsigned long in_swap_cache(unsigned long addr) +/* vma is the first one with address < vma->vm_end, + * and even address < vma->vm_start. Have to extend vma. */ +static inline int expand_stack(struct vm_area_struct * vma, unsigned long address) { - return swap_cache[MAP_NR(addr)]; + unsigned long grow; + + address &= PAGE_MASK; + grow = vma->vm_start - address; + if (vma->vm_end - address + > (unsigned long) current->rlim[RLIMIT_STACK].rlim_cur || + (vma->vm_mm->total_vm << PAGE_SHIFT) + grow + > (unsigned long) current->rlim[RLIMIT_AS].rlim_cur) + return -ENOMEM; + vma->vm_start = address; + vma->vm_offset -= grow; + vma->vm_mm->total_vm += grow >> PAGE_SHIFT; + if (vma->vm_flags & VM_LOCKED) + vma->vm_mm->locked_vm += grow >> PAGE_SHIFT; + return 0; } -extern inline long find_in_swap_cache (unsigned long addr) -{ - unsigned long entry; +#define avl_empty (struct vm_area_struct *) NULL -#ifdef SWAP_CACHE_INFO - swap_cache_find_total++; -#endif - entry = (unsigned long) xchg_ptr(swap_cache + MAP_NR(addr), NULL); -#ifdef SWAP_CACHE_INFO - if (entry) - swap_cache_find_success++; -#endif - return entry; +/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ +static inline struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr) +{ + struct vm_area_struct * result = NULL; + + if (mm) { + struct vm_area_struct ** next = &mm->mmap_avl; + for (;;) { + struct vm_area_struct *tree = *next; + if (tree == avl_empty) + break; + next = &tree->vm_avl_right; + if (tree->vm_end <= addr) + continue; + next = &tree->vm_avl_left; + result = tree; + if (tree->vm_start <= addr) + break; + } + } + return result; } -extern inline int delete_from_swap_cache(unsigned long addr) +/* Look up the first VMA which intersects the interval start_addr..end_addr-1, + NULL if none. Assume start_addr < end_addr. */ +static inline struct vm_area_struct * find_vma_intersection(struct mm_struct * mm, unsigned long start_addr, unsigned long end_addr) { - unsigned long entry; - -#ifdef SWAP_CACHE_INFO - swap_cache_del_total++; -#endif - entry= (unsigned long) xchg_ptr(swap_cache + MAP_NR(addr), NULL); - if (entry) { -#ifdef SWAP_CACHE_INFO - swap_cache_del_success++; -#endif - swap_free(entry); - return 1; - } - return 0; + struct vm_area_struct * vma; + + vma = find_vma(mm,start_addr); + if (vma && end_addr <= vma->vm_start) + vma = NULL; + return vma; } #endif /* __KERNEL__ */ diff --git a/include/linux/mman.h b/include/linux/mman.h index f9419b2f9..3bc0430bc 100644 --- a/include/linux/mman.h +++ b/include/linux/mman.h @@ -1,23 +1,8 @@ #ifndef _LINUX_MMAN_H #define _LINUX_MMAN_H -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ -#define PROT_NONE 0x0 /* page can not be accessed */ +#include <asm/mman.h> -#define MAP_SHARED 1 /* Share changes */ -#define MAP_PRIVATE 2 /* Changes are private */ -#define MAP_TYPE 0xf /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as a executable */ - -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate the caches */ -#define MS_SYNC 4 /* synchronous memory sync */ +#define MREMAP_MAYMOVE 1 #endif /* _LINUX_MMAN_H */ diff --git a/include/linux/module.h b/include/linux/module.h index 699c13ccf..1bf540e93 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -7,21 +7,16 @@ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H -#ifdef CONFIG_MODVERSIONS -# ifndef __GENKSYMS__ -# ifdef MODULE -# define _set_ver(sym,vers) sym ## _R ## vers -# include <linux/modversions.h> -# else /* MODULE */ -# ifdef EXPORT_SYMTAB -# define _set_ver(sym,vers) sym -# include <linux/modversions.h> -# endif /* EXPORT_SYMTAB */ -# endif /* MODULE */ -# else /* __GENKSYMS__ */ +#ifdef __GENKSYMS__ # define _set_ver(sym,vers) sym -# endif /* __GENKSYMS__ */ -#endif /* CONFIG_MODVERSIONS */ +# undef MODVERSIONS +# define MODVERSIONS +#else /* ! __GENKSYMS__ */ +# if defined(MODVERSIONS) && !defined(MODULE) && defined(EXPORT_SYMTAB) +# define _set_ver(sym,vers) sym +# include <linux/modversions.h> +# endif +#endif /* __GENKSYMS__ */ /* values of module.state */ #define MOD_UNINITIALIZED 0 @@ -31,6 +26,10 @@ /* maximum length of module name */ #define MOD_MAX_NAME 64 +/* magic marker for modules inserted from kerneld, to be auto-reaped */ +#define MOD_AUTOCLEAN 0x40000000 /* big enough, but no sign problems... */ +#define MOD_VISITED 0x20000000 /* Thanks Jacques! */ + /* maximum length of symbol name */ #define SYM_MAX_NAME 60 @@ -46,7 +45,7 @@ struct module_ref { struct internal_symbol { void *addr; - char *name; + const char *name; }; struct symbol_table { /* received from "insmod" */ @@ -59,44 +58,81 @@ struct symbol_table { /* received from "insmod" */ /* * Note: The string table follows immediately after the symbol table in memory! */ +struct _exceptinfo{ + struct exception_table_entry *start; + struct exception_table_entry *stop; +}; struct module { struct module *next; struct module_ref *ref; /* the list of modules that refer to me */ struct symbol_table *symtab; - char *name; + const char *name; int size; /* size of module in pages */ void* addr; /* address of module */ int state; void (*cleanup)(void); /* cleanup routine */ + struct _exceptinfo exceptinfo; }; +/* + prior to modules-2.1 there were no real way to identify + which insmod is talking to us Now a special signature must + be written here. + + The new module utilities knows about older kernel and write + the init in the signature and the cleanup in the init. + This is to make sure newer utilities work with older kernel + so it is simple for people to upgrade. +*/ +#define MODULE_2_1_7_SIG ((void*)0x00000217) + struct mod_routines { + void *signature; int (*init)(void); /* initialization routine */ void (*cleanup)(void); /* cleanup routine */ + struct _exceptinfo exceptinfo; }; -/* rename_module_symbol(old_name, new_name) WOW! */ -extern int rename_module_symbol(char *, char *); - -/* insert new symbol table */ -extern int register_symtab(struct symbol_table *); - /* * The first word of the module contains the use count. */ -#define GET_USE_COUNT(module) (* (int *) (module)->addr) +#define GET_USE_COUNT(module) (* (long *) (module)->addr) /* * define the count variable, and usage macros. */ -extern int mod_use_count_; -#if defined(CONFIG_MODVERSIONS) && defined(MODULE) && !defined(__GENKSYMS__) +#ifdef MODULE + +extern long mod_use_count_; +#define MOD_INC_USE_COUNT (mod_use_count_++, mod_use_count_ |= MOD_VISITED) +#define MOD_DEC_USE_COUNT (mod_use_count_--, mod_use_count_ |= MOD_VISITED) +#define MOD_IN_USE ((mod_use_count_ & ~(MOD_AUTOCLEAN | MOD_VISITED)) != 0) + +#ifndef __NO_VERSION__ +#include <linux/version.h> +char kernel_version[]=UTS_RELEASE; +#endif + +#if defined(MODVERSIONS) && !defined(__GENKSYMS__) int Using_Versions; /* gcc will handle this global (used as a flag) correctly */ #endif -#define MOD_INC_USE_COUNT mod_use_count_++ -#define MOD_DEC_USE_COUNT mod_use_count_-- -#define MOD_IN_USE (mod_use_count_ != 0) +#else + +#define MOD_INC_USE_COUNT do { } while (0) +#define MOD_DEC_USE_COUNT do { } while (0) +#define MOD_IN_USE 1 +extern struct module *module_list; + +#endif + +/* insert new symbol table */ +extern int register_symtab_from(struct symbol_table *, long *); +#ifdef MODULE +#define register_symtab(symtab) register_symtab_from(symtab, &mod_use_count_) +#else +#define register_symtab(symtab) register_symtab_from(symtab, 0) +#endif #endif diff --git a/include/linux/modules/ksyms.ver b/include/linux/modules/ksyms.ver deleted file mode 100644 index 76537cd4c..000000000 --- a/include/linux/modules/ksyms.ver +++ /dev/null @@ -1,194 +0,0 @@ -/**** This file is generated by genksyms DO NOT EDIT! ****/ -#if defined(CONFIG_MODVERSIONS) && !defined(__GENKSYMS__) -#ifndef _KSYMS_VER_ -#define _KSYMS_VER_ -#define rename_module_symbol _set_ver(rename_module_symbol, b81c73c1) -#define register_symtab _set_ver(register_symtab, e910ea66) -#define EISA_bus _set_ver(EISA_bus, 7e37737c) -#define wp_works_ok _set_ver(wp_works_ok, f37f99e9) -#define verify_area _set_ver(verify_area, 4cfda560) -#define do_mmap _set_ver(do_mmap, 677e7ee1) -#define do_munmap _set_ver(do_munmap, 6221f117) -#define zeromap_page_range _set_ver(zeromap_page_range, 7c395a26) -#define unmap_page_range _set_ver(unmap_page_range, 0110085f) -#define insert_vm_struct _set_ver(insert_vm_struct, 1f4e4882) -#define merge_segments _set_ver(merge_segments, 6854be5a) -#define __get_free_pages _set_ver(__get_free_pages, 5243d78b) -#define free_pages _set_ver(free_pages, 96448859) -#define kmalloc _set_ver(kmalloc, d31fb2cb) -#define kfree_s _set_ver(kfree_s, 1e72eb79) -#define vmalloc _set_ver(vmalloc, 667f3e25) -#define vfree _set_ver(vfree, 6df52add) -#define getname _set_ver(getname, 81487159) -#define putname _set_ver(putname, b19e8126) -#define __iget _set_ver(__iget, ee2b6320) -#define iput _set_ver(iput, 59241ced) -#define namei _set_ver(namei, 00478bcd) -#define lnamei _set_ver(lnamei, fcfddbb1) -#define open_namei _set_ver(open_namei, 414b2b0f) -#define close_fp _set_ver(close_fp, 1d4c15d8) -#define check_disk_change _set_ver(check_disk_change, b66ed457) -#define invalidate_buffers _set_ver(invalidate_buffers, c65255f1) -#define fsync_dev _set_ver(fsync_dev, a221190d) -#define permission _set_ver(permission, 0ebf7474) -#define inode_setattr _set_ver(inode_setattr, 0c80a3c1) -#define inode_change_ok _set_ver(inode_change_ok, 5d1cb326) -#define generic_mmap _set_ver(generic_mmap, d4ff59f3) -#define set_blocksize _set_ver(set_blocksize, f45fda38) -#define getblk _set_ver(getblk, d40228ac) -#define bread _set_ver(bread, c73bf0f0) -#define breada _set_ver(breada, eb8e858c) -#define brelse _set_ver(brelse, 4c27ac3d) -#define ll_rw_block _set_ver(ll_rw_block, f3aa4dd3) -#define __wait_on_buffer _set_ver(__wait_on_buffer, e8fcc968) -#define dcache_lookup _set_ver(dcache_lookup, 83336566) -#define dcache_add _set_ver(dcache_add, fe71f11e) -#define register_chrdev _set_ver(register_chrdev, da99513f) -#define unregister_chrdev _set_ver(unregister_chrdev, 61ea5ee8) -#define register_blkdev _set_ver(register_blkdev, 4699a621) -#define unregister_blkdev _set_ver(unregister_blkdev, d39bbca9) -#define tty_register_driver _set_ver(tty_register_driver, fcc8591c) -#define tty_unregister_driver _set_ver(tty_unregister_driver, c78132a8) -#define tty_std_termios _set_ver(tty_std_termios, cf350678) -#define block_read _set_ver(block_read, a7fe4f51) -#define block_write _set_ver(block_write, 902674c9) -#define block_fsync _set_ver(block_fsync, 182888d8) -#define wait_for_request _set_ver(wait_for_request, 9ca2932e) -#define blksize_size _set_ver(blksize_size, dea1eb55) -#define hardsect_size _set_ver(hardsect_size, ed1ee14f) -#define blk_size _set_ver(blk_size, f60b5398) -#define blk_dev _set_ver(blk_dev, dbf5fdd4) -#define is_read_only _set_ver(is_read_only, b0c5f83e) -#define set_device_ro _set_ver(set_device_ro, 8fb69e13) -#define bmap _set_ver(bmap, 73bb8bdd) -#define sync_dev _set_ver(sync_dev, 9bca536d) -#define get_blkfops _set_ver(get_blkfops, 83827791) -#define register_serial _set_ver(register_serial, 3425f38c) -#define unregister_serial _set_ver(unregister_serial, c013d717) -#define tty_hangup _set_ver(tty_hangup, e3487df0) -#define tty_wait_until_sent _set_ver(tty_wait_until_sent, da85d428) -#define tty_check_change _set_ver(tty_check_change, 705eaab0) -#define tty_hung_up_p _set_ver(tty_hung_up_p, f99ac1e4) -#define register_filesystem _set_ver(register_filesystem, 1c7110ef) -#define unregister_filesystem _set_ver(unregister_filesystem, 5e353af7) -#define register_binfmt _set_ver(register_binfmt, 66ece706) -#define unregister_binfmt _set_ver(unregister_binfmt, 41822618) -#define lookup_exec_domain _set_ver(lookup_exec_domain, 32f10d48) -#define register_exec_domain _set_ver(register_exec_domain, eda4711f) -#define unregister_exec_domain _set_ver(unregister_exec_domain, 78ea447c) -#define request_irq _set_ver(request_irq, 9e81629c) -#define free_irq _set_ver(free_irq, f487dc0c) -#define enable_irq _set_ver(enable_irq, 54e09f5f) -#define disable_irq _set_ver(disable_irq, b4449c1f) -#define bh_active _set_ver(bh_active, 98fb5ca1) -#define bh_mask _set_ver(bh_mask, 1abf3d3f) -#define add_timer _set_ver(add_timer, f13cb728) -#define del_timer _set_ver(del_timer, c7aff713) -#define tq_timer _set_ver(tq_timer, 46cf583e) -#define tq_immediate _set_ver(tq_immediate, 46cf583e) -#define tq_scheduler _set_ver(tq_scheduler, 46cf583e) -#define tq_last _set_ver(tq_last, 457cf547) -#define timer_active _set_ver(timer_active, 5a6747ee) -#define timer_table _set_ver(timer_table, 9e03b650) -#define request_dma _set_ver(request_dma, 2a687646) -#define free_dma _set_ver(free_dma, 5d4b914c) -#define disable_hlt _set_ver(disable_hlt, 794487ee) -#define enable_hlt _set_ver(enable_hlt, 9c7077bd) -#define check_region _set_ver(check_region, b91154fb) -#define request_region _set_ver(request_region, 138b0a1e) -#define release_region _set_ver(release_region, f41d6d31) -#define wake_up _set_ver(wake_up, e8d71419) -#define wake_up_interruptible _set_ver(wake_up_interruptible, 64c8cb92) -#define sleep_on _set_ver(sleep_on, 67a00cee) -#define interruptible_sleep_on _set_ver(interruptible_sleep_on, 6a5fc80d) -#define schedule _set_ver(schedule, 01000e51) -#define current _set_ver(current, fc1cb29b) -#define jiffies _set_ver(jiffies, 2f7c7437) -#define xtime _set_ver(xtime, e70c0be0) -#define loops_per_sec _set_ver(loops_per_sec, 40a14192) -#define need_resched _set_ver(need_resched, dfc016ea) -#define kill_proc _set_ver(kill_proc, 911f760a) -#define kill_pg _set_ver(kill_pg, 0a758a45) -#define kill_sl _set_ver(kill_sl, 49625e94) -#define panic _set_ver(panic, 400c0de3) -#define printk _set_ver(printk, ad1148ba) -#define sprintf _set_ver(sprintf, f9003107) -#define vsprintf _set_ver(vsprintf, e605cb6b) -#define simple_strtoul _set_ver(simple_strtoul, bdb8c1e3) -#define system_utsname _set_ver(system_utsname, 066845bc) -#define sys_call_table _set_ver(sys_call_table, 79fa4011) -#define do_signal _set_ver(do_signal, 86f9bc59) -#define send_sig _set_ver(send_sig, 5cddd8d9) -#define setup_arg_pages _set_ver(setup_arg_pages, fe68d94a) -#define copy_strings _set_ver(copy_strings, 232aee96) -#define create_tables _set_ver(create_tables, ba788fa2) -#define do_execve _set_ver(do_execve, 8c99dc0a) -#define flush_old_exec _set_ver(flush_old_exec, c737e178) -#define open_inode _set_ver(open_inode, 27302cb6) -#define read_exec _set_ver(read_exec, a80a2dd0) -#define si_meminfo _set_ver(si_meminfo, bb05fc9a) -#define sock_register _set_ver(sock_register, d68e1649) -#define sock_unregister _set_ver(sock_unregister, 72c332bd) -#define inet_add_protocol _set_ver(inet_add_protocol, 55292121) -#define inet_del_protocol _set_ver(inet_del_protocol, 73908a1b) -#define slhc_init _set_ver(slhc_init, e490a4b8) -#define slhc_free _set_ver(slhc_free, 39ab902b) -#define slhc_remember _set_ver(slhc_remember, db333be6) -#define slhc_compress _set_ver(slhc_compress, e753e2d2) -#define slhc_uncompress _set_ver(slhc_uncompress, 81cc1144) -#define register_netdevice_notifier _set_ver(register_netdevice_notifier, e7aace7c) -#define unregister_netdevice_notifier _set_ver(unregister_netdevice_notifier, be114416) -#define floppy_track_buffer _set_ver(floppy_track_buffer, c6e3f7c2) -#define register_netdev _set_ver(register_netdev, 0d8d1bb4) -#define unregister_netdev _set_ver(unregister_netdev, 25a99579) -#define ether_setup _set_ver(ether_setup, 4eafef91) -#define alloc_skb _set_ver(alloc_skb, b6b523ba) -#define kfree_skb _set_ver(kfree_skb, 0b938572) -#define dev_kfree_skb _set_ver(dev_kfree_skb, aa1fe7f4) -#define netif_rx _set_ver(netif_rx, d8051cb2) -#define dev_rint _set_ver(dev_rint, 040d3f4b) -#define dev_tint _set_ver(dev_tint, 860b350b) -#define irq2dev_map _set_ver(irq2dev_map, 10bdcd8a) -#define dev_add_pack _set_ver(dev_add_pack, 6d7d9be4) -#define dev_remove_pack _set_ver(dev_remove_pack, 784fa59f) -#define dev_get _set_ver(dev_get, 72ed90fd) -#define dev_ioctl _set_ver(dev_ioctl, 08760203) -#define dev_queue_xmit _set_ver(dev_queue_xmit, 4a478225) -#define dev_base _set_ver(dev_base, 0a8809f0) -#define dev_close _set_ver(dev_close, 9bdad56d) -#define arp_find _set_ver(arp_find, a141bd11) -#define n_tty_ioctl _set_ver(n_tty_ioctl, 538e5fa6) -#define tty_register_ldisc _set_ver(tty_register_ldisc, 8fdde939) -#define kill_fasync _set_ver(kill_fasync, 890501b6) -#define in_scan_scsis _set_ver(in_scan_scsis, 21874a88) -#define scsi_register_module _set_ver(scsi_register_module, 8eff1010) -#define scsi_unregister_module _set_ver(scsi_unregister_module, d913b8f0) -#define scsi_free _set_ver(scsi_free, 475dddfa) -#define scsi_malloc _set_ver(scsi_malloc, 1cce3f92) -#define scsi_register _set_ver(scsi_register, d6e77069) -#define scsi_unregister _set_ver(scsi_unregister, 3b0b616b) -#define scsicam_bios_param _set_ver(scsicam_bios_param, 3d965248) -#define scsi_init_malloc _set_ver(scsi_init_malloc, e5167cbc) -#define scsi_init_free _set_ver(scsi_init_free, 8b2721f8) -#define print_command _set_ver(print_command, 6f14cd75) -#define print_msg _set_ver(print_msg, 0465f877) -#define print_status _set_ver(print_status, 32f84646) -#define set_writetime _set_ver(set_writetime, 52131916) -#define sys_tz _set_ver(sys_tz, aa3c9782) -#define __wait_on_super _set_ver(__wait_on_super, 61a5c00a) -#define file_fsync _set_ver(file_fsync, d30a190f) -#define clear_inode _set_ver(clear_inode, da2b0e9f) -#define refile_buffer _set_ver(refile_buffer, 8c69e123) -#define ___strtok _set_ver(___strtok, 8b55d69c) -#define init_fifo _set_ver(init_fifo, 082629c7) -#define super_blocks _set_ver(super_blocks, e1f1ee99) -#define chrdev_inode_operations _set_ver(chrdev_inode_operations, 6ba1faa3) -#define blkdev_inode_operations _set_ver(blkdev_inode_operations, ed443696) -#define read_ahead _set_ver(read_ahead, bbcd3768) -#define get_hash_table _set_ver(get_hash_table, 3b5f3c55) -#define get_empty_inode _set_ver(get_empty_inode, 554bdc75) -#define insert_inode_hash _set_ver(insert_inode_hash, 59b8c371) -#define event _set_ver(event, a6aac9c1) -#define __down _set_ver(__down, 75aa9e96) -#endif /* _KSYMS_VER_ */ -#endif /* CONFIG_MODVERSIONS !__GENKSYMS__ */ diff --git a/include/linux/modversions.h b/include/linux/modversions.h deleted file mode 100644 index 25079e40b..000000000 --- a/include/linux/modversions.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/modules/ksyms.ver> diff --git a/include/linux/mount.h b/include/linux/mount.h new file mode 100644 index 000000000..c2e44397a --- /dev/null +++ b/include/linux/mount.h @@ -0,0 +1,30 @@ +/* + * + * Definitions for mount interface. This describes the in the kernel build + * linkedlist with mounted filesystems. + * + * Author: Marco van Wieringen <mvw@mcs.ow.nl> <mvw@tnix.net> <mvw@cistron.nl> + * + * Version: $Id: mount.h,v 1.3 1994/07/20 22:01:00 mvw Exp mvw $ + * + */ +#ifndef _LINUX_MOUNT_H +#define _LINUX_MOUNT_H + +struct vfsmount +{ + kdev_t mnt_dev; /* Device this applies to */ + char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ + char *mnt_dirname; /* Name of directory mounted on */ + unsigned int mnt_flags; /* Flags of this device */ + struct semaphore mnt_sem; /* lock device while I/O in progress */ + struct super_block *mnt_sb; /* pointer to superblock */ + struct file *mnt_quotas[MAXQUOTAS]; /* fp's to quotafiles */ + time_t mnt_iexp[MAXQUOTAS]; /* expiretime for inodes */ + time_t mnt_bexp[MAXQUOTAS]; /* expiretime for blocks */ + struct vfsmount *mnt_next; /* pointer to next in linkedlist */ +}; + +struct vfsmount *lookup_vfsmnt(kdev_t dev); + +#endif /* _LINUX_MOUNT_H */ diff --git a/include/linux/mouse.h b/include/linux/mouse.h deleted file mode 100644 index df4e42718..000000000 --- a/include/linux/mouse.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _LINUX_MOUSE_H -#define _LINUX_MOUSE_H - -#define BUSMOUSE_MINOR 0 -#define PSMOUSE_MINOR 1 -#define MS_BUSMOUSE_MINOR 2 -#define ATIXL_BUSMOUSE_MINOR 3 - -unsigned long mouse_init(unsigned long); - -#endif diff --git a/include/linux/mroute.h b/include/linux/mroute.h new file mode 100644 index 000000000..6772a60f8 --- /dev/null +++ b/include/linux/mroute.h @@ -0,0 +1,173 @@ +#ifndef __LINUX_MROUTE_H +#define __LINUX_MROUTE_H + +#include <linux/sockios.h> +#include <linux/in.h> + +/* + * Based on the MROUTING 3.5 defines primarily to keep + * source compatibility with BSD. + * + * See the mrouted code for the original history. + * + */ + +#define MRT_BASE 200 +#define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */ +#define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */ +#define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */ +#define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */ +#define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */ +#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ +#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ +#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ + +#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ +#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) + +#define MAXVIFS 32 +typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */ +typedef unsigned short vifi_t; +#define ALL_VIFS ((vifi_t)(-1)) + +/* + * Same idea as select + */ + +#define VIFM_SET(n,m) ((m)|=(1<<(n))) +#define VIFM_CLR(n,m) ((m)&=~(1<<(n))) +#define VIFM_ISSET(n,m) ((m)&(1<<(n))) +#define VIFM_CLRALL(m) ((m)=0) +#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom)) +#define VIFM_SAME(m1,m2) ((m1)==(m2)) + +/* + * Passed by mrouted for an MRT_ADD_VIF - again we use the + * mrouted 3.6 structures for compatibility + */ + +struct vifctl { + vifi_t vifc_vifi; /* Index of VIF */ + unsigned char vifc_flags; /* VIFF_ flags */ + unsigned char vifc_threshold; /* ttl limit */ + unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ + struct in_addr vifc_lcl_addr; /* Our address */ + struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */ +}; + +#define VIFF_TUNNEL 0x1 /* IPIP tunnel */ +#define VIFF_SRCRT 0x02 /* NI */ + +/* + * Cache manipulation structures for mrouted + */ + +struct mfcctl +{ + struct in_addr mfcc_origin; /* Origin of mcast */ + struct in_addr mfcc_mcastgrp; /* Group in question */ + vifi_t mfcc_parent; /* Where it arrived */ + unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */ +}; + +/* + * Group count retrieval for mrouted + */ + +struct sioc_sg_req +{ + struct in_addr src; + struct in_addr grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; +}; + +/* + * To get vif packet counts + */ + +struct sioc_vif_req +{ + vifi_t vifi; /* Which iface */ + unsigned long icount; /* In packets */ + unsigned long ocount; /* Out packets */ + unsigned long ibytes; /* In bytes */ + unsigned long obytes; /* Out bytes */ +}; + +/* + * This is the format the mroute daemon expects to see IGMP control + * data. Magically happens to be like an IP packet as per the original + */ + +struct igmpmsg +{ + unsigned long unused1,unused2; + unsigned char im_msgtype; /* What is this */ + unsigned char im_mbz; /* Must be zero */ + unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */ + unsigned char unused3; + struct in_addr im_src,im_dst; +}; + +/* + * That's all usermode folks + */ + +#ifdef __KERNEL__ +extern struct sock *mroute_socket; +extern int ip_mroute_setsockopt(struct sock *, int, char *, int); +extern int ip_mroute_getsockopt(struct sock *, int, char *, int *); +extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg); +extern void mroute_close(struct sock *sk); +extern void ipmr_forward(struct sk_buff *skb, int is_frag); + + +struct vif_device +{ + struct device *dev; /* Device we are using */ + struct route *rt_cache; /* Tunnel route cache */ + unsigned long bytes_in,bytes_out; + unsigned long pkt_in,pkt_out; /* Statistics */ + unsigned long rate_limit; /* Traffic shaping (NI) */ + unsigned char threshold; /* TTL threshold */ + unsigned short flags; /* Control flags */ + unsigned long local,remote; /* Addresses(remote for tunnels)*/ +}; + +struct mfc_cache +{ + struct mfc_cache *next; /* Next entry on cache line */ + __u32 mfc_mcastgrp; /* Group the entry belongs to */ + __u32 mfc_origin; /* Source of packet */ + vifi_t mfc_parent; /* Source interface */ + struct timer_list mfc_timer; /* Expiry timer */ + int mfc_flags; /* Flags on line */ + struct sk_buff_head mfc_unresolved; /* Unresolved buffers */ + int mfc_queuelen; /* Unresolved buffer counter */ + unsigned char mfc_ttls[MAXVIFS]; /* TTL thresholds */ +}; + +#define MFC_QUEUED 1 +#define MFC_RESOLVED 2 + + +#define MFC_LINES 64 + +#ifdef __BIG_ENDIAN +#define MFC_HASH(a,b) ((((a)>>24)^((b)>>26))&(MFC_LINES-1)) +#else +#define MFC_HASH(a,b) (((a)^((b)>>2))&(MFC_LINES-1)) +#endif + +#endif + +/* + * Pseudo messages used by mrouted + */ + +#define IGMPMSG_NOCACHE 1 /* Kernel cache fill request to mrouted */ +#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */ + +#endif diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index fa2dd9fa9..7aef08e01 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -21,6 +21,9 @@ #define FAT_CACHE 8 /* FAT cache size */ +#define MSDOS_MAX_EXTRA 3 /* tolerate up to that number of clusters which are + inaccessible because the FAT is too short */ + #define ATTR_RO 1 /* read-only */ #define ATTR_HIDDEN 2 /* hidden */ #define ATTR_SYS 4 /* system */ @@ -31,10 +34,26 @@ #define ATTR_NONE 0 /* no attribute bits */ #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) /* attribute bits that are copied "as is" */ +#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) + /* bits that are used by the Windows 95/Windows NT extended FAT */ + +#define ATTR_DIR_READ_BOTH 512 /* read both short and long names from the + * vfat filesystem. This is used by Samba + * to export the vfat filesystem with correct + * shortnames. */ +#define ATTR_DIR_READ_SHORT 1024 + +#define CASE_LOWER_BASE 8 /* base is lower case */ +#define CASE_LOWER_EXT 16 /* extension is lower case */ + +#define SCAN_ANY 0 /* either hidden or not */ +#define SCAN_HID 1 /* only hidden */ +#define SCAN_NOTHID 2 /* only not hidden */ +#define SCAN_NOTANY 3 /* test name, then use SCAN_HID or SCAN_NOTHID */ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ -#define IS_FREE(n) (!*(n) || *(unsigned char *) (n) == DELETED_FLAG || \ - *(unsigned char *) (n) == FD_FILL_BYTE) +#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG || \ + *(const unsigned char *) (n) == FD_FILL_BYTE) #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) /* valid file mode bits */ @@ -43,16 +62,29 @@ #define MSDOS_I(i) (&((i)->u.msdos_i)) #define MSDOS_NAME 11 /* maximum name length */ +#define MSDOS_LONGNAME 256 /* maximum name length */ +#define MSDOS_SLOTS 21 /* max # of slots needed for short and long names */ #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ #define MSDOS_FAT12 4078 /* maximum number of clusters in a 12 bit FAT */ /* + * Inode flags + */ +#define FAT_BINARY_FL 0x00000001 /* File contains binary data */ + +/* + * ioctl commands + */ +#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, long) +#define VFAT_IOCTL_READDIR_SHORT _IOW('r', 2, long) + +/* * Conversion from and to little-endian byte order. (no-op on i386/i486) * - * Naming: Ca_b_c, where a: F = from, T = to, b: LE = little-endian, BE = big- - * endian, c: W = word (16 bits), L = longword (32 bits) + * Naming: Ca_b_c, where a: F = from, T = to, b: LE = little-endian, + * BE = big-endian, c: W = word (16 bits), L = longword (32 bits) */ #define CF_LE_W(v) (v) @@ -82,106 +114,164 @@ struct msdos_boot_sector { struct msdos_dir_entry { __s8 name[8],ext[3]; /* name and extension */ __u8 attr; /* attribute bits */ - __u8 unused[10]; + __u8 lcase; /* Case for base and extension */ + __u8 ctime_ms; /* Creation time, milliseconds */ + __u16 ctime; /* Creation time */ + __u16 cdate; /* Creation date */ + __u16 adate; /* Last access date */ + __u8 unused[2]; __u16 time,date,start;/* time, date and first cluster */ __u32 size; /* file size (in bytes) */ }; -struct fat_cache { - int device; /* device number. 0 means unused. */ - int ino; /* inode number. */ - int file_cluster; /* cluster number in the file. */ - int disk_cluster; /* cluster number on disk. */ - struct fat_cache *next; /* next cache entry */ +/* Up to 13 characters of the name */ +struct msdos_dir_slot { + __u8 id; /* sequence number for slot */ + __u8 name0_4[10]; /* first 5 characters in name */ + __u8 attr; /* attribute byte */ + __u8 reserved; /* always 0 */ + __u8 alias_checksum; /* checksum for 8.3 alias */ + __u8 name5_10[12]; /* 6 more characters in name */ + __u8 start[2]; /* starting cluster number */ + __u8 name11_12[4]; /* last 2 characters in name */ }; -/* Determine whether this FS has kB-aligned data. */ +struct slot_info { + int is_long; /* was the found entry long */ + int long_slots; /* number of long slots in filename */ + int total_slots; /* total slots (long and short) */ + loff_t longname_offset; /* dir offset for longname start */ + loff_t shortname_offset; /* dir offset for shortname start */ + int ino; /* ino for the file */ +}; +/* Determine whether this FS has kB-aligned data. */ #define MSDOS_CAN_BMAP(mib) (!(((mib)->cluster_size & 1) || \ ((mib)->data_start & 1))) /* Convert attribute bits and a mask to the UNIX mode. */ - #define MSDOS_MKMODE(a,m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) /* Convert the UNIX mode to MS-DOS attribute bits. */ - #define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO) + #ifdef __KERNEL__ -/* misc.c */ +typedef int (*fat_filldir_t)(filldir_t filldir, void *, const char *, + int, int, off_t, off_t, int, ino_t); + +struct fat_cache { + kdev_t device; /* device number. 0 means unused. */ + int ino; /* inode number. */ + int file_cluster; /* cluster number in the file. */ + int disk_cluster; /* cluster number on disk. */ + struct fat_cache *next; /* next cache entry */ +}; -extern void fs_panic(struct super_block *s,char *msg); +/* misc.c */ extern int is_binary(char conversion,char *extension); -extern void lock_creation(void); -extern void unlock_creation(void); extern void lock_fat(struct super_block *sb); extern void unlock_fat(struct super_block *sb); -extern int msdos_add_cluster(struct inode *inode); +extern int fat_add_cluster(struct inode *inode); extern int date_dos2unix(__u16 time, __u16 date); -extern void date_unix2dos(int unix_date,__u16 *time, __u16 *date); -extern int msdos_get_entry(struct inode *dir,loff_t *pos,struct buffer_head **bh, - struct msdos_dir_entry **de); -extern int msdos_scan(struct inode *dir,char *name,struct buffer_head **res_bh, - struct msdos_dir_entry **res_de,int *ino); -extern int msdos_parent_ino(struct inode *dir,int locked); -extern int msdos_subdirs(struct inode *dir); +extern void fat_fs_panic(struct super_block *s,const char *msg); +extern void fat_lock_creation(void); +extern void fat_unlock_creation(void); +extern void fat_date_unix2dos(int unix_date,__u16 *time, __u16 *date); +extern int fat_get_entry(struct inode *dir,loff_t *pos,struct buffer_head **bh, + struct msdos_dir_entry **de); +extern int fat_scan(struct inode *dir,const char *name,struct buffer_head **res_bh, + struct msdos_dir_entry **res_de,int *ino,char scantype); +extern int fat_parent_ino(struct inode *dir,int locked); +extern int fat_subdirs(struct inode *dir); /* fat.c */ - extern int fat_access(struct super_block *sb,int nr,int new_value); -extern int msdos_smap(struct inode *inode,int sector); +extern int fat_smap(struct inode *inode,int sector); extern int fat_free(struct inode *inode,int skip); +void fat_cache_inval_inode(struct inode *inode); +void fat_cache_inval_dev(kdev_t device); extern void cache_init(void); void cache_lookup(struct inode *inode,int cluster,int *f_clu,int *d_clu); void cache_add(struct inode *inode,int f_clu,int d_clu); -void cache_inval_inode(struct inode *inode); -void cache_inval_dev(int device); int get_cluster(struct inode *inode,int cluster); -/* namei.c */ - -extern int msdos_lookup(struct inode *dir,const char *name,int len, - struct inode **result); -extern int msdos_create(struct inode *dir,const char *name,int len,int mode, - struct inode **result); -extern int msdos_mkdir(struct inode *dir,const char *name,int len,int mode); -extern int msdos_rmdir(struct inode *dir,const char *name,int len); -extern int msdos_unlink(struct inode *dir,const char *name,int len); -extern int msdos_unlink_umsdos(struct inode *dir,const char *name,int len); -extern int msdos_rename(struct inode *old_dir,const char *old_name,int old_len, - struct inode *new_dir,const char *new_name,int new_len); - /* inode.c */ - -extern void msdos_put_inode(struct inode *inode); +extern int fat_bmap(struct inode *inode,int block); +extern int fat_notify_change(struct inode *,struct iattr *); +extern void fat_put_inode(struct inode *inode); +extern void fat_put_super(struct super_block *sb); +extern void fat_read_inode(struct inode *inode, struct inode_operations *dir_ops); +extern struct super_block *fat_read_super(struct super_block *s, void *data, int silent); extern void msdos_put_super(struct super_block *sb); -extern struct super_block *msdos_read_super(struct super_block *s, - void *data,int); -extern void msdos_statfs(struct super_block *sb,struct statfs *buf, int); -extern int msdos_bmap(struct inode *inode,int block); -extern void msdos_read_inode(struct inode *inode); -extern void msdos_write_inode(struct inode *inode); -extern int msdos_notify_change(struct inode *,struct iattr *); +extern void fat_statfs(struct super_block *sb,struct statfs *buf, int); +extern void fat_write_inode(struct inode *inode); /* dir.c */ +extern struct file_operations fat_dir_operations; +extern int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, + fat_filldir_t fat_filldir, filldir_t filldir, + int shortnames, int longnames, int both); +extern int fat_readdir(struct inode *inode, struct file *filp, + void *dirent, filldir_t); +extern int fat_dir_ioctl(struct inode * inode, struct file * filp, + unsigned int cmd, unsigned long arg); -extern struct inode_operations msdos_dir_inode_operations; -extern int msdos_readdir (struct inode *inode, struct file *filp, - void *dirent, filldir_t); /* file.c */ +extern struct inode_operations fat_file_inode_operations; +extern struct inode_operations fat_file_inode_operations_1024; +extern long fat_file_read(struct inode *, struct file *, char *, unsigned long); +extern long fat_file_write(struct inode *, struct file *, const char *, unsigned long); +extern void fat_truncate(struct inode *inode); -extern struct inode_operations msdos_file_inode_operations; -extern struct inode_operations msdos_file_inode_operations_1024; -extern int msdos_file_read(struct inode *, struct file *, char *, int); -extern int msdos_file_write(struct inode *, struct file *, char *, int); -extern struct inode_operations msdos_file_inode_operations_no_bmap; +/* mmap.c */ +extern int fat_mmap(struct inode *, struct file *, struct vm_area_struct *); -extern void msdos_truncate(struct inode *inode); -/* mmap.c */ -extern int msdos_mmap(struct inode *, struct file *, struct vm_area_struct *); +/* vfat.c */ +extern int init_vfat_fs(void); + + +/* msdosfs_syms.c */ +extern int init_msdos_fs(void); +extern struct file_system_type msdos_fs_type; + +/* msdos.c */ +extern struct super_block *msdos_read_super(struct super_block *sb,void *data, int silent); + +/* msdos.c - these are for Umsdos */ +extern void msdos_read_inode(struct inode *inode); +extern int msdos_lookup(struct inode *dir,const char *name,int len, + struct inode **result); +extern int msdos_create(struct inode *dir,const char *name,int len,int mode, + struct inode **result); +extern int msdos_rmdir(struct inode *dir,const char *name,int len); +extern int msdos_mkdir(struct inode *dir,const char *name,int len,int mode); +extern int msdos_unlink(struct inode *dir,const char *name,int len); +extern int msdos_unlink_umsdos(struct inode *dir,const char *name,int len); +extern int msdos_rename(struct inode *old_dir,const char *old_name,int old_len, + struct inode *new_dir,const char *new_name,int new_len, + int must_be_dir); + +/* fatfs_syms.c */ +extern int init_fat_fs(void); + +/* vfat/namei.c - these are for dmsdos */ +extern int vfat_create(struct inode *dir,const char *name,int len,int mode, + struct inode **result); +extern int vfat_unlink(struct inode *dir,const char *name,int len); +extern int vfat_mkdir(struct inode *dir,const char *name,int len,int mode); +extern int vfat_rmdir(struct inode *dir,const char *name,int len); +extern int vfat_rename(struct inode *old_dir,const char *old_name,int old_len, + struct inode *new_dir,const char *new_name,int new_len, + int must_be_dir); +extern void vfat_put_super(struct super_block *sb); +extern struct super_block *vfat_read_super(struct super_block *sb,void *data, + int silent); +extern void vfat_read_inode(struct inode *inode); +extern int vfat_lookup(struct inode *dir,const char *name,int len, + struct inode **result); #endif /* __KERNEL__ */ diff --git a/include/linux/msdos_fs_i.h b/include/linux/msdos_fs_i.h index b11e22483..cc9d9ac85 100644 --- a/include/linux/msdos_fs_i.h +++ b/include/linux/msdos_fs_i.h @@ -33,6 +33,10 @@ struct msdos_inode_info { current inode */ struct inode *i_old; /* pointer to the old inode this inode depends on */ + struct inode *i_linked; /* pointer to inode linked to the current one, + happens when an open file is moved */ + struct inode *i_oldlink;/* pointer to open inode that references + the same file */ int i_binary; /* file contains non-text data */ }; diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h index 8e5f3041b..bf5ea6345 100644 --- a/include/linux/msdos_fs_sb.h +++ b/include/linux/msdos_fs_sb.h @@ -5,6 +5,23 @@ * MS-DOS file system in-core superblock data */ +struct fat_mount_options { + uid_t fs_uid; + gid_t fs_gid; + unsigned short fs_umask; + unsigned char name_check; /* r = relaxed, n = normal, s = strict */ + unsigned char conversion; /* b = binary, t = text, a = auto */ + unsigned quiet:1, /* set = fake successful chmods and chowns */ + showexec:1, /* set = only set x bit for com/exe/bat */ + sys_immutable:1, /* set = system files are immutable */ + dotsOK:1, /* set = hidden and system files are named '.filename' */ + isvfat:1, /* 0=no vfat long filename support, 1=vfat support */ + unicode_xlate:1, /* create escape sequences for unhandled Unicode */ + posixfs:1, /* Allow names like makefile and Makefile to coexist */ + numtail:1; /* Does first alias have a numeric '~1' type tail? */ +}; + + struct msdos_sb_info { unsigned short cluster_size; /* sectors/cluster */ unsigned char fats,fat_bits; /* number of FATs, FAT bits (12 or 16) */ @@ -12,16 +29,11 @@ struct msdos_sb_info { unsigned short dir_start,dir_entries; /* root dir start & entries */ unsigned short data_start; /* first data sector */ unsigned long clusters; /* number of clusters */ - uid_t fs_uid; - gid_t fs_gid; - int quiet; /* fake successful chmods and chowns */ - unsigned short fs_umask; - unsigned char name_check; /* r = relaxed, n = normal, s = strict */ - unsigned char conversion; /* b = binary, t = text, a = auto */ struct wait_queue *fat_wait; int fat_lock; - int prev_free; /* previously returned free cluster number */ - int free_clusters; /* -1 if undefined */ + int prev_free; /* previously returned free cluster number */ + int free_clusters; /* -1 if undefined */ + struct fat_mount_options options; }; #endif diff --git a/include/linux/msg.h b/include/linux/msg.h index f31a08038..2be627198 100644 --- a/include/linux/msg.h +++ b/include/linux/msg.h @@ -1,44 +1,49 @@ #ifndef _LINUX_MSG_H #define _LINUX_MSG_H + #include <linux/ipc.h> +/* ipcs ctl commands */ +#define MSG_STAT 11 +#define MSG_INFO 12 + /* msgrcv options */ #define MSG_NOERROR 010000 /* no error if message is too big */ #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ /* one msqid structure for each queue on the system */ struct msqid_ds { - struct ipc_perm msg_perm; - struct msg *msg_first; /* first message on queue */ - struct msg *msg_last; /* last message in queue */ - time_t msg_stime; /* last msgsnd time */ - time_t msg_rtime; /* last msgrcv time */ - time_t msg_ctime; /* last change time */ - struct wait_queue *wwait; - struct wait_queue *rwait; - ushort msg_cbytes; /* current number of bytes on queue */ - ushort msg_qnum; /* number of messages in queue */ - ushort msg_qbytes; /* max number of bytes on queue */ - ushort msg_lspid; /* pid of last msgsnd */ - ushort msg_lrpid; /* last receive pid */ + struct ipc_perm msg_perm; + struct msg *msg_first; /* first message on queue */ + struct msg *msg_last; /* last message in queue */ + __kernel_time_t msg_stime; /* last msgsnd time */ + __kernel_time_t msg_rtime; /* last msgrcv time */ + __kernel_time_t msg_ctime; /* last change time */ + struct wait_queue *wwait; + struct wait_queue *rwait; + unsigned short msg_cbytes; /* current number of bytes on queue */ + unsigned short msg_qnum; /* number of messages in queue */ + unsigned short msg_qbytes; /* max number of bytes on queue */ + __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ + __kernel_ipc_pid_t msg_lrpid; /* last receive pid */ }; /* message buffer for msgsnd and msgrcv calls */ struct msgbuf { - long mtype; /* type of message */ - char mtext[1]; /* message text */ + long mtype; /* type of message */ + char mtext[1]; /* message text */ }; /* buffer for msgctl calls IPC_INFO, MSG_INFO */ struct msginfo { - int msgpool; - int msgmap; - int msgmax; - int msgmnb; - int msgmni; - int msgssz; - int msgtql; - ushort msgseg; + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short msgseg; }; #define MSGMNI 128 /* <= 1K */ /* max # of msg queue identifiers */ @@ -57,15 +62,18 @@ struct msginfo { /* one msg structure for each message */ struct msg { - struct msg *msg_next; /* next message on queue */ - long msg_type; - char *msg_spot; /* message text address */ - short msg_ts; /* message text size */ + struct msg *msg_next; /* next message on queue */ + long msg_type; + char *msg_spot; /* message text address */ + time_t msg_stime; /* msgsnd time */ + short msg_ts; /* message text size */ }; -/* ipcs ctl commands */ -#define MSG_STAT 11 -#define MSG_INFO 12 +asmlinkage int sys_msgget (key_t key, int msgflg); +asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg); +asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, + int msgflg); +asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf); #endif /* __KERNEL__ */ diff --git a/include/linux/mtio.h b/include/linux/mtio.h index f995bd2f9..22cec7aaa 100644 --- a/include/linux/mtio.h +++ b/include/linux/mtio.h @@ -1,5 +1,4 @@ -/* $Id: /usr/src/linux-1.1.64/include/linux/mtio.h at Tue Jan 10 21:02:51 1995 by root@kai.home$ - * +/* * linux/mtio.h header file for Linux. Written by H. Bergman */ @@ -43,7 +42,6 @@ struct mtop { #define MTRAS2 15 /* run self test 2 (destructive) */ #define MTRAS3 16 /* reserved for self test 3 */ - #define MTSETBLK 20 /* set block length (SCSI) */ #define MTSETDENSITY 21 /* set tape density (SCSI) */ #define MTSEEK 22 /* seek to block (Tandberg, etc.) */ @@ -54,6 +52,14 @@ struct mtop { #define MTBSS 26 /* space backward over setmarks */ #define MTWSM 27 /* write setmarks */ +#define MTLOCK 28 /* lock the drive door */ +#define MTUNLOCK 29 /* unlock the drive door */ +#define MTLOAD 30 /* execute the SCSI load command */ +#define MTUNLOAD 31 /* execute the SCSI unload command */ +#define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */ +#define MTSETPART 33 /* Change the active tape partition */ +#define MTMKPART 34 /* Format the tape with one or two partitions */ + /* structure for MTIOCGET - mag tape get status command */ struct mtget { @@ -68,8 +74,8 @@ struct mtget { long mt_gstat; /* generic (device independent) status */ long mt_erreg; /* error register */ /* The next two fields are not always used */ - daddr_t mt_fileno; /* number of current file on tape */ - daddr_t mt_blkno; /* current block number */ + __kernel_daddr_t mt_fileno; /* number of current file on tape */ + __kernel_daddr_t mt_blkno; /* current block number */ }; @@ -97,23 +103,11 @@ struct mtget { #define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */ #define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */ -/* QIC-40/QIC-80 ftape supported drives. - * 20bit vendor ID + 0x800000 +/* QIC-40/80/3010/3020 ftape supported drives. + * 20bit vendor ID + 0x800000 (see vendors.h in ftape distribution) */ -#define MT_ISFTAPE_UNKNOWN 0x800000 -#define MT_ISCMSDJ10_DJ20 0x800047 -#define MT_ISCMSDJ10_DJ20_NEW 0x8011c4 -#define MT_ISARCHIVE_5580I 0x800005 -#define MT_ISARCHIVE_XL9250I 0x80014a -#define MT_ISARCHIVE_31250Q 0x800146 -#define MT_ISINSIGHT_80 0x810005 -#define MT_ISCONNER_C250MQT 0x80014c -#define MT_ISWANGTEK_2040F 0x8001c1 -#define MT_ISWANGTEK_2080F 0x8001c8 -#define MT_ISIOMEGA_250 0x808880 -#define MT_ISSUMMIT_SE150 0x800180 -#define MT_ISSUMMIT_SE250 0x800181 -#define MT_ISESCOM_IDTBU120E 0x800140 +#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ +#define MT_ISFTAPE_FLAG 0x800000 struct mt_tape_info { long t_type; /* device type id (mt_type) */ @@ -137,20 +131,6 @@ struct mt_tape_info { {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \ {MT_ISSCSI1, "Generic SCSI-1 tape"}, \ {MT_ISSCSI2, "Generic SCSI-2 tape"}, \ - {MT_ISFTAPE_UNKNOWN, "Unknown floppy interface tape drive"},\ - {MT_ISCMSDJ10_DJ20, "Colorado DJ-10/DJ-20"},\ - {MT_ISCMSDJ10_DJ20_NEW, "Colorado DJ-10/DJ-20 (new)"},\ - {MT_ISARCHIVE_5580I, "Archive 5580i"},\ - {MT_ISARCHIVE_XL9250I, "Archive XL9250i [Conner/Escom]"},\ - {MT_ISARCHIVE_31250Q, "Escom/Archive 31250Q"},\ - {MT_ISINSIGHT_80, "Insight 80 Mb"},\ - {MT_ISCONNER_C250MQT, "Conner C250MQT"},\ - {MT_ISWANGTEK_2040F, "Wangtek 3040F"},\ - {MT_ISWANGTEK_2080F, "Wangtek 3080F"},\ - {MT_ISIOMEGA_250, "Iomega 250"},\ - {MT_ISSUMMIT_SE150, "Summit SE 150"},\ - {MT_ISSUMMIT_SE250, "Summit SE 250/Mountain FS8000"},\ - {MT_ISESCOM_IDTBU120E, "Identity IDTBU120E, Escom?"},\ {0, NULL} \ } @@ -162,6 +142,35 @@ struct mtpos { }; +/* structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended + * as an interim solution for QIC-02 until DDI is fully implemented. + */ +struct mtconfiginfo { + long mt_type; /* drive type */ + long ifc_type; /* interface card type */ + unsigned short irqnr; /* IRQ number to use */ + unsigned short dmanr; /* DMA channel to use */ + unsigned short port; /* IO port base address */ + + unsigned long debug; /* debugging flags */ + + unsigned have_dens:1; + unsigned have_bsf:1; + unsigned have_fsr:1; + unsigned have_bsr:1; + unsigned have_eod:1; + unsigned have_seek:1; + unsigned have_tell:1; + unsigned have_ras1:1; + unsigned have_ras2:1; + unsigned have_ras3:1; + unsigned have_qfa:1; + + unsigned pad1:5; + char reserved[10]; +}; + + /* mag tape io control commands */ #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ @@ -173,7 +182,6 @@ struct mtpos { #define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* get tape config */ #define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* set tape config */ - /* Generic Mag Tape (device independent) status macros for examining * mt_gstat -- HP-UX compatible. * There is room for more generic status bits here, but I don't @@ -198,12 +206,9 @@ struct mtpos { #define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */ /* 16 generic status bits unused */ -/* DDS drives have 'setmarks', sort of like filemarks but used to group - * files, rather than blocks. Not used. Not supported. - * I think DDS drives are DAT drives. - */ /* SCSI-tape specific definitions */ +/* Bitfield shifts in the status */ #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 @@ -212,14 +217,32 @@ struct mtpos { #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff +/* Bitfields for the MTSETDRVBUFFER ioctl */ #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 +#define MT_ST_SETBOOLEANS 0x30000000 +#define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 +#define MT_ST_DEF_BLKSIZE 0x50000000 +#define MT_ST_DEF_OPTIONS 0x60000000 + #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 +#define MT_ST_AUTO_LOCK 0x40 +#define MT_ST_DEF_WRITES 0x80 +#define MT_ST_CAN_BSR 0x100 +#define MT_ST_NO_BLKLIMS 0x200 +#define MT_ST_CAN_PARTITIONS 0x400 +#define MT_ST_SCSI2LOGICAL 0x800 + +/* The mode parameters to be controlled. Parameter chosen with bits 20-28 */ +#define MT_ST_CLEAR_DEFAULT 0xfffff +#define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) +#define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) +#define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) #endif /* _LINUX_MTIO_H */ diff --git a/include/linux/ncp.h b/include/linux/ncp.h new file mode 100644 index 000000000..3d5286ec1 --- /dev/null +++ b/include/linux/ncp.h @@ -0,0 +1,304 @@ +/* + * ncp.h + * + * Copyright (C) 1995 by Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_H +#define _LINUX_NCP_H + +#include <linux/types.h> +#include <linux/ipx.h> + +#define NCP_PTYPE (0x11) +#define NCP_PORT (0x0451) + +#define NCP_ALLOC_SLOT_REQUEST (0x1111) +#define NCP_REQUEST (0x2222) +#define NCP_DEALLOC_SLOT_REQUEST (0x5555) + +struct ncp_request_header { + __u16 type __attribute__ ((packed)); + __u8 sequence __attribute__ ((packed)); + __u8 conn_low __attribute__ ((packed)); + __u8 task __attribute__ ((packed)); + __u8 conn_high __attribute__ ((packed)); + __u8 function __attribute__ ((packed)); + __u8 data[0] __attribute__ ((packed)); +}; + +#define NCP_REPLY (0x3333) +#define NCP_POSITIVE_ACK (0x9999) + +struct ncp_reply_header { + __u16 type __attribute__ ((packed)); + __u8 sequence __attribute__ ((packed)); + __u8 conn_low __attribute__ ((packed)); + __u8 task __attribute__ ((packed)); + __u8 conn_high __attribute__ ((packed)); + __u8 completion_code __attribute__ ((packed)); + __u8 connection_state __attribute__ ((packed)); + __u8 data[0] __attribute__ ((packed)); +}; + + +#define NCP_BINDERY_USER (0x0001) +#define NCP_BINDERY_UGROUP (0x0002) +#define NCP_BINDERY_PQUEUE (0x0003) +#define NCP_BINDERY_FSERVER (0x0004) +#define NCP_BINDERY_NAME_LEN (48) +struct ncp_bindery_object { + __u32 object_id; + __u16 object_type; + __u8 object_name[NCP_BINDERY_NAME_LEN]; + __u8 object_flags; + __u8 object_security; + __u8 object_has_prop; +}; + +struct nw_property { + __u8 value[128]; + __u8 more_flag; + __u8 property_flag; +}; + +struct prop_net_address { + __u32 network __attribute__ ((packed)); + __u8 node[IPX_NODE_LEN] __attribute__ ((packed)); + __u16 port __attribute__ ((packed)); +}; + +#define NCP_VOLNAME_LEN (16) +#define NCP_NUMBER_OF_VOLUMES (64) +struct ncp_volume_info { + __u32 total_blocks; + __u32 free_blocks; + __u32 purgeable_blocks; + __u32 not_yet_purgeable_blocks; + __u32 total_dir_entries; + __u32 available_dir_entries; + __u8 sectors_per_block; + char volume_name[NCP_VOLNAME_LEN+1]; +}; + +struct ncp_filesearch_info { + __u8 volume_number; + __u16 directory_id; + __u16 sequence_no; + __u8 access_rights; +}; + +#define NCP_MAX_FILENAME 14 + +/* these define the attribute byte as seen by NCP */ +#define aRONLY (1L<<0) +#define aHIDDEN (1L<<1) +#define aSYSTEM (1L<<2) +#define aEXECUTE (1L<<3) +#define aDIR (1L<<4) +#define aARCH (1L<<5) + +#define AR_READ (0x01) +#define AR_WRITE (0x02) +#define AR_EXCLUSIVE (0x20) + +#define NCP_FILE_ID_LEN 6 +struct ncp_file_info { + __u8 file_id[NCP_FILE_ID_LEN]; + char file_name[NCP_MAX_FILENAME+1]; + __u8 file_attributes; + __u8 file_mode; + __u32 file_length; + __u16 creation_date; + __u16 access_date; + __u16 update_date; + __u16 update_time; +}; + +/* Defines for Name Spaces */ +#define NW_NS_DOS 0 +#define NW_NS_MAC 1 +#define NW_NS_NFS 2 +#define NW_NS_FTAM 3 +#define NW_NS_OS2 4 + +/* Defines for ReturnInformationMask */ +#define RIM_NAME (0x0001L) +#define RIM_SPACE_ALLOCATED (0x0002L) +#define RIM_ATTRIBUTES (0x0004L) +#define RIM_DATA_SIZE (0x0008L) +#define RIM_TOTAL_SIZE (0x0010L) +#define RIM_EXT_ATTR_INFO (0x0020L) +#define RIM_ARCHIVE (0x0040L) +#define RIM_MODIFY (0x0080L) +#define RIM_CREATION (0x0100L) +#define RIM_OWNING_NAMESPACE (0x0200L) +#define RIM_DIRECTORY (0x0400L) +#define RIM_RIGHTS (0x0800L) +#define RIM_ALL (0x0FFFL) +#define RIM_COMPRESSED_INFO (0x80000000L) + +/* open/create modes */ +#define OC_MODE_OPEN 0x01 +#define OC_MODE_TRUNCATE 0x02 +#define OC_MODE_REPLACE 0x02 +#define OC_MODE_CREATE 0x08 + +/* open/create results */ +#define OC_ACTION_NONE 0x00 +#define OC_ACTION_OPEN 0x01 +#define OC_ACTION_CREATE 0x02 +#define OC_ACTION_TRUNCATE 0x04 +#define OC_ACTION_REPLACE 0x04 + +/* access rights attributes */ +#ifndef AR_READ_ONLY +#define AR_READ_ONLY 0x0001 +#define AR_WRITE_ONLY 0x0002 +#define AR_DENY_READ 0x0004 +#define AR_DENY_WRITE 0x0008 +#define AR_COMPATIBILITY 0x0010 +#define AR_WRITE_THROUGH 0x0040 +#define AR_OPEN_COMPRESSED 0x0100 +#endif + +struct nw_info_struct +{ + __u32 spaceAlloc __attribute__ ((packed)); + __u32 attributes __attribute__ ((packed)); + __u16 flags __attribute__ ((packed)); + __u32 dataStreamSize __attribute__ ((packed)); + __u32 totalStreamSize __attribute__ ((packed)); + __u16 numberOfStreams __attribute__ ((packed)); + __u16 creationTime __attribute__ ((packed)); + __u16 creationDate __attribute__ ((packed)); + __u32 creatorID __attribute__ ((packed)); + __u16 modifyTime __attribute__ ((packed)); + __u16 modifyDate __attribute__ ((packed)); + __u32 modifierID __attribute__ ((packed)); + __u16 lastAccessDate __attribute__ ((packed)); + __u16 archiveTime __attribute__ ((packed)); + __u16 archiveDate __attribute__ ((packed)); + __u32 archiverID __attribute__ ((packed)); + __u16 inheritedRightsMask __attribute__ ((packed)); + __u32 dirEntNum __attribute__ ((packed)); + __u32 DosDirNum __attribute__ ((packed)); + __u32 volNumber __attribute__ ((packed)); + __u32 EADataSize __attribute__ ((packed)); + __u32 EAKeyCount __attribute__ ((packed)); + __u32 EAKeySize __attribute__ ((packed)); + __u32 NSCreator __attribute__ ((packed)); + __u8 nameLen __attribute__ ((packed)); + __u8 entryName[256] __attribute__ ((packed)); +}; + +/* modify mask - use with MODIFY_DOS_INFO structure */ +#define DM_ATTRIBUTES (0x0002L) +#define DM_CREATE_DATE (0x0004L) +#define DM_CREATE_TIME (0x0008L) +#define DM_CREATOR_ID (0x0010L) +#define DM_ARCHIVE_DATE (0x0020L) +#define DM_ARCHIVE_TIME (0x0040L) +#define DM_ARCHIVER_ID (0x0080L) +#define DM_MODIFY_DATE (0x0100L) +#define DM_MODIFY_TIME (0x0200L) +#define DM_MODIFIER_ID (0x0400L) +#define DM_LAST_ACCESS_DATE (0x0800L) +#define DM_INHERITED_RIGHTS_MASK (0x1000L) +#define DM_MAXIMUM_SPACE (0x2000L) + +struct nw_modify_dos_info +{ + __u32 attributes __attribute__ ((packed)); + __u16 creationDate __attribute__ ((packed)); + __u16 creationTime __attribute__ ((packed)); + __u32 creatorID __attribute__ ((packed)); + __u16 modifyDate __attribute__ ((packed)); + __u16 modifyTime __attribute__ ((packed)); + __u32 modifierID __attribute__ ((packed)); + __u16 archiveDate __attribute__ ((packed)); + __u16 archiveTime __attribute__ ((packed)); + __u32 archiverID __attribute__ ((packed)); + __u16 lastAccessDate __attribute__ ((packed)); + __u16 inheritanceGrantMask __attribute__ ((packed)); + __u16 inheritanceRevokeMask __attribute__ ((packed)); + __u32 maximumSpace __attribute__ ((packed)); +}; + +struct nw_file_info { + struct nw_info_struct i; + int opened; + int access; + __u32 server_file_handle __attribute__ ((packed)); + __u8 open_create_action __attribute__ ((packed)); + __u8 file_handle[6] __attribute__ ((packed)); +}; + +struct nw_search_sequence { + __u8 volNumber __attribute__ ((packed)); + __u32 dirBase __attribute__ ((packed)); + __u32 sequence __attribute__ ((packed)); +}; + +struct nw_queue_job_entry { + __u16 InUse __attribute__ ((packed)); + __u32 prev __attribute__ ((packed)); + __u32 next __attribute__ ((packed)); + __u32 ClientStation __attribute__ ((packed)); + __u32 ClientTask __attribute__ ((packed)); + __u32 ClientObjectID __attribute__ ((packed)); + __u32 TargetServerID __attribute__ ((packed)); + __u8 TargetExecTime[6] __attribute__ ((packed)); + __u8 JobEntryTime[6] __attribute__ ((packed)); + __u32 JobNumber __attribute__ ((packed)); + __u16 JobType __attribute__ ((packed)); + __u16 JobPosition __attribute__ ((packed)); + __u16 JobControlFlags __attribute__ ((packed)); + __u8 FileNameLen __attribute__ ((packed)); + char JobFileName[13] __attribute__ ((packed)); + __u32 JobFileHandle __attribute__ ((packed)); + __u32 ServerStation __attribute__ ((packed)); + __u32 ServerTaskNumber __attribute__ ((packed)); + __u32 ServerObjectID __attribute__ ((packed)); + char JobTextDescription[50] __attribute__ ((packed)); + char ClientRecordArea[152] __attribute__ ((packed)); +}; + +struct queue_job { + struct nw_queue_job_entry j; + __u8 file_handle[6]; +}; + +#define QJE_OPER_HOLD 0x80 +#define QJE_USER_HOLD 0x40 +#define QJE_ENTRYOPEN 0x20 +#define QJE_SERV_RESTART 0x10 +#define QJE_SERV_AUTO 0x08 + +/* ClientRecordArea for print jobs */ + +#define KEEP_ON 0x0400 +#define NO_FORM_FEED 0x0800 +#define NOTIFICATION 0x1000 +#define DELETE_FILE 0x2000 +#define EXPAND_TABS 0x4000 +#define PRINT_BANNER 0x8000 + +struct print_job_record { + __u8 Version __attribute__ ((packed)); + __u8 TabSize __attribute__ ((packed)); + __u16 Copies __attribute__ ((packed)); + __u16 CtrlFlags __attribute__ ((packed)); + __u16 Lines __attribute__ ((packed)); + __u16 Rows __attribute__ ((packed)); + char FormName[16] __attribute__ ((packed)); + __u8 Reserved[6] __attribute__ ((packed)); + char BannerName[13] __attribute__ ((packed)); + char FnameBanner[13] __attribute__ ((packed)); + char FnameHeader[14] __attribute__ ((packed)); + char Path[80] __attribute__ ((packed)); +}; + + +#endif /* _LINUX_NCP_H */ diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h new file mode 100644 index 000000000..1d6744420 --- /dev/null +++ b/include/linux/ncp_fs.h @@ -0,0 +1,165 @@ +/* + * ncp_fs.h + * + * Copyright (C) 1995, 1996 by Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_FS_H +#define _LINUX_NCP_FS_H + +#include <linux/fs.h> +#include <linux/in.h> +#include <linux/types.h> + +#include <linux/ncp_mount.h> +#include <linux/ncp_fs_sb.h> +#include <linux/ncp_fs_i.h> + +/* + * ioctl commands + */ + +struct ncp_ioctl_request { + unsigned int function; + unsigned int size; + char *data; +}; + +struct ncp_fs_info { + int version; + struct sockaddr_ipx addr; + uid_t mounted_uid; + int connection; /* Connection number the server assigned us */ + int buffer_size; /* The negotiated buffer size, to be + used for read/write requests! */ + + int volume_number; + __u32 directory_id; +}; + +#define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) +#define NCP_IOC_GETMOUNTUID _IOW('n', 2, uid_t) +#define NCP_IOC_CONN_LOGGED_IN _IO('n', 3) + +#define NCP_GET_FS_INFO_VERSION (1) +#define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info) + +/* + * The packet size to allocate. One page should be enough. + */ +#define NCP_PACKET_SIZE 4070 + +#define NCP_MAXPATHLEN 255 +#define NCP_MAXNAMELEN 14 + +#define NCP_MSG_COMMAND "/sbin/nwmsg" + +#ifdef __KERNEL__ + +/* The readdir cache size controls how many directory entries are + * cached. + */ +#define NCP_READDIR_CACHE_SIZE 64 + + +#define NCP_MAX_RPC_TIMEOUT (6*HZ) + +/* Guess, what 0x564c is :-) */ +#define NCP_SUPER_MAGIC 0x564c + + +#define NCP_SBP(sb) ((struct ncp_server *)((sb)->u.generic_sbp)) +#define NCP_INOP(inode) ((struct ncp_inode_info *)((inode)->u.generic_ip)) + +#define NCP_SERVER(inode) NCP_SBP((inode)->i_sb) +#define NCP_FINFO(inode) (&(NCP_INOP(inode)->finfo)) +#define NCP_ISTRUCT(inode) (&(NCP_FINFO(inode)->i)) + +#ifdef DEBUG_NCP_MALLOC + +#include <linux/malloc.h> + +extern int ncp_malloced; +extern int ncp_current_malloced; + +static inline void * +ncp_kmalloc(unsigned int size, int priority) +{ + ncp_malloced += 1; + ncp_current_malloced += 1; + return kmalloc(size, priority); +} + +static inline void +ncp_kfree_s(void *obj, int size) +{ + ncp_current_malloced -= 1; + kfree_s(obj, size); +} + +#else /* DEBUG_NCP_MALLOC */ + +#define ncp_kmalloc(s,p) kmalloc(s,p) +#define ncp_kfree_s(o,s) kfree_s(o,s) + +#endif /* DEBUG_NCP_MALLOC */ + +#if DEBUG_NCP > 0 +#define DPRINTK(format, args...) printk(format , ## args) +#else +#define DPRINTK(format, args...) +#endif + +#if DEBUG_NCP > 1 +#define DDPRINTK(format, args...) printk(format , ## args) +#else +#define DDPRINTK(format, args...) +#endif + + +/* linux/fs/ncpfs/file.c */ +extern struct inode_operations ncp_file_inode_operations; +int ncp_make_open(struct inode *i, int right); + +/* linux/fs/ncpfs/dir.c */ +extern struct inode_operations ncp_dir_inode_operations; +void ncp_free_inode_info(struct ncp_inode_info *i); +void ncp_free_all_inodes(struct ncp_server *server); +void ncp_init_root(struct ncp_server *server); +int ncp_conn_logged_in(struct ncp_server *server); +void ncp_init_dir_cache(void); +void ncp_invalid_dir_cache(struct inode *ino); +struct ncp_inode_info *ncp_find_inode(struct inode *inode); +ino_t ncp_info_ino(struct ncp_server *server, struct ncp_inode_info *info); +void ncp_free_dir_cache(void); +int ncp_date_dos2unix(__u16 time, __u16 date); +void ncp_date_unix2dos(int unix_date, __u16 *time, __u16 *date); + + +/* linux/fs/ncpfs/ioctl.c */ +int ncp_ioctl (struct inode * inode, struct file * filp, + unsigned int cmd, unsigned long arg); + +/* linux/fs/ncpfs/inode.c */ +struct super_block *ncp_read_super(struct super_block *sb, + void *raw_data, int silent); +extern int init_ncp_fs(void); +void ncp_trigger_message(struct ncp_server *server); + +/* linux/fs/ncpfs/sock.c */ +int ncp_request(struct ncp_server *server, int function); +int ncp_connect(struct ncp_server *server); +int ncp_disconnect(struct ncp_server *server); +int ncp_catch_watchdog(struct ncp_server *server); +int ncp_dont_catch_watchdog(struct ncp_server *server); +int ncp_catch_message(struct ncp_server *server); +void ncp_lock_server(struct ncp_server *server); +void ncp_unlock_server(struct ncp_server *server); + +/* linux/fs/ncpfs/mmap.c */ +int ncp_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma); + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_NCP_FS_H */ diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h new file mode 100644 index 000000000..02ad1b452 --- /dev/null +++ b/include/linux/ncp_fs_i.h @@ -0,0 +1,36 @@ +/* + * ncp_fs_i.h + * + * Copyright (C) 1995 Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_FS_I +#define _LINUX_NCP_FS_I + +#include <linux/ncp.h> + +#ifdef __KERNEL__ + +enum ncp_inode_state { + NCP_INODE_VALID = 19, /* Inode currently in use */ + NCP_INODE_LOOKED_UP, /* directly before iget */ + NCP_INODE_CACHED, /* in a path to an inode which is in use */ + NCP_INODE_INVALID +}; + +/* + * ncp fs inode data (in memory only) + */ +struct ncp_inode_info { + enum ncp_inode_state state; + int nused; /* for directories: + number of references in memory */ + struct ncp_inode_info *dir; + struct ncp_inode_info *next, *prev; + struct inode *inode; + struct nw_file_info finfo; +}; + +#endif +#endif diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h new file mode 100644 index 000000000..6d1d7c510 --- /dev/null +++ b/include/linux/ncp_fs_sb.h @@ -0,0 +1,76 @@ +/* + * ncp_fs_sb.h + * + * Copyright (C) 1995, 1996 by Volker Lendecke + * + */ + +#ifndef _NCP_FS_SB +#define _NCP_FS_SB + +#include <linux/ncp_mount.h> +#include <linux/types.h> + +#ifdef __KERNEL__ + +#define NCP_DEFAULT_BUFSIZE 1024 + +struct ncp_server { + + struct ncp_mount_data m; /* Nearly all of the mount data is of + interest for us later, so we store + it completely. */ + + __u8 name_space[NCP_NUMBER_OF_VOLUMES]; + + struct file *ncp_filp; /* File pointer to ncp socket */ + struct file *wdog_filp; /* File pointer to wdog socket */ + struct file *msg_filp; /* File pointer to message socket */ + void *data_ready; /* The wdog socket gets a new + data_ready callback. We store the + old one for checking purposes and + to reset it on unmounting. */ + + u8 sequence; + u8 task; + u16 connection; /* Remote connection number */ + + u8 completion; /* Status message from server */ + u8 conn_status; /* Bit 4 = 1 ==> Server going down, no + requests allowed anymore. + Bit 0 = 1 ==> Server is down. */ + + int buffer_size; /* Negotiated bufsize */ + + int reply_size; /* Size of last reply */ + + int packet_size; + unsigned char *packet; /* Here we prepare requests and + receive replies */ + + int lock; /* To prevent mismatch in protocols. */ + struct wait_queue *wait; + + int current_size; /* for packet preparation */ + int has_subfunction; + int ncp_reply_size; + + struct ncp_inode_info root; + char root_path; /* '\0' */ +}; + +static inline int +ncp_conn_valid(struct ncp_server *server) +{ + return ((server->conn_status & 0x11) == 0); +} + +static inline void +ncp_invalidate_conn(struct ncp_server *server) +{ + server->conn_status |= 0x01; +} + +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h new file mode 100644 index 000000000..3de288659 --- /dev/null +++ b/include/linux/ncp_mount.h @@ -0,0 +1,49 @@ +/* + * ncp_mount.h + * + * Copyright (C) 1995, 1996 by Volker Lendecke + * + */ + +#ifndef _LINUX_NCP_MOUNT_H +#define _LINUX_NCP_MOUNT_H + +#include <linux/types.h> +#include <linux/ipx.h> +#include <linux/ncp.h> +#include <linux/ncp_fs_i.h> + +#define NCP_MOUNT_VERSION 2 + +#define NCP_USERNAME_LEN (NCP_BINDERY_NAME_LEN) +#define NCP_PASSWORD_LEN 20 + +/* Values for flags */ +#define NCP_MOUNT_SOFT 0x0001 +#define NCP_MOUNT_INTR 0x0002 + +struct ncp_mount_data { + int version; + unsigned int ncp_fd; /* The socket to the ncp port */ + unsigned int wdog_fd; /* Watchdog packets come here */ + unsigned int message_fd; /* Message notifications come here */ + uid_t mounted_uid; /* Who may umount() this filesystem? */ + + struct sockaddr_ipx serv_addr; + unsigned char server_name[NCP_BINDERY_NAME_LEN]; + + unsigned char mount_point[PATH_MAX+1]; + unsigned char mounted_vol[NCP_VOLNAME_LEN+1]; + + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ + unsigned int flags; + + uid_t uid; + gid_t gid; + mode_t file_mode; + mode_t dir_mode; +}; + +#endif diff --git a/include/linux/net.h b/include/linux/net.h index bad60518f..a338a8efd 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -22,9 +22,6 @@ #include <linux/wait.h> #include <linux/socket.h> - -#define NSOCKETS 2000 /* Dynamic, this is MAX LIMIT */ -#define NSOCKETS_UNIX 128 /* unix domain static limit */ #define NPROTO 16 /* should be enough for now.. */ @@ -43,6 +40,8 @@ #define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ #define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ #define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ +#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ +#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ typedef enum { @@ -81,6 +80,7 @@ struct socket { struct wait_queue **wait; /* ptr to place to wait on */ struct inode *inode; struct fasync_struct *fasync_list; /* Asynchronous wake up list */ + struct file *file; /* File back pointer for gc */ }; #define SOCK_INODE(S) ((S)->inode) @@ -100,23 +100,11 @@ struct proto_ops { int flags); int (*getname) (struct socket *sock, struct sockaddr *uaddr, int *usockaddr_len, int peer); - int (*read) (struct socket *sock, char *ubuf, int size, - int nonblock); - int (*write) (struct socket *sock, char *ubuf, int size, - int nonblock); int (*select) (struct socket *sock, int sel_type, select_table *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*listen) (struct socket *sock, int len); - int (*send) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags); - int (*recv) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags); - int (*sendto) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags, struct sockaddr *, int addr_len); - int (*recvfrom) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags, struct sockaddr *, int *addr_len); int (*shutdown) (struct socket *sock, int flags); int (*setsockopt) (struct socket *sock, int level, int optname, char *optval, int optlen); @@ -124,14 +112,15 @@ struct proto_ops { char *optval, int *optlen); int (*fcntl) (struct socket *sock, unsigned int cmd, unsigned long arg); + int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags); + int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int nonblock, int flags, int *addr_len); }; struct net_proto { - char *name; /* Protocol name */ + const char *name; /* Protocol name */ void (*init_func)(struct net_proto *); /* Bootstrap */ }; -extern int sock_awaitconn(struct socket *mysock, struct socket *servsock, int flags); extern int sock_wake_async(struct socket *sock, int how); extern int sock_register(int family, struct proto_ops *ops); extern int sock_unregister(int family); diff --git a/include/linux/net_alias.h b/include/linux/net_alias.h new file mode 100644 index 000000000..67a9f9bea --- /dev/null +++ b/include/linux/net_alias.h @@ -0,0 +1,172 @@ +/* + * NET_ALIAS network device aliasing definitions. + * + * + * Version: @(#)net_alias.h 0.43 12/20/95 + * + * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar> + * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _NET_ALIAS_H +#define _NET_ALIAS_H + +#include <linux/types.h> +#include <linux/if.h> +#include <linux/netdevice.h> + +/* + * max. alias slot number allowed + */ + +#define NET_ALIAS_MAX_SLOT 256 + +struct net_alias; +struct net_alias_info; +struct net_alias_type; + + +/* + * main alias structure + * note that *defines* dev & devname + */ + +struct net_alias +{ + struct device dev; /* alias device defn*/ + char name[IFNAMSIZ]; /* device name defn */ + unsigned hash; /* my hash value: for quick rehash */ + unsigned slot; /* slot number */ + void *data; /* private data */ + struct device *main_dev; /* pointer to main device */ + struct net_alias_type *nat; /* alias type object bound */ + struct net_alias *next; /* next alias (hashed linked list) */ +}; + + +/* + * alias structure pointed by main device + * it holds main device's alias hash table + */ + +struct net_alias_info +{ + int n_aliases; /* num aliases */ + struct device *taildev; /* my last (alias) device */ + struct net_alias *hash_tab[16]; /* hashed alias table */ +}; + +/* + * net_alias_type class + * declares a generic (AF_ independent) structure that will + * manage generic to family-specific behavior. + */ + +struct net_alias_type +{ + int type; /* aliasing type: address family */ + int n_attach; /* number of aliases attached */ + char name[16]; /* af_name */ + __u32 (*get_addr32) /* get __u32 addr 'representation'*/ + (struct net_alias_type *this, struct sockaddr*); + int (*dev_addr_chk) /* address checking func: */ + (struct net_alias_type *this, struct device *, struct sockaddr *); + struct device * (*dev_select) /* closest alias selector*/ + (struct net_alias_type *this, struct device *, struct sockaddr *sa); + int (*alias_init_1) /* called after alias creation: */ + (struct net_alias_type *this,struct net_alias *alias, struct sockaddr *sa); + int (*alias_done_1) /* called before alias deletion */ + (struct net_alias_type *this, struct net_alias *alias); + int (*alias_print_1) + (struct net_alias_type *this, struct net_alias *alias, char *buf, int len); + struct net_alias_type *next; /* link */ +}; + + +/* + * is dev an alias? + */ + +static __inline__ int +net_alias_is(struct device *dev) +{ + return (dev->my_alias != NULL); +} + + +/* + * does dev have aliases? + */ + +static __inline__ int +net_alias_has(struct device *dev) +{ + return (dev->alias_info != NULL); +} + + +extern void net_alias_init(void); + +extern struct device * net_alias_dev_get(char *dev_name, int aliasing_ok, int *err, struct sockaddr *sa, void *data); +extern int net_alias_dev_rehash(struct device *dev, struct sockaddr *sa); + +extern int net_alias_getinfo(char *buf, char **, off_t , int , int ); +extern int net_alias_types_getinfo(char *buf, char **, off_t , int , int ); + +extern int register_net_alias_type(struct net_alias_type *nat, int type); +extern int unregister_net_alias_type(struct net_alias_type *nat); + +extern struct device * net_alias_dev_chk(struct device *main_dev, struct sockaddr *sa, int flags_on, int flags_off); +extern struct device * net_alias_dev_chk32(struct device *main_dev, int family, __u32 addr32, int flags_on, int flags_off); + +extern struct device * net_alias_dev_rcv_sel(struct device *main_dev, struct sockaddr *sa_src, struct sockaddr *sa_dst); +extern struct device * net_alias_dev_rcv_sel32(struct device *main_dev, int family, __u32 src, __u32 dst); + + +/* + * returns MY 'true' main device + * intended for alias devices + */ + +static __inline__ struct device *net_alias_main_dev(struct device *dev) +{ + return (net_alias_is(dev))? dev->my_alias->main_dev : dev; +} + + +/* + * returns NEXT 'true' device + * intended for true devices + */ + +static __inline__ struct device * +net_alias_nextdev(struct device *dev) +{ + return (dev->alias_info)? dev->alias_info->taildev->next : dev->next; +} + + +/* + * sets NEXT 'true' device + * intended for main devices (treat main device as block: dev+aliases). + */ + +static __inline__ struct device * +net_alias_nextdev_set(struct device *dev, struct device *nextdev) +{ + struct device *pdev = dev; + if (net_alias_has(dev)) + { + pdev = dev->alias_info->taildev; /* point to last dev alias */ + } + pdev->next = nextdev; + return nextdev; +} + +#endif /* _NET_ALIAS_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8800f647b..55c72a1c7 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -24,14 +24,30 @@ #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H +#include <linux/config.h> #include <linux/if.h> #include <linux/if_ether.h> -#include <linux/skbuff.h> /* for future expansion when we will have different priorities. */ #define DEV_NUMBUFFS 3 #define MAX_ADDR_LEN 7 -#define MAX_HEADER 38 + +#if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR) +#define LL_MAX_HEADER 32 +#else +#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) +#define LL_MAX_HEADER 96 +#else +#define LL_MAX_HEADER 48 +#endif +#endif + +#if !defined(CONFIG_NET_IPIP) && \ + !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) +#define MAX_HEADER LL_MAX_HEADER +#else +#define MAX_HEADER (LL_MAX_HEADER + 48) +#endif #define IS_MYADDR 1 /* address is (one of) our own */ #define IS_LOOPBACK 2 /* address is for LOOPBACK */ @@ -39,8 +55,12 @@ #define IS_INVBCAST 4 /* Wrong netmask bcast not for us (unused)*/ #define IS_MULTICAST 5 /* Multicast IP address */ +#ifdef __KERNEL__ + +#include <linux/skbuff.h> + /* - * We tag these structures with multicasts. + * We tag multicasts with these structures. */ struct dev_mc_list @@ -51,6 +71,19 @@ struct dev_mc_list unsigned short dmi_users; }; +struct hh_cache +{ + struct hh_cache *hh_next; + void *hh_arp; /* Opaque pointer, used by + * any address resolution module, + * not only ARP. + */ + int hh_refcnt; /* number of users */ + unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP */ + char hh_uptodate; /* hh_data is valid */ + char hh_data[16]; /* cached hardware header */ +}; + /* * The DEVICE structure. * Actually, this whole structure is a big mistake. It mixes I/O @@ -70,15 +103,15 @@ struct device /* I/O specific fields - FIXME: Merge these and struct ifmap into one */ unsigned long rmem_end; /* shmem "recv" end */ unsigned long rmem_start; /* shmem "recv" start */ - unsigned long mem_end; /* sahared mem end */ + unsigned long mem_end; /* shared mem end */ unsigned long mem_start; /* shared mem start */ unsigned long base_addr; /* device I/O address */ unsigned char irq; /* device IRQ number */ /* Low-level status flags. */ - volatile unsigned int tbusy; /* transmitter busy */ volatile unsigned char start, /* start an operation */ interrupt; /* interrupt arrived */ + unsigned long tbusy; /* transmitter busy must be long for bitops */ struct device *next; @@ -112,9 +145,16 @@ struct device /* Interface address info. */ unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ + unsigned char pad; /* make dev_addr aligned to 8 bytes */ unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */ unsigned char addr_len; /* hardware address length */ +#if 0 + __u32 pa_addr_arr[4]; + __u16 pa_prefix_len; +#define pa_addr pa_addr_arr[3]; +#else unsigned long pa_addr; /* protocol address */ +#endif unsigned long pa_brdaddr; /* protocol broadcast addr */ unsigned long pa_dstaddr; /* protocol P-P other side addr */ unsigned long pa_mask; /* protocol netmask */ @@ -124,13 +164,15 @@ struct device int mc_count; /* Number of installed mcasts */ struct ip_mc_list *ip_mc_list; /* IP multicast filter chain */ + __u32 tx_queue_len; /* Max frames per queue allowed */ /* For load balancing driver pair support */ unsigned long pkt_queue; /* Packets queued */ struct device *slave; /* Slave device */ + struct net_alias_info *alias_info; /* main dev alias info */ + struct net_alias *my_alias; /* alias devs */ - /* Pointer to the interface buffers. */ struct sk_buff_head buffs[DEV_NUMBUFFS]; @@ -139,25 +181,27 @@ struct device int (*stop)(struct device *dev); int (*hard_start_xmit) (struct sk_buff *skb, struct device *dev); - int (*hard_header) (unsigned char *buff, + int (*hard_header) (struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, void *saddr, - unsigned len, - struct sk_buff *skb); + unsigned len); int (*rebuild_header)(void *eth, struct device *dev, unsigned long raddr, struct sk_buff *skb); #define HAVE_MULTICAST - void (*set_multicast_list)(struct device *dev, - int num_addrs, void *addrs); + void (*set_multicast_list)(struct device *dev); #define HAVE_SET_MAC_ADDR int (*set_mac_address)(struct device *dev, void *addr); #define HAVE_PRIVATE_IOCTL int (*do_ioctl)(struct device *dev, struct ifreq *ifr, int cmd); #define HAVE_SET_CONFIG int (*set_config)(struct device *dev, struct ifmap *map); - int (*header_cache)(struct device *dev, struct sock *sk, unsigned long saddr, unsigned long daddr); +#define HAVE_HEADER_CACHE + void (*header_cache_bind)(struct hh_cache **hhp, struct device *dev, unsigned short htype, __u32 daddr); + void (*header_cache_update)(struct hh_cache *hh, struct device *dev, unsigned char * haddr); +#define HAVE_CHANGE_MTU + int (*change_mtu)(struct device *dev, int new_mtu); }; @@ -171,14 +215,13 @@ struct packet_type { }; -#ifdef __KERNEL__ - +#include <linux/interrupt.h> #include <linux/notifier.h> /* Used by dev_rint */ #define IN_SKBUFF 1 -extern volatile int in_bh; +extern volatile unsigned long in_bh; extern struct device loopback_dev; extern struct device *dev_base; @@ -187,34 +230,72 @@ extern struct packet_type *ptype_base[16]; extern int ip_addr_match(unsigned long addr1, unsigned long addr2); extern int ip_chk_addr(unsigned long addr); -extern struct device *ip_dev_check(unsigned long daddr); +extern struct device *ip_dev_bynet(unsigned long daddr, unsigned long mask); extern unsigned long ip_my_addr(void); extern unsigned long ip_get_mask(unsigned long addr); +extern struct device *ip_dev_find(unsigned long addr); +extern struct device *dev_getbytype(unsigned short type); extern void dev_add_pack(struct packet_type *pt); extern void dev_remove_pack(struct packet_type *pt); -extern struct device *dev_get(char *name); +extern struct device *dev_get(const char *name); extern int dev_open(struct device *dev); extern int dev_close(struct device *dev); extern void dev_queue_xmit(struct sk_buff *skb, struct device *dev, int pri); + #define HAVE_NETIF_RX 1 extern void netif_rx(struct sk_buff *skb); -/* The old interface to netif_rx(). */ -extern int dev_rint(unsigned char *buff, long len, int flags, - struct device * dev); -extern void dev_transmit(void); -extern int in_net_bh(void); -extern void net_bh(void *tmp); +extern void net_bh(void); extern void dev_tint(struct device *dev); -extern int dev_get_info(char *buffer, char **start, off_t offset, int length); +extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); extern void dev_init(void); +/* Locking protection for page faults during outputs to devices unloaded during the fault */ + +extern int dev_lockct; + +/* + * These two don't currently need to be interrupt-safe + * but they may do soon. Do it properly anyway. + */ + +extern __inline__ void dev_lock_list(void) +{ + unsigned long flags; + save_flags(flags); + cli(); + dev_lockct++; + restore_flags(flags); +} + +extern __inline__ void dev_unlock_list(void) +{ + unsigned long flags; + save_flags(flags); + cli(); + dev_lockct--; + restore_flags(flags); +} + +/* + * This almost never occurs, isn't in performance critical paths + * and we can thus be relaxed about it + */ + +extern __inline__ void dev_lock_wait(void) +{ + while(dev_lockct) + schedule(); +} + + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ extern void ether_setup(struct device *dev); +extern void fddi_setup(struct device *dev); extern void tr_setup(struct device *dev); extern int ether_config(struct device *dev, struct ifmap *map); /* Support for loadable net-drivers */ diff --git a/include/linux/netrom.h b/include/linux/netrom.h index 935deb2b8..a7557ccb3 100644 --- a/include/linux/netrom.h +++ b/include/linux/netrom.h @@ -1,40 +1,45 @@ +/* + * These are the public elements of the Linux kernel NET/ROM implementation. + * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the + * definition of the ax25_address structure. + */ + +#ifndef NETROM_KERNEL_H +#define NETROM_KERNEL_H + #define PF_NETROM AF_NETROM #define NETROM_MTU 236 #define NETROM_T1 1 #define NETROM_T2 2 #define NETROM_N2 3 +#define NETROM_HDRINCL 4 +#define NETROM_PACLEN 5 +#define NETROM_T4 6 +#define NETROM_IDLE 7 + +#define NETROM_KILL 99 -#define SIOCNRADDNODE (SIOCPROTOPRIVATE) -#define SIOCNRDELNODE (SIOCPROTOPRIVATE+1) -#define SIOCNRADDNEIGH (SIOCPROTOPRIVATE+2) -#define SIOCNRDELNEIGH (SIOCPROTOPRIVATE+3) -#define SIOCNRGETPARMS (SIOCPROTOPRIVATE+4) -#define SIOCNRSETPARMS (SIOCPROTOPRIVATE+5) -#define SIOCNRDECOBS (SIOCPROTOPRIVATE+6) +#define SIOCNRDECOBS (SIOCPROTOPRIVATE+0) +#define SIOCNRCTLCON (SIOCPROTOPRIVATE+1) -struct nr_node_struct { +struct nr_route_struct { +#define NETROM_NEIGH 0 +#define NETROM_NODE 1 + int type; ax25_address callsign; - char mnemonic[7]; - ax25_address neighbour; char device[16]; unsigned int quality; + char mnemonic[7]; + ax25_address neighbour; unsigned int obs_count; }; -struct nr_neigh_struct { - ax25_address callsign; - char device[16]; - unsigned int quality; +struct nr_ctl_struct { + unsigned char index; + unsigned char id; + unsigned int cmd; + unsigned long arg; }; -struct nr_parms_struct { - unsigned int quality; - unsigned int obs_count; - unsigned int ttl; - unsigned int timeout; - unsigned int ack_delay; - unsigned int busy_delay; - unsigned int tries; - unsigned int window; -}; +#endif diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 66116a4e7..7924ecdec 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -17,7 +17,7 @@ /* * The readdir cache size controls how many directory entries are cached. * Its size is limited by the number of nfs_entry structures that can fit - * in one 4096-byte page, currently 256. + * in one page, currently, the limit is 256 when using 4KB pages. */ #define NFS_READDIR_CACHE_SIZE 64 @@ -26,11 +26,10 @@ #define NFS_DEF_FILE_IO_BUFFER_SIZE 1024 /* - * The upper limit on timeouts for the exponential backoff algorithm - * in tenths of a second. + * The upper limit on timeouts for the exponential backoff algorithm. */ -#define NFS_MAX_RPC_TIMEOUT 600 +#define NFS_MAX_RPC_TIMEOUT (6*HZ) /* * Size of the lookup cache in units of number of entries cached. @@ -44,6 +43,19 @@ #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) #define NFS_FH(inode) (&(inode)->u.nfs_i.fhandle) +#define NFS_RENAMED_DIR(inode) ((inode)->u.nfs_i.silly_rename_dir) +#define NFS_READTIME(inode) ((inode)->u.nfs_i.read_cache_jiffies) +#define NFS_OLDMTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) +#define NFS_ATTRTIMEO(inode) ((inode)->u.nfs_i.attrtimeo) +#define NFS_MINATTRTIMEO(inode) (S_ISREG((inode)->i_mode)? \ + NFS_SERVER(inode)->acregmin : \ + NFS_SERVER(inode)->acdirmin) +#define NFS_CACHEINV(inode) \ +do { \ + NFS_READTIME(inode) = jiffies - 1000000; \ + NFS_OLDMTIME(inode) = 0; \ +} while (0) + #ifdef __KERNEL__ @@ -61,10 +73,9 @@ extern int nfs_proc_readlink(struct nfs_server *server, struct nfs_fh *fhandle, unsigned int maxlen); extern int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle, int offset, int count, char *data, - struct nfs_fattr *fattr, int fs); -extern int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle, - int offset, int count, char *data, - struct nfs_fattr *fattr); + struct nfs_fattr *fattr); +extern int nfs_proc_write(struct inode * inode, int offset, + int count, const char *data, struct nfs_fattr *fattr); extern int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir, const char *name, struct nfs_sattr *sattr, struct nfs_fh *fhandle, struct nfs_fattr *fattr); @@ -72,7 +83,8 @@ extern int nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, const char *name); extern int nfs_proc_rename(struct nfs_server *server, struct nfs_fh *old_dir, const char *old_name, - struct nfs_fh *new_dir, const char *new_name); + struct nfs_fh *new_dir, const char *new_name, + int must_be_dir); extern int nfs_proc_link(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fh *dir, const char *name); extern int nfs_proc_symlink(struct nfs_server *server, struct nfs_fh *dir, @@ -86,15 +98,26 @@ extern int nfs_proc_readdir(struct nfs_server *server, struct nfs_fh *fhandle, int cookie, int count, struct nfs_entry *entry); extern int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *res); +extern int nfs_proc_read_request(struct rpc_ioreq *, struct nfs_server *, + struct nfs_fh *, unsigned long offset, + unsigned long count, __u32 *buf); +extern int nfs_proc_read_reply(struct rpc_ioreq *, struct nfs_fattr *); +extern int *rpc_header(int *p, int procedure, int program, int version, + int uid, int gid, int ngroup, gid_t *groups); +extern int *rpc_verify(int *p); /* linux/fs/nfs/sock.c */ -extern int nfs_rpc_call(struct nfs_server *server, int *start, int *end, int size); +extern int nfs_rpc_call(struct nfs_server *server, int *start, + int *end, int size); +extern int nfs_rpc_doio(struct nfs_server *server, struct rpc_ioreq *, + int async); /* linux/fs/nfs/inode.c */ extern struct super_block *nfs_read_super(struct super_block *sb, void *data,int); +extern int init_nfs_fs(void); extern struct inode *nfs_fhget(struct super_block *sb, struct nfs_fh *fhandle, struct nfs_fattr *fattr); extern void nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr); @@ -106,6 +129,8 @@ extern struct inode_operations nfs_file_inode_operations; /* linux/fs/nfs/dir.c */ extern struct inode_operations nfs_dir_inode_operations; +extern void nfs_sillyrename_cleanup(struct inode *); +extern void nfs_kfree_cache(void); /* linux/fs/nfs/symlink.c */ @@ -115,6 +140,21 @@ extern struct inode_operations nfs_symlink_inode_operations; extern int nfs_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma); +/* linux/fs/nfs/bio.c */ + +extern int nfs_readpage(struct inode *, struct page *); + +/* NFS root */ + +#define NFS_ROOT "/tftpboot/%s" +#define NFS_ROOT_NAME_LEN 256 +#define NFS_ROOT_ADDRS_LEN 128 + +extern int nfs_root_mount(struct super_block *sb); +extern int nfs_root_init(char *nfsname, char *nfsaddrs); +extern char nfs_root_name[]; +extern char nfs_root_addrs[]; + #endif /* __KERNEL__ */ #endif diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index d4652865b..7715c3a4d 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -2,12 +2,36 @@ #define _NFS_FS_I #include <linux/nfs.h> +#include <linux/pipe_fs_i.h> /* * nfs fs inode data in memory */ struct nfs_inode_info { + struct pipe_inode_info pipeinfo; struct nfs_fh fhandle; + /* + * read_cache_jiffies is when we started read-caching this inode, + * and read_cache_mtime is the mtime of the inode at that time. + * + * We need to invalidate the cache for this inode if + * + * jiffies - read_cache_jiffies > 30*HZ + * AND + * mtime != read_cache_mtime + */ + unsigned long read_cache_jiffies; + unsigned long read_cache_mtime; + /* + * This is to support the clandestine rename on unlink. + * Instead of the directory inode, we might as well keep its + * NFS FH, but that requires a kmalloc. + */ + struct inode *silly_rename_dir; + /* + * attrtimeo defines for how long the cached attributes are valid + */ + unsigned long attrtimeo; }; #endif diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 25db9e83f..bfdba35b4 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -1,10 +1,13 @@ #ifndef _NFS_FS_SB #define _NFS_FS_SB +#include <linux/rpcsock.h> #include <linux/nfs.h> struct nfs_server { struct file *file; + struct rpc_sock *rsock; + struct sockaddr toaddr ; /* Added for change to NFS code to use sendto() 1995-06-02 JSP */ int lock; struct wait_queue *wait; int flags; diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index beb5f1dd8..b122b43dc 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h @@ -17,7 +17,19 @@ * but here they are anyway. */ -#define NFS_MOUNT_VERSION 1 /* current version */ +#define NFS_NFS_PROGRAM 100003 /* nfsd program number */ +#define NFS_NFS_VERSION 2 /* nfsd version */ +#define NFS_NFS_PORT 2049 /* portnumber on server for nfsd */ + +#define NFS_MOUNT_PROGRAM 100005 /* mountd program number */ +#define NFS_MOUNT_VERSION 1 /* mountd version */ +#define NFS_MOUNT_PROC 1 /* mount process id */ +#define NFS_MOUNT_PORT 627 /* portnumber on server for mountd */ + +#define NFS_PMAP_PROGRAM 100000 /* portmap program number */ +#define NFS_PMAP_VERSION 2 /* portmap version */ +#define NFS_PMAP_PROC 3 /* portmap getport id */ +#define NFS_PMAP_PORT 111 /* portnumber on server for portmap */ struct nfs_mount_data { int version; /* 1 */ diff --git a/include/linux/nfsiod.h b/include/linux/nfsiod.h new file mode 100644 index 000000000..fdd07a2d0 --- /dev/null +++ b/include/linux/nfsiod.h @@ -0,0 +1,52 @@ +/* + * linux/include/linux/nfsiod.h + * + * Declarations for asynchronous NFS RPC calls. + * + */ + +#ifndef _LINUX_NFSIOD_H +#define _LINUX_NFSIOD_H + +#include <linux/rpcsock.h> +#include <linux/nfs_fs.h> + +#ifdef __KERNEL__ + +/* + * This is the callback handler for nfsiod requests. + * Note that the callback procedure must NOT sleep. + */ +struct nfsiod_req; +typedef int (*nfsiod_callback_t)(int result, struct nfsiod_req *); + +/* + * This is the nfsiod request struct. + */ +struct nfsiod_req { + struct nfsiod_req * rq_next; + struct nfsiod_req * rq_prev; + struct wait_queue * rq_wait; + struct rpc_ioreq rq_rpcreq; + nfsiod_callback_t rq_callback; + struct nfs_server * rq_server; + struct inode * rq_inode; + struct page * rq_page; + + /* user creds */ + uid_t rq_fsuid; + gid_t rq_fsgid; + int rq_groups[NGROUPS]; + + /* retry handling */ + int rq_retries; +}; + +struct nfsiod_req * nfsiod_reserve(struct nfs_server *); +void nfsiod_release(struct nfsiod_req *); +void nfsiod_enqueue(struct nfsiod_req *); +int nfsiod(void); + + +#endif /* __KERNEL__ */ +#endif /* _LINUX_NFSIOD_H */ diff --git a/include/linux/notifier.h b/include/linux/notifier.h index 78a446496..b3c9ccf65 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -13,7 +13,7 @@ struct notifier_block { - int (*notifier_call)(unsigned long, void *); + int (*notifier_call)(struct notifier_block *this, unsigned long, void *); struct notifier_block *next; int priority; }; @@ -68,7 +68,7 @@ extern __inline__ int notifier_call_chain(struct notifier_block **n, unsigned lo struct notifier_block *nb = *n; while(nb) { - ret=nb->notifier_call(val,v); + ret=nb->notifier_call(nb,val,v); if(ret&NOTIFY_STOP_MASK) return ret; nb=nb->next; diff --git a/include/linux/optcd.h b/include/linux/optcd.h new file mode 100644 index 000000000..00dd3aed8 --- /dev/null +++ b/include/linux/optcd.h @@ -0,0 +1,52 @@ +/* linux/include/linux/optcd.h - Optics Storage 8000 AT CDROM driver + $Id: optcd.h,v 1.2 1996/01/15 18:43:44 root Exp root $ + + Copyright (C) 1995 Leo Spiekman (spiekman@dutette.et.tudelft.nl) + + + Configuration file for linux/drivers/cdrom/optcd.c +*/ + +#ifndef _LINUX_OPTCD_H +#define _LINUX_OPTCD_H + + +/* I/O base of drive. Drive uses base to base+2. + This setting can be overridden with the kernel or insmod command + line option 'optcd=<portbase>'. Use address of 0 to disable driver. */ +#define OPTCD_PORTBASE 0x340 + + +/* enable / disable parts of driver by define / undef */ +#define MULTISESSION /* multisession support (ALPHA) */ + + +/* Change 0 to 1 to debug various parts of the driver */ +#define DEBUG_DRIVE_IF 0 /* Low level drive interface */ +#define DEBUG_CONV 0 /* Address conversions */ +#define DEBUG_BUFFERS 0 /* Buffering and block size conversion */ +#define DEBUG_REQUEST 0 /* Request mechanism */ +#define DEBUG_STATE 0 /* State machine */ +#define DEBUG_TOC 0 /* Q-channel and Table of Contents */ +#define DEBUG_MULTIS 0 /* Multisession code */ +#define DEBUG_VFS 0 /* VFS interface */ + + +/* Don't touch these unless you know what you're doing. */ + +/* Various timeout loop repetition counts. */ +#define BUSY_TIMEOUT 10000000 /* for busy wait */ +#define FAST_TIMEOUT 100000 /* ibid. for probing */ +#define SLEEP_TIMEOUT 6000 /* for timer wait */ +#define MULTI_SEEK_TIMEOUT 1000 /* for timer wait */ +#define READ_TIMEOUT 6000 /* for poll wait */ +#define STOP_TIMEOUT 2000 /* for poll wait */ +#define RESET_WAIT 5000 /* busy wait at drive reset */ + +/* # of buffers for block size conversion. 6 is optimal for my setup (P75), + giving 280 kb/s, with 0.4% CPU usage. Experiment to find your optimal + setting */ +#define N_BUFS 6 + + +#endif _LINUX_OPTCD_H diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h new file mode 100644 index 000000000..868874192 --- /dev/null +++ b/include/linux/pagemap.h @@ -0,0 +1,145 @@ +#ifndef _LINUX_PAGEMAP_H +#define _LINUX_PAGEMAP_H + +#include <asm/system.h> + +/* + * Page-mapping primitive inline functions + * + * Copyright 1995 Linus Torvalds + */ + +#include <linux/mm.h> +#include <linux/fs.h> + +static inline unsigned long page_address(struct page * page) +{ + return PAGE_OFFSET + PAGE_SIZE * page->map_nr; +} + +#define PAGE_HASH_BITS 11 +#define PAGE_HASH_SIZE (1 << PAGE_HASH_BITS) + +#define PAGE_AGE_VALUE 16 + +extern unsigned long page_cache_size; /* # of pages currently in the hash table */ +extern struct page * page_hash_table[PAGE_HASH_SIZE]; + +/* + * We use a power-of-two hash table to avoid a modulus, + * and get a reasonable hash by knowing roughly how the + * inode pointer and offsets are distributed (ie, we + * roughly know which bits are "significant") + */ +static inline unsigned long _page_hashfn(struct inode * inode, unsigned long offset) +{ +#define i (((unsigned long) inode)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1))) +#define o (offset >> PAGE_SHIFT) +#define s(x) ((x)+((x)>>PAGE_HASH_BITS)) + return s(i+o) & (PAGE_HASH_SIZE-1); +#undef i +#undef o +#undef s +} + +#define page_hash(inode,offset) (page_hash_table+_page_hashfn(inode,offset)) + +static inline struct page * __find_page(struct inode * inode, unsigned long offset, struct page *page) +{ + goto inside; + for (;;) { + page = page->next_hash; +inside: + if (!page) + goto not_found; + if (page->inode != inode) + continue; + if (page->offset == offset) + break; + } + /* Found the page. */ + atomic_inc(&page->count); + set_bit(PG_referenced, &page->flags); +not_found: + return page; +} + +static inline struct page *find_page(struct inode * inode, unsigned long offset) +{ + return __find_page(inode, offset, *page_hash(inode, offset)); +} + +static inline void remove_page_from_hash_queue(struct page * page) +{ + struct page **p; + struct page *next_hash, *prev_hash; + + next_hash = page->next_hash; + prev_hash = page->prev_hash; + page->next_hash = NULL; + page->prev_hash = NULL; + if (next_hash) + next_hash->prev_hash = prev_hash; + if (prev_hash) + prev_hash->next_hash = next_hash; + p = page_hash(page->inode,page->offset); + if (*p == page) + *p = next_hash; + page_cache_size--; +} + +static inline void __add_page_to_hash_queue(struct page * page, struct page **p) +{ + page_cache_size++; + set_bit(PG_referenced, &page->flags); + page->age = PAGE_AGE_VALUE; + page->prev_hash = NULL; + if ((page->next_hash = *p) != NULL) + page->next_hash->prev_hash = page; + *p = page; +} + +static inline void add_page_to_hash_queue(struct page * page, struct inode * inode, unsigned long offset) +{ + __add_page_to_hash_queue(page, page_hash(inode,offset)); +} + + +static inline void remove_page_from_inode_queue(struct page * page) +{ + struct inode * inode = page->inode; + + page->inode = NULL; + inode->i_nrpages--; + if (inode->i_pages == page) + inode->i_pages = page->next; + if (page->next) + page->next->prev = page->prev; + if (page->prev) + page->prev->next = page->next; + page->next = NULL; + page->prev = NULL; +} + +static inline void add_page_to_inode_queue(struct inode * inode, struct page * page) +{ + struct page **p = &inode->i_pages; + + inode->i_nrpages++; + page->inode = inode; + page->prev = NULL; + if ((page->next = *p) != NULL) + page->next->prev = page; + *p = page; +} + +extern void __wait_on_page(struct page *); +static inline void wait_on_page(struct page * page) +{ + if (PageLocked(page)) + __wait_on_page(page); +} + +extern void update_vm_cache(struct inode *, unsigned long, const char *, int); + +#endif diff --git a/include/linux/pci.h b/include/linux/pci.h index 0be42eadc..4118dfdc0 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -22,16 +22,23 @@ /* PROCEDURE TO REPORT NEW PCI DEVICES - * We are trying to collect informations on new PCI devices, using - * the standart PCI identification procedure. If some warning is + * We are trying to collect information on new PCI devices, using + * the standard PCI identification procedure. If some warning is * displayed at boot time, please report * - /proc/pci * - your exact hardware description. Try to find out * which device is unknown. It may be you mainboard chipset. * PCI-CPU bridge or PCI-ISA bridge. - * - Send all that to frederic@cao-vlsi.ibp.fr, and I'll add - * your device to the list as soon as possible - * fred. + * - If you can't find the actual information in your hardware + * booklet, try to read the references of the chip on the board. + * - Send all that to linux-pcisupport@cao-vlsi.ibp.fr, + * and I'll add your device to the list as soon as possible + * + * BEFORE you send a mail, please check the latest linux releases + * to be sure it has not been recently added. + * + * Thanks + * Frederic Potter. */ @@ -47,7 +54,7 @@ #define PCI_DEVICE_ID 0x02 /* 16 bits */ #define PCI_COMMAND 0x04 /* 16 bits */ #define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ -#define PCI_COMMAND_MEMORY 0x2 /* Enable response in I/O space */ +#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ #define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ #define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ #define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ @@ -58,6 +65,9 @@ #define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ #define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ +#define PCI_STATUS_UDF 0x40 /* Support User Definable Features */ + #define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ #define PCI_STATUS_PARITY 0x100 /* Detected parity error */ #define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ @@ -108,7 +118,9 @@ #define PCI_BASE_ADDRESS_IO_MASK (~0x03) /* bit 1 is reserved if address_space = 1 */ -/* 0x28-0x2f are reserved */ +#define PCI_CARDBUS_CIS 0x28 +#define PCI_SUBSYSTEM_ID 0x2c +#define PCI_SUBSYSTEM_VENDOR_ID 0x2e #define PCI_ROM_ADDRESS 0x30 /* 32 bits */ #define PCI_ROM_ADDRESS_ENABLE 0x01 /* Write 1 to enable ROM, bits 31..11 are address, @@ -127,12 +139,14 @@ #define PCI_CLASS_STORAGE_IDE 0x0101 #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 +#define PCI_CLASS_STORAGE_RAID 0x0104 #define PCI_CLASS_STORAGE_OTHER 0x0180 #define PCI_BASE_CLASS_NETWORK 0x02 #define PCI_CLASS_NETWORK_ETHERNET 0x0200 #define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 #define PCI_CLASS_NETWORK_FDDI 0x0202 +#define PCI_CLASS_NETWORK_ATM 0x0203 #define PCI_CLASS_NETWORK_OTHER 0x0280 #define PCI_BASE_CLASS_DISPLAY 0x03 @@ -157,196 +171,429 @@ #define PCI_CLASS_BRIDGE_MC 0x0603 #define PCI_CLASS_BRIDGE_PCI 0x0604 #define PCI_CLASS_BRIDGE_PCMCIA 0x0605 +#define PCI_CLASS_BRIDGE_NUBUS 0x0606 +#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 #define PCI_CLASS_BRIDGE_OTHER 0x0680 + +#define PCI_BASE_CLASS_COMMUNICATION 0x07 +#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 +#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 +#define PCI_CLASS_COMMUNICATION_OTHER 0x0780 + +#define PCI_BASE_CLASS_SYSTEM 0x08 +#define PCI_CLASS_SYSTEM_PIC 0x0800 +#define PCI_CLASS_SYSTEM_DMA 0x0801 +#define PCI_CLASS_SYSTEM_TIMER 0x0802 +#define PCI_CLASS_SYSTEM_RTC 0x0803 +#define PCI_CLASS_SYSTEM_OTHER 0x0880 + +#define PCI_BASE_CLASS_INPUT 0x09 +#define PCI_CLASS_INPUT_KEYBOARD 0x0900 +#define PCI_CLASS_INPUT_PEN 0x0901 +#define PCI_CLASS_INPUT_MOUSE 0x0902 +#define PCI_CLASS_INPUT_OTHER 0x0980 + +#define PCI_BASE_CLASS_DOCKING 0x0a +#define PCI_CLASS_DOCKING_GENERIC 0x0a00 +#define PCI_CLASS_DOCKING_OTHER 0x0a01 + +#define PCI_BASE_CLASS_PROCESSOR 0x0b +#define PCI_CLASS_PROCESSOR_386 0x0b00 +#define PCI_CLASS_PROCESSOR_486 0x0b01 +#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 +#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 +#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 +#define PCI_CLASS_PROCESSOR_CO 0x0b40 + +#define PCI_BASE_CLASS_SERIAL 0x0c +#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 +#define PCI_CLASS_SERIAL_ACCESS 0x0c01 +#define PCI_CLASS_SERIAL_SSA 0x0c02 +#define PCI_CLASS_SERIAL_USB 0x0c03 +#define PCI_CLASS_SERIAL_FIBER 0x0c04 + #define PCI_CLASS_OTHERS 0xff +/* + * Vendor and card ID's: sort these numerically according to vendor + * (and according to card ID within vendor) + */ +#define PCI_VENDOR_ID_COMPAQ 0x0e11 +#define PCI_DEVICE_ID_COMPAQ_1280 0x3033 +#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 #define PCI_VENDOR_ID_NCR 0x1000 #define PCI_DEVICE_ID_NCR_53C810 0x0001 -#define PCI_DEVICE_ID_NCR_53C815 0x0004 #define PCI_DEVICE_ID_NCR_53C820 0x0002 #define PCI_DEVICE_ID_NCR_53C825 0x0003 +#define PCI_DEVICE_ID_NCR_53C815 0x0004 -#define PCI_VENDOR_ID_ADAPTEC 0x9004 -#define PCI_DEVICE_ID_ADAPTEC_2940 0x7178 -#define PCI_DEVICE_ID_ADAPTEC_294x 0x7078 +#define PCI_VENDOR_ID_ATI 0x1002 +#define PCI_DEVICE_ID_ATI_68800 0x4158 +#define PCI_DEVICE_ID_ATI_215CT222 0x4354 +#define PCI_DEVICE_ID_ATI_210888CX 0x4358 +#define PCI_DEVICE_ID_ATI_210888GX 0x4758 -#define PCI_VENDOR_ID_DPT 0x1044 -#define PCI_DEVICE_ID_DPT 0xa400 +#define PCI_VENDOR_ID_VLSI 0x1004 +#define PCI_DEVICE_ID_VLSI_82C592 0x0005 +#define PCI_DEVICE_ID_VLSI_82C593 0x0006 +#define PCI_DEVICE_ID_VLSI_82C594 0x0007 +#define PCI_DEVICE_ID_VLSI_82C597 0x0009 -#define PCI_VENDOR_ID_S3 0x5333 -#define PCI_DEVICE_ID_S3_864_1 0x88c0 -#define PCI_DEVICE_ID_S3_864_2 0x88c1 -#define PCI_DEVICE_ID_S3_868 0x8880 -#define PCI_DEVICE_ID_S3_928 0x88b0 -#define PCI_DEVICE_ID_S3_964_1 0x88d0 -#define PCI_DEVICE_ID_S3_964_2 0x88d1 -#define PCI_DEVICE_ID_S3_811 0x8811 -#define PCI_DEVICE_ID_S3_968 0x88f0 +#define PCI_VENDOR_ID_ADL 0x1005 +#define PCI_DEVICE_ID_ADL_2301 0x2301 -#define PCI_VENDOR_ID_OPTI 0x1045 -#define PCI_DEVICE_ID_OPTI_82C822 0xc822 -#define PCI_DEVICE_ID_OPTI_82C621 0xc621 -#define PCI_DEVICE_ID_OPTI_82C557 0xc557 -#define PCI_DEVICE_ID_OPTI_82C558 0xc558 +#define PCI_VENDOR_ID_NS 0x100b +#define PCI_DEVICE_ID_NS_87410 0xd001 -#define PCI_VENDOR_ID_UMC 0x1060 -#define PCI_DEVICE_ID_UMC_UM8881F 0x8881 -#define PCI_DEVICE_ID_UMC_UM8891A 0x0891 -#define PCI_DEVICE_ID_UMC_UM8886F 0x8886 -#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 +#define PCI_VENDOR_ID_TSENG 0x100c +#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 +#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 +#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 +#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 + +#define PCI_VENDOR_ID_WEITEK 0x100e +#define PCI_DEVICE_ID_WEITEK_P9000 0x9001 +#define PCI_DEVICE_ID_WEITEK_P9100 0x9100 #define PCI_VENDOR_ID_DEC 0x1011 +#define PCI_DEVICE_ID_DEC_BRD 0x0001 #define PCI_DEVICE_ID_DEC_TULIP 0x0002 +#define PCI_DEVICE_ID_DEC_TGA 0x0004 #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 #define PCI_DEVICE_ID_DEC_FDDI 0x000F -#define PCI_DEVICE_ID_DEC_BRD 0x0001 +#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 +#define PCI_DEVICE_ID_DEC_21052 0x0021 +#define PCI_DEVICE_ID_DEC_21152 0x0024 + +#define PCI_VENDOR_ID_CIRRUS 0x1013 +#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 +#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 +#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 +#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac +#define PCI_DEVICE_ID_CIRRUS_6729 0x1100 +#define PCI_DEVICE_ID_CIRRUS_7542 0x1200 +#define PCI_DEVICE_ID_CIRRUS_7543 0x1202 + +#define PCI_VENDOR_ID_IBM 0x1014 +#define PCI_DEVICE_ID_IBM_82G2675 0x001d + +#define PCI_VENDOR_ID_WD 0x101c +#define PCI_DEVICE_ID_WD_7197 0x3296 + +#define PCI_VENDOR_ID_AMD 0x1022 +#define PCI_DEVICE_ID_AMD_LANCE 0x2000 +#define PCI_DEVICE_ID_AMD_SCSI 0x2020 + +#define PCI_VENDOR_ID_TRIDENT 0x1023 +#define PCI_DEVICE_ID_TRIDENT_9420 0x9420 +#define PCI_DEVICE_ID_TRIDENT_9440 0x9440 +#define PCI_DEVICE_ID_TRIDENT_9660 0x9660 + +#define PCI_VENDOR_ID_AI 0x1025 +#define PCI_DEVICE_ID_AI_M1435 0x1435 #define PCI_VENDOR_ID_MATROX 0x102B #define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 +#define PCI_DEVICE_ID_MATROX_MIL 0x0519 #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 -#define PCI_VENDOR_ID_INTEL 0x8086 -#define PCI_DEVICE_ID_INTEL_82378 0x0484 -#define PCI_DEVICE_ID_INTEL_82424 0x0483 -#define PCI_DEVICE_ID_INTEL_82375 0x0482 -#define PCI_DEVICE_ID_INTEL_82434 0x04a3 -#define PCI_DEVICE_ID_INTEL_82430 0x0486 -#define PCI_DEVICE_ID_INTEL_82437 0x122d -#define PCI_DEVICE_ID_INTEL_82371 0x122e +#define PCI_VENDOR_ID_CT 0x102c +#define PCI_DEVICE_ID_CT_65545 0x00d8 +#define PCI_DEVICE_ID_CT_65548 0x00dc -#define PCI_VENDOR_ID_SMC 0x1042 -#define PCI_DEVICE_ID_SMC_37C665 0x1000 +#define PCI_VENDOR_ID_MIRO 0x1031 +#define PCI_DEVICE_ID_MIRO_36050 0x5601 -#define PCI_VENDOR_ID_ATI 0x1002 -#define PCI_DEVICE_ID_ATI_M32 0x4158 -#define PCI_DEVICE_ID_ATI_M64 0x4758 +#define PCI_VENDOR_ID_FD 0x1036 +#define PCI_DEVICE_ID_FD_36C70 0x0000 -#define PCI_VENDOR_ID_WEITEK 0x100e -#define PCI_DEVICE_ID_WEITEK_P9000 0x9001 -#define PCI_DEVICE_ID_WEITEK_P9100 0x9100 +#define PCI_VENDOR_ID_SI 0x1039 +#define PCI_DEVICE_ID_SI_6201 0x0001 +#define PCI_DEVICE_ID_SI_6202 0x0002 +#define PCI_DEVICE_ID_SI_6205 0x0205 +#define PCI_DEVICE_ID_SI_503 0x0008 +#define PCI_DEVICE_ID_SI_501 0x0406 +#define PCI_DEVICE_ID_SI_496 0x0496 +#define PCI_DEVICE_ID_SI_601 0x0601 +#define PCI_DEVICE_ID_SI_5511 0x5511 +#define PCI_DEVICE_ID_SI_5513 0x5513 -#define PCI_VENDOR_ID_CIRRUS 0x1013 -#define PCI_DEVICE_ID_CIRRUS_5430 0x00A0 -#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00A4 -#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00A8 -#define PCI_DEVICE_ID_CIRRUS_6729 0x1100 +#define PCI_VENDOR_ID_HP 0x103c +#define PCI_DEVICE_ID_HP_J2585A 0x1030 + +#define PCI_VENDOR_ID_PCTECH 0x1042 +#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 +#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 -#define PCI_VENDOR_ID_BUSLOGIC 0x104B -#define PCI_DEVICE_ID_BUSLOGIC_946C 0x1040 -#define PCI_DEVICE_ID_BUSLOGIC_946C_2 0x0140 +#define PCI_VENDOR_ID_DPT 0x1044 +#define PCI_DEVICE_ID_DPT 0xa400 + +#define PCI_VENDOR_ID_OPTI 0x1045 +#define PCI_DEVICE_ID_OPTI_92C178 0xc178 +#define PCI_DEVICE_ID_OPTI_82C557 0xc557 +#define PCI_DEVICE_ID_OPTI_82C558 0xc558 +#define PCI_DEVICE_ID_OPTI_82C621 0xc621 +#define PCI_DEVICE_ID_OPTI_82C822 0xc822 -#define PCI_VENDOR_ID_N9 0x105D +#define PCI_VENDOR_ID_SGS 0x104a +#define PCI_DEVICE_ID_SGS_2000 0x0008 +#define PCI_DEVICE_ID_SGS_1764 0x0009 + +#define PCI_VENDOR_ID_BUSLOGIC 0x104B +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 +#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 + +#define PCI_VENDOR_ID_OAK 0x104e +#define PCI_DEVICE_ID_OAK_OTI107 0x0107 + +#define PCI_VENDOR_ID_PROMISE 0x105a +#define PCI_DEVICE_ID_PROMISE_5300 0x5300 + +#define PCI_VENDOR_ID_N9 0x105d #define PCI_DEVICE_ID_N9_I128 0x2309 +#define PCI_DEVICE_ID_N9_I128_2 0x2339 -#define PCI_VENDOR_ID_AI 0x1025 -#define PCI_DEVICE_ID_AI_M1435 0x1435 +#define PCI_VENDOR_ID_UMC 0x1060 +#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 +#define PCI_DEVICE_ID_UMC_UM8891A 0x0891 +#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a +#define PCI_DEVICE_ID_UMC_UM8886A 0x886a +#define PCI_DEVICE_ID_UMC_UM8881F 0x8881 +#define PCI_DEVICE_ID_UMC_UM8886F 0x8886 +#define PCI_DEVICE_ID_UMC_UM9017F 0x9017 +#define PCI_DEVICE_ID_UMC_UM8886N 0xe886 +#define PCI_DEVICE_ID_UMC_UM8891N 0xe891 -#define PCI_VENDOR_ID_AL 0x10b9 -#define PCI_DEVICE_ID_AL_M1445 0x1445 -#define PCI_DEVICE_ID_AL_M1449 0x1449 -#define PCI_DEVICE_ID_AL_M1451 0x1451 -#define PCI_DEVICE_ID_AL_M4803 0x5215 +#define PCI_VENDOR_ID_X 0x1061 +#define PCI_DEVICE_ID_X_AGX016 0x0001 -#define PCI_VENDOR_ID_TSENG 0x100c -#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 -#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 -#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 -#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 +#define PCI_VENDOR_ID_NEXGEN 0x1074 +#define PCI_DEVICE_ID_NEXGEN_82C501 0x4e78 + +#define PCI_VENDOR_ID_QLOGIC 0x1077 +#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 +#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 + +#define PCI_VENDOR_ID_LEADTEK 0x107d +#define PCI_DEVICE_ID_LEADTEK_805 0x0000 + +#define PCI_VENDOR_ID_CONTAQ 0x1080 +#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 + +#define PCI_VENDOR_ID_FOREX 0x1083 + +#define PCI_VENDOR_ID_OLICOM 0x108d #define PCI_VENDOR_ID_CMD 0x1095 #define PCI_DEVICE_ID_CMD_640 0x0640 +#define PCI_DEVICE_ID_CMD_646 0x0646 #define PCI_VENDOR_ID_VISION 0x1098 #define PCI_DEVICE_ID_VISION_QD8500 0x0001 #define PCI_DEVICE_ID_VISION_QD8580 0x0002 -#define PCI_VENDOR_ID_AMD 0x1022 -#define PCI_DEVICE_ID_AMD_LANCE 0x2000 -#define PCI_DEVICE_ID_AMD_SCSI 0x2020 +#define PCI_VENDOR_ID_SIERRA 0x10a8 +#define PCI_DEVICE_ID_SIERRA_STB 0x0000 -#define PCI_VENDOR_ID_VLSI 0x1004 -#define PCI_DEVICE_ID_VLSI_82C593 0x0006 -#define PCI_DEVICE_ID_VLSI_82C592 0x0005 +#define PCI_VENDOR_ID_ACC 0x10aa +#define PCI_DEVICE_ID_ACC_2056 0x0000 -#define PCI_VENDOR_ID_ADL 0x1005 -#define PCI_DEVICE_ID_ADL_2301 0x2301 +#define PCI_VENDOR_ID_WINBOND 0x10ad +#define PCI_DEVICE_ID_WINBOND_83769 0x0001 +#define PCI_DEVICE_ID_WINBOND_82C105 0x0105 -#define PCI_VENDOR_ID_SYMPHONY 0x1c1c -#define PCI_DEVICE_ID_SYMPHONY_101 0x0001 +#define PCI_VENDOR_ID_3COM 0x10b7 +#define PCI_DEVICE_ID_3COM_3C590 0x5900 +#define PCI_DEVICE_ID_3COM_3C595TX 0x5950 +#define PCI_DEVICE_ID_3COM_3C595T4 0x5951 +#define PCI_DEVICE_ID_3COM_3C595MII 0x5952 -#define PCI_VENDOR_ID_TRIDENT 0x1023 -#define PCI_DEVICE_ID_TRIDENT_9420 0x9420 -#define PCI_DEVICE_ID_TRIDENT_9440 0x9440 +#define PCI_VENDOR_ID_AL 0x10b9 +#define PCI_DEVICE_ID_AL_M1445 0x1445 +#define PCI_DEVICE_ID_AL_M1449 0x1449 +#define PCI_DEVICE_ID_AL_M1451 0x1451 +#define PCI_DEVICE_ID_AL_M1461 0x1461 +#define PCI_DEVICE_ID_AL_M1489 0x1489 +#define PCI_DEVICE_ID_AL_M1511 0x1511 +#define PCI_DEVICE_ID_AL_M1513 0x1513 +#define PCI_DEVICE_ID_AL_M4803 0x5215 -#define PCI_VENDOR_ID_CONTAQ 0x1080 -#define PCI_DEVICE_ID_CONTAQ_82C599 0x0600 +#define PCI_VENDOR_ID_ASP 0x10cd +#define PCI_DEVICE_ID_ASP_ABP940 0x1200 -#define PCI_VENDOR_ID_NS 0x100b -#define PCI_DEVICE_ID_NS_87410 0xd001 +#define PCI_VENDOR_ID_CERN 0x10dc +#define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001 +#define PCI_DEVICE_ID_CERN_SPSB_PCI 0x0002 + +#define PCI_VENDOR_ID_IMS 0x10e0 +#define PCI_DEVICE_ID_IMS_8849 0x8849 + +#define PCI_VENDOR_ID_TEKRAM2 0x10e1 +#define PCI_DEVICE_ID_TEKRAM2_690c 0x690c + +#define PCI_VENDOR_ID_AMCC 0x10e8 +#define PCI_DEVICE_ID_AMCC_MYRINET 0x8043 + +#define PCI_VENDOR_ID_INTERG 0x10ea +#define PCI_DEVICE_ID_INTERG_1680 0x1680 + +#define PCI_VENDOR_ID_REALTEK 0x10ec +#define PCI_DEVICE_ID_REALTEK_8029 0x8029 + +#define PCI_VENDOR_ID_INIT 0x1101 +#define PCI_DEVICE_ID_INIT_320P 0x9100 #define PCI_VENDOR_ID_VIA 0x1106 #define PCI_DEVICE_ID_VIA_82C505 0x0505 -#define PCI_DEVICE_ID_VIA_82C576 0x0576 #define PCI_DEVICE_ID_VIA_82C561 0x0561 +#define PCI_DEVICE_ID_VIA_82C576 0x0576 +#define PCI_DEVICE_ID_VIA_82C416 0x1571 + +#define PCI_VENDOR_ID_VORTEX 0x1119 +#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 +#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 +#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002 +#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003 +#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004 +#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005 +#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006 +#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007 +#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008 +#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009 +#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a +#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b +#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c +#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d -#define PCI_VENDOR_ID_SI 0x1039 -#define PCI_DEVICE_ID_SI_496 0x0496 -#define PCI_DEVICE_ID_SI_501 0x0406 -#define PCI_DEVICE_ID_SI_503 0x0008 -#define PCI_DEVICE_ID_SI_601 0x0601 +#define PCI_VENDOR_ID_EF 0x111a +#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 +#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 -#define PCI_VENDOR_ID_LEADTEK 0x107d -#define PCI_DEVICE_ID_LEADTEK_805 0x0000 +#define PCI_VENDOR_ID_FORE 0x1127 +#define PCI_DEVICE_ID_FORE_PCA200PC 0x0210 +#define PCI_DEVICE_ID_FORE_PCA200E 0x0300 -#define PCI_VENDOR_ID_IMS 0x10e0 -#define PCI_DEVICE_ID_IMS_8849 0x8849 +#define PCI_VENDOR_ID_IMAGINGTECH 0x112f +#define PCI_DEVICE_ID_IMAGINGTECH_ICPCI 0x0000 -#define PCI_VENDOR_ID_ZEINET 0x1193 -#define PCI_DEVICE_ID_ZEINET_1221 0x0001 +#define PCI_VENDOR_ID_PLX 0x113c +#define PCI_DEVICE_ID_PLX_9060 0x0001 -#define PCI_VENDOR_ID_EF 0x111a -#define PCI_DEVICE_ID_EF_ATM 0x0000 +#define PCI_VENDOR_ID_ALLIANCE 0x1142 +#define PCI_DEVICE_ID_ALLIANCE_PROMOTIO 0x3210 +#define PCI_DEVICE_ID_ALLIANCE_PROVIDEO 0x6422 -#define PCI_VENDOR_ID_HER 0xedd8 -#define PCI_DEVICE_ID_HER_STING 0xa091 +#define PCI_VENDOR_ID_VMIC 0x114a +#define PCI_DEVICE_ID_VMIC_VME 0x7587 -#define PCI_VENDOR_ID_ATRONICS 0x907f -#define PCI_DEVICE_ID_ATRONICS_2015 0x2015 +#define PCI_VENDOR_ID_DIGI 0x114f +#define PCI_DEVICE_ID_DIGI_RIGHTSWITCH 0x0003 -#define PCI_VENDOR_ID_CT 0x102c -#define PCI_DEVICE_ID_CT_65545 0x00d8 +#define PCI_VENDOR_ID_MUTECH 0x1159 +#define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 -#define PCI_VENDOR_ID_FD 0x1036 -#define PCI_DEVICE_ID_FD_36C70 0x0000 +#define PCI_VENDOR_ID_TOSHIBA 0x1179 -#define PCI_VENDOR_ID_WINBOND 0x10ad -#define PCI_DEVICE_ID_WINBOND_83769 0x0001 +#define PCI_VENDOR_ID_ZEITNET 0x1193 +#define PCI_DEVICE_ID_ZEITNET_1221 0x0001 +#define PCI_DEVICE_ID_ZEITNET_1225 0x0002 -#define PCI_VENDOR_ID_3COM 0x10b7 -#define PCI_DEVICE_ID_3COM_3C590 0x5900 -#define PCI_DEVICE_ID_3COM_3C595TX 0x5950 -#define PCI_DEVICE_ID_3COM_3C595T4 0x5951 -#define PCI_DEVICE_ID_3COM_3C595MII 0x5952 +#define PCI_VENDOR_ID_SPECIALIX 0x11cb +#define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 +#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 -#define PCI_VENDOR_ID_PROMISE 0x105a -#define PCI_DEVICE_ID_PROMISE_5300 0x5300 +#define PCI_VENDOR_ID_RP 0x11fe +#define PCI_DEVICE_ID_RP8OCTA 0x0001 +#define PCI_DEVICE_ID_RP8INTF 0x0002 +#define PCI_DEVICE_ID_RP16INTF 0x0003 +#define PCI_DEVICE_ID_RP32INTF 0x0004 -#define PCI_VENDOR_ID_QLOGIC 0x1077 -#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 -#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022 +#define PCI_VENDOR_ID_CYCLADES 0x120e +#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 +#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 +#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 +#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 -#define PCI_VENDOR_ID_X 0x1061 -#define PCI_DEVICE_ID_X_AGX016 0x0001 +#define PCI_VENDOR_ID_SYMPHONY 0x1c1c +#define PCI_DEVICE_ID_SYMPHONY_101 0x0001 + +#define PCI_VENDOR_ID_TEKRAM 0x1de1 +#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 + +#define PCI_VENDOR_ID_3DLABS 0x3D3D +#define PCI_DEVICE_ID_3DLABS_300SX 0x0001 + +#define PCI_VENDOR_ID_AVANCE 0x4005 +#define PCI_DEVICE_ID_AVANCE_2302 0x2302 + +#define PCI_VENDOR_ID_S3 0x5333 +#define PCI_DEVICE_ID_S3_ViRGE 0x5631 +#define PCI_DEVICE_ID_S3_TRIO 0x8811 +#define PCI_DEVICE_ID_S3_AURORA64VP 0x8812 +#define PCI_DEVICE_ID_S3_TRIO64UVP 0x8814 +#define PCI_DEVICE_ID_S3_ViRGE_VX 0x883d +#define PCI_DEVICE_ID_S3_868 0x8880 +#define PCI_DEVICE_ID_S3_928 0x88b0 +#define PCI_DEVICE_ID_S3_864_1 0x88c0 +#define PCI_DEVICE_ID_S3_864_2 0x88c1 +#define PCI_DEVICE_ID_S3_964_1 0x88d0 +#define PCI_DEVICE_ID_S3_964_2 0x88d1 +#define PCI_DEVICE_ID_S3_968 0x88f0 + +#define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_DEVICE_ID_INTEL_82375 0x0482 +#define PCI_DEVICE_ID_INTEL_82424 0x0483 +#define PCI_DEVICE_ID_INTEL_82378 0x0484 +#define PCI_DEVICE_ID_INTEL_82430 0x0486 +#define PCI_DEVICE_ID_INTEL_82434 0x04a3 +#define PCI_DEVICE_ID_INTEL_7116 0x1223 +#define PCI_DEVICE_ID_INTEL_82596 0x1226 +#define PCI_DEVICE_ID_INTEL_82865 0x1227 +#define PCI_DEVICE_ID_INTEL_82557 0x1229 +#define PCI_DEVICE_ID_INTEL_82437 0x122d +#define PCI_DEVICE_ID_INTEL_82371_0 0x122e +#define PCI_DEVICE_ID_INTEL_82371_1 0x1230 +#define PCI_DEVICE_ID_INTEL_82441 0x1237 +#define PCI_DEVICE_ID_INTEL_82439 0x1250 +#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 +#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 +#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 +#define PCI_DEVICE_ID_INTEL_82437VX 0x7030 +#define PCI_DEVICE_ID_INTEL_P6 0x84c4 + +#define PCI_VENDOR_ID_ADAPTEC 0x9004 +#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 +#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 +#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 +#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 +#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 +#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178 +#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 +#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 +#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 +#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 +#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 +#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 +#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378 +#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478 + +#define PCI_VENDOR_ID_ATRONICS 0x907f +#define PCI_DEVICE_ID_ATRONICS_2015 0x2015 + +#define PCI_VENDOR_ID_HER 0xedd8 +#define PCI_DEVICE_ID_HER_STING 0xa091 +#define PCI_DEVICE_ID_HER_STINGARK 0xa099 /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded * in a single byte as follows: * - * 7:4 = slot - * 3:0 = function + * 7:3 = slot + * 2:0 = function */ #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) @@ -418,7 +665,6 @@ extern unsigned long pci_init (unsigned long mem_start, unsigned long mem_end); extern struct pci_dev_info *pci_lookup_dev (unsigned int vendor, unsigned int dev); -extern char *pci_strbioserr (int error); extern const char *pci_strclass (unsigned int class); extern const char *pci_strvendor (unsigned int vendor); extern const char *pci_strdev (unsigned int vendor, unsigned int device); diff --git a/include/linux/pcwd.h b/include/linux/pcwd.h new file mode 100644 index 000000000..6b77fdefa --- /dev/null +++ b/include/linux/pcwd.h @@ -0,0 +1,12 @@ +/* + * Berkshire PC Watchdog Defines + * For version 0.41 of the driver + */ + +#define PCWD_IOCTL_BASE 'W' + +#define PCWD_GETSTAT _IOR(PCWD_IOCTL_BASE, 1, int) +#define PCWD_PING _IOR(PCWD_IOCTL_BASE, 2, int) + +#define PCWD_PREVRESET 0x01 /* System previously reset by card */ +#define PCWD_TEMPSENSE 0x02 /* Temperature overheat sense */ diff --git a/include/linux/personality.h b/include/linux/personality.h index 47aa02c35..91538d2bd 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -32,12 +32,12 @@ typedef asmlinkage void (*lcall7_func)(struct pt_regs *); * offset of the handler is hard coded in kernel/sys_call.S. */ struct exec_domain { - char *name; + const char *name; lcall7_func handler; unsigned char pers_low, pers_high; unsigned long * signal_map; unsigned long * signal_invmap; - int *use_count; + long *use_count; struct exec_domain *next; }; @@ -46,6 +46,6 @@ extern struct exec_domain default_exec_domain; extern struct exec_domain *lookup_exec_domain(unsigned long personality); extern int register_exec_domain(struct exec_domain *it); extern int unregister_exec_domain(struct exec_domain *it); -extern asmlinkage int sys_personality(unsigned long personality); +asmlinkage int sys_personality(unsigned long personality); #endif /* _PERSONALITY_H */ diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h new file mode 100644 index 000000000..f0ccb3bb9 --- /dev/null +++ b/include/linux/posix_types.h @@ -0,0 +1,56 @@ +#ifndef _LINUX_POSIX_TYPES_H +#define _LINUX_POSIX_TYPES_H + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +#ifndef NULL +# define NULL ((void *) 0) +#endif + +/* + * This allows for 1024 file descriptors: if NR_OPEN is ever grown + * beyond that you'll have to change this too. But 1024 fd's seem to be + * enough even for such "real" unices like OSF/1, so hopefully this is + * one limit that doesn't have to be changed [again]. + * + * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in + * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical + * place for them. Solved by having dummy defines in <sys/time.h>. + */ + +/* + * Those macros may have been defined in <gnu/types.h>. But we always + * use the ones here. + */ +#undef __NFDBITS +#define __NFDBITS (8 * sizeof(unsigned long)) + +#undef __FD_SETSIZE +#define __FD_SETSIZE 1024 + +#undef __FDSET_LONGS +#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) + +#undef __FDELT +#define __FDELT(d) ((d) / __NFDBITS) + +#undef __FDMASK +#define __FDMASK(d) (1UL << ((d) % __NFDBITS)) + +typedef struct fd_set { + unsigned long fds_bits [__FDSET_LONGS]; +} __kernel_fd_set; + +/* Type of a signal handler. */ +typedef void (*__kernel_sighandler_t)(int); + +/* Type of a SYSV IPC key. */ +typedef int __kernel_key_t; + +#include <asm/posix_types.h> + +#endif /* _LINUX_POSIX_TYPES_H */ diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h new file mode 100644 index 000000000..8bc478d6e --- /dev/null +++ b/include/linux/ppp-comp.h @@ -0,0 +1,192 @@ +/* + * ppp-comp.h - Definitions for doing PPP packet compression. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * $Id: ppp-comp.h,v 1.7 1995/05/01 01:43:37 paulus Exp $ + */ + +/* + * ==FILEVERSION 960302== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * ppp-comp.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new ppp-comp.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _NET_PPP_COMP_H +#define _NET_PPP_COMP_H + +/* + * The following symbols control whether we include code for + * various compression methods. + */ + +#ifndef DO_BSD_COMPRESS +#define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */ +#endif + +#define DO_PREDICTOR_1 0 +#define DO_PREDICTOR_2 0 +#define DO_DEFLATE 0 + +/* + * Structure giving methods for compression/decompression. + */ + +#ifdef PACKETPTR +struct compressor { + int compress_proto; /* CCP compression protocol number */ + + /* Allocate space for a compressor (transmit side) */ + void *(*comp_alloc) (unsigned char *options, int opt_len); + + /* Free space used by a compressor */ + void (*comp_free) (void *state); + + /* Initialize a compressor */ + int (*comp_init) (void *state, unsigned char *options, + int opt_len, int unit, int opthdr, int debug); + + /* Reset a compressor */ + void (*comp_reset) (void *state); + + /* Compress a packet */ + int (*compress) (void *state, unsigned char *rptr, + unsigned char *obuf, int isize, int osize); + + /* Return compression statistics */ + void (*comp_stat) (void *state, struct compstat *stats); + + /* Allocate space for a decompressor (receive side) */ + void *(*decomp_alloc) (unsigned char *options, int opt_len); + + /* Free space used by a decompressor */ + void (*decomp_free) (void *state); + + /* Initialize a decompressor */ + int (*decomp_init) (void *state, unsigned char *options, + int opt_len, int unit, int opthdr, int mru, + int debug); + + /* Reset a decompressor */ + void (*decomp_reset) (void *state); + + /* Decompress a packet. */ + int (*decompress) (void *state, unsigned char *ibuf, int isize, + unsigned char *obuf, int osize); + + /* Update state for an incompressible packet received */ + void (*incomp) (void *state, unsigned char *ibuf, int icnt); + + /* Return decompression statistics */ + void (*decomp_stat) (void *state, struct compstat *stats); +}; +#endif /* PACKETPTR */ + +/* + * Return values for decompress routine. + * We need to make these distinctions so that we can disable certain + * useful functionality, namely sending a CCP reset-request as a result + * of an error detected after decompression. This is to avoid infringing + * a patent held by Motorola. + * Don't you just lurve software patents. + */ + +#define DECOMP_OK 0 /* everything went OK */ +#define DECOMP_ERROR 1 /* error detected before decomp. */ +#define DECOMP_FATALERROR 2 /* error detected after decomp. */ + +/* + * CCP codes. + */ + +#define CCP_CONFREQ 1 +#define CCP_CONFACK 2 +#define CCP_TERMREQ 5 +#define CCP_TERMACK 6 +#define CCP_RESETREQ 14 +#define CCP_RESETACK 15 + +/* + * Max # bytes for a CCP option + */ + +#define CCP_MAX_OPTION_LENGTH 32 + +/* + * Parts of a CCP packet. + */ + +#define CCP_CODE(dp) ((dp)[0]) +#define CCP_ID(dp) ((dp)[1]) +#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) +#define CCP_HDRLEN 4 + +#define CCP_OPT_CODE(dp) ((dp)[0]) +#define CCP_OPT_LENGTH(dp) ((dp)[1]) +#define CCP_OPT_MINLEN 2 + +/* + * Definitions for BSD-Compress. + */ + +#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ +#define CILEN_BSD_COMPRESS 3 /* length of config. option */ + +/* Macros for handling the 3rd byte of the BSD-Compress config option. */ +#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ +#define BSD_VERSION(x) ((x) >> 5) /* version of option format */ +#define BSD_CURRENT_VERSION 1 /* current version number */ +#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) + +#define BSD_MIN_BITS 9 /* smallest code size supported */ +#define BSD_MAX_BITS 15 /* largest code size supported */ + +/* + * Definitions for other, as yet unsupported, compression methods. + */ + +#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ +#define CILEN_PREDICTOR_1 2 /* length of its config option */ +#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ +#define CILEN_PREDICTOR_2 2 /* length of its config option */ + +#define CI_DEFLATE 24 /* config option for Deflate */ +#define CILEN_DEFLATE 4 /* length of its config option */ + +#define DEFLATE_MIN_SIZE 8 +#define DEFLATE_MAX_SIZE 15 +#define DEFLATE_METHOD_VAL 8 +#define DEFLATE_SIZE(x) (((x) >> 4) + DEFLATE_MIN_SIZE) +#define DEFLATE_METHOD(x) ((x) & 0x0F) +#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \ + + DEFLATE_METHOD_VAL) +#define DEFLATE_CHK_SEQUENCE 0 + +#endif /* _NET_PPP_COMP_H */ diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h new file mode 100644 index 000000000..1b20ab9e1 --- /dev/null +++ b/include/linux/ppp_defs.h @@ -0,0 +1,178 @@ +/* $Id: ppp_defs.h,v 1.2 1994/09/21 01:31:06 paulus Exp $ */ + +/* + * ppp_defs.h - PPP definitions. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +/* + * ==FILEVERSION 960302== + * + * NOTE TO MAINTAINERS: + * If you modify this file at all, please set the above date. + * ppp_defs.h is shipped with a PPP distribution as well as with the kernel; + * if everyone increases the FILEVERSION number above, then scripts + * can do the right thing when deciding whether to install a new ppp_defs.h + * file. Don't change the format of that line otherwise, so the + * installation script can recognize it. + */ + +#ifndef _PPP_DEFS_H_ +#define _PPP_DEFS_H_ + +/* + * The basic PPP frame. + */ +#define PPP_HDRLEN 4 /* octets for standard ppp header */ +#define PPP_FCSLEN 2 /* octets for FCS */ +#define PPP_MRU 1500 /* default MRU = max length of info field */ + +#define PPP_ADDRESS(p) (((__u8 *)(p))[0]) +#define PPP_CONTROL(p) (((__u8 *)(p))[1]) +#define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) + +/* + * Significant octet values. + */ +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_IPX 0x2b /* IPX protocol */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_IPXCP 0x802b /* IPX Control Protocol */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQR 0xc025 /* Link Quality Report protocol */ +#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ + +/* + * Values for FCS calculations. + */ + +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ +#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) + +/* + * Extended asyncmap - allows any character to be escaped. + */ + +typedef __u32 ext_accm[8]; + +/* + * What to do with network protocol (NP) packets. + */ +enum NPmode { + NPMODE_PASS, /* pass the packet through */ + NPMODE_DROP, /* silently drop the packet */ + NPMODE_ERROR, /* return an error */ + NPMODE_QUEUE /* save it up for later. */ +}; + +/* + * Statistics for LQRP and pppstats + */ +struct pppstat { + __u32 ppp_discards; /* # frames discarded */ + + __u32 ppp_ibytes; /* bytes received */ + __u32 ppp_ioctects; /* bytes received not in error */ + __u32 ppp_ipackets; /* packets received */ + __u32 ppp_ierrors; /* receive errors */ + __u32 ppp_ilqrs; /* # LQR frames received */ + + __u32 ppp_obytes; /* raw bytes sent */ + __u32 ppp_ooctects; /* frame bytes sent */ + __u32 ppp_opackets; /* packets sent */ + __u32 ppp_oerrors; /* transmit errors */ + __u32 ppp_olqrs; /* # LQR frames sent */ +}; + +struct vjstat { + __u32 vjs_packets; /* outbound packets */ + __u32 vjs_compressed; /* outbound compressed packets */ + __u32 vjs_searches; /* searches for connection state */ + __u32 vjs_misses; /* times couldn't find conn. state */ + __u32 vjs_uncompressedin; /* inbound uncompressed packets */ + __u32 vjs_compressedin; /* inbound compressed packets */ + __u32 vjs_errorin; /* inbound unknown type packets */ + __u32 vjs_tossed; /* inbound packets tossed because of error */ +}; + +struct compstat { + __u32 unc_bytes; /* total uncompressed bytes */ + __u32 unc_packets; /* total uncompressed packets */ + __u32 comp_bytes; /* compressed bytes */ + __u32 comp_packets; /* compressed packets */ + __u32 inc_bytes; /* incompressible bytes */ + __u32 inc_packets; /* incompressible packets */ + + /* the compression ratio is defined as in_count / bytes_out */ + __u32 in_count; /* Bytes received */ + __u32 bytes_out; /* Bytes transmitted */ + + double ratio; /* not computed in kernel. */ +}; + +struct ppp_stats { + struct pppstat p; /* basic PPP statistics */ + struct vjstat vj; /* VJ header compression statistics */ +}; + +struct ppp_comp_stats { + struct compstat c; /* packet compression statistics */ + struct compstat d; /* packet decompression statistics */ +}; + +/* + * The following structure records the time in seconds since + * the last NP packet was sent or received. + */ +struct ppp_idle { + time_t xmit_idle; /* time since last NP packet sent */ + time_t recv_idle; /* time since last NP packet received */ +}; + +#ifndef __P +#ifdef __STDC__ +#define __P(x) x +#else +#define __P(x) () +#endif +#endif + +#endif /* _PPP_DEFS_H_ */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index c70aa162a..42ad7cacb 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -1,12 +1,17 @@ #ifndef _LINUX_PROC_FS_H #define _LINUX_PROC_FS_H -#include <linux/config.h> +#include <linux/fs.h> +#include <linux/malloc.h> /* * The proc filesystem constants/structures */ +/* + * We always define these enumerators + */ + enum root_directory_inos { PROC_ROOT_INO = 1, PROC_LOADAVG, @@ -18,9 +23,8 @@ enum root_directory_inos { PROC_PCI, PROC_SELF, /* will change inode # */ PROC_NET, -#ifdef CONFIG_DEBUG_MALLOC + PROC_SCSI, PROC_MALLOC, -#endif PROC_KCORE, PROC_MODULES, PROC_STAT, @@ -30,11 +34,21 @@ enum root_directory_inos { PROC_KSYMS, PROC_DMA, PROC_IOPORTS, - PROC_PROFILE /* whether enabled or not */ +#ifdef __SMP_PROF__ + PROC_SMP_PROF, +#endif + PROC_PROFILE, /* whether enabled or not */ + PROC_CMDLINE, + PROC_SYS, + PROC_MTAB, + PROC_MD, + PROC_RTC, + PROC_LOCKS }; enum pid_directory_inos { PROC_PID_INO = 2, + PROC_PID_STATUS, PROC_PID_MEM, PROC_PID_CWD, PROC_PID_ROOT, @@ -53,7 +67,6 @@ enum pid_subdirectory_inos { enum net_directory_inos { PROC_NET_UNIX = 128, -#ifdef CONFIG_INET PROC_NET_ARP, PROC_NET_ROUTE, PROC_NET_DEV, @@ -61,69 +74,210 @@ enum net_directory_inos { PROC_NET_TCP, PROC_NET_UDP, PROC_NET_SNMP, -#ifdef CONFIG_INET_RARP PROC_NET_RARP, -#endif -#ifdef CONFIG_IP_MULTICAST PROC_NET_IGMP, -#endif -#ifdef CONFIG_IP_FIREWALL + PROC_NET_IPMR_VIF, + PROC_NET_IPMR_MFC, PROC_NET_IPFWFWD, - PROC_NET_IPFWBLK, -#endif -#ifdef CONFIG_IP_ACCT + PROC_NET_IPFWIN, + PROC_NET_IPFWOUT, PROC_NET_IPACCT, -#endif -#ifdef CONFIG_IP_MASQUERADE PROC_NET_IPMSQHST, -#endif -#if defined(CONFIG_WAVELAN) PROC_NET_WAVELAN, -#endif /* defined(CONFIG_WAVELAN) */ -#endif -#ifdef CONFIG_IPX PROC_NET_IPX_INTERFACE, PROC_NET_IPX_ROUTE, PROC_NET_IPX, -#endif -#ifdef CONFIG_ATALK PROC_NET_ATALK, PROC_NET_AT_ROUTE, PROC_NET_ATIF, -#endif -#ifdef CONFIG_AX25 PROC_NET_AX25_ROUTE, PROC_NET_AX25, -#ifdef CONFIG_NETROM + PROC_NET_AX25_CALLS, PROC_NET_NR_NODES, PROC_NET_NR_NEIGH, PROC_NET_NR, -#endif -#endif PROC_NET_SOCKSTAT, + PROC_NET_RTCACHE, + PROC_NET_AX25_BPQETHER, + PROC_NET_ALIAS_TYPES, + PROC_NET_ALIASES, + PROC_NET_IP_MASQ_APP, + PROC_NET_RT6, + PROC_NET_RT6_STATS, + PROC_NET_STRIP_STATUS, + PROC_NET_STRIP_TRACE, + PROC_NET_Z8530, + PROC_NET_RS_NODES, + PROC_NET_RS_NEIGH, + PROC_NET_RS_ROUTES, + PROC_NET_RS, PROC_NET_LAST }; +enum scsi_directory_inos { + PROC_SCSI_SCSI = 256, + PROC_SCSI_ADVANSYS, + PROC_SCSI_EATA, + PROC_SCSI_EATA_PIO, + PROC_SCSI_AHA152X, + PROC_SCSI_AHA1542, + PROC_SCSI_AHA1740, + PROC_SCSI_AIC7XXX, + PROC_SCSI_BUSLOGIC, + PROC_SCSI_U14_34F, + PROC_SCSI_FDOMAIN, + PROC_SCSI_GENERIC_NCR5380, + PROC_SCSI_IN2000, + PROC_SCSI_PAS16, + PROC_SCSI_QLOGICFAS, + PROC_SCSI_QLOGICISP, + PROC_SCSI_SEAGATE, + PROC_SCSI_T128, + PROC_SCSI_NCR53C7xx, + PROC_SCSI_NCR53C8XX, + PROC_SCSI_ULTRASTOR, + PROC_SCSI_7000FASST, + PROC_SCSI_EATA2X, + PROC_SCSI_AM53C974, + PROC_SCSI_SSC, + PROC_SCSI_NCR53C406A, + PROC_SCSI_PPA, + PROC_SCSI_ESP, + PROC_SCSI_A3000, + PROC_SCSI_A2091, + PROC_SCSI_GVP11, + PROC_SCSI_ATARI, + PROC_SCSI_SCSI_DEBUG, + PROC_SCSI_NOT_PRESENT, + PROC_SCSI_FILE, /* I'm assuming here that we */ + PROC_SCSI_LAST = (PROC_SCSI_FILE + 16) /* won't ever see more than */ +}; /* 16 HBAs in one machine */ + +/* Finally, the dynamically allocatable proc entries are reserved: */ + +#define PROC_DYNAMIC_FIRST 4096 +#define PROC_NDYNAMIC 4096 + #define PROC_SUPER_MAGIC 0x9fa0 +/* + * This is not completely implemented yet. The idea is to + * create an in-memory tree (like the actual /proc filesystem + * tree) of these proc_dir_entries, so that we can dynamically + * add new files to /proc. + * + * The "next" pointer creates a linked list of one /proc directory, + * while parent/subdir create the directory structure (every + * /proc file has a parent, but "subdir" is NULL for all + * non-directory entries). + * + * "get_info" is called at "read", while "fill_inode" is used to + * fill in file type/protection/owner information specific to the + * particular /proc file. + */ struct proc_dir_entry { unsigned short low_ino; unsigned short namelen; - char * name; + const char *name; + mode_t mode; + nlink_t nlink; + uid_t uid; + gid_t gid; + unsigned long size; + struct inode_operations * ops; + int (*get_info)(char *, char **, off_t, int, int); + void (*fill_inode)(struct inode *); + struct proc_dir_entry *next, *parent, *subdir; + void *data; }; +extern int (* dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, + off_t offset, int length, int inout); + +extern struct proc_dir_entry proc_root; +extern struct proc_dir_entry proc_net; +extern struct proc_dir_entry proc_scsi; +extern struct proc_dir_entry proc_sys; +extern struct proc_dir_entry proc_pid; +extern struct proc_dir_entry proc_pid_fd; + +extern struct inode_operations proc_scsi_inode_operations; + +extern void proc_root_init(void); +extern void proc_base_init(void); +extern void proc_net_init(void); + +extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); +extern int proc_register_dynamic(struct proc_dir_entry *, + struct proc_dir_entry *); +extern int proc_unregister(struct proc_dir_entry *, int); + +static inline int proc_net_register(struct proc_dir_entry * x) +{ + return proc_register(&proc_net, x); +} + +static inline int proc_net_unregister(int x) +{ + return proc_unregister(&proc_net, x); +} + +static inline int proc_scsi_register(struct proc_dir_entry *driver, + struct proc_dir_entry *x) +{ + x->ops = &proc_scsi_inode_operations; + if(x->low_ino < PROC_SCSI_FILE){ + return(proc_register(&proc_scsi, x)); + }else{ + return(proc_register(driver, x)); + } +} + +static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x) +{ + extern void scsi_init_free(char *ptr, unsigned int size); + + if(x <= PROC_SCSI_FILE) + return(proc_unregister(&proc_scsi, x)); + else { + struct proc_dir_entry **p = &driver->subdir, *dp; + int ret; + + while ((dp = *p) != NULL) { + if (dp->low_ino == x) + break; + p = &dp->next; + } + ret = proc_unregister(driver, x); + scsi_init_free((char *) dp, sizeof(struct proc_dir_entry) + 4); + return(ret); + } +} + extern struct super_block *proc_read_super(struct super_block *,void *,int); -extern void proc_put_inode(struct inode *); -extern void proc_put_super(struct super_block *); +extern int init_proc_fs(void); +extern struct inode * proc_get_inode(struct super_block *, int, struct proc_dir_entry *); extern void proc_statfs(struct super_block *, struct statfs *, int); extern void proc_read_inode(struct inode *); extern void proc_write_inode(struct inode *); extern int proc_match(int, const char *, struct proc_dir_entry *); -extern struct inode_operations proc_root_inode_operations; -extern struct inode_operations proc_base_inode_operations; +/* + * These are generic /proc routines that use the internal + * "struct proc_dir_entry" tree to traverse the filesystem. + * + * The /proc root directory has extended versions to take care + * of the /proc/<pid> subdirectories. + */ +extern int proc_readdir(struct inode *, struct file *, void *, filldir_t); +extern int proc_lookup(struct inode *, const char *, int, struct inode **); + +extern struct inode_operations proc_dir_inode_operations; extern struct inode_operations proc_net_inode_operations; +extern struct inode_operations proc_netdir_inode_operations; +extern struct inode_operations proc_scsi_inode_operations; extern struct inode_operations proc_mem_inode_operations; +extern struct inode_operations proc_sys_inode_operations; extern struct inode_operations proc_array_inode_operations; extern struct inode_operations proc_arraylong_inode_operations; extern struct inode_operations proc_kcore_inode_operations; diff --git a/include/linux/quota.h b/include/linux/quota.h new file mode 100644 index 000000000..5eebb8a7b --- /dev/null +++ b/include/linux/quota.h @@ -0,0 +1,219 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Elz at The University of Melbourne. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Version: $Id: quota.h,v 1.8 1995/03/11 11:43:07 mvw Exp mvw $ + */ + +#ifndef _LINUX_QUOTA_ +#define _LINUX_QUOTA_ + +#include <linux/errno.h> + +/* + * Convert diskblocks to blocks and the other way around. + * currently only to fool the BSD source. :-) + */ +#define dbtob(num) (num << 10) +#define btodb(num) (num >> 10) + +/* + * Convert count of filesystem blocks to diskquota blocks, meant + * for filesystems where i_blksize != BLOCK_SIZE + */ +#define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE) + +/* + * Definitions for disk quotas imposed on the average user + * (big brother finally hits Linux). + * + * The following constants define the amount of time given a user + * before the soft limits are treated as hard limits (usually resulting + * in an allocation failure). The timer is started when the user crosses + * their soft limit, it is reset when they go below their soft limit. + */ +#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */ +#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */ + +#define MAXQUOTAS 2 +#define USRQUOTA 0 /* element used for user quotas */ +#define GRPQUOTA 1 /* element used for group quotas */ + +/* + * Definitions for the default names of the quotas files. + */ +#define INITQFNAMES { \ + "user", /* USRQUOTA */ \ + "group", /* GRPQUOTA */ \ + "undefined", \ +}; + +#define QUOTAFILENAME "quota" +#define QUOTAGROUP "staff" + +#define NR_DQHASH 43 /* Just an arbitrary number any suggestions ? */ +#define NR_DQUOTS 256 /* Number of quotas active at one time */ + +/* + * Command definitions for the 'quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_QUOTAON 0x0100 /* enable quotas */ +#define Q_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_GETQUOTA 0x0300 /* get limits and usage */ +#define Q_SETQUOTA 0x0400 /* set limits and usage */ +#define Q_SETUSE 0x0500 /* set usage */ +#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ +#define Q_SETQLIM 0x0700 /* set limits */ +#define Q_GETSTATS 0x0800 /* get collected stats */ + +/* + * The following structure defines the format of the disk quota file + * (as it appears on disk) - the file is an array of these structures + * indexed by user or group number. + */ +struct dqblk { + __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */ + __u32 dqb_bsoftlimit; /* preferred limit on disk blks */ + __u32 dqb_curblocks; /* current block count */ + __u32 dqb_ihardlimit; /* maximum # allocated inodes */ + __u32 dqb_isoftlimit; /* preferred inode limit */ + __u32 dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ +}; + +/* + * Shorthand notation. + */ +#define dq_bhardlimit dq_dqb.dqb_bhardlimit +#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit +#define dq_curblocks dq_dqb.dqb_curblocks +#define dq_ihardlimit dq_dqb.dqb_ihardlimit +#define dq_isoftlimit dq_dqb.dqb_isoftlimit +#define dq_curinodes dq_dqb.dqb_curinodes +#define dq_btime dq_dqb.dqb_btime +#define dq_itime dq_dqb.dqb_itime + +#define dqoff(UID) ((off_t)((UID) * sizeof (struct dqblk))) + +struct dqstats { + __u32 lookups; + __u32 drops; + __u32 reads; + __u32 writes; + __u32 cache_hits; + __u32 pages_allocated; + __u32 allocated_dquots; + __u32 free_dquots; + __u32 syncs; +}; + +#ifdef __KERNEL__ + +#include <linux/mount.h> + +/* + * Maximum length of a message generated in the quota system, + * that needs to be kicked onto the tty. + */ +#define MAX_QUOTA_MESSAGE 75 + +#define DQ_LOCKED 0x01 /* locked for update */ +#define DQ_WANT 0x02 /* wanted for update */ +#define DQ_MOD 0x04 /* dquot modified since read */ +#define DQ_BLKS 0x10 /* uid/gid has been warned about blk limit */ +#define DQ_INODES 0x20 /* uid/gid has been warned about inode limit */ +#define DQ_FAKE 0x40 /* no limits only usage */ + +struct dquot { + unsigned int dq_id; /* id this applies to (uid, gid) */ + short dq_type; /* type of quota */ + kdev_t dq_dev; /* Device this applies to */ + short dq_flags; /* see DQ_* */ + short dq_count; /* reference count */ + struct vfsmount *dq_mnt; /* vfsmountpoint this applies to */ + struct dqblk dq_dqb; /* diskquota usage */ + struct wait_queue *dq_wait; /* pointer to waitqueue */ + struct dquot *dq_prev; /* pointer to prev dquot */ + struct dquot *dq_next; /* pointer to next dquot */ + struct dquot *dq_hash_prev; /* pointer to prev dquot */ + struct dquot *dq_hash_next; /* pointer to next dquot */ +}; + +#define NODQUOT (struct dquot *)NULL + +/* + * Flags used for set_dqblk. + */ +#define QUOTA_SYSCALL 0x01 +#define SET_QUOTA 0x02 +#define SET_USE 0x04 +#define SET_QLIMIT 0x08 + +#define QUOTA_OK 0 +#define NO_QUOTA 1 + +/* + * declaration of quota_function calls in kernel. + */ + +extern void dquot_initialize(struct inode *inode, short type); +extern void dquot_drop(struct inode *inode); +extern int dquot_alloc_block(const struct inode *inode, unsigned long number); +extern int dquot_alloc_inode(const struct inode *inode, unsigned long number); +extern void dquot_free_block(const struct inode *inode, unsigned long number); +extern void dquot_free_inode(const struct inode *inode, unsigned long number); +extern int dquot_transfer(struct inode *inode, struct iattr *iattr, char direction); + +extern void invalidate_dquots(kdev_t dev, short type); +extern int quota_off(kdev_t dev, short type); +extern int sync_dquots(kdev_t dev, short type); + +#else + +# /* nodep */ include <sys/cdefs.h> + +__BEGIN_DECLS +int quotactl __P ((int, const char *, int, caddr_t)); +__END_DECLS + +#endif /* __KERNEL__ */ +#endif /* _QUOTA_ */ diff --git a/include/linux/raid0.h b/include/linux/raid0.h new file mode 100644 index 000000000..e1ae51c02 --- /dev/null +++ b/include/linux/raid0.h @@ -0,0 +1,27 @@ +#ifndef _RAID0_H +#define _RAID0_H + +struct strip_zone +{ + int zone_offset; /* Zone offset in md_dev */ + int dev_offset; /* Zone offset in real dev */ + int size; /* Zone size */ + int nb_dev; /* Number of devices attached to the zone */ + struct real_dev *dev[MAX_REAL]; /* Devices attached to the zone */ +}; + +struct raid0_hash +{ + struct strip_zone *zone0, *zone1; +}; + +struct raid0_data +{ + struct raid0_hash *hash_table; /* Dynamically allocated */ + struct strip_zone *strip_zone; /* This one too */ + int nr_strip_zones; + struct strip_zone *smallest; + int nr_zones; +}; + +#endif diff --git a/include/linux/random.h b/include/linux/random.h new file mode 100644 index 000000000..b2706ce03 --- /dev/null +++ b/include/linux/random.h @@ -0,0 +1,65 @@ +/* + * include/linux/random.h + * + * Include file for the random number generator. + */ + +#ifndef _LINUX_RANDOM_H +#define _LINUX_RANDOM_H + +#include <linux/ioctl.h> + +/* ioctl()'s for the random number generator */ + +/* Get the entropy count. */ +#define RNDGETENTCNT _IOR( 'R', 0x00, int ) + +/* Add to (or subtract from) the entropy count. (Superuser only.) */ +#define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) + +/* Get the contents of the entropy pool. (Superuser only.) */ +#define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) + +/* + * Write bytes into the entropy pool and add to the entropy count. + * (Superuser only.) + */ +#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) + +/* Clear entropy count to 0. (Superuser only.) */ +#define RNDZAPENTCNT _IO( 'R', 0x04 ) + +/* Clear the entropy pool and associated counters. (Superuser only.) */ +#define RNDCLEARPOOL _IO( 'R', 0x06 ) + +struct rand_pool_info { + int entropy_count; + int buf_size; + __u32 buf[0]; +}; + +/* Exported functions */ + +#ifdef __KERNEL__ + +extern void rand_initialize(void); +extern void rand_initialize_irq(int irq); +extern void rand_initialize_blkdev(int irq, int mode); + +extern void add_keyboard_randomness(unsigned char scancode); +extern void add_mouse_randomness(__u32 mouse_data); +extern void add_interrupt_randomness(int irq); +extern void add_blkdev_randomness(int major); + +extern void get_random_bytes(void *buf, int nbytes); + +extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, + __u16 sport, __u16 dport); + +#ifndef MODULE +extern struct file_operations random_fops, urandom_fops; +#endif + +#endif /* __KERNEL___ */ + +#endif /* _LINUX_RANDOM_H */ diff --git a/include/linux/resource.h b/include/linux/resource.h index ebbbcfa4e..f3bffbd7f 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h @@ -1,6 +1,8 @@ #ifndef _LINUX_RESOURCE_H #define _LINUX_RESOURCE_H +#include <linux/time.h> + /* * Resource control/accounting header file for linux */ @@ -42,8 +44,8 @@ struct rlimit { long rlim_max; }; -#define PRIO_MIN (-99) -#define PRIO_MAX 14 +#define PRIO_MIN (-20) +#define PRIO_MAX 20 #define PRIO_PROCESS 0 #define PRIO_PGRP 1 diff --git a/include/linux/rose.h b/include/linux/rose.h new file mode 100644 index 000000000..ca69e1e8b --- /dev/null +++ b/include/linux/rose.h @@ -0,0 +1,51 @@ +/* + * These are the public elements of the Linux kernel Rose implementation. + * For kernel AX.25 see the file ax25.h. This file requires ax25.h for the + * definition of the ax25_address structure. + */ + +#ifndef ROSE_KERNEL_H +#define ROSE_KERNEL_H + +#define PF_ROSE AF_ROSE +#define ROSE_MTU 128 + +#define ROSE_T0 1 +#define ROSE_T1 2 +#define ROSE_T2 3 +#define ROSE_T3 4 +#define ROSE_IDLE 5 +#define ROSE_HDRINCL 6 + +#define ROSE_KILL 99 + +#define SIOCRSCTLCON (SIOCPROTOPRIVATE+0) + +typedef struct { + char rose_addr[5]; +} rose_address; + +struct sockaddr_rose { + sa_family_t srose_family; + rose_address srose_addr; + ax25_address srose_call; + int srose_ndigis; + ax25_address srose_digi; +}; + +struct rose_route_struct { + rose_address address; + ax25_address neighbour; + char device[16]; + unsigned char ndigis; + ax25_address digipeaters[AX25_MAX_DIGIS]; +}; + +struct rose_ctl_struct { + unsigned int lci; + char dev[20]; + unsigned int cmd; + unsigned long arg; +}; + +#endif diff --git a/include/linux/route.h b/include/linux/route.h index 0f11ea2eb..bf677b2e0 100644 --- a/include/linux/route.h +++ b/include/linux/route.h @@ -8,6 +8,8 @@ * Version: @(#)route.h 1.0.3 05/27/93 * * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988 + * for the purposes of compatibility only. + * * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> * * This program is free software; you can redistribute it and/or @@ -22,7 +24,8 @@ /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ -struct rtentry { +struct rtentry +{ unsigned long rt_hash; /* hash key for lookups */ struct sockaddr rt_dst; /* target address */ struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ @@ -50,11 +53,33 @@ struct rtentry { #define RTF_IRTT 0x0100 /* Initial round trip time */ #define RTF_REJECT 0x0200 /* Reject route */ +#define RTF_ADDRCONF 0x0800 /* announced on link prefix */ +#define RTF_INVALID 0x1000 +#define RTF_DCACHE 0x2000 +#define RTF_DEFAULT 0x4000 /* Route is a default route */ +#define RTF_NEXTHOP 0x8000 /* Non gateway route with nexthop */ + /* - * REMOVE THESE BY 1.2.0 !!!!!!!!!!!!!!!!! + * This structure is passed from the kernel to user space by netlink + * routing/device announcements */ - -#define RTF_MTU RTF_MSS -#define rt_mtu rt_mss +struct netlink_rtinfo +{ + unsigned long rtmsg_type; + struct sockaddr rtmsg_dst; + struct sockaddr rtmsg_gateway; + struct sockaddr rtmsg_genmask; + short rtmsg_flags; + short rtmsg_metric; + char rtmsg_device[16]; +}; + +#define RTMSG_NEWROUTE 0x01 +#define RTMSG_DELROUTE 0x02 +#define RTMSG_NEWDEVICE 0x11 +#define RTMSG_DELDEVICE 0x12 + +#define RTMSG_AR_FAILED 0x21 /* Address Resolution failed */ #endif /* _LINUX_ROUTE_H */ + diff --git a/include/linux/rpcsock.h b/include/linux/rpcsock.h new file mode 100644 index 000000000..9a7f5eae9 --- /dev/null +++ b/include/linux/rpcsock.h @@ -0,0 +1,121 @@ +/* + * rpcsock.h Declarations for the RPC call interface. + * + * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> + */ + + +#ifndef _LINUX_RPCSOCK_H +#define _LINUX_RPCSOCK_H + +/* + * The rpcsock code maintains an estimate on the maximum number of out- + * standing RPC requests, using the congestion avoidance implemented in + * 44BSD. This is basically the Van Jacobson slow start algorithm: If a + * retransmit occurs, the congestion window is halved; otherwise, it is + * incremented by 1/cwnd when a reply is received and a full number of + * requests are outstanding. + * + * Upper procedures may check whether a request would block waiting for + * a free RPC slot by using the RPC_CONGESTED() macro. + * + * Note: on machines with low memory we should probably use a smaller + * MAXREQS value: At 32 outstanding reqs with 8 megs of RAM, fragment + * reassembly will frequently run out of memory. + */ +#define RPC_MAXREQS 32 +#define RPC_CWNDSCALE 256 +#define RPC_MAXCWND (RPC_MAXREQS * RPC_CWNDSCALE) +/* #define RPC_INITCWND (RPC_MAXCWND / 2) */ +#define RPC_INITCWND RPC_CWNDSCALE +#define RPC_CONGESTED(rsock) ((rsock)->cong >= (rsock)->cwnd) + +/* RPC reply header size: xid, direction, status, accept_status (verifier + * size computed separately) + */ +#define RPC_HDRSIZE (4 * 4) + +/* + * This describes a timeout strategy + */ +struct rpc_timeout { + unsigned long to_initval, + to_maxval, + to_increment; + int to_retries; + char to_exponential; +}; + +/* + * This describes a complete RPC request + */ +struct rpc_ioreq { + struct rpc_wait * rq_slot; + struct sockaddr * rq_addr; + int rq_alen; + struct iovec rq_svec[UIO_MAXIOV]; + unsigned int rq_snr; + unsigned long rq_slen; + struct iovec rq_rvec[UIO_MAXIOV]; + unsigned int rq_rnr; + unsigned long rq_rlen; +}; + +/* + * This is the callback handler for async RPC. + */ +struct rpc_wait; +typedef void (*rpc_callback_fn_t)(int, struct rpc_wait *, void *); + +/* + * Wait information. This struct defines all the state of an RPC + * request currently in flight. + */ +struct rpc_wait { + struct rpc_sock * w_sock; + struct rpc_wait * w_prev; + struct rpc_wait * w_next; + struct rpc_ioreq * w_req; + int w_result; + struct wait_queue * w_wait; + rpc_callback_fn_t w_handler; + void * w_cdata; + char w_queued; + char w_gotit; + __u32 w_xid; +}; + +struct rpc_sock { + struct file * file; + struct socket * sock; + struct sock * inet; + struct rpc_wait waiting[RPC_MAXREQS]; + unsigned long cong; + unsigned long cwnd; + struct rpc_wait * pending; + struct rpc_wait * free; + struct wait_queue * backlog; + struct wait_queue * shutwait; + int shutdown; +}; + +#ifdef __KERNEL__ + +/* rpc_call: Call synchronously */ +int rpc_call(struct rpc_sock *, struct rpc_ioreq *, + struct rpc_timeout *); +/* These implement asynch calls for nfsiod: Process calls rpc_reserve and + * rpc_transmits, then passes the request to nfsiod, which collects the + * results via rpc_doio + */ +int rpc_reserve(struct rpc_sock *, struct rpc_ioreq *, int); +void rpc_release(struct rpc_sock *, struct rpc_ioreq *); +int rpc_transmit(struct rpc_sock *, struct rpc_ioreq *); +int rpc_doio(struct rpc_sock *, struct rpc_ioreq *, + struct rpc_timeout *, int); +struct rpc_sock * rpc_makesock(struct file *); +int rpc_closesock(struct rpc_sock *); + +#endif /* __KERNEL__*/ + +#endif /* _LINUX_RPCSOCK_H */ diff --git a/include/linux/sbpcd.h b/include/linux/sbpcd.h index ee7ec8d4c..e9021316d 100644 --- a/include/linux/sbpcd.h +++ b/include/linux/sbpcd.h @@ -5,22 +5,28 @@ /* * Attention! This file contains user-serviceable parts! * I recommend to make use of it... + * If you feel helpless, look into linux/Documentation/cdrom/sbpcd + * (good idea anyway, at least before mailing me). * * The definitions for the first controller can get overridden by * the kernel command line ("lilo boot option"). * Examples: + * sbpcd=0x300,LaserMate + * or * sbpcd=0x230,SoundBlaster * or - * sbpcd=0x300,LaserMate + * sbpcd=0x338,SoundScape * or - * sbpcd=0x330,SPEA + * sbpcd=0x2C0,Teac16bit * * If sbpcd gets used as a module, you can load it with - * insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x230,1 + * insmod sbpcd.o sbpcd=0x300,0 * or - * insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x300,0 + * insmod sbpcd.o sbpcd=0x230,1 * or - * insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x330,2 + * insmod sbpcd.o sbpcd=0x338,2 + * or + * insmod sbpcd.o sbpcd=0x2C0,3 * respective to override the configured address and type. */ @@ -28,35 +34,36 @@ * define your CDROM port base address as CDROM_PORT * and specify the type of your interface card as SBPRO. * - * Read linux/drivers/block/README.sbpcd if you are in doubt about the - * type of your interface card (you should do that anyway). - * * address: * ======== * SBPRO type addresses typically are 0x0230 (=0x220+0x10), 0x0250, ... * LASERMATE type (CI-101P, WDH-7001C) addresses typically are 0x0300, ... - * SPEA addresses are from the LASERMATE type and range. + * SOUNDSCAPE addresses are from the LASERMATE type and range. You have to + * specify the REAL address here, not the configuration port address. Look + * at the CDROM driver's invoking line within your DOS CONFIG.SYS, or let + * sbpcd auto-probe, if you are not firm with the address. * There are some soundcards on the market with 0x0630, 0x0650, ...; their * type is not obvious (both types are possible). * * example: if your SBPRO audio address is 0x220, specify 0x230 and SBPRO 1. * if your soundcard has its CDROM port above 0x300, specify * that address and try SBPRO 0 first. + * if your SoundScape configuration port is at 0x330, specify + * 0x338 and SBPRO 2. * * interface type: * =============== * set SBPRO to 1 for "true" SoundBlaster card * set SBPRO to 0 for "compatible" soundcards and * for "poor" (no sound) interface cards. - * set SBPRO to 2 for the SPEA Media FX card + * set SBPRO to 2 for Ensonic SoundScape or SPEA Media FX cards + * set SBPRO to 3 for Teac 16bit interface cards * * Almost all "compatible" sound boards need to set SBPRO to 0. * If SBPRO is set wrong, the drives will get found - but any * data access will give errors (audio access will work). - * The "OmniCD" no-sound interface card from CreativeLabs needs SBPRO 1. - * - * mail to emoenke@gwdg.de if you have a "compatible" sound card which - * in fact needs to set SBPRO to 1 (not any known at time). + * The "OmniCD" no-sound interface card from CreativeLabs and most Teac + * interface cards need SBPRO 1. * * sound base: * =========== @@ -80,7 +87,7 @@ #define SOUND_BASE 0x000 /* <-----------<< sound address of this card or 0 */ #endif #if !(SBPCD_ISSUE-3) /* ===================== third interface board: === */ -#define CDROM_PORT 0x634 /* <-----------<< port address */ +#define CDROM_PORT 0x630 /* <-----------<< port address */ #define SBPRO 1 /* <-----------<< interface type */ #define MAX_DRIVES 4 /* set to 1 if the card does not use "drive select" */ #define SOUND_BASE 0x240 /* <-----------<< sound address of this card or 0 */ @@ -96,38 +103,85 @@ * some more or less user dependent definitions - service them! */ -/* Set this to 0 after you have configured your interface definitions right. */ +/* Set this to 0 once you have configured your interface definitions right. */ #define DISTRIBUTION 1 -/* max. number of audio frames to read with one */ -/* request (allocates n* 2352 bytes kernel memory!) */ -/* may be freely adjusted, f.e. 75 (= 1 sec.), at */ -/* runtime by use of the CDROMAUDIOBUFSIZ ioctl. */ -#define READ_AUDIO 0 +/* + * Time to wait after giving a message. + * This gets important if you enable non-standard DBG_xxx flags. + * You will see what happens if you omit the pause or make it + * too short. Be warned! + */ +#define KLOGD_PAUSE 1 -/* tray control: eject tray if no disk is in (0 or 1) */ +/* tray control: eject tray if no disk is in */ +#if DISTRIBUTION +#define JUKEBOX 0 +#else #define JUKEBOX 1 +#endif DISTRIBUTION -/* tray control: eject tray after last use (0 or 1) */ +/* tray control: eject tray after last use */ +#if DISTRIBUTION +#define EJECT 0 +#else #define EJECT 1 +#endif DISTRIBUTION + +/* max. number of audio frames to read with one */ +/* request (allocates n* 2352 bytes kernel memory!) */ +/* may be freely adjusted, f.e. 75 (= 1 sec.), at */ +/* runtime by use of the CDROMAUDIOBUFSIZ ioctl. */ +#define READ_AUDIO 0 + +/* Optimizations for the Teac CD-55A drive read performance. + * SBP_TEAC_SPEED can be changed here, or one can set the + * variable "teac" when loading as a module. + * Valid settings are: + * 0 - very slow - the recommended "DISTRIBUTION 1" setup. + * 1 - 2x performance with little overhead. No busy waiting. + * 2 - 4x performance with 5ms overhead per read. Busy wait. + * + * Setting SBP_TEAC_SPEED or the variable 'teac' to anything + * other than 0 may cause problems. If you run into them, first + * change SBP_TEAC_SPEED back to 0 and see if your drive responds + * normally. If yes, you are "allowed" to report your case - to help + * me with the driver, not to solve your hassle. Don´t mail if you + * simply are stuck into your own "tuning" experiments, you know? + */ +#define SBP_TEAC_SPEED 1 /*==========================================================================*/ /*==========================================================================*/ /* - * nothing to change below here if you are not experimenting + * nothing to change below here if you are not fully aware what you're doing */ #ifndef _LINUX_SBPCD_H #define _LINUX_SBPCD_H /*==========================================================================*/ /*==========================================================================*/ +/* + * driver's own read_ahead, data mode + */ +#define SBP_BUFFER_FRAMES 8 + #define LONG_TIMING 0 /* test against timeouts with "gold" CDs on CR-521 */ #undef FUTURE +#undef SAFE_MIXED #define TEST_UPC 0 #define SPEA_TEST 0 #define TEST_STI 0 +#define OLD_BUSY 0 #undef PATH_CHECK +#ifndef SOUND_BASE +#define SOUND_BASE 0 +#endif +#if DISTRIBUTION +#undef SBP_TEAC_SPEED +#define SBP_TEAC_SPEED 0 +#endif /*==========================================================================*/ /* * DDI interface definitions @@ -139,8 +193,6 @@ /* * "private" IOCTL functions */ -#define CDROMRESET 0x5380 /* hard-rest the drive */ -#define CDROMVOLREAD 0x5381 /* let the drive tell its volume settings */ #define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ /*==========================================================================*/ @@ -174,9 +226,9 @@ #define DBG_AUD 25 /* READ AUDIO debugging */ #define DBG_SEQ 26 /* Sequoia interface configuration trace */ #define DBG_LCS 27 /* Longshine LCS-7260 debugging trace */ -#define DBG_CD2 28 /* MKE CD200 debugging trace */ +#define DBG_CD2 28 /* MKE/Funai CD200 debugging trace */ #define DBG_TEA 29 /* TEAC CD-55A debugging trace */ -#define DBG_TE2 30 /* TEAC CD-55A 2nd debugging level */ +#define DBG_ECS 30 /* ECS-AT (Vertos 100) debugging trace */ #define DBG_000 31 /* unnecessary information */ /*==========================================================================*/ @@ -233,7 +285,7 @@ * LCS-7260 special status result bits: */ #define p_lcs_door_locked 0x02 -#define p_lcs_door_closed 0x01 +#define p_lcs_door_closed 0x01 /* probably disk_in */ /* * CR-52x special status result bits: @@ -263,6 +315,14 @@ #define pL_door_locked 0x02 #define pL_door_closed 0x01 +#define pV_door_closed 0x40 +#define pV_spinning 0x20 +#define pV_check 0x10 +#define pV_success 0x08 +#define pV_busy 0x04 +#define pV_door_locked 0x02 +#define pV_disk_ok 0x01 + #define p1_door_closed 0x80 #define p1_disk_in 0x40 #define p1_spinning 0x20 @@ -306,9 +366,9 @@ #define RESULT_READY ((inb(CDi_status)&s_not_result_ready)==0) /* - * drive types (firmware versions): + * drive families and types (firmware versions): */ -#define drv_fam0 0x08 /* CR-52x family */ +#define drv_fam0 0x0100 /* CR-52x family */ #define drv_199 (drv_fam0+0x01) /* <200 */ #define drv_200 (drv_fam0+0x02) /* <201 */ #define drv_201 (drv_fam0+0x03) /* <210 */ @@ -316,25 +376,35 @@ #define drv_211 (drv_fam0+0x05) /* <300 */ #define drv_300 (drv_fam0+0x06) /* >=300 */ -#define drv_famL 0x10 /* Longshine family */ +#define drv_fam1 0x0200 /* CR-56x family */ +#define drv_099 (drv_fam1+0x01) /* <100 */ +#define drv_100 (drv_fam1+0x02) /* >=100, only 1.02 and 5.00 known */ + +#define drv_fam2 0x0400 /* CD200 family */ + +#define drv_famT 0x0800 /* TEAC CD-55A */ + +#define drv_famL 0x1000 /* Longshine family */ #define drv_260 (drv_famL+0x01) /* LCS-7260 */ #define drv_e1 (drv_famL+0x01) /* LCS-7260, firmware "A E1" */ #define drv_f4 (drv_famL+0x02) /* LCS-7260, firmware "A4F4" */ -#define drv_fam1 0x20 /* CR-56x family */ -#define drv_099 (drv_fam1+0x01) /* <100 */ -#define drv_100 (drv_fam1+0x02) /* >=100, only 5.00 known here */ - -#define drv_famT 0x40 /* TEAC CD-55A */ -#define drv_fam2 0x80 /* CD200 family */ +#define drv_famV 0x2000 /* ECS-AT (vertos-100) family */ +#define drv_at (drv_famV+0x01) /* ECS-AT, firmware "1.00" */ #define fam0_drive (D_S[d].drv_type&drv_fam0) #define famL_drive (D_S[d].drv_type&drv_famL) +#define famV_drive (D_S[d].drv_type&drv_famV) #define fam1_drive (D_S[d].drv_type&drv_fam1) #define fam2_drive (D_S[d].drv_type&drv_fam2) #define famT_drive (D_S[d].drv_type&drv_famT) #define fam0L_drive (D_S[d].drv_type&(drv_fam0|drv_famL)) +#define fam0V_drive (D_S[d].drv_type&(drv_fam0|drv_famV)) +#define famLV_drive (D_S[d].drv_type&(drv_famL|drv_famV)) +#define fam0LV_drive (D_S[d].drv_type&(drv_fam0|drv_famL|drv_famV)) #define fam1L_drive (D_S[d].drv_type&(drv_fam1|drv_famL)) +#define fam1V_drive (D_S[d].drv_type&(drv_fam1|drv_famV)) +#define fam1LV_drive (D_S[d].drv_type&(drv_fam1|drv_famL|drv_famV)) #define fam01_drive (D_S[d].drv_type&(drv_fam0|drv_fam1)) #define fam12_drive (D_S[d].drv_type&(drv_fam1|drv_fam2)) #define fam2T_drive (D_S[d].drv_type&(drv_fam2|drv_famT)) @@ -378,7 +448,6 @@ #define audx13 0x0d /* Audio play operation successfully completed */ #define audx14 0x0e /* Audio play operation stopped due to error */ #define audx15 0x0f /* No current audio status to return */ - /* audio status (bcd) */ #define aud_11 0x11 /* Audio play operation in progress */ #define aud_12 0x12 /* Audio play operation paused */ @@ -386,7 +455,6 @@ #define aud_14 0x14 /* Audio play operation stopped due to error */ #define aud_15 0x15 /* No current audio status to return */ - /* * highest allowed drive number (MINOR+1) */ @@ -404,13 +472,15 @@ /*==========================================================================*/ +#define MIXER_addr SOUND_BASE+4 /* sound card's address register */ +#define MIXER_data SOUND_BASE+5 /* sound card's data register */ #define MIXER_CD_Volume 0x28 /* internal SB Pro register address */ /*==========================================================================*/ -/* - * Creative Labs Programmers did this: - */ -#define MAX_TRACKS 120 /* why more than 99? */ + +#define MAX_TRACKS 99 + +#define ERR_DISKCHANGE 615 /*==========================================================================*/ /* @@ -589,6 +659,7 @@ Read XA Parameter: * CD200: CMD2_ * LCS-7260: CMDL_ * TEAC CD-55A: CMDT_ + * ECS-AT: CMDV_ */ #define CMD1_RESET 0x0a #define CMD2_RESET 0x01 @@ -598,14 +669,17 @@ Read XA Parameter: #define CMD2_LOCK_CTL 0x1e #define CMDT_LOCK_CTL CMD2_LOCK_CTL #define CMDL_LOCK_CTL 0x0e +#define CMDV_LOCK_CTL CMDL_LOCK_CTL #define CMD1_TRAY_CTL 0x07 #define CMD2_TRAY_CTL 0x1b #define CMDT_TRAY_CTL CMD2_TRAY_CTL #define CMDL_TRAY_CTL 0x0d +#define CMDV_TRAY_CTL CMDL_TRAY_CTL #define CMD1_MULTISESS 0x8d #define CMDL_MULTISESS 0x8c +#define CMDV_MULTISESS CMDL_MULTISESS #define CMD1_SUBCHANINF 0x11 #define CMD2_SUBCHANINF 0x?? @@ -623,22 +697,27 @@ Read XA Parameter: #define CMD2_PATH_CHECK 0x??? #define CMDT_PATH_CHECK 0x??? #define CMDL_PATH_CHECK CMD0_PATH_CHECK +#define CMDV_PATH_CHECK CMD0_PATH_CHECK #define CMD0_SEEK 0x01 #define CMD1_SEEK CMD0_SEEK #define CMD2_SEEK 0x2b #define CMDT_SEEK CMD2_SEEK #define CMDL_SEEK CMD0_SEEK +#define CMDV_SEEK CMD0_SEEK #define CMD0_READ 0x02 #define CMD1_READ 0x10 #define CMD2_READ 0x28 #define CMDT_READ CMD2_READ #define CMDL_READ CMD0_READ +#define CMDV_READ CMD0_READ #define CMD0_READ_XA 0x03 #define CMD2_READ_XA 0xd4 +#define CMD2_READ_XA2 0xd5 #define CMDL_READ_XA CMD0_READ_XA /* really ?? */ +#define CMDV_READ_XA CMD0_READ_XA #define CMD0_READ_HEAD 0x04 @@ -646,11 +725,13 @@ Read XA Parameter: #define CMD1_SPINUP 0x02 #define CMD2_SPINUP CMD2_TRAY_CTL #define CMDL_SPINUP CMD0_SPINUP +#define CMDV_SPINUP CMD0_SPINUP #define CMD0_SPINDOWN 0x06 /* really??? */ #define CMD1_SPINDOWN 0x06 #define CMD2_SPINDOWN CMD2_TRAY_CTL #define CMDL_SPINDOWN 0x0d +#define CMDV_SPINDOWN CMD0_SPINDOWN #define CMD0_DIAG 0x07 @@ -658,6 +739,7 @@ Read XA Parameter: #define CMD1_READ_UPC 0x88 #define CMD2_READ_UPC 0x??? #define CMDL_READ_UPC CMD0_READ_UPC +#define CMDV_READ_UPC 0x8f #define CMD0_READ_ISRC 0x09 @@ -665,6 +747,7 @@ Read XA Parameter: #define CMD1_PLAY 0x??? #define CMD2_PLAY 0x??? #define CMDL_PLAY CMD0_PLAY +#define CMDV_PLAY CMD0_PLAY #define CMD0_PLAY_MSF 0x0b #define CMD1_PLAY_MSF 0x0e @@ -680,18 +763,22 @@ Read XA Parameter: #define CMD2_STATUS 0x00 #define CMDT_STATUS CMD2_STATUS #define CMDL_STATUS CMD0_STATUS +#define CMDV_STATUS CMD0_STATUS +#define CMD2_SEEK_LEADIN 0x00 #define CMD0_READ_ERR 0x82 #define CMD1_READ_ERR CMD0_READ_ERR #define CMD2_READ_ERR 0x03 #define CMDT_READ_ERR CMD2_READ_ERR /* get audio status */ #define CMDL_READ_ERR CMD0_READ_ERR +#define CMDV_READ_ERR CMD0_READ_ERR #define CMD0_READ_VER 0x83 #define CMD1_READ_VER CMD0_READ_VER #define CMD2_READ_VER 0x12 #define CMDT_READ_VER CMD2_READ_VER /* really ?? */ #define CMDL_READ_VER CMD0_READ_VER +#define CMDV_READ_VER CMD0_READ_VER #define CMD0_SETMODE 0x84 #define CMD1_SETMODE 0x09 @@ -719,6 +806,7 @@ Read XA Parameter: #define CMD2_READSUBQ 0x42 #define CMDT_READSUBQ CMD2_READSUBQ #define CMDL_READSUBQ CMD0_READSUBQ +#define CMDV_READSUBQ CMD0_READSUBQ #define CMD0_DISKCODE 0x8a @@ -727,22 +815,26 @@ Read XA Parameter: #define CMD2_DISKINFO 0x43 #define CMDT_DISKINFO CMD2_DISKINFO #define CMDL_DISKINFO CMD0_DISKINFO +#define CMDV_DISKINFO CMD0_DISKINFO #define CMD0_READTOC 0x8c #define CMD1_READTOC CMD0_READTOC #define CMD2_READTOC 0x??? #define CMDL_READTOC CMD0_READTOC +#define CMDV_READTOC CMD0_READTOC #define CMD0_PAU_RES 0x8d #define CMD1_PAU_RES 0x0d #define CMD2_PAU_RES 0x4b #define CMDT_PAUSE CMD2_PAU_RES #define CMDL_PAU_RES CMD0_PAU_RES +#define CMDV_PAUSE CMD0_PAU_RES #define CMD0_PACKET 0x8e #define CMD1_PACKET CMD0_PACKET #define CMD2_PACKET 0x??? #define CMDL_PACKET CMD0_PACKET +#define CMDV_PACKET 0x??? /*==========================================================================*/ /*==========================================================================*/ diff --git a/include/linux/scc.h b/include/linux/scc.h index 696eb4b12..330143da4 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -1,4 +1,4 @@ -/* $Id: scc.h,v 1.9 1995/01/12 18:24:40 JReuter Exp JReuter $ */ +/* $Id: scc.h,v 1.28 1996/10/30 20:01:15 jreuter Exp jreuter $ */ #ifndef _SCC_H #define _SCC_H @@ -12,40 +12,21 @@ #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ #define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */ -/* Constants */ - -#define MAXSCC 4 /* number of max. supported chips */ -#define MAX_IBUFS 200 /* change this if you run out of memory */ -#define BUFSIZE 128 /* must not exceed 4096 */ -#define TPS 25 /* scc_timer(): Ticks Per Second */ - -#define SCC_TIMER 3 - -#define SCC_PARANOIA_CHECK /* tell the user if something is going wrong */ - -/* ioctl() commands */ - -/* !!! NEW VALUES !!! */ - -#define TIOCSCCINI 0x5470 /* init driver */ -#define TIOCCHANINI 0x5471 /* init channel */ - -#define TIOCGKISS 0x5472 /* get kiss parameter */ -#define TIOCSKISS 0x5473 /* set kiss parameter */ - -#define TIOCSCCSTAT 0x5474 /* get scc status */ +/* DEV ioctl() commands */ +#define SIOCSCCRESERVED (SIOCDEVPRIVATE+0) +#define SIOCSCCCFG (SIOCDEVPRIVATE+1) +#define SIOCSCCINI (SIOCDEVPRIVATE+2) +#define SIOCSCCCHANINI (SIOCDEVPRIVATE+3) +#define SIOCSCCSMEM (SIOCDEVPRIVATE+4) +#define SIOCSCCGKISS (SIOCDEVPRIVATE+5) +#define SIOCSCCSKISS (SIOCDEVPRIVATE+6) +#define SIOCSCCGSTAT (SIOCDEVPRIVATE+7) /* magic number */ #define SCC_MAGIC 0x8530 /* ;-) */ -/* KISS protocol flags */ -#define FEND 192 -#define FESC 219 -#define TFEND 220 -#define TFESC 221 - /* KISS state machine */ #define KISS_IDLE 0 @@ -73,12 +54,27 @@ #define PARAM_WAIT 16 #define PARAM_MAXDEFER 17 #define PARAM_TX 18 -#define PARAM_SLIP 19 +#define PARAM_HWEVENT 31 #define PARAM_RETURN 255 /* reset kiss mode */ +/* fulldup parameter */ + +#define KISS_DUPLEX_HALF 0 /* normal CSMA operation */ +#define KISS_DUPLEX_FULL 1 /* fullduplex, key down trx after transmission */ +#define KISS_DUPLEX_LINK 2 /* fullduplex, key down trx after 'idletime' sec */ +#define KISS_DUPLEX_OPTIMA 3 /* fullduplex, let the protocol layer control the hw */ + +/* misc. parameters */ + #define TIMER_OFF 65535U /* to switch off timers */ #define NO_SUCH_PARAM 65534U /* param not implemented */ +/* HWEVENT parameter */ + +#define HWEV_DCD_ON 0 +#define HWEV_DCD_OFF 1 +#define HWEV_ALL_SENT 2 + /* channel grouping */ #define RXGROUP 0x100 /* if set, only tx when all channels clear */ @@ -97,86 +93,11 @@ #define TXS_BUSY 1 /* waiting for permission to send / tailtime */ #define TXS_ACTIVE 2 /* Transmitter on, sending data */ #define TXS_NEWFRAME 3 /* reset CRC and send (next) frame */ +#define TXS_IDLE2 4 /* Transmitter on, no data pending */ +#define TXS_WAIT 5 /* Waiting for Mintime to expire */ +#define TXS_TIMEOUT 6 /* We had a transmission timeout */ -#define TX_ON 1 /* command for scc_key_trx() */ -#define TX_OFF 0 /* dto */ - -/* Buffer management */ - -#define BT_RECEIVE 1 /* buffer allocated by receive */ -#define BT_TRANSMIT 2 /* buffer allocated by transmit */ - -#define QUEUE_THRES MAX_IBUFS/20 /* maximum amount of packets being queued */ -#define QUEUE_HYST 3 /* leave QUEUE_HYST packets untouched */ - -#define NULLBUF (struct mbuf *)0 -#define NULLBUFP (struct mbuf **)0 - - -typedef unsigned short io_port; /* type definition for an 'io port address' */ -typedef unsigned short ioaddr; /* old def */ - -#ifdef SCC_DELAY -#define Inb(port) inb_p(port) -#define Outb(port, val) outb_p(val, port) -#else -#define Inb(port) inb(port) -#define Outb(port, val) outb(val, port) -#endif - -/* some nasty macros (esp. Expired) */ - -#define TIMER_STOPPED 65535U -#define Running(k) (scc->k != TIMER_STOPPED) -#define Expired(k) (scc->k != TIMER_STOPPED) && (!(scc->k) || (--(scc->k) == 0)) -#define Stop_Timer(k) scc->k = TIMER_STOPPED - - -/* Basic message buffer structure */ - -/* looks familiar? Hmm, yes... */ - -struct mbuf { - struct mbuf *next; /* Links mbufs belonging to single packets */ - struct mbuf *anext; /* Links packets on queues */ - - char type; /* who allocated this buffer? */ - int time_out; /* unimplemented yet */ - - int size; /* Size of associated data buffer */ - int refcnt; /* Reference count */ - struct mbuf *dup; /* Pointer to duplicated mbuf */ - char data[BUFSIZE]; /* Active working pointers */ - int cnt; - int in_use; -}; - - -struct sccbuf { - struct mbuf *bp; - int inuse; -}; - - -/* SCC channel control structure for KISS */ - -struct scc_kiss { - unsigned char txdelay; /* Transmit Delay 10 ms/cnt */ - unsigned char persist; /* Persistence (0-255) as a % */ - unsigned char slottime; /* Delay to wait on persistence hit */ - unsigned char tailtime; /* Delay after XMTR OFF */ - unsigned char fulldup; /* Full Duplex mode 0=CSMA 1=DUP 2=ALWAYS KEYED */ - unsigned char waittime; /* Waittime before any transmit attempt */ - unsigned int maxkeyup; /* Maximum time to transmit (seconds) */ - unsigned char mintime; /* Minimal offtime after MAXKEYUP timeout */ - unsigned int idletime; /* Maximum idle time in ALWAYS KEYED mode (seconds) */ - unsigned int maxdefer; /* Timer for CSMA channel busy limit */ - unsigned char tx_inhibit; /* Transmit is not allowed when set */ - unsigned char group; /* group ID for AX.25 TX interlocking */ - unsigned char not_slip; /* set to zero: use SLIP instead of KISS */ - unsigned char softdcd; /* use DPLL instead of DCD pin for carrier detect */ -}; - +typedef unsigned long io_port; /* type definition for an 'io port address' */ /* SCC statistical information */ @@ -187,7 +108,7 @@ struct scc_stat { long spints; /* Special receiver interrupts */ long txframes; /* Packets sent */ - long rxframes; /* Number of Frames Actally Received */ + long rxframes; /* Number of Frames Actually Received */ long rxerrs; /* CRC Errors */ long txerrs; /* KISS errors */ @@ -196,358 +117,129 @@ struct scc_stat { unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ - - char tx_kiss_state; /* state of the kiss interpreter */ - char rx_kiss_state; /* state of the kiss encoder */ - int tx_queued; /* tx frames enqueued */ - int rx_queued; /* rx frames enqueued */ - - unsigned int rx_alloc; /* allocated rx_buffers */ - unsigned int tx_alloc; /* allocated tx_buffers */ - unsigned int used_buf; /* used buffers (should be rx_alloc+tx_alloc) */ + + unsigned int maxqueue; /* allocated tx_buffers */ + unsigned int bufsize; /* used buffersize */ }; -struct scc_modem{ +struct scc_modem { long speed; /* Line speed, bps */ char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ char nrz; /* NRZ instead of NRZI */ }; -struct ioctl_command { - int command; /* one of the KISS-Commands devined above */ +struct scc_kiss_cmd { + int command; /* one of the KISS-Commands defined above */ unsigned param; /* KISS-Param */ }; -/* SCC channel structure */ - -struct scc_channel { - int magic; /* magic word */ - - int init; /* channel exists? */ - struct tty_struct *tty; /* link to tty control structure */ - unsigned char tty_opened; - - io_port ctrl; /* I/O address of CONTROL register */ - io_port data; /* I/O address of DATA register */ - char enhanced; /* Enhanced SCC support */ - - unsigned char wreg[16]; /* Copy of last written value in WRx */ - unsigned char status; /* Copy of R0 at last external interrupt */ - - struct scc_kiss kiss; /* control structure for KISS params */ - struct scc_stat stat; /* statistical information */ - struct scc_modem modem; /* modem information */ - - struct mbuf *rbp; /* rx: Head of mbuf chain being filled */ - struct mbuf *rbp1; /* rx: Pointer to mbuf currently being written */ - struct mbuf *rcvq; /* Pointer to mbuf packets currently received */ - - struct mbuf *sndq; /* tx: Packets awaiting transmission */ - struct mbuf *tbp; /* tx: Transmit mbuf being sent */ +struct scc_hw_config { + io_port data_a; /* data port channel A */ + io_port ctrl_a; /* control port channel A */ + io_port data_b; /* data port channel B */ + io_port ctrl_b; /* control port channel B */ + io_port vector_latch; /* INTACK-Latch (#) */ + io_port special; /* special function port */ - struct mbuf *sndq1; /* Pointer to mbuf currently under construction */ - struct mbuf *sndq2; /* Pointer to mbuf currently under construction */ + int irq; /* irq */ + long clock; /* clock */ + char option; /* command for function port */ - - /* Timer */ - - unsigned int t_dwait; /* wait time (DWAIT) */ - unsigned int t_slot; /* channel sample frequency */ - unsigned int t_txdel; /* TX delay */ - unsigned int t_tail; /* tail time */ - unsigned int t_maxk; /* max. key up */ - unsigned int t_min; /* minimal key up */ - unsigned int t_idle; /* */ - unsigned int t_mbusy; /* time until defer if channel busy */ + char brand; /* hardware type */ + char escc; /* use ext. features of a 8580/85180/85280 */ }; +/* (#) only one INTACK latch allowed. */ -/* 8530 Serial Communications Controller Register definitions */ -#define FLAG 0x7e - -/* Write Register 0 */ -#define R0 0 /* Register selects */ -#define R1 1 -#define R2 2 -#define R3 3 -#define R4 4 -#define R5 5 -#define R6 6 -#define R7 7 -#define R8 8 -#define R9 9 -#define R10 10 -#define R11 11 -#define R12 12 -#define R13 13 -#define R14 14 -#define R15 15 - -#define NULLCODE 0 /* Null Code */ -#define POINT_HIGH 0x8 /* Select upper half of registers */ -#define RES_EXT_INT 0x10 /* Reset Ext. Status Interrupts */ -#define SEND_ABORT 0x18 /* HDLC Abort */ -#define RES_RxINT_FC 0x20 /* Reset RxINT on First Character */ -#define RES_Tx_P 0x28 /* Reset TxINT Pending */ -#define ERR_RES 0x30 /* Error Reset */ -#define RES_H_IUS 0x38 /* Reset highest IUS */ - -#define RES_Rx_CRC 0x40 /* Reset Rx CRC Checker */ -#define RES_Tx_CRC 0x80 /* Reset Tx CRC Checker */ -#define RES_EOM_L 0xC0 /* Reset EOM latch */ - -/* Write Register 1 */ - -#define EXT_INT_ENAB 0x1 /* Ext Int Enable */ -#define TxINT_ENAB 0x2 /* Tx Int Enable */ -#define PAR_SPEC 0x4 /* Parity is special condition */ - -#define RxINT_DISAB 0 /* Rx Int Disable */ -#define RxINT_FCERR 0x8 /* Rx Int on First Character Only or Error */ -#define INT_ALL_Rx 0x10 /* Int on all Rx Characters or error */ -#define INT_ERR_Rx 0x18 /* Int on error only */ - -#define WT_RDY_RT 0x20 /* Wait/Ready on R/T */ -#define WT_FN_RDYFN 0x40 /* Wait/FN/Ready FN */ -#define WT_RDY_ENAB 0x80 /* Wait/Ready Enable */ - -/* Write Register 2 (Interrupt Vector) */ - -/* Write Register 3 */ - -#define RxENABLE 0x1 /* Rx Enable */ -#define SYNC_L_INH 0x2 /* Sync Character Load Inhibit */ -#define ADD_SM 0x4 /* Address Search Mode (SDLC) */ -#define RxCRC_ENAB 0x8 /* Rx CRC Enable */ -#define ENT_HM 0x10 /* Enter Hunt Mode */ -#define AUTO_ENAB 0x20 /* Auto Enables */ -#define Rx5 0x0 /* Rx 5 Bits/Character */ -#define Rx7 0x40 /* Rx 7 Bits/Character */ -#define Rx6 0x80 /* Rx 6 Bits/Character */ -#define Rx8 0xc0 /* Rx 8 Bits/Character */ - -/* Write Register 4 */ - -#define PAR_ENA 0x1 /* Parity Enable */ -#define PAR_EVEN 0x2 /* Parity Even/Odd* */ - -#define SYNC_ENAB 0 /* Sync Modes Enable */ -#define SB1 0x4 /* 1 stop bit/char */ -#define SB15 0x8 /* 1.5 stop bits/char */ -#define SB2 0xc /* 2 stop bits/char */ - -#define MONSYNC 0 /* 8 Bit Sync character */ -#define BISYNC 0x10 /* 16 bit sync character */ -#define SDLC 0x20 /* SDLC Mode (01111110 Sync Flag) */ -#define EXTSYNC 0x30 /* External Sync Mode */ - -#define X1CLK 0x0 /* x1 clock mode */ -#define X16CLK 0x40 /* x16 clock mode */ -#define X32CLK 0x80 /* x32 clock mode */ -#define X64CLK 0xC0 /* x64 clock mode */ - -/* Write Register 5 */ - -#define TxCRC_ENAB 0x1 /* Tx CRC Enable */ -#define RTS 0x2 /* RTS */ -#define SDLC_CRC 0x4 /* SDLC/CRC-16 */ -#define TxENAB 0x8 /* Tx Enable */ -#define SND_BRK 0x10 /* Send Break */ -#define Tx5 0x0 /* Tx 5 bits (or less)/character */ -#define Tx7 0x20 /* Tx 7 bits/character */ -#define Tx6 0x40 /* Tx 6 bits/character */ -#define Tx8 0x60 /* Tx 8 bits/character */ -#define DTR 0x80 /* DTR */ - -/* Write Register 6 (Sync bits 0-7/SDLC Address Field) */ - -/* Write Register 7 (Sync bits 8-15/SDLC 01111110) */ - -/* Write Register 8 (transmit buffer) */ - -/* Write Register 9 (Master interrupt control) */ -#define VIS 1 /* Vector Includes Status */ -#define NV 2 /* No Vector */ -#define DLC 4 /* Disable Lower Chain */ -#define MIE 8 /* Master Interrupt Enable */ -#define STATHI 0x10 /* Status high */ -#define NORESET 0 /* No reset on write to R9 */ -#define CHRB 0x40 /* Reset channel B */ -#define CHRA 0x80 /* Reset channel A */ -#define FHWRES 0xc0 /* Force hardware reset */ - -/* Write Register 10 (misc control bits) */ -#define BIT6 1 /* 6 bit/8bit sync */ -#define LOOPMODE 2 /* SDLC Loop mode */ -#define ABUNDER 4 /* Abort/flag on SDLC xmit underrun */ -#define MARKIDLE 8 /* Mark/flag on idle */ -#define GAOP 0x10 /* Go active on poll */ -#define NRZ 0 /* NRZ mode */ -#define NRZI 0x20 /* NRZI mode */ -#define FM1 0x40 /* FM1 (transition = 1) */ -#define FM0 0x60 /* FM0 (transition = 0) */ -#define CRCPS 0x80 /* CRC Preset I/O */ - -/* Write Register 11 (Clock Mode control) */ -#define TRxCXT 0 /* TRxC = Xtal output */ -#define TRxCTC 1 /* TRxC = Transmit clock */ -#define TRxCBR 2 /* TRxC = BR Generator Output */ -#define TRxCDP 3 /* TRxC = DPLL output */ -#define TRxCOI 4 /* TRxC O/I */ -#define TCRTxCP 0 /* Transmit clock = RTxC pin */ -#define TCTRxCP 8 /* Transmit clock = TRxC pin */ -#define TCBR 0x10 /* Transmit clock = BR Generator output */ -#define TCDPLL 0x18 /* Transmit clock = DPLL output */ -#define RCRTxCP 0 /* Receive clock = RTxC pin */ -#define RCTRxCP 0x20 /* Receive clock = TRxC pin */ -#define RCBR 0x40 /* Receive clock = BR Generator output */ -#define RCDPLL 0x60 /* Receive clock = DPLL output */ -#define RTxCX 0x80 /* RTxC Xtal/No Xtal */ - -/* Write Register 12 (lower byte of baud rate generator time constant) */ - -/* Write Register 13 (upper byte of baud rate generator time constant) */ - -/* Write Register 14 (Misc control bits) */ -#define BRENABL 1 /* Baud rate generator enable */ -#define BRSRC 2 /* Baud rate generator source */ -#define DTRREQ 4 /* DTR/Request function */ -#define AUTOECHO 8 /* Auto Echo */ -#define LOOPBAK 0x10 /* Local loopback */ -#define SEARCH 0x20 /* Enter search mode */ -#define RMC 0x40 /* Reset missing clock */ -#define DISDPLL 0x60 /* Disable DPLL */ -#define SSBR 0x80 /* Set DPLL source = BR generator */ -#define SSRTxC 0xa0 /* Set DPLL source = RTxC */ -#define SFMM 0xc0 /* Set FM mode */ -#define SNRZI 0xe0 /* Set NRZI mode */ - -/* Write Register 15 (external/status interrupt control) */ -#define ZCIE 2 /* Zero count IE */ -#define DCDIE 8 /* DCD IE */ -#define SYNCIE 0x10 /* Sync/hunt IE */ -#define CTSIE 0x20 /* CTS IE */ -#define TxUIE 0x40 /* Tx Underrun/EOM IE */ -#define BRKIE 0x80 /* Break/Abort IE */ - - -/* Read Register 0 */ -#define Rx_CH_AV 0x1 /* Rx Character Available */ -#define ZCOUNT 0x2 /* Zero count */ -#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */ -#define DCD 0x8 /* DCD */ -#define SYNC_HUNT 0x10 /* Sync/hunt */ -#define CTS 0x20 /* CTS */ -#define TxEOM 0x40 /* Tx underrun */ -#define BRK_ABRT 0x80 /* Break/Abort */ - -/* Read Register 1 */ -#define ALL_SNT 0x1 /* All sent */ -/* Residue Data for 8 Rx bits/char programmed */ -#define RES3 0x8 /* 0/3 */ -#define RES4 0x4 /* 0/4 */ -#define RES5 0xc /* 0/5 */ -#define RES6 0x2 /* 0/6 */ -#define RES7 0xa /* 0/7 */ -#define RES8 0x6 /* 0/8 */ -#define RES18 0xe /* 1/8 */ -#define RES28 0x0 /* 2/8 */ -/* Special Rx Condition Interrupts */ -#define PAR_ERR 0x10 /* Parity error */ -#define Rx_OVR 0x20 /* Rx Overrun Error */ -#define CRC_ERR 0x40 /* CRC/Framing Error */ -#define END_FR 0x80 /* End of Frame (SDLC) */ - -/* Read Register 2 (channel B only) - Interrupt vector */ - -#define VECTOR_MASK 0x06 - -#define TXINT 0x00 -#define EXINT 0x02 -#define RXINT 0x04 -#define SPINT 0x06 - - -/* Read Register 3 (interrupt pending register) ch a only */ -#define CHBEXT 0x1 /* Channel B Ext/Stat IP */ -#define CHBTxIP 0x2 /* Channel B Tx IP */ -#define CHBRxIP 0x4 /* Channel B Rx IP */ -#define CHAEXT 0x8 /* Channel A Ext/Stat IP */ -#define CHATxIP 0x10 /* Channel A Tx IP */ -#define CHARxIP 0x20 /* Channel A Rx IP */ - -/* Read Register 8 (receive data register) */ +struct scc_mem_config { + unsigned int dummy; + unsigned int bufsize; +}; -/* Read Register 10 (misc status bits) */ -#define ONLOOP 2 /* On loop */ -#define LOOPSEND 0x10 /* Loop sending */ -#define CLK2MIS 0x40 /* Two clocks missing */ -#define CLK1MIS 0x80 /* One clock missing */ -/* Read Register 12 (lower byte of baud rate generator constant) */ +#ifdef __KERNEL__ -/* Read Register 13 (upper byte of baud rate generator constant) */ +#define TX_ON 1 /* command for scc_key_trx() */ +#define TX_OFF 0 /* dto */ -/* Read Register 15 (value of WR 15) */ +/* Vector masks in RR2B */ +#define VECTOR_MASK 0x06 +#define TXINT 0x00 +#define EXINT 0x02 +#define RXINT 0x04 +#define SPINT 0x06 -/* 8536 register definitions */ -#define CIO_MICR 0x00 /* Master interrupt control register */ -#define CIO_MCCR 0x01 /* Master configuration control register */ -#define CIO_CTMS1 0x1c /* Counter/timer mode specification #1 */ -#define CIO_CTMS2 0x1d /* Counter/timer mode specification #2 */ -#define CIO_CTMS3 0x1e /* Counter/timer mode specification #3 */ -#define CIO_IVR 0x04 /* Interrupt vector register */ +#ifdef SCC_DELAY +#define Inb(port) inb_p(port) +#define Outb(port, val) outb_p(val, port) +#else +#define Inb(port) inb(port) +#define Outb(port, val) outb(val, port) +#endif -#define CIO_CSR1 0x0a /* Command and status register CTC #1 */ -#define CIO_CSR2 0x0b /* Command and status register CTC #2 */ -#define CIO_CSR3 0x0c /* Command and status register CTC #3 */ +/* SCC channel control structure for KISS */ -#define CIO_CT1MSB 0x16 /* CTC #1 Timer constant - MSB */ -#define CIO_CT1LSB 0x17 /* CTC #1 Timer constant - LSB */ -#define CIO_CT2MSB 0x18 /* CTC #2 Timer constant - MSB */ -#define CIO_CT2LSB 0x19 /* CTC #2 Timer constant - LSB */ -#define CIO_CT3MSB 0x1a /* CTC #3 Timer constant - MSB */ -#define CIO_CT3LSB 0x1b /* CTC #3 Timer constant - LSB */ -#define CIO_PDCA 0x23 /* Port A data direction control */ -#define CIO_PDCB 0x2b /* Port B data direction control */ +struct scc_kiss { + unsigned char txdelay; /* Transmit Delay 10 ms/cnt */ + unsigned char persist; /* Persistence (0-255) as a % */ + unsigned char slottime; /* Delay to wait on persistence hit */ + unsigned char tailtime; /* Delay after last byte written */ + unsigned char fulldup; /* Full Duplex mode 0=CSMA 1=DUP 2=ALWAYS KEYED */ + unsigned char waittime; /* Waittime before any transmit attempt */ + unsigned int maxkeyup; /* Maximum time to transmit (seconds) */ + unsigned char mintime; /* Minimal offtime after MAXKEYUP timeout (seconds) */ + unsigned int idletime; /* Maximum idle time in ALWAYS KEYED mode (seconds) */ + unsigned int maxdefer; /* Timer for CSMA channel busy limit */ + unsigned char tx_inhibit; /* Transmit is not allowed when set */ + unsigned char group; /* Group ID for AX.25 TX interlocking */ + unsigned char mode; /* 'normal' or 'hwctrl' mode (unused) */ + unsigned char softdcd; /* Use DPLL instead of DCD pin for carrier detect */ +}; -#define CIO_GCB 0x04 /* CTC Gate command bit */ -#define CIO_TCB 0x02 /* CTC Trigger command bit */ -#define CIO_IE 0xc0 /* CTC Interrupt enable (set) */ -#define CIO_CIP 0x20 /* CTC Clear interrupt pending */ -#define CIO_IP 0x20 /* CTC Interrupt pending */ +/* SCC channel structure */ -/* 8580/85180/85280 Enhanced SCC register definitions */ +struct scc_channel { + int magic; /* magic word */ + + int init; /* channel exists? */ -/* Write Register 7' (SDLC/HDLC Programmable Enhancements) */ -#define AUTOTXF 0x01 /* Auto Tx Flag */ -#define AUTOEOM 0x02 /* Auto EOM Latch Reset */ -#define AUTORTS 0x04 /* Auto RTS */ -#define TXDNRZI 0x08 /* TxD Pulled High in SDLC NRZI mode */ -#define FASTDTR 0x10 /* Fast DTR/REQ Mode */ -#define CRCCBCR 0x20 /* CRC Check Bytes Completely Received */ -#define EXTRDEN 0x40 /* Extended Read Enabled */ + struct device *dev; /* link to device control structure */ + struct enet_statistics dev_stat;/* device statistics */ -/* Write Register 15 (external/status interrupt control) */ -#define SHDLCE 1 /* SDLC/HDLC Enhancements Enable */ -#define FIFOE 4 /* FIFO Enable */ + char brand; /* manufacturer of the board */ + long clock; /* used clock */ + + io_port ctrl; /* I/O address of CONTROL register */ + io_port data; /* I/O address of DATA register */ + io_port special; /* I/O address of special function port */ + int irq; /* Number of Interrupt */ + + char option; + char enhanced; /* Enhanced SCC support */ -/* Read Register 6 (frame status FIFO) */ -#define BCLSB 0xff /* LSB of 14 bits count */ + unsigned char wreg[16]; /* Copy of last written value in WRx */ + unsigned char status; /* Copy of R0 at last external interrupt */ -/* Read Register 7 (frame status FIFO) */ -#define BCMSB 0x3f /* MSB of 14 bits count */ -#define FDA 0x40 /* FIFO Data Available Status */ -#define FOY 0x80 /* FIFO Overflow Status */ + struct scc_kiss kiss; /* control structure for KISS params */ + struct scc_stat stat; /* statistical information */ + struct scc_modem modem; /* modem information */ + + struct sk_buff_head tx_queue; /* next tx buffer */ + struct sk_buff *rx_buff; /* pointer to frame currently received */ + struct sk_buff *tx_buff; /* pointer to frame currently transmitted */ -#endif /* _SCC_H */ + /* Timer */ -/* global functions */ + struct timer_list tx_t; /* tx timer for this channel */ + struct timer_list tx_wdog; /* tx watchdogs */ +}; -extern long scc_init(long kmem_start); +int scc_init(void); +#endif /* defined(__KERNEL__) */ +#endif /* defined(_SCC_H) */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 42bd0dcad..3cff32ca0 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -11,14 +11,30 @@ #include <asm/param.h> /* for HZ */ -extern unsigned long intr_count; extern unsigned long event; #include <linux/binfmts.h> #include <linux/personality.h> #include <linux/tasks.h> #include <linux/kernel.h> + #include <asm/system.h> +#include <asm/semaphore.h> +#include <asm/page.h> + +#include <linux/smp.h> +#include <linux/tty.h> +#include <linux/sem.h> + +/* + * cloning flags: + */ +#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ +#define CLONE_VM 0x00000100 /* set if VM shared between processes */ +#define CLONE_FS 0x00000200 /* set if fs info shared between processes */ +#define CLONE_FILES 0x00000400 /* set if open files shared between processes */ +#define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */ +#define CLONE_PID 0x00001000 /* set if pid shared */ /* * These are the constant used to fake the fixed-point load-average @@ -48,6 +64,7 @@ extern unsigned long avenrun[]; /* Load averages */ #define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ) extern int nr_running, nr_tasks; +extern int last_pid; #define FIRST_TASK task[0] #define LAST_TASK task[NR_TASKS-1] @@ -58,9 +75,8 @@ extern int nr_running, nr_tasks; #include <linux/time.h> #include <linux/param.h> #include <linux/resource.h> -#include <linux/vm86.h> -#include <linux/math_emu.h> #include <linux/ptrace.h> +#include <linux/timer.h> #include <asm/processor.h> @@ -71,30 +87,40 @@ extern int nr_running, nr_tasks; #define TASK_STOPPED 4 #define TASK_SWAPPING 5 +/* + * Scheduling policies + */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +struct sched_param { + int sched_priority; +}; + #ifndef NULL #define NULL ((void *) 0) #endif #ifdef __KERNEL__ -#define barrier() __asm__("": : :"memory") - extern void sched_init(void); extern void show_state(void); extern void trap_init(void); asmlinkage void schedule(void); -#endif /* __KERNEL__ */ - +/* Open file table structure */ struct files_struct { int count; fd_set close_on_exec; + fd_set open_fds; struct file * fd[NR_OPEN]; }; #define INIT_FILES { \ - 0, \ + 1, \ + { { 0, } }, \ { { 0, } }, \ { NULL, } \ } @@ -106,37 +132,44 @@ struct fs_struct { }; #define INIT_FS { \ - 0, \ + 1, \ 0022, \ NULL, NULL \ } struct mm_struct { int count; - unsigned long start_code, end_code, end_data; + pgd_t * pgd; + unsigned long context; + unsigned long start_code, end_code, start_data, end_data; unsigned long start_brk, brk, start_stack, start_mmap; unsigned long arg_start, arg_end, env_start, env_end; - unsigned long rss; - unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; - int swappable:1; - unsigned long swap_address; - unsigned long old_maj_flt; /* old value of maj_flt */ - unsigned long dec_flt; /* page fault count of the last time */ - unsigned long swap_cnt; /* number of pages to swap on next pass */ + unsigned long rss, total_vm, locked_vm; + unsigned long def_flags; struct vm_area_struct * mmap; struct vm_area_struct * mmap_avl; + struct semaphore mmap_sem; }; #define INIT_MM { \ + 1, \ + swapper_pg_dir, \ 0, \ - 0, 0, 0, \ 0, 0, 0, 0, \ 0, 0, 0, 0, \ + 0, 0, 0, 0, \ + 0, 0, 0, \ 0, \ -/* ?_flt */ 0, 0, 0, 0, \ - 0, \ -/* swap */ 0, 0, 0, 0, \ - &init_mmap, &init_mmap } + &init_mmap, &init_mmap, MUTEX } + +struct signal_struct { + int count; + struct sigaction action[32]; +}; + +#define INIT_SIGNALS { \ + 1, \ + { {0,}, } } struct task_struct { /* these are hardcoded - don't touch */ @@ -147,21 +180,28 @@ struct task_struct { unsigned long blocked; /* bitmap of masked signals */ unsigned long flags; /* per process flags, defined below */ int errno; - int debugreg[8]; /* Hardware debugging registers */ + long debugreg[8]; /* Hardware debugging registers */ struct exec_domain *exec_domain; /* various fields */ struct linux_binfmt *binfmt; struct task_struct *next_task, *prev_task; struct task_struct *next_run, *prev_run; - struct sigaction sigaction[32]; unsigned long saved_kernel_stack; unsigned long kernel_stack_page; int exit_code, exit_signal; + /* ??? */ unsigned long personality; int dumpable:1; int did_exec:1; - int pid,pgrp,tty_old_pgrp,session,leader; - int groups[NGROUPS]; + /* shouldn't this be pid_t? */ + int pid; + int pgrp; + int tty_old_pgrp; + int session; + /* boolean value for session group leader */ + int leader; + int ngroups; + gid_t groups[NGROUPS]; /* * pointers to (original) parent process, youngest child, younger sibling, * older sibling, respectively. (p->father can be replaced with @@ -171,11 +211,20 @@ struct task_struct { struct wait_queue *wait_chldexit; /* for wait4() */ unsigned short uid,euid,suid,fsuid; unsigned short gid,egid,sgid,fsgid; - unsigned long timeout; + unsigned long timeout, policy, rt_priority; unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; + struct timer_list real_timer; long utime, stime, cutime, cstime, start_time; - struct rlimit rlim[RLIM_NLIMITS]; +/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ + unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap; + int swappable:1; + unsigned long swap_address; + unsigned long old_maj_flt; /* old value of maj_flt */ + unsigned long dec_flt; /* page fault count of the last time */ + unsigned long swap_cnt; /* number of pages to swap on next pass */ +/* limits */ + struct rlimit rlim[RLIM_NLIMITS]; unsigned short used_math; char comm[16]; /* file system info */ @@ -189,11 +238,18 @@ struct task_struct { /* tss for this task */ struct thread_struct tss; /* filesystem information */ - struct fs_struct fs[1]; + struct fs_struct *fs; /* open file information */ - struct files_struct files[1]; + struct files_struct *files; /* memory management info */ - struct mm_struct mm[1]; + struct mm_struct *mm; +/* signal handlers */ + struct signal_struct *sig; +#ifdef __SMP__ + int processor; + int last_processor; + int lock_depth; /* Lock depth. We can context switch in and out of holding a syscall kernel lock... */ +#endif }; /* @@ -203,61 +259,85 @@ struct task_struct { /* Not implemented yet, only for 486*/ #define PF_PTRACED 0x00000010 /* set if ptrace (0) has been called. */ #define PF_TRACESYS 0x00000020 /* tracing system calls */ +#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ +#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ +#define PF_DUMPCORE 0x00000200 /* dumped core */ +#define PF_SIGNALED 0x00000400 /* killed by a signal */ -#define PF_STARTING 0x00000100 /* being created */ -#define PF_EXITING 0x00000200 /* getting shut down */ +#define PF_STARTING 0x00000002 /* being created */ +#define PF_EXITING 0x00000004 /* getting shut down */ + +#define PF_USEDFPU 0x00100000 /* Process used the FPU this quantum (SMP only) */ +#define PF_DTRACE 0x00200000 /* delayed trace (used on m68k) */ /* - * cloning flags: + * Limit the stack by to some sane default: root can always + * increase this limit if needed.. 8MB seems reasonable. */ -#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ -#define COPYVM 0x00000100 /* set if VM copy desired (like normal fork()) */ -#define COPYFD 0x00000200 /* set if fd's should be copied, not shared (NI) */ +#define _STK_LIM (8*1024*1024) + +#define DEF_PRIORITY (20*HZ/100) /* 200 ms time slices */ /* * INIT_TASK is used to set up the first task table, touch at * your own risk!. Base=0, limit=0x1fffff (=2MB) */ #define INIT_TASK \ -/* state etc */ { 0,15,15,0,0,0,0, \ +/* state etc */ { 0,DEF_PRIORITY,DEF_PRIORITY,0,0,0,0, \ /* debugregs */ { 0, }, \ /* exec domain */&default_exec_domain, \ /* binfmt */ NULL, \ /* schedlink */ &init_task,&init_task, &init_task, &init_task, \ -/* signals */ {{ 0, },}, \ /* stack */ 0,(unsigned long) &init_kernel_stack, \ /* ec,brk... */ 0,0,0,0,0, \ /* pid etc.. */ 0,0,0,0,0, \ -/* suppl grps*/ {NOGROUP,}, \ +/* suppl grps*/ 0, {0,}, \ /* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \ /* uid etc */ 0,0,0,0,0,0,0,0, \ -/* timeout */ 0,0,0,0,0,0,0,0,0,0,0,0, \ -/* rlimits */ { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ - {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ - { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ - {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, {NR_OPEN, NR_OPEN}}, \ +/* timeout */ 0,SCHED_OTHER,0,0,0,0,0,0,0, \ +/* timer */ { NULL, NULL, 0, 0, it_real_fn }, \ +/* utime */ 0,0,0,0,0, \ +/* flt */ 0,0,0,0,0,0, \ +/* swp */ 0,0,0,0,0, \ +/* rlimits */ INIT_RLIMITS, \ /* math */ 0, \ /* comm */ "swapper", \ /* fs info */ 0,NULL, \ /* ipc */ NULL, NULL, \ /* ldt */ NULL, \ /* tss */ INIT_TSS, \ -/* fs */ { INIT_FS }, \ -/* files */ { INIT_FILES }, \ -/* mm */ { INIT_MM } \ +/* fs */ &init_fs, \ +/* files */ &init_files, \ +/* mm */ &init_mm, \ +/* signals */ &init_signals, \ } -#ifdef __KERNEL__ - +extern struct mm_struct init_mm; extern struct task_struct init_task; extern struct task_struct *task[NR_TASKS]; extern struct task_struct *last_task_used_math; -extern struct task_struct *current; +extern struct task_struct *current_set[NR_CPUS]; +/* + * On a single processor system this comes out as current_set[0] when cpp + * has finished with it, which gcc will optimise away. + * Ralf: It won't. On MIPS something like + * la reg,current_set + * lw reg,(reg) + * will be generated which is one cycle to much. FIXME somewhen laaater. + */ +#define current (current_set[smp_processor_id()]) /* Current on this processor */ extern unsigned long volatile jiffies; extern unsigned long itimer_ticks; extern unsigned long itimer_next; extern struct timeval xtime; extern int need_resched; +extern void do_timer(struct pt_regs *); + +extern unsigned int * prof_buffer; +extern unsigned long prof_len; +extern unsigned long prof_shift; + +extern int securelevel; /* system security level */ #define CURRENT_TIME (xtime.tv_sec) @@ -265,89 +345,110 @@ extern void sleep_on(struct wait_queue ** p); extern void interruptible_sleep_on(struct wait_queue ** p); extern void wake_up(struct wait_queue ** p); extern void wake_up_interruptible(struct wait_queue ** p); +extern void wake_up_process(struct task_struct * tsk); extern void notify_parent(struct task_struct * tsk); +extern void force_sig(unsigned long sig,struct task_struct * p); extern int send_sig(unsigned long sig,struct task_struct * p,int priv); extern int in_group_p(gid_t grp); -extern int request_irq(unsigned int irq,void (*handler)(int, struct pt_regs *), - unsigned long flags, const char *device); -extern void free_irq(unsigned int irq); +extern int request_irq(unsigned int irq, + void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, + const char *device, + void *dev_id); +extern void free_irq(unsigned int irq, void *dev_id); + +/* + * This has now become a routine instead of a macro, it sets a flag if + * it returns true (to do BSD-style accounting where the process is flagged + * if it uses root privs). The implication of this is that you should do + * normal permissions checks first, and check suser() last. + */ +extern inline int suser(void) +{ + if (current->euid == 0) { + current->flags |= PF_SUPERPRIV; + return 1; + } + return 0; +} extern void copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *); extern void flush_thread(void); extern void exit_thread(void); +extern void exit_mm(struct task_struct *); +extern void exit_fs(struct task_struct *); +extern void exit_files(struct task_struct *); +extern void exit_sighand(struct task_struct *); +extern void release_thread(struct task_struct *); + extern int do_execve(char *, char **, char **, struct pt_regs *); extern int do_fork(unsigned long, unsigned long, struct pt_regs *); -asmlinkage int do_signal(unsigned long, struct pt_regs *); + +/* See if we have a valid user level fd. + * If it makes sense, return the file structure it references. + * Otherwise return NULL. + */ +extern inline struct file *file_from_fd(const unsigned int fd) +{ + + if (fd >= NR_OPEN) + return NULL; + /* either valid or null */ + return current->files->fd[fd]; +} + /* * The wait-queues are circular lists, and you have to be *very* sure * to keep them correct. Use only these two functions to add/remove * entries in the queues. */ +extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) +{ + struct wait_queue *head = *p; + struct wait_queue *next = WAIT_QUEUE_HEAD(p); + + if (head) + next = head; + *p = wait; + wait->next = next; +} + extern inline void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { unsigned long flags; -#ifdef DEBUG - if (wait->next) { - unsigned long pc; - __asm__ __volatile__("call 1f\n" - "1:\tpopl %0":"=r" (pc)); - printk("add_wait_queue (%08x): wait->next = %08x\n",pc,(unsigned long) wait->next); - } -#endif save_flags(flags); cli(); - if (!*p) { - wait->next = wait; - *p = wait; - } else { - wait->next = (*p)->next; - (*p)->next = wait; - } + __add_wait_queue(p, wait); restore_flags(flags); } +extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait) +{ + struct wait_queue * next = wait->next; + struct wait_queue * head = next; + + for (;;) { + struct wait_queue * nextlist = head->next; + if (nextlist == wait) + break; + head = nextlist; + } + head->next = next; +} + extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { unsigned long flags; - struct wait_queue * tmp; -#ifdef DEBUG - unsigned long ok = 0; -#endif save_flags(flags); cli(); - if ((*p == wait) && -#ifdef DEBUG - (ok = 1) && -#endif - ((*p = wait->next) == wait)) { - *p = NULL; - } else { - tmp = wait; - while (tmp->next != wait) { - tmp = tmp->next; -#ifdef DEBUG - if (tmp == *p) - ok = 1; -#endif - } - tmp->next = wait->next; - } - wait->next = NULL; + __remove_wait_queue(p, wait); restore_flags(flags); -#ifdef DEBUG - if (!ok) { - printk("removed wait_queue not on list.\n"); - printk("list = %08x, queue = %08x\n",(unsigned long) p, (unsigned long) wait); - __asm__("call 1f\n1:\tpopl %0":"=r" (ok)); - printk("eip = %08x\n",ok); - } -#endif } extern inline void select_wait(struct wait_queue ** wait_address, select_table * p) @@ -366,24 +467,6 @@ extern inline void select_wait(struct wait_queue ** wait_address, select_table * p->nr++; } -extern void __down(struct semaphore * sem); - -/* - * These are not yet interrupt-safe - */ -extern inline void down(struct semaphore * sem) -{ - if (sem->count <= 0) - __down(sem); - sem->count--; -} - -extern inline void up(struct semaphore * sem) -{ - sem->count++; - wake_up(&sem->wait); -} - #define REMOVE_LINKS(p) do { unsigned long flags; \ save_flags(flags) ; cli(); \ (p)->next_task->prev_task = (p)->prev_task; \ diff --git a/include/linux/scsicam.h b/include/linux/scsicam.h deleted file mode 100644 index d78dc71c4..000000000 --- a/include/linux/scsicam.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * scsicam.h - SCSI CAM support functions, use for HDIO_GETGEO, etc. - * - * Copyright 1993, 1994 Drew Eckhardt - * Visionary Computing - * (Unix and Linux consulting and custom programming) - * drew@Colorado.EDU - * +1 (303) 786-7975 - * - * For more information, please consult the SCSI-CAM draft. - */ - -#ifndef SCSICAM_H -#define SCSICAM_H -extern int scsicam_bios_param (Disk *disk, int dev, int *ip); -#endif /* def SCSICAM_H */ diff --git a/include/linux/sdla.h b/include/linux/sdla.h new file mode 100644 index 000000000..44ae55b1c --- /dev/null +++ b/include/linux/sdla.h @@ -0,0 +1,339 @@ +/* + * INET An implementation of the TCP/IP protocol suite for the LINUX + * operating system. INET is implemented using the BSD Socket + * interface as the means of communication with the user level. + * + * Global definitions for the Frame relay interface. + * + * Version: @(#)if_ifrad.h 0.20 13 Apr 96 + * + * Author: Mike McLagan <mike.mclagan@linux.org> + * + * Changes: + * 0.15 Mike McLagan Structure packing + * + * 0.20 Mike McLagan New flags for S508 buffer handling + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef SDLA_H +#define SDLA_H + +/* adapter type */ +#define SDLA_TYPES +#define SDLA_S502A 5020 +#define SDLA_S502E 5021 +#define SDLA_S503 5030 +#define SDLA_S507 5070 +#define SDLA_S508 5080 +#define SDLA_S509 5090 +#define SDLA_UNKNOWN -1 + +/* port selection flags for the S508 */ +#define SDLA_S508_PORT_V35 0x00 +#define SDLA_S508_PORT_RS232 0x02 + +/* Z80 CPU speeds */ +#define SDLA_CPU_3M 0x00 +#define SDLA_CPU_5M 0x01 +#define SDLA_CPU_7M 0x02 +#define SDLA_CPU_8M 0x03 +#define SDLA_CPU_10M 0x04 +#define SDLA_CPU_16M 0x05 +#define SDLA_CPU_12M 0x06 + +/* some private IOCTLs */ +#define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1) +#define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2) +#define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3) + +#define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4) +#define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5) +#define SDLA_READMEM (FRAD_LAST_IOCTL + 6) + +struct sdla_mem { + int addr; + int len; + void *data; +}; + +#define SDLA_START (FRAD_LAST_IOCTL + 7) +#define SDLA_STOP (FRAD_LAST_IOCTL + 8) + +/* some offsets in the Z80's memory space */ +#define SDLA_NMIADDR 0x0000 +#define SDLA_CONF_ADDR 0x0010 +#define SDLA_S502A_NMIADDR 0x0066 +#define SDLA_CODE_BASEADDR 0x0100 +#define SDLA_WINDOW_SIZE 0x2000 +#define SDLA_ADDR_MASK 0x1FFF + +/* largest handleable block of data */ +#define SDLA_MAX_DATA 4080 +#define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */ +#define SDLA_MAX_DLCI 24 + +/* this should be the same as frad_conf */ +struct sdla_conf { + short station; + short config; + short kbaud; + short clocking; + short max_frm; + short T391; + short T392; + short N391; + short N392; + short N393; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; +}; + +/* this should be the same as dlci_conf */ +struct sdla_dlci_conf { + short config; + short CIR_fwd; + short Bc_fwd; + short Be_fwd; + short CIR_bwd; + short Bc_bwd; + short Be_bwd; + short Tc_fwd; + short Tc_bwd; + short Tf_max; + short Tb_max; +}; + +#ifndef __KERNEL__ + +void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet); + +#else + +/* important Z80 window addresses */ +#define SDLA_CONTROL_WND 0xE000 + +#define SDLA_502_CMD_BUF 0xEF60 +#define SDLA_502_RCV_BUF 0xA900 +#define SDLA_502_TXN_AVAIL 0xFFF1 +#define SDLA_502_RCV_AVAIL 0xFFF2 +#define SDLA_502_EVENT_FLAGS 0xFFF3 +#define SDLA_502_MDM_STATUS 0xFFF4 +#define SDLA_502_IRQ_INTERFACE 0xFFFD +#define SDLA_502_IRQ_PERMISSION 0xFFFE +#define SDLA_502_DATA_OFS 0x0010 + +#define SDLA_508_CMD_BUF 0xE000 +#define SDLA_508_TXBUF_INFO 0xF100 +#define SDLA_508_RXBUF_INFO 0xF120 +#define SDLA_508_EVENT_FLAGS 0xF003 +#define SDLA_508_MDM_STATUS 0xF004 +#define SDLA_508_IRQ_INTERFACE 0xF010 +#define SDLA_508_IRQ_PERMISSION 0xF011 +#define SDLA_508_TSE_OFFSET 0xF012 + +/* Event flags */ +#define SDLA_EVENT_STATUS 0x01 +#define SDLA_EVENT_DLCI_STATUS 0x02 +#define SDLA_EVENT_BAD_DLCI 0x04 +#define SDLA_EVENT_LINK_DOWN 0x40 + +/* IRQ Trigger flags */ +#define SDLA_INTR_RX 0x01 +#define SDLA_INTR_TX 0x02 +#define SDLA_INTR_MODEM 0x04 +#define SDLA_INTR_COMPLETE 0x08 +#define SDLA_INTR_STATUS 0x10 +#define SDLA_INTR_TIMER 0x20 + +/* DLCI status bits */ +#define SDLA_DLCI_DELETED 0x01 +#define SDLA_DLCI_ACTIVE 0x02 +#define SDLA_DLCI_WAITING 0x04 +#define SDLA_DLCI_NEW 0x08 +#define SDLA_DLCI_INCLUDED 0x40 + +/* valid command codes */ +#define SDLA_INFORMATION_WRITE 0x01 +#define SDLA_INFORMATION_READ 0x02 +#define SDLA_ISSUE_IN_CHANNEL_SIGNAL 0x03 +#define SDLA_SET_DLCI_CONFIGURATION 0x10 +#define SDLA_READ_DLCI_CONFIGURATION 0x11 +#define SDLA_DISABLE_COMMUNICATIONS 0x12 +#define SDLA_ENABLE_COMMUNICATIONS 0x13 +#define SDLA_READ_DLC_STATUS 0x14 +#define SDLA_READ_DLC_STATISTICS 0x15 +#define SDLA_FLUSH_DLC_STATISTICS 0x16 +#define SDLA_LIST_ACTIVE_DLCI 0x17 +#define SDLA_FLUSH_INFORMATION_BUFFERS 0x18 +#define SDLA_ADD_DLCI 0x20 +#define SDLA_DELETE_DLCI 0x21 +#define SDLA_ACTIVATE_DLCI 0x22 +#define SDLA_DEACTIVATE_DLCI 0x23 +#define SDLA_READ_MODEM_STATUS 0x30 +#define SDLA_SET_MODEM_STATUS 0x31 +#define SDLA_READ_COMMS_ERR_STATS 0x32 +#define SDLA_FLUSH_COMMS_ERR_STATS 0x33 +#define SDLA_READ_CODE_VERSION 0x40 +#define SDLA_SET_IRQ_TRIGGER 0x50 +#define SDLA_GET_IRQ_TRIGGER 0x51 + +/* In channel signal types */ +#define SDLA_ICS_LINK_VERIFY 0x02 +#define SDLA_ICS_STATUS_ENQ 0x03 + +/* modem status flags */ +#define SDLA_MODEM_DTR_HIGH 0x01 +#define SDLA_MODEM_RTS_HIGH 0x02 +#define SDLA_MODEM_DCD_HIGH 0x08 +#define SDLA_MODEM_CTS_HIGH 0x20 + +/* used for RET_MODEM interpretation */ +#define SDLA_MODEM_DCD_LOW 0x01 +#define SDLA_MODEM_CTS_LOW 0x02 + +/* return codes */ +#define SDLA_RET_OK 0x00 +#define SDLA_RET_COMMUNICATIONS 0x01 +#define SDLA_RET_CHANNEL_INACTIVE 0x02 +#define SDLA_RET_DLCI_INACTIVE 0x03 +#define SDLA_RET_DLCI_CONFIG 0x04 +#define SDLA_RET_BUF_TOO_BIG 0x05 +#define SDLA_RET_NO_DATA 0x05 +#define SDLA_RET_BUF_OVERSIZE 0x06 +#define SDLA_RET_CIR_OVERFLOW 0x07 +#define SDLA_RET_NO_BUFS 0x08 +#define SDLA_RET_TIMEOUT 0x0A +#define SDLA_RET_MODEM 0x10 +#define SDLA_RET_CHANNEL_OFF 0x11 +#define SDLA_RET_CHANNEL_ON 0x12 +#define SDLA_RET_DLCI_STATUS 0x13 +#define SDLA_RET_DLCI_UNKNOWN 0x14 +#define SDLA_RET_COMMAND_INVALID 0x1F + +/* Configuration flags */ +#define SDLA_DIRECT_RECV 0x0080 +#define SDLA_TX_NO_EXCEPT 0x0020 +#define SDLA_NO_ICF_MSGS 0x1000 +#define SDLA_TX50_RX50 0x0000 +#define SDLA_TX70_RX30 0x2000 +#define SDLA_TX30_RX70 0x4000 + +/* IRQ selection flags */ +#define SDLA_IRQ_RECEIVE 0x01 +#define SDLA_IRQ_TRANSMIT 0x02 +#define SDLA_IRQ_MODEM_STAT 0x04 +#define SDLA_IRQ_COMMAND 0x08 +#define SDLA_IRQ_CHANNEL 0x10 +#define SDLA_IRQ_TIMER 0x20 + +/* definitions for PC memory mapping */ +#define SDLA_8K_WINDOW 0x01 +#define SDLA_S502_SEG_A 0x10 +#define SDLA_S502_SEG_C 0x20 +#define SDLA_S502_SEG_D 0x00 +#define SDLA_S502_SEG_E 0x30 +#define SDLA_S507_SEG_A 0x00 +#define SDLA_S507_SEG_B 0x40 +#define SDLA_S507_SEG_C 0x80 +#define SDLA_S507_SEG_E 0xC0 +#define SDLA_S508_SEG_A 0x00 +#define SDLA_S508_SEG_C 0x10 +#define SDLA_S508_SEG_D 0x08 +#define SDLA_S508_SEG_E 0x18 + +/* SDLA adapter port constants */ +#define SDLA_IO_EXTENTS 0x04 + +#define SDLA_REG_CONTROL 0x00 +#define SDLA_REG_PC_WINDOW 0x01 /* offset for PC window select latch */ +#define SDLA_REG_Z80_WINDOW 0x02 /* offset for Z80 window select latch */ +#define SDLA_REG_Z80_CONTROL 0x03 /* offset for Z80 control latch */ + +#define SDLA_S502_STS 0x00 /* status reg for 502, 502E, 507 */ +#define SDLA_S508_GNRL 0x00 /* general purp. reg for 508 */ +#define SDLA_S508_STS 0x01 /* status reg for 508 */ +#define SDLA_S508_IDR 0x02 /* ID reg for 508 */ + +/* control register flags */ +#define SDLA_S502A_START 0x00 /* start the CPU */ +#define SDLA_S502A_INTREQ 0x02 +#define SDLA_S502A_INTEN 0x04 +#define SDLA_S502A_HALT 0x08 /* halt the CPU */ +#define SDLA_S502A_NMI 0x10 /* issue an NMI to the CPU */ + +#define SDLA_S502E_CPUEN 0x01 +#define SDLA_S502E_ENABLE 0x02 +#define SDLA_S502E_INTACK 0x04 + +#define SDLA_S507_ENABLE 0x01 +#define SDLA_S507_IRQ3 0x00 +#define SDLA_S507_IRQ4 0x20 +#define SDLA_S507_IRQ5 0x40 +#define SDLA_S507_IRQ7 0x60 +#define SDLA_S507_IRQ10 0x80 +#define SDLA_S507_IRQ11 0xA0 +#define SDLA_S507_IRQ12 0xC0 +#define SDLA_S507_IRQ15 0xE0 + +#define SDLA_HALT 0x00 +#define SDLA_CPUEN 0x02 +#define SDLA_MEMEN 0x04 +#define SDLA_S507_EPROMWR 0x08 +#define SDLA_S507_EPROMCLK 0x10 +#define SDLA_S508_INTRQ 0x08 +#define SDLA_S508_INTEN 0x10 + +struct sdla_cmd { + char opp_flag __attribute__((packed)); + char cmd __attribute__((packed)); + short length __attribute__((packed)); + char retval __attribute__((packed)); + short dlci __attribute__((packed)); + char flags __attribute__((packed)); + short rxlost_int __attribute__((packed)); + long rxlost_app __attribute__((packed)); + char reserve[2] __attribute__((packed)); + char data[SDLA_MAX_DATA] __attribute__((packed)); /* transfer data buffer */ +}; + +struct intr_info { + char flags __attribute__((packed)); + short txlen __attribute__((packed)); + char irq __attribute__((packed)); + char flags2 __attribute__((packed)); + short timeout __attribute__((packed)); +}; + +/* found in the 508's control window at RXBUF_INFO */ +struct buf_info { + unsigned short rse_num __attribute__((packed)); + unsigned long rse_base __attribute__((packed)); + unsigned long rse_next __attribute__((packed)); + unsigned long buf_base __attribute__((packed)); + unsigned short reserved __attribute__((packed)); + unsigned long buf_top __attribute__((packed)); +}; + +/* structure pointed to by rse_base in RXBUF_INFO struct */ +struct buf_entry { + char opp_flag __attribute__((packed)); + short length __attribute__((packed)); + short dlci __attribute__((packed)); + char flags __attribute__((packed)); + short timestamp __attribute__((packed)); + short reserved[2] __attribute__((packed)); + long buf_addr __attribute__((packed)); +}; + +#endif + +#endif diff --git a/include/linux/sem.h b/include/linux/sem.h index 9484d233e..a5b3134bf 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -1,5 +1,6 @@ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H + #include <linux/ipc.h> /* semop flags */ @@ -14,45 +15,49 @@ #define SETVAL 16 /* set semval */ #define SETALL 17 /* set all semval's */ +/* ipcs ctl cmds */ +#define SEM_STAT 18 +#define SEM_INFO 19 + /* One semid data structure for each set of semaphores in the system. */ struct semid_ds { - struct ipc_perm sem_perm; /* permissions .. see ipc.h */ - time_t sem_otime; /* last semop time */ - time_t sem_ctime; /* last change time */ - struct sem *sem_base; /* ptr to first semaphore in array */ - struct sem_queue *sem_pending; /* pending operations to be processed */ - struct sem_queue **sem_pending_last; /* last pending operation */ - struct sem_undo *undo; /* undo requests on this array */ - ushort sem_nsems; /* no. of semaphores in array */ + struct ipc_perm sem_perm; /* permissions .. see ipc.h */ + __kernel_time_t sem_otime; /* last semop time */ + __kernel_time_t sem_ctime; /* last change time */ + struct sem *sem_base; /* ptr to first semaphore in array */ + struct sem_queue *sem_pending; /* pending operations to be processed */ + struct sem_queue **sem_pending_last; /* last pending operation */ + struct sem_undo *undo; /* undo requests on this array */ + unsigned short sem_nsems; /* no. of semaphores in array */ }; /* semop system calls takes an array of these. */ struct sembuf { - ushort sem_num; /* semaphore index in array */ - short sem_op; /* semaphore operation */ - short sem_flg; /* operation flags */ + unsigned short sem_num; /* semaphore index in array */ + short sem_op; /* semaphore operation */ + short sem_flg; /* operation flags */ }; /* arg for semctl system calls. */ union semun { - int val; /* value for SETVAL */ - struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ - ushort *array; /* array for GETALL & SETALL */ - struct seminfo *__buf; /* buffer for IPC_INFO */ - void *__pad; + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ + unsigned short *array; /* array for GETALL & SETALL */ + struct seminfo *__buf; /* buffer for IPC_INFO */ + void *__pad; }; struct seminfo { - int semmap; - int semmni; - int semmns; - int semmnu; - int semmsl; - int semopm; - int semume; - int semusz; - int semvmx; - int semaem; + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; }; #define SEMMNI 128 /* ? max # of semaphore identifiers */ @@ -72,37 +77,37 @@ struct seminfo { /* One semaphore structure for each semaphore in the system. */ struct sem { - short semval; /* current value */ - short sempid; /* pid of last operation */ + int semval; /* current value */ + int sempid; /* pid of last operation */ }; -/* ipcs ctl cmds */ -#define SEM_STAT 18 -#define SEM_INFO 19 - /* One queue for each semaphore set in the system. */ struct sem_queue { - struct sem_queue * next; /* next entry in the queue */ - struct sem_queue ** prev; /* previous entry in the queue, *(q->prev) == q */ - struct wait_queue * sleeper; /* sleeping process */ - struct sem_undo * undo; /* undo structure */ - int pid; /* process id of requesting process */ - int status; /* completion status of operation */ - struct semid_ds * sma; /* semaphore array for operations */ - struct sembuf * sops; /* array of pending operations */ - int nsops; /* number of operations */ + struct sem_queue * next; /* next entry in the queue */ + struct sem_queue ** prev; /* previous entry in the queue, *(q->prev) == q */ + struct wait_queue * sleeper; /* sleeping process */ + struct sem_undo * undo; /* undo structure */ + int pid; /* process id of requesting process */ + int status; /* completion status of operation */ + struct semid_ds * sma; /* semaphore array for operations */ + struct sembuf * sops; /* array of pending operations */ + int nsops; /* number of operations */ }; /* Each task has a list of undo requests. They are executed automatically * when the process exits. */ struct sem_undo { - struct sem_undo * proc_next; /* next entry on this process */ - struct sem_undo * id_next; /* next entry on this semaphore set */ - int semid; /* semaphore set identifier */ - short * semadj; /* array of adjustments, one per semaphore */ + struct sem_undo * proc_next; /* next entry on this process */ + struct sem_undo * id_next; /* next entry on this semaphore set */ + int semid; /* semaphore set identifier */ + short * semadj; /* array of adjustments, one per semaphore */ }; +asmlinkage int sys_semget (key_t key, int nsems, int semflg); +asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops); +asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg); + #endif /* __KERNEL__ */ #endif /* _LINUX_SEM_H */ diff --git a/include/linux/serial.h b/include/linux/serial.h index 02af4746a..141c6706c 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h @@ -44,7 +44,19 @@ struct serial_struct { #define PORT_16550A 4 #define PORT_CIRRUS 5 #define PORT_16650 6 -#define PORT_MAX 6 +#define PORT_16650V2 7 +#define PORT_16750 8 +#define PORT_MAX 8 + +struct serial_uart_config { + char *name; + int dfl_xmit_fifo_size; + int flags; +}; + +#define UART_CLEAR_FIFO 0x01 +#define UART_USE_FIFO 0x02 +#define UART_STARTECH 0x04 /* * Definitions for async_struct (and serial_struct) flags field @@ -55,7 +67,7 @@ struct serial_struct { #define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ -#define ASYNC_SPD_MASK 0x0030 +#define ASYNC_SPD_MASK 0x1030 #define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ #define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ @@ -67,8 +79,13 @@ struct serial_struct { #define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ #define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ -#define ASYNC_FLAGS 0x0FFF /* Possible legal async flags */ -#define ASYNC_USR_MASK 0x0430 /* Legal flags that non-privileged +#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */ + +#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */ +#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */ + +#define ASYNC_FLAGS 0x1FFF /* Possible legal async flags */ +#define ASYNC_USR_MASK 0x1430 /* Legal flags that non-privileged * users can set or reset */ /* Internal flags used only by kernel/chr_drv/serial.c */ @@ -79,6 +96,9 @@ struct serial_struct { #define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ #define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ #define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ +#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards */ + +#define ASYNC_INTERNAL_FLAGS 0xFF000000 /* Internal flags */ /* * Multiport serial configuration structure --- external structure @@ -97,6 +117,16 @@ struct serial_multiport_struct { int reserved[32]; }; +/* + * Serial input interrupt line counters -- external structure + * Four lines can interrupt: CTS, DSR, RI, DCD + */ +struct serial_icounter_struct { + int cts, dsr, rng, dcd; + int reserved[16]; +}; + + #ifdef __KERNEL__ /* * This is our internal structure for each serial port's state. @@ -107,20 +137,47 @@ struct serial_multiport_struct { * For definitions of the flags field, see tty.h */ +#include <linux/termios.h> +#include <linux/tqueue.h> + +/* + * Counters of the input lines (CTS, DSR, RI, CD) interrupts + */ +struct async_icount { + __u32 cts, dsr, rng, dcd; +}; + +struct serial_state { + int magic; + int baud_base; + int port; + int irq; + int flags; + int hub6; + int type; + int line; + int xmit_fifo_size; + int custom_divisor; + int count; + unsigned short close_delay; + unsigned short closing_wait; /* time to wait before closing */ + struct async_icount icount; + struct termios normal_termios; + struct termios callout_termios; + struct async_struct *info; +}; + struct async_struct { int magic; - int baud_base; int port; - int irq; - int flags; /* defined in tty.h */ - int hub6; /* HUB6 plus one */ - int type; /* UART type */ + int hub6; + int flags; + int xmit_fifo_size; + struct serial_state *state; struct tty_struct *tty; int read_status_mask; int ignore_status_mask; int timeout; - int xmit_fifo_size; - int custom_divisor; int x_char; /* xon/xoff character */ int close_delay; unsigned short closing_wait; @@ -131,7 +188,6 @@ struct async_struct { unsigned long event; unsigned long last_active; int line; - int count; /* # of fd on device */ int blocked_open; /* # of blocked opens */ long session; /* Session of opening process */ long pgrp; /* pgrp of opening process */ @@ -141,15 +197,15 @@ struct async_struct { int xmit_cnt; struct tq_struct tqueue; struct tq_struct tqueue_hangup; - struct termios normal_termios; - struct termios callout_termios; struct wait_queue *open_wait; struct wait_queue *close_wait; + struct wait_queue *delta_msr_wait; struct async_struct *next_port; /* For the linked list */ struct async_struct *prev_port; }; #define SERIAL_MAGIC 0x5301 +#define SSTATE_MAGIC 0x5302 /* * The size of the serial xmit buffer is 1 page, or 4096 bytes diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index 19d7c0ba7..c982ae28b 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h @@ -51,6 +51,8 @@ #define UART_FCR6_T_TRIGGER_8 0x10 /* Mask for transmit trigger set at 8 */ #define UART_FCR6_T_TRIGGER_24 0x20 /* Mask for transmit trigger set at 24 */ #define UART_FCR6_T_TRIGGER_30 0x30 /* Mask for transmit trigger set at 30 */ +/* TI 16750 definitions */ +#define UART_FCR7_64BYTE 0x20 /* Go into 64 byte mode */ /* * These are the definitions for the Line Control Register @@ -98,6 +100,11 @@ #define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */ #define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */ #define UART_IER_RDI 0x01 /* Enable receiver data interrupt */ +/* + * Sleep mode for ST16650 and TI16750. + * Note that for 16650, EFR-bit 4 must be selected as well. + */ +#define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ /* * These are the definitions for the Modem Control Register @@ -128,7 +135,7 @@ #define UART_EFR_CTS 0x80 /* CTS flow control */ #define UART_EFR_RTS 0x40 /* RTS flow control */ #define UART_EFR_SCD 0x20 /* Special character detect */ -#define UART_EFR_ENI 0x10 /* Enhanced Interrupt */ +#define UART_EFR_ECB 0x10 /* Enhanced control bit */ /* * the low four bits control software flow control */ diff --git a/include/linux/shm.h b/include/linux/shm.h index 2faa4e63d..f890c7356 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h @@ -1,20 +1,23 @@ #ifndef _LINUX_SHM_H_ #define _LINUX_SHM_H_ + #include <linux/ipc.h> +#include <asm/shmparam.h> + struct shmid_ds { - struct ipc_perm shm_perm; /* operation perms */ - int shm_segsz; /* size of segment (bytes) */ - time_t shm_atime; /* last attach time */ - time_t shm_dtime; /* last detach time */ - time_t shm_ctime; /* last change time */ - unsigned short shm_cpid; /* pid of creator */ - unsigned short shm_lpid; /* pid of last operator */ - short shm_nattch; /* no. of current attaches */ + struct ipc_perm shm_perm; /* operation perms */ + int shm_segsz; /* size of segment (bytes) */ + __kernel_time_t shm_atime; /* last attach time */ + __kernel_time_t shm_dtime; /* last detach time */ + __kernel_time_t shm_ctime; /* last change time */ + __kernel_ipc_pid_t shm_cpid; /* pid of creator */ + __kernel_ipc_pid_t shm_lpid; /* pid of last operator */ + unsigned short shm_nattch; /* no. of current attaches */ /* the following are private */ - unsigned short shm_npages; /* size of segment (pages) */ - unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */ - struct vm_area_struct *attaches; /* descriptors for attaches */ + unsigned short shm_npages; /* size of segment (pages) */ + unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct vm_area_struct *attaches; /* descriptors for attaches */ }; /* permission flag for shmget */ @@ -30,47 +33,26 @@ struct shmid_ds { #define SHM_LOCK 11 #define SHM_UNLOCK 12 +/* ipcs ctl commands */ +#define SHM_STAT 13 +#define SHM_INFO 14 + struct shminfo { - int shmmax; - int shmmin; - int shmmni; - int shmseg; - int shmall; + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; }; -/* address range for shared memory attaches if no address passed to shmat() */ -#define SHM_RANGE_START 0x50000000 -#define SHM_RANGE_END 0x60000000 - -/* format of page table entries that correspond to shared memory pages - currently out in swap space (see also mm/swap.c): - bit 0 (PAGE_PRESENT) is = 0 - bits 7..1 (SWP_TYPE) are = SHM_SWP_TYPE - bits 31..8 are used like this: - bits 14..8 (SHM_ID) the id of the shared memory segment - bits 29..15 (SHM_IDX) the index of the page within the shared memory segment - (actually only bits 24..15 get used since SHMMAX is so low) -*/ - -#define SHM_ID_SHIFT 8 -/* Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and - there is a static array of size SHMMNI. */ -#define _SHM_ID_BITS 7 -#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1) - -#define SHM_IDX_SHIFT (SHM_ID_SHIFT+_SHM_ID_BITS) -#define _SHM_IDX_BITS 15 -#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1) - -/* We must have SHM_ID_SHIFT + _SHM_ID_BITS + _SHM_IDX_BITS <= 32 - and SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). */ - -#define SHMMAX 0x3fa000 /* max shared seg size (bytes) */ -#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */ -#define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */ -#define SHMALL (1<<(_SHM_IDX_BITS+_SHM_ID_BITS))/* max shm system wide (pages) */ -#define SHMLBA 0x1000 /* attach addr a multiple of this */ -#define SHMSEG SHMMNI /* max shared segs per process */ +struct shm_info { + int used_ids; + unsigned long shm_tot; /* total allocated shm */ + unsigned long shm_rss; /* total resident shm */ + unsigned long shm_swp; /* total swapped shm */ + unsigned long swap_attempts; + unsigned long swap_successes; +}; #ifdef __KERNEL__ @@ -78,19 +60,11 @@ struct shminfo { #define SHM_DEST 01000 /* segment will be destroyed on last detach */ #define SHM_LOCKED 02000 /* segment will not be swapped */ -/* ipcs ctl commands */ -#define SHM_STAT 13 -#define SHM_INFO 14 -struct shm_info { - int used_ids; - ulong shm_tot; /* total allocated shm */ - ulong shm_rss; /* total resident shm */ - ulong shm_swp; /* total swapped shm */ - ulong swap_attempts; - ulong swap_successes; -}; +asmlinkage int sys_shmget (key_t key, int size, int flag); +asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr); +asmlinkage int sys_shmdt (char *shmaddr); +asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf); #endif /* __KERNEL__ */ #endif /* _LINUX_SHM_H_ */ - diff --git a/include/linux/sjcd.h b/include/linux/sjcd.h new file mode 100644 index 000000000..0aa5e7146 --- /dev/null +++ b/include/linux/sjcd.h @@ -0,0 +1,181 @@ +/* + * Definitions for a Sanyo CD-ROM interface. + * + * Copyright (C) 1995 Vadim V. Model + * model@cecmow.enet.dec.com + * vadim@rbrf.msk.su + * vadim@ipsun.ras.ru + * Eric van der Maarel + * H.T.M.v.d.Maarel@marin.nl + * + * This information is based on mcd.c from M. Harriss and sjcd102.lst from + * E. Moenkeberg. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SJCD_H__ +#define __SJCD_H__ + +/* + * Change this to set the I/O port address as default. More flexibility + * come with setup implementation. + */ +#define SJCD_BASE_ADDR 0x340 + +/* + * Change this to set the irq as default. Really SANYO do not use interrupts + * at all. + */ +#define SJCD_INTR_NR 0 + +/* + * Change this to set the dma as default value. really SANYO does not use + * direct memory access at all. + */ +#define SJCD_DMA_NR 0 + +/* + * Macros which allow us to find out the status of the drive. + */ +#define SJCD_STATUS_AVAILABLE( x ) (((x)&0x02)==0) +#define SJCD_DATA_AVAILABLE( x ) (((x)&0x01)==0) + +/* + * Port access macro. Three ports are available: S-data port (command port), + * status port (read only) and D-data port (read only). + */ +#define SJCDPORT( x ) ( sjcd_base + ( x ) ) +#define SJCD_STATUS_PORT SJCDPORT( 1 ) +#define SJCD_S_DATA_PORT SJCDPORT( 0 ) +#define SJCD_COMMAND_PORT SJCDPORT( 0 ) +#define SJCD_D_DATA_PORT SJCDPORT( 2 ) + +/* + * Drive info bits. Drive info available as first (mandatory) byte of + * command completion status. + */ +#define SST_NOT_READY 0x10 /* no disk in the drive (???) */ +#define SST_MEDIA_CHANGED 0x20 /* disk is changed */ +#define SST_DOOR_OPENED 0x40 /* door is open */ + +/* commands */ + +#define SCMD_EJECT_TRAY 0xD0 /* eject tray if not locked */ +#define SCMD_LOCK_TRAY 0xD2 /* lock tray when in */ +#define SCMD_UNLOCK_TRAY 0xD4 /* unlock tray when in */ +#define SCMD_CLOSE_TRAY 0xD6 /* load tray in */ + +#define SCMD_RESET 0xFA /* soft reset */ +#define SCMD_GET_STATUS 0x80 +#define SCMD_GET_VERSION 0xCC + +#define SCMD_DATA_READ 0xA0 /* are the same, depend on mode&args */ +#define SCMD_SEEK 0xA0 +#define SCMD_PLAY 0xA0 + +#define SCMD_GET_QINFO 0xA8 + +#define SCMD_SET_MODE 0xC4 +#define SCMD_MODE_PLAY 0xE0 +#define SCMD_MODE_COOKED (0xF8 & ~0x20) +#define SCMD_MODE_RAW 0xF9 +#define SCMD_MODE_x20_BIT 0x20 /* What is it for ? */ + +#define SCMD_SET_VOLUME 0xAE +#define SCMD_PAUSE 0xE0 +#define SCMD_STOP 0xE0 + +#define SCMD_GET_DISK_INFO 0xAA + +/* + * Some standard arguments for SCMD_GET_DISK_INFO. + */ +#define SCMD_GET_1_TRACK 0xA0 /* get the first track information */ +#define SCMD_GET_L_TRACK 0xA1 /* get the last track information */ +#define SCMD_GET_D_SIZE 0xA2 /* get the whole disk information */ + +/* + * Borrowed from hd.c. Allows to optimize multiple port read commands. + */ +#define S_READ_DATA( port, buf, nr ) insb( port, buf, nr ) + +/* + * We assume that there are no audio disks with TOC length more than this + * number (I personally have never seen disks with more than 20 fragments). + */ +#define SJCD_MAX_TRACKS 100 + +struct msf { + unsigned char min; + unsigned char sec; + unsigned char frame; +}; + +struct sjcd_hw_disk_info { + unsigned char track_control; + unsigned char track_no; + unsigned char x, y, z; + union { + unsigned char track_no; + struct msf track_msf; + } un; +}; + +struct sjcd_hw_qinfo { + unsigned char track_control; + unsigned char track_no; + unsigned char x; + struct msf rel; + struct msf abs; +}; + +struct sjcd_play_msf { + struct msf start; + struct msf end; +}; + +struct sjcd_disk_info { + unsigned char first; + unsigned char last; + struct msf disk_length; + struct msf first_track; +}; + +struct sjcd_toc { + unsigned char ctrl_addr; + unsigned char track; + unsigned char point_index; + struct msf track_time; + struct msf disk_time; +}; + +#if defined( SJCD_GATHER_STAT ) + +struct sjcd_stat { + int ticks; + int tticks[ 8 ]; + int idle_ticks; + int start_ticks; + int mode_ticks; + int read_ticks; + int data_ticks; + int stop_ticks; + int stopping_ticks; +}; + +#endif + +#endif diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e831eb130..57302ca98 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -13,83 +13,131 @@ #ifndef _LINUX_SKBUFF_H #define _LINUX_SKBUFF_H -#include <linux/malloc.h> -#include <linux/wait.h> -#include <linux/time.h> + #include <linux/config.h> +#include <linux/time.h> + +#include <asm/atomic.h> +#include <asm/types.h> -#undef CONFIG_SKB_CHECK +#define CONFIG_SKB_CHECK 0 #define HAVE_ALLOC_SKB /* For the drivers to know */ +#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ #define FREE_READ 1 #define FREE_WRITE 0 +#define CHECKSUM_NONE 0 +#define CHECKSUM_HW 1 +#define CHECKSUM_UNNECESSARY 2 -struct sk_buff_head { - struct sk_buff * volatile next; - struct sk_buff * volatile prev; +struct sk_buff_head +{ + struct sk_buff * next; + struct sk_buff * prev; + __u32 qlen; /* Must be same length as a pointer + for using debugging */ #if CONFIG_SKB_CHECK - int magic_debug_cookie; + int magic_debug_cookie; #endif }; -struct sk_buff { - struct sk_buff * volatile next; /* Next buffer in list */ - struct sk_buff * volatile prev; /* Previous buffer in list */ +struct sk_buff +{ + struct sk_buff * next; /* Next buffer in list */ + struct sk_buff * prev; /* Previous buffer in list */ + struct sk_buff_head * list; /* List we are on */ #if CONFIG_SKB_CHECK - int magic_debug_cookie; + int magic_debug_cookie; #endif - struct sk_buff * volatile link3; /* Link for IP protocol level buffer chains */ - struct sock *sk; /* Socket we are owned by */ - volatile unsigned long when; /* used to compute rtt's */ - struct timeval stamp; /* Time we arrived */ - struct device *dev; /* Device we arrived on/are leaving by */ - struct sk_buff *mem_addr; /* Self reference (obsolete) */ - union { - struct tcphdr *th; - struct ethhdr *eth; - struct iphdr *iph; - struct udphdr *uh; - unsigned char *raw; - unsigned long seq; - } h; - struct iphdr *ip_hdr; /* For IPPROTO_RAW */ - unsigned long mem_len; /* Length of allocated memory */ - unsigned long len; /* Length of actual data */ - unsigned long fraglen; /* Unused (yet) */ - struct sk_buff *fraglist; /* Fragment list */ - unsigned long truesize; /* True buffer size (obsolete) */ - unsigned long saddr; /* IP source address */ - unsigned long daddr; /* IP target address */ - unsigned long raddr; /* IP next hop address */ - volatile char acked, /* Are we acked ? */ - used, /* Are we in use ? */ - free, /* How to free this buffer */ - arp; /* Has IP/ARP resolution finished */ - unsigned char tries, /* Times tried */ - lock, /* Are we locked ? */ - localroute, /* Local routing asserted for this frame */ - pkt_type; /* Packet class */ -#define PACKET_HOST 0 /* To us */ -#define PACKET_BROADCAST 1 /* To all */ -#define PACKET_MULTICAST 2 /* To group */ -#define PACKET_OTHERHOST 3 /* To someone else */ - unsigned short users; /* User count - see datagram.c,tcp.c */ - unsigned short protocol; /* Packet protocol from driver. */ -#ifdef CONFIG_SLAVE_BALANCING - unsigned short in_dev_queue; -#endif - unsigned long padding[0]; /* Force long word alignment */ - unsigned char data[0]; /* Data follows */ + struct sk_buff *link3; /* Link for IP protocol level buffer chains */ + struct sock *sk; /* Socket we are owned by */ + unsigned long when; /* used to compute rtt's */ + struct timeval stamp; /* Time we arrived */ + struct device *dev; /* Device we arrived on/are leaving by */ + union + { + struct tcphdr *th; + struct ethhdr *eth; + struct iphdr *iph; + struct udphdr *uh; + unsigned char *raw; + /* for passing file handles in a unix domain socket */ + void *filp; + } h; + + union + { + /* As yet incomplete physical layer views */ + unsigned char *raw; + struct ethhdr *ethernet; + } mac; + + struct iphdr *ip_hdr; /* For IPPROTO_RAW */ +#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) + struct ipv6hdr *ipv6_hdr; + + /* + * It would be inefficient to store the nexthop address in every + * skb. Instead we store a pointer to the respective neighbour + * cache entry. This might make ndisc cache management harder. + */ + + struct neighbour *nexthop; +#endif + unsigned int len; /* Length of actual data */ + unsigned int csum; /* Checksum */ + __u32 saddr; /* IP source address */ + __u32 daddr; /* IP target address */ + __u32 raddr; /* IP next hop address */ + __u32 seq; /* TCP sequence number */ + __u32 end_seq; /* seq [+ fin] [+ syn] + datalen */ + __u32 ack_seq; /* TCP ack sequence number */ + unsigned char proto_priv[16]; /* Protocol private data */ + volatile char acked, /* Are we acked ? */ + used, /* Are we in use ? */ + free, /* How to free this buffer */ + arp; /* Has IP/ARP resolution finished */ + unsigned char tries, /* Times tried */ + lock, /* Are we locked ? */ + localroute, /* Local routing asserted for this frame */ + pkt_type, /* Packet class */ + pkt_bridged, /* Tracker for bridging */ + ip_summed; /* Driver fed us an IP checksum */ +#define PACKET_HOST 0 /* To us */ +#define PACKET_BROADCAST 1 /* To all */ +#define PACKET_MULTICAST 2 /* To group */ +#define PACKET_OTHERHOST 3 /* To someone else */ +#define PACKET_NDISC 17 /* Outgoing NDISC packet */ + unsigned short users; /* User count - see datagram.c,tcp.c */ + unsigned short protocol; /* Packet protocol from driver. */ + unsigned short truesize; /* Buffer size */ + + atomic_t count; /* reference count */ + struct sk_buff *data_skb; /* Link to the actual data skb */ + unsigned char *head; /* Head of buffer */ + unsigned char *data; /* Data head pointer */ + unsigned char *tail; /* Tail pointer */ + unsigned char *end; /* End pointer */ + void (*destructor)(struct sk_buff *); /* Destruct function */ + __u16 redirport; /* Redirect port */ + __u16 inclone; /* Inline clone */ +#define SKB_CLONE_ORIG 1 +#define SKB_CLONE_INLINE 2 }; +#ifdef CONFIG_SKB_LARGE +#define SK_WMEM_MAX 65535 +#define SK_RMEM_MAX 65535 +#else #define SK_WMEM_MAX 32767 #define SK_RMEM_MAX 32767 +#endif -#ifdef CONFIG_SKB_CHECK +#if CONFIG_SKB_CHECK #define SK_FREED_SKB 0x0DE2C0DE #define SK_GOOD_SKB 0xDEC0DED1 #define SK_HEAD_SKB 0x12231298 @@ -99,6 +147,7 @@ struct sk_buff { /* * Handling routines are only of interest to the kernel */ +#include <linux/malloc.h> #include <asm/system.h> @@ -113,24 +162,61 @@ extern struct sk_buff * skb_dequeue(struct sk_buff_head *list); extern void skb_insert(struct sk_buff *old,struct sk_buff *newsk); extern void skb_append(struct sk_buff *old,struct sk_buff *newsk); extern void skb_unlink(struct sk_buff *buf); +extern __u32 skb_queue_len(struct sk_buff_head *list); extern struct sk_buff * skb_peek_copy(struct sk_buff_head *list); extern struct sk_buff * alloc_skb(unsigned int size, int priority); -extern void kfree_skbmem(struct sk_buff *skb, unsigned size); +extern struct sk_buff * dev_alloc_skb(unsigned int size); +extern void kfree_skbmem(struct sk_buff *skb); extern struct sk_buff * skb_clone(struct sk_buff *skb, int priority); +extern struct sk_buff * skb_copy(struct sk_buff *skb, int priority); extern void skb_device_lock(struct sk_buff *skb); extern void skb_device_unlock(struct sk_buff *skb); extern void dev_kfree_skb(struct sk_buff *skb, int mode); extern int skb_device_locked(struct sk_buff *skb); +extern unsigned char * skb_put(struct sk_buff *skb, unsigned int len); +extern unsigned char * skb_push(struct sk_buff *skb, unsigned int len); +extern unsigned char * skb_pull(struct sk_buff *skb, unsigned int len); +extern int skb_headroom(struct sk_buff *skb); +extern int skb_tailroom(struct sk_buff *skb); +extern void skb_reserve(struct sk_buff *skb, unsigned int len); +extern void skb_trim(struct sk_buff *skb, unsigned int len); + +extern __inline__ int skb_queue_empty(struct sk_buff_head *list) +{ + return (list->next == (struct sk_buff *) list); +} + +extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri, int dir) +{ + struct sk_buff *nskb; + if(skb->users==1) + return skb; + nskb=skb_copy(skb, pri); + kfree_skb(skb, dir); /* Free our shared copy */ + return nskb; +} + /* * Peek an sk_buff. Unlike most other operations you _MUST_ * be careful with this one. A peek leaves the buffer on the * list and someone else may run off with it. For an interrupt * type system cli() peek the buffer copy the data and sti(); */ -static __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) +extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) +{ + struct sk_buff *list = ((struct sk_buff *)list_)->next; + if (list == (struct sk_buff *)list_) + list = NULL; + return list; +} + +/* + * Return the length of an sk_buff queue + */ + +extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) { - struct sk_buff *list = (struct sk_buff *)list_; - return (list->next != list)? list->next : NULL; + return(list_->qlen); } #if CONFIG_SKB_CHECK @@ -145,23 +231,37 @@ extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) { list->prev = (struct sk_buff *)list; list->next = (struct sk_buff *)list; + list->qlen = 0; } /* * Insert an sk_buff at the start of a list. + * + * The "__skb_xxxx()" functions are the non-atomic ones that + * can only be called with interrupts disabled. */ -extern __inline__ void skb_queue_head(struct sk_buff_head *list_,struct sk_buff *newsk) +extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) +{ + struct sk_buff *prev, *next; + + newsk->list = list; + list->qlen++; + prev = (struct sk_buff *)list; + next = prev->next; + newsk->next = next; + newsk->prev = prev; + next->prev = newsk; + prev->next = newsk; +} + +extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; - struct sk_buff *list = (struct sk_buff *)list_; save_flags(flags); cli(); - newsk->next = list->next; - newsk->prev = list; - newsk->next->prev = newsk; - newsk->prev->next = newsk; + __skb_queue_head(list, newsk); restore_flags(flags); } @@ -169,74 +269,92 @@ extern __inline__ void skb_queue_head(struct sk_buff_head *list_,struct sk_buff * Insert an sk_buff at the end of a list. */ -extern __inline__ void skb_queue_tail(struct sk_buff_head *list_, struct sk_buff *newsk) +extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) +{ + struct sk_buff *prev, *next; + + newsk->list = list; + list->qlen++; + next = (struct sk_buff *)list; + prev = next->prev; + newsk->next = next; + newsk->prev = prev; + next->prev = newsk; + prev->next = newsk; +} + +extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; - struct sk_buff *list = (struct sk_buff *)list_; save_flags(flags); cli(); - - newsk->next = list; - newsk->prev = list->prev; - - newsk->next->prev = newsk; - newsk->prev->next = newsk; - + __skb_queue_tail(list, newsk); restore_flags(flags); } /* - * Remove an sk_buff from a list. This routine is also interrupt safe - * so you can grab read and free buffers as another process adds them. - * - * Note we now do the ful list + * Remove an sk_buff from a list. */ -extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list_) +extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) +{ + struct sk_buff *next, *prev, *result; + + prev = (struct sk_buff *) list; + next = prev->next; + result = NULL; + if (next != prev) { + result = next; + next = next->next; + list->qlen--; + next->prev = prev; + prev->next = next; + result->next = NULL; + result->prev = NULL; + result->list = NULL; + } + return result; +} + +extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) { long flags; struct sk_buff *result; - struct sk_buff *list = (struct sk_buff *)list_; save_flags(flags); cli(); + result = __skb_dequeue(list); + restore_flags(flags); + return result; +} - result = list->next; - if (result == list) - { - restore_flags(flags); - return NULL; - } - else - { - result->next->prev = list; - list->next = result->next; - - result->next = NULL; - result->prev = NULL; - - restore_flags(flags); +/* + * Insert a packet on a list. + */ - return result; - } +extern __inline__ void __skb_insert(struct sk_buff *newsk, + struct sk_buff * prev, struct sk_buff *next, + struct sk_buff_head * list) +{ + newsk->next = next; + newsk->prev = prev; + next->prev = newsk; + prev->next = newsk; + newsk->list = list; + list->qlen++; } /* - * Insert a packet before another one in a list. + * Place a packet before a given packet in a list */ - extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; save_flags(flags); cli(); - newsk->next = old; - newsk->prev = old->prev; - old->prev = newsk; - newsk->prev->next = newsk; - + __skb_insert(newsk, old->prev, old, old->list); restore_flags(flags); } @@ -250,16 +368,29 @@ extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) save_flags(flags); cli(); - - newsk->prev = old; - newsk->next = old->next; - newsk->next->prev = newsk; - old->next = newsk; - + __skb_insert(newsk, old, old->next, old->list); restore_flags(flags); } /* + * remove sk_buff from list. _Must_ be called atomically, and with + * the list known.. + */ +extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) +{ + struct sk_buff * next, * prev; + + list->qlen--; + next = skb->next; + prev = skb->prev; + skb->next = NULL; + skb->prev = NULL; + skb->list = NULL; + next->prev = prev; + prev->next = next; +} + +/* * Remove an sk_buff from its list. Works even without knowing the list it * is sitting on, which can be handy at times. It also means that THE LIST * MUST EXIST when you unlink. Thus a list must have its contents unlinked @@ -272,23 +403,84 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) save_flags(flags); cli(); + if(skb->list) + __skb_unlink(skb, skb->list); + restore_flags(flags); +} + +/* + * Add data to an sk_buff + */ + +extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) +{ + extern char *skb_put_errstr; + unsigned char *tmp=skb->tail; + skb->tail+=len; + skb->len+=len; + if(skb->tail>skb->end) + { + __label__ here; + panic(skb_put_errstr,&&here,len); +here: + } + return tmp; +} - if(skb->prev && skb->next) +extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) +{ + extern char *skb_push_errstr; + skb->data-=len; + skb->len+=len; + if(skb->data<skb->head) { - skb->next->prev = skb->prev; - skb->prev->next = skb->next; - skb->next = NULL; - skb->prev = NULL; + __label__ here; + panic(skb_push_errstr, &&here,len); +here: + } + return skb->data; +} + +extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) +{ + if (len > skb->len) + return NULL; + skb->data+=len; + skb->len-=len; + return skb->data; +} + +extern __inline__ int skb_headroom(struct sk_buff *skb) +{ + return skb->data-skb->head; +} + +extern __inline__ int skb_tailroom(struct sk_buff *skb) +{ + return skb->end-skb->tail; +} + +extern __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) +{ + skb->data+=len; + skb->tail+=len; +} + +extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) +{ + if (skb->len > len) { + skb->len = len; + skb->tail = skb->data+len; } - restore_flags(flags); } #endif extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err); extern int datagram_select(struct sock *sk, int sel_type, select_table *wait); -extern void skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size); -extern void skb_free_datagram(struct sk_buff *skb); +extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size); +extern int skb_copy_datagram_iovec(struct sk_buff *from, int offset, struct iovec *to,int size); +extern void skb_free_datagram(struct sock * sk, struct sk_buff *skb); #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */ diff --git a/include/linux/smb.h b/include/linux/smb.h new file mode 100644 index 000000000..1bba4859e --- /dev/null +++ b/include/linux/smb.h @@ -0,0 +1,142 @@ +/* + * smb.h + * + * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_H +#define _LINUX_SMB_H + +#define SMB_PORT 139 +#define SMB_MAXNAMELEN 255 +#define SMB_MAXPATHLEN 1024 + +#define SMB_DEF_MAX_XMIT 32768 + +/* Allocate max. 1 page */ +#define TRANS2_MAX_TRANSFER (4096-17) + +#include <asm/types.h> +#ifdef __KERNEL__ +typedef u8 byte; +typedef u16 word; +typedef u32 dword; +#else +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long dword; +#endif + +/* The following macros have been taken directly from Samba. Thanks, + Andrew! */ + +#undef CAREFUL_ALIGNMENT + +/* we know that the 386 can handle misalignment and has the "right" + byteorder */ +#if defined(__i386__) +#define CAREFUL_ALIGNMENT 0 +#endif + +#ifndef CAREFUL_ALIGNMENT +#define CAREFUL_ALIGNMENT 1 +#endif + +#define BVAL(buf,pos) (((u8 *)(buf))[pos]) +#define PVAL(buf,pos) ((unsigned)BVAL(buf,pos)) +#define BSET(buf,pos,val) (BVAL(buf,pos) = (val)) + + +#if CAREFUL_ALIGNMENT +#define WVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) +#define DVAL(buf,pos) (WVAL(buf,pos)|WVAL(buf,(pos)+2)<<16) + +#define SSVALX(buf,pos,val) (BVAL(buf,pos)=(val)&0xFF,BVAL(buf,pos+1)=(val)>>8) +#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) +#define WSET(buf,pos,val) { word __val = (val); \ + SSVALX((buf),(pos),((word)(__val))); } +#define DSET(buf,pos,val) { dword __val = (val); \ + SIVALX((buf),(pos),((dword)(__val))); } +#else +/* this handles things for architectures like the 386 that can handle + alignment errors */ +/* + WARNING: This section is dependent on the length of word and dword + being correct +*/ +#define WVAL(buf,pos) (*(word *)((char *)(buf) + (pos))) +#define DVAL(buf,pos) (*(dword *)((char *)(buf) + (pos))) +#define WSET(buf,pos,val) WVAL(buf,pos)=((word)(val)) +#define DSET(buf,pos,val) DVAL(buf,pos)=((dword)(val)) +#endif + + +/* where to find the base of the SMB packet proper */ +#define smb_base(buf) ((byte *)(((byte *)(buf))+4)) + +#define LANMAN1 +#define LANMAN2 +#define NT1 + +enum smb_protocol { + PROTOCOL_NONE, + PROTOCOL_CORE, + PROTOCOL_COREPLUS, + PROTOCOL_LANMAN1, + PROTOCOL_LANMAN2, + PROTOCOL_NT1 +}; + +enum smb_case_hndl { + CASE_DEFAULT, + CASE_LOWER, + CASE_UPPER +}; + +#ifdef __KERNEL__ + +enum smb_conn_state { + CONN_VALID, /* everything's fine */ + CONN_INVALID, /* Something went wrong, but did not + try to reconnect yet. */ + CONN_RETRIED /* Tried a reconnection, but was refused */ +}; + +struct smb_dskattr { + word total; + word allocblocks; + word blocksize; + word free; +}; + +/* + * Contains all relevant data on a SMB networked file. + */ +struct smb_dirent { + + unsigned long f_ino; + umode_t f_mode; + nlink_t f_nlink; + uid_t f_uid; + gid_t f_gid; + kdev_t f_rdev; + off_t f_size; + time_t f_atime; + time_t f_mtime; + time_t f_ctime; + unsigned long f_blksize; + unsigned long f_blocks; + + int opened; /* is it open on the fileserver? */ + word fileid; /* What id to handle a file with? */ + word attr; /* Attribute fields, DOS value */ + + unsigned short access; /* Access bits. */ + unsigned long f_pos; /* File position. (For readdir.) */ + unsigned char name[SMB_MAXNAMELEN+1]; + int len; /* namelength */ +}; + +#endif /* __KERNEL__ */ +#endif /* _LINUX_SMB_H */ diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h new file mode 100644 index 000000000..c129cb540 --- /dev/null +++ b/include/linux/smb_fs.h @@ -0,0 +1,219 @@ +/* + * smb_fs.h + * + * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_FS_H +#define _LINUX_SMB_FS_H + +#include <linux/smb.h> +#include <linux/fs.h> +#include <linux/in.h> +#include <linux/types.h> +#include <linux/vmalloc.h> + +#include <linux/smb_mount.h> +#include <linux/smb_fs_sb.h> +#include <linux/smb_fs_i.h> + +/* + * ioctl commands + */ +#define SMB_IOC_GETMOUNTUID _IOR('u', 1, uid_t) + +#ifdef __KERNEL__ + +/* + * The readdir cache size controls how many directory entries are cached. + */ +#define SMB_READDIR_CACHE_SIZE 64 + +/* + * This defines the number of filenames cached in memory to avoid + * constructing filenames from \ + */ +#define SMB_CACHE_TABLE_SIZE 64 + +#define SMB_SUPER_MAGIC 0x517B + + + +#define SMB_SBP(sb) ((struct smb_sb_info *)(sb->u.generic_sbp)) +#define SMB_INOP(inode) ((struct smb_inode_info *)(inode->u.generic_ip)) + +#define SMB_SERVER(inode) (&(SMB_SBP(inode->i_sb)->s_server)) +#define SMB_SERVATTR(inode) (&(SMB_SBP(inode->i_sb)->s_attr)) + +#define SMB_FINFO(inode) (&(SMB_INOP(inode)->finfo)) + +#define SMB_HEADER_LEN 37 /* includes everything up to, but not + * including smb_bcc */ + +#ifdef DEBUG_SMB_MALLOC + +#include <linux/malloc.h> + +extern int smb_malloced; +extern int smb_current_kmalloced; +extern int smb_current_vmalloced; + +static inline void * +smb_kmalloc(unsigned int size, int priority) +{ + smb_malloced += 1; + smb_current_kmalloced += 1; + return kmalloc(size, priority); +} + +static inline void +smb_kfree_s(void *obj, int size) +{ + smb_current_kmalloced -= 1; + kfree_s(obj, size); +} + +static inline void * +smb_vmalloc(unsigned int size) +{ + smb_malloced += 1; + smb_current_vmalloced += 1; + return vmalloc(size); +} + +static inline void +smb_vfree(void *obj) +{ + smb_current_vmalloced -= 1; + vfree(obj); +} + +#else /* DEBUG_SMB_MALLOC */ + +#define smb_kmalloc(s,p) kmalloc(s,p) +#define smb_kfree_s(o,s) kfree_s(o,s) +#define smb_vmalloc(s) vmalloc(s) +#define smb_vfree(o) vfree(o) + +#endif /* DEBUG_SMB_MALLOC */ + +#if DEBUG_SMB > 0 +#define DPRINTK(format, args...) printk(format , ## args) +#else +#define DPRINTK(format, args...) +#endif + +#if DEBUG_SMB > 1 +#define DDPRINTK(format, args...) printk(format , ## args) +#else +#define DDPRINTK(format, args...) +#endif + + +static inline ino_t +smb_info_ino(struct smb_inode_info *info) +{ +#if 0 + return (ino_t) info; +#else + if (info != NULL) + { + return info->finfo.f_ino; + } + return 1; +#endif +} + +/* linux/fs/smbfs/file.c */ +extern struct inode_operations smb_file_inode_operations; +int smb_make_open(struct inode *i, int right); + +/* linux/fs/smbfs/dir.c */ +extern struct inode_operations smb_dir_inode_operations; +struct smb_inode_info *smb_find_inode(struct smb_server *server, ino_t ino); +void smb_free_inode_info(struct smb_inode_info *i); +void smb_free_all_inodes(struct smb_server *server); +void smb_init_root(struct smb_server *server); +int smb_stat_root(struct smb_server *server); +void smb_init_dir_cache(void); +void smb_invalid_dir_cache(unsigned long ino); +void smb_invalidate_all_inodes(struct smb_server *server); +void smb_free_dir_cache(void); + +/* linux/fs/smbfs/ioctl.c */ +int smb_ioctl (struct inode * inode, struct file * filp, + unsigned int cmd, unsigned long arg); + +/* linux/fs/smbfs/inode.c */ +struct super_block *smb_read_super(struct super_block *sb, + void *raw_data, int silent); +extern int init_smb_fs(void); +int smb_notify_change(struct inode *inode, struct iattr *attr); +void smb_invalidate_connection(struct smb_server *server); +int smb_conn_is_valid(struct smb_server *server); + +/* linux/fs/smbfs/proc.c */ +dword smb_len(unsigned char *packet); +byte *smb_encode_smb_length(byte *p, dword len); +__u8 *smb_setup_header(struct smb_server *server, byte command, + word wct, word bcc); +void smb_init_root_dirent(struct smb_server *server, struct smb_dirent *entry); +int smb_proc_open(struct smb_server *server, + struct smb_inode_info *dir, const char *name, int len, + struct smb_dirent *entry); +int smb_proc_close(struct smb_server *server, + __u16 fileid, __u32 mtime); +int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo, + off_t offset, long count, char *data, int fs); +int smb_proc_read_raw(struct smb_server *server, struct smb_dirent *finfo, + off_t offset, long count, char *data); +int smb_proc_write(struct smb_server *server, struct smb_dirent *finfo, + off_t offset, int count, const char *data); +int smb_proc_write_raw(struct smb_server *server, struct smb_dirent *finfo, + off_t offset, long count, const char *data); +int smb_proc_create(struct inode *dir, const char *name, int len, + word attr, time_t ctime); +int smb_proc_mv(struct inode *odir, const char *oname, const int olen, + struct inode *ndir, const char *nname, const int nlen); +int smb_proc_mkdir(struct inode *dir, const char *name, const int len); +int smb_proc_rmdir(struct inode *dir, const char *name, const int len); +int smb_proc_unlink(struct inode *dir, const char *name, const int len); +int smb_proc_readdir(struct smb_server *server, struct inode *dir, + int fpos, int cache_size, + struct smb_dirent *entry); +int smb_proc_getattr(struct inode *dir, const char *name, int len, + struct smb_dirent *entry); +int smb_proc_setattr(struct smb_server *server, + struct inode *ino, + struct smb_dirent *new_finfo); +int smb_proc_chkpath(struct smb_server *server, char *path, int len, + int *result); +int smb_proc_dskattr(struct super_block *super, struct smb_dskattr *attr); +int smb_proc_reconnect(struct smb_server *server); +int smb_proc_connect(struct smb_server *server); +int smb_proc_disconnect(struct smb_server *server); +int smb_proc_trunc(struct smb_server *server, word fid, dword length); + +/* linux/fs/smbfs/sock.c */ +int smb_release(struct smb_server *server); +int smb_connect(struct smb_server *server); +int smb_request(struct smb_server *server); +int smb_request_read_raw(struct smb_server *server, + unsigned char *target, int max_len); +int smb_request_write_raw(struct smb_server *server, + unsigned const char *source, int length); +int smb_catch_keepalive(struct smb_server *server); +int smb_dont_catch_keepalive(struct smb_server *server); +int smb_trans2_request(struct smb_server *server, __u16 trans2_command, + int ldata, unsigned char *data, + int lparam, unsigned char *param, + int *lrdata, unsigned char **rdata, + int *lrparam, unsigned char **rparam); + +/* linux/fs/smbfs/mmap.c */ +int smb_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma); + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_SMB_FS_H */ diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h new file mode 100644 index 000000000..b6e38fd18 --- /dev/null +++ b/include/linux/smb_fs_i.h @@ -0,0 +1,34 @@ +/* + * smb_fs_i.h + * + * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_FS_I +#define _LINUX_SMB_FS_I + +#ifdef __KERNEL__ +#include <linux/smb.h> + +enum smb_inode_state { + SMB_INODE_VALID = 19, /* Inode currently in use */ + SMB_INODE_LOOKED_UP, /* directly before iget */ + SMB_INODE_CACHED, /* in a path to an inode which is in use */ + SMB_INODE_INVALID +}; + +/* + * smb fs inode data (in memory only) + */ +struct smb_inode_info { + enum smb_inode_state state; + int nused; /* for directories: + number of references in memory */ + struct smb_inode_info *dir; + struct smb_inode_info *next, *prev; + struct smb_dirent finfo; +}; + +#endif +#endif diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h new file mode 100644 index 000000000..863062022 --- /dev/null +++ b/include/linux/smb_fs_sb.h @@ -0,0 +1,79 @@ +/* + * smb_fs_sb.h + * + * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke + * + */ + +#ifndef _SMB_FS_SB +#define _SMB_FS_SB + +#include <linux/smb.h> +#include <linux/smb_fs_i.h> +#include <linux/smb_mount.h> +#include <linux/types.h> + +#ifdef __KERNEL__ + +struct smb_server { + enum smb_protocol protocol; /* The protocol this + connection accepts. */ + enum smb_case_hndl case_handling; + struct file * sock_file; /* The socket we transfer + data on. */ + int lock; /* To prevent mismatch in + protocols. */ + struct wait_queue *wait; + + __u32 max_xmit; + char hostname[256]; + word pid; + word server_uid; + word mid; + word tid; + + struct smb_mount_data m; /* We store the complete information here + * to be able to reconnect. + */ + + unsigned short rcls; /* The error codes we received */ + unsigned short err; + + __u32 packet_size; + unsigned char * packet; + + enum smb_conn_state state; + unsigned long reconnect_time; /* The time of the last attempt */ + + /* The following are LANMAN 1.0 options transferred to us in + SMBnegprot */ + word secmode; + word maxmux; + word maxvcs; + word blkmode; + dword sesskey; + + /* We use our on data_ready callback, but need the original one */ + void *data_ready; + + /* We do not have unique numbers for files in the smb protocol + like NFS-filehandles. (SMB was designed for DOS, not for + UNIX!) So we have to create our own inode numbers. We keep + a complete path of smb_inode_info's to each active + inode. The inode number is then created by the address of + this structure. */ + struct smb_inode_info root; +}; + +/* + * This is the part of the super-block (in memory) for the SMB file system. + */ + +struct smb_sb_info { + struct smb_server s_server; + struct smb_dskattr s_attr; +}; + +#endif /* __KERNEL__ */ + +#endif diff --git a/include/linux/smb_mount.h b/include/linux/smb_mount.h new file mode 100644 index 000000000..7f1748731 --- /dev/null +++ b/include/linux/smb_mount.h @@ -0,0 +1,39 @@ +/* + * smb_mount.h + * + * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke + * + */ + +#ifndef _LINUX_SMB_MOUNT_H +#define _LINUX_SMB_MOUNT_H + +#include <linux/types.h> +#include <linux/in.h> + +#define SMB_MOUNT_VERSION 5 + +struct smb_mount_data { + int version; + unsigned int fd; + uid_t mounted_uid; /* Who may umount() this filesystem? */ + struct sockaddr_in addr; + + char server_name[17]; + char client_name[17]; + char service[64]; + char root_path[64]; + + char username[64]; + char password[64]; + char domain[64]; + + unsigned short max_xmit; + + uid_t uid; + gid_t gid; + mode_t file_mode; + mode_t dir_mode; +}; + +#endif diff --git a/include/linux/smbno.h b/include/linux/smbno.h new file mode 100644 index 000000000..176e88c86 --- /dev/null +++ b/include/linux/smbno.h @@ -0,0 +1,269 @@ +#ifndef _SMBNO_H_ +#define _SMBNO_H_ + +/* these define the attribute byte as seen by DOS */ +#define aRONLY (1L<<0) +#define aHIDDEN (1L<<1) +#define aSYSTEM (1L<<2) +#define aVOLID (1L<<3) +#define aDIR (1L<<4) +#define aARCH (1L<<5) + +/* error classes */ +#define SUCCESS 0 /* The request was successful. */ +#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ +#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ +#define ERRHRD 0x03 /* Error is an hardware error. */ +#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ + +/* SMB X/Open error codes for the ERRdos error class */ + +#define ERRbadfunc 1 /* Invalid function (or system call) */ +#define ERRbadfile 2 /* File not found (pathname error) */ +#define ERRbadpath 3 /* Directory not found */ +#define ERRnofids 4 /* Too many open files */ +#define ERRnoaccess 5 /* Access denied */ +#define ERRbadfid 6 /* Invalid fid */ +#define ERRbadmcb 7 /* Memory control blocks destroyed */ +#define ERRnomem 8 /* Out of memory */ +#define ERRbadmem 9 /* Invalid memory block address */ +#define ERRbadenv 10 /* Invalid environment */ +#define ERRbadformat 11 /* Invalid format */ +#define ERRbadaccess 12 /* Invalid open mode */ +#define ERRbaddata 13 /* Invalid data (only from ioctl call) */ +#define ERRres 14 /* reserved */ +#define ERRbaddrive 15 /* Invalid drive */ +#define ERRremcd 16 /* Attempt to delete current directory */ +#define ERRdiffdevice 17 /* rename/move across different filesystems */ +#define ERRnofiles 18 /* no more files found in file search */ +#define ERRbadshare 32 /* Share mode on file conflict with open mode */ +#define ERRlock 33 /* Lock request conflicts with existing lock */ +#define ERRfilexists 80 /* File in operation already exists */ +#define ERRbadpipe 230 /* Named pipe invalid */ +#define ERRpipebusy 231 /* All instances of pipe are busy */ +#define ERRpipeclosing 232 /* named pipe close in progress */ +#define ERRnotconnected 233 /* No process on other end of named pipe */ +#define ERRmoredata 234 /* More data to be returned */ +#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ +#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ + +/* Error codes for the ERRSRV class */ + +#define ERRerror 1 /* Non specific error code */ +#define ERRbadpw 2 /* Bad password */ +#define ERRbadtype 3 /* reserved */ +#define ERRaccess 4 /* No permissions to do the requested operation */ +#define ERRinvnid 5 /* tid invalid */ +#define ERRinvnetname 6 /* Invalid servername */ +#define ERRinvdevice 7 /* Invalid device */ +#define ERRqfull 49 /* Print queue full */ +#define ERRqtoobig 50 /* Queued item too big */ +#define ERRinvpfid 52 /* Invalid print file in smb_fid */ +#define ERRsmbcmd 64 /* Unrecognised command */ +#define ERRsrverror 65 /* smb server internal error */ +#define ERRfilespecs 67 /* fid and pathname invalid combination */ +#define ERRbadlink 68 /* reserved */ +#define ERRbadpermits 69 /* Access specified for a file is not valid */ +#define ERRbadpid 70 /* reserved */ +#define ERRsetattrmode 71 /* attribute mode invalid */ +#define ERRpaused 81 /* Message server paused */ +#define ERRmsgoff 82 /* Not receiving messages */ +#define ERRnoroom 83 /* No room for message */ +#define ERRrmuns 87 /* too many remote usernames */ +#define ERRtimeout 88 /* operation timed out */ +#define ERRnoresource 89 /* No resources currently available for request. */ +#define ERRtoomanyuids 90 /* too many userids */ +#define ERRbaduid 91 /* bad userid */ +#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ +#define ERRuseSTD 251 /* temporarily unable to use raw mode, use std.mode */ +#define ERRcontMPX 252 /* resume MPX mode */ +#define ERRbadPW /* reserved */ +#define ERRnosupport 0xFFFF + +/* Error codes for the ERRHRD class */ + +#define ERRnowrite 19 /* read only media */ +#define ERRbadunit 20 /* Unknown device */ +#define ERRnotready 21 /* Drive not ready */ +#define ERRbadcmd 22 /* Unknown command */ +#define ERRdata 23 /* Data (CRC) error */ +#define ERRbadreq 24 /* Bad request structure length */ +#define ERRseek 25 +#define ERRbadmedia 26 +#define ERRbadsector 27 +#define ERRnopaper 28 +#define ERRwrite 29 /* write fault */ +#define ERRread 30 /* read fault */ +#define ERRgeneral 31 /* General hardware failure */ +#define ERRwrongdisk 34 +#define ERRFCBunavail 35 +#define ERRsharebufexc 36 /* share buffer exceeded */ +#define ERRdiskfull 39 + +/* offsets into message for common items */ +#define smb_com 8 +#define smb_rcls 9 +#define smb_reh 10 +#define smb_err 11 +#define smb_flg 13 +#define smb_flg2 14 +#define smb_reb 13 +#define smb_tid 28 +#define smb_pid 30 +#define smb_uid 32 +#define smb_mid 34 +#define smb_wct 36 +#define smb_vwv 37 +#define smb_vwv0 37 +#define smb_vwv1 39 +#define smb_vwv2 41 +#define smb_vwv3 43 +#define smb_vwv4 45 +#define smb_vwv5 47 +#define smb_vwv6 49 +#define smb_vwv7 51 +#define smb_vwv8 53 +#define smb_vwv9 55 +#define smb_vwv10 57 +#define smb_vwv11 59 +#define smb_vwv12 61 +#define smb_vwv13 63 +#define smb_vwv14 65 + +/* these are the trans2 sub fields for primary requests */ +#define smb_tpscnt smb_vwv0 +#define smb_tdscnt smb_vwv1 +#define smb_mprcnt smb_vwv2 +#define smb_mdrcnt smb_vwv3 +#define smb_msrcnt smb_vwv4 +#define smb_flags smb_vwv5 +#define smb_timeout smb_vwv6 +#define smb_pscnt smb_vwv9 +#define smb_psoff smb_vwv10 +#define smb_dscnt smb_vwv11 +#define smb_dsoff smb_vwv12 +#define smb_suwcnt smb_vwv13 +#define smb_setup smb_vwv14 +#define smb_setup0 smb_setup +#define smb_setup1 (smb_setup+2) +#define smb_setup2 (smb_setup+4) + +/* these are for the secondary requests */ +#define smb_spscnt smb_vwv2 +#define smb_spsoff smb_vwv3 +#define smb_spsdisp smb_vwv4 +#define smb_sdscnt smb_vwv5 +#define smb_sdsoff smb_vwv6 +#define smb_sdsdisp smb_vwv7 +#define smb_sfid smb_vwv8 + +/* and these for responses */ +#define smb_tprcnt smb_vwv0 +#define smb_tdrcnt smb_vwv1 +#define smb_prcnt smb_vwv3 +#define smb_proff smb_vwv4 +#define smb_prdisp smb_vwv5 +#define smb_drcnt smb_vwv6 +#define smb_droff smb_vwv7 +#define smb_drdisp smb_vwv8 + +/* the complete */ +#define SMBmkdir 0x00 /* create directory */ +#define SMBrmdir 0x01 /* delete directory */ +#define SMBopen 0x02 /* open file */ +#define SMBcreate 0x03 /* create file */ +#define SMBclose 0x04 /* close file */ +#define SMBflush 0x05 /* flush file */ +#define SMBunlink 0x06 /* delete file */ +#define SMBmv 0x07 /* rename file */ +#define SMBgetatr 0x08 /* get file attributes */ +#define SMBsetatr 0x09 /* set file attributes */ +#define SMBread 0x0A /* read from file */ +#define SMBwrite 0x0B /* write to file */ +#define SMBlock 0x0C /* lock byte range */ +#define SMBunlock 0x0D /* unlock byte range */ +#define SMBctemp 0x0E /* create temporary file */ +#define SMBmknew 0x0F /* make new file */ +#define SMBchkpth 0x10 /* check directory path */ +#define SMBexit 0x11 /* process exit */ +#define SMBlseek 0x12 /* seek */ +#define SMBtcon 0x70 /* tree connect */ +#define SMBtconX 0x75 /* tree connect and X*/ +#define SMBtdis 0x71 /* tree disconnect */ +#define SMBnegprot 0x72 /* negotiate protocol */ +#define SMBdskattr 0x80 /* get disk attributes */ +#define SMBsearch 0x81 /* search directory */ +#define SMBsplopen 0xC0 /* open print spool file */ +#define SMBsplwr 0xC1 /* write to print spool file */ +#define SMBsplclose 0xC2 /* close print spool file */ +#define SMBsplretq 0xC3 /* return print queue */ +#define SMBsends 0xD0 /* send single block message */ +#define SMBsendb 0xD1 /* send broadcast message */ +#define SMBfwdname 0xD2 /* forward user name */ +#define SMBcancelf 0xD3 /* cancel forward */ +#define SMBgetmac 0xD4 /* get machine name */ +#define SMBsendstrt 0xD5 /* send start of multi-block message */ +#define SMBsendend 0xD6 /* send end of multi-block message */ +#define SMBsendtxt 0xD7 /* send text of multi-block message */ + +/* Core+ protocol */ +#define SMBlockread 0x13 /* Lock a range and read */ +#define SMBwriteunlock 0x14 /* Unlock a range then write */ +#define SMBreadbraw 0x1a /* read a block of data with no smb header */ +#define SMBwritebraw 0x1d /* write a block of data with no smb header */ +#define SMBwritec 0x20 /* secondary write request */ +#define SMBwriteclose 0x2c /* write a file then close it */ + +/* dos extended protocol */ +#define SMBreadBraw 0x1A /* read block raw */ +#define SMBreadBmpx 0x1B /* read block multiplexed */ +#define SMBreadBs 0x1C /* read block (secondary response) */ +#define SMBwriteBraw 0x1D /* write block raw */ +#define SMBwriteBmpx 0x1E /* write block multiplexed */ +#define SMBwriteBs 0x1F /* write block (secondary request) */ +#define SMBwriteC 0x20 /* write complete response */ +#define SMBsetattrE 0x22 /* set file attributes expanded */ +#define SMBgetattrE 0x23 /* get file attributes expanded */ +#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ +#define SMBtrans 0x25 /* transaction - name, bytes in/out */ +#define SMBtranss 0x26 /* transaction (secondary request/response) */ +#define SMBioctl 0x27 /* IOCTL */ +#define SMBioctls 0x28 /* IOCTL (secondary request/response) */ +#define SMBcopy 0x29 /* copy */ +#define SMBmove 0x2A /* move */ +#define SMBecho 0x2B /* echo */ +#define SMBopenX 0x2D /* open and X */ +#define SMBreadX 0x2E /* read and X */ +#define SMBwriteX 0x2F /* write and X */ +#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ +#define SMBtconX 0x75 /* tree connect and X */ +#define SMBffirst 0x82 /* find first */ +#define SMBfunique 0x83 /* find unique */ +#define SMBfclose 0x84 /* find close */ +#define SMBinvalid 0xFE /* invalid command */ + + +/* Extended 2.0 protocol */ +#define SMBtrans2 0x32 /* TRANS2 protocol set */ +#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */ +#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */ +#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ +#define SMBulogoffX 0x74 /* user logoff */ + +/* these are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0 +#define TRANSACT2_FINDFIRST 1 +#define TRANSACT2_FINDNEXT 2 +#define TRANSACT2_QFSINFO 3 +#define TRANSACT2_SETFSINFO 4 +#define TRANSACT2_QPATHINFO 5 +#define TRANSACT2_SETPATHINFO 6 +#define TRANSACT2_QFILEINFO 7 +#define TRANSACT2_SETFILEINFO 8 +#define TRANSACT2_FSCTL 9 +#define TRANSACT2_IOCTL 10 +#define TRANSACT2_FINDNOTIFYFIRST 11 +#define TRANSACT2_FINDNOTIFYNEXT 12 +#define TRANSACT2_MKDIR 13 + +#endif /* _SMBNO_H_ */ diff --git a/include/linux/smp.h b/include/linux/smp.h new file mode 100644 index 000000000..72984f154 --- /dev/null +++ b/include/linux/smp.h @@ -0,0 +1,54 @@ +#ifndef __LINUX_SMP_H +#define __LINUX_SMP_H + +/* + * Generic SMP support + * Alan Cox. <alan@cymru.net> + */ + +#ifdef __SMP__ +#include <asm/smp.h> + +extern void smp_message_pass(int target, int msg, unsigned long data, int wait); +extern void smp_boot_cpus(void); /* Boot processor call to load the other CPU's */ +extern void smp_callin(void); /* Processor call in. Must hold processors until .. */ +extern void smp_commence(void); /* Multiprocessors may now schedule */ +extern int smp_num_cpus; +extern int smp_threads_ready; /* True once the per process idle is forked */ +#ifdef __SMP_PROF__ +extern volatile unsigned long smp_spins[NR_CPUS]; /* count of interrupt spins */ +extern volatile unsigned long smp_spins_sys_idle[]; /* count of idle spins */ +extern volatile unsigned long smp_spins_syscall[]; /* count of syscall spins */ +extern volatile unsigned long smp_spins_syscall_cur[]; /* count of syscall spins for the current + call */ +extern volatile unsigned long smp_idle_count[1+NR_CPUS];/* count idle ticks */ +extern volatile unsigned long smp_idle_map; /* map with idle cpus */ +#else +extern volatile unsigned long smp_spins; +#endif + + +extern volatile unsigned long smp_msg_data; +extern volatile int smp_src_cpu; +extern volatile int smp_msg_id; + +#define MSG_ALL_BUT_SELF 0x8000 /* Assume <32768 CPU's */ +#define MSG_ALL 0x8001 + +#define MSG_INVALIDATE_TLB 0x0001 /* Remote processor TLB invalidate */ +#define MSG_STOP_CPU 0x0002 /* Sent to shut down slave CPU's when rebooting */ +#define MSG_RESCHEDULE 0x0003 /* Reschedule request from master CPU */ + +#else + +/* + * These macros fold the SMP functionality into a single CPU system + */ + +#define smp_num_cpus 1 +#define smp_processor_id() 0 +#define smp_message_pass(t,m,d,w) +#define smp_threads_ready 1 +#define kernel_lock() +#endif +#endif diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h new file mode 100644 index 000000000..14c9f5b47 --- /dev/null +++ b/include/linux/smp_lock.h @@ -0,0 +1,9 @@ +#ifndef __LINUX_SMPLOCK_H +#define __LINUX_SMPLOCK_H + +#ifdef __SMP__ +#include <asm/pgtable.h> +#include <asm/smp_lock.h> +#endif + +#endif diff --git a/include/linux/socket.h b/include/linux/socket.h index 44cff1fc4..21d7169bb 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -1,47 +1,109 @@ #ifndef _LINUX_SOCKET_H #define _LINUX_SOCKET_H +#include <asm/socket.h> /* arch-dependent defines */ #include <linux/sockios.h> /* the SIOCxxx I/O controls */ +#include <linux/uio.h> /* iovec support */ +typedef unsigned short sa_family_t; -struct sockaddr { - unsigned short sa_family; /* address family, AF_xxx */ - char sa_data[14]; /* 14 bytes of protocol address */ +/* + * 1003.1g requires sa_family_t and that sa_data is char. + */ + +struct sockaddr +{ + sa_family_t sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ }; struct linger { - int l_onoff; /* Linger active */ - int l_linger; /* How long to linger for */ + int l_onoff; /* Linger active */ + int l_linger; /* How long to linger for */ }; -/* Socket types. */ -#define SOCK_STREAM 1 /* stream (connection) socket */ -#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ -#define SOCK_RAW 3 /* raw socket */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequential packet socket */ -#define SOCK_PACKET 10 /* linux specific way of */ - /* getting packets at the dev */ - /* level. For writing rarp and */ - /* other similar things on the */ - /* user level. */ +/* + * As we do 4.4BSD message passing we use a 4.4BSD message passing + * system, not 4.3. Thus msg_accrights(len) are now missing. They + * belong in an obscure libc emulation or the bin. + */ + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + size_t msg_iovlen; /* Number of blocks */ + void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ + size_t msg_controllen; /* Length of rights list */ + int msg_flags; /* 4.4 BSD item we dont use */ +}; + +/* + * POSIX 1003.1g - ancillary data object information + * Ancillary data consits of a sequence of pairs of + * (cmsghdr, cmsg_data[]) + */ + +struct cmsghdr { + size_t cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + unsigned char cmsg_data[0]; +}; + +/* + * Ancilliary data object information MACROS + * Table 5-14 of POSIX 1003.1g + */ + +#define CMSG_DATA(cmsg) cmsg->cmsg_data +#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr(mhdr, cmsg) +#define CMSG_FIRST(mhdr) ((struct cmsghdr *) (mhdr)->msg_control) + +extern __inline__ struct cmsghdr * cmsg_nxthdr(struct msghdr *mhdr, + struct cmsghdr *cmsg) +{ + unsigned char * ptr; + + if (cmsg->cmsg_len < sizeof(struct cmsghdr)) + { + return NULL; + } + ptr = ((unsigned char *) cmsg) + cmsg->cmsg_len; + if (ptr >= (unsigned char *) mhdr->msg_control + mhdr->msg_controllen) + return NULL; + + return (struct cmsghdr *) ptr; +} + +/* Control Messages */ + +#define SCM_RIGHTS 1 + /* Supported address families. */ #define AF_UNSPEC 0 #define AF_UNIX 1 /* Unix domain sockets */ +#define AF_LOCAL 1 /* POSIX name for AF_UNIX */ #define AF_INET 2 /* Internet IP Protocol */ #define AF_AX25 3 /* Amateur Radio AX.25 */ #define AF_IPX 4 /* Novell IPX */ #define AF_APPLETALK 5 /* Appletalk DDP */ -#define AF_NETROM 6 /* Amateur radio NetROM */ +#define AF_NETROM 6 /* Amateur Radio NET/ROM */ #define AF_BRIDGE 7 /* Multiprotocol bridge */ #define AF_AAL5 8 /* Reserved for Werner's ATM */ #define AF_X25 9 /* Reserved for X.25 project */ -#define AF_MAX 12 /* For now.. */ +#define AF_INET6 10 /* IP version 6 */ +#define AF_ROSE 11 /* Amateur Radio X.25 PLP */ +#define AF_DECNET 12 /* Reserved for DECnet project */ +#define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ +#define AF_MAX 32 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC #define PF_UNIX AF_UNIX +#define PF_LOCAL AF_LOCAL #define PF_INET AF_INET #define PF_AX25 AF_AX25 #define PF_IPX AF_IPX @@ -50,50 +112,56 @@ struct linger { #define PF_BRIDGE AF_BRIDGE #define PF_AAL5 AF_AAL5 #define PF_X25 AF_X25 +#define PF_INET6 AF_INET6 +#define PR_ROSE AF_ROSE +#define PF_DECNET AF_DECNET +#define PF_NETBEUI AF_NETBEUI #define PF_MAX AF_MAX -/* Flags we can use with send/ and recv. */ -#define MSG_OOB 1 -#define MSG_PEEK 2 -#define MSG_DONTROUTE 4 +/* Maximum queue length specifiable by listen. */ +#define SOMAXCONN 128 + +/* Flags we can use with send/ and recv. + Added those for 1003.1g not all are supported yet + */ + +enum +{ + MSG_OOB = 0x01, /* Process out-of-band data. */ + MSG_PEEK = 0x02, /* Peek at incoming messages. */ + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ + MSG_CTRUNC = 0x08, /* We need to support this for BSD oddments */ + MSG_PROXY = 0x10, /* Supply or ask second address. */ + MSG_EOR = 0x20, /* End of record */ + MSG_TRUNC = 0x40, /* Data was discarded before delivery */ + MSG_WAITALL = 0x80, /* Wait for a full request */ +}; /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ -#define SOL_SOCKET 1 #define SOL_IP 0 +#define SOL_IPV6 41 +#define SOL_ICMPV6 58 +#define SOL_RAW 255 #define SOL_IPX 256 #define SOL_AX25 257 #define SOL_ATALK 258 -#define SOL_NETROM 259 +#define SOL_NETROM 259 +#define SOL_ROSE 260 +#define SOL_DECNET 261 +#define SOL_X25 262 #define SOL_TCP 6 #define SOL_UDP 17 -/* For setsockoptions(2) */ -#define SO_DEBUG 1 -#define SO_REUSEADDR 2 -#define SO_TYPE 3 -#define SO_ERROR 4 -#define SO_DONTROUTE 5 -#define SO_BROADCAST 6 -#define SO_SNDBUF 7 -#define SO_RCVBUF 8 -#define SO_KEEPALIVE 9 -#define SO_OOBINLINE 10 -#define SO_NO_CHECK 11 -#define SO_PRIORITY 12 -#define SO_LINGER 13 -/* To add :#define SO_REUSEPORT 14 */ - /* IP options */ #define IP_TOS 1 #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 +#define IPTOS_MINCOST 0x02 #define IP_TTL 2 -#ifdef V1_3_WILL_DO_THIS_FUNKY_STUFF -#define IP_HRDINCL 3 +#define IP_HDRINCL 3 #define IP_OPTIONS 4 -#endif #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 @@ -101,7 +169,6 @@ struct linger { #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 - /* These need to appear somewhere around here */ #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 @@ -119,4 +186,18 @@ struct linger { #define SOPRI_NORMAL 1 #define SOPRI_BACKGROUND 2 +#ifdef __KERNEL__ +extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); +extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, + int offset, int len); +extern unsigned int csum_partial_copy_fromiovecend(unsigned char *kdata, + struct iovec *iov, + int offset, + int len, int csum); + +extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); +extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); +extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); +extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); +#endif #endif /* _LINUX_SOCKET_H */ diff --git a/include/linux/sockios.h b/include/linux/sockios.h index 4259d9c94..3ec71128e 100644 --- a/include/linux/sockios.h +++ b/include/linux/sockios.h @@ -18,15 +18,7 @@ #ifndef _LINUX_SOCKIOS_H #define _LINUX_SOCKIOS_H -/* This section will go away soon! */ - -/* Socket-level I/O control calls. */ -#define FIOSETOWN 0x8901 -#define SIOCSPGRP 0x8902 -#define FIOGETOWN 0x8903 -#define SIOCGPGRP 0x8904 -#define SIOCATMARK 0x8905 -#define SIOCGSTAMP 0x8906 /* Get stamp */ +#include <asm/sockios.h> /* Routing table calls. */ #define SIOCADDRT 0x890B /* add routing table entry */ @@ -52,26 +44,26 @@ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ -#define OLD_SIOCGIFHWADDR 0x8923 /* get hardware address */ #define SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ #define SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 /* Get hardware address */ #define SIOCGIFSLAVE 0x8929 /* Driver slaving support */ #define SIOCSIFSLAVE 0x8930 -/* begin multicast support change */ -#define SIOCADDMULTI 0x8931 -#define SIOCDELMULTI 0x8932 -/* end multicast support change */ +#define SIOCADDMULTI 0x8931 /* Multicast address lists */ +#define SIOCDELMULTI 0x8932 +#define SIOGIFINDEX 0x8933 /* name -> if_index mapping */ -/* Routing table calls (oldrtent - don't use) */ -#define SIOCADDRTOLD 0x8940 /* add routing table entry */ -#define SIOCDELRTOLD 0x8941 /* delete routing table entry */ +#define SIOCGIFBR 0x8940 /* Bridging support */ +#define SIOCSIFBR 0x8941 /* Set bridging options */ /* ARP cache control calls. */ -#define SIOCDARP 0x8950 /* delete ARP table entry */ -#define SIOCGARP 0x8951 /* get ARP table entry */ -#define SIOCSARP 0x8952 /* set ARP table entry */ +#define OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ +#define OLD_SIOCGARP 0x8951 /* old get ARP table entry */ +#define OLD_SIOCSARP 0x8952 /* old set ARP table entry */ +#define SIOCDARP 0x8953 /* delete ARP table entry */ +#define SIOCGARP 0x8954 /* get ARP table entry */ +#define SIOCSARP 0x8955 /* set ARP table entry */ /* RARP cache control calls. */ #define SIOCDRARP 0x8960 /* delete RARP table entry */ @@ -83,6 +75,11 @@ #define SIOCGIFMAP 0x8970 /* Get device parameters */ #define SIOCSIFMAP 0x8971 /* Set device parameters */ +/* DLCI configuration calls */ + +#define SIOCADDDLCI 0x8980 /* Create new DLCI device */ +#define SIOCDELDLCI 0x8981 /* Delete DLCI device */ + /* Device private ioctl calls */ /* diff --git a/include/linux/sonycd535.h b/include/linux/sonycd535.h index 387e6f814..5dea1ef16 100644 --- a/include/linux/sonycd535.h +++ b/include/linux/sonycd535.h @@ -107,9 +107,9 @@ #define LOG_START_OFFSET 150 /* Offset of first logical sector */ -#define SONY_JIFFIES_TIMEOUT 500 /* Maximum number of jiffies (10ms) - the drive will wait/try for an - operation */ +#define SONY_JIFFIES_TIMEOUT (5*HZ) /* Maximum time + the drive will wait/try for an + operation */ #define SONY_READY_RETRIES (50000) /* How many times to retry a spin waiting for a register to come ready */ diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h index f839f1d89..3b6af75fa 100644 --- a/include/linux/soundcard.h +++ b/include/linux/soundcard.h @@ -1,45 +1,42 @@ #ifndef SOUNDCARD_H #define SOUNDCARD_H /* - * Copyright by Hannu Savolainen 1993 + * Copyright by Hannu Savolainen 1993-1996 * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * modification, are permitted provided that the following conditions are + * met: 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. 2. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * */ - /* - * If you make modifications to this file, please contact me before - * distributing the modified version. There is already enough - * diversity in the world. - * - * Regards, - * Hannu Savolainen - * hannu@voxware.pp.fi - */ -#define SOUND_VERSION 300 -#define VOXWARE +/* + * OSS interface version. With versions earlier than 3.6 this value is + * an integer with value less than 361. In versions 3.6 and later + * it's a six digit hexadecimal value. For example value + * of 0x030600 represents OSS version 3.6.0. + * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of + * the currently active driver. + */ +#define SOUND_VERSION 0x030700 +#define OPEN_SOUND_SYSTEM +/* In Linux we need to be prepared for cross compiling */ #include <linux/ioctl.h> /* @@ -58,13 +55,39 @@ #define SNDCARD_MSS 10 #define SNDCARD_PSS 11 #define SNDCARD_SSCAPE 12 +#define SNDCARD_PSS_MPU 13 +#define SNDCARD_PSS_MSS 14 +#define SNDCARD_SSCAPE_MSS 15 +#define SNDCARD_TRXPRO 16 +#define SNDCARD_TRXPRO_SB 17 +#define SNDCARD_TRXPRO_MPU 18 +#define SNDCARD_MAD16 19 +#define SNDCARD_MAD16_MPU 20 +#define SNDCARD_CS4232 21 +#define SNDCARD_CS4232_MPU 22 +#define SNDCARD_MAUI 23 +#define SNDCARD_PSEUDO_MSS 24 +#define SNDCARD_GUSPNP 25 +#define SNDCARD_UART401 26 +/* Soundcard numbers 27 to N are reserved. Don't add more numbers here */ /*********************************** * IOCTL Commands for /dev/sequencer */ -#ifndef _IOWR -/* @(#)ioctlp.h */ +#ifndef _SIOWR +#if defined(_IOWR) && !defined(sun) +/* Use already defined ioctl defines if they exist (except with Sun) */ +#define SIOCPARM_MASK IOCPARM_MASK +#define SIOC_VOID IOC_VOID +#define SIOC_OUT IOC_OUT +#define SIOC_IN IOC_IN +#define SIOC_INOUT IOC_INOUT +#define _SIO _IO +#define _SIOR _IOR +#define _SIOW _IOW +#define _SIOWR _IOWR +#else /* Ioctl's have the command encoded in the lower word, * and the size of any in or out parameters in the upper @@ -72,69 +95,89 @@ * to encode the in/out status of the parameter; for now * we restrict parameters to at most 128 bytes. */ -/* #define IOCTYPE (0xff<<8) */ -#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ -#define IOC_VOID 0x00000000 /* no parameters */ -#define IOC_OUT 0x20000000 /* copy out parameters */ -#define IOC_IN 0x40000000 /* copy in parameters */ -#define IOC_INOUT (IOC_IN|IOC_OUT) +/* #define SIOCTYPE (0xff<<8) */ +#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */ +#define SIOC_VOID 0x00000000 /* no parameters */ +#define SIOC_OUT 0x20000000 /* copy out parameters */ +#define SIOC_IN 0x40000000 /* copy in parameters */ +#define SIOC_INOUT (SIOC_IN|SIOC_OUT) /* the 0x20000000 is so we can distinguish new ioctl's from old */ -#define _IO(x,y) ((int)(IOC_VOID|(x<<8)|y)) -#define _IOR(x,y,t) ((int)(IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)) -#define _IOW(x,y,t) ((int)(IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)) -/* this should be _IORW, but stdio got there first */ -#define _IOWR(x,y,t) ((int)(IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)) -#endif /* !_IOWR */ - -#define SNDCTL_SEQ_RESET _IO ('Q', 0) -#define SNDCTL_SEQ_SYNC _IO ('Q', 1) -#define SNDCTL_SYNTH_INFO _IOWR('Q', 2, struct synth_info) -#define SNDCTL_SEQ_CTRLRATE _IOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ -#define SNDCTL_SEQ_GETOUTCOUNT _IOR ('Q', 4, int) -#define SNDCTL_SEQ_GETINCOUNT _IOR ('Q', 5, int) -#define SNDCTL_SEQ_PERCMODE _IOW ('Q', 6, int) -#define SNDCTL_FM_LOAD_INSTR _IOW ('Q', 7, struct sbi_instrument) /* Valid for FM only */ -#define SNDCTL_SEQ_TESTMIDI _IOW ('Q', 8, int) -#define SNDCTL_SEQ_RESETSAMPLES _IOW ('Q', 9, int) -#define SNDCTL_SEQ_NRSYNTHS _IOR ('Q',10, int) -#define SNDCTL_SEQ_NRMIDIS _IOR ('Q',11, int) -#define SNDCTL_MIDI_INFO _IOWR('Q',12, struct midi_info) -#define SNDCTL_SEQ_TRESHOLD _IOW ('Q',13, int) -#define SNDCTL_SYNTH_MEMAVL _IOWR('Q',14, int) /* in=dev#, out=memsize */ -#define SNDCTL_FM_4OP_ENABLE _IOW ('Q',15, int) /* in=dev# */ -#define SNDCTL_PMGR_ACCESS _IOWR('Q',16, struct patmgr_info) -#define SNDCTL_SEQ_PANIC _IO ('Q',17) - -#define SNDCTL_TMR_TIMEBASE _IOWR('T', 1, int) -#define SNDCTL_TMR_START _IO ('T', 2) -#define SNDCTL_TMR_STOP _IO ('T', 3) -#define SNDCTL_TMR_CONTINUE _IO ('T', 4) -#define SNDCTL_TMR_TEMPO _IOWR('T', 5, int) -#define SNDCTL_TMR_SOURCE _IOWR('T', 6, int) +#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) +#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +/* this should be _SIORW, but stdio got there first */ +#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) +# endif /* _IOWR */ +#endif /* !_SIOWR */ + +#define SNDCTL_SEQ_RESET _SIO ('Q', 0) +#define SNDCTL_SEQ_SYNC _SIO ('Q', 1) +#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) +#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ +#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) +#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) +#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) +#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete */ +#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) +#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) +#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) +#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) +#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) +#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) +#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */ +#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */ +#define SNDCTL_SEQ_PANIC _SIO ('Q',17) +#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) +#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) + + struct seq_event_rec { + unsigned char arr[8]; + }; + +#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) +#define SNDCTL_TMR_START _SIO ('T', 2) +#define SNDCTL_TMR_STOP _SIO ('T', 3) +#define SNDCTL_TMR_CONTINUE _SIO ('T', 4) +#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) +#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) # define TMR_INTERNAL 0x00000001 # define TMR_EXTERNAL 0x00000002 # define TMR_MODE_MIDI 0x00000010 # define TMR_MODE_FSK 0x00000020 # define TMR_MODE_CLS 0x00000040 # define TMR_MODE_SMPTE 0x00000080 -#define SNDCTL_TMR_METRONOME _IOW ('T', 7, int) -#define SNDCTL_TMR_SELECT _IOW ('T', 8, int) +#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) +#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) + +/* + * Some big endian/little endian handling macros + */ + +#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(HPPA) || defined(PPC) +/* Big endian machines */ +# define _PATCHKEY(id) (0xfd00|id) +# define AFMT_S16_NE AFMT_S16_BE +#else +# define _PATCHKEY(id) ((id<<8)|0xfd) +# define AFMT_S16_NE AFMT_S16_LE +#endif /* * Sample loading mechanism for internal synthesizers (/dev/sequencer) * The following patch_info structure has been designed to support * Gravis UltraSound. It tries to be universal format for uploading - * sample based patches but is probably too limited. + * sample based patches but is propably too limited. */ struct patch_info { - short key; /* Use GUS_PATCH here */ -#define GUS_PATCH 0x04fd -#define OBSOLETE_GUS_PATCH 0x02fd + unsigned short key; /* Use GUS_PATCH here */ +#define GUS_PATCH _PATCHKEY(0x04) +#define OBSOLETE_GUS_PATCH _PATCHKEY(0x02) + short device_no; /* Synthesizer number */ short instr_no; /* Midi pgm# */ - unsigned long mode; + unsigned int mode; /* * The least significant byte has the same format than the GUS .PAT * files @@ -151,10 +194,14 @@ struct patch_info { #define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ #define WAVE_SCALE 0x00040000 /* The scaling info is valid */ +#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ +/* Reserved bits */ +#define WAVE_ROM 0x40000000 /* For future use */ +#define WAVE_MULAW 0x20000000 /* For future use */ /* Other bits must be zeroed */ - long len; /* Size of the wave data in bytes */ - long loop_start, loop_end; /* Byte offsets from the beginning */ + int len; /* Size of the wave data in bytes */ + int loop_start, loop_end; /* Byte offsets from the beginning */ /* * The base_freq and base_note fields are used when computing the @@ -164,7 +211,7 @@ struct patch_info { * * The low_note and high_note fields define the minimum and maximum note * frequencies for which this sample is valid. It is possible to define - * more than one samples for a instrument number at the same time. The + * more than one samples for an instrument number at the same time. The * low_note and high_note fields are used to select the most suitable one. * * The fields base_note, high_note and low_note should contain @@ -173,9 +220,9 @@ struct patch_info { */ unsigned int base_freq; - unsigned long base_note; - unsigned long high_note; - unsigned long low_note; + unsigned int base_note; + unsigned int high_note; + unsigned int low_note; int panning; /* -128=left, 127=right */ int detuning; @@ -203,104 +250,22 @@ struct patch_info { unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ int volume; - int spare[4]; + int fractions; + int reserved1; + int spare[2]; char data[1]; /* The waveform data starts here */ }; - struct sysex_info { short key; /* Use GUS_PATCH here */ -#define SYSEX_PATCH 0x05fd +#define SYSEX_PATCH _PATCHKEY(0x05) +#define MAUI_PATCH _PATCHKEY(0x06) short device_no; /* Synthesizer number */ - long len; /* Size of the sysex data in bytes */ + int len; /* Size of the sysex data in bytes */ unsigned char data[1]; /* Sysex data starts here */ }; /* - * Patch management interface (/dev/sequencer, /dev/patmgr#) - * Don't use these calls if you want to maintain compatibility with - * the future versions of the driver. - */ - -#define PS_NO_PATCHES 0 /* No patch support on device */ -#define PS_MGR_NOT_OK 1 /* Plain patch support (no mgr) */ -#define PS_MGR_OK 2 /* Patch manager supported */ -#define PS_MANAGED 3 /* Patch manager running */ - -#define SNDCTL_PMGR_IFACE _IOWR('P', 1, struct patmgr_info) - -/* - * The patmgr_info is a fixed size structure which is used for two - * different purposes. The intended use is for communication between - * the application using /dev/sequencer and the patch manager daemon - * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)). - * - * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows - * a patch manager daemon to read and write device parameters. This - * ioctl available through /dev/sequencer also. Avoid using it since it's - * extremely hardware dependent. In addition access trough /dev/sequencer - * may confuse the patch manager daemon. - */ - -struct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */ - unsigned long key; /* Don't worry. Reserved for communication - between the patch manager and the driver. */ -#define PM_K_EVENT 1 /* Event from the /dev/sequencer driver */ -#define PM_K_COMMAND 2 /* Request from a application */ -#define PM_K_RESPONSE 3 /* From patmgr to application */ -#define PM_ERROR 4 /* Error returned by the patmgr */ - int device; - int command; - -/* - * Commands 0x000 to 0xfff reserved for patch manager programs - */ -#define PM_GET_DEVTYPE 1 /* Returns type of the patch mgr interface of dev */ -#define PMTYPE_FM2 1 /* 2 OP fm */ -#define PMTYPE_FM4 2 /* Mixed 4 or 2 op FM (OPL-3) */ -#define PMTYPE_WAVE 3 /* Wave table synthesizer (GUS) */ -#define PM_GET_NRPGM 2 /* Returns max # of midi programs in parm1 */ -#define PM_GET_PGMMAP 3 /* Returns map of loaded midi programs in data8 */ -#define PM_GET_PGM_PATCHES 4 /* Return list of patches of a program (parm1) */ -#define PM_GET_PATCH 5 /* Return patch header of patch parm1 */ -#define PM_SET_PATCH 6 /* Set patch header of patch parm1 */ -#define PM_READ_PATCH 7 /* Read patch (wave) data */ -#define PM_WRITE_PATCH 8 /* Write patch (wave) data */ - -/* - * Commands 0x1000 to 0xffff are for communication between the patch manager - * and the client - */ -#define _PM_LOAD_PATCH 0x100 - -/* - * Commands above 0xffff reserved for device specific use - */ - - long parm1; - long parm2; - long parm3; - - union { - unsigned char data8[4000]; - unsigned short data16[2000]; - unsigned long data32[1000]; - struct patch_info patch; - } data; - }; - -/* - * When a patch manager daemon is present, it will be informed by the - * driver when something important happens. For example when the - * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is - * returned. The command field contains the event type: - */ -#define PM_E_OPENED 1 /* /dev/sequencer opened */ -#define PM_E_CLOSED 2 /* /dev/sequencer closed */ -#define PM_E_PATCH_RESET 3 /* SNDCTL_RESETSAMPLES called */ -#define PM_E_PATCH_LOADED 4 /* A patch has been loaded by appl */ - -/* * /dev/sequencer input events. * * The data written to the /dev/sequencer is a stream of events. Events @@ -343,14 +308,8 @@ struct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */ * controllers. * In the MIDI 1.0 these controllers are sent using * two messages. Controller numbers 0 to 31 are used - * to send the LSB and the controller numbers 32 to 63 - * are for the LSB. - * - * This driver uses just the numbers 0 to 31 to store both - * the LSB and MSB. The controller value is a unsigned short - * and its valid range is between 0 and 16383 (0x0000 to 0x3fff). - * The driver sends the controller value using two messages when - * necessary. + * to send the MSB and the controller numbers 32 to 63 + * are for the LSB. Note that just 7 bits are used in MIDI bytes. */ #define CTL_BANK_SELECT 0x00 @@ -467,9 +426,9 @@ struct patmgr_info { /* Note! size must be < 4k since kmalloc() is used */ typedef unsigned char sbi_instr_data[32]; struct sbi_instrument { - unsigned short key; /* Initialize to FM_PATCH or OPL3_PATCH */ -#define FM_PATCH 0x01fd -#define OPL3_PATCH 0x03fd + unsigned short key; /* FM_PATCH or OPL3_PATCH */ +#define FM_PATCH _PATCHKEY(0x01) +#define OPL3_PATCH _PATCHKEY(0x03) short device; /* Synth# (0-4) */ int channel; /* Program# to be initialized */ sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ @@ -486,6 +445,7 @@ struct synth_info { /* Read only */ int synth_subtype; #define FM_TYPE_ADLIB 0x00 #define FM_TYPE_OPL3 0x01 +#define MIDI_TYPE_MPU401 0x401 #define SAMPLE_TYPE_GUS 0x10 @@ -493,7 +453,7 @@ struct synth_info { /* Read only */ int nr_voices; int nr_drums; /* Obsolete field */ int instr_bank_size; - unsigned long capabilities; + unsigned int capabilities; #define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ #define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ #define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ @@ -501,7 +461,7 @@ struct synth_info { /* Read only */ }; struct sound_timer_info { - char name[30]; + char name[32]; int caps; }; @@ -510,7 +470,7 @@ struct sound_timer_info { struct midi_info { char name[30]; int device; /* 0-N. INITIALIZE BEFORE CALLING */ - unsigned long capabilities; /* To be defined later */ + unsigned int capabilities; /* To be defined later */ int dev_type; int dummies[18]; /* Reserve space */ }; @@ -524,29 +484,30 @@ typedef struct { unsigned char data[30]; } mpu_command_rec; -#define SNDCTL_MIDI_PRETIME _IOWR('m', 0, int) -#define SNDCTL_MIDI_MPUMODE _IOWR('m', 1, int) -#define SNDCTL_MIDI_MPUCMD _IOWR('m', 2, mpu_command_rec) +#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) +#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) +#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) /******************************************** * IOCTL commands for /dev/dsp and /dev/audio */ -#define SNDCTL_DSP_RESET _IO ('P', 0) -#define SNDCTL_DSP_SYNC _IO ('P', 1) -#define SNDCTL_DSP_SPEED _IOWR('P', 2, int) -#define SNDCTL_DSP_STEREO _IOWR('P', 3, int) -#define SNDCTL_DSP_GETBLKSIZE _IOWR('P', 4, int) +#define SNDCTL_DSP_RESET _SIO ('P', 0) +#define SNDCTL_DSP_SYNC _SIO ('P', 1) +#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) +#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) +#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT -#define SOUND_PCM_WRITE_CHANNELS _IOWR('P', 6, int) -#define SOUND_PCM_WRITE_FILTER _IOWR('P', 7, int) -#define SNDCTL_DSP_POST _IO ('P', 8) -#define SNDCTL_DSP_SUBDIVIDE _IOWR('P', 9, int) -#define SNDCTL_DSP_SETFRAGMENT _IOWR('P',10, int) +#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) +#define SNDCTL_DSP_POST _SIO ('P', 8) +#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) +#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) /* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ -#define SNDCTL_DSP_GETFMTS _IOR ('P',11, int) /* Returns a mask */ -#define SNDCTL_DSP_SETFMT _IOWR('P',5, int) /* Selects ONE fmt*/ +#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */ +#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/ # define AFMT_QUERY 0x00000000 /* Return current fmt */ # define AFMT_MU_LAW 0x00000001 # define AFMT_A_LAW 0x00000002 @@ -557,11 +518,64 @@ typedef struct { # define AFMT_S8 0x00000040 # define AFMT_U16_LE 0x00000080 /* Little endian U16 */ # define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ -#define SOUND_PCM_READ_RATE _IOR ('P', 2, int) -#define SOUND_PCM_READ_CHANNELS _IOR ('P', 6, int) -#define SOUND_PCM_READ_BITS _IOR ('P', 5, int) -#define SOUND_PCM_READ_FILTER _IOR ('P', 7, int) +/* + * Buffer status queries. + */ +typedef struct audio_buf_info { + int fragments; /* # of available fragments (partially usend ones not counted) */ + int fragstotal; /* Total # of fragments allocated */ + int fragsize; /* Size of a fragment in bytes */ + + int bytes; /* Available space in bytes (includes partially used fragments) */ + /* Note! 'bytes' could be more than fragments*fragsize */ + } audio_buf_info; + +#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) +#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) +#define SNDCTL_DSP_NONBLOCK _SIO ('P',14) +#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) +# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ +# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ +# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ +# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ + /* internal buffers which may */ + /* cause some delays and */ + /* decrease precision of timing */ +# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ + /* Sometimes it's a DSP */ + /* but usually not */ +# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ +# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ + +#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) +#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) +# define PCM_ENABLE_INPUT 0x00000001 +# define PCM_ENABLE_OUTPUT 0x00000002 + +typedef struct count_info { + int bytes; /* Total # of bytes processed */ + int blocks; /* # of fragment transitions since last time */ + int ptr; /* Current DMA pointer value */ + } count_info; + +#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) +#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) + +typedef struct buffmem_desc { + unsigned *buffer; + int size; + } buffmem_desc; +#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) +#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) +#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) +#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) + +#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) +#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) +#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) +#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) /* Some alias names */ #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT @@ -573,21 +587,58 @@ typedef struct { #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT +#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE +#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE +#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK +#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS +#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER +#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER +#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO +#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR +#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR +#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF +#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF -/********************************************* - * IOCTL /dev/pss (experimental PSS API by marc.hoffman@analog.com. - * likely to change in near future. +/* + * ioctl calls to be used in communication with coprocessors and + * DSP chips. */ -#define SNDCTL_PSS_RESET _IO ('C', 0) -#define SNDCTL_PSS_SETUP_REGISTERS _IO ('C', 1) -#define SNDCTL_PSS_SPEAKER _IOW ('C', 2, struct pss_speaker) -struct pss_speaker { - int volume; - int bass; - int treb; - int mode; -}; +typedef struct copr_buffer { + int command; /* Set to 0 if not used */ + int flags; +#define CPF_NONE 0x0000 +#define CPF_FIRST 0x0001 /* First block */ +#define CPF_LAST 0x0002 /* Last block */ + int len; + int offs; /* If required by the device (0 if not used) */ + + unsigned char data[4000]; /* NOTE! 4000 is not 4k */ + } copr_buffer; + +typedef struct copr_debug_buf { + int command; /* Used internally. Set to 0 */ + int parm1; + int parm2; + int flags; + int len; /* Length of data in bytes */ + } copr_debug_buf; + +typedef struct copr_msg { + int len; + unsigned char data[4000]; + } copr_msg; + +#define SNDCTL_COPR_RESET _SIO ('C', 0) +#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) +#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) +#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) +#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) +#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) +#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) +#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) +#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) +#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) /********************************************* * IOCTL commands for /dev/mixer @@ -602,7 +653,7 @@ struct pss_speaker { * the devices supported by the particular mixer. */ -#define SOUND_MIXER_NRDEVICES 12 +#define SOUND_MIXER_NRDEVICES 17 #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 @@ -615,22 +666,42 @@ struct pss_speaker { #define SOUND_MIXER_IMIX 9 /* Recording monitor */ #define SOUND_MIXER_ALTPCM 10 #define SOUND_MIXER_RECLEV 11 /* Recording level */ +#define SOUND_MIXER_IGAIN 12 /* Input gain */ +#define SOUND_MIXER_OGAIN 13 /* Output gain */ +/* + * The AD1848 codec and compatibles have three line level inputs + * (line, aux1 and aux2). Since each card manufacturer have assigned + * different meanings to these inputs, it's inpractical to assign + * specific meanings (line, cd, synth etc.) to them. + */ +#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ +#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ +#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ /* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ /* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 -#define SOUND_MIXER_MUTE 28 /* 0 or 1 */ -#define SOUND_MIXER_ENHANCE 29 /* Enhanced stereo (0, 40, 60 or 80) */ -#define SOUND_MIXER_LOUD 30 /* 0 or 1 */ /* Note! Number 31 cannot be used since the sign bit is reserved */ +#define SOUND_MIXER_NONE 31 + +/* + * The following unsupported macros are no longer functional. + * Use SOUND_MIXER_PRIVATE# macros in future. + */ +#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE +#define SOUND_MIXER_MUTE SOUND_MIXER_NONE +#define SOUND_MIXER_LOUD SOUND_MIXER_NONE + #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ - "Mic ", "CD ", "Mix ", "Pcm2 ", "rec"} + "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ + "Line1", "Line2", "Line3"} #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ - "mic", "cd", "mix", "pcm2", "rec"} + "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ + "line1", "line2", "line3"} /* Device bitmask identifiers */ @@ -638,7 +709,7 @@ struct pss_speaker { #define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ #define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ #define SOUND_MIXER_CAPS 0xfc - #define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ +# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ #define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ /* Device mask bits */ @@ -655,12 +726,18 @@ struct pss_speaker { #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) +#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) +#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) +#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) +#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) +#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) +/* Obsolete macros */ #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) -#define MIXER_READ(dev) _IOR('M', dev, int) +#define MIXER_READ(dev) _SIOR('M', dev, int) #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) @@ -673,6 +750,13 @@ struct pss_speaker { #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) +#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) +#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) + +/* Obsolete macros */ #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) @@ -683,7 +767,7 @@ struct pss_speaker { #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) -#define MIXER_WRITE(dev) _IOWR('M', dev, int) +#define MIXER_WRITE(dev) _SIOWR('M', dev, int) #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) @@ -696,12 +780,81 @@ struct pss_speaker { #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) +#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) +#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) + +/* Obsolete macros */ #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) +typedef struct mixer_info +{ + char id[16]; + char name[32]; + int modify_counter; + int fillers[10]; +} mixer_info; + +typedef struct _old_mixer_info /* Obsolete */ +{ + char id[16]; + char name[32]; +} _old_mixer_info; + +#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) +#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) + +/* + * A mechanism for accessing "proprietary" mixer features. This method + * permits passing 128 bytes of arbitrary data between a mixer application + * and the mixer driver. Interpretation of the record is defined by + * the particular mixer driver. + */ +typedef unsigned char mixer_record[128]; + +#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) + +/* + * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. + * These features can be used when accessing device specific features. + */ +#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) +#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) +#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) +#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) +#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) + +/* + * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used + * for querying current mixer settings from the driver and for loading + * default volume settings _prior_ activating the mixer (loading + * doesn't affect current state of the mixer hardware). These calls + * are for internal use only. + */ + +typedef struct mixer_vol_table { + int num; /* Index to volume table */ + char name[32]; + int levels[32]; +} mixer_vol_table; + +#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) +#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) + +/* + * An ioctl for identifying the driver version. It will return value + * of the SOUND_VERSION macro used when compiling the driver. + * This call was introduced in OSS version 3.6 and it will not work + * with earlier versions (returns EINVAL). + */ +#define OSS_GETVERSION _SIOR ('M', 118, int) + /* * Level 2 event types for /dev/sequencer */ @@ -724,6 +877,7 @@ struct pss_speaker { #define EV_TIMING 0x81 #define EV_CHN_COMMON 0x92 #define EV_CHN_VOICE 0x93 +#define EV_SYSEX 0x94 /* * Event types 200 to 220 are reserved for application use. * These numbers will not be used by the driver. @@ -762,6 +916,11 @@ struct pss_speaker { #define TMR_SPP 10 /* Song position pointer */ #define TMR_TIMESIG 11 /* Time signature */ +/* + * Local event types + */ +#define LOCL_STARTAUDIO 1 + #if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) /* * Some convenience macros to simplify programming of the @@ -795,7 +954,6 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 #define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() -#define SEQ_PM_DEFINES struct patmgr_info _pm_info #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump @@ -817,15 +975,6 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define _SEQ_NEEDBUF(len) /* empty */ #endif -#define PM_LOAD_PATCH(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ - _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \ - _pm_info.parm1 = bank, _pm_info.parm2 = 1, \ - ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) -#define PM_LOAD_PATCHES(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ - _pm_info.device=dev, memcpy(_pm_info.data.data8, pgm, 128), \ - _pm_info.parm1 = bank, _pm_info.parm2 = 128, \ - ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) - #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ @@ -876,6 +1025,28 @@ void seqbuf_dump(void); /* This function must be provided by programs */ _seqbuf[_seqbufptr+5] = (p2);\ *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ _SEQ_ADVBUF(8);} +/* + * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits + * sending any MIDI bytes but it's absolutely not possible. Trying to do + * so _will_ cause problems with MPU401 intelligent mode). + * + * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be + * sent by calling SEQ_SYSEX() several times (there must be no other events + * between them). First sysex fragment must have 0xf0 in the first byte + * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte + * between these sysex start and end markers cannot be larger than 0x7f. Also + * lengths of each fragments (except the last one) must be 6. + * + * Breaking the above rules may work with some MIDI ports but is likely to + * cause fatal problems with some other devices (such as MPU401). + */ +#define SEQ_SYSEX(dev, buf, len) \ + {int i, l=(len); if (l>6)l=6;\ + _SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_SYSEX;\ + for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\ + for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\ + _SEQ_ADVBUF(8);} #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) @@ -896,7 +1067,8 @@ void seqbuf_dump(void); /* This function must be provided by programs */ _seqbuf[_seqbufptr+2] = (dev);\ _seqbuf[_seqbufptr+3] = (voice);\ _seqbuf[_seqbufptr+4] = (controller);\ - *(short *)&_seqbuf[_seqbufptr+5] = (value);\ + _seqbuf[_seqbufptr+5] = ((value)&0xff);\ + _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\ _seqbuf[_seqbufptr+7] = 0;\ _SEQ_ADVBUF(8);} /* @@ -908,21 +1080,9 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) -#if 0 -#define SEQ_PANNING(dev, voice, pos) {_SEQ_NEEDBUF(8);\ - _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ - _seqbuf[_seqbufptr+1] = SEQ_BALANCE;\ - _seqbuf[_seqbufptr+2] = (dev);\ - _seqbuf[_seqbufptr+3] = (voice);\ - (char)_seqbuf[_seqbufptr+4] = (pos);\ - _seqbuf[_seqbufptr+5] = 0;\ - _seqbuf[_seqbufptr+6] = 0;\ - _seqbuf[_seqbufptr+7] = 1;\ - _SEQ_ADVBUF(8);} -#endif /* - * Timing and synchronization macros + * Timing and syncronization macros */ #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ @@ -944,6 +1104,19 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) /* + * Local control events + */ + +#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) +/* * Events for the level 1 interface only */ @@ -963,5 +1136,4 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_WRPATCH2(patchx, len) (seqbuf_dump(), write(seqfd, (char*)(patchx), len)) #endif -long soundcard_init(long mem_start); #endif diff --git a/include/linux/soundmodem.h b/include/linux/soundmodem.h new file mode 100644 index 000000000..0bea35fce --- /dev/null +++ b/include/linux/soundmodem.h @@ -0,0 +1,107 @@ +/* + * The Linux soundcard driver for 1200 baud and 9600 baud packet radio + * (C) 1996 by Thomas Sailer, HB9JNX/AE4WA + */ + +#ifndef _SOUNDMODEM_H +#define _SOUNDMODEM_H + +#include <linux/sockios.h> +#include <linux/if_ether.h> + +/* -------------------------------------------------------------------- */ +/* + * structs for the IOCTL commands + */ + +struct sm_debug_data { + unsigned long debug1; + unsigned long debug2; + long debug3; +}; + +struct sm_diag_data { + unsigned int mode; + unsigned int flags; + unsigned int samplesperbit; + unsigned int datalen; + short *data; +}; + +struct sm_mixer_data { + unsigned int mixer_type; + unsigned int sample_rate; + unsigned int bit_rate; + unsigned int reg; + unsigned int data; +}; + +struct sm_config { + int hardware; + int mode; +}; + +struct sm_ioctl { + int cmd; + union { + struct sm_config cfg; + struct sm_diag_data diag; + struct sm_mixer_data mix; + struct sm_debug_data dbg; + } data; +}; + +/* -------------------------------------------------------------------- */ + +/* + * config: hardware + */ +#define SM_HARDWARE_INVALID -1 +#define SM_HARDWARE_SBC 0 +#define SM_HARDWARE_WSS 1 +#define SM_HARDWARE_WSSFDX 2 /* currently does not work! */ + +/* + * config: mode + */ +#define SM_MODE_INVALID -1 +#define SM_MODE_AFSK1200 0 +#define SM_MODE_FSK9600 1 + +/* + * diagnose modes + */ +#define SM_DIAGMODE_OFF 0 +#define SM_DIAGMODE_INPUT 1 +#define SM_DIAGMODE_DEMOD 2 + +/* + * diagnose flags + */ +#define SM_DIAGFLAG_DCDGATE (1<<0) +#define SM_DIAGFLAG_VALID (1<<1) + +/* + * mixer types + */ +#define SM_MIXER_INVALID 0 +#define SM_MIXER_AD1848 0x10 +#define SM_MIXER_CT1335 0x20 +#define SM_MIXER_CT1345 0x21 +#define SM_MIXER_CT1745 0x22 + +/* + * ioctl values + */ +#define SMCTL_GETMODEMTYPE 0x80 +#define SMCTL_SETMODEMTYPE 0x81 +#define SMCTL_DIAGNOSE 0x82 +#define SMCTL_GETMIXER 0x83 +#define SMCTL_SETMIXER 0x84 +#define SMCTL_GETDEBUG 0x85 + +/* -------------------------------------------------------------------- */ + +#endif /* _SOUNDMODEM_H */ + +/* --------------------------------------------------------------------- */ diff --git a/include/linux/stallion.h b/include/linux/stallion.h new file mode 100644 index 000000000..b1aa738bc --- /dev/null +++ b/include/linux/stallion.h @@ -0,0 +1,142 @@ +/*****************************************************************************/ + +/* + * stallion.h -- stallion multiport serial driver. + * + * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au). + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ +#ifndef _STALLION_H +#define _STALLION_H +/*****************************************************************************/ + +/* + * Define important driver constants here. + */ +#define STL_MAXBRDS 4 +#define STL_MAXPANELS 4 +#define STL_PORTSPERPANEL 16 +#define STL_MAXPORTS 64 +#define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) + + +/* + * Define a set of structures to hold all the board/panel/port info + * for our ports. These will be dynamically allocated as required. + */ + +/* + * Define a ring queue structure for each port. This will hold the + * TX data waiting to be output. Characters are fed into this buffer + * from the line discipline (or even direct from user space!) and + * then fed into the UARTs during interrupts. Will use a classic ring + * queue here for this. The good thing about this type of ring queue + * is that the head and tail pointers can be updated without interrupt + * protection - since "write" code only needs to change the head, and + * interrupt code only needs to change the tail. + */ +typedef struct { + char *buf; + char *head; + char *tail; +} stlrq_t; + +/* + * Port, panel and board structures to hold status info about each. + * The board structure contains pointers to structures for each panel + * connected to it, and in turn each panel structure contains pointers + * for each port structure for each port on that panel. Note that + * the port structure also contains the board and panel number that it + * is associated with, this makes it (fairly) easy to get back to the + * board/panel info for a port. + */ +typedef struct { + unsigned long magic; + int portnr; + int panelnr; + int brdnr; + int ioaddr; + int uartaddr; + int pagenr; + int istate; + int flags; + int baud_base; + int custom_divisor; + int close_delay; + int closing_wait; + int refcount; + int openwaitcnt; + int brklen; + long session; + long pgrp; + unsigned int sigs; + unsigned int rxignoremsk; + unsigned int rxmarkmsk; + unsigned long clk; + unsigned long hwid; + struct tty_struct *tty; + struct wait_queue *open_wait; + struct wait_queue *close_wait; + struct termios normaltermios; + struct termios callouttermios; + struct tq_struct tqueue; + comstats_t stats; + stlrq_t tx; +} stlport_t; + +typedef struct { + unsigned long magic; + int panelnr; + int brdnr; + int pagenr; + int nrports; + int iobase; + unsigned int hwid; + unsigned int ackmask; + stlport_t *ports[STL_PORTSPERPANEL]; +} stlpanel_t; + +typedef struct { + unsigned long magic; + int brdnr; + int brdtype; + int state; + int nrpanels; + int nrports; + int irq; + int irqtype; + unsigned int ioaddr1; + unsigned int ioaddr2; + unsigned int iostatus; + unsigned int ioctrl; + unsigned int ioctrlval; + unsigned int hwid; + unsigned long clk; + stlpanel_t *panels[STL_MAXPANELS]; +} stlbrd_t; + + +/* + * Define MAGIC numbers used for above structures. + */ +#define STL_PORTMAGIC 0x5a7182c9 +#define STL_PANELMAGIC 0x7ef621a1 +#define STL_BOARDMAGIC 0xa2267f52 + +/*****************************************************************************/ +#endif diff --git a/include/linux/stddef.h b/include/linux/stddef.h index c6221e712..39da8088d 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -1,11 +1,6 @@ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; -#endif - #undef NULL #define NULL ((void *)0) diff --git a/include/linux/string.h b/include/linux/string.h index 3fddfdd65..214503c20 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -13,25 +13,25 @@ extern "C" { extern char * ___strtok; extern char * strcpy(char *,const char *); -extern char * strncpy(char *,const char *,size_t); +extern char * strncpy(char *,const char *, __kernel_size_t); extern char * strcat(char *, const char *); -extern char * strncat(char *, const char *, size_t); +extern char * strncat(char *, const char *, __kernel_size_t); extern char * strchr(const char *,int); +extern char * strrchr(const char *,int); extern char * strpbrk(const char *,const char *); -extern char * ___strtok; extern char * strtok(char *,const char *); extern char * strstr(const char *,const char *); -extern size_t strlen(const char *); -extern size_t strnlen(const char *,size_t); -extern size_t strspn(const char *,const char *); +extern __kernel_size_t strlen(const char *); +extern __kernel_size_t strnlen(const char *,__kernel_size_t); +extern __kernel_size_t strspn(const char *,const char *); extern int strcmp(const char *,const char *); -extern int strncmp(const char *,const char *,size_t); +extern int strncmp(const char *,const char *,__kernel_size_t); -extern void * memset(void *,int,size_t); -extern void * memcpy(void *,const void *,size_t); -extern void * memmove(void *,const void *,size_t); -extern void * memscan(void *,int,size_t); -extern int memcmp(const void *,const void *,size_t); +extern void * memset(void *,int,__kernel_size_t); +extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memmove(void *,const void *,__kernel_size_t); +extern void * memscan(void *,int,__kernel_size_t); +extern int memcmp(const void *,const void *,__kernel_size_t); /* * Include machine specific inline routines diff --git a/include/linux/swap.h b/include/linux/swap.h new file mode 100644 index 000000000..18fe74e8e --- /dev/null +++ b/include/linux/swap.h @@ -0,0 +1,144 @@ +#ifndef _LINUX_SWAP_H +#define _LINUX_SWAP_H + +#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ +#define SWAP_FLAG_PRIO_MASK 0x7fff +#define SWAP_FLAG_PRIO_SHIFT 0 + +#define MAX_SWAPFILES 8 + +#ifdef __KERNEL__ + +#include <asm/atomic.h> + +#define SWP_USED 1 +#define SWP_WRITEOK 3 + +#define SWAP_CLUSTER_MAX 32 + +struct swap_info_struct { + unsigned int flags; + kdev_t swap_device; + struct inode * swap_file; + unsigned char * swap_map; + unsigned char * swap_lockmap; + unsigned int lowest_bit; + unsigned int highest_bit; + unsigned int cluster_next; + unsigned int cluster_nr; + int prio; /* swap priority */ + int pages; + unsigned long max; + int next; /* next entry on swap list */ +}; + +extern int nr_swap_pages; +extern int nr_free_pages; +extern atomic_t nr_async_pages; +extern int min_free_pages; +extern int free_pages_low; +extern int free_pages_high; + +/* Incomplete types for prototype declarations: */ +struct task_struct; +struct vm_area_struct; +struct sysinfo; + +/* linux/ipc/shm.c */ +extern int shm_swap (int, int); + +/* linux/mm/vmscan.c */ +extern int try_to_free_page(int, int, int); + +/* linux/mm/page_io.c */ +extern void rw_swap_page(int, unsigned long, char *, int); +#define read_swap_page(nr,buf) \ + rw_swap_page(READ,(nr),(buf),1) +#define write_swap_page(nr,buf) \ + rw_swap_page(WRITE,(nr),(buf),1) +extern void swap_after_unlock_page (unsigned long entry); + +/* linux/mm/page_alloc.c */ +extern void swap_in(struct task_struct *, struct vm_area_struct *, + pte_t *, unsigned long, int); + + +/* linux/mm/swap_state.c */ +extern void show_swap_cache_info(void); +extern int add_to_swap_cache(unsigned long, unsigned long); +extern unsigned long init_swap_cache(unsigned long, unsigned long); +extern void swap_duplicate(unsigned long); + +/* linux/mm/swapfile.c */ +extern unsigned int nr_swapfiles; +extern struct swap_info_struct swap_info[]; +void si_swapinfo(struct sysinfo *); +unsigned long get_swap_page(void); +extern void swap_free(unsigned long); + +/* + * vm_ops not present page codes for shared memory. + * + * Will go away eventually.. + */ +#define SHM_SWP_TYPE 0x40 + +/* + * swap cache stuff (in linux/mm/swap_state.c) + */ + +#define SWAP_CACHE_INFO + +extern unsigned long * swap_cache; + +#ifdef SWAP_CACHE_INFO +extern unsigned long swap_cache_add_total; +extern unsigned long swap_cache_add_success; +extern unsigned long swap_cache_del_total; +extern unsigned long swap_cache_del_success; +extern unsigned long swap_cache_find_total; +extern unsigned long swap_cache_find_success; +#endif + +extern inline unsigned long in_swap_cache(unsigned long index) +{ + return swap_cache[index]; +} + +extern inline long find_in_swap_cache(unsigned long index) +{ + unsigned long entry; + +#ifdef SWAP_CACHE_INFO + swap_cache_find_total++; +#endif + entry = xchg(swap_cache + index, 0); +#ifdef SWAP_CACHE_INFO + if (entry) + swap_cache_find_success++; +#endif + return entry; +} + +extern inline int delete_from_swap_cache(unsigned long index) +{ + unsigned long entry; + +#ifdef SWAP_CACHE_INFO + swap_cache_del_total++; +#endif + entry = xchg(swap_cache + index, 0); + if (entry) { +#ifdef SWAP_CACHE_INFO + swap_cache_del_success++; +#endif + swap_free(entry); + return 1; + } + return 0; +} + + +#endif /* __KERNEL__*/ + +#endif /* _LINUX_SWAP_H */ diff --git a/include/linux/swapctl.h b/include/linux/swapctl.h new file mode 100644 index 000000000..c85aa6c24 --- /dev/null +++ b/include/linux/swapctl.h @@ -0,0 +1,132 @@ +#ifndef _LINUX_SWAPCTL_H +#define _LINUX_SWAPCTL_H + +#include <asm/page.h> +#include <linux/fs.h> + +/* Swap tuning control */ + +/* First, enumerate the different reclaim policies */ +enum RCL_POLICY {RCL_ROUND_ROBIN, RCL_BUFF_FIRST, RCL_PERSIST}; + +typedef struct swap_control_v5 +{ + unsigned int sc_max_page_age; + unsigned int sc_page_advance; + unsigned int sc_page_decline; + unsigned int sc_page_initial_age; + unsigned int sc_max_buff_age; + unsigned int sc_buff_advance; + unsigned int sc_buff_decline; + unsigned int sc_buff_initial_age; + unsigned int sc_age_cluster_fract; + unsigned int sc_age_cluster_min; + unsigned int sc_pageout_weight; + unsigned int sc_bufferout_weight; + unsigned int sc_buffer_grace; + unsigned int sc_nr_buffs_to_free; + unsigned int sc_nr_pages_to_free; + enum RCL_POLICY sc_policy; +} swap_control_v5; +typedef struct swap_control_v5 swap_control_t; +extern swap_control_t swap_control; + +typedef struct kswapd_control_v1 +{ + unsigned int maxpages; + unsigned int pages_buff; + unsigned int pages_shm; + unsigned int pages_mmap; + unsigned int pages_swap; +} kswapd_control_v1; +typedef kswapd_control_v1 kswapd_control_t; +extern kswapd_control_t kswapd_ctl; + +typedef struct swapstat_v1 +{ + unsigned int wakeups; + unsigned int pages_reclaimed; + unsigned int pages_shm; + unsigned int pages_mmap; + unsigned int pages_swap; +} swapstat_v1; +typedef swapstat_v1 swapstat_t; +extern swapstat_t swapstats; + +extern int min_free_pages, free_pages_low, free_pages_high; + +#define SC_VERSION 1 +#define SC_MAX_VERSION 1 + +#ifdef __KERNEL__ + +/* Define the maximum (least urgent) priority for the page reclaim code */ +#define RCL_MAXPRI 6 +/* We use an extra priority in the swap accounting code to represent + failure to free a resource at any priority */ +#define RCL_FAILURE (RCL_MAXPRI + 1) + +#define RCL_POLICY (swap_control.sc_policy) +#define AGE_CLUSTER_FRACT (swap_control.sc_age_cluster_fract) +#define AGE_CLUSTER_MIN (swap_control.sc_age_cluster_min) +#define PAGEOUT_WEIGHT (swap_control.sc_pageout_weight) +#define BUFFEROUT_WEIGHT (swap_control.sc_bufferout_weight) + +#define NR_BUFFS_TO_FREE (swap_control.sc_nr_buffs_to_free) +#define NR_PAGES_TO_FREE (swap_control.sc_nr_pages_to_free) + +#define BUFFERMEM_GRACE (swap_control.sc_buffer_grace) + +/* Page aging (see mm/swap.c) */ + +#define MAX_PAGE_AGE (swap_control.sc_max_page_age) +#define PAGE_ADVANCE (swap_control.sc_page_advance) +#define PAGE_DECLINE (swap_control.sc_page_decline) +#define PAGE_INITIAL_AGE (swap_control.sc_page_initial_age) + +#define MAX_BUFF_AGE (swap_control.sc_max_buff_age) +#define BUFF_ADVANCE (swap_control.sc_buff_advance) +#define BUFF_DECLINE (swap_control.sc_buff_decline) +#define BUFF_INITIAL_AGE (swap_control.sc_buff_initial_age) + +/* Given a resource of N units (pages or buffers etc), we only try to + * age and reclaim AGE_CLUSTER_FRACT per 1024 resources each time we + * scan the resource list. */ +static inline int AGE_CLUSTER_SIZE(int resources) +{ + unsigned int n = (resources * AGE_CLUSTER_FRACT) >> 10; + if (n < AGE_CLUSTER_MIN) + return AGE_CLUSTER_MIN; + else + return n; +} + +static inline void touch_page(struct page *page) +{ + if (page->age < (MAX_PAGE_AGE - PAGE_ADVANCE)) + page->age += PAGE_ADVANCE; + else + page->age = MAX_PAGE_AGE; +} + +static inline void age_page(struct page *page) +{ + if (page->age > PAGE_DECLINE) + page->age -= PAGE_DECLINE; + else + page->age = 0; +} + +static inline int age_of(unsigned long addr) +{ + return mem_map[MAP_NR(addr)].age; +} + +static inline void set_page_new(unsigned long addr) +{ + mem_map[MAP_NR(addr)].age = PAGE_INITIAL_AGE; +} + +#endif /* __KERNEL */ + +#endif /* _LINUX_SWAPCTL_H */ diff --git a/include/linux/symtab_begin.h b/include/linux/symtab_begin.h index c6f693687..65a87008c 100644 --- a/include/linux/symtab_begin.h +++ b/include/linux/symtab_begin.h @@ -1,16 +1,45 @@ -#ifdef CONFIG_MODVERSIONS /* CONFIG_MODVERSIONS */ -#undef _set_ver -#undef X -#ifndef __GENKSYMS__ -#ifdef MODULE -#define _set_ver(sym,ver) { (void *) & sym ## _R ## ver, "_" #sym "_R" #ver } -#else /* MODULE */ -#define _set_ver(sym,ver) { (void *) & sym, "_" #sym "_R" #ver } -#endif /* MODULE */ -#define X(a) a -#endif /* __GENKSYMS__ */ -#else /* CONFIG_MODVERSIONS */ -#define X(sym) { (void *) & sym, "_" #sym } -#endif /* CONFIG_MODVERSIONS */ +#include <linux/linkage.h> + +#ifdef MODVERSIONS +# undef _set_ver +# undef X +/* + * These two macros _will_ get enough arguments from the X* macros + * since "sym" expands to "symaddr, symstr" from the #define in *.ver + */ +# define _basic_version(symaddr,symstr) symaddr, symstr +# define _alias_version(really,symaddr,symstr) (void *) & really , symstr + +# ifndef __GENKSYMS__ +# ifdef MODULE +# define _set_ver(sym,ver) \ + (void *) & sym ## _R ## ver, SYMBOL_NAME_STR(sym) "_R" #ver +# else /* !MODULE */ +# define _set_ver(sym,ver) \ + (void *) & sym, SYMBOL_NAME_STR(sym) "_R" #ver +# endif /* !MODULE */ +# define X(sym) { _basic_version(sym) } +/* + * For _really_ stacked modules: + * + * Use "Xalias(local_symbol, symbol_from_other_module)" + * to make subsequent modules really use "local_symbol" + * when they think that they are using "symbol_from_other_module" + * + * The "aliasing" module can still use "symbol_from_other_module", + * but can now replace and/or modify the behaviour of that symbol. + */ +# define Xalias(really,sym) { _alias_version(really,sym) } +# endif /* !__GENKSYMS__ */ +#else /* !MODVERSIONS */ +# define X(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} +# define Xalias(really,sym) { (void *) & really, SYMBOL_NAME_STR(sym)} +#endif /* MODVERSIONS */ +/* + * Some symbols always need to be unversioned. This includes + * compiler generated calls to functions. + */ +#define XNOVERS(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} + #define EMPTY {0,0} 0, 0, 0, { diff --git a/include/linux/symtab_end.h b/include/linux/symtab_end.h index 4fbd50f99..91b92e298 100644 --- a/include/linux/symtab_end.h +++ b/include/linux/symtab_end.h @@ -1,11 +1,11 @@ -#ifdef CONFIG_MODVERSIONS /* CONFIG_MODVERSIONS */ +#ifdef MODVERSIONS #undef _set_ver #if defined(MODULE) && !defined(__GENKSYMS__) #define _set_ver(sym,vers) sym ## _R ## vers #else #define _set_ver(a,b) a #endif -#endif /* CONFIG_MODVERSIONS */ +#endif /* MODVERSIONS */ #undef X #undef EMPTY /* mark end of table, last entry above ended with a comma! */ diff --git a/include/linux/sys.h b/include/linux/sys.h index 40f9471d0..dcd325668 100644 --- a/include/linux/sys.h +++ b/include/linux/sys.h @@ -27,10 +27,4 @@ * These are system calls that haven't been implemented yet * but have an entry in the table for future expansion.. */ -#ifdef __mips__ -#define sys_quotactl sys_ni_syscall -#else -#define _sys_quotactl _sys_ni_syscall -#endif - #endif diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h new file mode 100644 index 000000000..b16ddb71f --- /dev/null +++ b/include/linux/sysctl.h @@ -0,0 +1,265 @@ +/* + * sysctl.h: General linux system control interface + * + * Begun 24 March 1995, Stephen Tweedie + */ + +#include <linux/lists.h> + +#ifndef _LINUX_SYSCTL_H +#define _LINUX_SYSCTL_H + +#define CTL_MAXNAME 10 + +struct __sysctl_args { + int *name; + int nlen; + void *oldval; + size_t *oldlenp; + void *newval; + size_t newlen; + unsigned long __unused[4]; +}; + +/* Define sysctl names first */ + +/* Top-level names: */ + +/* For internal pattern-matching use only: */ +#ifdef __KERNEL__ +#define CTL_ANY -1 /* Matches any name */ +#define CTL_NONE 0 +#endif + +#define CTL_KERN 1 /* General kernel info and control */ +#define CTL_VM 2 /* VM management */ +#define CTL_NET 3 /* Networking */ +#define CTL_PROC 4 /* Process info */ +#define CTL_FS 5 /* Filesystems */ +#define CTL_DEBUG 6 /* Debugging */ +#define CTL_DEV 7 /* Devices */ +#define CTL_MAXID 8 + +/* CTL_KERN names: */ +#define KERN_OSTYPE 1 /* string: system version */ +#define KERN_OSRELEASE 2 /* string: system release */ +#define KERN_OSREV 3 /* int: system revision */ +#define KERN_VERSION 4 /* string: compile time info */ +#define KERN_SECUREMASK 5 /* struct: maximum rights mask */ +#define KERN_PROF 6 /* table: profiling information */ +#define KERN_NODENAME 7 +#define KERN_DOMAINNAME 8 +#define KERN_NRINODE 9 +#define KERN_MAXINODE 10 +#define KERN_NRFILE 11 +#define KERN_MAXFILE 12 +#define KERN_MAXID 13 +#define KERN_SECURELVL 14 /* int: system security level */ +#define KERN_PANIC 15 /* int: panic timeout */ +#define KERN_REALROOTDEV 16 /* real root device to mount after initrd */ +#define KERN_NFSRNAME 17 /* NFS root name */ +#define KERN_NFSRADDRS 18 /* NFS root addresses */ +#define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */ +#define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */ + +/* CTL_VM names: */ +#define VM_SWAPCTL 1 /* struct: Set vm swapping control */ +#define VM_KSWAPD 2 /* struct: control background pageout */ +#define VM_FREEPG 3 /* struct: Set free page thresholds */ +#define VM_BDFLUSH 4 /* struct: Control buffer cache flushing */ +#define VM_MAXID 5 + +/* CTL_NET names: */ +#define NET_CORE 1 +#define NET_ETHER 2 +#define NET_802 3 +#define NET_UNIX 4 +#define NET_IPV4 5 +#define NET_IPX 6 +#define NET_ATALK 7 +#define NET_NETROM 8 +#define NET_AX25 9 +#define NET_BRIDGE 10 +#define NET_IPV6 11 +#define NET_ROSE 12 +#define NET_X25 13 + +/* /proc/sys/net/core */ + +/* /proc/sys/net/ethernet */ + +/* /proc/sys/net/802 */ + +/* /proc/sys/net/unix */ + +/* /proc/sys/net/ipv4 */ +#define NET_IPV4_ARP_RES_TIME 1 +#define NET_IPV4_ARP_DEAD_RES_TIME 2 +#define NET_IPV4_ARP_MAX_TRIES 3 +#define NET_IPV4_ARP_TIMEOUT 4 +#define NET_IPV4_ARP_CHECK_INTERVAL 5 +#define NET_IPV4_ARP_CONFIRM_INTERVAL 6 +#define NET_IPV4_ARP_CONFIRM_TIMEOUT 7 +#define NET_IPV4_TCP_VEGAS_CONG_AVOID 8 + +/* /proc/sys/net/ipv6 */ +#define NET_IPV6_FORWARDING 1 +#define NET_IPV6_HOPLIMIT 2 +/* /proc/sys/net/ipx */ + +/* /proc/sys/net/appletalk */ + +/* /proc/sys/net/netrom */ +#define NET_NETROM_DEFAULT_PATH_QUALITY 1 +#define NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER 2 +#define NET_NETROM_NETWORK_TTL_INITIALISER 3 +#define NET_NETROM_TRANSPORT_TIMEOUT 4 +#define NET_NETROM_TRANSPORT_MAXIMUM_TRIES 5 +#define NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY 6 +#define NET_NETROM_TRANSPORT_BUSY_DELAY 7 +#define NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE 8 +#define NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT 9 +#define NET_NETROM_TRANSPORT_PACKET_LENGTH 10 +#define NET_NETROM_ROUTING_CONTROL 11 + +/* /proc/sys/net/ax25 */ +/* Values are generated dynamically */ + +/* /proc/sys/net/rose */ +#define NET_ROSE_RESTART_REQUEST_TIMEOUT 1 +#define NET_ROSE_CALL_REQUEST_TIMEOUT 2 +#define NET_ROSE_RESET_REQUEST_TIMEOUT 3 +#define NET_ROSE_CLEAR_REQUEST_TIMEOUT 4 +#define NET_ROSE_NO_ACTIVITY_TIMEOUT 5 +#define NET_ROSE_ROUTING_CONTROL 6 + +/* /proc/sys/net/x25 */ +#define NET_X25_RESTART_REQUEST_TIMEOUT 1 +#define NET_X25_CALL_REQUEST_TIMEOUT 2 +#define NET_X25_RESET_REQUEST_TIMEOUT 3 +#define NET_X25_CLEAR_REQUEST_TIMEOUT 4 +#define NET_X25_ACK_HOLDBACK_TIMEOUT 5 + +/* CTL_PROC names: */ + +/* CTL_FS names: */ + +/* CTL_DEBUG names: */ + +/* CTL_DEV names: */ + +#ifdef __KERNEL__ + +extern asmlinkage int sys_sysctl(struct __sysctl_args *); +extern void init_sysctl(void); + +typedef struct ctl_table ctl_table; + +typedef int ctl_handler (ctl_table *table, int *name, int nlen, + void *oldval, size_t *oldlenp, + void *newval, size_t newlen, + void **context); + +typedef int proc_handler (ctl_table *ctl, int write, struct file * filp, + void *buffer, size_t *lenp); + +extern int proc_dostring(ctl_table *, int, struct file *, + void *, size_t *); +extern int proc_dointvec(ctl_table *, int, struct file *, + void *, size_t *); +extern int proc_dointvec_minmax(ctl_table *, int, struct file *, + void *, size_t *); + +extern int do_sysctl (int *name, int nlen, + void *oldval, size_t *oldlenp, + void *newval, size_t newlen); + +extern int do_sysctl_strategy (ctl_table *table, + int *name, int nlen, + void *oldval, size_t *oldlenp, + void *newval, size_t newlen, void ** context); + +extern ctl_handler sysctl_string; +extern ctl_handler sysctl_intvec; + +extern int do_string ( + void *oldval, size_t *oldlenp, void *newval, size_t newlen, + int rdwr, char *data, size_t max); +extern int do_int ( + void *oldval, size_t *oldlenp, void *newval, size_t newlen, + int rdwr, int *data); +extern int do_struct ( + void *oldval, size_t *oldlenp, void *newval, size_t newlen, + int rdwr, void *data, size_t len); + + +/* + * Register a set of sysctl names by calling register_sysctl_table + * with an initialised array of ctl_table's. An entry with zero + * ctl_name terminates the table. table->de will be set up by the + * registration and need not be initialised in advance. + * + * sysctl names can be mirrored automatically under /proc/sys. The + * procname supplied controls /proc naming. + * + * The table's mode will be honoured both for sys_sysctl(2) and + * proc-fs access. + * + * Leaf nodes in the sysctl tree will be represented by a single file + * under /proc; non-leaf nodes will be represented by directories. A + * null procname disables /proc mirroring at this node. + * + * sysctl(2) can automatically manage read and write requests through + * the sysctl table. The data and maxlen fields of the ctl_table + * struct enable minimal validation of the values being written to be + * performed, and the mode field allows minimal authentication. + * + * More sophisticated management can be enabled by the provision of a + * strategy routine with the table entry. This will be called before + * any automatic read or write of the data is performed. + * + * The strategy routine may return: + * <0: Error occurred (error is passed to user process) + * 0: OK - proceed with automatic read or write. + * >0: OK - read or write has been done by the strategy routine, so + * return immediately. + * + * There must be a proc_handler routine for any terminal nodes + * mirrored under /proc/sys (non-terminals are handled by a built-in + * directory handler). Several default handlers are available to + * cover common cases. + */ + +/* A sysctl table is an array of struct ctl_table: */ +struct ctl_table +{ + int ctl_name; /* Binary ID */ + const char *procname; /* Text ID for /proc/sys, or zero */ + void *data; + int maxlen; + mode_t mode; + ctl_table *child; + proc_handler *proc_handler; /* Callback for text formatting */ + ctl_handler *strategy; /* Callback function for all r/w */ + struct proc_dir_entry *de; /* /proc control block */ + void *extra1; + void *extra2; +}; + +/* struct ctl_table_header is used to maintain dynamic lists of + ctl_table trees. */ +struct ctl_table_header +{ + ctl_table *ctl_table; + DLNODE(struct ctl_table_header) ctl_entry; +}; + +struct ctl_table_header * register_sysctl_table(ctl_table * table, + int insert_at_head); +void unregister_sysctl_table(struct ctl_table_header * table); + +#else /* __KERNEL__ */ + +#endif /* __KERNEL__ */ + +#endif /* _LINUX_SYSCTL_H */ diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index 984be6b1c..7b19dac3c 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -316,8 +316,6 @@ struct sysv_dir_entry { #define SYSV_DIRSIZE sizeof(struct sysv_dir_entry) /* size of every directory entry */ -#ifdef __KERNEL__ - /* Operations */ /* ========== */ @@ -335,23 +333,25 @@ struct sysv_dir_entry { #define SYSV2_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_SYSV2) #define COH_SUPER_MAGIC (SYSV_MAGIC_BASE+FSTYPE_COH) +#ifdef __KERNEL__ + /* sv_get_hash_table(sb,dev,block) is equivalent to get_hash_table(dev,block,block_size) */ static inline struct buffer_head * -sv_get_hash_table (struct super_block *sb, int dev, unsigned int block) +sv_get_hash_table (struct super_block *sb, kdev_t dev, unsigned int block) { return get_hash_table (dev, block + sb->sv_block_base, sb->sv_block_size); } /* sv_getblk(sb,dev,block) is equivalent to getblk(dev,block,block_size) */ static inline struct buffer_head * -sv_getblk (struct super_block *sb, int dev, unsigned int block) +sv_getblk (struct super_block *sb, kdev_t dev, unsigned int block) { return getblk (dev, block + sb->sv_block_base, sb->sv_block_size); } /* sv_bread(sb,dev,block) is equivalent to bread(dev,block,block_size) */ static inline struct buffer_head * -sv_bread (struct super_block *sb, int dev, unsigned int block) +sv_bread (struct super_block *sb, kdev_t dev, unsigned int block) { return bread (dev, block + sb->sv_block_base, sb->sv_block_size); } @@ -362,7 +362,7 @@ sv_bread (struct super_block *sb, int dev, unsigned int block) */ extern int sysv_lookup(struct inode * dir,const char * name, int len, - struct inode ** result); + struct inode ** result); extern int sysv_create(struct inode * dir,const char * name, int len, int mode, struct inode ** result); extern int sysv_mkdir(struct inode * dir, const char * name, int len, int mode); @@ -373,7 +373,7 @@ extern int sysv_symlink(struct inode * inode, const char * name, int len, extern int sysv_link(struct inode * oldinode, struct inode * dir, const char * name, int len); extern int sysv_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int sysv_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len); + struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); extern struct inode * sysv_new_inode(const struct inode * dir); extern void sysv_free_inode(struct inode * inode); extern unsigned long sysv_count_free_inodes(struct super_block *sb); @@ -385,11 +385,12 @@ extern int sysv_bmap(struct inode *,int); extern struct buffer_head * sysv_getblk(struct inode *, unsigned int, int); extern struct buffer_head * sysv_file_bread(struct inode *, int, int); -extern int sysv_file_read(struct inode *, struct file *, char *, int); +extern long sysv_file_read(struct inode *, struct file *, char *, unsigned long); extern void sysv_truncate(struct inode *); extern void sysv_put_super(struct super_block *); extern struct super_block *sysv_read_super(struct super_block *,void *,int); +extern int init_sysv_fs(void); extern void sysv_write_super(struct super_block *); extern void sysv_read_inode(struct inode *); extern int sysv_notify_change(struct inode *, struct iattr *); diff --git a/include/linux/tasks.h b/include/linux/tasks.h index 050bb3875..4540e34f0 100644 --- a/include/linux/tasks.h +++ b/include/linux/tasks.h @@ -4,6 +4,13 @@ /* * This is the maximum nr of tasks - change it if you need to */ + +#ifdef __SMP__ +#define NR_CPUS 32 /* Max processors that can be running in SMP */ +#else +#define NR_CPUS 1 +#endif + #define NR_TASKS 512 #define MAX_TASKS_PER_USER (NR_TASKS/2) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 7c95e5d02..89e42d849 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -17,16 +17,17 @@ #ifndef _LINUX_TCP_H #define _LINUX_TCP_H +#include <asm/byteorder.h> -#define HEADER_SIZE 128 /* maximum header size */ - +#include <linux/types.h> +#include <asm/byteorder.h> struct tcphdr { __u16 source; __u16 dest; __u32 seq; __u32 ack_seq; -#if defined(LITTLE_ENDIAN_BITFIELD) +#if defined(__LITTLE_ENDIAN_BITFIELD) __u16 res1:4, doff:4, fin:1, @@ -36,7 +37,7 @@ struct tcphdr { ack:1, urg:1, res2:2; -#elif defined(BIG_ENDIAN_BITFIELD) +#elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, res1:4, res2:2, diff --git a/include/linux/termios.h b/include/linux/termios.h index 5a01ae381..478662889 100644 --- a/include/linux/termios.h +++ b/include/linux/termios.h @@ -2,257 +2,6 @@ #define _LINUX_TERMIOS_H #include <linux/types.h> - -/* 0x54 is just a magic number to make these relatively unique ('T') */ - -#define TCGETS 0x5401 -#define TCSETS 0x5402 -#define TCSETSW 0x5403 -#define TCSETSF 0x5404 -#define TCGETA 0x5405 -#define TCSETA 0x5406 -#define TCSETAW 0x5407 -#define TCSETAF 0x5408 -#define TCSBRK 0x5409 -#define TCXONC 0x540A -#define TCFLSH 0x540B -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCOUTQ 0x5411 -#define TIOCSTI 0x5412 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define FIONREAD 0x541B -#define TIOCINQ FIONREAD -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -#define FIONBIO 0x5421 -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ -#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ -#define FIOCLEX 0x5451 -#define FIOASYNC 0x5452 -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 8 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 +#include <asm/termios.h> #endif diff --git a/include/linux/time.h b/include/linux/time.h index a6ce36c8c..47246a142 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -1,6 +1,14 @@ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H +#ifndef _STRUCT_TIMESPEC +#define _STRUCT_TIMESPEC +struct timespec { + long tv_sec; /* seconds */ + long tv_nsec; /* nanoseconds */ +}; +#endif /* _STRUCT_TIMESPEC */ + struct timeval { int tv_sec; /* seconds */ int tv_usec; /* microseconds */ @@ -15,20 +23,16 @@ struct timezone { #ifdef __KERNEL__ void do_gettimeofday(struct timeval *tv); -#include <asm/bitops.h> -#include <linux/string.h> -#define FD_SETSIZE __FD_SETSIZE -#define FD_SET(fd,fdsetp) set_bit(fd,fdsetp) -#define FD_CLR(fd,fdsetp) clear_bit(fd,fdsetp) -#define FD_ISSET(fd,fdsetp) (0 != test_bit(fd,fdsetp)) -#define FD_ZERO(fdsetp) memset(fdsetp, 0, sizeof(struct fd_set)) -#else +void do_settimeofday(struct timeval *tv); +void get_fast_time(struct timeval *tv); +void (*do_get_fast_time)(struct timeval *); +#endif + #define FD_SETSIZE __FD_SETSIZE #define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp) #define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp) #define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp) #define FD_ZERO(fdsetp) __FD_ZERO(fdsetp) -#endif /* * Names of the interval timers, and structure @@ -38,6 +42,11 @@ void do_gettimeofday(struct timeval *tv); #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 +struct itimerspec { + struct timespec it_interval; /* timer period */ + struct timespec it_value; /* timer expiration */ +}; + struct itimerval { struct timeval it_interval; /* timer interval */ struct timeval it_value; /* current value */ diff --git a/include/linux/timer.h b/include/linux/timer.h index acb9ca26e..b922d0dbb 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -14,6 +14,8 @@ * BEEP_TIMER console beep timer * * RS_TIMER timer for the RS-232 ports + * + * SWAP_TIMER timer for the background pageout daemon * * HD_TIMER harddisk timer * @@ -31,11 +33,14 @@ * * MCD_TIMER Mitsumi CD-ROM Timer * + * GSCD_TIMER Goldstar CD-ROM Timer + * */ #define BLANK_TIMER 0 #define BEEP_TIMER 1 #define RS_TIMER 2 +#define SWAP_TIMER 3 #define HD_TIMER 16 #define FLOPPY_TIMER 17 @@ -48,6 +53,9 @@ #define MCD_TIMER 23 #define HD_TIMER2 24 +#define GSCD_TIMER 25 + +#define DIGI_TIMER 29 struct timer_struct { unsigned long expires; @@ -81,6 +89,8 @@ struct timer_list { extern void add_timer(struct timer_list * timer); extern int del_timer(struct timer_list * timer); +extern void it_real_fn(unsigned long); + extern inline void init_timer(struct timer_list * timer) { timer->next = NULL; diff --git a/include/linux/timex.h b/include/linux/timex.h index ce82e020f..ff5420832 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -16,82 +16,161 @@ /* * Modification history timex.h - * + * + * 26 Sep 94 David L. Mills + * Added defines for hybrid phase/frequency-lock loop. + * + * 19 Mar 94 David L. Mills + * Moved defines from kernel routines to header file and added new + * defines for PPS phase-lock loop. + * + * 20 Feb 94 David L. Mills + * Revised status codes and structures for external clock and PPS + * signal discipline. + * + * 28 Nov 93 David L. Mills + * Adjusted parameters to improve stability and increase poll + * interval. + * * 17 Sep 93 David L. Mills * Created file $NTP/include/sys/timex.h * 07 Oct 93 Torsten Duwe * Derived linux/timex.h + * 1995-08-13 Torsten Duwe + * kernel PLL updated to 1994-12-13 specs (rfc-1589) */ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H /* * The following defines establish the engineering parameters of the PLL - * model. The HZ variable establishes the timer interrupt frequency, 100 Hz + * model. The HZ variable establishes the timer interrupt frequency, 100 Hz * for the SunOS kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the * OSF/1 kernel. The SHIFT_HZ define expresses the same value as the * nearest power of two in order to avoid hardware multiply operations. */ -#define SHIFT_HZ 7 /* log2(HZ) */ +#ifdef __alpha__ +# define SHIFT_HZ 10 /* log2(HZ) */ +#else +# define SHIFT_HZ 7 /* log2(HZ) */ +#endif /* - * The SHIFT_KG and SHIFT_KF defines establish the damping of the PLL - * and are chosen by analysis for a slightly underdamped convergence - * characteristic. The MAXTC define establishes the maximum time constant - * of the PLL. With the parameters given and the default time constant of - * zero, the PLL will converge in about 15 minutes. + * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen + * for a slightly underdamped convergence characteristic. SHIFT_KH + * establishes the damping of the FLL and is chosen by wisdom and black + * art. + * + * MAXTC establishes the maximum time constant of the PLL. With the + * SHIFT_KG and SHIFT_KF values given and a time constant range from + * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, + * respectively. */ -#define SHIFT_KG 8 /* shift for phase increment */ -#define SHIFT_KF 20 /* shift for frequency increment */ +#define SHIFT_KG 6 /* phase factor (shift) */ +#define SHIFT_KF 16 /* PLL frequency factor (shift) */ +#define SHIFT_KH 2 /* FLL frequency factor (shift) */ #define MAXTC 6 /* maximum time constant (shift) */ /* * The SHIFT_SCALE define establishes the decimal point of the time_phase - * variable which serves as a an extension to the low-order bits of the + * variable which serves as an extension to the low-order bits of the * system clock variable. The SHIFT_UPDATE define establishes the decimal * point of the time_offset variable which represents the current offset * with respect to standard time. The FINEUSEC define represents 1 usec in * scaled units. + * + * SHIFT_USEC defines the scaling (shift) of the time_freq and + * time_tolerance variables, which represent the current frequency + * offset and maximum frequency tolerance. + * + * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. */ -#define SHIFT_SCALE 24 /* shift for phase scale factor */ -#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* shift for offset scale factor */ -#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in scaled units */ +#define SHIFT_SCALE 22 /* phase scale (shift) */ +#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ +#define SHIFT_USEC 16 /* frequency offset scale (shift) */ +#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ -#define MAXPHASE 128000 /* max phase error (us) */ -#define MAXFREQ 100 /* max frequency error (ppm) */ -#define MINSEC 16 /* min interval between updates (s) */ -#define MAXSEC 1200 /* max interval between updates (s) */ +#define MAXPHASE 512000L /* max phase error (us) */ +#define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ +#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ +#define MINSEC 16L /* min interval between updates (s) */ +#define MAXSEC 1200L /* max interval between updates (s) */ +/* + * The following defines are used only if a pulse-per-second (PPS) + * signal is available and connected via a modem control lead, such as + * produced by the optional ppsclock feature incorporated in the Sun + * asynch driver. They establish the design parameters of the frequency- + * lock loop used to discipline the CPU clock oscillator to the PPS + * signal. + * + * PPS_AVG is the averaging factor for the frequency loop, as well as + * the time and frequency dispersion. + * + * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum + * calibration intervals, respectively, in seconds as a power of two. + * + * PPS_VALID is the maximum interval before the PPS signal is considered + * invalid and protocol updates used directly instead. + * + * MAXGLITCH is the maximum interval before a time offset of more than + * MAXTIME is believed. + */ +#define PPS_AVG 2 /* pps averaging constant (shift) */ +#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ +#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ +#define PPS_VALID 120 /* pps signal watchdog max (s) */ +#define MAXGLITCH 30 /* pps signal glitch max (s) */ + +#ifndef __alpha__ +/* + * This definitively is wrong for the Alpha and none of the + * kernel code seems to reference this anymore. + */ #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ -#define FINETUNE (((((LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ +#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \ << (SHIFT_SCALE-SHIFT_HZ)) / HZ) +#endif /* !__alpha__ */ /* * syscall interface - used (mainly by NTP daemon) * to discipline kernel clock oscillator */ struct timex { - int mode; /* mode selector */ + unsigned int modes; /* mode selector */ long offset; /* time offset (usec) */ - long frequency; /* frequency offset (scaled ppm) */ + long freq; /* frequency offset (scaled ppm) */ long maxerror; /* maximum error (usec) */ long esterror; /* estimated error (usec) */ int status; /* clock command/status */ - long time_constant; /* pll time constant */ + long constant; /* pll time constant */ long precision; /* clock precision (usec) (read only) */ long tolerance; /* clock frequency tolerance (ppm) * (read only) */ struct timeval time; /* (read only) */ long tick; /* (modified) usecs between clock ticks */ + + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; }; /* - * Mode codes (timex.mode) + * Mode codes (timex.mode) */ #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ @@ -102,18 +181,56 @@ struct timex { #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ +/* xntp 3.4 compatibility names */ +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ + + +/* + * Status codes (timex.status) + */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ + /* - * Clock command/status codes (timex.status) + * Clock states (time_state) */ -#define TIME_OK 0 /* clock synchronized */ +#define TIME_OK 0 /* clock synchronized, no leap second */ #define TIME_INS 1 /* insert leap second */ #define TIME_DEL 2 /* delete leap second */ #define TIME_OOP 3 /* leap second in progress */ -#define TIME_BAD 4 /* clock not synchronized */ +#define TIME_WAIT 4 /* leap second has occurred */ +#define TIME_ERROR 5 /* clock not synchronized */ +#define TIME_BAD TIME_ERROR /* bw compat */ #ifdef __KERNEL__ /* * kernel variables + * Note: maximum error = NTP synch distance = dispersion + delay / 2; + * estimated error = NTP dispersion. */ extern long tick; /* timer interrupt period */ extern int tickadj; /* amount of adjustment per tick */ @@ -121,19 +238,36 @@ extern int tickadj; /* amount of adjustment per tick */ /* * phase-lock loop variables */ -extern int time_status; /* clock synchronization status */ +extern int time_state; /* clock status */ +extern int time_status; /* clock synchronization status bits */ extern long time_offset; /* time adjustment (us) */ extern long time_constant; /* pll time constant */ extern long time_tolerance; /* frequency tolerance (ppm) */ extern long time_precision; /* clock precision (us) */ extern long time_maxerror; /* maximum error */ extern long time_esterror; /* estimated error */ + extern long time_phase; /* phase offset (scaled us) */ extern long time_freq; /* frequency offset (scaled ppm) */ extern long time_adj; /* tick adjust (scaled 1 / HZ) */ extern long time_reftime; /* time at last adjustment (s) */ extern long time_adjust; /* The amount of adjtime left */ + +/* interface variables pps->timer interrupt */ +extern long pps_offset; /* pps time offset (us) */ +extern long pps_jitter; /* time dispersion (jitter) (us) */ +extern long pps_freq; /* frequency offset (scaled ppm) */ +extern long pps_stabil; /* frequency dispersion (scaled ppm) */ +extern long pps_valid; /* pps signal watchdog counter */ + +/* interface variables pps->adjtimex */ +extern int pps_shift; /* interval duration (s) (shift) */ +extern long pps_jitcnt; /* jitter limit exceeded */ +extern long pps_calcnt; /* calibration intervals */ +extern long pps_errcnt; /* calibration errors */ +extern long pps_stbcnt; /* stability limit exceeded */ + #endif /* KERNEL */ #endif /* LINUX_TIMEX_H */ diff --git a/include/linux/tpqic02.h b/include/linux/tpqic02.h index 8a824f7d0..d25fd465a 100644 --- a/include/linux/tpqic02.h +++ b/include/linux/tpqic02.h @@ -628,34 +628,6 @@ typedef char flag; #define BLOCKS_BEYOND_EW 2 /* nr of blocks after Early Warning hole */ #define BOGUS_IRQ 32009 -/* structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended - * as an interim solution for QIC-02 until DDI is fully implemented. - */ -struct mtconfiginfo { - long mt_type; /* drive type */ - long ifc_type; /* interface card type */ - unsigned short irqnr; /* IRQ number to use */ - unsigned short dmanr; /* DMA channel to use */ - unsigned short port; /* IO port base address */ - - unsigned long debug; /* debugging flags */ - - unsigned have_dens:1; - unsigned have_bsf:1; - unsigned have_fsr:1; - unsigned have_bsr:1; - unsigned have_eod:1; - unsigned have_seek:1; - unsigned have_tell:1; - unsigned have_ras1:1; - unsigned have_ras2:1; - unsigned have_ras3:1; - unsigned have_qfa:1; - - unsigned pad1:5; - char reserved[10]; -}; - /* This is internal data, filled in based on the ifc_type field given * by the user. Everex is mapped to Wangtek with a different @@ -685,7 +657,7 @@ struct qic02_ccb { }; -extern long qic02_tape_init(long); /* for mem.c */ +extern int qic02_tape_init(void); /* for mem.c */ #endif /* CONFIG_QIC02_TAPE */ diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h index a5a15173a..8bd4e7f30 100644 --- a/include/linux/tqueue.h +++ b/include/linux/tqueue.h @@ -16,12 +16,6 @@ #include <asm/bitops.h> #include <asm/system.h> -#ifdef INCLUDE_INLINE_FUNCS -#define _INLINE_ extern -#else -#define _INLINE_ extern __inline__ -#endif - /* * New proposed "bottom half" handlers: * (C) 1994 Kai Petzke, wpp@marie.physik.tu-berlin.de @@ -54,22 +48,15 @@ struct tq_struct { typedef struct tq_struct * task_queue; -#define DECLARE_TASK_QUEUE(q) task_queue q = &tq_last - -extern struct tq_struct tq_last; -extern task_queue tq_timer, tq_immediate, tq_scheduler; +#define DECLARE_TASK_QUEUE(q) task_queue q = NULL -#ifdef INCLUDE_INLINE_FUNCS -struct tq_struct tq_last = { - &tq_last, 0, 0, 0 -}; -#endif +extern task_queue tq_timer, tq_immediate, tq_scheduler, tq_disk; /* * To implement your own list of active bottom halfs, use the following * two definitions: * - * struct tq_struct *my_bh = &tq_last; + * struct tq_struct *my_bh = NULL; * struct tq_struct run_my_bh = { * 0, 0, (void *)(void *) run_task_queue, &my_bh * }; @@ -92,7 +79,7 @@ struct tq_struct tq_last = { * "bh_list". You may call this function only from an interrupt * handler or a bottom half handler. */ -_INLINE_ void queue_task_irq(struct tq_struct *bh_pointer, +extern __inline__ void queue_task_irq(struct tq_struct *bh_pointer, task_queue *bh_list) { if (!set_bit(0,&bh_pointer->sync)) { @@ -105,7 +92,7 @@ _INLINE_ void queue_task_irq(struct tq_struct *bh_pointer, * queue_task_irq_off: put the bottom half handler "bh_pointer" on the list * "bh_list". You may call this function only when interrupts are off. */ -_INLINE_ void queue_task_irq_off(struct tq_struct *bh_pointer, +extern __inline__ void queue_task_irq_off(struct tq_struct *bh_pointer, task_queue *bh_list) { if (!(bh_pointer->sync & 1)) { @@ -119,7 +106,7 @@ _INLINE_ void queue_task_irq_off(struct tq_struct *bh_pointer, /* * queue_task: as queue_task_irq, but can be called from anywhere. */ -_INLINE_ void queue_task(struct tq_struct *bh_pointer, +extern __inline__ void queue_task(struct tq_struct *bh_pointer, task_queue *bh_list) { if (!set_bit(0,&bh_pointer->sync)) { @@ -135,29 +122,22 @@ _INLINE_ void queue_task(struct tq_struct *bh_pointer, /* * Call all "bottom halfs" on a given list. */ -_INLINE_ void run_task_queue(task_queue *list) +extern __inline__ void run_task_queue(task_queue *list) { - register struct tq_struct *save_p; - register struct tq_struct *p; - void *arg; - void (*f) (void *); - - while(1) { - p = xchg_ptr(list,&tq_last); - if(p == &tq_last) - break; - - do { - arg = p -> data; - f = p -> routine; - save_p = p -> next; - p -> sync = 0; - (*f)(arg); - p = save_p; - } while(p != &tq_last); + struct tq_struct *p; + + p = xchg(list,NULL); + while (p) { + void *arg; + void (*f) (void *); + struct tq_struct *save_p; + arg = p -> data; + f = p -> routine; + save_p = p; + p = p -> next; + save_p -> sync = 0; + (*f)(arg); } } -#undef _INLINE_ - #endif /* _LINUX_TQUEUE_H */ diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h index f2e09fa98..96801763d 100644 --- a/include/linux/trdevice.h +++ b/include/linux/trdevice.h @@ -28,10 +28,9 @@ #include <linux/if_tr.h> #ifdef __KERNEL__ -extern int tr_header(unsigned char *buff, struct device *dev, +extern int tr_header(struct sk_buff *skb, struct device *dev, unsigned short type, void *daddr, - void *saddr, unsigned len, - struct sk_buff *skb); + void *saddr, unsigned len); extern int tr_rebuild_header(void *buff, struct device *dev, unsigned long raddr, struct sk_buff *skb); extern unsigned short tr_type_trans(struct sk_buff *skb, struct device *dev); diff --git a/include/linux/tty.h b/include/linux/tty.h index d3761847c..c965cd287 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -5,6 +5,16 @@ * 'tty.h' defines some structures used by tty_io.c and some defines. */ +/* + * These constants are also useful for user-level apps (e.g., VC + * resizing). + */ +#define MIN_NR_CONSOLES 1 /* must be at least 1 */ +#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ +#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */ + /* Note: the ioctl VT_GETSTATE does not work for + consoles 16 and higher (since it returns a short) */ + #ifdef __KERNEL__ #include <linux/fs.h> #include <linux/termios.h> @@ -21,12 +31,7 @@ * (Note: the *_driver.minor_start values 1, 64, 128, 192 are * hardcoded at present.) */ -#define MIN_NR_CONSOLES 1 /* must be at least 1 */ -#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ -#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */ - /* Note: the ioctl VT_GETSTATE does not work for - consoles 16 and higher (since it returns a short) */ -#define NR_PTYS 64 +#define NR_PTYS 256 #define NR_LDISCS 16 /* @@ -40,30 +45,38 @@ struct screen_info { unsigned short orig_video_page; unsigned char orig_video_mode; unsigned char orig_video_cols; - unsigned short orig_video_ega_ax; + unsigned short unused2; unsigned short orig_video_ega_bx; - unsigned short orig_video_ega_cx; + unsigned short unused3; unsigned char orig_video_lines; + unsigned char orig_video_isVGA; + unsigned short orig_video_points; }; extern struct screen_info screen_info; #define ORIG_X (screen_info.orig_x) #define ORIG_Y (screen_info.orig_y) -#define ORIG_VIDEO_PAGE (screen_info.orig_video_page) #define ORIG_VIDEO_MODE (screen_info.orig_video_mode) #define ORIG_VIDEO_COLS (screen_info.orig_video_cols) -#define ORIG_VIDEO_EGA_AX (screen_info.orig_video_ega_ax) #define ORIG_VIDEO_EGA_BX (screen_info.orig_video_ega_bx) -#define ORIG_VIDEO_EGA_CX (screen_info.orig_video_ega_cx) #define ORIG_VIDEO_LINES (screen_info.orig_video_lines) +#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA) +#define ORIG_VIDEO_POINTS (screen_info.orig_video_points) #define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */ #define VIDEO_TYPE_CGA 0x11 /* CGA Display */ #define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */ +#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ +#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ #define VIDEO_TYPE_EGAC 0x21 /* EGA/VGA in Color Mode */ #define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */ -#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ +#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */ +#define VIDEO_TYPE_SNI_RM 0x31 /* SNI RM200 PCI video */ + +#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ + +#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */ /* * This character is the same as _POSIX_VDISABLE: it cannot be used as @@ -200,7 +213,7 @@ struct tty_struct { struct termios *termios, *termios_locked; int pgrp; int session; - dev_t device; + kdev_t device; unsigned long flags; int count; struct winsize winsize; @@ -252,12 +265,14 @@ struct tty_struct { */ #define TTY_THROTTLED 0 #define TTY_IO_ERROR 1 -#define TTY_SLAVE_CLOSED 2 +#define TTY_OTHER_CLOSED 2 #define TTY_EXCLUSIVE 3 #define TTY_DEBUG 4 #define TTY_DO_WRITE_WAKEUP 5 #define TTY_PUSH 6 #define TTY_CLOSING 7 +#define TTY_HW_COOK_OUT 14 +#define TTY_HW_COOK_IN 15 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) @@ -266,28 +281,25 @@ extern void tty_write_flush(struct tty_struct *); extern struct termios tty_std_termios; extern struct tty_struct * redirect; extern struct tty_ldisc ldiscs[]; -extern int fg_console; +extern int fg_console, last_console, want_console; + +extern int kmsg_redirect; extern struct wait_queue * keypress_wait; -/* intr=^C quit=^| erase=del kill=^U - eof=^D vtime=\0 vmin=\1 sxtc=\0 - start=^Q stop=^S susp=^Z eol=\0 - reprint=^R discard=^U werase=^W lnext=^V - eol2=\0 -*/ -#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" - -extern long rs_init(long); -extern long lp_init(long); -extern long con_init(long); -extern long pty_init(long); -extern long tty_init(long); -extern long vcs_init(long); -#ifdef CONFIG_CYCLADES -extern long cy_init(long); -#endif +extern unsigned long con_init(unsigned long); + +extern int rs_init(void); +extern int lp_init(void); +extern int pty_init(void); +extern int tty_init(void); +extern int pcxe_init(void); +extern int vcs_init(void); +extern int cy_init(void); +extern int stl_init(void); +extern int stli_init(void); +extern int riscom8_init(void); -extern int tty_paranoia_check(struct tty_struct *tty, dev_t device, +extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device, const char *routine); extern char *_tty_name(struct tty_struct *tty, char *buf); extern char *tty_name(struct tty_struct *tty); @@ -300,6 +312,7 @@ extern int tty_register_driver(struct tty_driver *driver); extern int tty_unregister_driver(struct tty_driver *driver); extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, int buflen); +extern void tty_write_message(struct tty_struct *tty, char *msg); extern int is_orphaned_pgrp(int pgrp); extern int is_ignored(int sig); @@ -325,11 +338,13 @@ extern int rs_open(struct tty_struct * tty, struct file * filp); /* pty.c */ extern int pty_open(struct tty_struct * tty, struct file * filp); +extern int pcxe_open(struct tty_struct *tty, struct file *filp); /* console.c */ extern int con_open(struct tty_struct * tty, struct file * filp); extern void update_screen(int new_console); +extern void console_print(const char *); /* vt.c */ diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 6008f6343..244122047 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -18,7 +18,7 @@ * This routine is called when a particular tty device is closed. * * int (*write)(struct tty_struct * tty, int from_user, - * unsigned char *buf, int count); + * const unsigned char *buf, int count); * * This routine is called by the kernel to write a series of * characters to the tty device. The characters may come from @@ -91,14 +91,23 @@ * * This routine notifies the tty driver that it should hangup the * tty device. + * + * void (*wait_until_sent)(struct tty_struct *tty, int timeout); * + * This routine waits until the device has written out all of the + * characters in its transmitter FIFO. + * + * void (*send_xchar)(struct tty_struct *tty, char ch); + * + * This routine is used to send a high-priority XON/XOFF + * character to the device. */ #include <linux/fs.h> struct tty_driver { int magic; /* magic number for this structure */ - char *name; + const char *name; int name_base; /* offset of printed name */ short major; /* major device number */ short minor_start; /* start of minor device number*/ @@ -124,7 +133,7 @@ struct tty_driver { int (*open)(struct tty_struct * tty, struct file * filp); void (*close)(struct tty_struct * tty, struct file * filp); int (*write)(struct tty_struct * tty, int from_user, - unsigned char *buf, int count); + const unsigned char *buf, int count); void (*put_char)(struct tty_struct *tty, unsigned char ch); void (*flush_chars)(struct tty_struct *tty); int (*write_room)(struct tty_struct *tty); @@ -139,6 +148,8 @@ struct tty_driver { void (*hangup)(struct tty_struct *tty); void (*flush_buffer)(struct tty_struct *tty); void (*set_ldisc)(struct tty_struct *tty); + void (*wait_until_sent)(struct tty_struct *tty, int timeout); + void (*send_xchar)(struct tty_struct *tty, char ch); /* * linked list pointers diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 732f5a115..05a33261d 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -2,7 +2,100 @@ #define _LINUX_TTY_LDISC_H /* - * Definitions for the tty line discipline + * This structure defines the interface between the tty line discpline + * implementation and the tty routines. The following routines can be + * defined; unless noted otherwise, they are optional, and can be + * filled in with a null pointer. + * + * int (*open)(struct tty_struct *); + * + * This function is called when the line discpline is associated + * with the tty. The line discpline can use this as an + * opportunity to initialize any state needed by the ldisc routines. + * + * void (*close)(struct tty_struct *); + * + * This function is called when the line discpline is being + * shutdown, either because the tty is being closed or because + * the tty is being changed to use a new line discpline + * + * void (*flush_buffer)(struct tty_struct *tty); + * + * This function instructs the line discipline to clear its + * buffers of any input characters it may have queued to be + * delivered to the user mode process. + * + * int (*chars_in_buffer)(struct tty_struct *tty); + * + * This function returns the number of input characters the line + * iscpline may have queued up to be delivered to the user mode + * process. + * + * int (*read)(struct tty_struct * tty, struct file * file, + * unsigned char * buf, unsigned int nr); + * + * This function is called when the user requests to read from + * the tty. The line discpline will return whatever characters + * it has buffered up for the user. If this function is not + * defined, the user will receive an EIO error. + * + * int (*write)(struct tty_struct * tty, struct file * file, + * const unsigned char * buf, unsigned int nr); + * + * This function is called when the user requests to write to the + * tty. The line discpline will deliver the characters to the + * low-level tty device for transmission, optionally performing + * some processing on the characters first. If this function is + * not defined, the user will receive an EIO error. + * + * int (*ioctl)(struct tty_struct * tty, struct file * file, + * unsigned int cmd, unsigned long arg); + * + * This function is called when the user requests an ioctl which + * is not handled by the tty layer or the low-level tty driver. + * It is intended for ioctls which affect line discpline + * operation. Not that the search order for ioctls is (1) tty + * layer, (2) tty low-level driver, (3) line discpline. So a + * low-level driver can "grab" an ioctl request before the line + * discpline has a chance to see it. + * + * void (*set_termios)(struct tty_struct *tty, struct termios * old); + * + * This function notifies the line discpline that a change has + * been made to the termios stucture. + * + * int (*select)(struct tty_struct * tty, struct inode * inode, + * struct file * file, int sel_type, + * struct select_table_struct *wait); + * + * This function is called when a user attempts to select on a + * tty device. It is solely the responsibility of the line + * discipline to handle select requests. + * + * void (*receive_buf)(struct tty_struct *, const unsigned char *cp, + * char *fp, int count); + * + * This function is called by the low-level tty driver to send + * characters received by the hardware to the line discpline for + * processing. <cp> is a pointer to the buffer of input + * character received by the device. <fp> is a pointer to a + * pointer of flag bytes which indicate whether a character was + * received with a parity error, etc. + * + * int (*receive_room)(struct tty_struct *); + * + * This function is called by the low-level tty driver to + * determine how many characters the line discpline can accept. + * The low-level driver must not send more characters than was + * indicated by receive_room, or the line discpline may drop + * those characters. + * + * void (*write_wakeup)(struct tty_struct *); + * + * This function is called by the low-level tty driver to signal + * that line discpline should try to send more characters to the + * low-level driver for transmission. If the line discpline does + * not have any more data to send, it can just return. */ #include <linux/fs.h> @@ -22,7 +115,7 @@ struct tty_ldisc { int (*read)(struct tty_struct * tty, struct file * file, unsigned char * buf, unsigned int nr); int (*write)(struct tty_struct * tty, struct file * file, - unsigned char * buf, unsigned int nr); + const unsigned char * buf, unsigned int nr); int (*ioctl)(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg); void (*set_termios)(struct tty_struct *tty, struct termios * old); @@ -33,7 +126,7 @@ struct tty_ldisc { /* * The following routines are called from below. */ - void (*receive_buf)(struct tty_struct *, unsigned char *cp, + void (*receive_buf)(struct tty_struct *, const unsigned char *cp, char *fp, int count); int (*receive_room)(struct tty_struct *); void (*write_wakeup)(struct tty_struct *); diff --git a/include/linux/types.h b/include/linux/types.h index a06f4020d..7f98711a4 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,73 +1,85 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#include <linux/posix_types.h> #include <asm/types.h> -#ifndef NULL -#define NULL ((void *) 0) -#endif +#ifndef __KERNEL_STRICT_NAMES + +typedef __kernel_fd_set fd_set; +typedef __kernel_dev_t dev_t; +typedef __kernel_ino_t ino_t; +typedef __kernel_mode_t mode_t; +typedef __kernel_nlink_t nlink_t; +typedef __kernel_off_t off_t; +typedef __kernel_pid_t pid_t; +typedef __kernel_uid_t uid_t; +typedef __kernel_gid_t gid_t; +typedef __kernel_daddr_t daddr_t; +typedef __kernel_key_t key_t; #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define _LOFF_T -typedef long long loff_t; +typedef __kernel_loff_t loff_t; #endif -/* bsd */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; +/* + * The following typedefs are also protected by individual ifdefs for + * historical reasons: + */ +#ifndef _SIZE_T +#define _SIZE_T +typedef __kernel_size_t size_t; +#endif -/* sysv */ -typedef unsigned char unchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; +#ifndef _SSIZE_T +#define _SSIZE_T +typedef __kernel_ssize_t ssize_t; +#endif -typedef char *caddr_t; +#ifndef _PTRDIFF_T +#define _PTRDIFF_T +typedef __kernel_ptrdiff_t ptrdiff_t; +#endif -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; +#ifndef _TIME_T +#define _TIME_T +typedef __kernel_time_t time_t; +#endif -/* - * This allows for 256 file descriptors: if NR_OPEN is ever grown beyond that - * you'll have to change this too. But 256 fd's seem to be enough even for such - * "real" unices like SunOS, so hopefully this is one limit that doesn't have - * to be changed. - * - * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in <sys/time.h> - * (and thus <linux/time.h>) - but this is a more logical place for them. Solved - * by having dummy defines in <sys/time.h>. - */ +#ifndef _CLOCK_T +#define _CLOCK_T +typedef __kernel_clock_t clock_t; +#endif -/* - * Those macros may have been defined in <gnu/types.h>. But we always - * use the ones here. - */ -#undef __FDSET_LONGS -#define __FDSET_LONGS 8 +#ifndef _CADDR_T +#define _CADDR_T +typedef __kernel_caddr_t caddr_t; +#endif -typedef struct fd_set { - unsigned long fds_bits [__FDSET_LONGS]; -} fd_set; +/* bsd */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; -#undef __NFDBITS -#define __NFDBITS (8 * sizeof(unsigned long)) +/* sysv */ +typedef unsigned char unchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; -#undef __FD_SETSIZE -#define __FD_SETSIZE (__FDSET_LONGS*__NFDBITS) +#endif /* __KERNEL_STRICT_NAMES */ /* - * Include machine dependent assembler stuff + * Below are truly Linux-specific types that should never collide with + * any application/library that wants linux/types.h. */ -#include <asm/types.h> struct ustat { - daddr_t f_tfree; - ino_t f_tinode; - char f_fname[6]; - char f_fpack[6]; + __kernel_daddr_t f_tfree; + __kernel_ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; }; -#endif +#endif /* _LINUX_TYPES_H */ diff --git a/include/linux/ucdrom.h b/include/linux/ucdrom.h new file mode 100644 index 000000000..6cf5c05b3 --- /dev/null +++ b/include/linux/ucdrom.h @@ -0,0 +1,114 @@ +/* ucdrom.h. Uniform cdrom data structures for cdrom.c. -*- linux-c -*- + Copyright (c) 1996 David van Leeuwen. + */ + +#ifndef LINUX_UCDROM_H +#define LINUX_UCDROM_H + +#ifdef __KERNEL__ +struct cdrom_device_info { + struct cdrom_device_ops *ops; /* link to device_ops */ + struct cdrom_device_info *next; /* next device_info for this major */ + void *handle; /* driver-dependent data */ +/* specifications */ + kdev_t dev; /* device number */ + int mask; /* mask of capability: disables them */ + int speed; /* maximum speed for reading data */ + int capacity; /* number of discs in jukebox */ +/* device-related storage */ + int options : 30; /* options flags */ + unsigned mc_flags : 2; /* media change buffer flags */ + int use_count; /* number of times device opened */ +}; + +struct cdrom_device_ops { +/* routines */ + int (*open) (struct cdrom_device_info *, int); + void (*release) (struct cdrom_device_info *); + int (*drive_status) (struct cdrom_device_info *, int); + int (*disc_status) (struct cdrom_device_info *); + int (*media_changed) (struct cdrom_device_info *, int); + int (*tray_move) (struct cdrom_device_info *, int); + int (*lock_door) (struct cdrom_device_info *, int); + int (*select_speed) (struct cdrom_device_info *, int); + int (*select_disc) (struct cdrom_device_info *, int); + int (*get_last_session) (struct cdrom_device_info *, + struct cdrom_multisession *); + int (*get_mcn) (struct cdrom_device_info *, + struct cdrom_mcn *); + /* hard reset device */ + int (*reset) (struct cdrom_device_info *); + /* play stuff */ + int (*audio_ioctl) (struct cdrom_device_info *,unsigned int, void *); + /* dev-specific */ + int (*dev_ioctl) (struct cdrom_device_info *, + unsigned int, unsigned long); +/* driver specifications */ + const int capability; /* capability flags */ + int n_minors; /* number of active minor devices */ +}; +#endif + +/* capability flags */ +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ +#define CDC_LOCK 0x4 /* disable manual eject */ +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ +#define CDC_MCN 0x40 /* Medium Catalog Number */ +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ + +/* drive status possibilities */ +#define CDS_NO_INFO 0 /* if not implemented */ +#define CDS_NO_DISC 1 +#define CDS_TRAY_OPEN 2 +#define CDS_DRIVE_NOT_READY 3 +#define CDS_DISC_OK 4 + +/* disc status possibilities, other than CDS_NO_DISC */ +#define CDS_AUDIO 100 +#define CDS_DATA_1 101 +#define CDS_DATA_2 102 +#define CDS_XA_2_1 103 +#define CDS_XA_2_2 104 + +/* User-configurable behavior options */ +#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ +#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ +#define CDO_LOCK 0x8 /* lock tray on open files */ +#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ + +/* Special codes for specifying changer slots. */ +#define CDSL_NONE ((int) (~0U>>1)-1) +#define CDSL_CURRENT ((int) (~0U>>1)) + +/* Some more ioctls to control these options */ +#define CDROM_SET_OPTIONS 0x5320 +#define CDROM_CLEAR_OPTIONS 0x5321 +#define CDROM_SELECT_SPEED 0x5322 /* head-speed */ +#define CDROM_SELECT_DISC 0x5323 /* for juke-boxes */ +#define CDROM_MEDIA_CHANGED 0x5325 +#define CDROM_DRIVE_STATUS 0x5326 /* tray position, etc. */ +#define CDROM_DISC_STATUS 0x5327 /* disc type etc. */ +#define CDROM_CHANGER_NSLOTS 0x5328 + +/* Rename an old ioctl */ +#define CDROM_GET_MCN CDROM_GET_UPC /* medium catalog number */ + +#ifdef __KERNEL__ +/* the general file operations structure: */ +extern struct file_operations cdrom_fops; + +extern int register_cdrom(struct cdrom_device_info *cdi, char *name); +extern int unregister_cdrom(struct cdrom_device_info *cdi); +#endif + +#endif /* LINUX_UCDROM_H */ +/* + * Local variables: + * comment-column: 40 + * End: + */ diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h new file mode 100644 index 000000000..af856645d --- /dev/null +++ b/include/linux/ufs_fs.h @@ -0,0 +1,270 @@ +/* + * linux/include/linux/ufs_fs.h + * + * Copyright (C) 1996 + * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu) + * Laboratory for Computer Science Research Computing Facility + * Rutgers, The State University of New Jersey + * + * $Id: ufs_fs.h,v 1.7 1996/08/13 19:27:59 ecd Exp $ + * + */ + +#ifndef __LINUX_UFS_FS_H +#define __LINUX_UFS_FS_H + +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/time.h> +#include <linux/stat.h> + +#define UFS_BBLOCK 0 +#define UFS_BBSIZE 8192 +#define UFS_SBLOCK 8192 +#define UFS_SBSIZE 8192 + +#define UFS_MAGIC 0x00011954 + +#define UFS_FSIZE 1024 +#define UFS_BSIZE 8192 + +#define UFS_NDADDR 12 +#define UFS_NINDIR 3 + +#define UFS_IND_BLOCK (UFS_NDADDR + 0) +#define UFS_DIND_BLOCK (UFS_NDADDR + 1) +#define UFS_TIND_BLOCK (UFS_NDADDR + 2) + +#define UFS_ROOTINO 2 + +#define UFS_USEEFT ((__u16)65535) + +#define UFS_FSOK 0x7c269d38 +#define UFS_FSACTIVE ((char)0x00) +#define UFS_FSCLEAN ((char)0x01) +#define UFS_FSSTABLE ((char)0x02) +#define UFS_FSBAD ((char)0xff) + +/* Flags for ufs_sb_info */ +#define UFS_DEBUG 0x00000001 +#define UFS_DEBUG_INODE 0x00000002 +#define UFS_DEBUG_NAMEI 0x00000004 +#define UFS_DEBUG_LINKS 0x00000008 + +#define UFS_ADDR_PER_BLOCK(sb) ((sb)->u.ufs_sb.s_bsize >> 2) +#define UFS_ADDR_PER_BLOCK_BITS(sb) ((sb)->u.ufs_sb.s_bshift - 2) + +/* Test if the inode number is valid. */ +#define ufs_ino_ok(inode) ((inode->i_ino < 2) && \ + (inode->i_ino > (inode->i_sb->u.ufs_sb.s_ncg * inode->i_sb->u.ufs_sb.s_ipg - 1))) + +/* Convert (sb,cg) to the first physical block number for that cg. */ +#define ufs_cgstart(sb, cg) \ + (((sb)->u.ufs_sb.s_fpg * (cg)) + (sb)->u.ufs_sb.s_cgoffset * ((cg) & ~((sb)->u.ufs_sb.s_cgmask))) + +/* Convert (sb,cg) to the first phys. block number for inodes in that cg. */ +#define ufs_cgimin(sb, cg) (ufs_cgstart((sb), (cg)) + (sb)->u.ufs_sb.s_iblkno) +#define ufs_cgdmin(sb, cg) (ufs_cgstart((sb), (cg)) + (sb)->u.ufs_sb.s_dblkno) + +/* Convert an inode number to a cg number. */ +/* XXX - this can be optimized if s_ipg is a power of 2. */ +#define ufs_ino2cg(inode) ((inode)->i_ino/(inode)->i_sb->u.ufs_sb.s_ipg) + +#define UFS_MAXNAMLEN 255 + +#define ufs_lbn(sb, block) ((block) >> (sb)->u.ufs_sb.s_lshift) +#define ufs_boff(sb, block) ((block) & ~((sb)->u.ufs_sb.s_lmask)) +#define ufs_dbn(sb, block, boff) ((block) + ufs_boff((sb), (boff))) + +struct ufs_direct { + __u32 d_ino; /* inode number of this entry */ + __u16 d_reclen; /* length of this entry */ + __u16 d_namlen; /* actual length of d_name */ + char d_name[UFS_MAXNAMLEN + 1]; /* file name */ +}; + +#define MAXMNTLEN 512 +#define MAXCSBUFS 32 + +struct ufs_csum { + __u32 cs_ndir; /* number of directories */ + __u32 cs_nbfree; /* number of free blocks */ + __u32 cs_nifree; /* number of free inodes */ + __u32 cs_nffree; /* number of free frags */ +}; + +typedef struct _ufsquad { + __u32 val[2]; +} ufsquad; + +/* + * This is the actual superblock, as it is laid out on the disk. + */ +struct ufs_superblock { + __u32 fs_link; /* UNUSED */ + __u32 fs_rlink; /* UNUSED */ + __u32 fs_sblkno; /* addr of super-block in filesys */ + __u32 fs_cblkno; /* offset of cyl-block in filesys */ + __u32 fs_iblkno; /* offset of inode-blocks in filesys */ + __u32 fs_dblkno; /* offset of first data after cg */ + __u32 fs_cgoffset; /* cylinder group offset in cylinder */ + __u32 fs_cgmask; /* used to calc mod fs_ntrak */ + time_t fs_time; /* last time written */ + __u32 fs_size; /* number of blocks in fs */ + __u32 fs_dsize; /* number of data blocks in fs */ + __u32 fs_ncg; /* number of cylinder groups */ + __u32 fs_bsize; /* size of basic blocks in fs */ + __u32 fs_fsize; /* size of frag blocks in fs */ + __u32 fs_frag; /* number of frags in a block in fs */ +/* these are configuration parameters */ + __u32 fs_minfree; /* minimum percentage of free blocks */ + __u32 fs_rotdelay; /* num of ms for optimal next block */ + __u32 fs_rps; /* disk revolutions per second */ +/* these fields can be computed from the others */ + __u32 fs_bmask; /* ``blkoff'' calc of blk offsets */ + __u32 fs_fmask; /* ``fragoff'' calc of frag offsets */ + __u32 fs_bshift; /* ``lblkno'' calc of logical blkno */ + __u32 fs_fshift; /* ``numfrags'' calc number of frags */ +/* these are configuration parameters */ + __u32 fs_maxcontig; /* max number of contiguous blks */ + __u32 fs_maxbpg; /* max number of blks per cyl group */ +/* these fields can be computed from the others */ + __u32 fs_fragshift; /* block to frag shift */ + __u32 fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + __u32 fs_sbsize; /* actual size of super block */ + __u32 fs_csmask; /* csum block offset */ + __u32 fs_csshift; /* csum block number */ + __u32 fs_nindir; /* value of NINDIR */ + __u32 fs_inopb; /* value of INOPB */ + __u32 fs_nspf; /* value of NSPF */ +/* yet another configuration parameter */ + __u32 fs_optim; /* optimization preference, see below */ +/* these fields are derived from the hardware */ + __u32 fs_npsect; /* # sectors/track including spares */ + __u32 fs_interleave; /* hardware sector interleave */ + __u32 fs_trackskew; /* sector 0 skew, per track */ +/* a unique id for this filesystem (currently unused and unmaintained) */ +/* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */ +/* Neither of those fields is used in the Tahoe code right now but */ +/* there could be problems if they are. */ + __u32 fs_id[2]; /* file system id */ +/* sizes determined by number of cylinder groups and their sizes */ + __u32 fs_csaddr; /* blk addr of cyl grp summary area */ + __u32 fs_cssize; /* size of cyl grp summary area */ + __u32 fs_cgsize; /* cylinder group size */ +/* these fields are derived from the hardware */ + __u32 fs_ntrak; /* tracks per cylinder */ + __u32 fs_nsect; /* sectors per track */ + __u32 fs_spc; /* sectors per cylinder */ +/* this comes from the disk driver partitioning */ + __u32 fs_ncyl; /* cylinders in file system */ +/* these fields can be computed from the others */ + __u32 fs_cpg; /* cylinders per group */ + __u32 fs_ipg; /* inodes per group */ + __u32 fs_fpg; /* blocks per group * fs_frag */ +/* this data must be re-computed after crashes */ + struct ufs_csum fs_cstotal; /* cylinder summary information */ +/* these fields are cleared at mount time */ + __u8 fs_fmod; /* super block modified flag */ + __u8 fs_clean; /* file system is clean flag */ + __u8 fs_ronly; /* mounted read-only flag */ + __u8 fs_flags; /* currently unused flag */ + __u8 fs_fsmnt[MAXMNTLEN]; /* name mounted on */ +/* these fields retain the current block allocation info */ + __u32 fs_cgrotor; /* last cg searched */ + struct ufs_csum * fs_csp[MAXCSBUFS]; /* list of fs_cs info buffers */ + __u32 fs_cpc; /* cyl per cycle in postbl */ + __u16 fs_opostbl[16][8]; /* old rotation block list head */ + __s32 fs_sparecon[55]; /* reserved for future constants */ + __s32 fs_state; /* file system state time stamp */ + ufsquad fs_qbmask; /* ~usb_bmask - for use with __s64 size */ + ufsquad fs_qfmask; /* ~usb_fmask - for use with __s64 size */ + __s32 fs_postblformat; /* format of positional layout tables */ + __s32 fs_nrpos; /* number of rotational positions */ + __s32 fs_postbloff; /* (__s16) rotation block list head */ + __s32 fs_rotbloff; /* (__u8) blocks for each rotation */ + __s32 fs_magic; /* magic number */ + __u8 fs_space[1]; /* list of blocks for each rotation */ + +}; + +/* + * structure of an on-disk inode + */ +struct ufs_inode { + __u16 ui_mode; /* 0x0 */ + __u16 ui_nlink; /* 0x2 */ + __u16 ui_suid; /* 0x4 */ + __u16 ui_sgid; /* 0x6 */ + ufsquad ui_size; /* 0x8 */ /* XXX - should be __u64 */ + struct timeval ui_atime; /* 0x10 */ + struct timeval ui_mtime; /* 0x18 */ + struct timeval ui_ctime; /* 0x20 */ + __u32 ui_db[UFS_NDADDR]; /* 0x28 data blocks */ + __u32 ui_ib[UFS_NINDIR]; /* 0x58 indirect blocks */ + __u32 ui_flags; /* 0x64 unused */ + __u32 ui_blocks; /* 0x68 blocks in use */ + __u32 ui_gen; /* 0x6c generation number XXX - what is this? */ + __u32 ui_shadow; /* 0x70 shadow inode XXX - what is this?*/ + __u32 ui_uid; /* 0x74 long EFT version of uid */ + __u32 ui_gid; /* 0x78 long EFT version of gid */ + __u32 ui_oeftflag; /* 0x7c reserved */ +}; + + +#ifdef __KERNEL__ +/* + * Function prototypes + */ + +/* ufs_inode.c */ +extern int ufs_bmap (struct inode *, int); +extern void ufs_read_inode(struct inode * inode); +extern void ufs_put_inode(struct inode * inode); + +extern void ufs_print_inode (struct inode *); + +/* ufs_namei.c */ +extern int ufs_lookup (struct inode *, const char *, int, struct inode **); + +/* ufs_super.c */ +extern void ufs_warning (struct super_block *, const char *, const char *, ...) + __attribute__ ((format (printf, 3, 4))); +extern int init_ufs_fs(void); + +/* + * Inodes and files operations + */ + +/* ufs_dir.c */ +extern struct inode_operations ufs_dir_inode_operations; +extern struct file_operations ufs_dir_operations; + +/* ufs_file.c */ +extern struct inode_operations ufs_file_inode_operations; +extern struct file_operations ufs_file_operations; + +/* ufs_symlink.c */ +extern struct inode_operations ufs_symlink_inode_operations; +extern struct file_operations ufs_symlink_operations; + +/* Byte swapping 32/16-bit quantities into little endian format. */ +extern int ufs_need_swab; + +extern __inline__ __u32 ufs_swab32(__u32 value) +{ + return (ufs_need_swab ? ((value >> 24) | + ((value >> 8) & 0xff00) | + ((value << 8) & 0xff0000) | + (value << 24)) : value); +} + +extern __inline__ __u16 ufs_swab16(__u16 value) +{ + return (ufs_need_swab ? ((value >> 8) | + (value << 8)) : value); +} + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_UFS_FS_H */ diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h new file mode 100644 index 000000000..f10b36d91 --- /dev/null +++ b/include/linux/ufs_fs_i.h @@ -0,0 +1,27 @@ +/* + * linux/include/linux/ufs_fs_i.h + * + * Copyright (C) 1996 + * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu) + * Laboratory for Computer Science Research Computing Facility + * Rutgers, The State University of New Jersey + * + * $Id: ufs_fs_i.h,v 1.2 1996/05/03 04:02:25 davem Exp $ + * + */ + +#ifndef _LINUX_UFS_FS_I_H +#define _LINUX_UFS_FS_I_H + +struct ufs_inode_info { + __u32 i_data[15]; + __u64 i_size; + __u32 i_flags; + __u32 i_gen; + __u32 i_shadow; + __u32 i_uid; + __u32 i_gid; + __u32 i_oeftflag; +}; + +#endif /* _LINUX_UFS_FS_I_H */ diff --git a/include/linux/ufs_fs_sb.h b/include/linux/ufs_fs_sb.h new file mode 100644 index 000000000..da56276a2 --- /dev/null +++ b/include/linux/ufs_fs_sb.h @@ -0,0 +1,40 @@ +/* + * linux/include/linux/ufs_fs_sb.h + * + * Copyright (C) 1996 + * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu) + * Laboratory for Computer Science Research Computing Facility + * Rutgers, The State University of New Jersey + * + * $Id: ufs_fs_sb.h,v 1.6 1996/06/01 15:31:08 ecd Exp $ + * + */ + +#ifndef __LINUX_UFS_FS_SB_H +#define __LINUX_UFS_FS_SB_H + +#include <linux/ufs_fs.h> + +struct ufs_sb_info { + struct ufs_superblock * s_raw_sb; + __u32 s_flags; /* internal flags for UFS code */ + __u32 s_ncg; /* used in ufs_read_inode */ + __u32 s_ipg; /* used in ufs_read_inode */ + __u32 s_fpg; + __u32 s_fsize; + __u32 s_fshift; + __u32 s_fmask; + __u32 s_bsize; + __u32 s_bmask; + __u32 s_bshift; + __u32 s_iblkno; + __u32 s_dblkno; + __u32 s_cgoffset; + __u32 s_cgmask; + __u32 s_inopb; + __u32 s_lshift; + __u32 s_lmask; + __u32 s_fsfrag; +}; + +#endif /* __LINUX_UFS_FS_SB_H */ diff --git a/include/linux/uio.h b/include/linux/uio.h new file mode 100644 index 000000000..5fbc2f7f1 --- /dev/null +++ b/include/linux/uio.h @@ -0,0 +1,30 @@ +#ifndef __LINUX_UIO_H +#define __LINUX_UIO_H + +/* + * Berkeley style UIO structures - Alan Cox 1994. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + + +/* A word of warning: Our uio structure will clash with the C library one (which is now obsolete). Remove the C + library one from sys/uio.h if you have a very old library set */ + +struct iovec +{ + void *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ + size_t iov_len; /* Must be size_t (1003.1g) */ +}; + +/* + * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1) + */ + +#define UIO_MAXIOV 16 /* Maximum iovec's in one operation + 16 matches BSD */ + +#endif diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h index 5571ca08d..9021ae919 100644 --- a/include/linux/ultrasound.h +++ b/include/linux/ultrasound.h @@ -1,36 +1,18 @@ #ifndef _ULTRASOUND_H_ #define _ULTRASOUND_H_ /* - * Copyright by Hannu Savolainen 1993 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* * ultrasound.h - Macros for programming the Gravis Ultrasound * These macros are extremely device dependent * and not portable. */ +/* + * Copyright (C) by Hannu Savolainen 1993-1996 + * + * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) + * Version 2 (June 1991). See the "COPYING" file distributed with this software + * for more info. + */ + /* * Private events for Gravis Ultrasound (GUS) @@ -52,7 +34,7 @@ * _GUS_VOICEOFF - Stops voice (no parameters) * _GUS_VOICEFADE - Stops the voice smoothly. * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) - * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7) + * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) diff --git a/include/linux/umsdos_fs.h b/include/linux/umsdos_fs.h index 170761a5e..b25f0c31e 100644 --- a/include/linux/umsdos_fs.h +++ b/include/linux/umsdos_fs.h @@ -16,6 +16,9 @@ #ifndef _LINUX_DIRENT_H #include <linux/dirent.h> #endif +#ifndef _LINUX_IOCTL_H +#include <linux/ioctl.h> +#endif struct umsdos_fake_info { char fname[13]; @@ -70,19 +73,19 @@ struct umsdos_info{ /* The next ioctl commands operate only on the DOS directory */ /* The file umsdos_progs/umsdosio.c contain a string table */ /* based on the order of those definition. Keep it in sync */ -#define UMSDOS_READDIR_DOS 1234 /* Do a readdir of the DOS directory */ -#define UMSDOS_UNLINK_DOS 1235 /* Erase in the DOS directory only */ -#define UMSDOS_RMDIR_DOS 1236 /* rmdir in the DOS directory only */ -#define UMSDOS_STAT_DOS 1237 /* Get info about a file */ +#define UMSDOS_READDIR_DOS _IO(0x04,210) /* Do a readdir of the DOS directory */ +#define UMSDOS_UNLINK_DOS _IO(0x04,211) /* Erase in the DOS directory only */ +#define UMSDOS_RMDIR_DOS _IO(0x04,212) /* rmdir in the DOS directory only */ +#define UMSDOS_STAT_DOS _IO(0x04,213) /* Get info about a file */ /* The next ioctl commands operate only on the EMD file */ -#define UMSDOS_CREAT_EMD 1238 /* Create a file */ -#define UMSDOS_UNLINK_EMD 1239 /* unlink (rmdir) a file */ -#define UMSDOS_READDIR_EMD 1240 /* read the EMD file only. */ -#define UMSDOS_GETVERSION 1241 /* Get the release number of UMSDOS */ -#define UMSDOS_INIT_EMD 1242 /* Create the EMD file if not there */ -#define UMSDOS_DOS_SETUP 1243 /* Set the defaults of the MsDOS driver */ - -#define UMSDOS_RENAME_DOS 1244 /* rename a file/directory in the DOS */ +#define UMSDOS_CREAT_EMD _IO(0x04,214) /* Create a file */ +#define UMSDOS_UNLINK_EMD _IO(0x04,215) /* unlink (rmdir) a file */ +#define UMSDOS_READDIR_EMD _IO(0x04,216) /* read the EMD file only. */ +#define UMSDOS_GETVERSION _IO(0x04,217) /* Get the release number of UMSDOS */ +#define UMSDOS_INIT_EMD _IO(0x04,218) /* Create the EMD file if not there */ +#define UMSDOS_DOS_SETUP _IO(0x04,219) /* Set the defaults of the MsDOS driver */ + +#define UMSDOS_RENAME_DOS _IO(0x04,220) /* rename a file/directory in the DOS */ /* directory only */ struct umsdos_ioctl{ struct dirent dos_dirent; @@ -133,6 +136,7 @@ extern struct file_operations umsdos_file_operations; extern struct inode_operations umsdos_file_inode_operations; extern struct inode_operations umsdos_file_inode_operations_no_bmap; extern struct inode_operations umsdos_symlink_inode_operations; +extern int init_umsdos_fs(void); #include <linux/umsdos_fs.p> diff --git a/include/linux/umsdos_fs.p b/include/linux/umsdos_fs.p index a89ae6e22..333f9940f 100644 --- a/include/linux/umsdos_fs.p +++ b/include/linux/umsdos_fs.p @@ -1,10 +1,10 @@ -/* check.c 30/01/95 22.05.32 */ +/* check.c 23/01/95 03.38.30 */ void check_page_tables (void); -/* dir.c 18/03/95 00.30.50 */ -int UMSDOS_dir_read (struct inode *inode, +/* dir.c 22/06/95 00.22.12 */ +long UMSDOS_dir_read (struct inode *inode, struct file *filp, char *buf, - int count); + unsigned long count); void umsdos_lookup_patch (struct inode *dir, struct inode *inode, struct umsdos_dirent *entry, @@ -19,27 +19,23 @@ int UMSDOS_lookup (struct inode *dir, int len, struct inode **result); int umsdos_hlink2inode (struct inode *hlink, struct inode **result); -/* emd.c 30/01/95 22.05.32 */ -int umsdos_readdir_kmem (struct inode *inode, - struct file *filp, - struct dirent *dirent, - int count); -int umsdos_file_read_kmem (struct inode *inode, +/* emd.c 22/06/95 00.22.04 */ +long umsdos_file_read_kmem (struct inode *inode, struct file *filp, char *buf, - int count); -int umsdos_file_write_kmem (struct inode *inode, + unsigned long count); +long umsdos_file_write_kmem (struct inode *inode, struct file *filp, - char *buf, - int count); -int umsdos_emd_dir_write (struct inode *emd_dir, + const char *buf, + unsigned long count); +long umsdos_emd_dir_write (struct inode *emd_dir, struct file *filp, char *buf, - int count); -int umsdos_emd_dir_read (struct inode *emd_dir, + unsigned long count); +long umsdos_emd_dir_read (struct inode *emd_dir, struct file *filp, char *buf, - int count); + unsigned long count); struct inode *umsdos_emd_dir_lookup (struct inode *dir, int creat); int umsdos_emd_dir_readentry (struct inode *emd_dir, struct file *filp, @@ -57,11 +53,13 @@ int umsdos_isempty (struct inode *dir); int umsdos_findentry (struct inode *dir, struct umsdos_info *info, int expect); -/* file.c 30/01/95 22.05.56 */ -/* inode.c 25/02/95 09.21.46 */ +/* file.c 25/01/95 02.25.38 */ +/* inode.c 12/06/95 09.49.40 */ void UMSDOS_put_inode (struct inode *inode); void UMSDOS_put_super (struct super_block *sb); -void UMSDOS_statfs (struct super_block *sb, struct statfs *buf, int); +void UMSDOS_statfs (struct super_block *sb, + struct statfs *buf, + int bufsiz); int umsdos_real_lookup (struct inode *dir, const char *name, int len, @@ -81,16 +79,16 @@ int UMSDOS_notify_change (struct inode *inode, struct iattr *attr); struct super_block *UMSDOS_read_super (struct super_block *s, void *data, int silent); -/* ioctl.c 21/02/95 20.58.22 */ +/* ioctl.c 22/06/95 00.22.08 */ int UMSDOS_ioctl_dir (struct inode *dir, struct file *filp, unsigned int cmd, unsigned long data); -/* mangle.c 30/01/95 22.05.56 */ +/* mangle.c 25/01/95 02.25.38 */ void umsdos_manglename (struct umsdos_info *info); int umsdos_evalrecsize (int len); int umsdos_parse (const char *fname, int len, struct umsdos_info *info); -/* namei.c 30/01/95 22.05.56 */ +/* namei.c 25/01/95 02.25.38 */ void umsdos_lockcreate (struct inode *dir); void umsdos_startlookup (struct inode *dir); void umsdos_unlockcreate (struct inode *dir); @@ -124,8 +122,9 @@ int UMSDOS_rename (struct inode *old_dir, int old_len, struct inode *new_dir, const char *new_name, - int new_len); -/* rdir.c 18/03/95 00.30.18 */ + int new_len, + int must_be_dir); +/* rdir.c 22/03/95 03.31.42 */ int umsdos_rlookup_x (struct inode *dir, const char *name, int len, @@ -135,4 +134,4 @@ int UMSDOS_rlookup (struct inode *dir, const char *name, int len, struct inode **result); -/* symlink.c 30/01/95 22.05.32 */ +/* symlink.c 23/01/95 03.38.30 */ diff --git a/include/linux/un.h b/include/linux/un.h index e11ad75fe..45561c564 100644 --- a/include/linux/un.h +++ b/include/linux/un.h @@ -4,7 +4,7 @@ #define UNIX_PATH_MAX 108 struct sockaddr_un { - unsigned short sun_family; /* AF_UNIX */ + sa_family_t sun_family; /* AF_UNIX */ char sun_path[UNIX_PATH_MAX]; /* pathname */ }; diff --git a/include/linux/unistd.h b/include/linux/unistd.h index 0ec2184f6..10ed9834b 100644 --- a/include/linux/unistd.h +++ b/include/linux/unistd.h @@ -1,158 +1,6 @@ #ifndef _LINUX_UNISTD_H_ #define _LINUX_UNISTD_H_ -/* - * This file contains the system call numbers. - */ - -#define __NR_setup 0 /* used only by init, to get system going */ -#define __NR_exit 1 -#define __NR_fork 2 -#define __NR_read 3 -#define __NR_write 4 -#define __NR_open 5 -#define __NR_close 6 -#define __NR_waitpid 7 -#define __NR_creat 8 -#define __NR_link 9 -#define __NR_unlink 10 -#define __NR_execve 11 -#define __NR_chdir 12 -#define __NR_time 13 -#define __NR_mknod 14 -#define __NR_chmod 15 -#define __NR_chown 16 -#define __NR_break 17 -#define __NR_oldstat 18 -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -#define __NR_setuid 23 -#define __NR_getuid 24 -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -#define __NR_oldfstat 28 -#define __NR_pause 29 -#define __NR_utime 30 -#define __NR_stty 31 -#define __NR_gtty 32 -#define __NR_access 33 -#define __NR_nice 34 -#define __NR_ftime 35 -#define __NR_sync 36 -#define __NR_kill 37 -#define __NR_rename 38 -#define __NR_mkdir 39 -#define __NR_rmdir 40 -#define __NR_dup 41 -#define __NR_pipe 42 -#define __NR_times 43 -#define __NR_prof 44 -#define __NR_brk 45 -#define __NR_setgid 46 -#define __NR_getgid 47 -#define __NR_signal 48 -#define __NR_geteuid 49 -#define __NR_getegid 50 -#define __NR_acct 51 -#define __NR_phys 52 -#define __NR_lock 53 -#define __NR_ioctl 54 -#define __NR_fcntl 55 -#define __NR_mpx 56 -#define __NR_setpgid 57 -#define __NR_ulimit 58 -#define __NR_oldolduname 59 -#define __NR_umask 60 -#define __NR_chroot 61 -#define __NR_ustat 62 -#define __NR_dup2 63 -#define __NR_getppid 64 -#define __NR_getpgrp 65 -#define __NR_setsid 66 -#define __NR_sigaction 67 -#define __NR_sgetmask 68 -#define __NR_ssetmask 69 -#define __NR_setreuid 70 -#define __NR_setregid 71 -#define __NR_sigsuspend 72 -#define __NR_sigpending 73 -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -#define __NR_getrlimit 76 -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -#define __NR_getgroups 80 -#define __NR_setgroups 81 -#define __NR_select 82 -#define __NR_symlink 83 -#define __NR_oldlstat 84 -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -#define __NR_readdir 89 -#define __NR_mmap 90 -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -#define __NR_fchown 95 -#define __NR_getpriority 96 -#define __NR_setpriority 97 -#define __NR_profil 98 -#define __NR_statfs 99 -#define __NR_fstatfs 100 -#define __NR_ioperm 101 -#define __NR_socketcall 102 -#define __NR_syslog 103 -#define __NR_setitimer 104 -#define __NR_getitimer 105 -#define __NR_stat 106 -#define __NR_lstat 107 -#define __NR_fstat 108 -#define __NR_olduname 109 -#define __NR_iopl 110 -#define __NR_vhangup 111 -#define __NR_idle 112 -#define __NR_vm86 113 -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -#define __NR_sigreturn 119 -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -#define __NR_modify_ldt 123 -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -#define __NR_sigprocmask 126 -#define __NR_create_module 127 -#define __NR_init_module 128 -#define __NR_delete_module 129 -#define __NR_get_kernel_syms 130 -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -#define __NR_afs_syscall 137 /* Syscall for Andrew File System */ -#define __NR_setfsuid 138 -#define __NR_setfsgid 139 -#define __NR__llseek 140 -#define __NR_getdents 141 -#define __NR__newselect 142 -#define __NR_flock 143 -/* This one hasn't been assigned officially! Code that relies - on it deserves to die ... */ -#define __NR__cacheflush 144 - extern int errno; /* diff --git a/include/linux/user.h b/include/linux/user.h index 3fbee19e4..68daf840f 100644 --- a/include/linux/user.h +++ b/include/linux/user.h @@ -1,77 +1 @@ -#ifndef _LINUX_USER_H -#define _LINUX_USER_H - -#include <linux/ptrace.h> -/* Core file format: The core file is written in such a way that gdb - can understand it and provide useful information to the user (under - linux we use the 'trad-core' bfd). There are quite a number of - obstacles to being able to view the contents of the floating point - registers, and until these are solved you will not be able to view the - contents of them. Actually, you can read in the core file and look at - the contents of the user struct to find out what the floating point - registers contain. - The actual file contents are as follows: - UPAGE: 1 page consisting of a user struct that tells gdb what is present - in the file. Directly after this is a copy of the task_struct, which - is currently not used by gdb, but it may come in useful at some point. - All of the registers are stored as part of the upage. The upage should - always be only one page. - DATA: The data area is stored. We use current->end_text to - current->brk to pick up all of the user variables, plus any memory - that may have been malloced. No attempt is made to determine if a page - is demand-zero or if a page is totally unused, we just cover the entire - range. All of the addresses are rounded in such a way that an integral - number of pages is written. - STACK: We need the stack information in order to get a meaningful - backtrace. We need to write the data from (esp) to - current->start_stack, so we round each of these off in order to be able - to write an integer number of pages. - The minimum core file size is 3 pages, or 12288 bytes. -*/ - -struct user_i387_struct { - long cwd; - long swd; - long twd; - long fip; - long fcs; - long foo; - long fos; - long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ -}; - -/* When the kernel dumps core, it starts by dumping the user struct - - this will be used by gdb to figure out where the data and stack segments - are within the file, and what virtual addresses to use. */ -struct user{ -/* We start with the registers, to mimic the way that "memory" is returned - from the ptrace(3,...) function. */ - struct pt_regs regs; /* Where the registers are actually stored */ -/* ptrace does not yet supply these. Someday.... */ - int u_fpvalid; /* True if math co-processor being used. */ - /* for this mess. Not yet used. */ - struct user_i387_struct i387; /* Math Co-processor registers. */ -/* The rest of this junk is to help gdb figure out what goes where */ - unsigned long int u_tsize; /* Text segment size (pages). */ - unsigned long int u_dsize; /* Data segment size (pages). */ - unsigned long int u_ssize; /* Stack segment size (pages). */ - unsigned long start_code; /* Starting virtual address of text. */ - unsigned long start_stack; /* Starting virtual address of stack area. - This is actually the bottom of the stack, - the top of the stack is always found in the - esp register. */ - long int signal; /* Signal that caused the core dump. */ - int reserved; /* No longer used */ - struct pt_regs * u_ar0; /* Used by gdb to help find the values for */ - /* the registers. */ - struct user_i387_struct* u_fpstate; /* Math Co-processor pointer. */ - unsigned long magic; /* To uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ - int u_debugreg[8]; -}; -#define NBPG 4096 -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif +#include <asm/user.h> diff --git a/include/linux/vm86.h b/include/linux/vm86.h deleted file mode 100644 index ceb10358f..000000000 --- a/include/linux/vm86.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _LINUX_VM86_H -#define _LINUX_VM86_H - -/* - * I'm guessing at the VIF/VIP flag usage, but hope that this is how - * the Pentium uses them. Linux will return from vm86 mode when both - * VIF and VIP is set. - * - * On a Pentium, we could probably optimize the virtual flags directly - * in the eflags register instead of doing it "by hand" in vflags... - * - * Linus - */ - -#define TF_MASK 0x00000100 -#define IF_MASK 0x00000200 -#define IOPL_MASK 0x00003000 -#define NT_MASK 0x00004000 -#define VM_MASK 0x00020000 -#define AC_MASK 0x00040000 -#define VIF_MASK 0x00080000 /* virtual interrupt flag */ -#define VIP_MASK 0x00100000 /* virtual interrupt pending */ -#define ID_MASK 0x00200000 - -#define BIOSSEG 0x0f000 - -#define CPU_086 0 -#define CPU_186 1 -#define CPU_286 2 -#define CPU_386 3 -#define CPU_486 4 -#define CPU_586 5 - -/* - * Return values for the 'vm86()' system call - */ -#define VM86_TYPE(retval) ((retval) & 0xff) -#define VM86_ARG(retval) ((retval) >> 8) - -#define VM86_SIGNAL 0 /* return due to signal */ -#define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */ -#define VM86_INTx 2 /* int3/int x instruction (ARG = x) */ -#define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */ - -/* - * This is the stack-layout when we have done a "SAVE_ALL" from vm86 - * mode - the main change is that the old segment descriptors aren't - * useful any more and are forced to be zero by the kernel (and the - * hardware when a trap occurs), and the real segment descriptors are - * at the end of the structure. Look at ptrace.h to see the "normal" - * setup. - */ - -struct vm86_regs { -/* - * normal regs, with special meaning for the segment descriptors.. - */ - long ebx; - long ecx; - long edx; - long esi; - long edi; - long ebp; - long eax; - long __null_ds; - long __null_es; - long __null_fs; - long __null_gs; - long orig_eax; - long eip; - unsigned short cs, __csh; - long eflags; - long esp; - unsigned short ss, __ssh; -/* - * these are specific to v86 mode: - */ - unsigned short es, __esh; - unsigned short ds, __dsh; - unsigned short fs, __fsh; - unsigned short gs, __gsh; -}; - -struct revectored_struct { - unsigned long __map[8]; /* 256 bits */ -}; - -struct vm86_struct { - struct vm86_regs regs; - unsigned long flags; - unsigned long screen_bitmap; - unsigned long cpu_type; - struct revectored_struct int_revectored; - struct revectored_struct int21_revectored; -}; - -/* - * flags masks - */ -#define VM86_SCREEN_BITMAP 0x0001 - -#ifdef __KERNEL__ - -void handle_vm86_fault(struct vm86_regs *, long); -void handle_vm86_debug(struct vm86_regs *, long); - -#endif - -#endif diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h new file mode 100644 index 000000000..7fc973198 --- /dev/null +++ b/include/linux/vmalloc.h @@ -0,0 +1,32 @@ +#ifndef __LINUX_VMALLOC_H +#define __LINUX_VMALLOC_H + +#include <linux/sched.h> +#include <linux/mm.h> + +#include <asm/pgtable.h> + +struct vm_struct { + unsigned long flags; + void * addr; + unsigned long size; + struct vm_struct * next; +}; + +struct vm_struct * get_vm_area(unsigned long size); +void vfree(void * addr); +void * vmalloc(unsigned long size); +int vread(char *buf, char *addr, int count); + +extern inline void set_pgdir(unsigned long address, pgd_t entry) +{ + struct task_struct * p; + + for_each_task(p) { + if (!p->mm) + continue; + *pgd_offset(p->mm,address) = entry; + } +} + +#endif diff --git a/include/linux/vt.h b/include/linux/vt.h index 33f1ad659..9f95b0bea 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h @@ -19,9 +19,9 @@ struct vt_mode { #define VT_ACKACQ 0x02 /* acknowledge switch */ struct vt_stat { - ushort v_active; /* active vt */ - ushort v_signal; /* signal to send */ - ushort v_state; /* vt bitmask */ + unsigned short v_active; /* active vt */ + unsigned short v_signal; /* signal to send */ + unsigned short v_state; /* vt bitmask */ }; #define VT_GETSTATE 0x5603 /* get global vt state info */ #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ @@ -33,10 +33,22 @@ struct vt_stat { #define VT_DISALLOCATE 0x5608 /* free memory associated to vt */ struct vt_sizes { - ushort v_rows; /* number of rows */ - ushort v_cols; /* number of columns */ - ushort v_scrollsize; /* number of lines of scrollback */ + unsigned short v_rows; /* number of rows */ + unsigned short v_cols; /* number of columns */ + unsigned short v_scrollsize; /* number of lines of scrollback */ }; #define VT_RESIZE 0x5609 /* set kernel's idea of screensize */ +struct vt_consize { + unsigned short v_rows; /* number of rows */ + unsigned short v_cols; /* number of columns */ + unsigned short v_vlin; /* number of pixel rows on screen */ + unsigned short v_clin; /* number of pixel rows per character */ + unsigned short v_vcol; /* number of pixel columns on screen */ + unsigned short v_ccol; /* number of pixel columns per character */ +}; +#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ +#define VT_LOCKSWITCH 0x560B /* disallow vt switching */ +#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */ + #endif /* _LINUX_VT_H */ diff --git a/include/linux/wait.h b/include/linux/wait.h index 90ffe7b3b..be24fa242 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -8,18 +8,25 @@ #ifdef __KERNEL__ +#include <asm/page.h> + struct wait_queue { struct task_struct * task; struct wait_queue * next; }; -struct semaphore { - int count; - struct wait_queue * wait; -}; +#define WAIT_QUEUE_HEAD(x) ((struct wait_queue *)((x)-1)) + +static inline void init_waitqueue(struct wait_queue **q) +{ + *q = WAIT_QUEUE_HEAD(q); +} -#define MUTEX ((struct semaphore) { 1, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { 0, NULL }) +static inline int waitqueue_active(struct wait_queue **q) +{ + struct wait_queue *head = *q; + return head && head != WAIT_QUEUE_HEAD(q); +} struct select_table_entry { struct wait_queue wait; @@ -27,11 +34,11 @@ struct select_table_entry { }; typedef struct select_table_struct { - int nr; + unsigned int nr; struct select_table_entry * entry; } select_table; -#define __MAX_SELECT_TABLE_ENTRIES (4096 / sizeof (struct select_table_entry)) +#define __MAX_SELECT_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct select_table_entry)) #endif /* __KERNEL__ */ diff --git a/include/linux/wrapper.h b/include/linux/wrapper.h new file mode 100644 index 000000000..13de8d4ae --- /dev/null +++ b/include/linux/wrapper.h @@ -0,0 +1,40 @@ +#ifndef _WRAPPER_H_ +#define _WRAPPER_H_ +#define wait_handle struct wait_queue +#define file_handle struct file +#define inode_handle struct inode +#define select_table_handle select_table +#define vm_area_handle struct vm_area_struct +#define file_operation_handle file_operations + +#define connect_wrapper(x) 0 +#define current_got_fatal_signal() (current->signal & ~current->blocked) +#define current_set_timeout(val) current->timeout = val + +#define module_interruptible_sleep_on interruptible_sleep_on +#define module_wake_up wake_up +#define module_select_wait select_wait +#define module_register_chrdev register_chrdev +#define module_unregister_chrdev unregister_chrdev +#define module_register_blkdev register_blkdev +#define module_unregister_blkdev unregister_blkdev + +#define inode_get_rdev(i) i->i_rdev +#define inode_get_count(i) i->i_count +#define inode_inc_count(i) i->i_count++ +#define inode_dec_count(i) i->i_count-- + +#define file_get_flags(f) f->f_flags + +#define vma_set_inode(v,i) v->vm_inode = i +#define vma_get_flags(v) v->vm_flags +#define vma_get_offset(v) v->vm_offset +#define vma_get_start(v) v->vm_start +#define vma_get_end(v) v->vm_end +#define vma_get_page_prot(v) v->vm_page_prot + +#define mem_map_reserve(p) set_bit(PG_reserved, &mem_map[p].flags) +#define mem_map_unreserve(p) clear_bit(PG_reserved, &mem_map[p].flags) +#define mem_map_inc_count(p) mem_map[p].count++ +#define mem_map_dec_count(p) mem_map[p].count-- +#endif diff --git a/include/linux/xd.h b/include/linux/xd.h deleted file mode 100644 index 6daf3e951..000000000 --- a/include/linux/xd.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef _LINUX_XD_H -#define _LINUX_XD_H - -/* - * This file contains the definitions for the IO ports and errors etc. for XT hard disk controllers (at least the DTC 5150X). - * - * Author: Pat Mackinlay, pat@it.com.au - * Date: 29/09/92 - * - * Revised: 01/01/93, ... - * - * Ref: DTC 5150X Controller Specification (thanks to Kevin Fowler, kevinf@agora.rain.com) - * Also thanks to: Salvador Abreu, Dave Thaler, Risto Kankkunen and Wim Van Dorst. - */ - -/* XT hard disk controller registers */ -#define XD_DATA (xd_iobase + 0x00) /* data RW register */ -#define XD_RESET (xd_iobase + 0x01) /* reset WO register */ -#define XD_STATUS (xd_iobase + 0x01) /* status RO register */ -#define XD_SELECT (xd_iobase + 0x02) /* select WO register */ -#define XD_JUMPER (xd_iobase + 0x02) /* jumper RO register */ -#define XD_CONTROL (xd_iobase + 0x03) /* DMAE/INTE WO register */ -#define XD_RESERVED (xd_iobase + 0x03) /* reserved */ - -/* XT hard disk controller commands (incomplete list) */ -#define CMD_TESTREADY 0x00 /* test drive ready */ -#define CMD_RECALIBRATE 0x01 /* recalibrate drive */ -#define CMD_SENSE 0x03 /* request sense */ -#define CMD_FORMATDRV 0x04 /* format drive */ -#define CMD_VERIFY 0x05 /* read verify */ -#define CMD_FORMATTRK 0x06 /* format track */ -#define CMD_FORMATBAD 0x07 /* format bad track */ -#define CMD_READ 0x08 /* read */ -#define CMD_WRITE 0x0A /* write */ -#define CMD_SEEK 0x0B /* seek */ - -/* Controller specific commands */ -#define CMD_DTCSETPARAM 0x0C /* set drive parameters (DTC 5150X only?) */ -#define CMD_DTCGETECC 0x0D /* get ecc error length (DTC 5150X only?) */ -#define CMD_DTCREADBUF 0x0E /* read sector buffer (DTC 5150X only?) */ -#define CMD_DTCWRITEBUF 0x0F /* write sector buffer (DTC 5150X only?) */ -#define CMD_DTCREMAPTRK 0x11 /* assign alternate track (DTC 5150X only?) */ -#define CMD_DTCGETPARAM 0xFB /* get drive parameters (DTC 5150X only?) */ -#define CMD_DTCSETSTEP 0xFC /* set step rate (DTC 5150X only?) */ -#define CMD_DTCSETGEOM 0xFE /* set geometry data (DTC 5150X only?) */ -#define CMD_DTCGETGEOM 0xFF /* get geometry data (DTC 5150X only?) */ -#define CMD_ST11GETGEOM 0xF8 /* get geometry data (Seagate ST11R/M only?) */ -#define CMD_WDSETPARAM 0x0C /* set drive parameters (WD 1004A27X only?) */ - -/* Bits for command status byte */ -#define CSB_ERROR 0x02 /* error */ -#define CSB_LUN 0x20 /* logical Unit Number */ - -/* XT hard disk controller status bits */ -#define STAT_READY 0x01 /* controller is ready */ -#define STAT_INPUT 0x02 /* data flowing from controller to host */ -#define STAT_COMMAND 0x04 /* controller in command phase */ -#define STAT_SELECT 0x08 /* controller is selected */ -#define STAT_REQUEST 0x10 /* controller requesting data */ -#define STAT_INTERRUPT 0x20 /* controller requesting interrupt */ - -/* XT hard disk controller control bits */ -#define PIO_MODE 0x00 /* control bits to set for PIO */ -#define DMA_MODE 0x03 /* control bits to set for DMA & interrupt */ - -#define XD_MAXDRIVES 2 /* maximum 2 drives */ -#define XD_TIMEOUT 100 /* 1 second timeout */ -#define XD_RETRIES 4 /* maximum 4 retries */ - -#undef DEBUG /* define for debugging output */ - -#ifdef DEBUG - #define DEBUG_STARTUP /* debug driver initialisation */ - #define DEBUG_OVERRIDE /* debug override geometry detection */ - #define DEBUG_READWRITE /* debug each read/write command */ - #define DEBUG_OTHER /* debug misc. interrupt/DMA stuff */ - #define DEBUG_COMMAND /* debug each controller command */ -#endif /* DEBUG */ - -/* this structure defines the XT drives and their types */ -typedef struct { - u_char heads; - u_short cylinders; - u_char sectors; - u_char control; -} XD_INFO; - -#define HDIO_GETGEO 0x0301 /* get drive geometry */ - -/* this structure is returned to the HDIO_GETGEO ioctl */ -typedef struct { - u_char heads; - u_char sectors; - u_short cylinders; - u_long start; -} XD_GEOMETRY; - -/* this structure defines a ROM BIOS signature */ -typedef struct { - u_long offset; - char *string; - void (*init_controller)(u_char *address); - void (*init_drive)(u_char drive); - char *name; -} XD_SIGNATURE; - -u_long xd_init (u_long mem_start,u_long mem_end); -void xd_setup (char *command,int *integers); -static u_char xd_detect (u_char *controller,u_char **address); -static u_char xd_initdrives (void (*init_drive)(u_char drive)); -static void xd_geninit (void); - -static int xd_open (struct inode *inode,struct file *file); -static void do_xd_request (void); -static int xd_ioctl (struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg); -static void xd_release (struct inode *inode,struct file *file); -static int xd_reread_partitions (int dev); -static int xd_readwrite (u_char operation,u_char drive,char *buffer,u_int block,u_int count); -static void xd_recalibrate (u_char drive); - -static void xd_interrupt_handler (int irq, struct pt_regs * regs); -static u_char xd_setup_dma (u_char opcode,u_char *buffer,u_int count); -static u_char *xd_build (u_char *cmdblk,u_char command,u_char drive,u_char head,u_short cylinder,u_char sector,u_char count,u_char control); -static inline u_char xd_waitport (u_short port,u_char flags,u_char mask,u_long timeout); -static u_int xd_command (u_char *command,u_char mode,u_char *indata,u_char *outdata,u_char *sense,u_long timeout); - -/* card specific setup and geometry gathering code */ -static void xd_dtc_init_controller (u_char *address); -static void xd_dtc_init_drive (u_char drive); -static void xd_wd_init_controller (u_char *address); -static void xd_wd_init_drive (u_char drive); -static void xd_seagate_init_controller (u_char *address); -static void xd_seagate_init_drive (u_char drive); -static void xd_omti_init_controller (u_char *address); -static void xd_omti_init_drive (u_char drive); -static void xd_setparam (u_char command,u_char drive,u_char heads,u_short cylinders,u_short rwrite,u_short wprecomp,u_char ecc); -static void xd_override_init_drive (u_char drive); - -#endif /* _LINUX_XD_H */ diff --git a/include/linux/xia_fs.h b/include/linux/xia_fs.h index 908360976..84015a2bf 100644 --- a/include/linux/xia_fs.h +++ b/include/linux/xia_fs.h @@ -79,7 +79,8 @@ extern int xiafs_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int xiafs_rename(struct inode * old_dir, const char * old_name, int old_len, struct inode * new_dir, - const char * new_name, int new_len); + const char * new_name, int new_len, + int must_be_dir); extern struct inode * xiafs_new_inode(struct inode * dir); extern void xiafs_free_inode(struct inode * inode); extern unsigned long xiafs_count_free_inodes(struct super_block *sb); @@ -95,6 +96,7 @@ extern struct buffer_head * xiafs_bread(struct inode *, int, int); extern void xiafs_truncate(struct inode *); extern void xiafs_put_super(struct super_block *); extern struct super_block *xiafs_read_super(struct super_block *,void *,int); +extern int init_xiafs_fs(void); extern void xiafs_read_inode(struct inode *); extern void xiafs_write_inode(struct inode *); extern void xiafs_put_inode(struct inode *); |