You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ int atm_charge(struct atm_vcc *vcc,int truesize)
|
||||
|
||||
|
||||
struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
|
||||
unsigned int __nocast gfp_flags)
|
||||
gfp_t gfp_flags)
|
||||
{
|
||||
struct sock *sk = sk_atm(vcc);
|
||||
int guess = atm_guess_pdu2truesize(pdu_size);
|
||||
|
||||
@@ -372,7 +372,7 @@ static struct proto l2cap_proto = {
|
||||
.obj_size = sizeof(struct l2cap_pinfo)
|
||||
};
|
||||
|
||||
static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio)
|
||||
static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d)
|
||||
d->rx_credits = RFCOMM_DEFAULT_CREDITS;
|
||||
}
|
||||
|
||||
struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio)
|
||||
struct rfcomm_dlc *rfcomm_dlc_alloc(gfp_t prio)
|
||||
{
|
||||
struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio);
|
||||
if (!d)
|
||||
|
||||
@@ -284,7 +284,7 @@ static struct proto rfcomm_proto = {
|
||||
.obj_size = sizeof(struct rfcomm_pinfo)
|
||||
};
|
||||
|
||||
static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio)
|
||||
static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio)
|
||||
{
|
||||
struct rfcomm_dlc *d;
|
||||
struct sock *sk;
|
||||
|
||||
@@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de
|
||||
skb->destructor = rfcomm_wfree;
|
||||
}
|
||||
|
||||
static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority)
|
||||
static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, gfp_t priority)
|
||||
{
|
||||
if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) {
|
||||
struct sk_buff *skb = alloc_skb(size, priority);
|
||||
|
||||
+1
-1
@@ -418,7 +418,7 @@ static struct proto sco_proto = {
|
||||
.obj_size = sizeof(struct sco_pinfo)
|
||||
};
|
||||
|
||||
static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio)
|
||||
static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
|
||||
+1
-1
@@ -1132,7 +1132,7 @@ static inline int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
|
||||
#endif
|
||||
|
||||
/* Keep head the same: replace data */
|
||||
int __skb_linearize(struct sk_buff *skb, unsigned int __nocast gfp_mask)
|
||||
int __skb_linearize(struct sk_buff *skb, gfp_t gfp_mask)
|
||||
{
|
||||
unsigned int size;
|
||||
u8 *data;
|
||||
|
||||
+7
-7
@@ -130,7 +130,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
|
||||
* Buffers may only be allocated from interrupts using a @gfp_mask of
|
||||
* %GFP_ATOMIC.
|
||||
*/
|
||||
struct sk_buff *__alloc_skb(unsigned int size, unsigned int __nocast gfp_mask,
|
||||
struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
|
||||
int fclone)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
@@ -198,7 +198,7 @@ nodata:
|
||||
*/
|
||||
struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
|
||||
unsigned int size,
|
||||
unsigned int __nocast gfp_mask)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
u8 *data;
|
||||
@@ -361,7 +361,7 @@ void __kfree_skb(struct sk_buff *skb)
|
||||
* %GFP_ATOMIC.
|
||||
*/
|
||||
|
||||
struct sk_buff *skb_clone(struct sk_buff *skb, unsigned int __nocast gfp_mask)
|
||||
struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
|
||||
{
|
||||
struct sk_buff *n;
|
||||
|
||||
@@ -500,7 +500,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
|
||||
* header is going to be modified. Use pskb_copy() instead.
|
||||
*/
|
||||
|
||||
struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_mask)
|
||||
struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
|
||||
{
|
||||
int headerlen = skb->data - skb->head;
|
||||
/*
|
||||
@@ -539,7 +539,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, unsigned int __nocast gfp_ma
|
||||
* The returned buffer has a reference count of 1.
|
||||
*/
|
||||
|
||||
struct sk_buff *pskb_copy(struct sk_buff *skb, unsigned int __nocast gfp_mask)
|
||||
struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
|
||||
{
|
||||
/*
|
||||
* Allocate the copy buffer
|
||||
@@ -598,7 +598,7 @@ out:
|
||||
*/
|
||||
|
||||
int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
|
||||
unsigned int __nocast gfp_mask)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
int i;
|
||||
u8 *data;
|
||||
@@ -689,7 +689,7 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
|
||||
*/
|
||||
struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
|
||||
int newheadroom, int newtailroom,
|
||||
unsigned int __nocast gfp_mask)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
/*
|
||||
* Allocate the copy buffer
|
||||
|
||||
+5
-5
@@ -637,7 +637,7 @@ lenout:
|
||||
* @prot: struct proto associated with this new sock instance
|
||||
* @zero_it: if we should zero the newly allocated sock
|
||||
*/
|
||||
struct sock *sk_alloc(int family, unsigned int __nocast priority,
|
||||
struct sock *sk_alloc(int family, gfp_t priority,
|
||||
struct proto *prot, int zero_it)
|
||||
{
|
||||
struct sock *sk = NULL;
|
||||
@@ -704,7 +704,7 @@ void sk_free(struct sock *sk)
|
||||
module_put(owner);
|
||||
}
|
||||
|
||||
struct sock *sk_clone(const struct sock *sk, const unsigned int __nocast priority)
|
||||
struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
|
||||
{
|
||||
struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0);
|
||||
|
||||
@@ -845,7 +845,7 @@ unsigned long sock_i_ino(struct sock *sk)
|
||||
* Allocate a skb from the socket's send buffer.
|
||||
*/
|
||||
struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
|
||||
unsigned int __nocast priority)
|
||||
gfp_t priority)
|
||||
{
|
||||
if (force || atomic_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
|
||||
struct sk_buff * skb = alloc_skb(size, priority);
|
||||
@@ -861,7 +861,7 @@ struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
|
||||
* Allocate a skb from the socket's receive buffer.
|
||||
*/
|
||||
struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
|
||||
unsigned int __nocast priority)
|
||||
gfp_t priority)
|
||||
{
|
||||
if (force || atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf) {
|
||||
struct sk_buff *skb = alloc_skb(size, priority);
|
||||
@@ -876,7 +876,7 @@ struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
|
||||
/*
|
||||
* Allocate a memory block from the socket's option memory buffer.
|
||||
*/
|
||||
void *sock_kmalloc(struct sock *sk, int size, unsigned int __nocast priority)
|
||||
void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
|
||||
{
|
||||
if ((unsigned)size <= sysctl_optmem_max &&
|
||||
atomic_read(&sk->sk_omem_alloc) + size < sysctl_optmem_max) {
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
struct dccp_ackvec *dccp_ackvec_alloc(const unsigned int len,
|
||||
const unsigned int __nocast priority)
|
||||
const gfp_t priority)
|
||||
{
|
||||
struct dccp_ackvec *av = kmalloc(sizeof(*av) + len, priority);
|
||||
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ struct sk_buff;
|
||||
|
||||
#ifdef CONFIG_IP_DCCP_ACKVEC
|
||||
extern struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
|
||||
const unsigned int __nocast priority);
|
||||
const gfp_t priority);
|
||||
extern void dccp_ackvec_free(struct dccp_ackvec *av);
|
||||
|
||||
extern int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
|
||||
@@ -93,7 +93,7 @@ static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
|
||||
}
|
||||
#else /* CONFIG_IP_DCCP_ACKVEC */
|
||||
static inline struct dccp_ackvec *dccp_ackvec_alloc(unsigned int len,
|
||||
const unsigned int __nocast priority)
|
||||
const gfp_t priority)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ struct dccp_li_hist_entry {
|
||||
|
||||
static inline struct dccp_li_hist_entry *
|
||||
dccp_li_hist_entry_new(struct dccp_li_hist *hist,
|
||||
const unsigned int __nocast prio)
|
||||
const gfp_t prio)
|
||||
{
|
||||
return kmem_cache_alloc(hist->dccplih_slab, prio);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ extern struct dccp_rx_hist_entry *
|
||||
|
||||
static inline struct dccp_tx_hist_entry *
|
||||
dccp_tx_hist_entry_new(struct dccp_tx_hist *hist,
|
||||
const unsigned int __nocast prio)
|
||||
const gfp_t prio)
|
||||
{
|
||||
struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab,
|
||||
prio);
|
||||
@@ -137,7 +137,7 @@ static inline struct dccp_rx_hist_entry *
|
||||
const struct sock *sk,
|
||||
const u32 ndp,
|
||||
const struct sk_buff *skb,
|
||||
const unsigned int __nocast prio)
|
||||
const gfp_t prio)
|
||||
{
|
||||
struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab,
|
||||
prio);
|
||||
|
||||
@@ -452,8 +452,7 @@ static struct proto dn_proto = {
|
||||
.obj_size = sizeof(struct dn_sock),
|
||||
};
|
||||
|
||||
static struct sock *dn_alloc_sock(struct socket *sock,
|
||||
unsigned int __nocast gfp)
|
||||
static struct sock *dn_alloc_sock(struct socket *sock, gfp_t gfp)
|
||||
{
|
||||
struct dn_scp *scp;
|
||||
struct sock *sk = sk_alloc(PF_DECnet, gfp, &dn_proto, 1);
|
||||
@@ -805,8 +804,7 @@ static int dn_auto_bind(struct socket *sock)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int dn_confirm_accept(struct sock *sk, long *timeo,
|
||||
unsigned int __nocast allocation)
|
||||
static int dn_confirm_accept(struct sock *sk, long *timeo, gfp_t allocation)
|
||||
{
|
||||
struct dn_scp *scp = DN_SK(sk);
|
||||
DEFINE_WAIT(wait);
|
||||
|
||||
+9
-11
@@ -117,8 +117,7 @@ try_again:
|
||||
* The eventual aim is for each socket to have a cached header size
|
||||
* for its outgoing packets, and to set hdr from this when sk != NULL.
|
||||
*/
|
||||
struct sk_buff *dn_alloc_skb(struct sock *sk, int size,
|
||||
unsigned int __nocast pri)
|
||||
struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
int hdr = 64;
|
||||
@@ -212,7 +211,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt)
|
||||
* Returns: The number of times the packet has been sent previously
|
||||
*/
|
||||
static inline unsigned dn_nsp_clone_and_send(struct sk_buff *skb,
|
||||
unsigned int __nocast gfp)
|
||||
gfp_t gfp)
|
||||
{
|
||||
struct dn_skb_cb *cb = DN_SKB_CB(skb);
|
||||
struct sk_buff *skb2;
|
||||
@@ -353,7 +352,7 @@ static unsigned short *dn_nsp_mk_data_header(struct sock *sk, struct sk_buff *sk
|
||||
}
|
||||
|
||||
void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb,
|
||||
unsigned int __nocast gfp, int oth)
|
||||
gfp_t gfp, int oth)
|
||||
{
|
||||
struct dn_scp *scp = DN_SK(sk);
|
||||
struct dn_skb_cb *cb = DN_SKB_CB(skb);
|
||||
@@ -520,7 +519,7 @@ static int dn_nsp_retrans_conn_conf(struct sock *sk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp)
|
||||
void dn_send_conn_conf(struct sock *sk, gfp_t gfp)
|
||||
{
|
||||
struct dn_scp *scp = DN_SK(sk);
|
||||
struct sk_buff *skb = NULL;
|
||||
@@ -552,7 +551,7 @@ void dn_send_conn_conf(struct sock *sk, unsigned int __nocast gfp)
|
||||
|
||||
|
||||
static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
|
||||
unsigned short reason, unsigned int __nocast gfp,
|
||||
unsigned short reason, gfp_t gfp,
|
||||
struct dst_entry *dst,
|
||||
int ddl, unsigned char *dd, __u16 rem, __u16 loc)
|
||||
{
|
||||
@@ -595,7 +594,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg,
|
||||
|
||||
|
||||
void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg,
|
||||
unsigned short reason, unsigned int __nocast gfp)
|
||||
unsigned short reason, gfp_t gfp)
|
||||
{
|
||||
struct dn_scp *scp = DN_SK(sk);
|
||||
int ddl = 0;
|
||||
@@ -616,7 +615,7 @@ void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg,
|
||||
{
|
||||
struct dn_skb_cb *cb = DN_SKB_CB(skb);
|
||||
int ddl = 0;
|
||||
unsigned int __nocast gfp = GFP_ATOMIC;
|
||||
gfp_t gfp = GFP_ATOMIC;
|
||||
|
||||
dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl,
|
||||
NULL, cb->src_port, cb->dst_port);
|
||||
@@ -628,7 +627,7 @@ void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval)
|
||||
struct dn_scp *scp = DN_SK(sk);
|
||||
struct sk_buff *skb;
|
||||
unsigned char *ptr;
|
||||
unsigned int __nocast gfp = GFP_ATOMIC;
|
||||
gfp_t gfp = GFP_ATOMIC;
|
||||
|
||||
if ((skb = dn_alloc_skb(sk, DN_MAX_NSP_DATA_HEADER + 2, gfp)) == NULL)
|
||||
return;
|
||||
@@ -663,8 +662,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg)
|
||||
unsigned char menuver;
|
||||
struct dn_skb_cb *cb;
|
||||
unsigned char type = 1;
|
||||
unsigned int __nocast allocation =
|
||||
(msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
|
||||
gfp_t allocation = (msgflg == NSP_CI) ? sk->sk_allocation : GFP_ATOMIC;
|
||||
struct sk_buff *skb = dn_alloc_skb(sk, 200, allocation);
|
||||
|
||||
if (!skb)
|
||||
|
||||
@@ -207,7 +207,7 @@ void ieee80211_txb_free(struct ieee80211_txb *txb)
|
||||
}
|
||||
|
||||
static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
|
||||
unsigned int __nocast gfp_mask)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
struct ieee80211_txb *txb;
|
||||
int i;
|
||||
|
||||
@@ -494,7 +494,7 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
|
||||
EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_prune);
|
||||
|
||||
struct sock *inet_csk_clone(struct sock *sk, const struct request_sock *req,
|
||||
const unsigned int __nocast priority)
|
||||
const gfp_t priority)
|
||||
{
|
||||
struct sock *newsk = sk_clone(sk, priority);
|
||||
|
||||
|
||||
@@ -604,7 +604,7 @@ static struct file_operations ip_vs_app_fops = {
|
||||
/*
|
||||
* Replace a segment of data with a new segment
|
||||
*/
|
||||
int ip_vs_skb_replace(struct sk_buff *skb, unsigned int __nocast pri,
|
||||
int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
|
||||
char *o_buf, int o_len, char *n_buf, int n_len)
|
||||
{
|
||||
struct iphdr *iph;
|
||||
|
||||
@@ -1610,7 +1610,7 @@ void tcp_send_fin(struct sock *sk)
|
||||
* was unread data in the receive queue. This behavior is recommended
|
||||
* by draft-ietf-tcpimpl-prob-03.txt section 3.10. -DaveM
|
||||
*/
|
||||
void tcp_send_active_reset(struct sock *sk, unsigned int __nocast priority)
|
||||
void tcp_send_active_reset(struct sock *sk, gfp_t priority)
|
||||
{
|
||||
struct tcp_sock *tp = tcp_sk(sk);
|
||||
struct sk_buff *skb;
|
||||
|
||||
+3
-3
@@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock)
|
||||
}
|
||||
|
||||
static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
|
||||
unsigned int __nocast allocation, struct sock *sk)
|
||||
gfp_t allocation, struct sock *sk)
|
||||
{
|
||||
int err = -ENOBUFS;
|
||||
|
||||
@@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
|
||||
#define BROADCAST_ONE 1
|
||||
#define BROADCAST_REGISTERED 2
|
||||
#define BROADCAST_PROMISC_ONLY 4
|
||||
static int pfkey_broadcast(struct sk_buff *skb, unsigned int __nocast allocation,
|
||||
static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
|
||||
int broadcast_flags, struct sock *one_sk)
|
||||
{
|
||||
struct sock *sk;
|
||||
@@ -1417,7 +1417,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
|
||||
}
|
||||
|
||||
static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig,
|
||||
unsigned int __nocast allocation)
|
||||
gfp_t allocation)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct sadb_msg *hdr;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user