diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
commit | 46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch) | |
tree | 3b9b51fc482e729f663d25333e77fbed9aaa939a /include/linux | |
parent | 31dc59d503a02e84c4de98826452acaeb56dc15a (diff) |
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'include/linux')
44 files changed, 1808 insertions, 572 deletions
diff --git a/include/linux/blk.h b/include/linux/blk.h index f06443c04..fd9e46712 100644 --- a/include/linux/blk.h +++ b/include/linux/blk.h @@ -54,6 +54,11 @@ extern int ez_init(void); extern int bpcd_init(void); extern int ps2esdi_init(void); +#if defined(CONFIG_ARCH_S390) +extern int mdisk_init(void); +extern int dasd_init(void); +#endif /* CONFIG_ARCH_S390 */ + extern void set_device_ro(kdev_t dev,int flag); void add_blkdev_randomness(int major); @@ -352,6 +357,23 @@ static void floppy_off(unsigned int nr); #define DEVICE_ON(device) #define DEVICE_OFF(device) + +#elif (MAJOR_NR == MDISK_MAJOR) + +#define DEVICE_NAME "mdisk" +#define DEVICE_REQUEST mdisk_request +#define DEVICE_NR(device) (MINOR(device)) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + +#elif (MAJOR_NR == DASD_MAJOR) + +#define DEVICE_NAME "dasd" +#define DEVICE_REQUEST do_dasd_request +#define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS) +#define DEVICE_ON(device) +#define DEVICE_OFF(device) + #elif (MAJOR_NR == I2O_MAJOR) #define DEVICE_NAME "I2O block" diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8a05bdca2..fb673b0af 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -32,6 +32,7 @@ struct request { int errors; unsigned long sector; unsigned long nr_sectors; + unsigned long hard_sector, hard_nr_sectors; unsigned int nr_segments; unsigned int nr_hw_segments; unsigned long current_nr_sectors; diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 75d9fb540..359905839 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -14,6 +14,7 @@ */ extern unsigned long max_low_pfn; +extern unsigned long min_low_pfn; /* * node_bootmem_map is a map pointer - the bits represent all physical diff --git a/include/linux/cycx_x25.h b/include/linux/cycx_x25.h index 4fa2e967e..97e7b59e2 100644 --- a/include/linux/cycx_x25.h +++ b/include/linux/cycx_x25.h @@ -12,6 +12,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* 2000/04/02 acme dprintk and cycx_debug * 1999/01/03 acme judicious use of data types * 1999/01/02 acme #define X25_ACK_N3 0x4411 * 1998/12/28 acme cleanup: lot'o'things removed @@ -30,6 +31,11 @@ #define X25_MBOX_OFFS 0x300 /* general mailbox block */ #define X25_RXMBOX_OFFS 0x340 /* receive mailbox */ +/* Debug */ +#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a) + +extern unsigned int cycx_debug; + /* Data Structures */ /* X.25 Command Block. */ typedef struct X25Cmd diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4cc4c56ce..f28b3bd9e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -1,6 +1,9 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H +#include <asm/atomic.h> +#include <linux/mount.h> + #ifdef __KERNEL__ /* @@ -105,7 +108,10 @@ struct dentry_operations { * s_nfsd_free_path semaphore will be down */ -/* +/** + * d_drop - drop a dentry + * @dentry: dentry to drop + * * d_drop() unhashes the entry from the parent * dentry hashes, so that it won't be found through * a VFS lookup any more. Note that this is different @@ -118,6 +124,7 @@ struct dentry_operations { * to invalidate a dentry for some reason (NFS * timeouts or autofs deletes). */ + static __inline__ void d_drop(struct dentry * dentry) { list_del(&dentry->d_hash); @@ -164,10 +171,16 @@ extern int have_submounts(struct dentry *); * This adds the entry to the hash queues. */ extern void d_rehash(struct dentry *); -/* + +/** + * d_add - add dentry to hash queues + * @entry: dentry to add + * @inode: The inode to attach to this dentry + * * This adds the entry to the hash queues and initializes "d_inode". * The entry was actually filled in earlier during "d_alloc()" */ + static __inline__ void d_add(struct dentry * entry, struct inode * inode) { d_rehash(entry); @@ -183,10 +196,24 @@ extern struct dentry * d_lookup(struct dentry *, struct qstr *); /* validate "insecure" dentry pointer */ extern int d_validate(struct dentry *, struct dentry *, unsigned int, unsigned int); +extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *, + struct vfsmount *, char *, int); /* write full pathname into buffer and return start of pathname */ -extern char * d_path(struct dentry *, char *, int); - +#define d_path(dentry, vfsmnt, buffer, buflen) \ + __d_path(dentry, vfsmnt, current->fs->root, current->fs->rootmnt, \ + buffer, buflen) + /* Allocation counts.. */ + +/** + * dget - get a reference to a dentry + * @dentry: dentry to get a reference too + * + * Given a dentry or NULL pointer increment the reference count + * if appropriate and return the dentry. A dentry will not be + * destroyed when it has references. + */ + static __inline__ struct dentry * dget(struct dentry *dentry) { if (dentry) @@ -194,6 +221,13 @@ static __inline__ struct dentry * dget(struct dentry *dentry) return dentry; } +/** + * d_unhashed - is dentry hashed + * @dentry: entry to check + * + * Returns true if the dentry passed is not currently hashed + */ + static __inline__ int d_unhashed(struct dentry *dentry) { return list_empty(&dentry->d_hash); @@ -201,6 +235,13 @@ static __inline__ int d_unhashed(struct dentry *dentry) extern void dput(struct dentry *); +/* MOUNT_REWRITE: replace with the check for d_vfsmnt */ +static __inline__ int d_mountpoint(struct dentry *dentry) +{ + return dentry != dentry->d_mounts; +} + + #endif /* __KERNEL__ */ #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/errno.h b/include/linux/errno.h index ac2128445..653227803 100644 --- a/include/linux/errno.h +++ b/include/linux/errno.h @@ -11,6 +11,16 @@ #define ERESTARTNOHAND 514 /* restart if no handler.. */ #define ENOIOCTLCMD 515 /* No ioctl command */ +/* Defined for the NFSv3 protocol */ +#define EBADHANDLE 521 /* Illegal NFS file handle */ +#define ENOTSYNC 522 /* Update synchronization mismatch */ +#define EBADCOOKIE 523 /* Cookie is stale */ +#define ENOTSUPP 524 /* Operation is not supported */ +#define ETOOSMALL 525 /* Buffer or request is too small */ +#define ESERVERFAULT 526 /* An untranslatable error occurred */ +#define EBADTYPE 527 /* Type not supported by server */ +#define EJUKEBOX 528 /* Request initiated, but will not complete before timeout */ + #endif #endif diff --git a/include/linux/fs.h b/include/linux/fs.h index c1d3ffe75..57bade5c6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -79,7 +79,6 @@ extern int max_super_blocks, nr_super_blocks; #define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if * FS_NO_DCACHE is not set. */ -#define FS_IBASKET 8 /* FS does callback to free_ibasket() if space gets low. */ /* * These are the fs-independent mount-flags: up to 16 flags are supported @@ -456,6 +455,7 @@ struct fown_struct { struct file { struct list_head f_list; struct dentry *f_dentry; + struct vfsmount *f_vfsmnt; struct file_operations *f_op; atomic_t f_count; unsigned int f_flags; @@ -507,16 +507,24 @@ struct file_lock { struct file *fl_file; unsigned char fl_flags; unsigned char fl_type; - off_t fl_start; - off_t fl_end; + loff_t fl_start; + loff_t fl_end; void (*fl_notify)(struct file_lock *); /* unblock callback */ + void (*fl_insert)(struct file_lock *); /* lock insertion callback */ + void (*fl_remove)(struct file_lock *); /* lock removal callback */ union { struct nfs_lock_info nfs_fl; } fl_u; }; +/* The following constant reflects the upper bound of the file/locking space */ +#ifndef OFFSET_MAX +#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) +#define OFFSET_MAX INT_LIMIT(loff_t) +#endif + extern struct file_lock *file_lock_table; #include <linux/fcntl.h> @@ -539,10 +547,36 @@ struct fasync_struct { struct file *fa_file; }; +struct nameidata { + struct dentry *dentry; + struct vfsmount *mnt; + struct qstr last; +}; + #define FASYNC_MAGIC 0x4601 extern int fasync_helper(int, struct file *, int, struct fasync_struct **); +#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ +#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ + +struct quota_mount_options +{ + unsigned int flags; /* Flags for diskquotas on this device */ + struct semaphore dqio_sem; /* lock device while I/O in progress */ + struct semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device */ + struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ + time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */ + time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */ + char rsquash[MAXQUOTAS]; /* for quotas threat root as any other user */ +}; + +/* + * Umount options + */ + +#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ + #include <linux/minix_fs_sb.h> #include <linux/ext2_fs_sb.h> #include <linux/hpfs_fs_sb.h> @@ -582,9 +616,6 @@ struct super_block { struct dentry *s_root; wait_queue_head_t s_wait; - struct inode *s_ibasket; - short int s_ibasket_count; - short int s_ibasket_max; struct list_head s_dirty; /* dirty inodes */ struct list_head s_files; @@ -688,7 +719,7 @@ struct inode_operations { int (*rename) (struct inode *, struct dentry *, struct inode *, struct dentry *); int (*readlink) (struct dentry *, char *,int); - struct dentry * (*follow_link) (struct dentry *, struct dentry *, unsigned int); + int (*follow_link) (struct dentry *, struct nameidata *); void (*truncate) (struct inode *); int (*permission) (struct inode *, int); int (*revalidate) (struct dentry *); @@ -812,10 +843,9 @@ extern int do_truncate(struct dentry *, loff_t start); extern int get_unused_fd(void); extern void put_unused_fd(unsigned int); -extern struct file *filp_open(const char *, int, int, struct dentry *); -extern struct file *dentry_open(struct dentry *, int); +extern struct file *filp_open(const char *, int, int); +extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); extern int filp_close(struct file *, fl_owner_t id); - extern char * getname(const char *); #define __getname() ((char *) __get_free_page(GFP_KERNEL)) #define putname(name) free_page((unsigned long)(name)) @@ -930,13 +960,8 @@ extern int get_write_access(struct inode *); extern void put_write_access(struct inode *); extern struct dentry * do_mknod(const char *, int, dev_t); extern int do_pipe(int *); -extern int do_unlink(const char * name, struct dentry *); -extern struct dentry * __open_namei(const char *, int, int, struct dentry *); -static inline struct dentry * open_namei(const char *pathname) -{ - return __open_namei(pathname, 0, 0, NULL); -} +extern int open_namei(const char *, int, int, struct nameidata *); extern int kernel_read(struct file *, unsigned long, char *, unsigned long); extern struct file * open_exec(const char *); @@ -968,6 +993,8 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *); #define LOOKUP_DIRECTORY (2) #define LOOKUP_SLASHOK (4) #define LOOKUP_CONTINUE (8) +#define LOOKUP_POSITIVE (16) +#define LOOKUP_PARENT (32) /* * "descriptor" for what we're up to with a read for sendfile(). @@ -987,12 +1014,13 @@ typedef struct { typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long); - -extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int); +extern struct dentry * lookup_dentry(const char *, unsigned int); +extern int walk_init(const char *, unsigned, struct nameidata *); +extern int walk_name(const char *, unsigned, struct nameidata *); extern struct dentry * lookup_one(const char *, struct dentry *); extern struct dentry * __namei(const char *, unsigned int); -#define namei(pathname) __namei(pathname, 1) +#define namei(pathname) __namei(pathname, LOOKUP_FOLLOW) #define lnamei(pathname) __namei(pathname, 0) extern void iput(struct inode *); @@ -1062,9 +1090,9 @@ extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *); extern struct file_operations generic_ro_fops; extern int vfs_readlink(struct dentry *, char *, int, const char *); -extern struct dentry *vfs_follow_link(struct dentry *, struct dentry *, unsigned, const char *); +extern int vfs_follow_link(struct nameidata *, const char *); extern int page_readlink(struct dentry *, char *, int); -extern struct dentry *page_follow_link(struct dentry *, struct dentry *, unsigned); +extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; extern int vfs_readdir(struct file *, filldir_t, void *); diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h new file mode 100644 index 000000000..3e341078b --- /dev/null +++ b/include/linux/ibmtr.h @@ -0,0 +1,454 @@ +/* Definitions for an IBM Token Ring card. */ +/* This file is distributed under the GNU GPL */ + +/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */ + +#define TR_RETRY_INTERVAL (5*HZ) /* 500 on PC = 5 s */ +#define TR_RESET_INTERVAL (HZ/20) /* 5 on PC = 50 ms */ +#define TR_BUSY_INTERVAL (HZ/5) /* 5 on PC = 200 ms */ +#define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */ +#define TR_RETRIES 6 /* number of open retries */ + +#define TR_ISA 1 +#define TR_MCA 2 +#define TR_ISAPNP 3 +#define NOTOK 0 +#define TOKDEBUG 1 + +#define IBMTR_SHARED_RAM_SIZE 0x10000 +#define IBMTR_IO_EXTENT 4 +#define IBMTR_MAX_ADAPTERS 2 + +#define CHANNEL_ID 0X1F30 +#define AIP 0X1F00 +#define AIPCHKSUM1 0X1F60 +#define AIPCHKSUM2 0X1FF0 +#define AIPADAPTYPE 0X1FA0 +#define AIPDATARATE 0X1FA2 +#define AIPEARLYTOKEN 0X1FA4 +#define AIPAVAILSHRAM 0X1FA6 +#define AIPSHRAMPAGE 0X1FA8 +#define AIP4MBDHB 0X1FAA +#define AIP16MBDHB 0X1FAC +#define AIPFID 0X1FBA + +/* Note, 0xA20 == 0x220 since motherboard decodes 10 bits. I left everything + the way my documentation had it, ie: 0x0A20. */ +#define ADAPTINTCNTRL 0x02f0 /* Adapter interrupt control */ +#define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */ +#define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */ +#define ADAPTINTREL 0x3 /* Adapter interrupt release */ + +#define MMIOStartLocP 0x0a20 /* Primary adapter's starting MMIO area */ +#define MMIOStartLocA 0x0a24 /* Alternate adapter's starting MMIO area */ + +#define GLOBAL_INT_ENABLE 0x02f0 + +/* MMIO bits 0-4 select register */ +#define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */ +/* Used to set the starting address of shared RAM */ +/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared RAM address.*/ +/* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */ +#define RRR_ODD 0x01 +/* Bits 2 and 3 of this register can be read to determine shared RAM size */ +/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */ +#define WRBR_EVEN 0x02 /* Write region base registers - even and odd */ +#define WRBR_ODD 0x03 +#define WWOR_EVEN 0x04 /* Write window open registers - even and odd */ +#define WWOR_ODD 0x05 +#define WWCR_EVEN 0x06 /* Write window close registers - even and odd */ +#define WWCR_ODD 0x07 + +/* Interrupt status registers - PC system - even and odd */ +#define ISRP_EVEN 0x08 + +#define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has + expired. */ +#define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an + internal error. */ +#define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to + write to an invalid area of shared RAM or an invalid + register within the MMIO. */ +/* In addition, the following bits within ISRP_EVEN can be turned on or off by you */ +/* to control the interrupt processing: */ +#define INT_IRQ 0x80 /* Bit 7 - If 0 the adapter will issue a CHCK, if 1 and + IRQ. This should normally be set (by you) to 1. */ +#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will + occur. If 1, interrupts will occur normally. + Normally set to 1. */ +/* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the primary adapter,*/ +/* 1 if this adapter is the alternate adapter. */ + + +#define ISRP_ODD 0x09 + +#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has + encountered a serious problem and has closed + itself. Whoa. */ +#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted + an SRB request and set the return code within + the SRB. */ +#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB + and this area can be safely reused. This interrupt + is only used if your application has set the ASB + free request bit in ISRA_ODD or if an error was + detected in your response. */ +#define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a + command for action. The command is located in the + ARB area of shared memory. */ +#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a + response to your SRB (the response is located in + the SSB area of shared memory). */ +/* Bit 1 - Bridge frame forward complete. */ + + + +#define ISRA_EVEN 0x0A /* Interrupt status registers - adapter - even and odd */ +/* Bit 7 - Internal parity error (on adapter's internal bus) */ +/* Bit 6 - Timer interrupt pending */ +/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */ +/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */ +/* Bit 3 - Adapter processor check status */ +/* Bit 2 - Reserved */ +/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */ +/* Bit 0 - Adapter software interrupt mask (prevents internal software interrupts) */ + +#define ISRA_ODD 0x0B +#define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new + command in the SRB and are ready for the adapter to + process the command. */ +#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response + (an ASB) in the shared RAM which is available for + the adapter's use. */ +/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but that a previous */ +/* command is still pending. The adapter will then interrupt you when the previous */ +/* command is completed */ +/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but that a previous */ +/* ASB is still pending. The adapter will then interrupt you when the previous ASB */ +/* is copied. */ +#define ARB_FREE 0x2 +#define SSB_FREE 0x1 + +#define TCR_EVEN 0x0C /* Timer control registers - even and odd */ +#define TCR_ODD 0x0D +#define TVR_EVEN 0x0E /* Timer value registers - even and odd */ +#define TVR_ODD 0x0F +#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */ +#define SRPR_ENABLE_PAGING 0xc0 +#define SRPR_ODD 0x19 /* Not used. */ +#define TOKREAD 0x60 +#define TOKOR 0x40 +#define TOKAND 0x20 +#define TOKWRITE 0x00 + +/* MMIO bits 5-6 select operation */ +/* 00 is used to write to a register */ +/* 01 is used to bitwise AND a byte with a register */ +/* 10 is used to bitwise OR a byte with a register */ +/* 11 is used to read from a register */ + +/* MMIO bits 7-8 select area of interest.. see below */ +/* 00 selects attachment control area. */ +/* 01 is reserved. */ +/* 10 selects adapter identification area A containing the adapter encoded address. */ +/* 11 selects the adapter identification area B containing test patterns. */ + +#define PCCHANNELID 5049434F3631313039393020 +#define MCCHANNELID 4D4152533633583435313820 + +#define ACA_OFFSET 0x1e00 +#define ACA_SET 0x40 +#define ACA_RESET 0x20 +#define ACA_RW 0x00 + +#ifdef ENABLE_PAGING +#define SET_PAGE(x) (isa_writeb((x), \ + ti->mmio + ACA_OFFSET + ACA_RW + SRPR_EVEN)) +#else +#define SET_PAGE(x) +#endif + +typedef enum { IN_PROGRESS, SUCCESS, FAILURE, CLOSED } open_state; + +/* do_tok_int possible values */ +#define FIRST_INT 1 +#define NOT_FIRST 2 + +struct tok_info { + unsigned char irq; + __u32 mmio; + unsigned char hw_address[32]; + unsigned char adapter_type; + unsigned char data_rate; + unsigned char token_release; + unsigned char avail_shared_ram; + unsigned char shared_ram_paging; + unsigned short dhb_size4mb; + unsigned short rbuf_len4; + unsigned short rbuf_cnt4; + unsigned short maxmtu4; + unsigned short dhb_size16mb; + unsigned short rbuf_len16; + unsigned short rbuf_cnt16; + unsigned short maxmtu16; + /* Additions by David Morris */ + unsigned char do_tok_int; + wait_queue_head_t wait_for_tok_int; + wait_queue_head_t wait_for_reset; + unsigned char sram_base; + /* Additions by Peter De Schrijver */ + unsigned char page_mask; /* mask to select RAM page to Map*/ + unsigned char mapped_ram_size; /* size of RAM page */ + __u32 sram; /* Shared memory base address */ + __u32 init_srb; /* Initial System Request Block address */ + __u32 srb; /* System Request Block address */ + __u32 ssb; /* System Status Block address */ + __u32 arb; /* Adapter Request Block address */ + __u32 asb; /* Adapter Status Block address */ + __u8 init_srb_page; + __u8 srb_page; + __u8 ssb_page; + __u8 arb_page; + __u8 asb_page; + unsigned short exsap_station_id; + unsigned short global_int_enable; + struct sk_buff *current_skb; + struct net_device_stats tr_stats; + unsigned char auto_ringspeedsave; + open_state open_status; + unsigned char readlog_pending; + unsigned short adapter_int_enable; /* Adapter-specific int enable */ + struct timer_list tr_timer; + unsigned char ring_speed; + __u32 func_addr; + unsigned int retry_count; + spinlock_t lock; /* SMP protection */ +}; + +/* token ring adapter commands */ +#define DIR_INTERRUPT 0x00 /* struct srb_interrupt */ +#define DIR_MOD_OPEN_PARAMS 0x01 +#define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */ +#define DIR_CLOSE_ADAPTER 0x04 +#define DIR_SET_GRP_ADDR 0x06 +#define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */ +#define DIR_READ_LOG 0x08 /* struct srb_read_log */ +#define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */ +#define DLC_CLOSE_SAP 0x16 +#define DATA_LOST 0x20 /* struct asb_rec */ +#define REC_DATA 0x81 /* struct arb_rec_req */ +#define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */ +#define DLC_STATUS 0x83 /* struct arb_dlc_status */ +#define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */ + +/* DIR_OPEN_ADAPTER options */ +#define OPEN_PASS_BCON_MAC 0x0100 +#define NUM_RCV_BUF 2 +#define RCV_BUF_LEN 1024 +#define DHB_LENGTH 2048 +#define NUM_DHB 2 +#define DLC_MAX_SAP 2 +#define DLC_MAX_STA 1 + +/* DLC_OPEN_SAP options */ +#define MAX_I_FIELD 0x0088 +#define SAP_OPEN_IND_SAP 0x04 +#define SAP_OPEN_PRIORITY 0x20 +#define SAP_OPEN_STATION_CNT 0x1 +#define XMIT_DIR_FRAME 0x0A +#define XMIT_UI_FRAME 0x0d +#define XMIT_XID_CMD 0x0e +#define XMIT_TEST_CMD 0x11 + +/* srb close return code */ +#define SIGNAL_LOSS 0x8000 +#define HARD_ERROR 0x4000 +#define XMIT_BEACON 0x1000 +#define LOBE_FAULT 0x0800 +#define AUTO_REMOVAL 0x0400 +#define REMOVE_RECV 0x0100 +#define LOG_OVERFLOW 0x0080 +#define RING_RECOVER 0x0020 + +struct srb_init_response { + unsigned char command; + unsigned char init_status; + unsigned char init_status_2; + unsigned char reserved[3]; + __u16 bring_up_code; + __u16 encoded_address; + __u16 level_address; + __u16 adapter_address; + __u16 parms_address; + __u16 mac_address; +}; + +struct dir_open_adapter { + unsigned char command; + char reserved[7]; + __u16 open_options; + unsigned char node_address[6]; + unsigned char group_address[4]; + unsigned char funct_address[4]; + __u16 num_rcv_buf; + __u16 rcv_buf_len; + __u16 dhb_length; + unsigned char num_dhb; + char reserved2; + unsigned char dlc_max_sap; + unsigned char dlc_max_sta; + unsigned char dlc_max_gsap; + unsigned char dlc_max_gmem; + unsigned char dlc_t1_tick_1; + unsigned char dlc_t2_tick_1; + unsigned char dlc_ti_tick_1; + unsigned char dlc_t1_tick_2; + unsigned char dlc_t2_tick_2; + unsigned char dlc_ti_tick_2; + unsigned char product_id[18]; +}; + +struct srb_open_response { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2[3]; + __u16 error_code; + __u16 asb_addr; + __u16 srb_addr; + __u16 arb_addr; + __u16 ssb_addr; +}; + +struct dlc_open_sap { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + __u16 station_id; + unsigned char timer_t1; + unsigned char timer_t2; + unsigned char timer_ti; + unsigned char maxout; + unsigned char maxin; + unsigned char maxout_incr; + unsigned char max_retry_count; + unsigned char gsap_max_mem; + __u16 max_i_field; + unsigned char sap_value; + unsigned char sap_options; + unsigned char station_count; + unsigned char sap_gsap_mem; + unsigned char gsap[0]; +}; + +struct srb_xmit { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; + unsigned char reserved1; + __u16 station_id; +}; + +struct srb_interrupt { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; +}; + +struct srb_read_log { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + unsigned char line_errors; + unsigned char internal_errors; + unsigned char burst_errors; + unsigned char A_C_errors; + unsigned char abort_delimiters; + unsigned char reserved3; + unsigned char lost_frames; + unsigned char recv_congest_count; + unsigned char frame_copied_errors; + unsigned char frequency_errors; + unsigned char token_errors; +}; + +struct asb_xmit_resp { + unsigned char command; + unsigned char cmd_corr; + unsigned char ret_code; + unsigned char reserved; + __u16 station_id; + __u16 frame_length; + unsigned char hdr_length; + unsigned char rsap_value; +}; + +struct arb_xmit_req { + unsigned char command; + unsigned char cmd_corr; + unsigned char reserved1[2]; + __u16 station_id; + __u16 dhb_address; +}; + +struct arb_rec_req { + unsigned char command; + unsigned char reserved1[3]; + __u16 station_id; + __u16 rec_buf_addr; + unsigned char lan_hdr_len; + unsigned char dlc_hdr_len; + __u16 frame_len; + unsigned char msg_type; +}; + +struct asb_rec { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2; + __u16 station_id; + __u16 rec_buf_addr; +}; + +struct rec_buf { + /* unsigned char reserved1[2]; */ + __u16 buf_ptr; + unsigned char reserved2; + __u16 buf_len; + unsigned char data[0]; +}; + +struct arb_dlc_status { + unsigned char command; + unsigned char reserved1[3]; + __u16 station_id; + __u16 status; + unsigned char frmr_data[5]; + unsigned char access_prio; + unsigned char rem_addr[TR_ALEN]; + unsigned char rsap_value; +}; + +struct arb_ring_stat_change { + unsigned char command; + unsigned char reserved1[5]; + __u16 ring_status; +}; + +struct srb_close_adapter { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; +}; + +struct srb_set_funct_addr { + unsigned char command; + unsigned char reserved1; + unsigned char ret_code; + unsigned char reserved2[3]; + unsigned char funct_address[4]; +}; + diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h index f5d80a778..38adbdcc0 100644 --- a/include/linux/if_ppp.h +++ b/include/linux/if_ppp.h @@ -21,7 +21,7 @@ */ /* - * ==FILEVERSION 20000115== + * ==FILEVERSION 20000324== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the above date. @@ -140,6 +140,7 @@ struct ifpppcstatsreq { #define PPPIOCCONNECT _IOW('t', 58, int) /* connect channel to unit */ #define PPPIOCDISCONN _IO('t', 57) /* disconnect channel */ #define PPPIOCATTCHAN _IOW('t', 56, int) /* attach to ppp channel */ +#define PPPIOCGCHAN _IOR('t', 55, int) /* get ppp channel number */ #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ diff --git a/include/linux/input.h b/include/linux/input.h index 4cc82fbf4..17f6c046f 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -47,6 +47,35 @@ struct input_event { }; /* + * The device ID structure; + */ + +struct input_id { + __u16 bus; + __u16 vendor; + __u16 product; +}; + +/* + * Protocol version. + */ + +#define EV_VERSION 0x010000 + +/* + * IOCTLs (0x00 - 0x7f) + */ + +#define EVIOCGVERSION _IOR('E', 0x01, __u32) /* get driver version */ +#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ +#define EVIOCGREP _IOR('E', 0x03, int[2]) /* get repeat settings */ +#define EVIOCSREP _IOW('E', 0x03, int[2]) /* get repeat settings */ +#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x03, len) /* get device name */ +#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ +#define EVIOCGABSLIM(num) _IOR('E', 0x40 + num, int[4]) /* get abs event limits */ +#define EVIOCGABS(num) _IOR('E', 0x80 + num, int) /* get abs value */ + +/* * Event types */ @@ -273,11 +302,12 @@ struct input_event { #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 #define BTN_TOP2 0x124 -#define BTN_BASE 0x125 -#define BTN_BASE2 0x126 -#define BTN_BASE3 0x127 -#define BTN_BASE4 0x128 -#define BTN_BASE5 0x129 +#define BTN_PINKIE 0x125 +#define BTN_BASE 0x126 +#define BTN_BASE2 0x127 +#define BTN_BASE3 0x128 +#define BTN_BASE4 0x129 +#define BTN_BASE5 0x12a #define BTN_GAMEPAD 0x130 #define BTN_A 0x130 @@ -383,6 +413,7 @@ struct input_event { */ #include <linux/sched.h> +#include <linux/devfs_fs_kernel.h> #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define BIT(x) (1<<((x)%BITS_PER_LONG)) @@ -393,6 +424,8 @@ struct input_dev { void *private; int number; + char *name; + struct input_id id; unsigned long evbit[NBITS(EV_MAX)]; unsigned long keybit[NBITS(KEY_MAX)]; @@ -430,17 +463,21 @@ struct input_handler { void *private; void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); - int (*connect)(struct input_handler *handler, struct input_dev *dev); + struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev); void (*disconnect)(struct input_handle *handle); - struct input_handle *handle; + struct file_operations *fops; + int minor; + struct input_handle *handle; struct input_handler *next; }; struct input_handle { void *private; + + int open; struct input_dev *dev; struct input_handler *handler; @@ -455,9 +492,12 @@ void input_unregister_device(struct input_dev *); void input_register_handler(struct input_handler *); void input_unregister_handler(struct input_handler *); -void input_open_device(struct input_handle *); +int input_open_device(struct input_handle *); void input_close_device(struct input_handle *); +devfs_handle_t input_register_minor(char *name, int minor, int minor_base); +void input_unregister_minor(devfs_handle_t handle); + void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); #define input_report_key(a,b,c) input_event(a, EV_KEY, b, c) diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index d949bd649..694046eaa 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -146,12 +146,14 @@ struct nlm_host * nlm_lookup_host(struct svc_client *, struct sockaddr_in *, int, int); struct rpc_clnt * nlm_bind_host(struct nlm_host *); void nlm_rebind_host(struct nlm_host *); +struct nlm_host * nlm_get_host(struct nlm_host *); void nlm_release_host(struct nlm_host *); void nlm_shutdown_hosts(void); /* * Server-side lock handling */ +int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, struct nlm_lock *, int, struct nlm_cookie *); u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); diff --git a/include/linux/lockd/nlm.h b/include/linux/lockd/nlm.h index 4bc44e7d9..e22388d50 100644 --- a/include/linux/lockd/nlm.h +++ b/include/linux/lockd/nlm.h @@ -12,11 +12,8 @@ #include <linux/config.h> /* Maximum file offset in file_lock.fl_end */ -#ifdef OFFSET_MAX -# define NLM_OFFSET_MAX OFFSET_MAX -#else -# define NLM_OFFSET_MAX ((off_t) 0x7fffffff) -#endif +# define NLM_OFFSET_MAX ((s32) 0x7fffffff) +# define NLM4_OFFSET_MAX ((s64) ((~(u64)0) >> 1)) /* Return states for NLM */ enum { diff --git a/include/linux/mm.h b/include/linux/mm.h index 0e35a9c79..453b31d7c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -163,7 +163,7 @@ typedef struct page { #define PG_error 1 #define PG_referenced 2 #define PG_uptodate 3 -#define PG__unused_00 4 +#define PG_dirty 4 #define PG_decr_after 5 #define PG_unused_01 6 #define PG__unused_02 7 @@ -180,6 +180,8 @@ typedef struct page { #define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags) #define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) #define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) +#define PageDirty(page) test_bit(PG_dirty, &(page)->flags) +#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags) #define PageLocked(page) test_bit(PG_locked, &(page)->flags) #define LockPage(page) set_bit(PG_locked, &(page)->flags) #define TryLockPage(page) test_and_set_bit(PG_locked, &(page)->flags) @@ -188,7 +190,7 @@ typedef struct page { wake_up(&page->wait); \ } while (0) #define PageError(page) test_bit(PG_error, &(page)->flags) -#define SetPageError(page) test_and_set_bit(PG_error, &(page)->flags) +#define SetPageError(page) set_bit(PG_error, &(page)->flags) #define ClearPageError(page) clear_bit(PG_error, &(page)->flags) #define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) #define PageDecrAfter(page) test_bit(PG_decr_after, &(page)->flags) @@ -205,6 +207,9 @@ typedef struct page { #define PageClearSwapCache(page) clear_bit(PG_swap_cache, &(page)->flags) #define PageTestandClearSwapCache(page) test_and_clear_bit(PG_swap_cache, &(page)->flags) +#define PageSwapEntry(page) test_bit(PG_swap_entry, &(page)->flags) +#define SetPageSwapEntry(page) set_bit(PG_swap_entry, &(page)->flags) +#define ClearPageSwapEntry(page) clear_bit(PG_swap_entry, &(page)->flags) #ifdef CONFIG_HIGHMEM #define PageHighMem(page) test_bit(PG_highmem, &(page)->flags) @@ -406,7 +411,8 @@ extern int check_pgt_cache(void); extern void free_area_init(unsigned long * zones_size); extern void free_area_init_node(int nid, pg_data_t *pgdat, - unsigned long * zones_size, unsigned long zone_start_paddr); + unsigned long * zones_size, unsigned long zone_start_paddr, + unsigned long *zholes_size); extern void mem_init(void); extern void show_mem(void); extern void si_meminfo(struct sysinfo * val); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 82d3e62f4..05a846297 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -102,7 +102,7 @@ extern pg_data_t *pgdat_list; */ extern void show_free_areas_core(int); extern void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, - unsigned long *zones_size, unsigned long paddr); + unsigned long *zones_size, unsigned long paddr, unsigned long *zholes_size); #ifndef CONFIG_DISCONTIGMEM diff --git a/include/linux/mount.h b/include/linux/mount.h index c2dcfe93f..547163d2e 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -11,20 +11,6 @@ #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H -#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ -#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ - -struct quota_mount_options -{ - unsigned int flags; /* Flags for diskquotas on this device */ - struct semaphore dqio_sem; /* lock device while I/O in progress */ - struct semaphore dqoff_sem; /* serialize quota_off() and quota_on() on device */ - struct file *files[MAXQUOTAS]; /* fp's to quotafiles */ - time_t inode_expire[MAXQUOTAS]; /* expiretime for inode-quota */ - time_t block_expire[MAXQUOTAS]; /* expiretime for block-quota */ - char rsquash[MAXQUOTAS]; /* for quotas threat root as any other user */ -}; - struct vfsmount { kdev_t mnt_dev; /* Device this applies to */ @@ -34,10 +20,14 @@ struct vfsmount struct vfsmount *mnt_next; /* pointer to next in linkedlist */ }; -/* - * Umount options - */ - -#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ +/* MOUNT_REWRITE: fill these */ +static inline struct vfsmount *mntget(struct vfsmount *mnt) +{ + return mnt; +} + +static inline void mntput(struct vfsmount *mnt) +{ +} #endif /* _LINUX_MOUNT_H */ diff --git a/include/linux/nbd.h b/include/linux/nbd.h index cdd77e932..c981a6911 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -15,6 +15,7 @@ #define NBD_CLEAR_QUE _IO( 0xab, 5 ) #define NBD_PRINT_DEBUG _IO( 0xab, 6 ) #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) +#define NBD_DISCONNECT _IO( 0xab, 8 ) #ifdef MAJOR_NR diff --git a/include/linux/net.h b/include/linux/net.h index d91b6bcf6..0269a037e 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -53,12 +53,14 @@ typedef enum { SS_DISCONNECTING /* in process of disconnecting */ } socket_state; -#define SO_ACCEPTCON (1<<16) /* performed a listen */ -#define SO_WAITDATA (1<<17) /* wait data to read */ -#define SO_NOSPACE (1<<18) /* no space to write */ +#define __SO_ACCEPTCON (1<<16) /* performed a listen */ #ifdef __KERNEL__ +#define SOCK_ASYNC_NOSPACE 0 +#define SOCK_ASYNC_WAITDATA 1 +#define SOCK_NOSPACE 2 + struct socket { socket_state state; diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h index 12cf75136..178eb4c06 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack.h +++ b/include/linux/netfilter_ipv4/ip_conntrack.h @@ -67,13 +67,13 @@ struct ip_conntrack_expect struct ip_conntrack *expectant; }; -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED #include <linux/netfilter_ipv4/ip_nat.h> #endif #if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE) #include <linux/netfilter_ipv4/ip_conntrack_ftp.h> -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED #include <linux/netfilter_ipv4/ip_nat_ftp.h> #endif #endif @@ -119,7 +119,7 @@ struct ip_conntrack #endif } help; -#if defined(CONFIG_IP_NF_NAT) || defined(CONFIG_IP_NF_NAT_MODULE) +#ifdef CONFIG_IP_NF_NAT_NEEDED struct { struct ip_nat_info info; union { @@ -132,7 +132,7 @@ struct ip_conntrack int masq_index; #endif } nat; -#endif /* CONFIG_IP_NF_NAT || CONFIG_IP_NF_NAT_MODULE */ +#endif /* CONFIG_IP_NF_NAT_NEEDED */ }; diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h index a164aed4f..c5fabbbd9 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h @@ -19,7 +19,6 @@ enum ip_ct_ftp_type IP_CT_FTP_PASV = IP_CT_DIR_REPLY }; -/* Protected by ip_conntrack_lock */ /* We record seq number and length of ftp ip/port text here: all in host order. */ struct ip_ct_ftp diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h index 8bbd6230f..a78776235 100644 --- a/include/linux/netfilter_ipv4/ip_queue.h +++ b/include/linux/netfilter_ipv4/ip_queue.h @@ -2,7 +2,7 @@ * This is a module which is used for queueing IPv4 packets and * communicating with userspace via netlink. * - * (C) 2000 James Morris + * (C) 2000 James Morris, this code is GPL. */ #ifndef _IP_QUEUE_H #define _IP_QUEUE_H @@ -27,7 +27,7 @@ typedef struct ipq_packet_msg { char indev_name[IFNAMSIZ]; /* Name of incoming interface */ char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */ size_t data_len; /* Length of packet data */ - /* Optional packet data follows */ + unsigned char payload[0]; /* Optional packet data */ } ipq_packet_msg_t; /* Messages sent from userspace */ @@ -40,7 +40,7 @@ typedef struct ipq_verdict_msg { unsigned int value; /* Verdict to hand to netfilter */ unsigned long id; /* Packet ID for this verdict */ size_t data_len; /* Length of replacement data */ - /* Optional replacement data follows */ + unsigned char payload[0]; /* Optional replacement packet */ } ipq_verdict_msg_t; typedef struct ipq_peer_msg { @@ -50,37 +50,19 @@ typedef struct ipq_peer_msg { } msg; } ipq_peer_msg_t; -/* Each queued packet has one of these states */ +/* Packet delivery modes */ enum { - IPQ_PS_NEW, /* Newly arrived packet */ - IPQ_PS_WAITING, /* User has been notified of packet, - we're waiting for a verdict */ - IPQ_PS_VERDICT /* Packet has been assigned verdict, - waiting to be reinjected */ -}; -#define IPQ_PS_MAX IPQ_PS_VERDICT - -/* The queue operates in one of these states */ -enum { - IPQ_QS_HOLD, /* Hold all packets in queue */ - IPQ_QS_COPY, /* Copy metadata and/or packets to user */ - IPQ_QS_FLUSH /* Flush and drop all queue entries */ -}; -#define IPQ_QS_MAX IPQ_QS_FLUSH - -/* Modes requested by peer */ -enum { - IPQ_COPY_NONE, /* Copy nothing */ + IPQ_COPY_NONE, /* Initial mode, packets are dropped */ IPQ_COPY_META, /* Copy metadata */ IPQ_COPY_PACKET /* Copy metadata + packet (range) */ -}; +}; #define IPQ_COPY_MAX IPQ_COPY_PACKET /* Types of messages */ #define IPQM_BASE 0x10 /* standard netlink messages below this */ -#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ -#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ -#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ +#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */ +#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */ +#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */ #define IPQM_MAX (IPQM_BASE + 4) #endif /*_IP_QUEUE_H*/ diff --git a/include/linux/netfilter_ipv4/ipt_REJECT.h b/include/linux/netfilter_ipv4/ipt_REJECT.h index 1ceebe211..eeafdf468 100644 --- a/include/linux/netfilter_ipv4/ipt_REJECT.h +++ b/include/linux/netfilter_ipv4/ipt_REJECT.h @@ -6,8 +6,7 @@ enum ipt_reject_with { IPT_ICMP_HOST_UNREACHABLE, IPT_ICMP_PROT_UNREACHABLE, IPT_ICMP_PORT_UNREACHABLE, - IPT_ICMP_ECHOREPLY, - IPT_TCP_RESET, + IPT_ICMP_ECHOREPLY }; struct ipt_reject_info { diff --git a/include/linux/nfs.h b/include/linux/nfs.h index 3dca58cbc..aa36f7bd3 100644 --- a/include/linux/nfs.h +++ b/include/linux/nfs.h @@ -9,6 +9,7 @@ #include <linux/sunrpc/msg_prot.h> +#define NFS_PROGRAM 100003 #define NFS_PORT 2049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 @@ -26,7 +27,9 @@ #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 - +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_PORT 627 + /* * NFS stats. The good thing with these values is that NFSv3 errors are * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which @@ -84,187 +87,27 @@ enum nfs_ftype { NFFIFO = 8 }; +#if defined(__KERNEL__) +/* + * This is the kernel NFS client file handle representation + */ +#define NFS_MAXFHSIZE 64 struct nfs_fh { - char data[NFS_FHSIZE]; + unsigned short size; + unsigned char data[NFS_MAXFHSIZE]; }; -#define NFS_PROGRAM 100003 -#define NFS_VERSION 2 -#define NFSPROC_NULL 0 -#define NFSPROC_GETATTR 1 -#define NFSPROC_SETATTR 2 -#define NFSPROC_ROOT 3 -#define NFSPROC_LOOKUP 4 -#define NFSPROC_READLINK 5 -#define NFSPROC_READ 6 -#define NFSPROC_WRITECACHE 7 -#define NFSPROC_WRITE 8 -#define NFSPROC_CREATE 9 -#define NFSPROC_REMOVE 10 -#define NFSPROC_RENAME 11 -#define NFSPROC_LINK 12 -#define NFSPROC_SYMLINK 13 -#define NFSPROC_MKDIR 14 -#define NFSPROC_RMDIR 15 -#define NFSPROC_READDIR 16 -#define NFSPROC_STATFS 17 - -/* Mount support for NFSroot */ -#ifdef __KERNEL__ -#define NFS_MNT_PROGRAM 100005 -#define NFS_MNT_VERSION 1 -#define NFS_MNT_PORT 627 -#define NFS_MNTPROC_MNT 1 -#define NFS_MNTPROC_UMNT 3 - /* * This is really a general kernel constant, but since nothing like * this is defined in the kernel headers, I have to do it here. */ #define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1)) -#endif /* __KERNEL__ */ - -#if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) - -extern struct rpc_program nfs_program; -extern struct rpc_stat nfs_rpcstat; - -struct nfs_time { - __u32 seconds; - __u32 useconds; -}; - -struct nfs_fattr { - enum nfs_ftype type; - __u32 mode; - __u32 nlink; - __u32 uid; - __u32 gid; - __u32 size; - __u32 blocksize; - __u32 rdev; - __u32 blocks; - __u32 fsid; - __u32 fileid; - struct nfs_time atime; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs_fsinfo { - __u32 tsize; - __u32 bsize; - __u32 blocks; - __u32 bfree; - __u32 bavail; -}; - -/* Arguments to the write call. - * Note that NFS_WRITE_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h - */ -#define NFS_WRITE_MAXIOV 8 enum nfs3_stable_how { NFS_UNSTABLE = 0, NFS_DATA_SYNC = 1, NFS_FILE_SYNC = 2 }; - -struct nfs_writeargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - enum nfs3_stable_how stable; - unsigned int nriov; - struct iovec iov[NFS_WRITE_MAXIOV]; -}; - -struct nfs_writeverf { - enum nfs3_stable_how committed; - __u32 verifier[2]; -}; - -struct nfs_writeres { - struct nfs_fattr * fattr; - struct nfs_writeverf * verf; - __u32 count; -}; - -#ifdef NFS_NEED_XDR_TYPES - -struct nfs_sattrargs { - struct nfs_fh * fh; - struct iattr * sattr; -}; - -struct nfs_diropargs { - struct nfs_fh * fh; - const char * name; -}; - -struct nfs_readlinkargs { - struct nfs_fh * fh; - const void * buffer; -}; - -struct nfs_readargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - void * buffer; -}; - -struct nfs_createargs { - struct nfs_fh * fh; - const char * name; - struct iattr * sattr; -}; - -struct nfs_renameargs { - struct nfs_fh * fromfh; - const char * fromname; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs_linkargs { - struct nfs_fh * fromfh; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs_symlinkargs { - struct nfs_fh * fromfh; - const char * fromname; - const char * topath; - struct iattr * sattr; -}; - -struct nfs_readdirargs { - struct nfs_fh * fh; - __u32 cookie; - void * buffer; - int bufsiz; -}; - -struct nfs_diropok { - struct nfs_fh * fh; - struct nfs_fattr * fattr; -}; - -struct nfs_readres { - struct nfs_fattr * fattr; - unsigned int count; -}; - -struct nfs_readdirres { - void * buffer; - int bufsiz; - u32 cookie; -}; - -#endif /* NFS_NEED_XDR_TYPES */ #endif /* __KERNEL__ */ - -#endif +#endif /* _LINUX_NFS_H */ diff --git a/include/linux/nfs2.h b/include/linux/nfs2.h new file mode 100644 index 000000000..0ed951713 --- /dev/null +++ b/include/linux/nfs2.h @@ -0,0 +1,74 @@ +/* + * NFS protocol definitions + * + * This file contains constants for Version 2 of the protocol. + */ +#ifndef _LINUX_NFS2_H +#define _LINUX_NFS2_H + +#define NFS2_PORT 2049 +#define NFS2_MAXDATA 8192 +#define NFS2_MAXPATHLEN 1024 +#define NFS2_MAXNAMLEN 255 +#define NFS2_MAXGROUPS 16 +#define NFS2_FHSIZE 32 +#define NFS2_COOKIESIZE 4 +#define NFS2_FIFO_DEV (-1) +#define NFS2MODE_FMT 0170000 +#define NFS2MODE_DIR 0040000 +#define NFS2MODE_CHR 0020000 +#define NFS2MODE_BLK 0060000 +#define NFS2MODE_REG 0100000 +#define NFS2MODE_LNK 0120000 +#define NFS2MODE_SOCK 0140000 +#define NFS2MODE_FIFO 0010000 + + +/* NFSv2 file types - beware, these are not the same in NFSv3 */ +enum nfs2_ftype { + NF2NON = 0, + NF2REG = 1, + NF2DIR = 2, + NF2BLK = 3, + NF2CHR = 4, + NF2LNK = 5, + NF2SOCK = 6, + NF2BAD = 7, + NF2FIFO = 8 +}; + +struct nfs2_fh { + char data[NFS2_FHSIZE]; +}; + +/* + * Procedure numbers for NFSv2 + */ +#define NFS2_VERSION 2 +#define NFSPROC_NULL 0 +#define NFSPROC_GETATTR 1 +#define NFSPROC_SETATTR 2 +#define NFSPROC_ROOT 3 +#define NFSPROC_LOOKUP 4 +#define NFSPROC_READLINK 5 +#define NFSPROC_READ 6 +#define NFSPROC_WRITECACHE 7 +#define NFSPROC_WRITE 8 +#define NFSPROC_CREATE 9 +#define NFSPROC_REMOVE 10 +#define NFSPROC_RENAME 11 +#define NFSPROC_LINK 12 +#define NFSPROC_SYMLINK 13 +#define NFSPROC_MKDIR 14 +#define NFSPROC_RMDIR 15 +#define NFSPROC_READDIR 16 +#define NFSPROC_STATFS 17 + +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_VERSION 1 +#define MNTPROC_NULL 0 +#define MNTPROC_MNT 1 +#define MNTPROC_UMNT 3 +#define MNTPROC_UMNTALL 4 + +#endif /* _LINUX_NFS2_H */ diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h index cf5405b35..1f45a9296 100644 --- a/include/linux/nfs3.h +++ b/include/linux/nfs3.h @@ -4,14 +4,12 @@ #ifndef _LINUX_NFS3_H #define _LINUX_NFS3_H -#include <linux/sunrpc/msg_prot.h> -#include <linux/nfs.h> - #define NFS3_PORT 2049 -#define NFS3_MAXDATA 8192 +#define NFS3_MAXDATA 32768 #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 +#define NFS3_FHSIZE 64 #define NFS3_COOKIESIZE 4 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 @@ -23,7 +21,6 @@ #define NFS3MODE_SOCK 0140000 #define NFS3MODE_FIFO 0010000 - /* Flags for access() call */ #define NFS3_ACCESS_READ 0x0001 #define NFS3_ACCESS_LOOKUP 0x0002 @@ -33,9 +30,11 @@ #define NFS3_ACCESS_EXECUTE 0x0020 /* Flags for create mode */ -#define NFS3_CREATE_UNCHECKED 0 -#define NFS3_CREATE_GUARDED 1 -#define NFS3_CREATE_EXCLUSIVE 2 +enum nfs3_createmode { + NFS3_CREATE_UNCHECKED = 0, + NFS3_CREATE_GUARDED = 1, + NFS3_CREATE_EXCLUSIVE = 2 +}; /* NFSv3 file system properties */ #define NFS3_FSF_LINK 0x0001 @@ -60,180 +59,41 @@ enum nfs3_ftype { }; #define NFS3_VERSION 3 -#define NFSPROC_NULL 0 -#define NFSPROC_GETATTR 1 -#define NFSPROC_SETATTR 2 -#define NFSPROC_ROOT 3 -#define NFSPROC_LOOKUP 4 -#define NFSPROC_READLINK 5 -#define NFSPROC_READ 6 -#define NFSPROC_WRITECACHE 7 -#define NFSPROC_WRITE 8 -#define NFSPROC_CREATE 9 -#define NFSPROC_REMOVE 10 -#define NFSPROC_RENAME 11 -#define NFSPROC_LINK 12 -#define NFSPROC_SYMLINK 13 -#define NFSPROC_MKDIR 14 -#define NFSPROC_RMDIR 15 -#define NFSPROC_READDIR 16 -#define NFSPROC_STATFS 17 +#define NFS3PROC_NULL 0 +#define NFS3PROC_GETATTR 1 +#define NFS3PROC_SETATTR 2 +#define NFS3PROC_LOOKUP 3 +#define NFS3PROC_ACCESS 4 +#define NFS3PROC_READLINK 5 +#define NFS3PROC_READ 6 +#define NFS3PROC_WRITE 7 +#define NFS3PROC_CREATE 8 +#define NFS3PROC_MKDIR 9 +#define NFS3PROC_SYMLINK 10 +#define NFS3PROC_MKNOD 11 +#define NFS3PROC_REMOVE 12 +#define NFS3PROC_RMDIR 13 +#define NFS3PROC_RENAME 14 +#define NFS3PROC_LINK 15 +#define NFS3PROC_READDIR 16 +#define NFS3PROC_READDIRPLUS 17 +#define NFS3PROC_FSSTAT 18 +#define NFS3PROC_FSINFO 19 +#define NFS3PROC_PATHCONF 20 +#define NFS3PROC_COMMIT 21 + +#define NFS_MNT3_PROGRAM 100005 +#define NFS_MNT3_VERSION 3 +#define MOUNTPROC3_NULL 0 +#define MOUNTPROC3_MNT 1 +#define MOUNTPROC3_UMNT 3 +#define MOUNTPROC3_UMNTALL 4 + #if defined(__KERNEL__) || defined(NFS_NEED_KERNEL_TYPES) /* Number of 32bit words in post_op_attr */ #define NFS3_POST_OP_ATTR_WORDS 22 -struct nfs3_fattr { - enum nfs3_ftype type; - __u32 mode; - __u32 nlink; - __u32 uid; - __u32 gid; - __u64 size; - __u64 used; - __u32 rdev_maj; - __u32 rdev_min; - __u32 fsid; - __u32 fileid; - struct nfs_time atime; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs3_wcc_attr { - __u64 size; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -struct nfs3_wcc_data { - struct nfs3_wcc_attr before; - struct nfs3_wcc_attr after; -}; - -struct nfs3_sattr { - __u32 valid; - __u32 mode; - __u32 uid; - __u32 gid; - __u64 size; - struct nfs_time atime; - struct nfs_time mtime; -}; - -struct nfs3_entry { - __u32 fileid; - char * name; - unsigned int length; - __u32 cookie; - __u32 eof; -}; - -struct nfs3_fsinfo { - __u32 tsize; - __u32 bsize; - __u32 blocks; - __u32 bfree; - __u32 bavail; -}; - -#ifdef NFS_NEED_XDR_TYPES - -struct nfs3_sattrargs { - struct nfs_fh * fh; - struct nfs_sattr * sattr; -}; - -struct nfs3_diropargs { - struct nfs_fh * fh; - const char * name; -}; - -struct nfs3_readargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - void * buffer; -}; - -struct nfs3_writeargs { - struct nfs_fh * fh; - __u32 offset; - __u32 count; - const void * buffer; -}; - -struct nfs3_createargs { - struct nfs_fh * fh; - const char * name; - struct nfs_sattr * sattr; -}; - -struct nfs3_renameargs { - struct nfs_fh * fromfh; - const char * fromname; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs3_linkargs { - struct nfs_fh * fromfh; - struct nfs_fh * tofh; - const char * toname; -}; - -struct nfs3_symlinkargs { - struct nfs_fh * fromfh; - const char * fromname; - const char * topath; - struct nfs_sattr * sattr; -}; - -struct nfs3_readdirargs { - struct nfs_fh * fh; - __u32 cookie; - void * buffer; - unsigned int bufsiz; -}; - -struct nfs3_diropok { - struct nfs_fh * fh; - struct nfs_fattr * fattr; -}; - -struct nfs3_readres { - struct nfs_fattr * fattr; - unsigned int count; -}; - -struct nfs3_readlinkres { - char ** string; - unsigned int * lenp; - unsigned int maxlen; - void * buffer; -}; - -struct nfs3_readdirres { - void * buffer; - unsigned int bufsiz; -}; - -/* - * The following are for NFSv3 - */ -struct nfs3_fh { - __u32 size; - __u8 data[NFS3_FHSIZE] -}; - -struct nfs3_wcc_attr { - __u64 size; - struct nfs_time mtime; - struct nfs_time ctime; -}; - -#endif /* NFS_NEED_XDR_TYPES */ #endif /* __KERNEL__ */ - -#endif +#endif /* _LINUX_NFS3_H */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 19f1740f1..5f9a5dded 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -10,14 +10,16 @@ #define _LINUX_NFS_FS_H #include <linux/config.h> -#include <linux/signal.h> -#include <linux/sched.h> -#include <linux/pagemap.h> #include <linux/in.h> +#include <linux/mm.h> +#include <linux/pagemap.h> + +#include <linux/sunrpc/debug.h> -#include <linux/sunrpc/sched.h> #include <linux/nfs.h> -#include <linux/nfs_mount.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> +#include <linux/nfs_xdr.h> /* * Enable debugging support for nfs client. @@ -63,17 +65,20 @@ #define NFS_DSERVER(dentry) (&(dentry)->d_sb->u.nfs_sb.s_server) #define NFS_SERVER(inode) (&(inode)->i_sb->u.nfs_sb.s_server) #define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) +#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) #define NFS_REQUESTLIST(inode) (NFS_SERVER(inode)->rw_requests) #define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) #define NFS_CONGESTED(inode) (RPC_CONGESTED(NFS_CLIENT(inode))) - +#define NFS_COOKIEVERF(inode) ((inode)->u.nfs_i.cookieverf) #define NFS_READTIME(inode) ((inode)->u.nfs_i.read_cache_jiffies) -#define NFS_OLDMTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) +#define NFS_CACHE_CTIME(inode) ((inode)->u.nfs_i.read_cache_ctime) +#define NFS_CACHE_MTIME(inode) ((inode)->u.nfs_i.read_cache_mtime) +#define NFS_CACHE_ATIME(inode) ((inode)->u.nfs_i.read_cache_atime) +#define NFS_CACHE_ISIZE(inode) ((inode)->u.nfs_i.read_cache_isize) #define NFS_NEXTSCAN(inode) ((inode)->u.nfs_i.nextscan) #define NFS_CACHEINV(inode) \ do { \ - NFS_READTIME(inode) = jiffies - 1000000; \ - NFS_OLDMTIME(inode) = 0; \ + NFS_READTIME(inode) = jiffies - NFS_MAXATTRTIMEO(inode) - 1; \ } while (0) #define NFS_ATTRTIMEO(inode) ((inode)->u.nfs_i.attrtimeo) #define NFS_MINATTRTIMEO(inode) \ @@ -82,15 +87,18 @@ do { \ #define NFS_MAXATTRTIMEO(inode) \ (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ : NFS_SERVER(inode)->acregmax) +#define NFS_ATTRTIMEO_UPDATE(inode) ((inode)->u.nfs_i.attrtimeo_timestamp) #define NFS_FLAGS(inode) ((inode)->u.nfs_i.flags) #define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) -#define NFS_COOKIES(inode) ((inode)->u.nfs_i.cookies) -#define NFS_DIREOF(inode) ((inode)->u.nfs_i.direof) #define NFS_FILEID(inode) ((inode)->u.nfs_i.fileid) #define NFS_FSID(inode) ((inode)->u.nfs_i.fsid) +/* Inode Flags */ +#define NFS_USE_READDIRPLUS(inode) ((NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS) ? 1 : 0) +#define NFS_MONOTONE_COOKIES(inode) ((NFS_SERVER(inode)->flags & NFS_NONMONOTONE_COOKIES) ? 0 : 1) + /* * These are the default flags for swap requests */ @@ -124,45 +132,6 @@ unsigned long page_index(struct page *page) } #ifdef __KERNEL__ - -/* - * linux/fs/nfs/proc.c - */ -extern int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); -extern int nfs_proc_setattr(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fattr *fattr, struct iattr *sattr); -extern int nfs_proc_lookup(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct nfs_fh *fhandle, - struct nfs_fattr *fattr); -extern int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle, - int swap, unsigned long offset, unsigned int count, - void *buffer, struct nfs_fattr *fattr); -extern int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle, - int swap, unsigned long offset, unsigned int count, - const void *buffer, struct nfs_fattr *fattr); -extern int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct iattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); -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); -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, - const char *name, const char *path, - struct iattr *sattr); -extern int nfs_proc_mkdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name, struct iattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr); -extern int nfs_proc_rmdir(struct nfs_server *server, struct nfs_fh *dir, - const char *name); -extern int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, - struct nfs_fsinfo *res); - - /* * linux/fs/nfs/inode.c */ @@ -191,8 +160,6 @@ extern struct address_space_operations nfs_file_aops; extern struct inode_operations nfs_dir_inode_operations; extern struct file_operations nfs_dir_operations; extern struct dentry_operations nfs_dentry_operations; -extern void nfs_flush_dircache(struct inode *); -extern void nfs_free_dircache(struct inode *); /* * linux/fs/nfs/symlink.c @@ -244,7 +211,7 @@ nfs_wb_all(struct inode *inode) static inline int nfs_wb_page(struct inode *inode, struct page* page) { - int error = nfs_sync_file(inode, 0, page_offset(page), PAGE_CACHE_SIZE, FLUSH_WAIT | FLUSH_STABLE); + int error = nfs_sync_file(inode, 0, page_index(page), 1, FLUSH_WAIT | FLUSH_STABLE); return (error < 0) ? error : 0; } @@ -268,6 +235,7 @@ extern int nfs_readpage(struct dentry *, struct page *); * (Used only by nfsroot module) */ extern int nfs_mount(struct sockaddr_in *, char *, struct nfs_fh *); +extern int nfs3_mount(struct sockaddr_in *, char *, struct nfs_fh *); /* * inline functions @@ -281,6 +249,30 @@ nfs_revalidate_inode(struct nfs_server *server, struct dentry *dentry) return __nfs_revalidate_inode(server, dentry); } +static inline loff_t +nfs_size_to_loff_t(__u64 size) +{ + loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1; + if (size > maxsz) + return maxsz; + return (loff_t) size; +} + +static inline ino_t +nfs_fileid_to_ino_t(u64 fileid) +{ + ino_t ino = (ino_t) fileid; + if (sizeof(ino_t) < sizeof(u64)) + ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; + return ino; +} + +static inline time_t +nfs_time_to_secs(__u64 time) +{ + return (time_t)(time >> 32); +} + /* NFS root */ extern int nfs_root_mount(struct super_block *sb); diff --git a/include/linux/nfs_fs_i.h b/include/linux/nfs_fs_i.h index d4a80639b..05e259900 100644 --- a/include/linux/nfs_fs_i.h +++ b/include/linux/nfs_fs_i.h @@ -1,8 +1,8 @@ #ifndef _NFS_FS_I #define _NFS_FS_I -#include <linux/nfs.h> -#include <linux/pipe_fs_i.h> +#include <asm/types.h> +#include <linux/list.h> /* * nfs fs inode data in memory @@ -11,8 +11,8 @@ struct nfs_inode_info { /* * The 64bit 'inode number' */ - __u32 fsid; - __u32 fileid; + __u64 fsid; + __u64 fileid; /* * Various flags @@ -37,8 +37,18 @@ struct nfs_inode_info { * mtime != read_cache_mtime */ unsigned long read_cache_jiffies; - unsigned long read_cache_mtime; + __u64 read_cache_ctime; + __u64 read_cache_mtime; + __u64 read_cache_atime; + __u64 read_cache_isize; unsigned long attrtimeo; + unsigned long attrtimeo_timestamp; + + /* + * This is the cookie verifier used for NFSv3 readdir + * operations + */ + __u32 cookieverf[2]; /* * This is the list of dirty unwritten pages. @@ -55,15 +65,12 @@ struct nfs_inode_info { struct inode *hash_next, *hash_prev; unsigned long nextscan; - - /* Readdir caching information. */ - void *cookies; - u32 direof; }; /* * Legal inode flag values */ +#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ #define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ #define NFS_IS_SNAPSHOT 0x0010 /* a snapshot file */ #define NFS_INO_FLUSH 0x0020 /* inode is due for flushing */ @@ -74,6 +81,7 @@ struct nfs_inode_info { struct nfs_lock_info { u32 state; u32 flags; + struct nlm_host *host; }; /* diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 418faaa33..da76c1d62 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -1,22 +1,22 @@ #ifndef _NFS_FS_SB #define _NFS_FS_SB -#include <linux/nfs.h> -#include <linux/in.h> - /* * NFS client parameters stored in the superblock. */ struct nfs_server { struct rpc_clnt * client; /* RPC client handle */ + struct nfs_rpc_ops * rpc_ops; /* NFS protocol vector */ int flags; /* various flags */ - int rsize; /* read size */ - int wsize; /* write size */ + unsigned int rsize; /* read size */ + unsigned int wsize; /* write size */ + unsigned int dtsize; /* readdir size */ unsigned int bsize; /* server block size */ unsigned int acregmin; /* attr cache timeouts */ unsigned int acregmax; unsigned int acdirmin; unsigned int acdirmax; + unsigned int namelen; char * hostname; /* remote hostname */ struct nfs_reqlist * rw_requests; /* async read/write requests */ }; @@ -26,7 +26,6 @@ struct nfs_server { */ struct nfs_sb_info { struct nfs_server s_server; - struct nfs_fh s_root; }; #endif diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h index 60493b150..8e11ef368 100644 --- a/include/linux/nfs_mount.h +++ b/include/linux/nfs_mount.h @@ -8,6 +8,8 @@ * * structure passed from user-space to kernel-space during an nfs mount */ +#include <linux/in.h> +#include <linux/nfs.h> /* * WARNING! Do not delete or change the order of these fields. If @@ -16,12 +18,12 @@ * mount-to-kernel version compatibility. Some of these aren't used yet * but here they are anyway. */ -#define NFS_MOUNT_VERSION 3 +#define NFS_MOUNT_VERSION 4 struct nfs_mount_data { int version; /* 1 */ int fd; /* 1 */ - struct nfs_fh root; /* 1 */ + struct nfs2_fh old_root; /* 1 */ int flags; /* 1 */ int rsize; /* 1 */ int wsize; /* 1 */ @@ -35,6 +37,7 @@ struct nfs_mount_data { char hostname[256]; /* 1 */ int namlen; /* 2 */ unsigned int bsize; /* 3 */ + struct nfs_fh root; /* 4 */ }; /* bits in the flags field */ @@ -49,5 +52,13 @@ struct nfs_mount_data { #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_FLAGMASK 0xFFFF + +/* + * Private flags - not to be set by mount program + */ +#ifdef __KERNEL__ +#define NFS_NONMONOTONE_COOKIES 0x00010000 +#endif /* __KERNEL__ */ #endif diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h new file mode 100644 index 000000000..eca3e1b2d --- /dev/null +++ b/include/linux/nfs_xdr.h @@ -0,0 +1,374 @@ +#ifndef _LINUX_NFS_XDR_H +#define _LINUX_NFS_XDR_H + +extern struct rpc_program nfs_program; +extern struct rpc_stat nfs_rpcstat; + +struct nfs_fattr { + unsigned short valid; /* which fields are valid */ + __u64 pre_size; /* pre_op_attr.size */ + __u64 pre_mtime; /* pre_op_attr.mtime */ + __u64 pre_ctime; /* pre_op_attr.ctime */ + enum nfs_ftype type; /* always use NFSv2 types */ + __u32 mode; + __u32 nlink; + __u32 uid; + __u32 gid; + __u64 size; + union { + struct { + __u32 blocksize; + __u32 blocks; + } nfs2; + struct { + __u64 used; + } nfs3; + } du; + __u32 rdev; + __u64 fsid; + __u64 fileid; + __u64 atime; + __u64 mtime; + __u64 ctime; +}; + +#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ +#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ +#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ + +/* + * Info on the file system + */ +struct nfs_fsinfo { + __u32 rtmax; /* max. read transfer size */ + __u32 rtpref; /* pref. read transfer size */ + __u32 rtmult; /* reads should be multiple of this */ + __u32 wtmax; /* max. write transfer size */ + __u32 wtpref; /* pref. write transfer size */ + __u32 wtmult; /* writes should be multiple of this */ + __u32 dtpref; /* pref. readdir transfer size */ + __u64 maxfilesize; + __u64 bsize; /* block size */ + __u64 tbytes; /* total size in bytes */ + __u64 fbytes; /* # of free bytes */ + __u64 abytes; /* # of bytes available to user */ + __u64 tfiles; /* # of files */ + __u64 ffiles; /* # of free files */ + __u64 afiles; /* # of files available to user */ + __u32 linkmax;/* max # of hard links */ + __u32 namelen;/* max name length */ +}; + +/* Arguments to the read call. + * Note that NFS_READ_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h + */ +#define NFS_READ_MAXIOV 8 + +struct nfs_readargs { + struct nfs_fh * fh; + __u64 offset; + __u32 count; + unsigned int nriov; + struct iovec iov[NFS_READ_MAXIOV]; +}; + +struct nfs_readres { + struct nfs_fattr * fattr; + unsigned int count; + int eof; +}; + +/* Arguments to the write call. + * Note that NFS_WRITE_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h + */ +#define NFS_WRITE_MAXIOV 8 +struct nfs_writeargs { + struct nfs_fh * fh; + __u32 offset; + __u32 count; + enum nfs3_stable_how stable; + unsigned int nriov; + struct iovec iov[NFS_WRITE_MAXIOV]; +}; + +struct nfs_writeverf { + enum nfs3_stable_how committed; + __u32 verifier[2]; +}; + +struct nfs_writeres { + struct nfs_fattr * fattr; + struct nfs_writeverf * verf; + __u32 count; +}; + +/* + * Argument struct for decode_entry function + */ +struct nfs_entry { + struct page * page; + __u64 ino; + __u64 cookie, + prev_cookie; + const char * name; + unsigned int len; + int eof; + struct nfs_fh fh; + struct nfs_fattr fattr; + unsigned long offset, + prev; +}; + +/* + * The following types are for NFSv2 only. + */ +struct nfs_sattrargs { + struct nfs_fh * fh; + struct iattr * sattr; +}; + +struct nfs_diropargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; +}; + +struct nfs_createargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; +}; + +struct nfs_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + const char * topath; + unsigned int tolen; + struct iattr * sattr; +}; + +struct nfs_readdirargs { + struct nfs_fh * fh; + __u32 cookie; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_diropok { + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs_readlinkargs { + struct nfs_fh * fh; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_readlinkres { + void * buffer; + unsigned int bufsiz; +}; + +struct nfs_readdirres { + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_sattrargs { + struct nfs_fh * fh; + struct iattr * sattr; + unsigned int guard; + __u64 guardtime; +}; + +struct nfs3_diropargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; +}; + +struct nfs3_accessargs { + struct nfs_fh * fh; + __u32 access; +}; + +struct nfs3_createargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; + enum nfs3_createmode createmode; + __u32 verifier[2]; +}; + +struct nfs3_mkdirargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + struct iattr * sattr; +}; + +struct nfs3_symlinkargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + const char * topath; + unsigned int tolen; + struct iattr * sattr; +}; + +struct nfs3_mknodargs { + struct nfs_fh * fh; + const char * name; + unsigned int len; + enum nfs3_ftype type; + struct iattr * sattr; + dev_t rdev; +}; + +struct nfs3_renameargs { + struct nfs_fh * fromfh; + const char * fromname; + unsigned int fromlen; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs3_linkargs { + struct nfs_fh * fromfh; + struct nfs_fh * tofh; + const char * toname; + unsigned int tolen; +}; + +struct nfs3_readdirargs { + struct nfs_fh * fh; + __u64 cookie; + __u32 verf[2]; + void * buffer; + unsigned int bufsiz; + int plus; +}; + +struct nfs3_diropres { + struct nfs_fattr * dir_attr; + struct nfs_fh * fh; + struct nfs_fattr * fattr; +}; + +struct nfs3_accessres { + struct nfs_fattr * fattr; + __u32 access; +}; + +struct nfs3_readlinkargs { + struct nfs_fh * fh; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_readlinkres { + struct nfs_fattr * fattr; + void * buffer; + unsigned int bufsiz; +}; + +struct nfs3_renameres { + struct nfs_fattr * fromattr; + struct nfs_fattr * toattr; +}; + +struct nfs3_linkres { + struct nfs_fattr * dir_attr; + struct nfs_fattr * fattr; +}; + +struct nfs3_readdirres { + struct nfs_fattr * dir_attr; + __u32 * verf; + void * buffer; + unsigned int bufsiz; + int plus; +}; + +/* + * RPC procedure vector for NFSv2/NFSv3 demuxing + */ +struct nfs_rpc_ops { + int version; /* Protocol version */ + + int (*getroot) (struct nfs_server *, struct nfs_fh *, + struct nfs_fattr *); + int (*getattr) (struct dentry *, struct nfs_fattr *); + int (*setattr) (struct dentry *, struct nfs_fattr *, + struct iattr *); + int (*lookup) (struct dentry *, struct qstr *, + struct nfs_fh *, struct nfs_fattr *); + int (*access) (struct dentry *, int , int); + int (*readlink)(struct dentry *, void *, unsigned int); + int (*read) (struct dentry *, struct nfs_fattr *, + int, loff_t, unsigned int, + void *buffer, int *eofp); + int (*write) (struct dentry *, struct nfs_fattr *, + int, loff_t, unsigned int, + void *buffer, struct nfs_writeverf *verfp); + int (*commit) (struct dentry *, struct nfs_fattr *, + unsigned long, unsigned int); + int (*create) (struct dentry *, struct qstr *, struct iattr *, + int, struct nfs_fh *, struct nfs_fattr *); + int (*remove) (struct dentry *, struct qstr *); + int (*rename) (struct dentry *, struct qstr *, + struct dentry *, struct qstr *); + int (*link) (struct dentry *, struct dentry *, struct qstr *); + int (*symlink) (struct dentry *, struct qstr *, struct qstr *, + struct iattr *, struct nfs_fh *, + struct nfs_fattr *); + int (*mkdir) (struct dentry *, struct qstr *, struct iattr *, + struct nfs_fh *, struct nfs_fattr *); + int (*rmdir) (struct dentry *, struct qstr *); + int (*readdir) (struct dentry *, u64 cookie, void *, unsigned int, + int); + int (*mknod) (struct dentry *, struct qstr *, struct iattr *, + dev_t, struct nfs_fh *, struct nfs_fattr *); + int (*statfs) (struct nfs_server *, struct nfs_fh *, + struct nfs_fsinfo *); + u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); +}; + +/* + * NFS_CALL(getattr, inode, (fattr)); + * into + * NFS_PROTO(inode)->getattr(fattr); + */ +#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args + +/* + * Function vectors etc. for the NFS client + */ +extern struct nfs_rpc_ops nfs_v2_clientops; +extern struct nfs_rpc_ops nfs_v3_clientops; +extern struct rpc_version nfs_version2; +extern struct rpc_version nfs_version3; +extern struct rpc_program nfs_program; + +#endif diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h index 22c7ff1e8..f59c6a6ef 100644 --- a/include/linux/nfsd/const.h +++ b/include/linux/nfsd/const.h @@ -10,6 +10,8 @@ #define _LINUX_NFSD_CONST_H #include <linux/nfs.h> +#include <linux/nfs2.h> +#include <linux/nfs3.h> /* * Maximum protocol version supported by knfsd @@ -21,18 +23,6 @@ */ #define NFSSVC_MAXBLKSIZE 8192 -#define NFS2_MAXPATHLEN 1024 -#define NFS2_MAXNAMLEN 255 -#define NFS2_FHSIZE NFS_FHSIZE -#define NFS2_COOKIESIZE 4 - -#define NFS3_MAXPATHLEN PATH_MAX -#define NFS3_MAXNAMLEN NAME_MAX -#define NFS3_FHSIZE 64 -#define NFS3_COOKIEVERFSIZE 8 -#define NFS3_CREATEVERFSIZE 8 -#define NFS3_WRITEVERFSIZE 8 - #ifdef __KERNEL__ #ifndef NFS_SUPER_MAGIC diff --git a/include/linux/pci.h b/include/linux/pci.h index 55423de5c..a5eb6ca4c 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -340,7 +340,7 @@ struct pci_dev { struct resource dma_resource[DEVICE_COUNT_DMA]; struct resource irq_resource[DEVICE_COUNT_IRQ]; - char name[48]; /* device name */ + char name[80]; /* device name */ char slot_name[8]; /* slot name */ int active; /* ISAPnP: device is active */ int ro; /* ISAPnP: read only */ @@ -510,6 +510,7 @@ int pci_assign_resource(struct pci_dev *dev, int i); int pci_claim_resource(struct pci_dev *, int); void pci_assign_unassigned_resources(void); +void pdev_assign_unassigned_resources(struct pci_dev *dev); void pci_set_bus_ranges(void); void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), int (*)(struct pci_dev *, u8, u8)); diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h index d9ba188a0..fc39f2658 100644 --- a/include/linux/ppp_channel.h +++ b/include/linux/ppp_channel.h @@ -16,11 +16,12 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * ==FILEVERSION 20000225== + * ==FILEVERSION 20000322== */ #include <linux/list.h> #include <linux/skbuff.h> +#include <linux/poll.h> struct ppp_channel; @@ -61,7 +62,10 @@ extern int ppp_register_channel(struct ppp_channel *); /* Detach a channel from its PPP unit (e.g. on hangup). */ extern void ppp_unregister_channel(struct ppp_channel *); -/* Get the unit number associated with a channel */ +/* Get the channel number for a channel */ +extern int ppp_channel_index(struct ppp_channel *); + +/* Get the unit number associated with a channel, or -1 if none */ extern int ppp_unit_number(struct ppp_channel *); /* diff --git a/include/linux/proc_fs_i.h b/include/linux/proc_fs_i.h index 5060d08fc..d4bde0989 100644 --- a/include/linux/proc_fs_i.h +++ b/include/linux/proc_fs_i.h @@ -2,7 +2,7 @@ struct proc_inode_info { struct task_struct *task; int type; union { - struct dentry *(*proc_get_link)(struct inode *); + int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); int (*proc_read)(struct task_struct *task, char *page); } op; struct file *file; diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index 9478513f9..6ba4ebbcd 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h @@ -17,6 +17,12 @@ /* ioctls */ +/* compat */ +#define REGISTER_DEV _IO (MD_MAJOR, 1) +#define START_MD _IO (MD_MAJOR, 2) +#define STOP_MD _IO (MD_MAJOR, 3) + + /* status */ #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) diff --git a/include/linux/sched.h b/include/linux/sched.h index 75d010ca4..aa30e2cc1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -185,12 +185,13 @@ struct fs_struct { atomic_t count; int umask; struct dentry * root, * pwd; + struct vfsmount * rootmnt, * pwdmnt; }; #define INIT_FS { \ ATOMIC_INIT(1), \ 0022, \ - NULL, NULL \ + NULL, NULL, NULL, NULL \ } /* Maximum number of active map areas.. This is a random (large) number */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 429089cc5..f229d4f82 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -207,20 +207,45 @@ extern __inline__ atomic_t *skb_datarefp(struct sk_buff *skb) return (atomic_t *)(skb->end); } +/** + * skb_queue_empty - check if a queue is empty + * @list: queue head + * + * Returns true if the queue is empty, false otherwise + */ + extern __inline__ int skb_queue_empty(struct sk_buff_head *list) { return (list->next == (struct sk_buff *) list); } +/** + * skb_get - reference buffer + * @skb: buffer to reference + * + * Makes another reference to a socket buffer and returns a pointer + * to the buffer. + */ + extern __inline__ struct sk_buff *skb_get(struct sk_buff *skb) { atomic_inc(&skb->users); return skb; } -/* If users==1, we are the only owner and are can avoid redundant +/* + * If users==1, we are the only owner and are can avoid redundant * atomic change. */ + +/** + * kfree_skb - free an sk_buff + * @skb: The buffer to free + * + * Drop a reference to the buffer and free it if the usage count has + * hit zero. + */ + extern __inline__ void kfree_skb(struct sk_buff *skb) { if (atomic_read(&skb->users) == 1 || atomic_dec_and_test(&skb->users)) @@ -234,16 +259,47 @@ extern __inline__ void kfree_skb_fast(struct sk_buff *skb) kfree_skbmem(skb); } +/** + * skb_cloned - is the buffer a clone + * @skb: Buffer to check + * + * Returns true if the buffer was generated with skb_clone and is + * one of multiple shared copies of the buffer. Cloned buffers are + * shared data so must not be written to under normal circumstances. + */ + extern __inline__ int skb_cloned(struct sk_buff *skb) { return skb->cloned && atomic_read(skb_datarefp(skb)) != 1; } +/** + * skb_shared - is the buffer shared + * @skb: buffer to check + * + * Returns true if more than one person has a reference to this + * buffer. + */ + extern __inline__ int skb_shared(struct sk_buff *skb) { return (atomic_read(&skb->users) != 1); } +/** + * skb_share_check - check if buffer is shared and if so clone it + * @skb: buffer to check + * @pri: priority for memory allocation + * + * If the buffer is shared the buffer is cloned and the old copy + * drops a reference. A new clone with a single reference is returned. + * If the buffer is not shared the original buffer is returned. When + * being called from interrupt status or with spinlocks held pri must + * be GFP_ATOMIC. + * + * NULL is returned on a memory allocation failure. + */ + extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) { if (skb_shared(skb)) { @@ -263,6 +319,20 @@ extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri) * a packet thats being forwarded. */ +/** + * skb_unshare - make a copy of a shared buffer + * @skb: buffer to check + * @pri: priority for memory allocation + * + * If the socket buffer is a clone then this function creates a new + * copy of the data, drops a reference count on the old copy and returns + * the new copy with the reference count at 1. If the buffer is not a clone + * the original buffer is returned. When called with a spinlock held or + * from interrupt state pri must be GFP_ATOMIC + * + * NULL is returned on a memory allocation failure. + */ + extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) { struct sk_buff *nskb; @@ -273,11 +343,18 @@ extern __inline__ struct sk_buff *skb_unshare(struct sk_buff *skb, int pri) return nskb; } -/* +/** + * skb_peek + * @list_: list to peek at + * * 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(); + * list and someone else may run off with it. You must hold + * the appropriate locks or have a private queue to do this. + * + * Returns NULL for an empty list or a pointer to the head element. + * The reference count is not incremented and the reference is therefore + * volatile. Use with caution. */ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) @@ -288,6 +365,20 @@ extern __inline__ struct sk_buff *skb_peek(struct sk_buff_head *list_) return list; } +/** + * skb_peek_tail + * @list_: list to peek at + * + * 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. You must hold + * the appropriate locks or have a private queue to do this. + * + * Returns NULL for an empty list or a pointer to the tail element. + * The reference count is not incremented and the reference is therefore + * volatile. Use with caution. + */ + extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) { struct sk_buff *list = ((struct sk_buff *)list_)->prev; @@ -296,8 +387,11 @@ extern __inline__ struct sk_buff *skb_peek_tail(struct sk_buff_head *list_) return list; } -/* - * Return the length of an sk_buff queue +/** + * skb_queue_len - get queue length + * @list_: list to measure + * + * Return the length of an sk_buff queue. */ extern __inline__ __u32 skb_queue_len(struct sk_buff_head *list_) @@ -320,6 +414,17 @@ extern __inline__ void skb_queue_head_init(struct sk_buff_head *list) * can only be called with interrupts disabled. */ +/** + * __skb_queue_head - queue a buffer at the list head + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the start of a list. This function takes no locks + * and you must therefore hold required locks before calling it. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { struct sk_buff *prev, *next; @@ -334,6 +439,19 @@ extern __inline__ void __skb_queue_head(struct sk_buff_head *list, struct sk_buf prev->next = newsk; } + +/** + * skb_queue_head - queue a buffer at the list head + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the start of the list. This function takes the + * list lock and can be used safely with other locking sk_buff functions + * safely. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -343,9 +461,17 @@ extern __inline__ void skb_queue_head(struct sk_buff_head *list, struct sk_buff spin_unlock_irqrestore(&list->lock, flags); } -/* - * Insert an sk_buff at the end of a list. - */ +/** + * __skb_queue_tail - queue a buffer at the list tail + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the end of a list. This function takes no locks + * and you must therefore hold required locks before calling it. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { @@ -361,6 +487,18 @@ extern __inline__ void __skb_queue_tail(struct sk_buff_head *list, struct sk_buf prev->next = newsk; } +/** + * skb_queue_tail - queue a buffer at the list tail + * @list: list to use + * @newsk: buffer to queue + * + * Queue a buffer at the tail of the list. This function takes the + * list lock and can be used safely with other locking sk_buff functions + * safely. + * + * A buffer cannot be placed on two lists at the same time. + */ + extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { unsigned long flags; @@ -370,8 +508,13 @@ extern __inline__ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff spin_unlock_irqrestore(&list->lock, flags); } -/* - * Remove an sk_buff from a list. +/** + * __skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. This function does not take any locks + * so must be used with appropriate locks held only. The head item is + * returned or NULL if the list is empty. */ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) @@ -394,6 +537,15 @@ extern __inline__ struct sk_buff *__skb_dequeue(struct sk_buff_head *list) return result; } +/** + * skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. The list lock is taken so the function + * may be used safely with other locking list functions. The head item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *skb_dequeue(struct sk_buff_head *list) { long flags; @@ -421,9 +573,16 @@ extern __inline__ void __skb_insert(struct sk_buff *newsk, list->qlen++; } -/* - * Place a packet before a given packet in a list +/** + * skb_insert - insert a buffer + * @old: buffer to insert before + * @newsk: buffer to insert + * + * Place a packet before a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls + * A buffer cannot be placed on two lists at the same time. */ + extern __inline__ void skb_insert(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -442,6 +601,17 @@ extern __inline__ void __skb_append(struct sk_buff *old, struct sk_buff *newsk) __skb_insert(newsk, old, old->next, old->list); } +/** + * skb_append - append a buffer + * @old: buffer to insert after + * @newsk: buffer to insert + * + * Place a packet after a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls. + * A buffer cannot be placed on two lists at the same time. + */ + + extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; @@ -455,6 +625,7 @@ extern __inline__ void skb_append(struct sk_buff *old, struct sk_buff *newsk) * 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; @@ -469,11 +640,17 @@ extern __inline__ void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *li 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 - * _FIRST_. +/** + * skb_unlink - remove a buffer from a list + * @skb: buffer to remove + * + * Place a packet after a given packet in a list. The list locks are taken + * and this function is atomic with respect to other list locked calls + * + * 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 before it is + * destroyed. */ extern __inline__ void skb_unlink(struct sk_buff *skb) @@ -491,6 +668,16 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) } /* XXX: more streamlined implementation */ + +/** + * __skb_dequeue_tail - remove from the tail of the queue + * @list: list to dequeue from + * + * Remove the tail of the list. This function does not take any locks + * so must be used with appropriate locks held only. The tail item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) { struct sk_buff *skb = skb_peek_tail(list); @@ -499,6 +686,15 @@ extern __inline__ struct sk_buff *__skb_dequeue_tail(struct sk_buff_head *list) return skb; } +/** + * skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. The list lock is taken so the function + * may be used safely with other locking list functions. The tail item is + * returned or NULL if the list is empty. + */ + extern __inline__ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list) { long flags; @@ -522,6 +718,16 @@ extern __inline__ unsigned char *__skb_put(struct sk_buff *skb, unsigned int len return tmp; } +/** + * skb_put - add data to a buffer + * @skb: buffer to use + * @len: amount of data to add + * + * This function extends the used data area of the buffer. If this would + * exceed the total buffer size the kernel will panic. A pointer to the + * first byte of the extra data is returned + */ + extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp=skb->tail; @@ -540,6 +746,16 @@ extern __inline__ unsigned char *__skb_push(struct sk_buff *skb, unsigned int le return skb->data; } +/** + * skb_push - add data to the start of a buffer + * @skb: buffer to use + * @len: amount of data to add + * + * This function extends the used data area of the buffer at the buffer + * start. If this would exceed the total buffer headroom the kernel will + * panic. A pointer to the first byte of the extra data is returned + */ + extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { skb->data-=len; @@ -556,6 +772,17 @@ extern __inline__ char *__skb_pull(struct sk_buff *skb, unsigned int len) return skb->data+=len; } +/** + * skb_pull - remove data from the start of a buffer + * @skb: buffer to use + * @len: amount of data to remove + * + * This function removes data from the start of a buffer, returning + * the memory to the headroom. A pointer to the next data in the buffer + * is returned. Once the data has been pulled future pushes will overwrite + * the old data + */ + extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) { if (len > skb->len) @@ -563,28 +790,61 @@ extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len return __skb_pull(skb,len); } +/** + * skb_headroom - bytes at buffer head + * @skb: buffer to check + * + * Return the number of bytes of free space at the head of an sk_buff + */ + extern __inline__ int skb_headroom(const struct sk_buff *skb) { return skb->data-skb->head; } +/** + * skb_tailroom - bytes at buffer end + * @skb: buffer to check + * + * Return the number of bytes of free space at the tail of an sk_buff + */ + extern __inline__ int skb_tailroom(const struct sk_buff *skb) { return skb->end-skb->tail; } +/** + * skb_reserve - adjust headroom + * @skb: buffer to alter + * @len: bytes to move + * + * Increase the headroom of an empty sk_buff by reducing the tail + * room. This is only allowed for an empty buffer. + */ + 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) { skb->len = len; skb->tail = skb->data+len; } +/** + * skb_trim - remove end from a buffer + * @skb: buffer to alter + * @len: new length + * + * Cut the length of a buffer down by removing data from the tail. If + * the buffer is already under the length specified it is not modified. + */ + extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) { if (skb->len > len) { @@ -592,6 +852,16 @@ extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) } } +/** + * skb_orphan - orphan a buffer + * @skb: buffer to orphan + * + * If a buffer currently has an owner then we call the owners + * destructor function and make the skb unowned. The buffer continues + * to exist but is no longer charged to its former owner. + */ + + extern __inline__ void skb_orphan(struct sk_buff *skb) { if (skb->destructor) @@ -600,6 +870,16 @@ extern __inline__ void skb_orphan(struct sk_buff *skb) skb->sk = NULL; } +/** + * skb_purge - empty a list + * @list: list to empty + * + * Delete all buffers on an sk_buff list. Each buffer is removed from + * the list and one reference dropped. This function takes the list + * lock and is atomic with respect to other list locking functions. + */ + + extern __inline__ void skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; @@ -607,6 +887,16 @@ extern __inline__ void skb_queue_purge(struct sk_buff_head *list) kfree_skb(skb); } +/** + * __skb_purge - empty a list + * @list: list to empty + * + * Delete all buffers on an sk_buff list. Each buffer is removed from + * the list and one reference dropped. This function does not take the + * list lock and the caller must hold the relevant locks to use it. + */ + + extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) { struct sk_buff *skb; @@ -614,6 +904,19 @@ extern __inline__ void __skb_queue_purge(struct sk_buff_head *list) kfree_skb(skb); } +/** + * dev_alloc_skb - allocate an skbuff for sending + * @length: length to allocate + * + * Allocate a new sk_buff and assign it a usage count of one. The + * buffer has unspecified headroom built in. Users should allocate + * the headroom they think they need without accounting for the + * built in space. The built in space is used for optimisations. + * + * NULL is returned in there is no free memory. Although this function + * allocates memory it can be called from an interrupt. + */ + extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) { struct sk_buff *skb; @@ -624,6 +927,22 @@ extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length) return skb; } +/** + * skb_cow - copy a buffer if need be + * @skb: buffer to copy + * @headroom: needed headroom + * + * If the buffer passed lacks sufficient headroom or is a clone then + * it is copied and the additional headroom made available. If there + * is no free memory NULL is returned. The new buffer is returned if + * a copy was made (and the old one dropped a reference). The existing + * buffer is returned otherwise. + * + * This function primarily exists to avoid making two copies when making + * a writable copy of a buffer and then growing the headroom. + */ + + extern __inline__ struct sk_buff * skb_cow(struct sk_buff *skb, unsigned int headroom) { diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 279636434..a45f0ae2e 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -63,6 +63,7 @@ struct rpc_task { void (*tk_callback)(struct rpc_task *); void (*tk_action)(struct rpc_task *); void (*tk_exit)(struct rpc_task *); + void (*tk_release)(struct rpc_task *); void * tk_calldata; /* diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 1e17e52bb..fb33c6b5f 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -10,6 +10,7 @@ #ifndef SUNRPC_SVC_H #define SUNRPC_SVC_H +#include <linux/in.h> #include <linux/sunrpc/types.h> #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/svcauth.h> diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 5a29918e6..98bf0ec20 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -59,6 +59,7 @@ void xdr_init(void); /* * Miscellaneous XDR helper functions */ +u32 * xdr_encode_array(u32 *p, const char *s, unsigned int len); u32 * xdr_encode_string(u32 *p, const char *s); u32 * xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen); u32 * xdr_encode_netobj(u32 *p, const struct xdr_netobj *); @@ -93,6 +94,9 @@ xdr_adjust_iovec(struct iovec *iov, u32 *p) return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base); } +void xdr_shift_iovec(struct iovec *, int, size_t); +void xdr_zero_iovec(struct iovec *, int, size_t); + #endif /* __KERNEL__ */ #endif /* _SUNRPC_XDR_H_ */ diff --git a/include/linux/swap.h b/include/linux/swap.h index d79fd68ef..d24ff0e0a 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -154,7 +154,7 @@ static inline int is_page_shared(struct page *page) return 1; count = page_count(page); if (PageSwapCache(page)) - count += swap_count(page) - 2; + count += swap_count(page) - 2 - !!page->buffers; return count > 1; } @@ -173,6 +173,8 @@ do { \ #define lru_cache_del(page) \ do { \ + if (!PageLocked(page)) \ + BUG(); \ spin_lock(&pagemap_lru_lock); \ list_del(&(page)->lru); \ nr_lru_pages--; \ diff --git a/include/linux/tty.h b/include/linux/tty.h index 48b7e0819..5d3d791d3 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -376,6 +376,9 @@ extern void start_tty(struct tty_struct * tty); extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); extern int tty_register_driver(struct tty_driver *driver); extern int tty_unregister_driver(struct tty_driver *driver); +extern void tty_register_devfs (struct tty_driver *driver, unsigned int flags, + unsigned minor); +extern void tty_unregister_devfs (struct tty_driver *driver, unsigned minor); 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); diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h index 47980eaaf..c1a255da9 100644 --- a/include/linux/udf_fs.h +++ b/include/linux/udf_fs.h @@ -56,12 +56,4 @@ #define udf_info(f, a...) \ printk (KERN_INFO "UDF-fs INFO " ## f, ## a); -#ifdef __KERNEL__ -/* - * Function prototypes (all other prototypes included in udfdecl.h) - */ -extern int init_udf_fs(void); - -#endif /* __KERNEL__ */ - #endif /* !defined(_LINUX_UDF_FS_H) */ diff --git a/include/linux/usb.h b/include/linux/usb.h index c011f8238..772264c52 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1,13 +1,6 @@ #ifndef __LINUX_USB_H #define __LINUX_USB_H -#include <linux/types.h> -#include <linux/ioctl.h> -#include <linux/version.h> -#include <linux/sched.h> -#include <linux/delay.h> -#include <linux/interrupt.h> /* for in_interrupt() */ - /* USB constants */ /* @@ -130,6 +123,12 @@ #ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/ioctl.h> +#include <linux/version.h> +#include <linux/sched.h> +#include <linux/delay.h> +#include <linux/interrupt.h> /* for in_interrupt() */ #include <linux/config.h> #include <linux/list.h> @@ -364,10 +363,9 @@ struct usb_driver { */ typedef int (*usb_device_irq)(int, void *, int, void *); -/* -------------------------------------------------------------------------------------* - * New USB Structures * - * -------------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------* + * New USB Structures * + *----------------------------------------------------------------------------*/ #define USB_DISABLE_SPD 0x0001 #define USB_ISO_ASAP 0x0002 @@ -499,7 +497,7 @@ struct irq_wrapper_data { usb_device_irq handler; }; -/* ------------------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ struct usb_operations { int (*allocate)(struct usb_device *); @@ -712,6 +710,7 @@ static inline unsigned int __default_pipe(struct usb_device *dev) * Send and receive control messages.. */ int usb_new_device(struct usb_device *dev); +int usb_reset_device(struct usb_device *dev); int usb_set_address(struct usb_device *dev); int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, unsigned char descindex, void *buf, int size); diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h new file mode 100644 index 000000000..95eaa937a --- /dev/null +++ b/include/linux/usbdevice_fs.h @@ -0,0 +1,170 @@ +/*****************************************************************************/ + +/* + * usbdevice_fs.h -- USB device file system. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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. + * + * History: + * 0.1 04.01.2000 Created + * + * $Id: usbdevice_fs.h,v 1.1 2000/01/06 18:40:41 tom Exp $ + */ + +/*****************************************************************************/ + +#ifndef _LINUX_USBDEVICE_FS_H +#define _LINUX_USBDEVICE_FS_H + +/* --------------------------------------------------------------------- */ + +#define USBDEVICE_SUPER_MAGIC 0x9fa2 + +/* usbdevfs ioctl codes */ + +struct usbdevfs_ctrltransfer { + __u8 requesttype; + __u8 request; + __u16 value; + __u16 index; + __u16 length; + __u32 timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_bulktransfer { + unsigned int ep; + unsigned int len; + unsigned int timeout; /* in milliseconds */ + void *data; +}; + +struct usbdevfs_setinterface { + unsigned int interface; + unsigned int altsetting; +}; + +struct usbdevfs_disconnectsignal { + unsigned int signr; + void *context; +}; + +#define USBDEVFS_URB_DISABLE_SPD 1 +#define USBDEVFS_URB_ISO_ASAP 2 + +#define USBDEVFS_URB_TYPE_ISO 0 +#define USBDEVFS_URB_TYPE_INTERRUPT 1 +#define USBDEVFS_URB_TYPE_CONTROL 2 +#define USBDEVFS_URB_TYPE_BULK 3 + +struct usbdevfs_iso_packet_desc { + unsigned int length; + unsigned int actual_length; + unsigned int status; +}; + +struct usbdevfs_urb { + unsigned char type; + unsigned char endpoint; + int status; + unsigned int flags; + void *buffer; + int buffer_length; + int actual_length; + int start_frame; + int number_of_packets; + int error_count; + unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ + void *usercontext; + struct usbdevfs_iso_packet_desc iso_frame_desc[0]; +}; + +#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) +#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) +#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) +#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) +#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) +#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) +#define USBDEVFS_DISCARDURB _IO('U', 11) +#define USBDEVFS_REAPURB _IOW('U', 12, void *) +#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) +#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) +#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) +#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) + +/* --------------------------------------------------------------------- */ + +#ifdef __KERNEL__ + +#include <linux/list.h> +#include <asm/semaphore.h> + +/* + * inode number macros + */ +#define ITYPE(x) ((x)&(0xf<<28)) +#define ISPECIAL (0<<28) +#define IBUS (1<<28) +#define IDEVICE (2<<28) +#define IBUSNR(x) (((x)>>8)&0xff) +#define IDEVNR(x) ((x)&0xff) + +#define IROOT 1 + +/* + * sigh. rwsemaphores do not (yet) work from modules + */ + +#define rw_semaphore semaphore +#define init_rwsem init_MUTEX +#define down_read down +#define down_write down +#define up_read up +#define up_write up + + +struct dev_state { + struct list_head list; /* state list */ + struct rw_semaphore devsem; /* protects modifications to dev (dev == NULL indicating disconnect) */ + struct usb_device *dev; + struct file *file; + spinlock_t lock; /* protects the async urb lists */ + struct list_head async_pending; + struct list_head async_completed; + wait_queue_head_t wait; /* wake up if a request completed */ + unsigned int discsignr; + struct task_struct *disctask; + void *disccontext; + unsigned long ifclaimed; +}; + +/* internal methods & data */ +extern struct usb_driver usbdevfs_driver; +extern struct file_operations usbdevfs_drivers_fops; +extern struct file_operations usbdevfs_devices_fops; +extern struct file_operations usbdevfs_device_file_operations; +extern struct inode_operations usbdevfs_device_inode_operations; +extern struct inode_operations usbdevfs_bus_inode_operations; +extern struct file_operations usbdevfs_bus_file_operations; +extern void usbdevfs_conn_disc_event(void); + + +#endif /* __KERNEL__ */ + +/* --------------------------------------------------------------------- */ +#endif /* _LINUX_USBDEVICE_FS_H */ |