From: Andreas Dilger Date: Mon, 9 Aug 2010 14:25:34 +0000 (-0400) Subject: b=23270 simplify "lctl osts" (llapi_ostlist) code X-Git-Tag: v1_8_4_50~4 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7090e6f8c930776e5c085d7abac29398e39acb01;p=fs%2Flustre-release.git b=23270 simplify "lctl osts" (llapi_ostlist) code Simplify "lfs osts" command so that it avoids the filesystem traversal code entirely, and just calls setup_osts() to print the OST list. --- diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index e466d49..1e88a51 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1337,27 +1337,20 @@ retry_get_uuids: return ret; } -static int cb_ostlist(char *path, DIR *parent, DIR *d, void *data, - struct dirent64 *de) + +int llapi_ostlist(char *path, struct find_param *param) { - struct find_param *param = (struct find_param *)data; + DIR *dir; int ret; - LASSERT(parent != NULL || d != NULL); - - /* Prepare odb. */ - ret = setup_obd_uuid(d ? d : parent, path, param); + dir = opendir(path); + if (dir == NULL) + return -errno; - /* We don't want to actually traverse the directory tree, - * so return a positive value from sem_init to terminate - * the traversal before it starts. - */ - return ret == 0 ? 1 : ret; -} + ret = setup_obd_uuid(dir, path, param); + closedir(dir); -int llapi_ostlist(char *path, struct find_param *param) -{ - return param_callback(path, cb_ostlist, cb_common_fini, param); + return ret; } static void lov_dump_user_lmm_header(struct lov_user_md *lum, char *path,