Subversion Repositories HelenOS

Rev

Rev 2518 | Rev 2521 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2007 Jakub Jermar
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup fs
  30.  * @{
  31.  */
  32.  
  33. /**
  34.  * @file    vfs.c
  35.  * @brief   VFS multiplexer for HelenOS.
  36.  */
  37.  
  38. #include <ipc/ipc.h>
  39. #include <ipc/services.h>
  40. #include <async.h>
  41. #include <errno.h>
  42. #include "vfs.h"
  43.  
  44. static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall)
  45. {
  46.     ipcarg_t iarg1, iarg2;
  47.  
  48.     /*
  49.      * The connection was opened via the IPC_CONNECT_ME_TO call.
  50.      * This call needs to be answered.
  51.      *
  52.      * The protocol is that the requested action is specified in ARG1
  53.      * of the opening call. If the request has a single integer argument,
  54.      * it is passed in ARG2.
  55.      */
  56.     iarg1 = IPC_GET_ARG1(*icall);
  57.     iarg2 = IPC_GET_ARG2(*icall);
  58.  
  59.     /*
  60.      * Now, the connection can either be from an individual FS,
  61.      * which is trying to register itself and pass us its capabilities.
  62.      * Or, the connection is a regular connection from a client that wants
  63.      * us to do something for it (e.g. open a file, mount a fs etc.).
  64.      */
  65.     switch (iarg1) {
  66.     case VFS_REGISTER:
  67.     case VFS_MOUNT:
  68.     case VFS_UNMOUNT:
  69.     case VFS_OPEN:
  70.     default:
  71.         ipc_answer_fast(iid, ENOTSUP, 0, 0);
  72.         break;
  73.     }
  74. }
  75.  
  76. int main(int argc, char **argv)
  77. {
  78.     ipcarg_t phonead;
  79.  
  80.     async_set_client_connection(vfs_connection);
  81.     ipc_connect_to_me(PHONE_NS, SERVICE_VFS, 0, &phonead);
  82.     async_manager();
  83.     return 0;
  84. }
  85.  
  86. /**
  87.  * @}
  88.  */
  89.