From: Arshad Hussain Date: Thu, 11 Jan 2024 09:35:02 +0000 (+0530) Subject: LU-17414 lnet: Use POSIX error number for libnetconfig X-Git-Tag: 2.15.61~64 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F53657%2F3;p=fs%2Flustre-release.git LU-17414 lnet: Use POSIX error number for libnetconfig Currently liblnetconfig.c is returning custom define LUSTRE_CFG_RC_* numbers which can be confusing to users. This patch redefines LUSTRE_CFG_RC_* to use POSIX error number to be consistent. Test-Parameters: trivial testlist=sanity-lnet Signed-off-by: Arshad Hussain Change-Id: I585d1dfd80d07160e5cdeef784920414132bcaf8 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53657 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Chris Horn Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/utils/lnetconfig/liblnetconfig.h b/lnet/utils/lnetconfig/liblnetconfig.h index 48adc14..a3708da 100644 --- a/lnet/utils/lnetconfig/liblnetconfig.h +++ b/lnet/utils/lnetconfig/liblnetconfig.h @@ -41,17 +41,17 @@ #include #include -#define LUSTRE_CFG_RC_NO_ERR 0 -#define LUSTRE_CFG_RC_BAD_PARAM -1 -#define LUSTRE_CFG_RC_MISSING_PARAM -2 -#define LUSTRE_CFG_RC_OUT_OF_RANGE_PARAM -3 -#define LUSTRE_CFG_RC_OUT_OF_MEM -4 -#define LUSTRE_CFG_RC_GENERIC_ERR -5 -#define LUSTRE_CFG_RC_NO_MATCH -6 -#define LUSTRE_CFG_RC_MATCH -7 -#define LUSTRE_CFG_RC_SKIP -8 -#define LUSTRE_CFG_RC_LAST_ELEM -9 -#define LUSTRE_CFG_RC_MARSHAL_FAIL -10 +#define LUSTRE_CFG_RC_NO_ERR 0 /* success */ +#define LUSTRE_CFG_RC_BAD_PARAM -EINVAL /* 22 */ +#define LUSTRE_CFG_RC_MISSING_PARAM -EFAULT /* 14 */ +#define LUSTRE_CFG_RC_OUT_OF_RANGE_PARAM -ERANGE /* 34 */ +#define LUSTRE_CFG_RC_OUT_OF_MEM -ENOMEM /* 12 */ +#define LUSTRE_CFG_RC_GENERIC_ERR -ENODATA /* 61 */ +#define LUSTRE_CFG_RC_NO_MATCH -ENOMSG /* 42 */ +#define LUSTRE_CFG_RC_MATCH -EXFULL /* 54 */ +#define LUSTRE_CFG_RC_SKIP -EBADSLT /* 57 */ +#define LUSTRE_CFG_RC_LAST_ELEM -ECHRNG /* 48 */ +#define LUSTRE_CFG_RC_MARSHAL_FAIL -ENOSTR /* 60 */ #define CONFIG_CMD "configure" #define UNCONFIG_CMD "unconfigure" diff --git a/lnet/utils/lnetctl.c b/lnet/utils/lnetctl.c index 7692efe..c37fcdf 100644 --- a/lnet/utils/lnetctl.c +++ b/lnet/utils/lnetctl.c @@ -364,7 +364,7 @@ static int check_cmd(const command_t *cmd_list, const char *cmd, if (argc < min_args) { print_help(cmd_list, cmd, sub_cmd); - rc = -1; + rc = LUSTRE_CFG_RC_BAD_PARAM; goto out; } else if (argc > 2) { return 0;