summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-10-09 11:46:44 (GMT)
committerThomas Haller <thaller@redhat.com>2017-10-09 11:51:29 (GMT)
commitb4802a17a7655bfeee3e9c06e649d30b96dbad3b (patch)
tree8a70c993fc2d929f51b2ab64119900ecbd0e8737 /include
parent3fe3454b0228a6c9729ce9ffebf62bda85fd87ab (diff)
downloadlibnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.zip
libnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.tar.gz
libnl-b4802a17a7655bfeee3e9c06e649d30b96dbad3b.tar.bz2
nl: add "const" specifier for nla_policy argument of parse functions
Adding const to a function argument is generally not an API break (at least, if the argument is a struct, like in this case). Usually we declare the policy as static variables. The user should be able to mark them as "const", so that the linker makes the policy array read-only. Adjust the API to allow for that. Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/netlink-private/tc.h2
-rw-r--r--include/netlink/attr.h4
-rw-r--r--include/netlink/genl/genl.h4
-rw-r--r--include/netlink/msg.h4
4 files changed, 7 insertions, 7 deletions
diff --git a/include/netlink-private/tc.h b/include/netlink-private/tc.h
index d0cb283..939cd18 100644
--- a/include/netlink-private/tc.h
+++ b/include/netlink-private/tc.h
@@ -35,7 +35,7 @@ extern "C" {
#define TCA_ATTR_MAX TCA_ATTR_LINKTYPE
extern int tca_parse(struct nlattr **, int, struct rtnl_tc *,
- struct nla_policy *);
+ const struct nla_policy *);
#define RTNL_TC_RTABLE_SIZE 256
diff --git a/include/netlink/attr.h b/include/netlink/attr.h
index 2157fe1..da9eee4 100644
--- a/include/netlink/attr.h
+++ b/include/netlink/attr.h
@@ -89,7 +89,7 @@ extern int nla_len(const struct nlattr *);
extern int nla_ok(const struct nlattr *, int);
extern struct nlattr * nla_next(const struct nlattr *, int *);
extern int nla_parse(struct nlattr **, int, struct nlattr *,
- int, struct nla_policy *);
+ int, const struct nla_policy *);
extern int nla_validate(const struct nlattr *, int, int,
const struct nla_policy *);
extern struct nlattr * nla_find(const struct nlattr *, int, int);
@@ -145,7 +145,7 @@ extern struct nlattr * nla_nest_start(struct nl_msg *, int);
extern int nla_nest_end(struct nl_msg *, struct nlattr *);
extern void nla_nest_cancel(struct nl_msg *, const struct nlattr *);
extern int nla_parse_nested(struct nlattr **, int, struct nlattr *,
- struct nla_policy *);
+ const struct nla_policy *);
extern int nla_is_nested(const struct nlattr *);
/**
diff --git a/include/netlink/genl/genl.h b/include/netlink/genl/genl.h
index e455581..c4ac137 100644
--- a/include/netlink/genl/genl.h
+++ b/include/netlink/genl/genl.h
@@ -29,9 +29,9 @@ extern void * genlmsg_put(struct nl_msg *, uint32_t, uint32_t,
extern int genlmsg_valid_hdr(struct nlmsghdr *, int);
extern int genlmsg_validate(struct nlmsghdr *, int, int,
- struct nla_policy *);
+ const struct nla_policy *);
extern int genlmsg_parse(struct nlmsghdr *, int, struct nlattr **,
- int, struct nla_policy *);
+ int, const struct nla_policy *);
extern struct genlmsghdr *
genlmsg_hdr(struct nlmsghdr *);
extern void * genlmsg_data(const struct genlmsghdr *);
diff --git a/include/netlink/msg.h b/include/netlink/msg.h
index 5aee97d..51d9aeb 100644
--- a/include/netlink/msg.h
+++ b/include/netlink/msg.h
@@ -66,10 +66,10 @@ extern int nlmsg_valid_hdr(const struct nlmsghdr *, int);
extern int nlmsg_ok(const struct nlmsghdr *, int);
extern struct nlmsghdr * nlmsg_next(struct nlmsghdr *, int *);
extern int nlmsg_parse(struct nlmsghdr *, int, struct nlattr **,
- int, struct nla_policy *);
+ int, const struct nla_policy *);
extern struct nlattr * nlmsg_find_attr(struct nlmsghdr *, int, int);
extern int nlmsg_validate(struct nlmsghdr *, int, int,
- struct nla_policy *);
+ const struct nla_policy *);
extern struct nl_msg * nlmsg_alloc(void);
extern struct nl_msg * nlmsg_alloc_size(size_t);