From 9d12f9a8181babfb0eebadcc861ffa167c65ee33 Mon Sep 17 00:00:00 2001 From: niu Date: Wed, 16 Jun 2004 07:55:13 +0000 Subject: [PATCH] * pass in the 3rd parameter for obdgens while getting lov stripe config. --- lustre/utils/liblustreapi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 7d0a6ec..c522a9f 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -198,16 +198,26 @@ int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count) struct lov_desc desc = { 0, }; char *buf = NULL; int max_ost_count, rc; + __u32 *obdgens; max_ost_count = (OBD_MAX_IOCTL_BUFFER - size_round(sizeof(data)) - - size_round(sizeof(desc))) / sizeof(*uuidp); + size_round(sizeof(desc))) / + (sizeof(*uuidp) + sizeof(*obdgens)); if (max_ost_count > *ost_count) max_ost_count = *ost_count; + obdgens = malloc(size_round(max_ost_count * sizeof(*obdgens))); + if (!obdgens) { + err_msg("no memory for %d generation #'s", max_ost_count); + return(-ENOMEM); + } + data.ioc_inllen1 = sizeof(desc); data.ioc_inlbuf1 = (char *)&desc; data.ioc_inllen2 = size_round(max_ost_count * sizeof(*uuidp)); data.ioc_inlbuf2 = (char *)uuidp; + data.ioc_inllen3 = size_round(max_ost_count * sizeof(*obdgens)); + data.ioc_inlbuf3 = (char *)obdgens; desc.ld_tgt_count = max_ost_count; @@ -233,6 +243,7 @@ int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count) *ost_count = desc.ld_tgt_count; out: free(buf); + free(obdgens); return 0; } -- 1.8.3.1