diff options
author | Patrick McHardy <kaber@trash.net> | 2008-10-28 14:59:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-28 14:59:11 -0400 |
commit | b057efd4d226fcc3a92b0dc6d8ea8e8185ecb260 (patch) | |
tree | ac372761de7105de30245976d5268218ab4fb357 | |
parent | 3891845e1ef6e6807075d4241966b26f6ecb0a5c (diff) |
netlink: constify struct nlattr * arg to parsing functions
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netlink.h | 22 | ||||
-rw-r--r-- | net/netlink/attr.c | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index 3643bbb8e585..46b7764f1774 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -233,7 +233,7 @@ extern int nla_parse(struct nlattr *tb[], int maxtype, | |||
233 | extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); | 233 | extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); |
234 | extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, | 234 | extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, |
235 | size_t dstsize); | 235 | size_t dstsize); |
236 | extern int nla_memcpy(void *dest, struct nlattr *src, int count); | 236 | extern int nla_memcpy(void *dest, const struct nlattr *src, int count); |
237 | extern int nla_memcmp(const struct nlattr *nla, const void *data, | 237 | extern int nla_memcmp(const struct nlattr *nla, const void *data, |
238 | size_t size); | 238 | size_t size); |
239 | extern int nla_strcmp(const struct nlattr *nla, const char *str); | 239 | extern int nla_strcmp(const struct nlattr *nla, const char *str); |
@@ -741,7 +741,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype) | |||
741 | * See nla_parse() | 741 | * See nla_parse() |
742 | */ | 742 | */ |
743 | static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, | 743 | static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, |
744 | struct nlattr *nla, | 744 | const struct nlattr *nla, |
745 | const struct nla_policy *policy) | 745 | const struct nla_policy *policy) |
746 | { | 746 | { |
747 | return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); | 747 | return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); |
@@ -875,7 +875,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
875 | * nla_get_u32 - return payload of u32 attribute | 875 | * nla_get_u32 - return payload of u32 attribute |
876 | * @nla: u32 netlink attribute | 876 | * @nla: u32 netlink attribute |
877 | */ | 877 | */ |
878 | static inline u32 nla_get_u32(struct nlattr *nla) | 878 | static inline u32 nla_get_u32(const struct nlattr *nla) |
879 | { | 879 | { |
880 | return *(u32 *) nla_data(nla); | 880 | return *(u32 *) nla_data(nla); |
881 | } | 881 | } |
@@ -884,7 +884,7 @@ static inline u32 nla_get_u32(struct nlattr *nla) | |||
884 | * nla_get_be32 - return payload of __be32 attribute | 884 | * nla_get_be32 - return payload of __be32 attribute |
885 | * @nla: __be32 netlink attribute | 885 | * @nla: __be32 netlink attribute |
886 | */ | 886 | */ |
887 | static inline __be32 nla_get_be32(struct nlattr *nla) | 887 | static inline __be32 nla_get_be32(const struct nlattr *nla) |
888 | { | 888 | { |
889 | return *(__be32 *) nla_data(nla); | 889 | return *(__be32 *) nla_data(nla); |
890 | } | 890 | } |
@@ -893,7 +893,7 @@ static inline __be32 nla_get_be32(struct nlattr *nla) | |||
893 | * nla_get_u16 - return payload of u16 attribute | 893 | * nla_get_u16 - return payload of u16 attribute |
894 | * @nla: u16 netlink attribute | 894 | * @nla: u16 netlink attribute |
895 | */ | 895 | */ |
896 | static inline u16 nla_get_u16(struct nlattr *nla) | 896 | static inline u16 nla_get_u16(const struct nlattr *nla) |
897 | { | 897 | { |
898 | return *(u16 *) nla_data(nla); | 898 | return *(u16 *) nla_data(nla); |
899 | } | 899 | } |
@@ -902,7 +902,7 @@ static inline u16 nla_get_u16(struct nlattr *nla) | |||
902 | * nla_get_be16 - return payload of __be16 attribute | 902 | * nla_get_be16 - return payload of __be16 attribute |
903 | * @nla: __be16 netlink attribute | 903 | * @nla: __be16 netlink attribute |
904 | */ | 904 | */ |
905 | static inline __be16 nla_get_be16(struct nlattr *nla) | 905 | static inline __be16 nla_get_be16(const struct nlattr *nla) |
906 | { | 906 | { |
907 | return *(__be16 *) nla_data(nla); | 907 | return *(__be16 *) nla_data(nla); |
908 | } | 908 | } |
@@ -911,7 +911,7 @@ static inline __be16 nla_get_be16(struct nlattr *nla) | |||
911 | * nla_get_le16 - return payload of __le16 attribute | 911 | * nla_get_le16 - return payload of __le16 attribute |
912 | * @nla: __le16 netlink attribute | 912 | * @nla: __le16 netlink attribute |
913 | */ | 913 | */ |
914 | static inline __le16 nla_get_le16(struct nlattr *nla) | 914 | static inline __le16 nla_get_le16(const struct nlattr *nla) |
915 | { | 915 | { |
916 | return *(__le16 *) nla_data(nla); | 916 | return *(__le16 *) nla_data(nla); |
917 | } | 917 | } |
@@ -920,7 +920,7 @@ static inline __le16 nla_get_le16(struct nlattr *nla) | |||
920 | * nla_get_u8 - return payload of u8 attribute | 920 | * nla_get_u8 - return payload of u8 attribute |
921 | * @nla: u8 netlink attribute | 921 | * @nla: u8 netlink attribute |
922 | */ | 922 | */ |
923 | static inline u8 nla_get_u8(struct nlattr *nla) | 923 | static inline u8 nla_get_u8(const struct nlattr *nla) |
924 | { | 924 | { |
925 | return *(u8 *) nla_data(nla); | 925 | return *(u8 *) nla_data(nla); |
926 | } | 926 | } |
@@ -929,7 +929,7 @@ static inline u8 nla_get_u8(struct nlattr *nla) | |||
929 | * nla_get_u64 - return payload of u64 attribute | 929 | * nla_get_u64 - return payload of u64 attribute |
930 | * @nla: u64 netlink attribute | 930 | * @nla: u64 netlink attribute |
931 | */ | 931 | */ |
932 | static inline u64 nla_get_u64(struct nlattr *nla) | 932 | static inline u64 nla_get_u64(const struct nlattr *nla) |
933 | { | 933 | { |
934 | u64 tmp; | 934 | u64 tmp; |
935 | 935 | ||
@@ -942,7 +942,7 @@ static inline u64 nla_get_u64(struct nlattr *nla) | |||
942 | * nla_get_flag - return payload of flag attribute | 942 | * nla_get_flag - return payload of flag attribute |
943 | * @nla: flag netlink attribute | 943 | * @nla: flag netlink attribute |
944 | */ | 944 | */ |
945 | static inline int nla_get_flag(struct nlattr *nla) | 945 | static inline int nla_get_flag(const struct nlattr *nla) |
946 | { | 946 | { |
947 | return !!nla; | 947 | return !!nla; |
948 | } | 948 | } |
@@ -953,7 +953,7 @@ static inline int nla_get_flag(struct nlattr *nla) | |||
953 | * | 953 | * |
954 | * Returns the number of milliseconds in jiffies. | 954 | * Returns the number of milliseconds in jiffies. |
955 | */ | 955 | */ |
956 | static inline unsigned long nla_get_msecs(struct nlattr *nla) | 956 | static inline unsigned long nla_get_msecs(const struct nlattr *nla) |
957 | { | 957 | { |
958 | u64 msecs = nla_get_u64(nla); | 958 | u64 msecs = nla_get_u64(nla); |
959 | 959 | ||
diff --git a/net/netlink/attr.c b/net/netlink/attr.c index 2d106cfe1d27..c83fea7da9a8 100644 --- a/net/netlink/attr.c +++ b/net/netlink/attr.c | |||
@@ -233,7 +233,7 @@ size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize) | |||
233 | * | 233 | * |
234 | * Returns the number of bytes copied. | 234 | * Returns the number of bytes copied. |
235 | */ | 235 | */ |
236 | int nla_memcpy(void *dest, struct nlattr *src, int count) | 236 | int nla_memcpy(void *dest, const struct nlattr *src, int count) |
237 | { | 237 | { |
238 | int minlen = min_t(int, count, nla_len(src)); | 238 | int minlen = min_t(int, count, nla_len(src)); |
239 | 239 | ||