Changeset b3f598e in mainline


Ignore:
Timestamp:
2007-09-13T20:19:40Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
183b4a0
Parents:
c952465d
Message:

VFS work.
Start implementing the VFS_REGISTER request.

Location:
uspace/srv/vfs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs.c

    rc952465d rb3f598e  
    4242#include "vfs.h"
    4343
     44static void vfs_register(ipc_callid_t iid, ipc_call_t *icall)
     45{
     46        ipc_callid_t callid;
     47        ipc_call_t call;
     48
     49        callid = async_get_call(&call);
     50        if (IPC_GET_METHOD(call) == IPC_M_DATA_SEND) {
     51                size_t size = IPC_GET_ARG3(call);
     52                if (size != sizeof(vfs_info_t)) {
     53                        /*
     54                         * The client is sending us something, which cannot be
     55                         * the info structure.
     56                         */
     57                        ipc_answer_fast(iid, EINVAL, 0, 0);
     58                        ipc_answer_fast(callid, EINVAL, 0, 0);
     59                        return;
     60                }
     61                /*
     62                 * XXX: continue here
     63                 * Allocate an info structue, answer the call, check sanity
     64                 * of the copied-in info structure, ...
     65                 */
     66        } else {
     67                /*
     68                 * The client doesn't obey the same protocol as we do.
     69                 */
     70                ipc_answer_fast(iid, EINVAL, 0, 0);
     71                ipc_answer_fast(callid, EINVAL, 0, 0);
     72                return;
     73        }
     74}
     75
    4476static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall)
    4577{
     
    6597        switch (iarg1) {
    6698        case VFS_REGISTER:
     99                vfs_register(iid, icall);
     100                break;
    67101        case VFS_MOUNT:
    68102        case VFS_UNMOUNT:
  • uspace/srv/vfs/vfs.h

    rc952465d rb3f598e  
    3535
    3636typedef enum {
    37         VFS_REGISTER = 1,
     37        VFS_REGISTER = 0,
    3838        VFS_MOUNT,
    3939        VFS_UNMOUNT,
    40         VFS_OPEN
     40        VFS_OPEN,
     41        VFS_LAST,               /* keep this the last member of the enum */
    4142} vfs_request_t;
     43
     44
     45/**
     46 * An instance of this structure is associated with a particular FS operation.
     47 * It tells VFS if the FS supports the operation or maybe if a default one
     48 * should be used.
     49 */
     50typedef enum {
     51        VFS_OP_NOTSUP = 0,
     52        VFS_OP_DEFAULT,
     53        VFS_OP_DEFINED
     54} vfs_op_t;
     55
     56#define FS_NAME_MAXLEN  20
     57
     58/**
     59 * A structure like this is passed to VFS by each individual FS upon its
     60 * registration. It assosiates a human-readable identifier with each
     61 * registered FS. More importantly, through this structure, the FS announces
     62 * what operations it supports.
     63 */
     64typedef struct {
     65        char fs_name[FS_NAME_MAXLEN];   /**< Unique identifier of the fs. */
     66        vfs_op_t ops[VFS_LAST];         /**< Operations. */
     67} vfs_info_t;
    4268
    4369#endif
Note: See TracChangeset for help on using the changeset viewer.