Changes in uspace/srv/fs/mfs/mfs_inode.c [7a46bfe:c2e50d7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_inode.c
r7a46bfe rc2e50d7 42 42 static int 43 43 mfs_read_inode_raw(const struct mfs_instance *instance, 44 44 struct mfs_ino_info **ino_ptr, uint16_t inum); 45 45 46 46 static int 47 47 mfs2_read_inode_raw(const struct mfs_instance *instance, 48 struct mfs_ino_info **ino_ptr, uint32_t inum); 49 50 48 struct mfs_ino_info **ino_ptr, uint32_t inum); 49 50 /**Read a MINIX inode from disk 51 * 52 * @param inst Pointer to the filesystem instance. 53 * @param ino_i Pointer to the generic MINIX inode 54 * where the inode content will be stored. 55 * @param index index of the inode to read. 56 * 57 * @return EOK on success or a negative error code. 58 */ 51 59 int 52 60 mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i, 53 61 fs_index_t index) 54 62 { 55 63 struct mfs_sb_info *sbi = inst->sbi; … … 57 65 58 66 if (sbi->fs_version == MFS_VERSION_V1) { 59 /* Read a MFS V1 inode*/67 /* Read a MFS V1 inode */ 60 68 r = mfs_read_inode_raw(inst, ino_i, index); 61 69 } else { 62 /* Read a MFS V2/V3 inode*/70 /* Read a MFS V2/V3 inode */ 63 71 r = mfs2_read_inode_raw(inst, ino_i, index); 64 72 } … … 69 77 static int 70 78 mfs_read_inode_raw(const struct mfs_instance *instance, 71 struct mfs_ino_info **ino_ptr, uint16_t inum) { 79 struct mfs_ino_info **ino_ptr, uint16_t inum) 80 { 72 81 struct mfs_inode *ino; 73 82 struct mfs_ino_info *ino_i = NULL; … … 77 86 78 87 sbi = instance->sbi; 79 assert(sbi); 80 81 /*inode 0 does not exist*/ 88 89 /* inode 0 does not exist */ 82 90 inum -= 1; 83 91 … … 94 102 95 103 r = block_get(&b, instance->service_id, 96 itable_off + inum / sbi->ino_per_block, 97 BLOCK_FLAGS_NONE); 104 itable_off + inum / sbi->ino_per_block, 105 BLOCK_FLAGS_NONE); 106 98 107 if (r != EOK) 99 108 goto out_err; … … 127 136 static int 128 137 mfs2_read_inode_raw(const struct mfs_instance *instance, 129 struct mfs_ino_info **ino_ptr, uint32_t inum) { 138 struct mfs_ino_info **ino_ptr, uint32_t inum) 139 { 130 140 struct mfs2_inode *ino; 131 141 struct mfs_ino_info *ino_i = NULL; … … 142 152 143 153 sbi = instance->sbi; 144 assert(sbi); 145 146 /*inode 0 does not exist*/ 154 155 /* inode 0 does not exist */ 147 156 inum -= 1; 148 157 … … 151 160 152 161 r = block_get(&b, instance->service_id, 153 itable_off + inum / sbi->ino_per_block, 154 BLOCK_FLAGS_NONE); 162 itable_off + inum / sbi->ino_per_block, 163 BLOCK_FLAGS_NONE); 164 155 165 if (r != EOK) 156 166 goto out_err; … … 185 195 } 186 196 197 /**Write a MINIX inode on disk (if marked as dirty) 198 * 199 * @param mnode Pointer to the generic MINIX inode in memory. 200 * 201 * @return EOK on success or a negative error code. 202 */ 187 203 int 188 mfs_put_inode _core(struct mfs_node *mnode)204 mfs_put_inode(struct mfs_node *mnode) 189 205 { 190 206 int rc = EOK; 191 192 assert(mnode);193 assert(mnode->ino_i);194 207 195 208 if (!mnode->ino_i->dirty) … … 197 210 198 211 struct mfs_instance *inst = mnode->instance; 199 assert(inst);200 212 struct mfs_sb_info *sbi = inst->sbi; 201 assert(sbi);202 213 203 214 if (sbi->fs_version == MFS_VERSION_V1) … … 224 235 225 236 r = block_get(&b, mnode->instance->service_id, 226 227 237 itable_off + inum / sbi->ino_per_block, 238 BLOCK_FLAGS_NONE); 228 239 229 240 if (r != EOK) … … 267 278 268 279 r = block_get(&b, mnode->instance->service_id, 269 270 280 itable_off + inum / sbi->ino_per_block, 281 BLOCK_FLAGS_NONE); 271 282 272 283 if (r != EOK) … … 299 310 } 300 311 312 /**Reduce the inode size of a given number of bytes 313 * 314 * @param mnode Pointer to the generic MINIX inode in memory. 315 * @param size_shrink Number of bytes that will be subtracted to the inode. 316 * 317 * @return EOK on success or a negative error code. 318 */ 301 319 int 302 320 mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink) … … 308 326 309 327 if (size_shrink == 0) { 310 /* File is empty*/328 /* Nothing to be done */ 311 329 return EOK; 312 330 } … … 319 337 ino_i->dirty = true; 320 338 321 /* Compute the number of zones to free*/339 /* Compute the number of zones to free */ 322 340 unsigned zones_to_free; 323 341 … … 340 358 341 359 if (old_zone == 0) 342 continue; /* Sparse block*/360 continue; /* Sparse block */ 343 361 344 362 r = mfs_free_zone(mnode->instance, old_zone);
Note:
See TracChangeset
for help on using the changeset viewer.