Changeset 7b6d98b in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2008-03-05T22:11:57Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 739d00a
- Parents:
- 3ca7059
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r3ca7059 r7b6d98b 71 71 static void *tmpfs_create_node(int); 72 72 static bool tmpfs_link_node(void *, void *, const char *); 73 static int tmpfs_unlink_node(void * );73 static int tmpfs_unlink_node(void *, void *); 74 74 static void tmpfs_destroy_node(void *); 75 75 … … 171 171 { 172 172 dentry->index = 0; 173 dentry->parent = NULL;174 173 dentry->sibling = NULL; 175 174 dentry->child = NULL; … … 251 250 parentp->child = childp; 252 251 } 253 childp->parent = parentp;254 252 255 253 return true; 256 254 } 257 255 258 int tmpfs_unlink_node(void *nodeptr) 259 { 260 tmpfs_dentry_t *dentry = (tmpfs_dentry_t *)nodeptr; 261 262 if (dentry->child) 256 int tmpfs_unlink_node(void *prnt, void *chld) 257 { 258 tmpfs_dentry_t *parentp = (tmpfs_dentry_t *)prnt; 259 tmpfs_dentry_t *childp = (tmpfs_dentry_t *)chld; 260 261 if (!parentp) 262 return EBUSY; 263 264 if (childp->child) 263 265 return ENOTEMPTY; 264 266 265 if (!dentry->parent) 266 return EBUSY; 267 268 if (dentry->parent->child == dentry) { 269 dentry->parent->child = dentry->sibling; 267 if (parentp->child == childp) { 268 parentp->child = childp->sibling; 270 269 } else { 271 270 /* TODO: consider doubly linked list for organizing siblings. */ 272 tmpfs_dentry_t *tmp = dentry->parent->child;273 while (tmp->sibling != dentry)271 tmpfs_dentry_t *tmp = parentp->child; 272 while (tmp->sibling != childp) 274 273 tmp = tmp->sibling; 275 tmp->sibling = dentry->sibling; 276 } 277 dentry->sibling = NULL; 278 dentry->parent = NULL; 279 280 free(dentry->name); 281 dentry->name = NULL; 282 283 dentry->lnkcnt--; 274 tmp->sibling = childp->sibling; 275 } 276 childp->sibling = NULL; 277 278 free(childp->name); 279 childp->name = NULL; 280 281 childp->lnkcnt--; 284 282 285 283 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.