Changes in uspace/srv/vfs/vfs.c [ffa2c8ef:852b801] in mainline


Ignore:
File:
1 edited

Legend:

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

    rffa2c8ef r852b801  
    3636 */
    3737
     38#include <ipc/ipc.h>
    3839#include <ipc/services.h>
    39 #include <ipc/ns.h>
    4040#include <async.h>
    4141#include <errno.h>
    4242#include <stdio.h>
    4343#include <bool.h>
    44 #include <str.h>
     44#include <string.h>
    4545#include <as.h>
    4646#include <atomic.h>
    4747#include "vfs.h"
    4848
    49 #define NAME  "vfs"
     49#define NAME "vfs"
    5050
    5151static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall)
     
    5757         * This call needs to be answered.
    5858         */
    59         async_answer_0(iid, EOK);
     59        ipc_answer_0(iid, EOK);
    6060       
     61        /*
     62         * Here we enter the main connection fibril loop.
     63         * The logic behind this loop and the protocol is that we'd like to keep
     64         * each connection open until the client hangs up. When the client hangs
     65         * up, we will free its VFS state. The act of hanging up the connection
     66         * by the client is equivalent to client termination because we cannot
     67         * distinguish one from the other. On the other hand, the client can
     68         * hang up arbitrarily if it has no open files and reestablish the
     69         * connection later.
     70         */
    6171        while (keep_on_going) {
    6272                ipc_call_t call;
    6373                ipc_callid_t callid = async_get_call(&call);
    6474               
    65                 switch (IPC_GET_IMETHOD(call)) {
     75                fs_handle_t fs_handle;
     76                int phone;
     77               
     78                switch (IPC_GET_METHOD(call)) {
    6679                case IPC_M_PHONE_HUNGUP:
    6780                        keep_on_going = false;
     
    7386                case VFS_IN_MOUNT:
    7487                        vfs_mount(callid, &call);
    75                         break;
    76                 case VFS_IN_UNMOUNT:
    77                         vfs_unmount(callid, &call);
    7888                        break;
    7989                case VFS_IN_OPEN:
     
    116126                        vfs_sync(callid, &call);
    117127                        break;
    118                 case VFS_IN_DUP:
    119                         vfs_dup(callid, &call);
    120128                default:
    121                         async_answer_0(callid, ENOTSUP);
     129                        ipc_answer_0(callid, ENOTSUP);
    122130                        break;
    123131                }
    124132        }
    125 
    126         /*
    127          * Open files for this client will be cleaned up when its last
    128          * connection fibril terminates.
    129          */
     133       
     134        /* TODO: cleanup after the client */
    130135}
    131136
     
    159164       
    160165        /*
    161          * Set client data constructor and destructor.
    162          */
    163         async_set_client_data_constructor(vfs_client_data_create);
    164         async_set_client_data_destructor(vfs_client_data_destroy);
    165 
    166         /*
    167166         * Set a connection handling function/fibril.
    168167         */
     
    172171         * Register at the naming service.
    173172         */
    174         if (service_register(SERVICE_VFS) != EOK) {
    175                 printf("%s: Cannot register VFS service\n", NAME);
    176                 return EINVAL;
    177         }
     173        ipcarg_t phonead;
     174        ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, 0, &phonead);
    178175       
    179176        /*
Note: See TracChangeset for help on using the changeset viewer.