Changeset 49df572 in mainline
- Timestamp:
- 2008-11-24T22:38:44Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 14c331a
- Parents:
- e478b2a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
re478b2a4 r49df572 289 289 fat_idx_t *idxp; 290 290 fat_node_t *nodep; 291 fat_bs_t *bs; 292 fat_cluster_t mcl, lcl; 293 uint16_t bps; 294 int rc; 295 296 bs = block_bb_get(dev_handle); 297 bps = uint16_t_le2host(bs->bps); 298 if (flags & L_DIRECTORY) { 299 /* allocate a cluster */ 300 rc = fat_alloc_clusters(bs, dev_handle, 1, &mcl, &lcl); 301 if (rc != EOK) 302 return NULL; 303 } 291 304 292 305 nodep = fat_node_get_new(); 293 if (!nodep) 306 if (!nodep) { 307 fat_free_clusters(bs, dev_handle, mcl); 294 308 return NULL; 309 } 295 310 idxp = fat_idx_get_new(dev_handle); 296 311 if (!idxp) { 312 fat_free_clusters(bs, dev_handle, mcl); 297 313 fat_node_put(nodep); 298 314 return NULL; … … 300 316 /* idxp->lock held */ 301 317 if (flags & L_DIRECTORY) { 318 int i; 319 block_t *b; 320 321 /* 322 * Populate the new cluster with unused dentries. 323 * We don't create the '.' and '..' entries, since they are 324 * optional and HelenOS VFS does not need them. 325 */ 326 for (i = 0; i < bs->spc; i++) { 327 b = _fat_block_get(bs, dev_handle, mcl, i, 328 BLOCK_FLAGS_NOREAD); 329 /* mark all dentries as never-used */ 330 memset(b->data, 0, bps); 331 b->dirty = false; 332 block_put(b); 333 } 302 334 nodep->type = FAT_DIRECTORY; 335 nodep->firstc = mcl; 336 nodep->size = bps * bs->spc; 303 337 } else { 304 338 nodep->type = FAT_FILE; 305 }306 nodep->size = 0;307 nodep->firstc = FAT_CLST_RES0;339 nodep->firstc = FAT_CLST_RES0; 340 nodep->size = 0; 341 } 308 342 nodep->lnkcnt = 0; /* not linked anywhere */ 309 343 nodep->refcnt = 1; 344 nodep->dirty = true; 310 345 311 346 nodep->idx = idxp;
Note:
See TracChangeset
for help on using the changeset viewer.