memset(&data, 0, sizeof(data));
data.ioc_dev = cur_device;
- data.ioc_inllen1 = sizeof(rawbuf) - cfs_size_round(sizeof(data));
+ data.ioc_inllen1 = sizeof(rawbuf) - __ALIGN_KERNEL(sizeof(data), 8);
memset(buf, 0, sizeof(rawbuf));
rc = llapi_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (rc) {
data.ioc_dev = cur_device;
data.ioc_inllen1 = strlen(argv[1]) + 1;
data.ioc_inlbuf1 = argv[1];
- data.ioc_inllen2 = sizeof(rawbuf) - cfs_size_round(sizeof(data)) -
- cfs_size_round(data.ioc_inllen1);
+ data.ioc_inllen2 = sizeof(rawbuf) - __ALIGN_KERNEL(sizeof(data), 8) -
+ __ALIGN_KERNEL(data.ioc_inllen1, 8);
memset(buf, 0, sizeof(rawbuf));
rc = llapi_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (rc) {
data.ioc_inllen3 = strlen(to) + 1;
data.ioc_inlbuf3 = to;
}
- data.ioc_inllen4 = sizeof(rawbuf) - cfs_size_round(sizeof(data)) -
- cfs_size_round(data.ioc_inllen1) -
- cfs_size_round(data.ioc_inllen2) -
- cfs_size_round(data.ioc_inllen3);
+ data.ioc_inllen4 = sizeof(rawbuf) - __ALIGN_KERNEL(sizeof(data), 8) -
+ __ALIGN_KERNEL(data.ioc_inllen1, 8) -
+ __ALIGN_KERNEL(data.ioc_inllen2, 8) -
+ __ALIGN_KERNEL(data.ioc_inllen3, 8);
memset(buf, 0, sizeof(rawbuf));
rc = llapi_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (rc) {
data.ioc_inllen3 = strlen(to) + 1;
data.ioc_inlbuf3 = to;
}
- data.ioc_inllen4 = sizeof(rawbuf) - cfs_size_round(sizeof(data)) -
- cfs_size_round(data.ioc_inllen1) -
- cfs_size_round(data.ioc_inllen2) -
- cfs_size_round(data.ioc_inllen3);
+ data.ioc_inllen4 = sizeof(rawbuf) - __ALIGN_KERNEL(sizeof(data), 8) -
+ __ALIGN_KERNEL(data.ioc_inllen1, 8) -
+ __ALIGN_KERNEL(data.ioc_inllen2, 8) -
+ __ALIGN_KERNEL(data.ioc_inllen3, 8);
memset(buf, 0, sizeof(rawbuf));
rc = llapi_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (rc) {
return -1;
}
- if (!cfs_nidrange_is_contiguous(&nidlist)) {
- fprintf(stderr, "error: %s: nodemap ranges must be "
- "contiguous\n", jt_cmdname(argv[0]));
- return -1;
+ rc = cfs_nidrange_find_min_max(&nidlist, &min_nid[0], &max_nid[0],
+ LNET_NIDSTR_SIZE);
+ if (rc < 0) {
+ errno = -rc;
+ if (rc == -EINVAL)
+ fprintf(stderr, "error: %s: nid range uses "
+ "currently unsupported features\n",
+ jt_cmdname(argv[0]));
+ else if (rc == -ERANGE)
+ fprintf(stderr, "error: %s: nodemap ranges must be "
+ "contiguous\n", jt_cmdname(argv[0]));
+
+ return rc;
}
- cfs_nidrange_find_min_max(&nidlist, &min_nid[0], &max_nid[0],
- LNET_NIDSTR_SIZE);
snprintf(nid_range, sizeof(nid_range), "%s:%s", min_nid, max_nid);
rc = nodemap_cmd(LCFG_NODEMAP_ADD_RANGE, NULL, 0, argv[0],
return -1;
}
- if (!cfs_nidrange_is_contiguous(&nidlist)) {
- fprintf(stderr, "error: %s: nodemap ranges must be "
- "contiguous\n", jt_cmdname(argv[0]));
- return -1;
+ rc = cfs_nidrange_find_min_max(&nidlist, &min_nid[0], &max_nid[0],
+ LNET_NIDSTR_SIZE);
+ if (rc < 0) {
+ errno = -rc;
+ if (rc == -EINVAL)
+ fprintf(stderr, "error: %s: nid range uses "
+ "currently unsupported features\n",
+ jt_cmdname(argv[0]));
+ else if (rc == -ERANGE)
+ fprintf(stderr, "error: %s: nodemap ranges must be "
+ "contiguous\n", jt_cmdname(argv[0]));
+
+ return rc;
}
- cfs_nidrange_find_min_max(&nidlist, &min_nid[0], &max_nid[0],
- LNET_NIDSTR_SIZE);
snprintf(nid_range, sizeof(nid_range), "%s:%s", min_nid, max_nid);
rc = nodemap_cmd(LCFG_NODEMAP_DEL_RANGE, NULL, 0, argv[0],