struct cfs_lstr src;
struct cfs_lstr res;
int rc;
- ENTRY;
src.ls_str = str;
src.ls_len = len;
rc = cfs_gettok(&src, ' ', &res);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
rc = parse_nidrange(&res, nidlist);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
}
- RETURN(1);
+ return 1;
}
/*
{
struct nidrange *nr;
struct addrrange *ar;
- ENTRY;
list_for_each_entry(nr, nidlist, nr_link) {
if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid)))
if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid)))
continue;
if (nr->nr_all)
- RETURN(1);
+ return 1;
list_for_each_entry(ar, &nr->nr_addrranges, ar_link)
if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid),
&ar->ar_numaddr_ranges))
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
static int
{
int i = 0;
struct nidrange *nr;
- ENTRY;
if (count <= 0)
- RETURN(0);
+ return 0;
list_for_each_entry(nr, nidlist, nr_link) {
if (i != 0)
&nr->nr_addrranges, nr);
}
}
- RETURN(i);
+ return i;
}
/**
tmp = realloc(param.mdtuuid,
param.num_alloc_mdts *
sizeof(*param.mdtuuid));
- if (tmp == NULL)
- GOTO(err_free, ret = -ENOMEM);
+ if (tmp == NULL) {
+ ret = -ENOMEM;
+ goto err_free;
+ }
+
param.mdtuuid = tmp;
} else {
param.exclude_obd = !!neg_opt;
tmp = realloc(param.obduuid,
param.num_alloc_obds *
sizeof(*param.obduuid));
- if (tmp == NULL)
- GOTO(err_free, ret = -ENOMEM);
+ if (tmp == NULL) {
+ ret = -ENOMEM;
+ goto err_free;
+ }
+
param.obduuid = tmp;
}
for (token = buf; token && *token; token = next) {
*p = 0;
next = p+1;
}
- if (strlen(token) > sizeof(puuid->uuid)-1)
- GOTO(err_free, ret = -E2BIG);
+
+ if (strlen(token) > sizeof(puuid->uuid) - 1) {
+ ret = -E2BIG;
+ goto err_free;
+ }
+
strncpy(puuid->uuid, token,
sizeof(puuid->uuid));
}
if (fp == NULL) {
rc = -errno;
llapi_error(LLAPI_MSG_ERROR, rc, "error: opening "DEVICES_LIST);
- GOTO(out, rc);
+ goto out;
}
if (fsname == NULL && file_path != NULL) {
llapi_error(LLAPI_MSG_ERROR, rc,
"'%s' is not on a Lustre filesystem",
file_path);
- GOTO(out, rc);
+ goto out;
}
} else if (fsname != NULL) {
rc = strlcpy(fs, fsname, sizeof(fs));
- if (rc >= sizeof(fs))
- GOTO(out, rc = -E2BIG);
+ if (rc >= sizeof(fs)) {
+ rc = -E2BIG;
+ goto out;
+ }
}
while (fgets(devices, sizeof(devices) - 1, fp) != NULL) {
if (strcmp(tmp, fs))
continue;
rc = strlcpy(dev, tmp, sizeof(dev));
- if (rc >= sizeof(dev))
- GOTO(out, rc = -E2BIG);
+ if (rc >= sizeof(dev)) {
+ rc = -E2BIG;
+ goto out;
+ }
+
tmp = strchr(dev, ' ');
if (tmp != NULL)
*tmp = '\0';
if (dev[0] == '*' && strlen(fs)) {
rc = snprintf(dev, sizeof(dev), "%s-*", fs);
- if (rc >= sizeof(dev))
- GOTO(out, rc = -E2BIG);
+ if (rc >= sizeof(dev)) {
+ rc = -E2BIG;
+ goto out;
+ }
}
rc = snprintf(devices, sizeof(devices), "%s/%s/%s", obd_type, dev,
param_name);
- if (rc >= sizeof(devices))
- GOTO(out, rc = -E2BIG);
+ if (rc >= sizeof(devices)) {
+ rc = -E2BIG;
+ goto out;
+ }
+
fclose(fp);
return get_param(devices, value, val_len);
out:
return 0;
s = calloc(1, read_size);
- if (s == NULL)
- GOTO(out, rc = -ENOMEM);
-
- fd = open(statuslog, O_RDONLY);
- if (fd == -1)
- GOTO(out, rc = -errno);
- size = read(fd, s, read_size);
- if (size != read_size)
- GOTO(out, rc = -EINVAL);
- if (read_size < s->ls_size) {
- read_size = s->ls_size;
- s = lr_grow_buf(s, read_size);
- if (s == NULL)
- GOTO(out, rc = -ENOMEM);
- if (lseek(fd, 0, SEEK_SET) == -1)
- GOTO(out, rc = -errno);
- size = read(fd, s, read_size);
- if (size != read_size)
- GOTO(out, rc = -EINVAL);
- }
+ if (s == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
+
+ fd = open(statuslog, O_RDONLY);
+ if (fd == -1) {
+ rc = -errno;
+ goto out;
+ }
+
+ size = read(fd, s, read_size);
+ if (size != read_size) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ if (read_size < s->ls_size) {
+ read_size = s->ls_size;
+ s = lr_grow_buf(s, read_size);
+ if (s == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
+
+ if (lseek(fd, 0, SEEK_SET) == -1) {
+ rc = -ENOMEM;
+ goto out;
+ }
+
+ size = read(fd, s, read_size);
+ if (size != read_size) {
+ rc = -EINVAL;
+ goto out;
+ }
+ }
+
+ while (read(fd, &rec, sizeof(rec)) != 0) {
+ tmp = calloc(1, sizeof(*tmp));
+ if (!tmp) {
+ rc = -ENOMEM;
+ goto out;
+ }
- while (read(fd, &rec, sizeof(rec)) != 0) {
- tmp = calloc(1, sizeof(*tmp));
- if (!tmp)
- GOTO(out, rc = -ENOMEM);
tmp->pc_log = rec;
tmp->pc_next = parents;
parents = tmp;
if (status->ls_num_targets == 0) {
if (status->ls_size != s->ls_size) {
status = lr_grow_buf(status, s->ls_size);
- if (status == NULL)
- GOTO(out, rc = -ENOMEM);
+ if (status == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
+
status->ls_size = s->ls_size;
}
status->ls_num_targets = s->ls_num_targets;