static
int do_add_uuid(char * func, char *uuid, lnet_nid_t nid)
{
- int rc;
- struct lustre_cfg_bufs bufs;
- struct lustre_cfg *lcfg;
+ int rc;
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
- lustre_cfg_bufs_reset(&bufs, lcfg_devname);
- if (uuid)
- lustre_cfg_bufs_set_string(&bufs, 1, uuid);
+ lustre_cfg_bufs_reset(&bufs, lcfg_devname);
+ if (uuid != NULL)
+ lustre_cfg_bufs_set_string(&bufs, 1, uuid);
lcfg = lustre_cfg_new(LCFG_ADD_UUID, &bufs);
if (lcfg == NULL) {
rc = -ENOMEM;
} else {
lcfg->lcfg_nid = nid;
- /* Poison NAL -- pre 1.4.6 will LASSERT on 0 NAL, this way it
- * doesn't work without crashing (bz 10130) */
- lcfg->lcfg_nal = 0x5a;
+
rc = lcfg_ioctl(func, OBD_DEV_ID, lcfg);
lustre_cfg_free(lcfg);
}
return -1;
}
- printf ("Added uuid %s: %s\n", uuid, libcfs_nid2str(nid));
- return 0;
+ if (uuid != NULL)
+ printf("Added uuid %s: %s\n", uuid, libcfs_nid2str(nid));
+
+ return 0;
}
int jt_lcfg_add_uuid(int argc, char **argv)
if ((p = strchr(name, '.')))
*p = '\0';
len = strlen(name) + 2;
- if (lnet)
+ if (lnet != NULL)
len += strlen(lnet);
- if (!(res = malloc(len)))
- nl_oom();
- snprintf(res, len, "%s@%s", name, lnet);
- break;
- }
- }
- freeaddrinfo(ai);
- }
- }
- free(addr);
+ if (!(res = malloc(len)))
+ nl_oom();
+ if (lnet != NULL)
+ snprintf(res, len, "%s@%s",
+ name, lnet);
+ else
+ snprintf(res, len, "%s", name);
+ break;
+ }
+ }
+ freeaddrinfo(ai);
+ }
+ }
+ free(addr);
- return res;
+ return res;
}
void nl_lookup_ip(NIDList nl)