- struct mgs_device *mgs, cfs_list_t *dentry_list)
-{
- /* see mds_cleanup_pending */
- struct lvfs_run_ctxt saved;
- struct file *file;
- struct dentry *dentry;
- struct vfsmount *mnt;
- int rc = 0;
- ENTRY;
+ struct mgs_device *mgs, cfs_list_t *list)
+{
+ struct dt_object *dir = mgs->mgs_configs_dir;
+ const struct dt_it_ops *iops;
+ struct dt_it *it;
+ struct mgs_direntry *de;
+ char *key;
+ int rc, key_sz;
+
+ CFS_INIT_LIST_HEAD(list);
+
+ if (!dt_try_as_dir(env, dir))
+ GOTO(out, rc = -ENOTDIR);
+
+ LASSERT(dir);
+ LASSERT(dir->do_index_ops);
+
+ iops = &dir->do_index_ops->dio_it;
+ it = iops->init(env, dir, LUDA_64BITHASH, BYPASS_CAPA);
+ if (IS_ERR(it))
+ RETURN(PTR_ERR(it));
+
+ rc = iops->load(env, it, 0);
+ if (rc <= 0)
+ GOTO(fini, rc = 0);
+
+ /* main cycle */
+ do {
+ key = (void *)iops->key(env, it);
+ if (IS_ERR(key)) {
+ CERROR("%s: key failed when listing %s: rc = %d\n",
+ mgs->mgs_obd->obd_name, MOUNT_CONFIGS_DIR,
+ (int) PTR_ERR(key));
+ goto next;
+ }
+ key_sz = iops->key_size(env, it);
+ LASSERT(key_sz > 0);
+
+ /* filter out "." and ".." entries */
+ if (key[0] == '.') {
+ if (key_sz == 1)
+ goto next;
+ if (key_sz == 2 && key[1] == '.')
+ goto next;
+ }