From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH libnftnl] src: remove scaffolding around deprecated parser functions
Date: Wed, 25 Sep 2024 12:44:43 +0200 [thread overview]
Message-ID: <20240925104443.37555-1-pablo@netfilter.org> (raw)
nftnl_.*_do_parse() are of no use anymore, remove them.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/object.c | 30 ++++++------------------------
src/rule.c | 29 ++++++-----------------------
src/set.c | 30 ++++++------------------------
src/table.c | 26 ++++++--------------------
4 files changed, 24 insertions(+), 91 deletions(-)
diff --git a/src/object.c b/src/object.c
index 19cb7d0dbf73..9d150315d487 100644
--- a/src/object.c
+++ b/src/object.c
@@ -386,40 +386,22 @@ int nftnl_obj_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_obj *obj)
return 0;
}
-static int nftnl_obj_do_parse(struct nftnl_obj *obj, enum nftnl_parse_type type,
- const void *data, struct nftnl_parse_err *err,
- enum nftnl_parse_input input)
-{
- struct nftnl_parse_err perr = {};
- int ret;
-
- switch (type) {
- case NFTNL_PARSE_JSON:
- case NFTNL_PARSE_XML:
- default:
- ret = -1;
- errno = EOPNOTSUPP;
- break;
- }
-
- if (err != NULL)
- *err = perr;
-
- return ret;
-}
-
EXPORT_SYMBOL(nftnl_obj_parse);
int nftnl_obj_parse(struct nftnl_obj *obj, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err)
{
- return nftnl_obj_do_parse(obj, type, data, err, NFTNL_PARSE_BUFFER);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
EXPORT_SYMBOL(nftnl_obj_parse_file);
int nftnl_obj_parse_file(struct nftnl_obj *obj, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err)
{
- return nftnl_obj_do_parse(obj, type, fp, err, NFTNL_PARSE_FILE);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
static int nftnl_obj_snprintf_dflt(char *buf, size_t remain,
diff --git a/src/rule.c b/src/rule.c
index e16e2c1aa5bf..811d5a213f83 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -500,39 +500,22 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
return 0;
}
-static int nftnl_rule_do_parse(struct nftnl_rule *r, enum nftnl_parse_type type,
- const void *data, struct nftnl_parse_err *err,
- enum nftnl_parse_input input)
-{
- int ret;
- struct nftnl_parse_err perr = {};
-
- switch (type) {
- case NFTNL_PARSE_JSON:
- case NFTNL_PARSE_XML:
- default:
- ret = -1;
- errno = EOPNOTSUPP;
- break;
- }
- if (err != NULL)
- *err = perr;
-
- return ret;
-}
-
EXPORT_SYMBOL(nftnl_rule_parse);
int nftnl_rule_parse(struct nftnl_rule *r, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err)
{
- return nftnl_rule_do_parse(r, type, data, err, NFTNL_PARSE_BUFFER);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
EXPORT_SYMBOL(nftnl_rule_parse_file);
int nftnl_rule_parse_file(struct nftnl_rule *r, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err)
{
- return nftnl_rule_do_parse(r, type, fp, err, NFTNL_PARSE_FILE);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
static int nftnl_rule_snprintf_default(char *buf, size_t remain,
diff --git a/src/set.c b/src/set.c
index 07e332dcd673..75ad64e03850 100644
--- a/src/set.c
+++ b/src/set.c
@@ -753,40 +753,22 @@ out_set_expr:
return -1;
}
-static int nftnl_set_do_parse(struct nftnl_set *s, enum nftnl_parse_type type,
- const void *data, struct nftnl_parse_err *err,
- enum nftnl_parse_input input)
-{
- int ret;
- struct nftnl_parse_err perr = {};
-
- switch (type) {
- case NFTNL_PARSE_JSON:
- case NFTNL_PARSE_XML:
- default:
- ret = -1;
- errno = EOPNOTSUPP;
- break;
- }
-
- if (err != NULL)
- *err = perr;
-
- return ret;
-}
-
EXPORT_SYMBOL(nftnl_set_parse);
int nftnl_set_parse(struct nftnl_set *s, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err)
{
- return nftnl_set_do_parse(s, type, data, err, NFTNL_PARSE_BUFFER);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
EXPORT_SYMBOL(nftnl_set_parse_file);
int nftnl_set_parse_file(struct nftnl_set *s, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err)
{
- return nftnl_set_do_parse(s, type, fp, err, NFTNL_PARSE_FILE);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
static int nftnl_set_snprintf_default(char *buf, size_t remain,
diff --git a/src/table.c b/src/table.c
index 1a5f6f3bcc50..b1b164cbbced 100644
--- a/src/table.c
+++ b/src/table.c
@@ -327,36 +327,22 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t)
return 0;
}
-static int nftnl_table_do_parse(struct nftnl_table *t, enum nftnl_parse_type type,
- const void *data, struct nftnl_parse_err *err,
- enum nftnl_parse_input input)
-{
- int ret;
-
- switch (type) {
- case NFTNL_PARSE_JSON:
- case NFTNL_PARSE_XML:
- default:
- ret = -1;
- errno = EOPNOTSUPP;
- break;
- }
-
- return ret;
-}
-
EXPORT_SYMBOL(nftnl_table_parse);
int nftnl_table_parse(struct nftnl_table *t, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err)
{
- return nftnl_table_do_parse(t, type, data, err, NFTNL_PARSE_BUFFER);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
EXPORT_SYMBOL(nftnl_table_parse_file);
int nftnl_table_parse_file(struct nftnl_table *t, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err)
{
- return nftnl_table_do_parse(t, type, fp, err, NFTNL_PARSE_FILE);
+ errno = EOPNOTSUPP;
+
+ return -1;
}
static int nftnl_table_snprintf_default(char *buf, size_t size,
--
2.30.2
reply other threads:[~2024-09-25 10:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240925104443.37555-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).