Changeset 87d4422 in mainline
- Timestamp:
- 2011-04-03T13:44:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c4eeb2f
- Parents:
- ae8541d
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.h
rae8541d r87d4422 126 126 /*The following fields do not exist on disk but only in memory*/ 127 127 bool dirty; 128 unsigned index; 129 /*Pointer to the node at witch the dentry belongs*/ 130 struct mfs_node *node; 128 131 }; 129 132 … … 166 169 read_directory_entry(struct mfs_node *mnode, unsigned index); 167 170 171 extern int 172 write_dentry(struct mfs_dentry_info *d_info); 173 168 174 /*mfs_balloc.c*/ 169 175 extern int -
uspace/srv/fs/minixfs/mfs_dentry.c
rae8541d r87d4422 80 80 81 81 d_info->dirty = false; 82 d_info->index = index; 83 d_info->node = mnode; 82 84 return d_info; 83 85 … … 87 89 } 88 90 91 int 92 write_dentry(struct mfs_dentry_info *d_info) 93 { 94 struct mfs_node *mnode = d_info->node; 95 struct mfs_sb_info *sbi = mnode->instance->sbi; 96 const unsigned d_off_bytes = d_info->index * sbi->dirsize; 97 const unsigned dirs_per_block = sbi->block_size / sbi->dirsize; 98 block_t *b; 99 uint32_t block; 100 int r; 101 102 r = read_map(&block, mnode, d_off_bytes); 103 if (r != EOK) 104 goto out; 105 106 r = block_get(&b, mnode->instance->handle, block, BLOCK_FLAGS_NONE); 107 if (r != EOK) 108 goto out; 109 110 const size_t name_len = str_size(d_info->d_name); 111 uint8_t *ptr = b->data; 112 ptr += (d_info->index % dirs_per_block) * sbi->dirsize; 113 114 if (sbi->fs_version == MFS_VERSION_V3) { 115 struct mfs3_dentry *dentry; 116 dentry = (struct mfs3_dentry *) ptr; 117 118 dentry->d_inum = conv32(sbi->native, d_info->d_inum); 119 memcpy(dentry->d_name, d_info->d_name, name_len); 120 } else { 121 struct mfs_dentry *dentry; 122 dentry = (struct mfs_dentry *) ptr; 123 124 dentry->d_inum = conv16(sbi->native, d_info->d_inum); 125 memcpy(dentry->d_name, d_info->d_name, name_len); 126 } 127 128 b->dirty = true; 129 block_put(b); 130 131 out: 132 return r; 133 } 134 89 135 /** 90 136 * @}
Note:
See TracChangeset
for help on using the changeset viewer.