diff options
| author | Andy Grover <agrover@groveronline.com> | 2002-08-15 01:24:56 -0700 |
|---|---|---|
| committer | Andy Grover <agrover@acpi3.jf.intel.com> | 2002-08-15 01:24:56 -0700 |
| commit | 33921b31bfe43bf4e062aee4ba27e7136ad42455 (patch) | |
| tree | 3f4e3cdfa13edb4bcefcc28e898db8bf7eebb983 /include/linux | |
| parent | 3d12fd4e7a4c237d37766a005d09eecf72d87352 (diff) | |
| parent | 75754eb4f81f994dae0f92f75be5e0d50d24d67f (diff) | |
Merge groveronline.com:/root/bk/linux-2.5
into groveronline.com:/root/bk/linux-acpi
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mm.h | 8 | ||||
| -rw-r--r-- | include/linux/page-flags.h | 2 | ||||
| -rw-r--r-- | include/linux/pagemap.h | 10 | ||||
| -rw-r--r-- | include/linux/pagevec.h | 77 | ||||
| -rw-r--r-- | include/linux/sched.h | 1 | ||||
| -rw-r--r-- | include/linux/smp.h | 1 | ||||
| -rw-r--r-- | include/linux/sunrpc/xprt.h | 5 | ||||
| -rw-r--r-- | include/linux/swap.h | 13 | ||||
| -rw-r--r-- | include/linux/usb.h | 20 |
9 files changed, 110 insertions, 27 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index baafd9a57b25..4d7de397481f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -194,10 +194,16 @@ struct page { * routine so they can be sure the page doesn't go away from under them. */ #define get_page(p) atomic_inc(&(p)->count) -#define put_page(p) __free_page(p) +#define __put_page(p) atomic_dec(&(p)->count) #define put_page_testzero(p) atomic_dec_and_test(&(p)->count) #define page_count(p) atomic_read(&(p)->count) #define set_page_count(p,v) atomic_set(&(p)->count, v) +extern void FASTCALL(__page_cache_release(struct page *)); +#define put_page(p) \ + do { \ + if (put_page_testzero(p)) \ + __page_cache_release(p); \ + } while (0) /* * Multiple processes may "see" the same page. E.g. for untouched diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f6b48a987cd4..9801b15876d9 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -154,6 +154,7 @@ extern void get_page_state(struct page_state *ret); ret; \ }) +#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags) #define PageLRU(page) test_bit(PG_lru, &(page)->flags) #define TestSetPageLRU(page) test_and_set_bit(PG_lru, &(page)->flags) #define TestClearPageLRU(page) test_and_clear_bit(PG_lru, &(page)->flags) @@ -161,6 +162,7 @@ extern void get_page_state(struct page_state *ret); #define PageActive(page) test_bit(PG_active, &(page)->flags) #define SetPageActive(page) set_bit(PG_active, &(page)->flags) #define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) +#define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags) #define PageSlab(page) test_bit(PG_slab, &(page)->flags) #define SetPageSlab(page) set_bit(PG_slab, &(page)->flags) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index b559ccd68520..ff10783f8632 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -23,14 +23,18 @@ #define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK) #define page_cache_get(x) get_page(x) -extern void FASTCALL(page_cache_release(struct page *)); + +static inline void page_cache_release(struct page *page) +{ + if (!PageReserved(page) && put_page_testzero(page)) + __page_cache_release(page); +} static inline struct page *page_cache_alloc(struct address_space *x) { return alloc_pages(x->gfp_mask, 0); } - typedef int filler_t(void *, struct page *); extern struct page * find_get_page(struct address_space *mapping, @@ -58,6 +62,8 @@ extern struct page * read_cache_page(struct address_space *mapping, extern int add_to_page_cache(struct page *page, struct address_space *mapping, unsigned long index); +extern int add_to_page_cache_lru(struct page *page, + struct address_space *mapping, unsigned long index); extern void remove_from_page_cache(struct page *page); extern void __remove_from_page_cache(struct page *page); diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h new file mode 100644 index 000000000000..36017cf91bbf --- /dev/null +++ b/include/linux/pagevec.h @@ -0,0 +1,77 @@ +/* + * include/linux/pagevec.h + * + * In many places it is efficient to batch an operation up against multiple + * pages. A pagevec is a multipage container which is used for that. + */ + +#define PAGEVEC_SIZE 16 + +struct page; + +struct pagevec { + unsigned nr; + struct page *pages[PAGEVEC_SIZE]; +}; + +void __pagevec_release(struct pagevec *pvec); +void __pagevec_release_nonlru(struct pagevec *pvec); +void __pagevec_free(struct pagevec *pvec); +void __pagevec_lru_add(struct pagevec *pvec); +void __pagevec_lru_del(struct pagevec *pvec); +void lru_add_drain(void); +void pagevec_deactivate_inactive(struct pagevec *pvec); + +static inline void pagevec_init(struct pagevec *pvec) +{ + pvec->nr = 0; +} + +static inline unsigned pagevec_count(struct pagevec *pvec) +{ + return pvec->nr; +} + +static inline unsigned pagevec_space(struct pagevec *pvec) +{ + return PAGEVEC_SIZE - pvec->nr; +} + +/* + * Add a page to a pagevec. Returns the number of slots still available. + */ +static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page) +{ + pvec->pages[pvec->nr++] = page; + return pagevec_space(pvec); +} + +static inline void pagevec_release(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_release(pvec); +} + +static inline void pagevec_release_nonlru(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_release_nonlru(pvec); +} + +static inline void pagevec_free(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_free(pvec); +} + +static inline void pagevec_lru_add(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_lru_add(pvec); +} + +static inline void pagevec_lru_del(struct pagevec *pvec) +{ + if (pagevec_count(pvec)) + __pagevec_lru_del(pvec); +} diff --git a/include/linux/sched.h b/include/linux/sched.h index fcd107c3d29c..767d1b7bd0ec 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -445,7 +445,6 @@ extern union thread_union init_thread_union; extern struct task_struct init_task; extern struct mm_struct init_mm; -extern struct task_struct *init_tasks[NR_CPUS]; /* PID hashing. (shouldnt this be dynamic?) */ #define PIDHASH_SZ (4096 >> 2) diff --git a/include/linux/smp.h b/include/linux/smp.h index 6f6c6ed7a239..8ed8547e5212 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -96,6 +96,7 @@ static inline void smp_send_reschedule_all(void) { } #define cpu_online_map 1 #define cpu_online(cpu) ({ cpu; 1; }) #define num_online_cpus() 1 +#define num_booting_cpus() 1 struct notifier_block; diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index c9b93c6a7a27..2ce2c8223384 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -57,8 +57,7 @@ struct rpc_timeout { unsigned long to_current, /* current timeout */ to_initval, /* initial timeout */ to_maxval, /* max timeout */ - to_increment, /* if !exponential */ - to_resrvval; /* reserve timeout */ + to_increment; /* if !exponential */ short to_retries; /* max # of retries */ unsigned char to_exponential; }; @@ -173,7 +172,7 @@ void xprt_default_timeout(struct rpc_timeout *, int); void xprt_set_timeout(struct rpc_timeout *, unsigned int, unsigned long); -int xprt_reserve(struct rpc_task *); +void xprt_reserve(struct rpc_task *); void xprt_transmit(struct rpc_task *); void xprt_receive(struct rpc_task *); int xprt_adjust_timeout(struct rpc_timeout *); diff --git a/include/linux/swap.h b/include/linux/swap.h index b3bae533a6a4..a7f1f96ff9f1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -156,8 +156,6 @@ extern int FASTCALL(page_over_rsslimit(struct page *)); /* linux/mm/swap.c */ extern void FASTCALL(lru_cache_add(struct page *)); -extern void FASTCALL(__lru_cache_del(struct page *)); -extern void FASTCALL(lru_cache_del(struct page *)); extern void FASTCALL(activate_page(struct page *)); @@ -211,7 +209,7 @@ extern struct swap_list_t swap_list; asmlinkage long sys_swapoff(const char *); asmlinkage long sys_swapon(const char *, int); -extern spinlock_t pagemap_lru_lock; +extern spinlock_t _pagemap_lru_lock; extern void FASTCALL(mark_page_accessed(struct page *)); @@ -227,12 +225,17 @@ do { \ BUG(); \ } while (0) +#define __add_page_to_active_list(page) \ +do { \ + list_add(&(page)->lru, &active_list); \ + inc_page_state(nr_active); \ +} while (0) + #define add_page_to_active_list(page) \ do { \ DEBUG_LRU_PAGE(page); \ SetPageActive(page); \ - list_add(&(page)->lru, &active_list); \ - inc_page_state(nr_active); \ + __add_page_to_active_list(page); \ } while (0) #define add_page_to_inactive_list(page) \ diff --git a/include/linux/usb.h b/include/linux/usb.h index 7f44f0ff05ef..ad34a45f28c4 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -167,10 +167,6 @@ struct usb_device; #define USB_DT_OTHER_SPEED_CONFIG 0x07 #define USB_DT_INTERFACE_POWER 0x08 -// FIXME should be internal to hub driver -#define USB_DT_HUB (USB_TYPE_CLASS | 0x09) -#define USB_DT_HUB_NONVAR_SIZE 7 - /* * Descriptor sizes per descriptor type */ @@ -258,6 +254,8 @@ struct usb_interface { void *private_data; }; #define to_usb_interface(d) container_of(d, struct usb_interface, dev) +#define interface_to_usbdev(intf) \ + container_of(intf->dev.parent, struct usb_device, dev) /* USB_DT_CONFIG: Configuration descriptor information. * @@ -303,10 +301,8 @@ struct usb_qualifier_descriptor { __u8 bRESERVED; } __attribute__ ((packed)); -/* helpers for driver access to descriptors */ -extern int usb_ifnum_to_ifpos(struct usb_device *dev, unsigned ifnum); -extern struct usb_interface * - usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum); +// FIXME remove; exported only for drivers/usb/misc/auserwald.c +// prefer usb_device->epnum[0..31] extern struct usb_endpoint_descriptor * usb_epnum_to_ep_desc(struct usb_device *dev, unsigned epnum); @@ -435,10 +431,6 @@ extern void usb_free_dev(struct usb_device *); /* for when layers above USB add new non-USB drivers */ extern void usb_scan_devices(void); -/* for probe/disconnect with correct module usage counting */ -void *usb_bind_driver(struct usb_driver *driver, struct usb_device *dev, unsigned int ifnum); -void usb_unbind_driver(struct usb_device *device, struct usb_interface *intf); - /* mostly for devices emulating SCSI over USB */ extern int usb_reset_device(struct usb_device *dev); @@ -446,14 +438,12 @@ extern int usb_reset_device(struct usb_device *dev); extern int usb_get_current_frame_number (struct usb_device *usb_dev); /* used these for multi-interface device registration */ -extern int usb_find_interface_driver_for_ifnum(struct usb_device *dev, unsigned int ifnum); 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); -const struct usb_device_id *usb_match_id(struct usb_device *dev, - struct usb_interface *interface, +const struct usb_device_id *usb_match_id(struct usb_interface *interface, const struct usb_device_id *id); /** |
