+ struct find_param *param = (struct find_param *)data;
+ lstat_t *st;
+ int rc;
+
+ LASSERT(parent != NULL || d != NULL);
+
+ if (d) {
+ rc = ioctl(dirfd(d), LL_IOC_MDC_GETINFO,
+ (void *)param->lmd);
+ } else if (parent) {
+ char *fname = strrchr(path, '/');
+ fname = (fname == NULL ? path : fname + 1);
+
+ strncpy((char *)param->lmd, fname, param->lumlen);
+ rc = ioctl(dirfd(parent), IOC_MDC_GETFILEINFO,
+ (void *)param->lmd);
+ } else {
+ return 0;
+ }
+
+ if (rc) {
+ if (errno == ENODATA) {
+ if (!param->obduuid && !param->quiet)
+ fprintf(stderr, "%s has no stripe info\n",
+ path);
+ rc = 0;
+ } else if (errno != EISDIR) {
+ rc = errno;
+ err_msg("%s ioctl failed for %s.",
+ d ? "LL_IOC_MDC_GETINFO" :
+ "IOC_MDC_GETFILEINFO", path);
+ }
+ return rc;
+ }
+
+ st = ¶m->lmd->lmd_st;
+
+ /* libc chown() will do extra check, and if the real owner is
+ * the same as the ones to set, it won't fall into kernel, so
+ * invoke syscall directly. */
+ rc = syscall(SYS_chown, path, -1, -1);
+ if (rc)
+ err_msg("error: chown %s (%u,%u)", path);
+
+ rc = chmod(path, st->st_mode);
+ if (rc)
+ err_msg("error: chmod %s (%hu)", path, st->st_mode);
+
+ return rc;
+}
+
+int llapi_quotachown(char *path, int flag)
+{
+ struct find_param param;
+ int ret = 0;
+
+ memset(¶m, 0, sizeof(param));
+ param.recursive = 1;
+ param.verbose = 0;
+ param.quiet = 1;
+
+ ret = common_param_init(¶m);
+ if (ret)
+ goto out;
+
+ ret = llapi_semantic_traverse(path, NULL, cb_quotachown,
+ NULL, ¶m);
+out:
+ find_param_fini(¶m);
+ return ret;
+}
+
+int llapi_getfacl(char *fname, char *cmd)
+{
+ struct rmtacl_ioctl_data data;
+ char out[RMTACL_SIZE_MAX] = "";