diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-04-05 18:06:04 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-04-05 18:06:04 +0200 |
commit | 3ece3d60f41b65470ec5ce6c9a0b830e32a84422 (patch) | |
tree | c4c110ccb2b6de6232a436f49c3a042fe97b3711 | |
parent | 73661922bc3b7ebf1225d8273147ab4a87757008 (diff) | |
download | libmnl-3ece3d60f41b65470ec5ce6c9a0b830e32a84422.tar.gz libmnl-3ece3d60f41b65470ec5ce6c9a0b830e32a84422.zip |
rename mnl_attr_type_ok() by mnl_attr_type_valid() for consistency
better to rename this function since its return value is not similar
to other _ok() functions, for consistency.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | examples/genl-family-get.c | 12 | ||||
-rw-r--r-- | examples/rtnl-link-dump.c | 4 | ||||
-rw-r--r-- | examples/rtnl-link-dump2.c | 4 | ||||
-rw-r--r-- | examples/rtnl-link-dump3.c | 4 | ||||
-rw-r--r-- | examples/rtnl-link-event.c | 4 | ||||
-rw-r--r-- | examples/rtnl-route-dump.c | 8 | ||||
-rw-r--r-- | include/libmnl/libmnl.h | 2 | ||||
-rw-r--r-- | src/attr.c | 8 |
8 files changed, 23 insertions, 23 deletions
diff --git a/examples/genl-family-get.c b/examples/genl-family-get.c index c8352ab..ddbb557 100644 --- a/examples/genl-family-get.c +++ b/examples/genl-family-get.c @@ -10,8 +10,8 @@ static int parse_mc_grps_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, CTRL_ATTR_MCAST_GRP_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, CTRL_ATTR_MCAST_GRP_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } @@ -59,8 +59,8 @@ static int parse_family_ops_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, CTRL_ATTR_OP_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, CTRL_ATTR_OP_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } @@ -105,8 +105,8 @@ static int data_attr_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, CTRL_ATTR_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, CTRL_ATTR_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } diff --git a/examples/rtnl-link-dump.c b/examples/rtnl-link-dump.c index b0c8e76..c9d06b0 100644 --- a/examples/rtnl-link-dump.c +++ b/examples/rtnl-link-dump.c @@ -12,8 +12,8 @@ static int data_attr_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, IFLA_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, IFLA_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } diff --git a/examples/rtnl-link-dump2.c b/examples/rtnl-link-dump2.c index d333071..bd93f9d 100644 --- a/examples/rtnl-link-dump2.c +++ b/examples/rtnl-link-dump2.c @@ -9,8 +9,8 @@ static int data_attr_cb(const struct nlattr *attr, void *data) { - if (mnl_attr_type_ok(attr, IFLA_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, IFLA_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } diff --git a/examples/rtnl-link-dump3.c b/examples/rtnl-link-dump3.c index 87a15a5..6da62ad 100644 --- a/examples/rtnl-link-dump3.c +++ b/examples/rtnl-link-dump3.c @@ -25,8 +25,8 @@ static int data_cb(const struct nlmsghdr *nlh, void *data) mnl_attr_for_each(attr, nlh, sizeof(*ifm)) { int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, IFLA_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, IFLA_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } switch(type) { diff --git a/examples/rtnl-link-event.c b/examples/rtnl-link-event.c index bba59cd..c3600ca 100644 --- a/examples/rtnl-link-event.c +++ b/examples/rtnl-link-event.c @@ -12,8 +12,8 @@ static int data_attr_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, IFLA_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, IFLA_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } diff --git a/examples/rtnl-route-dump.c b/examples/rtnl-route-dump.c index 0d89cae..4a0f790 100644 --- a/examples/rtnl-route-dump.c +++ b/examples/rtnl-route-dump.c @@ -12,8 +12,8 @@ static int data_attr_cb2(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, RTAX_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, RTAX_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) { @@ -68,8 +68,8 @@ static int data_attr_cb(const struct nlattr *attr, void *data) const struct nlattr **tb = (const struct nlattr **)data; int type = mnl_attr_get_type(attr); - if (mnl_attr_type_ok(attr, RTA_MAX) < 0) { - perror("mnl_attr_type_ok"); + if (mnl_attr_type_valid(attr, RTA_MAX) < 0) { + perror("mnl_attr_type_valid"); return MNL_CB_ERROR; } diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h index ac488a7..5d05b19 100644 --- a/include/libmnl/libmnl.h +++ b/include/libmnl/libmnl.h @@ -86,7 +86,7 @@ extern void mnl_attr_put_str(struct nlmsghdr *nlh, int type, const void *data); extern void mnl_attr_put_str_null(struct nlmsghdr *nlh, int type, const void *data); /* TLV validation */ -extern int mnl_attr_type_ok(const struct nlattr *attr, int maxtype); +extern int mnl_attr_type_valid(const struct nlattr *attr, int maxtype); enum mnl_attr_data_type { MNL_TYPE_UNSPEC, @@ -99,21 +99,21 @@ struct nlattr *mnl_attr_next(const struct nlattr *attr, int *len) } /** - * mnl_attr_type_ok - check if the attribute type is valid + * mnl_attr_type_valid - check if the attribute type is valid * @attr: pointer to attribute to be checked * @max: maximum attribute type * * This function allows to check if the attribute type is higher than the * maximum supported type. If the attribute type is invalid, this function - * returns -1 and errno is explicitly set. + * returns -1 and errno is explicitly set. On success, this function returns 1. */ -int mnl_attr_type_ok(const struct nlattr *attr, int max) +int mnl_attr_type_valid(const struct nlattr *attr, int max) { if (mnl_attr_get_type(attr) > max) { errno = EINVAL; return -1; } - return 0; + return 1; } static int __mnl_attr_validate(const struct nlattr *attr, |