- ret = add_directory(dirname, &dir_size, &dir_files);
-out:
- closedir(dir);
- ret2 = para_fchdir(cwd_fd);
- if (ret2 < 0 && ret >= 0)
- ret = ret2;
- close(cwd_fd);
- return ret;
-}
-
-static int get_dir_name(struct osl_row *row, char **name)
-{
- struct osl_object obj;
- int ret = osl_get_object(dir_table, row, DT_NAME, &obj);
-
- if (ret < 0)
- return ret;
- *name = obj.data;
- return 1;
-}
-
-static int print_dirname_and_size(struct osl_row *row, void *data)
-{
- unsigned *count = data;
- struct osl_object obj;
- char *name;
- int ret;
-
- if ((*count)++ > 100)
- return -E_LOOP_COMPLETE;
- ret = get_dir_name(row, &name);
- if (ret < 0)
- return ret;
- ret = osl_get_object(dir_table, row, DT_BYTES, &obj);
- if (ret < 0)
- return ret;
- printf("%s\t%llu\n", name, *(long long unsigned *)obj.data);
- return 1;
-}
-
-static int print_dirname_and_file_count(struct osl_row *row, void *data)
-{
- unsigned *count = data;
- struct osl_object obj;
- char *name;
- int ret;
-
- if ((*count)++ > 100)
- return -E_LOOP_COMPLETE;
- ret = get_dir_name(row, &name);
- if (ret < 0)
- return ret;
- ret = osl_get_object(dir_table, row, DT_FILES, &obj);
- if (ret < 0)
- return ret;
- printf("%s\t%llu\n", name, *(long long unsigned *)obj.data);
- return 1;
-}
-
-static int print_id_stats(struct osl_row *row, __a_unused void *data)
-{
- struct osl_object obj;
- uint32_t uid;
- uint64_t bytes, files;
- int ret = osl_get_object(id_table, row, IDT_UID, &obj);
-
- if (ret < 0)
- return ret;
- uid = *(uint32_t *)obj.data;
- ret = osl_get_object(id_table, row, IDT_BYTES, &obj);
- if (ret < 0)
- return ret;
- bytes = *(uint64_t *)obj.data;
- ret = osl_get_object(id_table, row, IDT_FILES, &obj);
- if (ret < 0)
- return ret;
- files = *(uint64_t *)obj.data;
-
- printf("%u\t%llu%llu\n", (unsigned)uid, (long long unsigned)files,
- (long long unsigned)bytes);
- return 1;