opc = up ? IOC_LIBCFS_CONFIGURE : IOC_LIBCFS_UNCONFIGURE;
rc = l_ioctl(LNET_DEV_ID, opc, &data);
-
if (rc != 0) {
snprintf(err_str,
sizeof(err_str),
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_ADD_ROUTE, &data);
if (rc != 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot add route: %s\"", strerror(errno));
- rc = -errno;
goto out;
}
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_DEL_ROUTE, &data);
if (rc != 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot delete route: %s\"", strerror(errno));
- rc = -errno;
goto out;
}
struct lnet_ioctl_config_data data;
lnet_nid_t gateway_nid;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ int l_errno = 0;
__u32 net = LNET_NIDNET(LNET_NID_ANY);
int i;
struct cYAML *root = NULL, *route = NULL, *item = NULL;
data.cfg_count = i;
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_GET_ROUTE, &data);
- if (rc != 0)
+ if (rc != 0) {
+ l_errno = errno;
break;
+ }
/* filter on provided data */
if (net != LNET_NIDNET(LNET_NID_ANY) &&
if (show_rc == NULL)
cYAML_print_tree(root);
- if (errno != ENOENT) {
+ if (l_errno != ENOENT) {
snprintf(err_str,
sizeof(err_str),
"\"cannot get routes: %s\"",
- strerror(errno));
- rc = -errno;
+ strerror(l_errno));
+ rc = -l_errno;
goto out;
} else
rc = LUSTRE_CFG_RC_NO_ERR;
{
struct lnet_ioctl_config_data data;
char buf[LNET_MAX_STR_LEN];
- int rc = LUSTRE_CFG_RC_NO_ERR, num_of_nets = 0;
+ int rc = LUSTRE_CFG_RC_NO_ERR;
char err_str[LNET_MAX_STR_LEN];
snprintf(err_str, sizeof(err_str), "\"success\"");
data.cfg_config_u.cfg_net.net_peer_rtr_credits = peer_buf_cr;
data.cfg_config_u.cfg_net.net_max_tx_credits = credits;
- num_of_nets = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_ADD_NET, &data);
- if (num_of_nets < 0) {
+ rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_ADD_NET, &data);
+ if (rc < 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot add network: %s\"", strerror(errno));
- rc = -errno;
}
out:
- cYAML_build_error((num_of_nets > 0) ? num_of_nets : rc,
- seq_no, ADD_CMD, "net", err_str, err_rc);
+ cYAML_build_error(rc, seq_no, ADD_CMD, "net", err_str, err_rc);
return rc;
}
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_DEL_NET, &data);
if (rc != 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot delete network: %s\"", strerror(errno));
- rc = -errno;
goto out;
}
struct lnet_ioctl_net_config *net_config;
__u32 net = LNET_NIDNET(LNET_NID_ANY);
int rc = LUSTRE_CFG_RC_OUT_OF_MEM, i, j;
+ int l_errno = 0;
struct cYAML *root = NULL, *tunables = NULL,
*net_node = NULL, *interfaces = NULL,
*item = NULL, *first_seq = NULL;
data->cfg_count = i;
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_GET_NET, data);
- if (rc != 0)
+ if (rc != 0) {
+ l_errno = errno;
break;
+ }
/* filter on provided data */
if (net != LNET_NIDNET(LNET_NID_ANY) &&
if (show_rc == NULL)
cYAML_print_tree(root);
- if (errno != ENOENT) {
+ if (l_errno != ENOENT) {
snprintf(err_str,
sizeof(err_str),
"\"cannot get networks: %s\"",
- strerror(errno));
- rc = -errno;
+ strerror(l_errno));
+ rc = -l_errno;
goto out;
} else
rc = LUSTRE_CFG_RC_NO_ERR;
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_CONFIG_RTR, &data);
if (rc != 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot %s routing %s\"",
(enable) ? "enable" : "disable", strerror(errno));
- rc = -errno;
goto out;
}
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_ADD_BUF, &data);
if (rc != 0) {
+ rc = -errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot configure buffers: %s\"", strerror(errno));
- rc = -errno;
goto out;
}
struct lnet_ioctl_config_data *data;
struct lnet_ioctl_pool_cfg *pool_cfg = NULL;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ int l_errno = 0;
char *buf;
char *pools[LNET_NRBPOOLS] = {"tiny", "small", "large"};
struct cYAML *root = NULL, *pools_node = NULL,
data->cfg_count = i;
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_GET_BUF, data);
- if (rc != 0)
+ if (rc != 0) {
+ l_errno = errno;
break;
+ }
exist = true;
if (show_rc == NULL)
cYAML_print_tree(root);
- if (errno != ENOENT) {
+ if (l_errno != ENOENT) {
snprintf(err_str,
sizeof(err_str),
"\"cannot get routing information: %s\"",
- strerror(errno));
- rc = -errno;
+ strerror(l_errno));
+ rc = -l_errno;
goto out;
} else
rc = LUSTRE_CFG_RC_NO_ERR;
{
struct lnet_ioctl_peer peer_info;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM, ncpt = 0, i = 0, j = 0;
+ int l_errno = 0;
struct cYAML *root = NULL, *peer = NULL, *first_seq = NULL,
*peer_root = NULL;
char err_str[LNET_MAX_STR_LEN];
peer_info.pr_lnd_u.pr_peer_credits.cr_ncpt = j;
rc = l_ioctl(LNET_DEV_ID,
IOC_LIBCFS_GET_PEER_INFO, &peer_info);
- if (rc != 0)
+ if (rc != 0) {
+ l_errno = errno;
break;
+ }
if (ncpt_set != 0) {
ncpt = peer_info.pr_lnd_u.pr_peer_credits.
goto out;
}
- if (errno != ENOENT) {
+ if (l_errno != ENOENT) {
snprintf(err_str,
sizeof(err_str),
"\"cannot get peer information: %s\"",
- strerror(errno));
- rc = -errno;
+ strerror(l_errno));
+ rc = -l_errno;
goto out;
}
{
struct lnet_ioctl_lnet_stats data;
int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ int l_errno;
char err_str[LNET_MAX_STR_LEN];
struct cYAML *root = NULL, *stats = NULL;
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_GET_LNET_STATS, &data);
if (rc != 0) {
+ l_errno = errno;
snprintf(err_str,
sizeof(err_str),
"\"cannot get lnet statistics: %s\"",
- strerror(errno));
- rc = -errno;
+ strerror(l_errno));
+ rc = -l_errno;
goto out;
}