aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2005-10-07 02:46:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-08 18:00:57 -0400
commitdd0fc66fb33cd610bc1a5db8a5e232d34879b4d7 (patch)
tree51f96a9db96293b352e358f66032e1f4ff79fafb /include/linux
parent3b0e77bd144203a507eb191f7117d2c5004ea1de (diff)
[PATCH] gfp flags annotations - part 1
- added typedef unsigned int __nocast gfp_t; - replaced __nocast uses for gfp flags with gfp_t - it gives exactly the same warnings as far as sparse is concerned, doesn't change generated code (from gcc point of view we replaced unsigned int with typedef) and documents what's going on far better. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/bio.h6
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpuset.h5
-rw-r--r--include/linux/dmapool.h2
-rw-r--r--include/linux/gfp.h14
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/kfifo.h4
-rw-r--r--include/linux/mempool.h9
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/posix_acl.h6
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/skbuff.h28
-rw-r--r--include/linux/slab.h19
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/textsearch.h2
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/vmalloc.h4
22 files changed, 63 insertions, 64 deletions
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index aca9b344bd35..e7d0593bb576 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -467,7 +467,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
467 467
468int atm_charge(struct atm_vcc *vcc,int truesize); 468int atm_charge(struct atm_vcc *vcc,int truesize);
469struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size, 469struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
470 unsigned int __nocast gfp_flags); 470 gfp_t gfp_flags);
471int atm_pcr_goal(struct atm_trafprm *tp); 471int atm_pcr_goal(struct atm_trafprm *tp);
472 472
473void vcc_release_async(struct atm_vcc *vcc, int reply); 473void vcc_release_async(struct atm_vcc *vcc, int reply);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6e1c79c8b6bf..3344b4e8e43a 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -276,8 +276,8 @@ extern void bio_pair_release(struct bio_pair *dbio);
276extern struct bio_set *bioset_create(int, int, int); 276extern struct bio_set *bioset_create(int, int, int);
277extern void bioset_free(struct bio_set *); 277extern void bioset_free(struct bio_set *);
278 278
279extern struct bio *bio_alloc(unsigned int __nocast, int); 279extern struct bio *bio_alloc(gfp_t, int);
280extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *); 280extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
281extern void bio_put(struct bio *); 281extern void bio_put(struct bio *);
282extern void bio_free(struct bio *, struct bio_set *); 282extern void bio_free(struct bio *, struct bio_set *);
283 283
@@ -287,7 +287,7 @@ extern int bio_phys_segments(struct request_queue *, struct bio *);
287extern int bio_hw_segments(struct request_queue *, struct bio *); 287extern int bio_hw_segments(struct request_queue *, struct bio *);
288 288
289extern void __bio_clone(struct bio *, struct bio *); 289extern void __bio_clone(struct bio *, struct bio *);
290extern struct bio *bio_clone(struct bio *, unsigned int __nocast); 290extern struct bio *bio_clone(struct bio *, gfp_t);
291 291
292extern void bio_init(struct bio *); 292extern void bio_init(struct bio *);
293 293
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 90828493791f..6a1d154c0825 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -172,7 +172,7 @@ void __brelse(struct buffer_head *);
172void __bforget(struct buffer_head *); 172void __bforget(struct buffer_head *);
173void __breadahead(struct block_device *, sector_t block, int size); 173void __breadahead(struct block_device *, sector_t block, int size);
174struct buffer_head *__bread(struct block_device *, sector_t block, int size); 174struct buffer_head *__bread(struct block_device *, sector_t block, int size);
175struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags); 175struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
176void free_buffer_head(struct buffer_head * bh); 176void free_buffer_head(struct buffer_head * bh);
177void FASTCALL(unlock_buffer(struct buffer_head *bh)); 177void FASTCALL(unlock_buffer(struct buffer_head *bh));
178void FASTCALL(__lock_buffer(struct buffer_head *bh)); 178void FASTCALL(__lock_buffer(struct buffer_head *bh));
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 96582c9911ac..95952cc1f525 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -149,7 +149,7 @@ struct cn_dev {
149 149
150int cn_add_callback(struct cb_id *, char *, void (*callback) (void *)); 150int cn_add_callback(struct cb_id *, char *, void (*callback) (void *));
151void cn_del_callback(struct cb_id *); 151void cn_del_callback(struct cb_id *);
152int cn_netlink_send(struct cn_msg *, u32, unsigned int __nocast); 152int cn_netlink_send(struct cn_msg *, u32, gfp_t);
153 153
154int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *)); 154int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
155void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 155void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 24062a1dbf61..6e2deef96b34 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -23,7 +23,7 @@ void cpuset_init_current_mems_allowed(void);
23void cpuset_update_current_mems_allowed(void); 23void cpuset_update_current_mems_allowed(void);
24void cpuset_restrict_to_mems_allowed(unsigned long *nodes); 24void cpuset_restrict_to_mems_allowed(unsigned long *nodes);
25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 25int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
26extern int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask); 26extern int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
27extern int cpuset_excl_nodes_overlap(const struct task_struct *p); 27extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
28extern struct file_operations proc_cpuset_operations; 28extern struct file_operations proc_cpuset_operations;
29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 29extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
@@ -49,8 +49,7 @@ static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
49 return 1; 49 return 1;
50} 50}
51 51
52static inline int cpuset_zone_allowed(struct zone *z, 52static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
53 unsigned int __nocast gfp_mask)
54{ 53{
55 return 1; 54 return 1;
56} 55}
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index 4932ee5c77f0..76f12f46db7f 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -19,7 +19,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
19 19
20void dma_pool_destroy(struct dma_pool *pool); 20void dma_pool_destroy(struct dma_pool *pool);
21 21
22void *dma_pool_alloc(struct dma_pool *pool, unsigned int __nocast mem_flags, 22void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
23 dma_addr_t *handle); 23 dma_addr_t *handle);
24 24
25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); 25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4dc990f3b5cc..3010e172394d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -85,9 +85,9 @@ static inline void arch_free_page(struct page *page, int order) { }
85#endif 85#endif
86 86
87extern struct page * 87extern struct page *
88FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *)); 88FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *));
89 89
90static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_mask, 90static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
91 unsigned int order) 91 unsigned int order)
92{ 92{
93 if (unlikely(order >= MAX_ORDER)) 93 if (unlikely(order >= MAX_ORDER))
@@ -98,17 +98,17 @@ static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_m
98} 98}
99 99
100#ifdef CONFIG_NUMA 100#ifdef CONFIG_NUMA
101extern struct page *alloc_pages_current(unsigned int __nocast gfp_mask, unsigned order); 101extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
102 102
103static inline struct page * 103static inline struct page *
104alloc_pages(unsigned int __nocast gfp_mask, unsigned int order) 104alloc_pages(gfp_t gfp_mask, unsigned int order)
105{ 105{
106 if (unlikely(order >= MAX_ORDER)) 106 if (unlikely(order >= MAX_ORDER))
107 return NULL; 107 return NULL;
108 108
109 return alloc_pages_current(gfp_mask, order); 109 return alloc_pages_current(gfp_mask, order);
110} 110}
111extern struct page *alloc_page_vma(unsigned __nocast gfp_mask, 111extern struct page *alloc_page_vma(gfp_t gfp_mask,
112 struct vm_area_struct *vma, unsigned long addr); 112 struct vm_area_struct *vma, unsigned long addr);
113#else 113#else
114#define alloc_pages(gfp_mask, order) \ 114#define alloc_pages(gfp_mask, order) \
@@ -117,8 +117,8 @@ extern struct page *alloc_page_vma(unsigned __nocast gfp_mask,
117#endif 117#endif
118#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 118#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
119 119
120extern unsigned long FASTCALL(__get_free_pages(unsigned int __nocast gfp_mask, unsigned int order)); 120extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order));
121extern unsigned long FASTCALL(get_zeroed_page(unsigned int __nocast gfp_mask)); 121extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask));
122 122
123#define __get_free_page(gfp_mask) \ 123#define __get_free_page(gfp_mask) \
124 __get_free_pages((gfp_mask),0) 124 __get_free_pages((gfp_mask),0)
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index de097269bd7f..ff853b3173c6 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -935,7 +935,7 @@ void journal_put_journal_head(struct journal_head *jh);
935 */ 935 */
936extern kmem_cache_t *jbd_handle_cache; 936extern kmem_cache_t *jbd_handle_cache;
937 937
938static inline handle_t *jbd_alloc_handle(unsigned int __nocast gfp_flags) 938static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags)
939{ 939{
940 return kmem_cache_alloc(jbd_handle_cache, gfp_flags); 940 return kmem_cache_alloc(jbd_handle_cache, gfp_flags);
941} 941}
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index c27cd428d269..48eccd865bd8 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -35,8 +35,8 @@ struct kfifo {
35}; 35};
36 36
37extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, 37extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size,
38 unsigned int __nocast gfp_mask, spinlock_t *lock); 38 gfp_t gfp_mask, spinlock_t *lock);
39extern struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, 39extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask,
40 spinlock_t *lock); 40 spinlock_t *lock);
41extern void kfifo_free(struct kfifo *fifo); 41extern void kfifo_free(struct kfifo *fifo);
42extern unsigned int __kfifo_put(struct kfifo *fifo, 42extern unsigned int __kfifo_put(struct kfifo *fifo,
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index 796220ce47cc..f2427d7394b0 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -6,7 +6,7 @@
6 6
7#include <linux/wait.h> 7#include <linux/wait.h>
8 8
9typedef void * (mempool_alloc_t)(unsigned int __nocast gfp_mask, void *pool_data); 9typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
10typedef void (mempool_free_t)(void *element, void *pool_data); 10typedef void (mempool_free_t)(void *element, void *pool_data);
11 11
12typedef struct mempool_s { 12typedef struct mempool_s {
@@ -26,17 +26,16 @@ extern mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn,
26extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, 26extern mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
27 mempool_free_t *free_fn, void *pool_data, int nid); 27 mempool_free_t *free_fn, void *pool_data, int nid);
28 28
29extern int mempool_resize(mempool_t *pool, int new_min_nr, 29extern int mempool_resize(mempool_t *pool, int new_min_nr, gfp_t gfp_mask);
30 unsigned int __nocast gfp_mask);
31extern void mempool_destroy(mempool_t *pool); 30extern void mempool_destroy(mempool_t *pool);
32extern void * mempool_alloc(mempool_t *pool, unsigned int __nocast gfp_mask); 31extern void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask);
33extern void mempool_free(void *element, mempool_t *pool); 32extern void mempool_free(void *element, mempool_t *pool);
34 33
35/* 34/*
36 * A mempool_alloc_t and mempool_free_t that get the memory from 35 * A mempool_alloc_t and mempool_free_t that get the memory from
37 * a slab that is passed in through pool_data. 36 * a slab that is passed in through pool_data.
38 */ 37 */
39void *mempool_alloc_slab(unsigned int __nocast gfp_mask, void *pool_data); 38void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
40void mempool_free_slab(void *element, void *pool_data); 39void mempool_free_slab(void *element, void *pool_data);
41 40
42#endif /* _LINUX_MEMPOOL_H */ 41#endif /* _LINUX_MEMPOOL_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index bdebdc564506..ba25ca874c20 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -131,7 +131,7 @@ extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*
131extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 131extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
132extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 132extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
133extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 133extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
134 __u32 group, unsigned int __nocast allocation); 134 __u32 group, gfp_t allocation);
135extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 135extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
136extern int netlink_register_notifier(struct notifier_block *nb); 136extern int netlink_register_notifier(struct notifier_block *nb);
137extern int netlink_unregister_notifier(struct notifier_block *nb); 137extern int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index d9a25647a295..acbf31c154f8 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -19,7 +19,7 @@
19#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 19#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */
20#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 20#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */
21 21
22static inline unsigned int __nocast mapping_gfp_mask(struct address_space * mapping) 22static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
23{ 23{
24 return mapping->flags & __GFP_BITS_MASK; 24 return mapping->flags & __GFP_BITS_MASK;
25} 25}
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 4caedddaa033..4bc241290c24 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -71,11 +71,11 @@ posix_acl_release(struct posix_acl *acl)
71 71
72/* posix_acl.c */ 72/* posix_acl.c */
73 73
74extern struct posix_acl *posix_acl_alloc(int, unsigned int __nocast); 74extern struct posix_acl *posix_acl_alloc(int, gfp_t);
75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, unsigned int __nocast); 75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
76extern int posix_acl_valid(const struct posix_acl *); 76extern int posix_acl_valid(const struct posix_acl *);
77extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); 77extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
78extern struct posix_acl *posix_acl_from_mode(mode_t, unsigned int __nocast); 78extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t);
79extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); 79extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *);
80extern int posix_acl_create_masq(struct posix_acl *, mode_t *); 80extern int posix_acl_create_masq(struct posix_acl *, mode_t *);
81extern int posix_acl_chmod_masq(struct posix_acl *, mode_t); 81extern int posix_acl_chmod_masq(struct posix_acl *, mode_t);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9c51917b1cce..045d4761febc 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -50,7 +50,7 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
50unsigned int 50unsigned int
51radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 51radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
52 unsigned long first_index, unsigned int max_items); 52 unsigned long first_index, unsigned int max_items);
53int radix_tree_preload(unsigned int __nocast gfp_mask); 53int radix_tree_preload(gfp_t gfp_mask);
54void radix_tree_init(void); 54void radix_tree_init(void);
55void *radix_tree_tag_set(struct radix_tree_root *root, 55void *radix_tree_tag_set(struct radix_tree_root *root,
56 unsigned long index, int tag); 56 unsigned long index, int tag);
diff --git a/include/linux/security.h b/include/linux/security.h
index 0e43460d374e..627382e74057 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -2634,8 +2634,7 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2634 return security_ops->socket_getpeersec(sock, optval, optlen, len); 2634 return security_ops->socket_getpeersec(sock, optval, optlen, len);
2635} 2635}
2636 2636
2637static inline int security_sk_alloc(struct sock *sk, int family, 2637static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2638 unsigned int __nocast priority)
2639{ 2638{
2640 return security_ops->sk_alloc_security(sk, family, priority); 2639 return security_ops->sk_alloc_security(sk, family, priority);
2641} 2640}
@@ -2752,8 +2751,7 @@ static inline int security_socket_getpeersec(struct socket *sock, char __user *o
2752 return -ENOPROTOOPT; 2751 return -ENOPROTOOPT;
2753} 2752}
2754 2753
2755static inline int security_sk_alloc(struct sock *sk, int family, 2754static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
2756 unsigned int __nocast priority)
2757{ 2755{
2758 return 0; 2756 return 0;
2759} 2757}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 466c879f82b8..8f5d9e7f8734 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -302,37 +302,37 @@ struct sk_buff {
302 302
303extern void __kfree_skb(struct sk_buff *skb); 303extern void __kfree_skb(struct sk_buff *skb);
304extern struct sk_buff *__alloc_skb(unsigned int size, 304extern struct sk_buff *__alloc_skb(unsigned int size,
305 unsigned int __nocast priority, int fclone); 305 gfp_t priority, int fclone);
306static inline struct sk_buff *alloc_skb(unsigned int size, 306static inline struct sk_buff *alloc_skb(unsigned int size,
307 unsigned int __nocast priority) 307 gfp_t priority)
308{ 308{
309 return __alloc_skb(size, priority, 0); 309 return __alloc_skb(size, priority, 0);
310} 310}
311 311
312static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 312static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
313 unsigned int __nocast priority) 313 gfp_t priority)
314{ 314{
315 return __alloc_skb(size, priority, 1); 315 return __alloc_skb(size, priority, 1);
316} 316}
317 317
318extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp, 318extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
319 unsigned int size, 319 unsigned int size,
320 unsigned int __nocast priority); 320 gfp_t priority);
321extern void kfree_skbmem(struct sk_buff *skb); 321extern void kfree_skbmem(struct sk_buff *skb);
322extern struct sk_buff *skb_clone(struct sk_buff *skb, 322extern struct sk_buff *skb_clone(struct sk_buff *skb,
323 unsigned int __nocast priority); 323 gfp_t priority);
324extern struct sk_buff *skb_copy(const struct sk_buff *skb, 324extern struct sk_buff *skb_copy(const struct sk_buff *skb,
325 unsigned int __nocast priority); 325 gfp_t priority);
326extern struct sk_buff *pskb_copy(struct sk_buff *skb, 326extern struct sk_buff *pskb_copy(struct sk_buff *skb,
327 unsigned int __nocast gfp_mask); 327 gfp_t gfp_mask);
328extern int pskb_expand_head(struct sk_buff *skb, 328extern int pskb_expand_head(struct sk_buff *skb,
329 int nhead, int ntail, 329 int nhead, int ntail,
330 unsigned int __nocast gfp_mask); 330 gfp_t gfp_mask);
331extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 331extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
332 unsigned int headroom); 332 unsigned int headroom);
333extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 333extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
334 int newheadroom, int newtailroom, 334 int newheadroom, int newtailroom,
335 unsigned int __nocast priority); 335 gfp_t priority);
336extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad); 336extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
337#define dev_kfree_skb(a) kfree_skb(a) 337#define dev_kfree_skb(a) kfree_skb(a)
338extern void skb_over_panic(struct sk_buff *skb, int len, 338extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -484,7 +484,7 @@ static inline int skb_shared(const struct sk_buff *skb)
484 * NULL is returned on a memory allocation failure. 484 * NULL is returned on a memory allocation failure.
485 */ 485 */
486static inline struct sk_buff *skb_share_check(struct sk_buff *skb, 486static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
487 unsigned int __nocast pri) 487 gfp_t pri)
488{ 488{
489 might_sleep_if(pri & __GFP_WAIT); 489 might_sleep_if(pri & __GFP_WAIT);
490 if (skb_shared(skb)) { 490 if (skb_shared(skb)) {
@@ -516,7 +516,7 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
516 * %NULL is returned on a memory allocation failure. 516 * %NULL is returned on a memory allocation failure.
517 */ 517 */
518static inline struct sk_buff *skb_unshare(struct sk_buff *skb, 518static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
519 unsigned int __nocast pri) 519 gfp_t pri)
520{ 520{
521 might_sleep_if(pri & __GFP_WAIT); 521 might_sleep_if(pri & __GFP_WAIT);
522 if (skb_cloned(skb)) { 522 if (skb_cloned(skb)) {
@@ -1017,7 +1017,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1017 * %NULL is returned in there is no free memory. 1017 * %NULL is returned in there is no free memory.
1018 */ 1018 */
1019static inline struct sk_buff *__dev_alloc_skb(unsigned int length, 1019static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1020 unsigned int __nocast gfp_mask) 1020 gfp_t gfp_mask)
1021{ 1021{
1022 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask); 1022 struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
1023 if (likely(skb)) 1023 if (likely(skb))
@@ -1130,8 +1130,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1130 * If there is no free memory -ENOMEM is returned, otherwise zero 1130 * If there is no free memory -ENOMEM is returned, otherwise zero
1131 * is returned and the old skb data released. 1131 * is returned and the old skb data released.
1132 */ 1132 */
1133extern int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp); 1133extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp);
1134static inline int skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp) 1134static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
1135{ 1135{
1136 return __skb_linearize(skb, gfp); 1136 return __skb_linearize(skb, gfp);
1137} 1137}
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1f356f3bbc64..5fc04a16ecb0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -61,11 +61,11 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo
61 void (*)(void *, kmem_cache_t *, unsigned long)); 61 void (*)(void *, kmem_cache_t *, unsigned long));
62extern int kmem_cache_destroy(kmem_cache_t *); 62extern int kmem_cache_destroy(kmem_cache_t *);
63extern int kmem_cache_shrink(kmem_cache_t *); 63extern int kmem_cache_shrink(kmem_cache_t *);
64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); 64extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *); 67extern const char *kmem_cache_name(kmem_cache_t *);
68extern kmem_cache_t *kmem_find_general_cachep(size_t size, unsigned int __nocast gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, gfp_t gfpflags);
69 69
70/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
71struct cache_sizes { 71struct cache_sizes {
@@ -74,9 +74,9 @@ struct cache_sizes {
74 kmem_cache_t *cs_dmacachep; 74 kmem_cache_t *cs_dmacachep;
75}; 75};
76extern struct cache_sizes malloc_sizes[]; 76extern struct cache_sizes malloc_sizes[];
77extern void *__kmalloc(size_t, unsigned int __nocast); 77extern void *__kmalloc(size_t, gfp_t);
78 78
79static inline void *kmalloc(size_t size, unsigned int __nocast flags) 79static inline void *kmalloc(size_t size, gfp_t flags)
80{ 80{
81 if (__builtin_constant_p(size)) { 81 if (__builtin_constant_p(size)) {
82 int i = 0; 82 int i = 0;
@@ -99,7 +99,7 @@ found:
99 return __kmalloc(size, flags); 99 return __kmalloc(size, flags);
100} 100}
101 101
102extern void *kzalloc(size_t, unsigned int __nocast); 102extern void *kzalloc(size_t, gfp_t);
103 103
104/** 104/**
105 * kcalloc - allocate memory for an array. The memory is set to zero. 105 * kcalloc - allocate memory for an array. The memory is set to zero.
@@ -107,7 +107,7 @@ extern void *kzalloc(size_t, unsigned int __nocast);
107 * @size: element size. 107 * @size: element size.
108 * @flags: the type of memory to allocate. 108 * @flags: the type of memory to allocate.
109 */ 109 */
110static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags) 110static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
111{ 111{
112 if (n != 0 && size > INT_MAX / n) 112 if (n != 0 && size > INT_MAX / n)
113 return NULL; 113 return NULL;
@@ -118,15 +118,14 @@ extern void kfree(const void *);
118extern unsigned int ksize(const void *); 118extern unsigned int ksize(const void *);
119 119
120#ifdef CONFIG_NUMA 120#ifdef CONFIG_NUMA
121extern void *kmem_cache_alloc_node(kmem_cache_t *, 121extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
122 unsigned int __nocast flags, int node); 122extern void *kmalloc_node(size_t size, gfp_t flags, int node);
123extern void *kmalloc_node(size_t size, unsigned int __nocast flags, int node);
124#else 123#else
125static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node) 124static inline void *kmem_cache_alloc_node(kmem_cache_t *cachep, int flags, int node)
126{ 125{
127 return kmem_cache_alloc(cachep, flags); 126 return kmem_cache_alloc(cachep, flags);
128} 127}
129static inline void *kmalloc_node(size_t size, unsigned int __nocast flags, int node) 128static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
130{ 129{
131 return kmalloc(size, flags); 130 return kmalloc(size, flags);
132} 131}
diff --git a/include/linux/string.h b/include/linux/string.h
index dab2652acbd8..369be3264a55 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -88,7 +88,7 @@ extern int memcmp(const void *,const void *,__kernel_size_t);
88extern void * memchr(const void *,int,__kernel_size_t); 88extern void * memchr(const void *,int,__kernel_size_t);
89#endif 89#endif
90 90
91extern char *kstrdup(const char *s, unsigned int __nocast gfp); 91extern char *kstrdup(const char *s, gfp_t gfp);
92 92
93#ifdef __cplusplus 93#ifdef __cplusplus
94} 94}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 3c9ff0048153..a7bf1a3b1496 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -147,7 +147,7 @@ struct swap_list_t {
147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) 147#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
148 148
149/* linux/mm/oom_kill.c */ 149/* linux/mm/oom_kill.c */
150extern void out_of_memory(unsigned int __nocast gfp_mask, int order); 150extern void out_of_memory(gfp_t gfp_mask, int order);
151 151
152/* linux/mm/memory.c */ 152/* linux/mm/memory.c */
153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); 153extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index 1a4990e448e9..515046d1b2f4 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -159,7 +159,7 @@ extern unsigned int textsearch_find_continuous(struct ts_config *,
159#define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1)) 159#define TS_PRIV_ALIGN(len) (((len) + TS_PRIV_ALIGNTO-1) & ~(TS_PRIV_ALIGNTO-1))
160 160
161static inline struct ts_config *alloc_ts_config(size_t payload, 161static inline struct ts_config *alloc_ts_config(size_t payload,
162 unsigned int __nocast gfp_mask) 162 gfp_t gfp_mask)
163{ 163{
164 struct ts_config *conf; 164 struct ts_config *conf;
165 165
diff --git a/include/linux/types.h b/include/linux/types.h
index 2b678c22ca4a..0aee34f9da9f 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -165,6 +165,10 @@ typedef __u64 __bitwise __le64;
165typedef __u64 __bitwise __be64; 165typedef __u64 __bitwise __be64;
166#endif 166#endif
167 167
168#ifdef __KERNEL__
169typedef unsigned __nocast gfp_t;
170#endif
171
168struct ustat { 172struct ustat {
169 __kernel_daddr_t f_tfree; 173 __kernel_daddr_t f_tfree;
170 __kernel_ino_t f_tinode; 174 __kernel_ino_t f_tinode;
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index b244f69ef682..3701a0673d2c 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -34,8 +34,8 @@ struct vm_struct {
34extern void *vmalloc(unsigned long size); 34extern void *vmalloc(unsigned long size);
35extern void *vmalloc_exec(unsigned long size); 35extern void *vmalloc_exec(unsigned long size);
36extern void *vmalloc_32(unsigned long size); 36extern void *vmalloc_32(unsigned long size);
37extern void *__vmalloc(unsigned long size, unsigned int __nocast gfp_mask, pgprot_t prot); 37extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot);
38extern void *__vmalloc_area(struct vm_struct *area, unsigned int __nocast gfp_mask, pgprot_t prot); 38extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot);
39extern void vfree(void *addr); 39extern void vfree(void *addr);
40 40
41extern void *vmap(struct page **pages, unsigned int count, 41extern void *vmap(struct page **pages, unsigned int count,