Changeset 1affcdf3 in mainline for uspace/srv/fs


Ignore:
Timestamp:
2011-06-10T19:33:41Z (15 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1878386
Parents:
13ecdac9 (diff), 79a141a (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

Location:
uspace/srv/fs
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/devfs/Makefile

    r13ecdac9 r1affcdf3  
    3232EXTRA_CFLAGS += -I$(LIBFS_PREFIX)
    3333BINARY = devfs
     34STATIC_NEEDED = y
    3435
    3536SOURCES = \
  • uspace/srv/fs/devfs/devfs.c

    r13ecdac9 r1affcdf3  
    4141#include <stdio.h>
    4242#include <ipc/services.h>
    43 #include <ipc/ns.h>
     43#include <ns.h>
    4444#include <async.h>
    4545#include <errno.h>
     
    6868                ipc_callid_t callid = async_get_call(&call);
    6969               
    70                 switch  (IPC_GET_IMETHOD(call)) {
    71                 case IPC_M_PHONE_HUNGUP:
     70                if (!IPC_GET_IMETHOD(call))
    7271                        return;
     72               
     73                switch (IPC_GET_IMETHOD(call)) {
    7374                case VFS_OUT_MOUNTED:
    7475                        devfs_mounted(callid, &call);
     
    119120int main(int argc, char *argv[])
    120121{
    121         printf(NAME ": HelenOS Device Filesystem\n");
     122        printf("%s: HelenOS Device Filesystem\n", NAME);
    122123       
    123124        if (!devfs_init()) {
    124                 printf(NAME ": failed to initialize devfs\n");
     125                printf("%s: failed to initialize devfs\n", NAME);
    125126                return -1;
    126127        }
    127128       
    128         int vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
    129         if (vfs_phone < EOK) {
    130                 printf(NAME ": Unable to connect to VFS\n");
     129        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     130            SERVICE_VFS, 0, 0);
     131        if (!vfs_sess) {
     132                printf("%s: Unable to connect to VFS\n", NAME);
    131133                return -1;
    132134        }
    133135       
    134         int rc = fs_register(vfs_phone, &devfs_reg, &devfs_vfs_info,
     136        int rc = fs_register(vfs_sess, &devfs_reg, &devfs_vfs_info,
    135137            devfs_connection);
    136138        if (rc != EOK) {
    137                 printf(NAME ": Failed to register file system (%d)\n", rc);
     139                printf("%s: Failed to register file system (%d)\n", NAME, rc);
    138140                return rc;
    139141        }
    140142       
    141         printf(NAME ": Accepting connections\n");
     143        printf("%s: Accepting connections\n", NAME);
    142144        task_retval(0);
    143145        async_manager();
  • uspace/srv/fs/devfs/devfs_ops.c

    r13ecdac9 r1affcdf3  
    5959typedef struct {
    6060        devmap_handle_t handle;
    61         int phone;              /**< When < 0, the structure is incomplete. */
     61        async_sess_t *sess;       /**< If NULL, the structure is incomplete. */
    6262        size_t refcount;
    6363        link_t link;
    64         fibril_condvar_t cv;    /**< Broadcast when completed. */
     64        fibril_condvar_t cv;      /**< Broadcast when completed. */
    6565} device_t;
    6666
     
    232232                };
    233233                link_t *lnk;
    234 
     234               
    235235                fibril_mutex_lock(&devices_mutex);
    236236restart:
     
    244244                       
    245245                        dev->handle = node->handle;
    246                         dev->phone = -1;        /* mark as incomplete */
     246                       
     247                        /* Mark as incomplete */
     248                        dev->sess = NULL;
    247249                        dev->refcount = 1;
    248250                        fibril_condvar_initialize(&dev->cv);
    249 
     251                       
    250252                        /*
    251253                         * Insert the incomplete device structure so that other
     
    254256                         */
    255257                        hash_table_insert(&devices, key, &dev->link);
    256 
     258                       
    257259                        /*
    258260                         * Drop the mutex to allow recursive devfs requests.
    259261                         */
    260262                        fibril_mutex_unlock(&devices_mutex);
    261 
    262                         int phone = devmap_device_connect(node->handle, 0);
    263 
     263                       
     264                        async_sess_t *sess = devmap_device_connect(EXCHANGE_SERIALIZE,
     265                            node->handle, 0);
     266                       
    264267                        fibril_mutex_lock(&devices_mutex);
    265 
     268                       
    266269                        /*
    267270                         * Notify possible waiters about this device structure
     
    269272                         */
    270273                        fibril_condvar_broadcast(&dev->cv);
    271 
    272                         if (phone < 0) {
     274                       
     275                        if (!sess) {
    273276                                /*
    274277                                 * Connecting failed, need to remove the
     
    277280                                hash_table_remove(&devices, key, DEVICES_KEYS);
    278281                                fibril_mutex_unlock(&devices_mutex);
    279 
     282                               
    280283                                return ENOENT;
    281284                        }
    282285                       
    283                         /* Set the correct phone. */
    284                         dev->phone = phone;
     286                        /* Set the correct session. */
     287                        dev->sess = sess;
    285288                } else {
    286289                        device_t *dev = hash_table_get_instance(lnk, device_t, link);
    287 
    288                         if (dev->phone < 0) {
     290                       
     291                        if (!dev->sess) {
    289292                                /*
    290293                                 * Wait until the device structure is completed
     
    608611               
    609612                device_t *dev = hash_table_get_instance(lnk, device_t, link);
    610                 assert(dev->phone >= 0);
     613                assert(dev->sess);
    611614               
    612615                ipc_callid_t callid;
     
    619622               
    620623                /* Make a request at the driver */
     624                async_exch_t *exch = async_exchange_begin(dev->sess);
     625               
    621626                ipc_call_t answer;
    622                 aid_t msg = async_send_3(dev->phone, IPC_GET_IMETHOD(*request),
     627                aid_t msg = async_send_3(exch, IPC_GET_IMETHOD(*request),
    623628                    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request),
    624629                    IPC_GET_ARG3(*request), &answer);
    625630               
    626631                /* Forward the IPC_M_DATA_READ request to the driver */
    627                 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     632                async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     633               
     634                async_exchange_end(exch);
     635               
    628636                fibril_mutex_unlock(&devices_mutex);
    629637               
     
    672680               
    673681                device_t *dev = hash_table_get_instance(lnk, device_t, link);
    674                 assert(dev->phone >= 0);
     682                assert(dev->sess);
    675683               
    676684                ipc_callid_t callid;
     
    683691               
    684692                /* Make a request at the driver */
     693                async_exch_t *exch = async_exchange_begin(dev->sess);
     694               
    685695                ipc_call_t answer;
    686                 aid_t msg = async_send_3(dev->phone, IPC_GET_IMETHOD(*request),
     696                aid_t msg = async_send_3(exch, IPC_GET_IMETHOD(*request),
    687697                    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request),
    688698                    IPC_GET_ARG3(*request), &answer);
    689699               
    690700                /* Forward the IPC_M_DATA_WRITE request to the driver */
    691                 async_forward_fast(callid, dev->phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     701                async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     702               
     703                async_exchange_end(exch);
    692704               
    693705                fibril_mutex_unlock(&devices_mutex);
     
    742754               
    743755                device_t *dev = hash_table_get_instance(lnk, device_t, link);
    744                 assert(dev->phone >= 0);
     756                assert(dev->sess);
    745757                dev->refcount--;
    746758               
    747759                if (dev->refcount == 0) {
    748                         async_hangup(dev->phone);
     760                        async_hangup(dev->sess);
    749761                        hash_table_remove(&devices, key, DEVICES_KEYS);
    750762                }
     
    790802               
    791803                device_t *dev = hash_table_get_instance(lnk, device_t, link);
    792                 assert(dev->phone >= 0);
     804                assert(dev->sess);
    793805               
    794806                /* Make a request at the driver */
     807                async_exch_t *exch = async_exchange_begin(dev->sess);
     808               
    795809                ipc_call_t answer;
    796                 aid_t msg = async_send_2(dev->phone, IPC_GET_IMETHOD(*request),
     810                aid_t msg = async_send_2(exch, IPC_GET_IMETHOD(*request),
    797811                    IPC_GET_ARG1(*request), IPC_GET_ARG2(*request), &answer);
     812               
     813                async_exchange_end(exch);
    798814               
    799815                fibril_mutex_unlock(&devices_mutex);
  • uspace/srv/fs/fat/Makefile

    r13ecdac9 r1affcdf3  
    3232EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
    3333BINARY = fat
     34STATIC_NEEDED = y
    3435
    3536SOURCES = \
  • uspace/srv/fs/fat/fat.c

    r13ecdac9 r1affcdf3  
    3939#include "fat.h"
    4040#include <ipc/services.h>
    41 #include <ipc/ns.h>
     41#include <ns.h>
    4242#include <async.h>
    4343#include <errno.h>
     
    8888       
    8989        dprintf(NAME ": connection opened\n");
    90         while (1) {
    91                 ipc_callid_t callid;
     90       
     91        while (true) {
    9292                ipc_call_t call;
    93        
    94                 callid = async_get_call(&call);
    95                 switch  (IPC_GET_IMETHOD(call)) {
    96                 case IPC_M_PHONE_HUNGUP:
     93                ipc_callid_t callid = async_get_call(&call);
     94               
     95                if (!IPC_GET_IMETHOD(call))
    9796                        return;
     97               
     98                switch (IPC_GET_IMETHOD(call)) {
    9899                case VFS_OUT_MOUNTED:
    99100                        fat_mounted(callid, &call);
     
    144145int main(int argc, char **argv)
    145146{
    146         int vfs_phone;
    147         int rc;
    148 
    149147        printf(NAME ": HelenOS FAT file system server\n");
    150 
    151         rc = fat_idx_init();
     148       
     149        int rc = fat_idx_init();
    152150        if (rc != EOK)
    153151                goto err;
    154 
    155         vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
    156         if (vfs_phone < EOK) {
     152       
     153        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     154            SERVICE_VFS, 0, 0);
     155        if (!vfs_sess) {
    157156                printf(NAME ": failed to connect to VFS\n");
    158157                return -1;
    159158        }
    160159       
    161         rc = fs_register(vfs_phone, &fat_reg, &fat_vfs_info, fat_connection);
     160        rc = fs_register(vfs_sess, &fat_reg, &fat_vfs_info, fat_connection);
    162161        if (rc != EOK) {
    163162                fat_idx_fini();
     
    168167        task_retval(0);
    169168        async_manager();
    170         /* not reached */
     169       
     170        /* Not reached */
    171171        return 0;
    172 
     172       
    173173err:
    174174        printf(NAME ": Failed to register file system (%d)\n", rc);
     
    178178/**
    179179 * @}
    180  */ 
     180 */
  • uspace/srv/fs/fat/fat_ops.c

    r13ecdac9 r1affcdf3  
    970970
    971971        /* initialize libblock */
    972         rc = block_init(devmap_handle, BS_SIZE);
     972        rc = block_init(EXCHANGE_SERIALIZE, devmap_handle, BS_SIZE);
    973973        if (rc != EOK) {
    974974                async_answer_0(rid, rc);
  • uspace/srv/fs/minixfs/mfs.c

    r13ecdac9 r1affcdf3  
    4141
    4242#include <ipc/services.h>
    43 #include <ipc/ns.h>
     43#include <ns.h>
    4444#include <async.h>
    4545#include <errno.h>
     
    4747#include <task.h>
    4848#include <stdio.h>
     49#include <libfs.h>
    4950#include "mfs.h"
    5051
     
    9697                /*mfsdebug(NAME "method = %d\n", method);*/
    9798                switch  (method) {
    98                 case IPC_M_PHONE_HUNGUP:
    99                         return;
    10099                case VFS_OUT_MOUNTED:
    101100                        mfs_mounted(callid, &call);
     
    135134int main(int argc, char **argv)
    136135{
    137         int vfs_phone;
    138136        int rc;
    139137
    140138        printf(NAME ": HelenOS Minix file system server\n");
    141139
    142         vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
     140        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     141                                SERVICE_VFS, 0, 0);
    143142
    144         if (vfs_phone < EOK) {
     143        if (!vfs_sess) {
    145144                printf(NAME ": failed to connect to VFS\n");
    146145                return -1;
    147146        }
    148147
    149         rc = fs_register(vfs_phone, &mfs_reg, &mfs_vfs_info, mfs_connection);
     148        rc = fs_register(vfs_sess, &mfs_reg, &mfs_vfs_info, mfs_connection);
    150149        if (rc != EOK)
    151150                goto err;
  • uspace/srv/fs/minixfs/mfs_ops.c

    r13ecdac9 r1affcdf3  
    113113
    114114        /* initialize libblock */
    115         rc = block_init(devmap_handle, 1024);
     115        rc = block_init(EXCHANGE_SERIALIZE, devmap_handle, 1024);
    116116        if (rc != EOK) {
    117117                mfsdebug("libblock initialization failed\n");
  • uspace/srv/fs/tmpfs/Makefile

    r13ecdac9 r1affcdf3  
    3232EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
    3333BINARY = tmpfs
     34STATIC_NEEDED = y
    3435
    3536SOURCES = \
  • uspace/srv/fs/tmpfs/tmpfs.c

    r13ecdac9 r1affcdf3  
    3030/** @addtogroup fs
    3131 * @{
    32  */ 
     32 */
    3333
    3434/**
     
    4343#include "tmpfs.h"
    4444#include <ipc/services.h>
    45 #include <ipc/ns.h>
     45#include <ns.h>
    4646#include <async.h>
    4747#include <errno.h>
     
    9494       
    9595        dprintf(NAME ": connection opened\n");
    96         while (1) {
    97                 ipc_callid_t callid;
     96       
     97        while (true) {
    9898                ipc_call_t call;
    99        
    100                 callid = async_get_call(&call);
    101                 switch  (IPC_GET_IMETHOD(call)) {
    102                 case IPC_M_PHONE_HUNGUP:
     99                ipc_callid_t callid = async_get_call(&call);
     100               
     101                if (!IPC_GET_IMETHOD(call))
    103102                        return;
     103               
     104                switch (IPC_GET_IMETHOD(call)) {
    104105                case VFS_OUT_MOUNTED:
    105106                        tmpfs_mounted(callid, &call);
     
    151152{
    152153        printf(NAME ": HelenOS TMPFS file system server\n");
    153 
     154       
    154155        if (!tmpfs_init()) {
    155156                printf(NAME ": failed to initialize TMPFS\n");
    156157                return -1;
    157158        }
    158 
    159         int vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0);
    160         if (vfs_phone < EOK) {
     159       
     160        async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE,
     161            SERVICE_VFS, 0, 0);
     162        if (!vfs_sess) {
    161163                printf(NAME ": Unable to connect to VFS\n");
    162164                return -1;
    163165        }
    164 
    165         int rc = fs_register(vfs_phone, &tmpfs_reg, &tmpfs_vfs_info,
     166       
     167        int rc = fs_register(vfs_sess, &tmpfs_reg, &tmpfs_vfs_info,
    166168            tmpfs_connection);
    167169        if (rc != EOK) {
     
    169171                return rc;
    170172        }
    171 
     173       
    172174        printf(NAME ": Accepting connections\n");
    173175        task_retval(0);
    174176        async_manager();
    175         /* not reached */
     177       
     178        /* Not reached */
    176179        return 0;
    177180}
     
    179182/**
    180183 * @}
    181  */ 
     184 */
  • uspace/srv/fs/tmpfs/tmpfs_dump.c

    r13ecdac9 r1affcdf3  
    167167        int rc;
    168168
    169         rc = block_init(dev, TMPFS_COMM_SIZE);
     169        rc = block_init(EXCHANGE_SERIALIZE, dev, TMPFS_COMM_SIZE);
    170170        if (rc != EOK)
    171171                return false;
Note: See TracChangeset for help on using the changeset viewer.