Changeset d8af1bd in mainline


Ignore:
Timestamp:
2011-06-25T11:36:18Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
38b7233
Parents:
53eb588
Message:

Minixfs file deletion feature is complete but not yet stable.

Location:
uspace/srv/fs/minixfs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/minixfs/mfs.c

    r53eb588 rd8af1bd  
    124124                        mfs_truncate(callid, &call);
    125125                        break;
     126                case VFS_OUT_DESTROY:
     127                        mfs_destroy(callid, &call);
     128                        break;
    126129                default:
    127130                        async_answer_0(callid, ENOTSUP);
  • uspace/srv/fs/minixfs/mfs.h

    r53eb588 rd8af1bd  
    174174mfs_truncate(ipc_callid_t rid, ipc_call_t *request);
    175175
     176extern void
     177mfs_destroy(ipc_callid_t rid, ipc_call_t *request);
     178
    176179/*mfs_inode.c*/
    177180extern int
  • uspace/srv/fs/minixfs/mfs_ops.c

    r53eb588 rd8af1bd  
    5757static int mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name);
    5858static int mfs_unlink(fs_node_t *, fs_node_t *, const char *name);
     59static int mfs_destroy_node(fs_node_t *fn);
    5960
    6061static int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle,
     
    7980        .link = mfs_link,
    8081        .unlink = mfs_unlink,
     82        .destroy = mfs_destroy_node,
    8183        .plb_get_char = mfs_plb_get_char,
    8284        .has_children = mfs_has_children,
     
    819821
    820822void
     823mfs_destroy(ipc_callid_t rid, ipc_call_t *request)
     824{
     825        devmap_handle_t handle = (devmap_handle_t)IPC_GET_ARG1(*request);
     826        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
     827        fs_node_t *fn;
     828        int r;
     829
     830        r = mfs_node_get(&fn, handle, index);
     831        if (r != EOK) {
     832                async_answer_0(rid, r);
     833                return;
     834        }
     835        if (!fn) {
     836                async_answer_0(rid, ENOENT);
     837                return;
     838        }
     839
     840        /*Destroy the inode*/
     841        r = mfs_destroy_node(fn);
     842        async_answer_0(rid, r);
     843}
     844
     845static int
     846mfs_destroy_node(fs_node_t *fn)
     847{
     848        struct mfs_node *mnode = fn->data;
     849        bool has_children;
     850        int r;
     851
     852        r = mfs_has_children(&has_children, fn);
     853        on_error(r, return r);
     854
     855        assert(!has_children);
     856
     857        /*Free the entire inode content*/
     858        r = inode_shrink(mnode, mnode->ino_i->i_size);
     859        on_error(r, return r);
     860        r = mfs_free_bit(mnode->instance, mnode->ino_i->index, BMAP_INODE);
     861        on_error(r, return r);
     862
     863        free(mnode->ino_i);
     864        free(mnode);
     865        return r;
     866}
     867
     868void
    821869mfs_truncate(ipc_callid_t rid, ipc_call_t *request)
    822870{
Note: See TracChangeset for help on using the changeset viewer.