Changeset f17667a in mainline for uspace/srv/fs/tmpfs


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

Add the VFS_FREE operation. This operation frees up whatever resources used by
a file system node for which there is no name (i.e. an unlinked node).

Cleanup VFS operations enums and remove unneeded VFS operations.

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

Legend:

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

    rb5553a2 rf17667a  
    5656        .ops = {
    5757                [IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] = VFS_OP_DEFINED,
    58                 [IPC_METHOD_TO_VFS_OP(VFS_OPEN)] = VFS_OP_DEFINED,
    59                 [IPC_METHOD_TO_VFS_OP(VFS_CLOSE)] = VFS_OP_DEFINED,
    6058                [IPC_METHOD_TO_VFS_OP(VFS_READ)] = VFS_OP_DEFINED,
    6159                [IPC_METHOD_TO_VFS_OP(VFS_WRITE)] = VFS_OP_DEFINED,
    62                 [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_NULL,
    63                 [IPC_METHOD_TO_VFS_OP(VFS_RENAME)] = VFS_OP_NULL,
    64                 [IPC_METHOD_TO_VFS_OP(VFS_OPENDIR)] = VFS_OP_NULL,
    65                 [IPC_METHOD_TO_VFS_OP(VFS_READDIR)] = VFS_OP_NULL,
    66                 [IPC_METHOD_TO_VFS_OP(VFS_CLOSEDIR)] = VFS_OP_NULL,
    67                 [IPC_METHOD_TO_VFS_OP(VFS_UNLINK)] = VFS_OP_NULL,
     60                [IPC_METHOD_TO_VFS_OP(VFS_TRUNCATE)] = VFS_OP_DEFINED,
    6861                [IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_NULL,
    6962                [IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL,
     63                [IPC_METHOD_TO_VFS_OP(VFS_FREE)] = VFS_OP_DEFINED,
    7064        }
    7165};
     
    119113                        tmpfs_write(callid, &call);
    120114                        break;
     115                case VFS_TRUNCATE:
     116                        tmpfs_truncate(callid, &call);
     117                        break;
     118                case VFS_FREE:
     119                        tmpfs_free(callid, &call);
     120                        break;
    121121                default:
    122122                        ipc_answer_0(callid, ENOTSUP);
  • uspace/srv/fs/tmpfs/tmpfs.h

    rb5553a2 rf17667a  
    6565extern void tmpfs_write(ipc_callid_t, ipc_call_t *);
    6666extern void tmpfs_truncate(ipc_callid_t, ipc_call_t *);
     67extern void tmpfs_free(ipc_callid_t, ipc_call_t *);
    6768
    6869#endif
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    rb5553a2 rf17667a  
    497497}
    498498
     499void tmpfs_free(ipc_callid_t rid, ipc_call_t *request)
     500{
     501        int dev_handle = IPC_GET_ARG1(*request);
     502        unsigned long index = IPC_GET_ARG2(*request);
     503
     504        link_t *hlp;
     505        hlp = hash_table_find(&dentries, &index);
     506        if (!hlp) {
     507                ipc_answer_0(rid, ENOENT);
     508                return;
     509        }
     510        tmpfs_dentry_t *dentry = hash_table_get_instance(hlp, tmpfs_dentry_t,
     511            dh_link);
     512       
     513        assert(!dentry->parent);
     514        assert(!dentry->child);
     515        assert(!dentry->sibling);
     516
     517        if (dentry->type == TMPFS_FILE)
     518                free(dentry->data);
     519        free(dentry->name);
     520        free(dentry);
     521
     522        ipc_answer_0(rid, EOK);
     523}
     524
    499525/**
    500526 * @}
Note: See TracChangeset for help on using the changeset viewer.