Changeset 4bfad34 in mainline for uspace/lib/ext4/src/ops.c
- Timestamp:
- 2017-05-11T22:07:09Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be39fc6
- Parents:
- 71fe4723
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/src/ops.c
r71fe4723 r4bfad34 32 32 */ 33 33 /** 34 * @file ext4fs_ops.c34 * @file ops.c 35 35 * @brief Operations for ext4 filesystem. 36 36 */ … … 46 46 #include <ipc/loc.h> 47 47 #include "ext4/ops.h" 48 //#include "../../vfs/vfs.h" 49 50 #define EXT4FS_NODE(node) \ 51 ((node) ? (ext4fs_node_t *) (node)->data : NULL) 52 53 /** 54 * Type for holding an instance of mounted partition. 55 */ 56 typedef struct ext4fs_instance { 57 link_t link; 58 service_id_t service_id; 59 ext4_filesystem_t *filesystem; 60 unsigned int open_nodes_count; 61 } ext4fs_instance_t; 62 63 /** 64 * Type for wrapping common fs_node and add some useful pointers. 65 */ 66 typedef struct ext4fs_node { 67 ext4fs_instance_t *instance; 68 ext4_inode_ref_t *inode_ref; 69 fs_node_t *fs_node; 70 ht_link_t link; 71 unsigned int references; 72 } ext4fs_node_t; 48 #include "ext4/fstypes.h" 73 49 74 50 /* Forward declarations of auxiliary functions */ … … 80 56 static bool ext4fs_is_dots(const uint8_t *, size_t); 81 57 static int ext4fs_instance_get(service_id_t, ext4fs_instance_t **); 82 static int ext4fs_node_get_core(fs_node_t **, ext4fs_instance_t *, fs_index_t);83 static int ext4fs_node_put_core(ext4fs_node_t *);84 58 85 59 /* Forward declarations of ext4 libfs operations. */ … … 89 63 static int ext4fs_node_get(fs_node_t **, service_id_t, fs_index_t); 90 64 static int ext4fs_node_open(fs_node_t *); 91 staticint ext4fs_node_put(fs_node_t *);65 int ext4fs_node_put(fs_node_t *); 92 66 static int ext4fs_create_node(fs_node_t **, service_id_t, int); 93 67 static int ext4fs_destroy_node(fs_node_t *); … … 373 347 * 374 348 */ 375 int ext4fs_node_put_core(ext4fs_node_t *enode)349 static int ext4fs_node_put_core(ext4fs_node_t *enode) 376 350 { 377 351 hash_table_remove_item(&open_nodes, &enode->link); … … 966 940 cmode = CACHE_MODE_WB; 967 941 968 /* Initialize the filesystem */969 int rc = ext4_filesystem_init(fs, service_id, cmode);970 if (rc != EOK) {971 free(fs);972 free(inst);973 return rc;974 }975 976 /* Check flags */977 bool read_only;978 rc = ext4_filesystem_check_features(fs, &read_only);979 if (rc != EOK) {980 ext4_filesystem_fini(fs);981 free(fs);982 free(inst);983 return rc;984 }985 986 942 /* Initialize instance */ 987 943 link_initialize(&inst->link); … … 990 946 inst->open_nodes_count = 0; 991 947 992 /* Read root node */ 993 fs_node_t *root_node; 994 rc = ext4fs_node_get_core(&root_node, inst, EXT4_INODE_ROOT_INDEX); 995 if (rc != EOK) { 996 ext4_filesystem_fini(fs); 948 /* Initialize the filesystem */ 949 aoff64_t rnsize; 950 int rc = ext4_filesystem_init(fs, inst, service_id, cmode, &rnsize); 951 if (rc != EOK) { 997 952 free(fs); 998 953 free(inst); … … 1005 960 fibril_mutex_unlock(&instance_list_mutex); 1006 961 1007 ext4fs_node_t *enode = EXT4FS_NODE(root_node);1008 1009 962 *index = EXT4_INODE_ROOT_INDEX; 1010 *size = ext4_inode_get_size(fs->superblock, enode->inode_ref->inode);963 *size = rnsize; 1011 964 *lnkcnt = 1; 1012 965 1013 return ext4fs_node_put(root_node);966 return EOK; 1014 967 } 1015 968
Note:
See TracChangeset
for help on using the changeset viewer.