summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-03-13 20:55:15 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-03-13 20:55:15 +0000
commit1471f525455788c20b130690e0f104df451aeb43 (patch)
tree3778beba56558beb9a9548ea5b467e9c44ea966f /include/linux
parente80d2c5456d30ebba5b0eb8a9d33e17d815d4d83 (diff)
Merge with Linux 2.3.51.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/adfs_fs.h2
-rw-r--r--include/linux/brlock.h2
-rw-r--r--include/linux/dcache.h5
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/ext2_fs.h2
-rw-r--r--include/linux/fb.h8
-rw-r--r--include/linux/fs.h114
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/if_ec.h21
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--include/linux/iobuf.h9
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/lockd/bind.h3
-rw-r--r--include/linux/lockd/lockd.h3
-rw-r--r--include/linux/lockd/xdr.h13
-rw-r--r--include/linux/lockd/xdr4.h7
-rw-r--r--include/linux/module.h2
-rw-r--r--include/linux/msdos_fs.h2
-rw-r--r--include/linux/msdos_fs_sb.h1
-rw-r--r--include/linux/nbd.h18
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nfsd/nfsd.h70
-rw-r--r--include/linux/nfsd/nfsfh.h127
-rw-r--r--include/linux/nfsd/syscall.h17
-rw-r--r--include/linux/nfsd/xdr.h1
-rw-r--r--include/linux/pci_ids.h8
-rw-r--r--include/linux/shm.h2
-rw-r--r--include/linux/sysctl.h3
-rw-r--r--include/linux/usb.h786
-rw-r--r--include/linux/videodev.h2
31 files changed, 1134 insertions, 108 deletions
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index ae1e69173..c881f0fd6 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -61,6 +61,4 @@ extern inline int adfs_checkbblk(unsigned char *ptr)
#endif
-extern int init_adfs_fs (void);
-
#endif
diff --git a/include/linux/brlock.h b/include/linux/brlock.h
index f28ac1eb7..e68940b0f 100644
--- a/include/linux/brlock.h
+++ b/include/linux/brlock.h
@@ -45,7 +45,7 @@ enum brlock_indices {
#include <linux/cache.h>
#include <linux/spinlock.h>
-#if defined(__i386__)
+#if defined(__i386__) || defined(__ia64__)
#define __BRLOCK_USE_ATOMICS
#else
#undef __BRLOCK_USE_ATOMICS
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3dcad3357..c5ef464b4 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -191,6 +191,11 @@ static __inline__ struct dentry * dget(struct dentry *dentry)
return dentry;
}
+static __inline__ int d_unhashed(struct dentry *dentry)
+{
+ return list_empty(&dentry->d_hash);
+}
+
extern void dput(struct dentry *);
#endif /* __KERNEL__ */
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index 2ba621bc2..cc23e2e0c 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -53,7 +53,7 @@ extern int init_module(void);
extern void cleanup_module(void);
extern struct super_block *efs_read_super(struct super_block *, void *, int);
extern void efs_put_super(struct super_block *);
-extern int efs_statfs(struct super_block *, struct statfs *, int);
+extern int efs_statfs(struct super_block *, struct statfs *);
extern void efs_read_inode(struct inode *);
extern efs_block_t efs_map_block(struct inode *, efs_block_t);
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 67c6fac14..85e8d092f 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -590,7 +590,7 @@ extern void ext2_put_super (struct super_block *);
extern void ext2_write_super (struct super_block *);
extern int ext2_remount (struct super_block *, int *, char *);
extern struct super_block * ext2_read_super (struct super_block *,void *,int);
-extern int ext2_statfs (struct super_block *, struct statfs *, int);
+extern int ext2_statfs (struct super_block *, struct statfs *);
/* truncate.c */
extern void ext2_truncate (struct inode *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 0b55b363b..43bf69f86 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -283,15 +283,19 @@ struct fb_ops {
int (*fb_rasterimg)(struct fb_info *info, int start);
};
+/* fb_info flags */
+#define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */
+#define FBINFO_FLAG_OPEN 2 /* Has this been open already ? */
+
struct fb_info {
char modename[40]; /* default video mode */
kdev_t node;
int flags;
- int open; /* Has this been open already ? */
-#define FBINFO_FLAG_MODULE 1 /* Low-level driver is a module */
+ int count; /* How many using the hardware */
struct fb_var_screeninfo var; /* Current var */
struct fb_fix_screeninfo fix; /* Current fix */
struct fb_monspecs monspecs; /* Current Monitor specs */
+ struct fb_cmap cmap; /* Current cmap */
struct fb_ops *fbops;
char *screen_base; /* Virtual address */
struct display *disp; /* initial display variable */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 45ec949e1..0d472ec6e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -20,6 +20,7 @@
#include <linux/stat.h>
#include <linux/cache.h>
#include <linux/stddef.h>
+#include <linux/string.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
@@ -181,8 +182,6 @@ extern void inode_init(void);
extern void file_table_init(void);
extern void dcache_init(void);
-typedef char buffer_block[BLOCK_SIZE];
-
/* bh state bits */
#define BH_Uptodate 0 /* 1 if the buffer contains valid data */
#define BH_Dirty 1 /* 1 if the buffer is dirty */
@@ -384,6 +383,7 @@ struct inode {
unsigned long i_blocks;
unsigned long i_version;
struct semaphore i_sem;
+ struct semaphore i_zombie;
struct inode_operations *i_op;
struct file_operations *i_fop; /* former ->i_op->default_file_ops */
struct super_block *i_sb;
@@ -704,7 +704,7 @@ struct super_operations {
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
- int (*statfs) (struct super_block *, struct statfs *, int);
+ int (*statfs) (struct super_block *, struct statfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
@@ -724,12 +724,43 @@ struct file_system_type {
const char *name;
int fs_flags;
struct super_block *(*read_super) (struct super_block *, void *, int);
+ struct module *owner;
struct file_system_type * next;
};
+#ifdef MODULE
+#define DECLARE_FSTYPE(var,type,read,flags) \
+struct file_system_type var = { \
+ name: type, \
+ read_super: read, \
+ fs_flags: flags, \
+ owner: THIS_MODULE, \
+}
+#else
+#define DECLARE_FSTYPE(var,type,read,flags) \
+struct file_system_type var = { \
+ name: type, \
+ read_super: read, \
+ fs_flags: flags, \
+}
+#endif
+
+#define DECLARE_FSTYPE_DEV(var,type,read) \
+ DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV)
+
extern int register_filesystem(struct file_system_type *);
extern int unregister_filesystem(struct file_system_type *);
+static inline int vfs_statfs(struct super_block *sb, struct statfs *buf)
+{
+ if (!sb)
+ return -ENODEV;
+ if (!sb->s_op || !sb->s_op->statfs)
+ return -ENOSYS;
+ memset(buf, 0xff, sizeof(struct statfs));
+ return sb->s_op->statfs(sb, buf);
+}
+
/* Return value for VFS lock functions - tells locks.c to lock conventionally
* REALLY kosha for root NFS and nfs_lock
*/
@@ -830,8 +861,6 @@ extern struct file_operations read_pipe_fops;
extern struct file_operations write_pipe_fops;
extern struct file_operations rdwr_pipe_fops;
-extern struct file_system_type *get_fs_type(const char *);
-
extern int fs_may_remount_ro(struct super_block *);
extern int fs_may_mount(kdev_t);
@@ -907,6 +936,7 @@ extern void put_write_access(struct inode *);
extern struct dentry * open_namei(const char *, int, int);
extern struct dentry * do_mknod(const char *, int, dev_t);
extern int do_pipe(int *);
+extern int do_unlink(const char * name);
/* fs/dcache.c -- generic fs support functions */
extern int is_subdir(struct dentry *, struct dentry *);
@@ -1085,7 +1115,7 @@ extern void inode_setattr(struct inode *, struct iattr *);
* other process will be too late..
*/
#define check_parent(dir, dentry) \
- ((dir) == (dentry)->d_parent && !list_empty(&dentry->d_hash))
+ ((dir) == (dentry)->d_parent && !d_unhashed(dentry))
/*
* Locking the parent is needed to:
@@ -1122,11 +1152,8 @@ static inline void unlock_dir(struct dentry *dir)
* Whee.. Deadlock country. Happily there are only two VFS
* operations that does this..
*/
-static inline void double_lock(struct dentry *d1, struct dentry *d2)
+static inline void double_down(struct semaphore *s1, struct semaphore *s2)
{
- struct semaphore *s1 = &d1->d_inode->i_sem;
- struct semaphore *s2 = &d2->d_inode->i_sem;
-
if (s1 != s2) {
if ((unsigned long) s1 < (unsigned long) s2) {
struct semaphore *tmp = s2;
@@ -1137,19 +1164,76 @@ static inline void double_lock(struct dentry *d1, struct dentry *d2)
down(s2);
}
-static inline void double_unlock(struct dentry *d1, struct dentry *d2)
+/*
+ * Ewwwwwwww... _triple_ lock. We are guaranteed that the 3rd argument is
+ * not equal to 1st and not equal to 2nd - the first case (target is parent of
+ * source) would be already caught, the second is plain impossible (target is
+ * its own parent and that case would be caught even earlier). Very messy.
+ * I _think_ that it works, but no warranties - please, look it through.
+ * Pox on bloody lusers who mandated overwriting rename() for directories...
+ */
+
+static inline void triple_down(struct semaphore *s1,
+ struct semaphore *s2,
+ struct semaphore *s3)
+{
+ if (s1 != s2) {
+ if ((unsigned long) s1 < (unsigned long) s2) {
+ if ((unsigned long) s1 < (unsigned long) s3) {
+ struct semaphore *tmp = s3;
+ s3 = s1; s1 = tmp;
+ }
+ if ((unsigned long) s1 < (unsigned long) s2) {
+ struct semaphore *tmp = s2;
+ s2 = s1; s1 = tmp;
+ }
+ } else {
+ if ((unsigned long) s1 < (unsigned long) s3) {
+ struct semaphore *tmp = s3;
+ s3 = s1; s1 = tmp;
+ }
+ if ((unsigned long) s2 < (unsigned long) s3) {
+ struct semaphore *tmp = s3;
+ s3 = s2; s2 = tmp;
+ }
+ }
+ down(s1);
+ } else if ((unsigned long) s2 < (unsigned long) s3) {
+ struct semaphore *tmp = s3;
+ s3 = s2; s2 = tmp;
+ }
+ down(s2);
+ down(s3);
+}
+
+static inline void double_up(struct semaphore *s1, struct semaphore *s2)
{
- struct semaphore *s1 = &d1->d_inode->i_sem;
- struct semaphore *s2 = &d2->d_inode->i_sem;
+ up(s1);
+ if (s1 != s2)
+ up(s2);
+}
+static inline void triple_up(struct semaphore *s1,
+ struct semaphore *s2,
+ struct semaphore *s3)
+{
up(s1);
if (s1 != s2)
up(s2);
- dput(d1);
- dput(d2);
+ up(s3);
}
+static inline void double_lock(struct dentry *d1, struct dentry *d2)
+{
+ double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem);
+}
+static inline void double_unlock(struct dentry *d1, struct dentry *d2)
+{
+ double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem);
+ dput(d1);
+ dput(d2);
+}
#endif /* __KERNEL__ */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 64136c732..248c37b39 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -414,6 +414,7 @@ typedef struct hwif_s {
#if (DISK_RECOVERY_TIME > 0)
unsigned long last_time; /* time when previous rq was done */
#endif
+ byte straight8; /* Alan's straight 8 check */
} ide_hwif_t;
/*
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
index 4883f16a7..8de2f6b69 100644
--- a/include/linux/if_ec.h
+++ b/include/linux/if_ec.h
@@ -34,6 +34,19 @@ struct sockaddr_ec
#ifdef __KERNEL__
+#define EC_HLEN 6
+
+/* This is what an Econet frame looks like on the wire. */
+struct ec_framehdr
+{
+ unsigned char dst_stn;
+ unsigned char dst_net;
+ unsigned char src_stn;
+ unsigned char src_net;
+ unsigned char cb;
+ unsigned char port;
+};
+
struct econet_opt
{
unsigned char cb;
@@ -42,6 +55,14 @@ struct econet_opt
unsigned char net;
};
+struct ec_device
+{
+ unsigned char station, net; /* Econet protocol address */
+};
+
+extern struct sock *ec_listening_socket(unsigned char port, unsigned char
+ station, unsigned char net);
+
#endif
#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 8e33913d3..96974638a 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -5,8 +5,10 @@
#include <linux/kernel.h>
#include <linux/smp.h>
#include <linux/cache.h>
+
#include <asm/bitops.h>
#include <asm/atomic.h>
+#include <asm/ptrace.h>
struct irqaction {
void (*handler)(int, void *, struct pt_regs *);
diff --git a/include/linux/iobuf.h b/include/linux/iobuf.h
index 420285faf..3de43c924 100644
--- a/include/linux/iobuf.h
+++ b/include/linux/iobuf.h
@@ -29,6 +29,8 @@
#define KIO_STATIC_PAGES (KIO_MAX_ATOMIC_IO / (PAGE_SIZE >> 10) + 1)
#define KIO_MAX_SECTORS (KIO_MAX_ATOMIC_IO * 2)
+/* The main kiobuf struct used for all our IO! */
+
struct kiobuf
{
int nr_pages; /* Pages actually referenced */
@@ -46,7 +48,6 @@ struct kiobuf
unsigned int locked : 1; /* If set, pages has been locked */
/* Always embed enough struct pages for 64k of IO */
- unsigned long page_array[KIO_STATIC_PAGES];
struct page * map_array[KIO_STATIC_PAGES];
/* Dynamic state for IO completion: */
@@ -61,10 +62,14 @@ struct kiobuf
int map_user_kiobuf(int rw, struct kiobuf *, unsigned long va, size_t len);
void unmap_kiobuf(struct kiobuf *iobuf);
+int lock_kiovec(int nr, struct kiobuf *iovec[], int wait);
+int unlock_kiovec(int nr, struct kiobuf *iovec[]);
/* fs/iobuf.c */
-void __init kiobuf_init(void);
+void __init kiobuf_setup(void);
+void kiobuf_init(struct kiobuf *);
+void end_kio_request(struct kiobuf *, int);
void simple_wakeup_kiobuf(struct kiobuf *);
int alloc_kiovec(int nr, struct kiobuf **);
void free_kiovec(int nr, struct kiobuf **);
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 7407d39db..69040207e 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1,7 +1,12 @@
#ifndef __irq_h
#define __irq_h
+#include <linux/cache.h>
+#include <linux/spinlock.h>
+
#include <asm/irq.h>
+#include <asm/ptrace.h>
+
/*
* IRQ line status.
*/
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 83abfcf92..f42566696 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -9,7 +9,7 @@
extern int request_module(const char * name);
extern int exec_usermodehelper(char *program_path, char *argv[], char *envp[]);
#else
-#define request_module(x) do {} while(0)
+static inline int request_module(const char * name) { return -ENOSYS; }
extern inline int exec_usermodehelper(char *program_path, char *argv[], char *envp[])
{
return -EACCES;
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 4e0aebedb..40dd93194 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -13,7 +13,6 @@
/* Dummy declarations */
struct svc_rqst;
-struct knfs_fh;
struct svc_client; /* opaque type */
/*
@@ -24,7 +23,7 @@ struct nlmsvc_binding {
void (*exp_unlock)(void);
struct svc_client * (*exp_getclient)(struct sockaddr_in *);
u32 (*fopen)(struct svc_rqst *,
- struct knfs_fh *,
+ struct nfs_fh *,
struct file *);
void (*fclose)(struct file *);
void (*detach)(void);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index cb2c148f1..d949bd649 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -75,13 +75,14 @@ struct nlm_rqst {
*/
struct nlm_file {
struct nlm_file * f_next; /* linked list */
- struct knfs_fh f_handle; /* NFS file handle */
+ struct nfs_fh f_handle; /* NFS file handle */
struct file f_file; /* VFS file pointer */
struct nlm_share * f_shares; /* DOS shares */
struct nlm_block * f_blocks; /* blocked locks */
unsigned int f_locks; /* guesstimate # of locks */
unsigned int f_count; /* reference count */
struct semaphore f_sema; /* avoid concurrent access */
+ int f_hash; /* hash of f_handle */
};
/*
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index f397306c4..72752441e 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,8 +13,15 @@
#include <linux/nfs.h>
#include <linux/sunrpc/xdr.h>
-extern u32 nlm_granted, nlm_lck_denied, nlm_lck_denied_nolocks,
- nlm_lck_blocked, nlm_lck_denied_grace_period;
+#define NLM_MAXSTRLEN 1024
+
+#define QUADLEN(len) (((len) + 3) >> 2)
+
+#define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
+#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
+#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
+#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
+#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
/* Lock info passed via NLM */
struct nlm_lock {
@@ -49,6 +56,8 @@ struct nlm_args {
u32 fsm_mode;
};
+typedef struct nlm_args nlm_args;
+
/*
* Generic lockd result
*/
diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
index d9d7e3f75..cee36e7c0 100644
--- a/include/linux/lockd/xdr4.h
+++ b/include/linux/lockd/xdr4.h
@@ -15,7 +15,12 @@
#include <linux/lockd/xdr.h>
/* error codes new to NLMv4 */
-extern u32 nlm4_deadlock, nlm4_rofs, nlm4_stale_fh, nlm4_fbig, nlm4_failed;
+#define nlm4_deadlock __constant_htonl(NLM_DEADLCK)
+#define nlm4_rofs __constant_htonl(NLM_ROFS)
+#define nlm4_stale_fh __constant_htonl(NLM_STALE_FH)
+#define nlm4_fbig __constant_htonl(NLM_FBIG)
+#define nlm4_failed __constant_htonl(NLM_FAILED)
+
int nlm4svc_decode_testargs(struct svc_rqst *, u32 *, struct nlm_args *);
diff --git a/include/linux/module.h b/include/linux/module.h
index 56d29ce62..915342edd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -145,6 +145,8 @@ struct module_info
/* Find a symbol exported by the kernel or another module */
extern unsigned long get_module_symbol(char *, char *);
+extern int try_inc_mod_count(struct module *mod);
+
#if defined(MODULE) && !defined(__GENKSYMS__)
/* Embedded module documentation macros. */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index de2ccffbd..ce7837f1d 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -247,7 +247,7 @@ extern struct inode *fat_iget(struct super_block*,int);
extern struct inode *fat_build_inode(struct super_block*,struct msdos_dir_entry*,int,int*);
extern struct super_block *fat_read_super(struct super_block *s, void *data, int silent, struct inode_operations *dir_ops);
extern void msdos_put_super(struct super_block *sb);
-extern int fat_statfs(struct super_block *sb,struct statfs *buf, int);
+extern int fat_statfs(struct super_block *sb,struct statfs *buf);
extern void fat_write_inode(struct inode *inode);
/* dir.c */
diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h
index 93053c6b6..de8913cd3 100644
--- a/include/linux/msdos_fs_sb.h
+++ b/include/linux/msdos_fs_sb.h
@@ -53,7 +53,6 @@ struct msdos_sb_info {
struct nls_table *nls_io; /* Charset used for input and display */
struct cvf_format* cvf_format;
void *dir_ops; /* Opaque; default directory operations */
- void (*put_super_callback)(struct super_block *);
void *private_data;
};
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index e5194b28f..cdd77e932 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -30,22 +30,35 @@ extern int requests_in;
extern int requests_out;
#endif
-static void
+static int
nbd_end_request(struct request *req)
{
unsigned long flags;
+ int ret = 0;
#ifdef PARANOIA
requests_out++;
#endif
+ /*
+ * This is a very dirty hack that we have to do to handle
+ * merged requests because end_request stuff is a bit
+ * broken. The fact we have to do this only if there
+ * aren't errors looks even more silly.
+ */
+ if (!req->errors) {
+ req->sector += req->current_nr_sectors;
+ req->nr_sectors -= req->current_nr_sectors;
+ }
+
spin_lock_irqsave(&io_request_lock, flags);
if (end_that_request_first( req, !req->errors, "nbd" ))
goto out;
+ ret = 1;
end_that_request_last( req );
out:
spin_unlock_irqrestore(&io_request_lock, flags);
- return;
+ return ret;
}
#define MAX_NBD 128
@@ -56,7 +69,6 @@ struct nbd_device {
int harderror; /* Code of hard error */
#define NBD_READ_ONLY 0x0001
#define NBD_WRITE_NOCHK 0x0002
-#define NBD_INITIALISED 0x0004
struct socket * sock;
struct file * file; /* If == NULL, device is not ready, yet */
int magic; /* FIXME: not if debugging is off */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 0704c88e1..45f6dd0e0 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -89,7 +89,7 @@ struct svc_client * exp_getclient(struct sockaddr_in *sin);
void exp_putclient(struct svc_client *clp);
struct svc_export * exp_get(struct svc_client *clp, kdev_t dev, ino_t ino);
int exp_rootfh(struct svc_client *, kdev_t, ino_t,
- char *path, struct knfs_fh *);
+ char *path, struct knfsd_fh *, int maxsize);
int nfserrno(int errno);
void exp_nlmdetach(void);
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index d71a6923b..a2f4897fc 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -100,7 +100,7 @@ void nfsd_close(struct file *);
int nfsd_read(struct svc_rqst *, struct svc_fh *,
loff_t, char *, unsigned long *);
int nfsd_write(struct svc_rqst *, struct svc_fh *,
- loff_t, char *, unsigned long, int);
+ loff_t, char *, unsigned long, int *);
int nfsd_readlink(struct svc_rqst *, struct svc_fh *,
char *, int *);
int nfsd_symlink(struct svc_rqst *, struct svc_fh *,
@@ -129,8 +129,6 @@ int nfsd_commit(struct svc_rqst *, struct svc_fh *,
int nfsd_notify_change(struct inode *, struct iattr *);
int nfsd_permission(struct svc_export *, struct dentry *, int);
-/* nfsd/nfsctl.c */
-void nfsd_modcount(struct inode *, int);
/*
* lockd binding
@@ -140,43 +138,39 @@ void nfsd_lockd_shutdown(void);
void nfsd_lockd_unexport(struct svc_client *);
-#ifndef makedev
-#define makedev(maj, min) (((maj) << 8) | (min))
-#endif
-
/*
- * These variables contain pre-xdr'ed values for faster operation.
- * FIXME: should be replaced by macros for big-endian machines.
+ * These macros provide pre-xdr'ed values for faster operation.
*/
-extern u32 nfs_ok,
- nfserr_perm,
- nfserr_noent,
- nfserr_io,
- nfserr_nxio,
- nfserr_acces,
- nfserr_exist,
- nfserr_xdev,
- nfserr_nodev,
- nfserr_notdir,
- nfserr_isdir,
- nfserr_inval,
- nfserr_fbig,
- nfserr_nospc,
- nfserr_rofs,
- nfserr_mlink,
- nfserr_nametoolong,
- nfserr_notempty,
- nfserr_dquot,
- nfserr_stale,
- nfserr_remote,
- nfserr_badhandle,
- nfserr_notsync,
- nfserr_badcookie,
- nfserr_notsupp,
- nfserr_toosmall,
- nfserr_serverfault,
- nfserr_badtype,
- nfserr_jukebox;
+#define nfs_ok __constant_htonl(NFS_OK)
+#define nfserr_perm __constant_htonl(NFSERR_PERM)
+#define nfserr_noent __constant_htonl(NFSERR_NOENT)
+#define nfserr_io __constant_htonl(NFSERR_IO)
+#define nfserr_nxio __constant_htonl(NFSERR_NXIO)
+#define nfserr_acces __constant_htonl(NFSERR_ACCES)
+#define nfserr_exist __constant_htonl(NFSERR_EXIST)
+#define nfserr_xdev __constant_htonl(NFSERR_XDEV)
+#define nfserr_nodev __constant_htonl(NFSERR_NODEV)
+#define nfserr_notdir __constant_htonl(NFSERR_NOTDIR)
+#define nfserr_isdir __constant_htonl(NFSERR_ISDIR)
+#define nfserr_inval __constant_htonl(NFSERR_INVAL)
+#define nfserr_fbig __constant_htonl(NFSERR_FBIG)
+#define nfserr_nospc __constant_htonl(NFSERR_NOSPC)
+#define nfserr_rofs __constant_htonl(NFSERR_ROFS)
+#define nfserr_mlink __constant_htonl(NFSERR_MLINK)
+#define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP)
+#define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG)
+#define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY)
+#define nfserr_dquot __constant_htonl(NFSERR_DQUOT)
+#define nfserr_stale __constant_htonl(NFSERR_STALE)
+#define nfserr_remote __constant_htonl(NFSERR_REMOTE)
+#define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE)
+#define nfserr_notsync __constant_htonl(NFSERR_NOTSYNC)
+#define nfserr_badcookie __constant_htonl(NFSERR_BADCOOKIE)
+#define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP)
+#define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL)
+#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT)
+#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)
+#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX)
/*
* Time of server startup
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 20e850ec5..83320b810 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -25,34 +25,95 @@
#include <linux/nfsd/debug.h>
/*
- * This is the new "dentry style" Linux NFSv2 file handle.
+ * This is the old "dentry style" Linux NFSv2 file handle.
*
* The xino and xdev fields are currently used to transport the
* ino/dev of the exported inode.
*/
-struct nfs_fhbase {
- struct dentry * fb_dentry; /* dentry cookie */
+struct nfs_fhbase_old {
+ struct dentry * fb_dentry; /* dentry cookie - always 0xfeebbaca */
__u32 fb_ino; /* our inode number */
- __u32 fb_dirino; /* dir inode number */
+ __u32 fb_dirino; /* dir inode number, 0 for directories */
__u32 fb_dev; /* our device */
__u32 fb_xdev;
__u32 fb_xino;
__u32 fb_generation;
};
-#define NFS_FH_PADDING (NFS_FHSIZE - sizeof(struct nfs_fhbase))
-struct knfs_fh {
- struct nfs_fhbase fh_base;
- __u8 fh_cookie[NFS_FH_PADDING];
+/*
+ * This is the new flexible, extensible style NFSv2/v3 file handle.
+ * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
+ *
+ * The file handle is seens as a list of 4byte words.
+ * The first word contains a version number (1) and four descriptor bytes
+ * that tell how the remaining 3 variable length fields should be handled.
+ * These three bytes are auth_type, fsid_type and fileid_type.
+ *
+ * All 4byte values are in host-byte-order.
+ *
+ * The auth_type field specifies how the filehandle can be authenticated
+ * This might allow a file to be confirmed to be in a writable part of a
+ * filetree without checking the path from it upto the root.
+ * Current values:
+ * 0 - No authentication. fb_auth is 0 bytes long
+ * Possible future values:
+ * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
+ * prefixed by a secret and with the important export flags.
+ *
+ * The fsid_type identifies how the filesystem (or export point) is
+ * encoded.
+ * Current values:
+ * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number
+ * NOTE: we cannot use the kdev_t device id value, because kdev_t.h
+ * says we mustn't. We must break it up and reassemble.
+ * Possible future encodings:
+ * 1 - 4 byte user specified identifier
+ *
+ * The fileid_type identified how the file within the filesystem is encoded.
+ * This is (will be) passed to, and set by, the underlying filesystem if it supports
+ * filehandle operations. The filesystem must not use the value '0' or '0xff' and may
+ * only use the values 1 and 2 as defined below:
+ * Current values:
+ * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
+ * 1 - 32bit inode number, 32 bit generation number.
+ * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
+ *
+ */
+struct nfs_fhbase_new {
+ __u8 fb_version; /* == 1, even => nfs_fhbase_old */
+ __u8 fb_auth_type;
+ __u8 fb_fsid_type;
+ __u8 fb_fileid_type;
+ __u32 fb_auth[1];
+/* __u32 fb_fsid[0]; floating */
+/* __u32 fb_fileid[0]; floating */
+};
+
+struct knfsd_fh {
+ int fh_size; /* significant for NFSv3.
+ * Points to the current size while building
+ * a new file handle
+ */
+ union {
+ struct nfs_fhbase_old fh_old;
+ __u32 fh_pad[NFS3_FHSIZE/4];
+ struct nfs_fhbase_new fh_new;
+ } fh_base;
};
-#define fh_dcookie fh_base.fb_dentry
-#define fh_ino fh_base.fb_ino
-#define fh_dirino fh_base.fb_dirino
-#define fh_dev fh_base.fb_dev
-#define fh_xdev fh_base.fb_xdev
-#define fh_xino fh_base.fb_xino
-#define fh_generation fh_base.fb_generation
+#define ofh_dcookie fh_base.fh_old.fb_dentry
+#define ofh_ino fh_base.fh_old.fb_ino
+#define ofh_dirino fh_base.fh_old.fb_dirino
+#define ofh_dev fh_base.fh_old.fb_dev
+#define ofh_xdev fh_base.fh_old.fb_xdev
+#define ofh_xino fh_base.fh_old.fb_xino
+#define ofh_generation fh_base.fh_old.fb_generation
+
+#define fh_version fh_base.fh_new.fb_version
+#define fh_fsid_type fh_base.fh_new.fb_fsid_type
+#define fh_auth_type fh_base.fh_new.fb_auth_type
+#define fh_fileid_type fh_base.fh_new.fb_fileid_type
+#define fh_auth fh_base.fh_new.fb_auth
#ifdef __KERNEL__
@@ -84,9 +145,10 @@ extern inline ino_t u32_to_ino_t(__u32 uino)
* pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
*/
typedef struct svc_fh {
- struct knfs_fh fh_handle; /* FH data */
+ struct knfsd_fh fh_handle; /* FH data */
struct dentry * fh_dentry; /* validated dentry */
struct svc_export * fh_export; /* export pointer */
+ int fh_maxsize; /* max size for fh_handle */
#ifdef CONFIG_NFSD_V3
unsigned char fh_post_saved; /* post-op attrs saved */
unsigned char fh_pre_saved; /* pre-op attrs saved */
@@ -119,20 +181,28 @@ typedef struct svc_fh {
/*
* Shorthand for dprintk()'s
*/
-#define SVCFH_DENTRY(f) ((f)->fh_dentry)
-#define SVCFH_INO(f) ((f)->fh_handle.fh_ino)
-#define SVCFH_DEV(f) ((f)->fh_handle.fh_dev)
-
+inline static char * SVCFH_fmt(struct svc_fh *fhp)
+{
+ struct knfsd_fh *fh = &fhp->fh_handle;
+
+ static char buf[80];
+ sprintf(buf, "%d: %08x %08x %08x %08x %08x %08x",
+ fh->fh_size,
+ fh->fh_base.fh_pad[0],
+ fh->fh_base.fh_pad[1],
+ fh->fh_base.fh_pad[2],
+ fh->fh_base.fh_pad[3],
+ fh->fh_base.fh_pad[4],
+ fh->fh_base.fh_pad[5]);
+ return buf;
+}
/*
* Function prototypes
*/
u32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int);
-void fh_compose(struct svc_fh *, struct svc_export *, struct dentry *);
-void fh_update(struct svc_fh *);
+int fh_compose(struct svc_fh *, struct svc_export *, struct dentry *);
+int fh_update(struct svc_fh *);
void fh_put(struct svc_fh *);
-void nfsd_fh_flush(kdev_t);
-void nfsd_fh_init(void);
-void nfsd_fh_free(void);
static __inline__ struct svc_fh *
fh_copy(struct svc_fh *dst, struct svc_fh *src)
@@ -148,9 +218,10 @@ fh_copy(struct svc_fh *dst, struct svc_fh *src)
}
static __inline__ struct svc_fh *
-fh_init(struct svc_fh *fhp)
+fh_init(struct svc_fh *fhp, int maxsize)
{
memset(fhp, 0, sizeof(*fhp));
+ fhp->fh_maxsize = maxsize;
return fhp;
}
@@ -216,8 +287,8 @@ fh_lock(struct svc_fh *fhp)
struct dentry *dentry = fhp->fh_dentry;
struct inode *inode;
- dfprintk(FILEOP, "nfsd: fh_lock(%x/%ld) locked = %d\n",
- SVCFH_DEV(fhp), (long)SVCFH_INO(fhp), fhp->fh_locked);
+ dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
+ SVCFH_fmt(fhp), fhp->fh_locked);
if (!fhp->fh_dverified) {
printk(KERN_ERR "fh_lock: fh not verified!\n");
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index 1d42ec550..af723ced8 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -37,6 +37,7 @@
#define NFSCTL_UGIDUPDATE 5 /* update a client's uid/gid map. */
#define NFSCTL_GETFH 6 /* get an fh by ino (used by mountd) */
#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
+#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
/* SVC */
struct nfsctl_svc {
@@ -91,6 +92,13 @@ struct nfsctl_fdparm {
int gd_version;
};
+/* GETFS - GET Filehandle with Size */
+struct nfsctl_fsparm {
+ struct sockaddr gd_addr;
+ char gd_path[NFS_MAXPATHLEN+1];
+ int gd_maxlen;
+};
+
/*
* This is the argument union.
*/
@@ -103,6 +111,9 @@ struct nfsctl_arg {
struct nfsctl_uidmap u_umap;
struct nfsctl_fhparm u_getfh;
struct nfsctl_fdparm u_getfd;
+#ifdef notyet
+ struct nfsctl_fsparm u_getfs;
+#endif
unsigned int u_debug;
} u;
#define ca_svc u.u_svc
@@ -111,12 +122,16 @@ struct nfsctl_arg {
#define ca_umap u.u_umap
#define ca_getfh u.u_getfh
#define ca_getfd u.u_getfd
+#define ca_getfs u.u_getfs
#define ca_authd u.u_authd
#define ca_debug u.u_debug
};
union nfsctl_res {
- struct knfs_fh cr_getfh;
+ __u8 cr_getfh[NFS_FHSIZE];
+#ifdef notyet
+ struct knfsd_fh cr_getfs;
+#endif
unsigned int cr_debug;
};
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index bc47b8bac..323c62b83 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -121,7 +121,6 @@ union nfsd_xdrstore {
#define NFSSVC_XDRSIZE sizeof(union nfsd_xdrstore)
-void nfsd_xdr_init(void);
int nfssvc_decode_void(struct svc_rqst *, u32 *, void *);
int nfssvc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index b7911143f..d9909e0cc 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -670,7 +670,9 @@
#define PCI_DEVICE_ID_TTI_HPT366 0x0004
#define PCI_VENDOR_ID_VIA 0x1106
+#define PCI_DEVICE_ID_VIA_8371_0 0x0391
#define PCI_DEVICE_ID_VIA_8501_0 0x0501
+#define PCI_DEVICE_ID_VIA_8601_0 0x0601
#define PCI_DEVICE_ID_VIA_82C505 0x0505
#define PCI_DEVICE_ID_VIA_82C561 0x0561
#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
@@ -694,9 +696,12 @@
#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
#define PCI_DEVICE_ID_VIA_82C686_6 0x3068
#define PCI_DEVICE_ID_VIA_86C100A 0x6100
+#define PCI_DEVICE_ID_VIA_8231 0x8231
+#define PCI_DEVICE_ID_VIA_8371_1 0x8391
#define PCI_DEVICE_ID_VIA_8501_1 0x8501
#define PCI_DEVICE_ID_VIA_82C597_1 0x8597
#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
+#define PCI_DEVICE_ID_VIA_8601_1 0x8601
#define PCI_VENDOR_ID_SMC2 0x1113
#define PCI_DEVICE_ID_SMC2_1211TX 0x1211
@@ -1052,6 +1057,9 @@
#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
+#define PCI_VENDOR_ID_AFAVLAB 0x14db
+#define PCI_DEVICE_ID_AFAVLAB_TK9902 0x2120
+
#define PCI_VENDOR_ID_SYMPHONY 0x1c1c
#define PCI_DEVICE_ID_SYMPHONY_101 0x0001
diff --git a/include/linux/shm.h b/include/linux/shm.h
index e8b7d1f7c..c1ab5240b 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -10,7 +10,7 @@
*/
#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
-#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */
+#define SHMMIN 0 /* min shared seg size (bytes) */
#define SHMMNI 128 /* max num of segs system wide */
#define SHMALL (SHMMAX/PAGE_SIZE*SHMMNI) /* max shm system wide (pages) */
#define SHMSEG SHMMNI /* max shared segs per process */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 1d91cf216..eb51e575f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -110,7 +110,8 @@ enum
KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */
KERN_SHMMNI=45, /* int: shm array identifiers */
KERN_OVERFLOWUID=46, /* int: overflow UID */
- KERN_OVERFLOWGID=47 /* int: overflow GID */
+ KERN_OVERFLOWGID=47, /* int: overflow GID */
+ KERN_SHMPATH=48, /* string: path to shm fs */
};
diff --git a/include/linux/usb.h b/include/linux/usb.h
new file mode 100644
index 000000000..69f0189aa
--- /dev/null
+++ b/include/linux/usb.h
@@ -0,0 +1,786 @@
+#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 */
+
+/*
+ * Device and/or Interface Class codes
+ */
+#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
+#define USB_CLASS_AUDIO 1
+#define USB_CLASS_COMM 2
+#define USB_CLASS_HID 3
+#define USB_CLASS_PRINTER 7
+#define USB_CLASS_MASS_STORAGE 8
+#define USB_CLASS_HUB 9
+#define USB_CLASS_DATA 10
+#define USB_CLASS_VENDOR_SPEC 0xff
+
+/*
+ * USB types
+ */
+#define USB_TYPE_STANDARD (0x00 << 5)
+#define USB_TYPE_CLASS (0x01 << 5)
+#define USB_TYPE_VENDOR (0x02 << 5)
+#define USB_TYPE_RESERVED (0x03 << 5)
+
+/*
+ * USB recipients
+ */
+#define USB_RECIP_DEVICE 0x00
+#define USB_RECIP_INTERFACE 0x01
+#define USB_RECIP_ENDPOINT 0x02
+#define USB_RECIP_OTHER 0x03
+
+/*
+ * USB directions
+ */
+#define USB_DIR_OUT 0
+#define USB_DIR_IN 0x80
+
+/*
+ * Descriptor types
+ */
+#define USB_DT_DEVICE 0x01
+#define USB_DT_CONFIG 0x02
+#define USB_DT_STRING 0x03
+#define USB_DT_INTERFACE 0x04
+#define USB_DT_ENDPOINT 0x05
+
+#define USB_DT_HID (USB_TYPE_CLASS | 0x01)
+#define USB_DT_REPORT (USB_TYPE_CLASS | 0x02)
+#define USB_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
+#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
+
+/*
+ * Descriptor sizes per descriptor type
+ */
+#define USB_DT_DEVICE_SIZE 18
+#define USB_DT_CONFIG_SIZE 9
+#define USB_DT_INTERFACE_SIZE 9
+#define USB_DT_ENDPOINT_SIZE 7
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
+#define USB_DT_HUB_NONVAR_SIZE 7
+#define USB_DT_HID_SIZE 9
+
+/*
+ * Endpoints
+ */
+#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
+#define USB_ENDPOINT_DIR_MASK 0x80
+
+#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
+#define USB_ENDPOINT_XFER_CONTROL 0
+#define USB_ENDPOINT_XFER_ISOC 1
+#define USB_ENDPOINT_XFER_BULK 2
+#define USB_ENDPOINT_XFER_INT 3
+
+/*
+ * USB Packet IDs (PIDs)
+ */
+#define USB_PID_UNDEF_0 0xf0
+#define USB_PID_OUT 0xe1
+#define USB_PID_ACK 0xd2
+#define USB_PID_DATA0 0xc3
+#define USB_PID_UNDEF_4 0xb4
+#define USB_PID_SOF 0xa5
+#define USB_PID_UNDEF_6 0x96
+#define USB_PID_UNDEF_7 0x87
+#define USB_PID_UNDEF_8 0x78
+#define USB_PID_IN 0x69
+#define USB_PID_NAK 0x5a
+#define USB_PID_DATA1 0x4b
+#define USB_PID_PREAMBLE 0x3c
+#define USB_PID_SETUP 0x2d
+#define USB_PID_STALL 0x1e
+#define USB_PID_UNDEF_F 0x0f
+
+/*
+ * Standard requests
+ */
+#define USB_REQ_GET_STATUS 0x00
+#define USB_REQ_CLEAR_FEATURE 0x01
+#define USB_REQ_SET_FEATURE 0x03
+#define USB_REQ_SET_ADDRESS 0x05
+#define USB_REQ_GET_DESCRIPTOR 0x06
+#define USB_REQ_SET_DESCRIPTOR 0x07
+#define USB_REQ_GET_CONFIGURATION 0x08
+#define USB_REQ_SET_CONFIGURATION 0x09
+#define USB_REQ_GET_INTERFACE 0x0A
+#define USB_REQ_SET_INTERFACE 0x0B
+#define USB_REQ_SYNCH_FRAME 0x0C
+
+/*
+ * HID requests
+ */
+#define USB_REQ_GET_REPORT 0x01
+#define USB_REQ_GET_IDLE 0x02
+#define USB_REQ_GET_PROTOCOL 0x03
+#define USB_REQ_SET_REPORT 0x09
+#define USB_REQ_SET_IDLE 0x0A
+#define USB_REQ_SET_PROTOCOL 0x0B
+
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#include <linux/list.h>
+
+#define USB_MAJOR 180
+
+/* for 2.2-kernels */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+
+static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+typedef struct wait_queue wait_queue_t;
+
+typedef struct wait_queue *wait_queue_head_t;
+#define DECLARE_WAITQUEUE(wait, current) \
+ struct wait_queue wait = { current, NULL }
+#define DECLARE_WAIT_QUEUE_HEAD(wait)\
+ wait_queue_head_t wait
+
+#define init_waitqueue_head(x) *x=NULL
+#define init_MUTEX(x) *(x)=MUTEX
+#define DECLARE_MUTEX(name) struct semaphore name=MUTEX
+#define DECLARE_MUTEX_LOCKED(name) struct semaphore name=MUTEX_LOCKED
+
+
+#define __set_current_state(state_value) \
+ do { current->state = state_value; } while (0)
+#ifdef __SMP__
+#define set_current_state(state_value) \
+ set_mb(current->state, state_value)
+#else
+#define set_current_state(state_value) \
+ __set_current_state(state_value)
+#endif
+
+#endif // 2.2.x
+
+
+static __inline__ void wait_ms(unsigned int ms)
+{
+ if(!in_interrupt()) {
+ current->state = TASK_UNINTERRUPTIBLE;
+ schedule_timeout(1 + ms * HZ / 1000);
+ }
+ else
+ mdelay(ms);
+}
+
+typedef struct {
+ __u8 requesttype;
+ __u8 request;
+ __u16 value;
+ __u16 index;
+ __u16 length;
+} devrequest __attribute__ ((packed));
+
+/*
+ * USB-status codes:
+ * USB_ST* maps to -E* and should go away in the future
+ */
+
+#define USB_ST_NOERROR 0
+#define USB_ST_CRC (-EILSEQ)
+#define USB_ST_BITSTUFF (-EPROTO)
+#define USB_ST_NORESPONSE (-ETIMEDOUT) /* device not responding/handshaking */
+#define USB_ST_DATAOVERRUN (-EOVERFLOW)
+#define USB_ST_DATAUNDERRUN (-EREMOTEIO)
+#define USB_ST_BUFFEROVERRUN (-ECOMM)
+#define USB_ST_BUFFERUNDERRUN (-ENOSR)
+#define USB_ST_INTERNALERROR (-EPROTO) /* unknown error */
+#define USB_ST_SHORT_PACKET (-EREMOTEIO)
+#define USB_ST_PARTIAL_ERROR (-EXDEV) /* ISO transfer only partially completed */
+#define USB_ST_URB_KILLED (-ENOENT) /* URB canceled by user */
+#define USB_ST_URB_PENDING (-EINPROGRESS)
+#define USB_ST_REMOVED (-ENODEV) /* device not existing or removed */
+#define USB_ST_TIMEOUT (-ETIMEDOUT) /* communication timed out, also in urb->status**/
+#define USB_ST_NOTSUPPORTED (-ENOSYS)
+#define USB_ST_BANDWIDTH_ERROR (-ENOSPC) /* too much bandwidth used */
+#define USB_ST_URB_INVALID_ERROR (-EINVAL) /* invalid value/transfer type */
+#define USB_ST_URB_REQUEST_ERROR (-ENXIO) /* invalid endpoint */
+#define USB_ST_STALL (-EPIPE) /* pipe stalled, also in urb->status*/
+
+/*
+ * USB device number allocation bitmap. There's one bitmap
+ * per USB tree.
+ */
+struct usb_devmap {
+ unsigned long devicemap[128 / (8*sizeof(unsigned long))];
+};
+
+#define USB_MAXBUS 64
+
+struct usb_busmap {
+ unsigned long busmap[USB_MAXBUS / (8*sizeof(unsigned long))];
+};
+
+/*
+ * This is a USB device descriptor.
+ *
+ * USB device information
+ */
+
+/* Everything but the endpoint maximums are aribtrary */
+#define USB_MAXCONFIG 8
+#define USB_ALTSETTINGALLOC 4
+#define USB_MAXALTSETTING 128 /* Hard limit */
+#define USB_MAXINTERFACES 32
+#define USB_MAXENDPOINTS 32
+
+/* All standard descriptors have these 2 fields in common */
+struct usb_descriptor_header {
+ __u8 bLength;
+ __u8 bDescriptorType;
+} __attribute__ ((packed));
+
+/* Device descriptor */
+struct usb_device_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u16 bcdUSB;
+ __u8 bDeviceClass;
+ __u8 bDeviceSubClass;
+ __u8 bDeviceProtocol;
+ __u8 bMaxPacketSize0;
+ __u16 idVendor;
+ __u16 idProduct;
+ __u16 bcdDevice;
+ __u8 iManufacturer;
+ __u8 iProduct;
+ __u8 iSerialNumber;
+ __u8 bNumConfigurations;
+} __attribute__ ((packed));
+
+/* Endpoint descriptor */
+struct usb_endpoint_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bEndpointAddress;
+ __u8 bmAttributes;
+ __u16 wMaxPacketSize;
+ __u8 bInterval;
+ __u8 bRefresh;
+ __u8 bSynchAddress;
+
+ unsigned char *extra; /* Extra descriptors */
+ int extralen;
+} __attribute__ ((packed));
+
+/* Interface descriptor */
+struct usb_interface_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bInterfaceNumber;
+ __u8 bAlternateSetting;
+ __u8 bNumEndpoints;
+ __u8 bInterfaceClass;
+ __u8 bInterfaceSubClass;
+ __u8 bInterfaceProtocol;
+ __u8 iInterface;
+
+ struct usb_endpoint_descriptor *endpoint;
+
+ unsigned char *extra;
+ int extralen;
+} __attribute__ ((packed));
+
+struct usb_interface {
+ struct usb_interface_descriptor *altsetting;
+
+ int act_altsetting; /* active alternate setting */
+ int num_altsetting; /* number of alternate settings */
+ int max_altsetting; /* total memory allocated */
+
+ struct usb_driver *driver; /* driver */
+ void *private_data;
+};
+
+/* Configuration descriptor information.. */
+struct usb_config_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u16 wTotalLength;
+ __u8 bNumInterfaces;
+ __u8 bConfigurationValue;
+ __u8 iConfiguration;
+ __u8 bmAttributes;
+ __u8 MaxPower;
+
+ struct usb_interface *interface;
+} __attribute__ ((packed));
+
+/* String descriptor */
+struct usb_string_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u16 wData[1];
+} __attribute__ ((packed));
+
+struct usb_device;
+
+struct usb_driver {
+ const char *name;
+
+ void * (*probe)(struct usb_device *, unsigned int);
+ void (*disconnect)(struct usb_device *, void *);
+
+ struct list_head driver_list;
+
+ struct file_operations *fops;
+ int minor;
+};
+
+/*
+ * Pointer to a device endpoint interrupt function -greg
+ * Parameters:
+ * int status - This needs to be defined. Right now each HCD
+ * passes different transfer status bits back. Don't use it
+ * until we come up with a common meaning.
+ * void *buffer - This is a pointer to the data used in this
+ * USB transfer.
+ * int length - This is the number of bytes transferred in or out
+ * of the buffer by this transfer. (-1 = unknown/unsupported)
+ * void *dev_id - This is a user defined pointer set when the IRQ
+ * is requested that is passed back.
+ *
+ * Special Cases:
+ * if (status == USB_ST_REMOVED), don't trust buffer or len.
+ */
+typedef int (*usb_device_irq)(int, void *, int, void *);
+
+/* --------------------------------------------------------------------------*
+ * New USB Structures *
+ * --------------------------------------------------------------------------*/
+
+#define USB_DISABLE_SPD 1
+#define USB_ISO_ASAP 2
+#define USB_URB_EARLY_COMPLETE 4
+#define USB_ASYNC_UNLINK 8
+
+typedef struct {
+ unsigned int offset;
+ unsigned int length; // expected length
+ unsigned int actual_length;
+ unsigned int status;
+} iso_packet_descriptor_t, *piso_packet_descriptor_t;
+
+struct urb;
+typedef void (*usb_complete_t)(struct urb *);
+
+typedef struct urb
+{
+ spinlock_t lock; // lock for the URB
+ void *hcpriv; // private data for host controller
+ struct list_head urb_list; // list pointer to all active urbs
+ struct urb *next; // pointer to next URB
+ struct usb_device *dev; // pointer to associated USB device
+ unsigned int pipe; // pipe information
+ int status; // returned status
+ unsigned int transfer_flags; // USB_DISABLE_SPD | USB_ISO_ASAP | USB_URB_EARLY_COMPLETE
+ void *transfer_buffer; // associated data buffer
+ int transfer_buffer_length; // data buffer length
+ int actual_length; // actual data buffer length
+ unsigned char *setup_packet; // setup packet (control only)
+ //
+ int start_frame; // start frame (iso/irq only)
+ int number_of_packets; // number of packets in this request (iso/irq only)
+ int interval; // polling interval (irq only)
+ int error_count; // number of errors in this transfer (iso only)
+ //
+ void *context; // context for completion routine
+ usb_complete_t complete; // pointer to completion routine
+ //
+ iso_packet_descriptor_t iso_frame_desc[0];
+} urb_t, *purb_t;
+
+#define FILL_CONTROL_URB(a,aa,b,c,d,e,f,g) \
+ do {\
+ spin_lock_init(&(a)->lock);\
+ (a)->dev=aa;\
+ (a)->pipe=b;\
+ (a)->setup_packet=c;\
+ (a)->transfer_buffer=d;\
+ (a)->transfer_buffer_length=e;\
+ (a)->complete=f;\
+ (a)->context=g;\
+ } while (0)
+
+#define FILL_BULK_URB(a,aa,b,c,d,e,f) \
+ do {\
+ spin_lock_init(&(a)->lock);\
+ (a)->dev=aa;\
+ (a)->pipe=b;\
+ (a)->transfer_buffer=c;\
+ (a)->transfer_buffer_length=d;\
+ (a)->complete=e;\
+ (a)->context=f;\
+ } while (0)
+
+#define FILL_INT_URB(a,aa,b,c,d,e,f,g) \
+ do {\
+ spin_lock_init(&(a)->lock);\
+ (a)->dev=aa;\
+ (a)->pipe=b;\
+ (a)->transfer_buffer=c;\
+ (a)->transfer_buffer_length=d;\
+ (a)->complete=e;\
+ (a)->context=f;\
+ (a)->interval=g;\
+ (a)->start_frame=-1;\
+ } while (0)
+
+purb_t usb_alloc_urb(int iso_packets);
+void usb_free_urb (purb_t purb);
+int usb_submit_urb(purb_t purb);
+int usb_unlink_urb(purb_t purb);
+int usb_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len, int timeout);
+int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout);
+
+/*-------------------------------------------------------------------*
+ * COMPATIBILITY STUFF *
+ *-------------------------------------------------------------------*/
+typedef struct
+{
+ wait_queue_head_t *wakeup;
+
+ usb_device_irq handler;
+ void* stuff;
+ /* more to follow */
+} api_wrapper_data;
+
+struct irq_wrapper_data {
+ void *context;
+ usb_device_irq handler;
+};
+
+/* ------------------------------------------------------------------------------------- */
+
+struct usb_operations {
+ int (*allocate)(struct usb_device *);
+ int (*deallocate)(struct usb_device *);
+ int (*get_frame_number) (struct usb_device *usb_dev);
+ int (*submit_urb) (struct urb* purb);
+ int (*unlink_urb) (struct urb* purb);
+};
+
+/*
+ * Allocated per bus we have
+ */
+struct usb_bus {
+ int busnum; /* Bus number (in order of reg) */
+
+ struct usb_devmap devmap; /* Device map */
+ struct usb_operations *op; /* Operations (specific to the HC) */
+ struct usb_device *root_hub; /* Root hub */
+ struct list_head bus_list;
+ void *hcpriv; /* Host Controller private data */
+
+ unsigned int bandwidth_allocated; /* on this Host Controller; */
+ /* applies to Int. and Isoc. pipes; */
+ /* measured in microseconds/frame; */
+ /* range is 0..900, where 900 = */
+ /* 90% of a 1-millisecond frame */
+ int bandwidth_int_reqs; /* number of Interrupt requesters */
+ int bandwidth_isoc_reqs; /* number of Isoc. requesters */
+
+ /* usbdevfs inode list */
+ struct list_head inodes;
+};
+
+#define USB_MAXCHILDREN (8) /* This is arbitrary */
+
+struct usb_device {
+ int devnum; /* Device number on USB bus */
+ int slow; /* Slow device? */
+
+ atomic_t refcnt; /* Reference count */
+
+ int maxpacketsize; /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
+ unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */
+ unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */
+ /* [0] = IN, [1] = OUT */
+ struct usb_config_descriptor *actconfig;/* the active configuration */
+ int epmaxpacketin[16]; /* INput endpoint specific maximums */
+ int epmaxpacketout[16]; /* OUTput endpoint specific maximums */
+
+ struct usb_device *parent;
+ struct usb_bus *bus; /* Bus we're part of */
+
+ struct usb_device_descriptor descriptor;/* Descriptor */
+ struct usb_config_descriptor *config; /* All of the configs */
+
+ int have_langid; /* whether string_langid is valid yet */
+ int string_langid; /* language ID for strings */
+
+ void *hcpriv; /* Host Controller private data */
+
+ /* usbdevfs inode list */
+ struct list_head inodes;
+ struct list_head filelist;
+
+ /*
+ * Child devices - these can be either new devices
+ * (if this is a hub device), or different instances
+ * of this same device.
+ *
+ * Each instance needs its own set of data structures.
+ */
+
+ int maxchild; /* Number of ports if hub */
+ struct usb_device *children[USB_MAXCHILDREN];
+};
+
+extern int usb_register(struct usb_driver *);
+extern void usb_deregister(struct usb_driver *);
+
+/* used these for multi-interface device registration */
+extern void usb_driver_claim_interface(struct usb_driver *driver, struct usb_interface *iface, void* priv);
+extern int usb_interface_claimed(struct usb_interface *iface);
+extern void usb_driver_release_interface(struct usb_driver *driver, struct usb_interface *iface);
+
+extern struct usb_bus *usb_alloc_bus(struct usb_operations *);
+extern void usb_free_bus(struct usb_bus *);
+extern void usb_register_bus(struct usb_bus *);
+extern void usb_deregister_bus(struct usb_bus *);
+
+extern struct usb_device *usb_alloc_dev(struct usb_device *parent, struct usb_bus *);
+extern void usb_free_dev(struct usb_device *);
+extern void usb_inc_dev_use(struct usb_device *);
+#define usb_dec_dev_use usb_free_dev
+extern void usb_release_bandwidth(struct usb_device *, int);
+
+extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout);
+
+extern int usb_request_irq(struct usb_device *, unsigned int, usb_device_irq, int, void *, void **);
+extern int usb_release_irq(struct usb_device *dev, void *handle, unsigned int pipe);
+
+extern void *usb_request_bulk(struct usb_device *, unsigned int, usb_device_irq, void *, int, void *);
+extern int usb_terminate_bulk(struct usb_device *, void *);
+
+extern void usb_init_root_hub(struct usb_device *dev);
+extern void usb_connect(struct usb_device *dev);
+extern void usb_disconnect(struct usb_device **);
+
+extern void usb_destroy_configuration(struct usb_device *dev);
+
+int usb_get_current_frame_number (struct usb_device *usb_dev);
+
+/*
+ * Calling this entity a "pipe" is glorifying it. A USB pipe
+ * is something embarrassingly simple: it basically consists
+ * of the following information:
+ * - device number (7 bits)
+ * - endpoint number (4 bits)
+ * - current Data0/1 state (1 bit)
+ * - direction (1 bit)
+ * - speed (1 bit)
+ * - max packet size (2 bits: 8, 16, 32 or 64)
+ * - pipe type (2 bits: control, interrupt, bulk, isochronous)
+ *
+ * That's 18 bits. Really. Nothing more. And the USB people have
+ * documented these eighteen bits as some kind of glorious
+ * virtual data structure.
+ *
+ * Let's not fall in that trap. We'll just encode it as a simple
+ * unsigned int. The encoding is:
+ *
+ * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
+ * - direction: bit 7 (0 = Host-to-Device [Out], 1 = Device-to-Host [In])
+ * - device: bits 8-14
+ * - endpoint: bits 15-18
+ * - Data0/1: bit 19
+ * - speed: bit 26 (0 = Full, 1 = Low Speed)
+ * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt, 10 = control, 11 = bulk)
+ *
+ * Why? Because it's arbitrary, and whatever encoding we select is really
+ * up to us. This one happens to share a lot of bit positions with the UHCI
+ * specification, so that much of the uhci driver can just mask the bits
+ * appropriately.
+ */
+
+#define PIPE_ISOCHRONOUS 0
+#define PIPE_INTERRUPT 1
+#define PIPE_CONTROL 2
+#define PIPE_BULK 3
+
+#define USB_ISOCHRONOUS 0
+#define USB_INTERRUPT 1
+#define USB_CONTROL 2
+#define USB_BULK 3
+
+#define usb_maxpacket(dev, pipe, out) (out \
+ ? (dev)->epmaxpacketout[usb_pipeendpoint(pipe)] \
+ : (dev)->epmaxpacketin [usb_pipeendpoint(pipe)] )
+#define usb_packetid(pipe) (((pipe) & USB_DIR_IN) ? USB_PID_IN : USB_PID_OUT)
+
+#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
+#define usb_pipein(pipe) (((pipe) >> 7) & 1)
+#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
+#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
+#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
+#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
+#define usb_pipeslow(pipe) (((pipe) >> 26) & 1)
+#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
+#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
+#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
+#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
+#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
+
+#define PIPE_DEVEP_MASK 0x0007ff00
+
+/* The D0/D1 toggle bits */
+#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
+#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
+#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << ep)) | ((bit) << ep))
+
+/* Endpoint halt control/status */
+#define usb_endpoint_out(ep_dir) (((ep_dir >> 7) & 1) ^ 1)
+#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
+#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
+#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
+
+static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint)
+{
+ return (dev->devnum << 8) | (endpoint << 15) | (dev->slow << 26) | dev->maxpacketsize;
+}
+
+static inline unsigned int __default_pipe(struct usb_device *dev)
+{
+ return (dev->slow << 26);
+}
+
+/* Create various pipes... */
+#define usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))
+#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
+#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))
+#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
+#define usb_sndbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))
+#define usb_rcvbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
+#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
+#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
+#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30) | __default_pipe(dev))
+#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | __default_pipe(dev) | USB_DIR_IN)
+
+/*
+ * Send and receive control messages..
+ */
+int usb_new_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);
+int usb_get_class_descriptor(struct usb_device *dev, int ifnum, unsigned char desctype,
+ unsigned char descindex, void *buf, int size);
+int usb_get_device_descriptor(struct usb_device *dev);
+int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr);
+int usb_get_status(struct usb_device *dev, int type, int target, void *data);
+int usb_get_protocol(struct usb_device *dev, int ifnum);
+int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
+int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
+int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id);
+int usb_set_configuration(struct usb_device *dev, int configuration);
+int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
+ unsigned char id, void *buf, int size);
+int usb_set_report(struct usb_device *dev, int ifnum, unsigned char type,
+ unsigned char id, void *buf, int size);
+int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
+int usb_clear_halt(struct usb_device *dev, int pipe);
+
+#define usb_get_extra_descriptor(ifpoint,type,ptr)\
+ __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,type,(void**)ptr)
+
+/*
+ * Some USB bandwidth allocation constants.
+ */
+#define BW_HOST_DELAY 1000L /* nanoseconds */
+#define BW_HUB_LS_SETUP 333L /* nanoseconds */
+ /* 4 full-speed bit times (est.) */
+
+#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
+#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
+#define FRAME_TIME_USECS 1000L
+#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
+
+#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
+ /* Trying not to use worst-case bit-stuffing
+ of (7/6 * 8 * bytecount) = 9.33 * bytecount */
+ /* bytecount = data payload byte count */
+
+#define NS_TO_US(ns) ((ns + 500L) / 1000L)
+ /* convert & round nanoseconds to microseconds */
+
+/*
+ * Debugging helpers..
+ */
+void usb_show_device_descriptor(struct usb_device_descriptor *);
+void usb_show_config_descriptor(struct usb_config_descriptor *);
+void usb_show_interface_descriptor(struct usb_interface_descriptor *);
+void usb_show_endpoint_descriptor(struct usb_endpoint_descriptor *);
+void usb_show_device(struct usb_device *);
+void usb_show_string(struct usb_device *dev, char *id, int index);
+
+#ifdef DEBUG
+#define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg)
+#else
+#define dbg(format, arg...) do {} while (0)
+#endif
+#define err(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg)
+#define info(format, arg...) printk(KERN_INFO __FILE__ ": " format "\n" , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING __FILE__ ": " format "\n" , ## arg)
+
+
+/*
+ * bus and driver list
+ */
+
+extern struct list_head usb_driver_list;
+extern struct list_head usb_bus_list;
+
+/*
+ * USB device fs stuff
+ */
+
+#ifdef CONFIG_USB_DEVICEFS
+
+/*
+ * these are expected to be called from the USB core/hub thread
+ * with the kernel lock held
+ */
+extern void usbdevfs_add_bus(struct usb_bus *bus);
+extern void usbdevfs_remove_bus(struct usb_bus *bus);
+extern void usbdevfs_add_device(struct usb_device *dev);
+extern void usbdevfs_remove_device(struct usb_device *dev);
+
+extern int usbdevfs_init(void);
+extern void usbdevfs_cleanup(void);
+
+#else /* CONFIG_USB_DEVICEFS */
+
+extern inline void usbdevfs_add_bus(struct usb_bus *bus) {}
+extern inline void usbdevfs_remove_bus(struct usb_bus *bus) {}
+extern inline void usbdevfs_add_device(struct usb_device *dev) {}
+extern inline void usbdevfs_remove_device(struct usb_device *dev) {}
+
+extern inline int usbdevfs_init(void) { return 0; }
+extern inline void usbdevfs_cleanup(void) { }
+
+#endif /* CONFIG_USB_DEVICEFS */
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 5919a894e..682620995 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -286,7 +286,7 @@ struct video_code
#define VIDIOCGPICT _IOR('v',6,struct video_picture) /* Get picture properties */
#define VIDIOCSPICT _IOW('v',7,struct video_picture) /* Set picture properties */
#define VIDIOCCAPTURE _IOW('v',8,int) /* Start, end capture */
-#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Set the video overlay window */
+#define VIDIOCGWIN _IOR('v',9, struct video_window) /* Get the video overlay window */
#define VIDIOCSWIN _IOW('v',10, struct video_window) /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
#define VIDIOCGFBUF _IOR('v',11, struct video_buffer) /* Get frame buffer */
#define VIDIOCSFBUF _IOW('v',12, struct video_buffer) /* Set frame buffer - root only */