Changeset 16105cba in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2008-02-17T14:28:20Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e704503
Parents:
2616965d
Message:

Add TMPFS support for destroying leaf links in the file system namespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r2616965d r16105cba  
    188188static int destroy_component(void *nodeptr)
    189189{
    190         return EPERM;
     190        tmpfs_dentry_t *dentry = (tmpfs_dentry_t *)nodeptr;
     191
     192        if (dentry->child)
     193                return ENOTEMPTY;
     194
     195        if (!dentry->parent)
     196                return EBUSY;
     197
     198        if (dentry->parent->child == dentry) {
     199                dentry->parent->child = dentry->sibling;
     200        } else {
     201                /* TODO: consider doubly linked list for organizing siblings. */
     202                tmpfs_dentry_t *tmp = dentry->parent->child;
     203                while (tmp->sibling != dentry)
     204                        tmp = tmp->sibling;
     205                tmp->sibling = dentry->sibling;
     206        }
     207
     208        return EOK;
    191209}
    192210
     
    314332        if (lflag & L_DESTROY) {
    315333                int res = destroy_component(dcur);
    316                 ipc_answer_0(rid, res);
     334                unsigned lnkcnt = (res == EOK) ? 0 : TMPFS_GET_LNKCNT(dcur);
     335                ipc_answer_5(rid, (ipcarg_t)res, tmpfs_reg.fs_handle,
     336                    dev_handle, dcur->index, dcur->size, lnkcnt);
    317337                return;
    318338        }
Note: See TracChangeset for help on using the changeset viewer.