-static struct osl_column_description id_table_cols[] = {
- [IDT_UID] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE | OSL_UNIQUE,
- .name = "uid",
- .compare_function = uint32_compare,
- .data_size = sizeof(uint32_t)
- },
- [IDT_BYTES] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE,
- .compare_function = size_compare,
- .name = "num_bytes",
- .data_size = sizeof(uint64_t)
- },
- [IDT_FILES] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE,
- .compare_function = size_compare,
- .name = "num_filess",
- .data_size = sizeof(uint64_t)
- },
- [IDT_TABLE] = {
- .storage_type = OSL_NO_STORAGE,
- .storage_flags = OSL_FIXED_SIZE | OSL_UNIQUE,
- .name = "user_table",
- .data_size = sizeof(void *)
- }
-};
-
-static struct osl_table_description id_table_desc = {
- .name = "id_table",
- .num_columns = NUM_IDT_COLUMNS,
- .flags = 0,
- .column_descriptions = id_table_cols,
- .dir = "/tmp/adu"
-};
-
-/** The columns of the id table. */
-enum user_table_columns {
- /** The numer of the directory. */
- UT_DIR_NUM,
- /** The number of bytes of all regular files in this dir owned by this id. */
- UT_BYTES,
- /** The number of files in this dir owned by this id. */
- UT_FILES,
- /** Number of columns in this table. */
- NUM_UT_COLUMNS
-};
-
-static struct osl_column_description user_table_cols[] = {
- [UT_DIR_NUM] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE | OSL_UNIQUE,
- .name = "dir_num",
- .compare_function = uint32_compare,
- .data_size = sizeof(uint32_t)
- },
- [IDT_BYTES] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE,
- .compare_function = size_compare,
- .name = "num_bytes",
- .data_size = sizeof(uint64_t)
- },
- [IDT_FILES] = {
- .storage_type = OSL_MAPPED_STORAGE,
- .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE,
- .compare_function = size_compare,
- .name = "num_files",
- .data_size = sizeof(uint64_t)
- },
-};
-
-static struct osl_table_description user_table_desc = {
- .num_columns = NUM_UT_COLUMNS,
- .flags = 0,
- .column_descriptions = user_table_cols,
- .dir = "/tmp/adu"
-};
-static struct osl_table *dir_table;
-static struct osl_table *id_table;
-
-static int create_tables(void)
-{
- int ret = osl_create_table(&dir_table_desc);
- if (ret < 0)
- return ret;
- ret = osl_create_table(&id_table_desc);
- if (ret < 0)
- return ret;
- return 1;
-}
-
-int add_directory(char *dirname, uint32_t dir_num, uint64_t *dir_size,
- uint64_t *dir_files)