Changeset 6571b78 in mainline
- Timestamp:
- 2008-11-22T11:04:00Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3ff2b54
- Parents:
- ce4a3dae
- Location:
- uspace/srv/fs/fat
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat.h
rce4a3dae r6571b78 205 205 extern void fat_truncate(ipc_callid_t, ipc_call_t *); 206 206 207 extern fat_idx_t *fat_idx_get_new(dev_handle_t); 207 208 extern fat_idx_t *fat_idx_get_by_pos(dev_handle_t, fat_cluster_t, unsigned); 208 209 extern fat_idx_t *fat_idx_get_by_index(dev_handle_t, fs_index_t); -
uspace/srv/fs/fat/fat_ops.c
rce4a3dae r6571b78 235 235 { 236 236 fat_node_t *nodep = (fat_node_t *)node; 237 bool destroy = false; 237 238 238 239 futex_down(&nodep->lock); 239 240 if (!--nodep->refcnt) { 240 futex_down(&ffn_futex); 241 list_append(&nodep->ffn_link, &ffn_head); 242 futex_up(&ffn_futex); 241 if (nodep->idx) { 242 futex_down(&ffn_futex); 243 list_append(&nodep->ffn_link, &ffn_head); 244 futex_up(&ffn_futex); 245 } else { 246 /* 247 * The node does not have any index structure associated 248 * with itself. This can only mean that we are releasing 249 * the node after a failed attempt to allocate the index 250 * structure for it. 251 */ 252 destroy = true; 253 } 243 254 } 244 255 futex_up(&nodep->lock); 245 } 246 247 static void *fat_create(dev_handle_t dev_handle, int flags) 248 { 249 return NULL; /* not supported at the moment */ 250 } 251 252 static int fat_destroy(void *node) 256 if (destroy) 257 free(node); 258 } 259 260 static void *fat_create_node(dev_handle_t dev_handle, int flags) 261 { 262 fat_idx_t *idxp; 263 fat_node_t *nodep; 264 265 nodep = fat_node_get_new(); 266 if (!nodep) 267 return NULL; 268 idxp = fat_idx_get_new(dev_handle); 269 if (!idxp) { 270 fat_node_put(nodep); 271 return NULL; 272 } 273 /* idxp->lock held */ 274 if (flags & L_DIRECTORY) { 275 nodep->type = FAT_DIRECTORY; 276 } else { 277 nodep->type = FAT_FILE; 278 } 279 nodep->size = 0; 280 nodep->firstc = FAT_CLST_RES0; 281 nodep->lnkcnt = 0; /* not linked anywhere */ 282 nodep->refcnt = 1; 283 284 nodep->idx = idxp; 285 idxp->nodep = nodep; 286 287 futex_up(&idxp->lock); 288 return nodep; 289 } 290 291 static int fat_destroy_node(void *node) 253 292 { 254 293 return ENOTSUP; /* not supported at the moment */ … … 425 464 .node_get = fat_node_get, 426 465 .node_put = fat_node_put, 427 .create = fat_create ,428 .destroy = fat_destroy ,466 .create = fat_create_node, 467 .destroy = fat_destroy_node, 429 468 .link = fat_link, 430 469 .unlink = fat_unlink,
Note:
See TracChangeset
for help on using the changeset viewer.