Changeset bd5f3b7 in mainline for uspace/srv/fs/tmpfs/tmpfs.c


Ignore:
Timestamp:
2011-08-21T13:07:35Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
00aece0, f1a9e87
Parents:
86a34d3e (diff), a6480d5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r86a34d3e rbd5f3b7  
    6161};
    6262
    63 fs_reg_t tmpfs_reg;
    64 
    65 /**
    66  * This connection fibril processes VFS requests from VFS.
    67  *
    68  * In order to support simultaneous VFS requests, our design is as follows.
    69  * The connection fibril accepts VFS requests from VFS. If there is only one
    70  * instance of the fibril, VFS will need to serialize all VFS requests it sends
    71  * to FAT. To overcome this bottleneck, VFS can send TMPFS the
    72  * IPC_M_CONNECT_ME_TO call. In that case, a new connection fibril will be
    73  * created, which in turn will accept the call. Thus, a new phone will be
    74  * opened for VFS.
    75  *
    76  * There are few issues with this arrangement. First, VFS can run out of
    77  * available phones. In that case, VFS can close some other phones or use one
    78  * phone for more serialized requests. Similarily, TMPFS can refuse to duplicate
    79  * the connection. VFS should then just make use of already existing phones and
    80  * route its requests through them. To avoid paying the fibril creation price
    81  * upon each request, TMPFS might want to keep the connections open after the
    82  * request has been completed.
    83  */
    84 static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    85 {
    86         if (iid) {
    87                 /*
    88                  * This only happens for connections opened by
    89                  * IPC_M_CONNECT_ME_TO calls as opposed to callback connections
    90                  * created by IPC_M_CONNECT_TO_ME.
    91                  */
    92                 async_answer_0(iid, EOK);
    93         }
    94        
    95         dprintf(NAME ": connection opened\n");
    96        
    97         while (true) {
    98                 ipc_call_t call;
    99                 ipc_callid_t callid = async_get_call(&call);
    100                
    101                 if (!IPC_GET_IMETHOD(call))
    102                         return;
    103                
    104                 switch (IPC_GET_IMETHOD(call)) {
    105                 case VFS_OUT_MOUNTED:
    106                         tmpfs_mounted(callid, &call);
    107                         break;
    108                 case VFS_OUT_MOUNT:
    109                         tmpfs_mount(callid, &call);
    110                         break;
    111                 case VFS_OUT_UNMOUNTED:
    112                         tmpfs_unmounted(callid, &call);
    113                         break;
    114                 case VFS_OUT_UNMOUNT:
    115                         tmpfs_unmount(callid, &call);
    116                         break;
    117                 case VFS_OUT_LOOKUP:
    118                         tmpfs_lookup(callid, &call);
    119                         break;
    120                 case VFS_OUT_READ:
    121                         tmpfs_read(callid, &call);
    122                         break;
    123                 case VFS_OUT_WRITE:
    124                         tmpfs_write(callid, &call);
    125                         break;
    126                 case VFS_OUT_TRUNCATE:
    127                         tmpfs_truncate(callid, &call);
    128                         break;
    129                 case VFS_OUT_CLOSE:
    130                         tmpfs_close(callid, &call);
    131                         break;
    132                 case VFS_OUT_DESTROY:
    133                         tmpfs_destroy(callid, &call);
    134                         break;
    135                 case VFS_OUT_OPEN_NODE:
    136                         tmpfs_open_node(callid, &call);
    137                         break;
    138                 case VFS_OUT_STAT:
    139                         tmpfs_stat(callid, &call);
    140                         break;
    141                 case VFS_OUT_SYNC:
    142                         tmpfs_sync(callid, &call);
    143                         break;
    144                 default:
    145                         async_answer_0(callid, ENOTSUP);
    146                         break;
    147                 }
    148         }
    149 }
    150 
    15163int main(int argc, char **argv)
    15264{
     
    16577        }
    16678       
    167         int rc = fs_register(vfs_sess, &tmpfs_reg, &tmpfs_vfs_info,
    168             tmpfs_connection);
     79        int rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
     80            &tmpfs_libfs_ops);
    16981        if (rc != EOK) {
    17082                printf(NAME ": Failed to register file system (%d)\n", rc);
Note: See TracChangeset for help on using the changeset viewer.