Changeset c922bc7 in mainline


Ignore:
Timestamp:
2011-04-06T18:32:00Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ab1adff
Parents:
40f7297
Message:

Add function get_inode(), it is used to obtain a generic minix inode without
messing around with these ugly "if (fsversion == x) .. else if (fsversion == y)…"

Location:
uspace/srv/fs/minixfs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/minixfs/mfs.h

    r40f7297 rc922bc7  
    154154
    155155/*mfs_inode.c*/
    156 extern struct mfs_ino_info *
    157 mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum);
    158 
    159 extern struct mfs_ino_info *
    160 mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum);
     156int
     157get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
     158                                fs_index_t index);
    161159
    162160extern int
     
    164162
    165163int
    166 mfs_inode_grow(struct mfs_node *mnode, unsigned size_grow);
     164inode_grow(struct mfs_node *mnode, unsigned size_grow);
    167165
    168166/*mfs_rw.c*/
  • uspace/srv/fs/minixfs/mfs_inode.c

    r40f7297 rc922bc7  
    4444mfs2_write_inode_raw(struct mfs_node *mnode);
    4545
    46 struct mfs_ino_info *
     46static struct mfs_ino_info *
     47mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum);
     48
     49static struct mfs_ino_info *
     50mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum);
     51
     52
     53int
     54get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
     55                                fs_index_t index)
     56{
     57        struct mfs_sb_info *sbi = inst->sbi;
     58
     59        if (sbi->fs_version == MFS_VERSION_V1) {
     60                /*Read a MFS V1 inode*/
     61                *ino_i = mfs_read_inode_raw(inst, index);
     62        } else {
     63                /*Read a MFS V2/V3 inode*/
     64                *ino_i = mfs2_read_inode_raw(inst, index);
     65        }
     66
     67        if (*ino_i == NULL)
     68                return -1;
     69
     70        return EOK;
     71}
     72
     73static struct mfs_ino_info *
    4774mfs_read_inode_raw(const struct mfs_instance *instance, uint16_t inum)
    4875{
     
    100127}
    101128
    102 struct mfs_ino_info *
     129static struct mfs_ino_info *
    103130mfs2_read_inode_raw(const struct mfs_instance *instance, uint32_t inum)
    104131{
     
    272299
    273300int
    274 mfs_inode_grow(struct mfs_node *mnode, unsigned size_grow)
     301inode_grow(struct mfs_node *mnode, unsigned size_grow)
    275302{
    276303        unsigned i;
  • uspace/srv/fs/minixfs/mfs_ops.c

    r40f7297 rc922bc7  
    387387        int rc;
    388388
    389         const struct mfs_sb_info *sbi = inst->sbi;
    390 
    391389        node = malloc(sizeof(fs_node_t));
    392390        if (!node) {
     
    405403        struct mfs_ino_info *ino_i;
    406404
    407         if (sbi->fs_version == MFS_VERSION_V1) {
    408                 /*Read MFS V1 inode*/
    409                 ino_i = mfs_read_inode_raw(inst, index);
    410         } else {
    411                 /*Read MFS V2/V3 inode*/
    412                 ino_i = mfs2_read_inode_raw(inst, index);
    413         }
    414 
    415         if (!ino_i)
     405        rc = get_inode(inst, &ino_i, index);
     406        if (rc != EOK)
    416407                goto out_err;
    417408
Note: See TracChangeset for help on using the changeset viewer.