Changeset 7b6d98b in mainline
- 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
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libfs/libfs.c
r3ca7059 r7b6d98b 146 146 last += PLB_SIZE; 147 147 148 void *par = NULL; 148 149 void *cur = ops->root_get(); 149 150 void *tmp = ops->child_get(cur); … … 207 208 208 209 /* descend one level */ 210 par = cur; 209 211 cur = tmp; 210 212 tmp = ops->child_get(tmp); … … 261 263 if (lflag & L_DESTROY) { 262 264 unsigned old_lnkcnt = ops->lnkcnt_get(cur); 263 int res = ops->unlink( cur);265 int res = ops->unlink(par, cur); 264 266 ipc_answer_5(rid, (ipcarg_t)res, fs_handle, dev_handle, 265 267 ops->index_get(cur), ops->size_get(cur), old_lnkcnt); -
uspace/lib/libfs/libfs.h
r3ca7059 r7b6d98b 47 47 void (* destroy)(void *); 48 48 bool (* link)(void *, void *, const char *); 49 int (* unlink)(void * );49 int (* unlink)(void *, void *); 50 50 unsigned long (* index_get)(void *); 51 51 unsigned long (* size_get)(void *); -
uspace/srv/fs/tmpfs/tmpfs.h
r3ca7059 r7b6d98b 46 46 unsigned long index; /**< TMPFS node index. */ 47 47 link_t dh_link; /**< Dentries hash table link. */ 48 struct tmpfs_dentry *parent;49 48 struct tmpfs_dentry *sibling; 50 49 struct tmpfs_dentry *child; -
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.