Changeset 03bc76a in mainline for uspace/srv/fs/minixfs/mfs.c


Ignore:
Timestamp:
2011-09-04T12:33:10Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c699b0c
Parents:
8ff0bd2
Message:

Get rid of VFS_OUT method switch and IPC unmarshalling

File:
1 edited

Legend:

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

    r8ff0bd2 r03bc76a  
    3838 */
    3939
    40 #define _MAIN
    41 
    4240#include <ipc/services.h>
    4341#include <ns.h>
     
    5553        .write_retains_size = false,
    5654};
    57 
    58 
    59 /**
    60  * This connection fibril processes VFS requests from VFS.
    61  *
    62  * In order to support simultaneous VFS requests, our design is as follows.
    63  * The connection fibril accepts VFS requests from VFS. If there is only one
    64  * instance of the fibril, VFS will need to serialize all VFS requests it sends
    65  * to MinixFS. To overcome this bottleneck, VFS can send MinixFS the IPC_M_CONNECT_ME_TO
    66  * call. In that case, a new connection fibril will be created, which in turn
    67  * will accept the call. Thus, a new phone will be opened for VFS.
    68  *
    69  * There are few issues with this arrangement. First, VFS can run out of
    70  * available phones. In that case, VFS can close some other phones or use one
    71  * phone for more serialized requests. Similarily, MinixFS can refuse to duplicate
    72  * the connection. VFS should then just make use of already existing phones and
    73  * route its requests through them. To avoid paying the fibril creation price
    74  * upon each request, MinixFS might want to keep the connections open after the
    75  * request has been completed.
    76  */
    77 
    78 static void mfs_connection(ipc_callid_t iid, ipc_call_t *icall)
    79 {
    80         if (iid) {
    81                 /*
    82                  * This only happens for connections opened by
    83                  * IPC_M_CONNECT_ME_TO calls as opposed to callback connections
    84                  * created by IPC_M_CONNECT_TO_ME.
    85                  */
    86                 async_answer_0(iid, EOK);
    87         }
    88 
    89         while (1) {
    90                 ipc_callid_t callid;
    91                 ipc_call_t call;
    92 
    93                 callid = async_get_call(&call);
    94                 int method = IPC_GET_IMETHOD(call);
    95 
    96                 /*mfsdebug(NAME "method = %d\n", method);*/
    97                 switch  (method) {
    98                 case VFS_OUT_MOUNTED:
    99                         mfs_mounted(callid, &call);
    100                         break;
    101                 case VFS_OUT_MOUNT:
    102                         mfs_mount(callid, &call);
    103                         break;
    104                 case VFS_OUT_STAT:
    105                         mfs_stat(callid, &call);
    106                         break;
    107                 case VFS_OUT_LOOKUP:
    108                         mfs_lookup(callid, &call);
    109                         break;
    110                 case VFS_OUT_READ:
    111                         mfs_read(callid, &call);
    112                         break;
    113                 case VFS_OUT_OPEN_NODE:
    114                         mfs_open_node(callid, &call);
    115                         break;
    116                 case VFS_OUT_CLOSE:
    117                         mfs_close(callid, &call);
    118                         break;
    119                 case VFS_OUT_WRITE:
    120                         mfs_write(callid, &call);
    121                         break;
    122                 case VFS_OUT_TRUNCATE:
    123                         mfs_truncate(callid, &call);
    124                         break;
    125                 case VFS_OUT_DESTROY:
    126                         mfs_destroy(callid, &call);
    127                         break;
    128                 case VFS_OUT_UNMOUNTED:
    129                         mfs_unmounted(callid, &call);
    130                         break;
    131                 case VFS_OUT_UNMOUNT:
    132                         mfs_unmount(callid, &call);
    133                         break;
    134                 case VFS_OUT_SYNC:
    135                         mfs_sync(callid, &call);
    136                         break;
    137                 default:
    138                         async_answer_0(callid, ENOTSUP);
    139                         break;
    140                 }
    141         }
    142 }
    143 
    14455
    14556int main(int argc, char **argv)
     
    16374        }
    16475
    165         rc = fs_register(vfs_sess, &mfs_reg, &mfs_vfs_info, mfs_connection);
     76        rc = fs_register(vfs_sess, &mfs_vfs_info, &mfs_ops, &mfs_libfs_ops);
    16677        if (rc != EOK)
    16778                goto err;
Note: See TracChangeset for help on using the changeset viewer.