Commit 60cad5da authored by Al Viro's avatar Al Viro Committed by David S. Miller
Browse files

[IPV4]: annotate inetdev.h helpers



inet_confirm_addr(), inet_ifa_byprefix(), ip_dev_find(), inet_make_mask() and
inet_ifa_match() annotated, along with inferred net-endian variables
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a7a628c4
...@@ -86,7 +86,7 @@ EXPORT_SYMBOL(rdma_copy_addr); ...@@ -86,7 +86,7 @@ EXPORT_SYMBOL(rdma_copy_addr);
int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
{ {
struct net_device *dev; struct net_device *dev;
u32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr; __be32 ip = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
int ret; int ret;
dev = ip_dev_find(ip); dev = ip_dev_find(ip);
...@@ -239,7 +239,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in, ...@@ -239,7 +239,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in,
{ {
struct net_device *dev; struct net_device *dev;
u32 src_ip = src_in->sin_addr.s_addr; u32 src_ip = src_in->sin_addr.s_addr;
u32 dst_ip = dst_in->sin_addr.s_addr; __be32 dst_ip = dst_in->sin_addr.s_addr;
int ret; int ret;
dev = ip_dev_find(dst_ip); dev = ip_dev_find(dst_ip);
......
...@@ -104,18 +104,18 @@ struct in_ifaddr ...@@ -104,18 +104,18 @@ struct in_ifaddr
extern int register_inetaddr_notifier(struct notifier_block *nb); extern int register_inetaddr_notifier(struct notifier_block *nb);
extern int unregister_inetaddr_notifier(struct notifier_block *nb); extern int unregister_inetaddr_notifier(struct notifier_block *nb);
extern struct net_device *ip_dev_find(u32 addr); extern struct net_device *ip_dev_find(__be32 addr);
extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
extern int devinet_ioctl(unsigned int cmd, void __user *); extern int devinet_ioctl(unsigned int cmd, void __user *);
extern void devinet_init(void); extern void devinet_init(void);
extern struct in_device *inetdev_init(struct net_device *dev); extern struct in_device *inetdev_init(struct net_device *dev);
extern struct in_device *inetdev_by_index(int); extern struct in_device *inetdev_by_index(int);
extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
extern u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope); extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask); extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
extern void inet_forward_change(void); extern void inet_forward_change(void);
static __inline__ int inet_ifa_match(u32 addr, struct in_ifaddr *ifa) static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
{ {
return !((addr^ifa->ifa_address)&ifa->ifa_mask); return !((addr^ifa->ifa_address)&ifa->ifa_mask);
} }
...@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev) ...@@ -183,7 +183,7 @@ static inline void in_dev_put(struct in_device *idev)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
static __inline__ __u32 inet_make_mask(int logmask) static __inline__ __be32 inet_make_mask(int logmask)
{ {
if (logmask) if (logmask)
return htonl(~((1<<(32-logmask))-1)); return htonl(~((1<<(32-logmask))-1));
......
...@@ -429,8 +429,8 @@ struct in_device *inetdev_by_index(int ifindex) ...@@ -429,8 +429,8 @@ struct in_device *inetdev_by_index(int ifindex)
/* Called only from RTNL semaphored context. No locks. */ /* Called only from RTNL semaphored context. No locks. */
struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
u32 mask) __be32 mask)
{ {
ASSERT_RTNL(); ASSERT_RTNL();
...@@ -927,8 +927,8 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope) ...@@ -927,8 +927,8 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)
return addr; return addr;
} }
static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, static __be32 confirm_addr_indev(struct in_device *in_dev, __be32 dst,
u32 local, int scope) __be32 local, int scope)
{ {
int same = 0; int same = 0;
__be32 addr = 0; __be32 addr = 0;
...@@ -971,9 +971,9 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst, ...@@ -971,9 +971,9 @@ static u32 confirm_addr_indev(struct in_device *in_dev, u32 dst,
* - local: address, 0=autoselect the local address * - local: address, 0=autoselect the local address
* - scope: maximum allowed scope value for the local address * - scope: maximum allowed scope value for the local address
*/ */
u32 inet_confirm_addr(const struct net_device *dev, u32 dst, u32 local, int scope) __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope)
{ {
u32 addr = 0; __be32 addr = 0;
struct in_device *in_dev; struct in_device *in_dev;
if (dev) { if (dev) {
......
...@@ -122,7 +122,7 @@ static void fib_flush(void) ...@@ -122,7 +122,7 @@ static void fib_flush(void)
* Find the first device with a given source address. * Find the first device with a given source address.
*/ */
struct net_device * ip_dev_find(u32 addr) struct net_device * ip_dev_find(__be32 addr)
{ {
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res; struct fib_result res;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment