summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 18:13:52 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 18:13:52 -0800
commited6eefe4382ab3a72d70922d401b7c8003513f13 (patch)
tree02530a3e9ad5144240f04d6455f9c0184b72132c /include/linux
parent24579a8815132babf322c6d73608ce31f9b28ac8 (diff)
v2.4.3.6 -> v2.4.3.7
- Johannes Erdfelt: USB updates - David Howells: more rw-sem stuff - David Miller: network callback cleanups and fixes - Jan Harkes: make Coda use the proper VFS layer interfaces, so that it can use "non-traditional-unix" filesystems without inode numbers for backing store.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/coda.h32
-rw-r--r--include/linux/coda_fs_i.h7
-rw-r--r--include/linux/coda_linux.h19
-rw-r--r--include/linux/coda_proc.h1
-rw-r--r--include/linux/coda_psdev.h9
-rw-r--r--include/linux/compiler.h13
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h8
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_ftp.h21
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h13
-rw-r--r--include/linux/pagemap.h7
-rw-r--r--include/linux/pipe_fs_i.h3
-rw-r--r--include/linux/rwsem-spinlock.h138
-rw-r--r--include/linux/rwsem.h80
-rw-r--r--include/linux/swap.h7
-rw-r--r--include/linux/usb.h2
18 files changed, 123 insertions, 261 deletions
diff --git a/include/linux/coda.h b/include/linux/coda.h
index d9ab68c3541c..f96edc7c7a37 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -313,7 +313,9 @@ struct coda_statfs {
#define CODA_RESOLVE 32
#define CODA_REINTEGRATE 33
#define CODA_STATFS 34
-#define CODA_NCALLS 35
+#define CODA_STORE 35
+#define CODA_RELEASE 36
+#define CODA_NCALLS 37
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
@@ -372,6 +374,28 @@ struct coda_open_out {
};
+/* coda_store: */
+struct coda_store_in {
+ struct coda_in_hdr ih;
+ ViceFid VFid;
+ int flags;
+};
+
+struct coda_store_out {
+ struct coda_out_hdr out;
+};
+
+/* coda_release: */
+struct coda_release_in {
+ struct coda_in_hdr ih;
+ ViceFid VFid;
+ int flags;
+};
+
+struct coda_release_out {
+ struct coda_out_hdr out;
+};
+
/* coda_close: */
struct coda_close_in {
struct coda_in_hdr ih;
@@ -641,6 +665,10 @@ struct coda_open_by_fd_in {
struct coda_open_by_fd_out {
struct coda_out_hdr oh;
int fd;
+
+#ifdef __KERNEL__
+ struct file *fh; /* not passed from userspace but used in-kernel only */
+#endif
};
/* coda_open_by_path: */
@@ -675,6 +703,8 @@ struct coda_statfs_out {
union inputArgs {
struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
struct coda_open_in coda_open;
+ struct coda_store_in coda_store;
+ struct coda_release_in coda_release;
struct coda_close_in coda_close;
struct coda_ioctl_in coda_ioctl;
struct coda_getattr_in coda_getattr;
diff --git a/include/linux/coda_fs_i.h b/include/linux/coda_fs_i.h
index 4a776e87f9d9..43d63d77697d 100644
--- a/include/linux/coda_fs_i.h
+++ b/include/linux/coda_fs_i.h
@@ -13,20 +13,17 @@
#include <linux/list.h>
#include <linux/coda.h>
-#define CODA_CNODE_MAGIC 0x47114711
/*
* coda fs inode data
*/
struct coda_inode_info {
struct ViceFid c_fid; /* Coda identifier */
u_short c_flags; /* flags (see below) */
- struct list_head c_volrootlist; /* list of volroot cnoddes */
struct list_head c_cilist; /* list of all coda inodes */
- struct inode *c_vnode; /* inode associated with cnode */
- unsigned int c_contcount; /* refcount for container inode */
+ struct file *c_container; /* container file for this cnode */
+ unsigned int c_contcount; /* refcount for container file */
struct coda_cred c_cached_cred; /* credentials of cached perms */
unsigned int c_cached_perm; /* cached access permissions */
- int c_magic; /* to verify the data structure */
};
/* flags */
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index de20ba7c3652..9b221556097f 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -36,15 +36,18 @@ extern struct file_operations coda_ioctl_operations;
/* operations shared over more than one file */
int coda_open(struct inode *i, struct file *f);
+int coda_flush(struct file *f);
int coda_release(struct inode *i, struct file *f);
int coda_permission(struct inode *inode, int mask);
int coda_revalidate_inode(struct dentry *);
int coda_notify_change(struct dentry *, struct iattr *);
+int coda_isnullfid(ViceFid *fid);
/* global variables */
extern int coda_debug;
extern int coda_print_entry;
extern int coda_access_cache;
+extern int coda_fake_statfs;
/* this file: heloers */
static __inline__ struct ViceFid *coda_i2f(struct inode *);
@@ -53,8 +56,6 @@ static __inline__ void coda_flag_inode(struct inode *, int flag);
char *coda_f2s(ViceFid *f);
char *coda_f2s2(ViceFid *f);
int coda_isroot(struct inode *i);
-int coda_fid_is_volroot(struct ViceFid *);
-int coda_fid_is_weird(struct ViceFid *fid);
int coda_iscontrol(const char *name, size_t length);
void coda_load_creds(struct coda_cred *cred);
@@ -65,10 +66,6 @@ void print_vattr( struct coda_vattr *attr );
int coda_cred_ok(struct coda_cred *cred);
int coda_cred_eq(struct coda_cred *cred1, struct coda_cred *cred2);
-/* cache.c */
-void coda_purge_children(struct inode *, int);
-void coda_purge_dentries(struct inode *);
-
/* sysctl.h */
void coda_sysctl_init(void);
void coda_sysctl_clean(void);
@@ -120,22 +117,22 @@ do { \
/* inode to cnode access functions */
+#define ITOC(inode) (&((inode)->u.coda_i))
+
static __inline__ struct ViceFid *coda_i2f(struct inode *inode)
{
- return &(inode->u.coda_i.c_fid);
+ return &(ITOC(inode)->c_fid);
}
static __inline__ char *coda_i2s(struct inode *inode)
{
- return coda_f2s(&(inode->u.coda_i.c_fid));
+ return coda_f2s(&(ITOC(inode)->c_fid));
}
/* this will not zap the inode away */
static __inline__ void coda_flag_inode(struct inode *inode, int flag)
{
- inode->u.coda_i.c_flags |= flag;
+ ITOC(inode)->c_flags |= flag;
}
-#define ITOC(inode) (&((inode)->u.coda_i))
-
#endif
diff --git a/include/linux/coda_proc.h b/include/linux/coda_proc.h
index 37dfad86adf3..12d2c1025814 100644
--- a/include/linux/coda_proc.h
+++ b/include/linux/coda_proc.h
@@ -40,6 +40,7 @@ struct coda_vfs_stats
{
/* file operations */
int open;
+ int flush;
int release;
int fsync;
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index db03f6af8e42..1b562e74fa0c 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -39,10 +39,13 @@ int venus_setattr(struct super_block *, struct ViceFid *,
int venus_lookup(struct super_block *sb, struct ViceFid *fid,
const char *name, int length, int *type,
struct ViceFid *resfid);
-int venus_release(struct super_block *sb, struct ViceFid *fid, int flags,
- struct coda_cred *);
+int venus_store(struct super_block *sb, struct ViceFid *fid, int flags,
+ struct coda_cred *);
+int venus_release(struct super_block *sb, struct ViceFid *fid, int flags);
+int venus_close(struct super_block *sb, struct ViceFid *fid, int flags,
+ struct coda_cred *);
int venus_open(struct super_block *sb, struct ViceFid *fid,
- int flags, ino_t *ino, dev_t *dev);
+ int flags, struct file **f);
int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,
const char *name, int length,
struct ViceFid *newfid, struct coda_vattr *attrs);
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
new file mode 100644
index 000000000000..0c2c76ce9430
--- /dev/null
+++ b/include/linux/compiler.h
@@ -0,0 +1,13 @@
+#ifndef __LINUX_COMPILER_H
+#define __LINUX_COMPILER_H
+
+/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
+ a mechanism by which the user can annotate likely branch directions and
+ expect the blocks to be reordered appropriately. Define __builtin_expect
+ to nothing for earlier compilers. */
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
+#define __builtin_expect(x, expected_value) (x)
+#endif
+
+#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ae22bc2d0f00..a71dbf25c0e6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -774,7 +774,7 @@ struct file_operations {
int (*lock) (struct file *, int, struct file_lock *);
ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
- ssize_t (*writepage) (struct file *, struct page *, int, size_t, loff_t *, int);
+ ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
};
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
index f1ff9ecb43da..35caff35f1f5 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack.h
@@ -84,12 +84,7 @@ struct ip_conntrack_expect
#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>
-#ifdef CONFIG_IP_NF_NAT_NEEDED
-#include <linux/netfilter_ipv4/ip_nat_ftp.h>
-#endif
-#endif
struct ip_conntrack
{
@@ -127,18 +122,14 @@ struct ip_conntrack
} proto;
union {
-#if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE)
struct ip_ct_ftp ct_ftp_info;
-#endif
} help;
#ifdef CONFIG_IP_NF_NAT_NEEDED
struct {
struct ip_nat_info info;
union {
-#if defined(CONFIG_IP_NF_FTP) || defined(CONFIG_IP_NF_FTP_MODULE)
- struct ip_nat_ftp_info ftp_info[IP_CT_DIR_MAX];
-#endif
+ /* insert nat helper private data here */
} help;
#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
index c5fabbbd9acd..4b560e237ba3 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
@@ -14,9 +14,13 @@ DECLARE_LOCK_EXTERN(ip_ftp_lock);
enum ip_ct_ftp_type
{
/* PORT command from client */
- IP_CT_FTP_PORT = IP_CT_DIR_ORIGINAL,
+ IP_CT_FTP_PORT,
/* PASV response from server */
- IP_CT_FTP_PASV = IP_CT_DIR_REPLY
+ IP_CT_FTP_PASV,
+ /* EPRT command from client */
+ IP_CT_FTP_EPRT,
+ /* EPSV response from server */
+ IP_CT_FTP_EPSV,
};
/* We record seq number and length of ftp ip/port text here: all in
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
index 8eb37d6d5bf7..3a35b1fafd5d 100644
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ b/include/linux/netfilter_ipv4/ip_nat.h
@@ -24,6 +24,15 @@ enum ip_nat_manip_type
/* Used internally by get_unique_tuple(). */
#define IP_NAT_RANGE_FULL 4
+/* NAT sequence number modifications */
+struct ip_nat_seq {
+ /* position of the last TCP sequence number
+ * modification (if any) */
+ u_int32_t correction_pos;
+ /* sequence number offset before and after last modification */
+ int32_t offset_before, offset_after;
+};
+
/* Single range specification. */
struct ip_nat_range
{
@@ -98,6 +107,8 @@ struct ip_nat_info
/* Helper (NULL if none). */
struct ip_nat_helper *helper;
+
+ struct ip_nat_seq seq[IP_CT_DIR_MAX];
};
/* Set up the info structure to map into this range. */
diff --git a/include/linux/netfilter_ipv4/ip_nat_ftp.h b/include/linux/netfilter_ipv4/ip_nat_ftp.h
deleted file mode 100644
index d84015529be5..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_ftp.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _IP_NAT_FTP_H
-#define _IP_NAT_FTP_H
-/* FTP extension for TCP NAT alteration. */
-
-#ifndef __KERNEL__
-#error Only in kernel.
-#endif
-
-/* Protects ftp part of conntracks */
-DECLARE_LOCK_EXTERN(ip_ftp_lock);
-
-/* We keep track of where the last SYN correction was, and the SYN
- offsets before and after that correction. Two of these (indexed by
- direction). */
-struct ip_nat_ftp_info
-{
- u_int32_t syn_correction_pos;
- int32_t syn_offset_before, syn_offset_after;
-};
-
-#endif /* _IP_NAT_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
index 2171b4325eb8..d85cd0669826 100644
--- a/include/linux/netfilter_ipv4/ip_nat_helper.h
+++ b/include/linux/netfilter_ipv4/ip_nat_helper.h
@@ -25,6 +25,19 @@ struct ip_nat_helper
const char *name;
};
+extern struct list_head helpers;
+
extern int ip_nat_helper_register(struct ip_nat_helper *me);
extern void ip_nat_helper_unregister(struct ip_nat_helper *me);
+extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
+ struct ip_conntrack *ct,
+ enum ip_conntrack_info ctinfo,
+ unsigned int match_offset,
+ unsigned int match_len,
+ char *rep_buffer,
+ unsigned int rep_len);
+extern int ip_nat_seq_adjust(struct sk_buff *skb,
+ struct ip_conntrack *ct,
+ enum ip_conntrack_info ctinfo);
+extern void ip_nat_delete_sack(struct sk_buff *skb, struct tcphdr *tcph);
#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index d780e183d1ef..0febcc2a1899 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -77,7 +77,12 @@ extern struct page * __find_lock_page (struct address_space * mapping,
unsigned long index, struct page **hash);
extern void lock_page(struct page *page);
#define find_lock_page(mapping, index) \
- __find_lock_page(mapping, index, page_hash(mapping, index))
+ __find_lock_page(mapping, index, page_hash(mapping, index))
+
+extern struct page * __find_get_swapcache_page (struct address_space * mapping,
+ unsigned long index, struct page **hash);
+#define find_get_swapcache_page(mapping, index) \
+ __find_get_swapcache_page(mapping, index, page_hash(mapping, index))
extern void __add_page_to_hash_queue(struct page * page, struct page **p);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 52a9d5b5a4e2..16fadad4d92f 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -5,6 +5,7 @@
struct pipe_inode_info {
wait_queue_head_t wait;
char *base;
+ unsigned int len;
unsigned int start;
unsigned int readers;
unsigned int writers;
@@ -22,7 +23,7 @@ struct pipe_inode_info {
#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
#define PIPE_BASE(inode) ((inode).i_pipe->base)
#define PIPE_START(inode) ((inode).i_pipe->start)
-#define PIPE_LEN(inode) ((inode).i_size)
+#define PIPE_LEN(inode) ((inode).i_pipe->len)
#define PIPE_READERS(inode) ((inode).i_pipe->readers)
#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
#define PIPE_WAITING_READERS(inode) ((inode).i_pipe->waiting_readers)
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index 0799131b8079..930032d0b467 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -1,6 +1,8 @@
/* rwsem-spinlock.h: fallback C implementation
*
* Copyright (c) 2001 David Howells (dhowells@redhat.com).
+ * - Derived partially from ideas by Andrea Arcangeli <andrea@suse.de>
+ * - Derived also from comments by Linus
*/
#ifndef _LINUX_RWSEM_SPINLOCK_H
@@ -11,6 +13,7 @@
#endif
#include <linux/spinlock.h>
+#include <linux/list.h>
#ifdef __KERNEL__
@@ -19,27 +22,19 @@
struct rwsem_waiter;
/*
- * the semaphore definition
+ * the rw-semaphore definition
+ * - if activity is 0 then there are no active readers or writers
+ * - if activity is +ve then that is the number of active readers
+ * - if activity is -1 then there is one active writer
+ * - if wait_list is not empty, then there are processes waiting for the semaphore
*/
struct rw_semaphore {
- signed long count;
-#define RWSEM_UNLOCKED_VALUE 0x00000000
-#define RWSEM_ACTIVE_BIAS 0x00000001
-#define RWSEM_ACTIVE_MASK 0x0000ffff
-#define RWSEM_WAITING_BIAS (-0x00010000)
-#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
-#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
+ __s32 activity;
spinlock_t wait_lock;
- struct rwsem_waiter *wait_front;
- struct rwsem_waiter **wait_back;
+ struct list_head wait_list;
#if RWSEM_DEBUG
int debug;
#endif
-#if RWSEM_DEBUG_MAGIC
- long __magic;
- atomic_t readers;
- atomic_t writers;
-#endif
};
/*
@@ -50,119 +45,18 @@ struct rw_semaphore {
#else
#define __RWSEM_DEBUG_INIT /* */
#endif
-#if RWSEM_DEBUG_MAGIC
-#define __RWSEM_DEBUG_MINIT(name) , (int)&(name).__magic, ATOMIC_INIT(0), ATOMIC_INIT(0)
-#else
-#define __RWSEM_DEBUG_MINIT(name) /* */
-#endif
#define __RWSEM_INITIALIZER(name) \
-{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, NULL, &(name).wait_front \
- __RWSEM_DEBUG_INIT __RWSEM_DEBUG_MINIT(name) }
+{ 0, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) __RWSEM_DEBUG_INIT }
#define DECLARE_RWSEM(name) \
struct rw_semaphore name = __RWSEM_INITIALIZER(name)
-static inline void init_rwsem(struct rw_semaphore *sem)
-{
- sem->count = RWSEM_UNLOCKED_VALUE;
- spin_lock_init(&sem->wait_lock);
- sem->wait_front = NULL;
- sem->wait_back = &sem->wait_front;
-#if RWSEM_DEBUG
- sem->debug = 0;
-#endif
-#if RWSEM_DEBUG_MAGIC
- sem->__magic = (long)&sem->__magic;
- atomic_set(&sem->readers, 0);
- atomic_set(&sem->writers, 0);
-#endif
-}
-
-/*
- * lock for reading
- */
-static inline void __down_read(struct rw_semaphore *sem)
-{
- int count;
- spin_lock(&sem->wait_lock);
- sem->count += RWSEM_ACTIVE_READ_BIAS;
- count = sem->count;
- spin_unlock(&sem->wait_lock);
- if (count<0)
- rwsem_down_read_failed(sem);
-}
-
-/*
- * lock for writing
- */
-static inline void __down_write(struct rw_semaphore *sem)
-{
- int count;
- spin_lock(&sem->wait_lock);
- count = sem->count;
- sem->count += RWSEM_ACTIVE_WRITE_BIAS;
- spin_unlock(&sem->wait_lock);
- if (count)
- rwsem_down_write_failed(sem);
-}
-
-/*
- * unlock after reading
- */
-static inline void __up_read(struct rw_semaphore *sem)
-{
- int count;
- spin_lock(&sem->wait_lock);
- count = sem->count;
- sem->count -= RWSEM_ACTIVE_READ_BIAS;
- spin_unlock(&sem->wait_lock);
- if (count<0 && !((count-RWSEM_ACTIVE_READ_BIAS)&RWSEM_ACTIVE_MASK))
- rwsem_wake(sem);
-}
-
-/*
- * unlock after writing
- */
-static inline void __up_write(struct rw_semaphore *sem)
-{
- int count;
- spin_lock(&sem->wait_lock);
- sem->count -= RWSEM_ACTIVE_WRITE_BIAS;
- count = sem->count;
- spin_unlock(&sem->wait_lock);
- if (count<0)
- rwsem_wake(sem);
-}
-
-/*
- * implement exchange and add functionality
- * - only called when spinlock is already held
- */
-static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
-{
- int count;
-
- sem->count += delta;
- count = sem->count;
-
- return count;
-}
-
-/*
- * implement compare and exchange functionality on the rw-semaphore count LSW
- * - only called by __rwsem_do_wake(), so spinlock is already held when called
- */
-static inline __u16 rwsem_cmpxchgw(struct rw_semaphore *sem, __u16 old, __u16 new)
-{
- __u16 prev;
-
- prev = sem->count & RWSEM_ACTIVE_MASK;
- if (prev==old)
- sem->count = (sem->count & ~RWSEM_ACTIVE_MASK) | new;
-
- return prev;
-}
+extern void FASTCALL(init_rwsem(struct rw_semaphore *sem));
+extern void FASTCALL(__down_read(struct rw_semaphore *sem));
+extern void FASTCALL(__down_write(struct rw_semaphore *sem));
+extern void FASTCALL(__up_read(struct rw_semaphore *sem));
+extern void FASTCALL(__up_write(struct rw_semaphore *sem));
#endif /* __KERNEL__ */
#endif /* _LINUX_RWSEM_SPINLOCK_H */
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index fd4d39f42ca4..03121ee0aaf8 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -2,30 +2,6 @@
*
* Written by David Howells (dhowells@redhat.com).
* Derived from asm-i386/semaphore.h
- *
- *
- * The MSW of the count is the negated number of active writers and waiting
- * lockers, and the LSW is the total number of active locks
- *
- * The lock count is initialized to 0 (no active and no waiting lockers).
- *
- * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case of an
- * uncontended lock. This can be determined because XADD returns the old value.
- * Readers increment by 1 and see a positive value when uncontended, negative
- * if there are writers (and maybe) readers waiting (in which case it goes to
- * sleep).
- *
- * The value of WAITING_BIAS supports up to 32766 waiting processes. This can
- * be extended to 65534 by manually checking the whole MSW rather than relying
- * on the S flag.
- *
- * The value of ACTIVE_BIAS supports up to 65535 active processes.
- *
- * This should be totally fair - if anything is waiting, a process that wants a
- * lock will go to the back of the queue. When the currently active lock is
- * released, if there's a writer at the front of the queue, then that and only
- * that will be woken up; if there's a bunch of consequtive readers at the
- * front, then they'll all be woken up, but no other readers will be.
*/
#ifndef _LINUX_RWSEM_H
@@ -34,26 +10,16 @@
#include <linux/linkage.h>
#define RWSEM_DEBUG 0
-#define RWSEM_DEBUG_MAGIC 0
#ifdef __KERNEL__
#include <linux/types.h>
+#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/atomic.h>
struct rw_semaphore;
-/* defined contention handler functions for the generic case
- * - these are also used for the exchange-and-add based algorithm
- */
-#if defined(CONFIG_RWSEM_GENERIC_SPINLOCK) || defined(CONFIG_RWSEM_XCHGADD_ALGORITHM)
-/* we use FASTCALL convention for the helpers */
-extern struct rw_semaphore *FASTCALL(rwsem_down_read_failed(struct rw_semaphore *sem));
-extern struct rw_semaphore *FASTCALL(rwsem_down_write_failed(struct rw_semaphore *sem));
-extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *sem));
-#endif
-
#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
#include <linux/rwsem-spinlock.h> /* use a generic implementation */
#else
@@ -74,20 +40,7 @@ extern void FASTCALL(rwsemtrace(struct rw_semaphore *sem, const char *str));
static inline void down_read(struct rw_semaphore *sem)
{
rwsemtrace(sem,"Entering down_read");
-
-#if RWSEM_DEBUG_MAGIC
- if (sem->__magic != (long)&sem->__magic)
- BUG();
-#endif
-
__down_read(sem);
-
-#if RWSEM_DEBUG_MAGIC
- if (atomic_read(&sem->writers))
- BUG();
- atomic_inc(&sem->readers);
-#endif
-
rwsemtrace(sem,"Leaving down_read");
}
@@ -97,22 +50,7 @@ static inline void down_read(struct rw_semaphore *sem)
static inline void down_write(struct rw_semaphore *sem)
{
rwsemtrace(sem,"Entering down_write");
-
-#if RWSEM_DEBUG_MAGIC
- if (sem->__magic != (long)&sem->__magic)
- BUG();
-#endif
-
__down_write(sem);
-
-#if RWSEM_DEBUG_MAGIC
- if (atomic_read(&sem->writers))
- BUG();
- if (atomic_read(&sem->readers))
- BUG();
- atomic_inc(&sem->writers);
-#endif
-
rwsemtrace(sem,"Leaving down_write");
}
@@ -122,14 +60,7 @@ static inline void down_write(struct rw_semaphore *sem)
static inline void up_read(struct rw_semaphore *sem)
{
rwsemtrace(sem,"Entering up_read");
-
-#if RWSEM_DEBUG_MAGIC
- if (atomic_read(&sem->writers))
- BUG();
- atomic_dec(&sem->readers);
-#endif
__up_read(sem);
-
rwsemtrace(sem,"Leaving up_read");
}
@@ -139,16 +70,7 @@ static inline void up_read(struct rw_semaphore *sem)
static inline void up_write(struct rw_semaphore *sem)
{
rwsemtrace(sem,"Entering up_write");
-
-#if RWSEM_DEBUG_MAGIC
- if (atomic_read(&sem->readers))
- BUG();
- if (atomic_read(&sem->writers) != 1)
- BUG();
- atomic_dec(&sem->writers);
-#endif
__up_write(sem);
-
rwsemtrace(sem,"Leaving up_write");
}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index e97b2c5472ab..1ad8d5a72794 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -111,8 +111,8 @@ extern void wakeup_kswapd(void);
extern int try_to_free_pages(unsigned int gfp_mask);
/* linux/mm/page_io.c */
-extern void rw_swap_page(int, struct page *, int);
-extern void rw_swap_page_nolock(int, swp_entry_t, char *, int);
+extern void rw_swap_page(int, struct page *);
+extern void rw_swap_page_nolock(int, swp_entry_t, char *);
/* linux/mm/page_alloc.c */
@@ -121,8 +121,7 @@ extern void show_swap_cache_info(void);
extern void add_to_swap_cache(struct page *, swp_entry_t);
extern int swap_check_entry(unsigned long);
extern struct page * lookup_swap_cache(swp_entry_t);
-extern struct page * read_swap_cache_async(swp_entry_t, int);
-#define read_swap_cache(entry) read_swap_cache_async(entry, 1);
+extern struct page * read_swap_cache_async(swp_entry_t);
/* linux/mm/oom_kill.c */
extern int out_of_memory(void);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 227d6048e8b5..5068f1a80656 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -583,6 +583,8 @@ struct usb_bus {
/* usbdevfs inode list */
struct list_head inodes;
+
+ atomic_t refcnt;
};
#define USB_MAXCHILDREN (16) /* This is arbitrary */