* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
struct dirent64 *de)
{
struct find_param *param = (struct find_param *)data;
+ int ret;
LASSERT(parent != NULL || d != NULL);
/* Prepare odb. */
- return setup_obd_uuid(d ? d : parent, path, param);
+ ret = setup_obd_uuid(d ? d : parent, path, param);
+
+ /* 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;
}
int llapi_ostlist(char *path, struct find_param *param)
}
static void lov_dump_user_lmm_header(struct lov_user_md *lum, char *path,
+ struct lov_user_ost_data_v1 *objects,
int is_dir, int verbose, int depth,
char *pool_name)
{
llapi_printf(LLAPI_MSG_NORMAL, "%sstripe_offset: ",
prefix);
llapi_printf(LLAPI_MSG_NORMAL, "%u%c",
- lum->lmm_objects[0].l_ost_idx, nl);
+ objects[0].l_ost_idx, nl);
}
if ((verbose & VERBOSE_POOL) && (pool_name != NULL)) {
}
if (obdstripe == 1)
- lov_dump_user_lmm_header(lum, path, is_dir, header, depth,
+ lov_dump_user_lmm_header(lum, path, objects, is_dir, header, depth,
pool_name);
if (!is_dir && (header & VERBOSE_OBJID)) {
"ioctl on %s for getting connect flags failed", mnt);
return rc;
}
+
+int llapi_get_version(char *buffer, int buffer_size,
+ char **version)
+{
+ int rc;
+ int fd;
+ struct obd_ioctl_data *data = (struct obd_ioctl_data *)buffer;
+
+ fd = open(OBD_DEV_PATH, O_RDONLY);
+ if (fd == -1)
+ return -errno;
+
+ memset(buffer, 0, buffer_size);
+ data->ioc_version = OBD_IOCTL_VERSION;
+ data->ioc_inllen1 = buffer_size - cfs_size_round(sizeof(*data));
+ data->ioc_inlbuf1 = buffer + cfs_size_round(sizeof(*data));
+ data->ioc_len = obd_ioctl_packlen(data);
+
+ rc = ioctl(fd, OBD_GET_VERSION, buffer);
+ if (rc == -1) {
+ rc = errno;
+ close(fd);
+ return -rc;
+ }
+ close(fd);
+ *version = data->ioc_bulk;
+ return 0;
+}