Commit dbe0e5f9 authored by Thomas Leibovici's avatar Thomas Leibovici
Browse files

Replace ENOATTR with its actual value ENODATA



ENOATTR is no longer defined in "errno.h" and requires specific include.
Drop it and replace it with its actual value ENODATA.

Change-Id: I8e63af6abae5de31a756d9f56bf16f1e31216f04
Signed-off-by: default avatarThomas Leibovici <thomas.leibovici@cea.fr>
Reviewed-on: https://cws-fleury.labs.ocre.cea.fr/gerrit/6720


Reviewed-by: Linter
Reviewed-by: default avatarPatrice LUCAS <patrice.lucas@cea.fr>
Reviewed-by: default avatarSebastien Gougeaud <sebastien.gougeaud@cea.fr>
Tested-by: default avatarJenkins s8open_nr <s8open_nr@ccc.ocre.cea.fr>
parent 3c4430ab
......@@ -163,7 +163,7 @@ static int build_env_name(const char *section, const char *name, char **env)
/**
* Get process-wide configuration parameter from environment.
* @retval 0 on success
* @retval -ENOATTR if the parameter in not defined.
* @retval -ENODATA if the parameter in not defined.
* @retval other negative error code on failure.
*/
static int pho_cfg_get_env(const char *section, const char *name,
......@@ -181,7 +181,7 @@ static int pho_cfg_get_env(const char *section, const char *name,
free(env);
if (val == NULL)
return -ENOATTR;
return -ENODATA;
*value = val;
return 0;
......@@ -190,7 +190,7 @@ static int pho_cfg_get_env(const char *section, const char *name,
/**
* Get host-wide configuration parameter from config file.
* @retval 0 on success
* @retval -ENOATTR if the parameter in not defined.
* @retval -ENODATA if the parameter in not defined.
* @retval other negative error code on failure.
*/
static int pho_cfg_get_local(const char *section, const char *name,
......@@ -207,13 +207,13 @@ static int pho_cfg_get_local(const char *section, const char *name,
pho_debug("config file: %s::%s=%s", section, name,
*value ? *value : "<NULL>");
/* ini_config sets rc=EINVAL if the parameter is not found. */
return ((*value == NULL) ? -ENOATTR : 0);
return ((*value == NULL) ? -ENODATA : 0);
}
/**
* Get global configuration parameter from DSS.
* @retval 0 on success
* @retval -ENOATTR if the parameter in not defined.
* @retval -ENODATA if the parameter in not defined.
* @retval other negative error code on failure.
*/
static int pho_cfg_get_global(const char *section, const char *name,
......@@ -229,13 +229,13 @@ int pho_cfg_get_val(const char *section, const char *name, const char **value)
/* 1) check process-wide parameter (from environment)*/
rc = pho_cfg_get_env(section, name, value);
if (rc != -ENOATTR)
if (rc != -ENODATA)
return rc;
/* 2) check host-wide parameter (if config file has been loaded) */
if (cfg_items) {
rc = pho_cfg_get_local(section, name, value);
if (rc != -ENOATTR)
if (rc != -ENODATA)
return rc;
}
......@@ -243,7 +243,7 @@ int pho_cfg_get_val(const char *section, const char *name, const char **value)
if (thr_dss_hdl)
return pho_cfg_get_global(section, name, value);
return -ENOATTR;
return -ENODATA;
}
const char *_pho_cfg_get(int first_index, int last_index, int param_index,
......@@ -263,7 +263,7 @@ const char *_pho_cfg_get(int first_index, int last_index, int param_index,
return NULL;
rc = pho_cfg_get_val(item->section, item->name, &res);
if (rc == -ENOATTR)
if (rc == -ENODATA)
res = item->value;
return res;
......
......@@ -81,7 +81,7 @@ int pho_cfg_set_thread_conn(void *dss_handle);
* altered).
*
* @retval 0 The parameter is returned successfully.
* @retval -ENOATTR The parameter is not found.
* @retval -ENODATA The parameter is not found.
*/
int pho_cfg_get_val(const char *section, const char *name,
const char **value);
......
......@@ -297,7 +297,7 @@ static int pho_setxattr(const char *path, int fd, const char *name,
rc = removexattr(path, tmp_name);
if (rc != 0) {
if (errno == ENOATTR)
if (errno == ENODATA)
rc = 0;
else
LOG_GOTO(free_tmp, rc = -errno, "removexattr failed");
......@@ -341,7 +341,7 @@ static int pho_getxattr(const char *path, const char *name, char **value)
rc = getxattr(path, tmp_name, buff, ATTR_MAX_VALUELEN);
if (rc <= 0) {
if (errno == ENOATTR || rc == 0)
if (errno == ENODATA || rc == 0)
GOTO(free_buff, rc = 0);
LOG_GOTO(free_buff, rc = -errno, "getxattr failed");
......
......@@ -100,11 +100,11 @@ static int test(void *hint)
rc = pho_cfg_get_val(item->section, item->variable, &val);
/* if value is NULL: -ENOATTR is expected */
/* if value is NULL: -ENODATA is expected */
if (item->value == NULL) {
if (rc != -ENOATTR) {
if (rc != -ENODATA) {
int rc2 = rc ? rc : -EINVAL;
pho_error(rc2, "pho_cfg_get_val(%s, %s, ...): -ENOATTR expected"
pho_error(rc2, "pho_cfg_get_val(%s, %s, ...): -ENODATA expected"
" (got %d)", item->section, item->variable, rc);
return rc2;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment