nf: nfnl_*_str2copy_mode() should return int

... to be able to return a negative error code for unknown modes.

[thaller@redhat.com: This is potentially an ABI break, but since
the size of the enum is implementation defined, it seems
anyway unstable to have them as function arguments/return values.]

http://lists.infradead.org/pipermail/libnl/2014-August/001616.html

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Graf 2014-08-26 01:09:08 +02:00 committed by Thomas Haller
parent 03f3f3c4c0
commit da80033c2f
6 changed files with 6 additions and 6 deletions

View File

@ -58,7 +58,7 @@ extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *);
extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
char *, size_t);
extern enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *);
extern int nfnl_log_str2copy_mode(const char *);
extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_copy_range(const struct nfnl_log *);

View File

@ -54,7 +54,7 @@ extern enum nfnl_queue_copy_mode nfnl_queue_get_copy_mode(const struct nfnl_queu
extern char * nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode,
char *, size_t);
extern enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *);
extern int nfnl_queue_str2copy_mode(const char *);
extern void nfnl_queue_set_copy_range(struct nfnl_queue *,
uint32_t);

View File

@ -69,7 +69,7 @@ char *nfnl_log_copy_mode2str(enum nfnl_log_copy_mode copy_mode, char *buf,
ARRAY_SIZE(copy_modes));
}
enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *name)
int nfnl_log_str2copy_mode(const char *name)
{
return __str2type(name, copy_modes, ARRAY_SIZE(copy_modes));
}

View File

@ -65,7 +65,7 @@ char *nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode copy_mode, char *buf,
ARRAY_SIZE(copy_modes));
}
enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *name)
int nfnl_queue_str2copy_mode(const char *name)
{
return __str2type(name, copy_modes, ARRAY_SIZE(copy_modes));
}

View File

@ -54,7 +54,7 @@ int main(int argc, char *argv[])
struct nl_sock *rt_sock;
struct nl_cache *link_cache;
struct nfnl_log *log;
enum nfnl_log_copy_mode copy_mode;
int copy_mode;
uint32_t copy_range;
int err;
int family;

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
struct nl_sock *rt_sock;
struct nl_cache *link_cache;
struct nfnl_queue *queue;
enum nfnl_queue_copy_mode copy_mode;
int copy_mode;
uint32_t copy_range;
int err = 1;
int family;