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