Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 01900b6 in mainline


Ignore:
Timestamp:
2020-01-21T15:10:26Z (8 months ago)
Author:
Martin Decky <martin@…>
Branches:
master
Children:
51da086
Parents:
f8fb03b
Message:

Use an optional output argument instead of errno to propagate the error

The use of errno is troublesome in all other than top-level library
functions since the value in errno might get overwritten by subsequent
inner calls on the error path (e.g. cleanup, deallocation, etc.). The
optional output argument makes it possible to explicitly ignore the
error code if it is not needed, but still to pass it reliably back to
the original caller.

This change affecs async_connect_me_to(),
async_connect_me_to_blocking(), async_connect_kbox(), service_connect(),
service_connect_blocking() and loader_connect().

Location:
uspace
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskdump/taskdump.c

    rf8fb03b r01900b6  
    126126static errno_t connect_task(task_id_t task_id)
    127127{
    128         async_sess_t *ksess = async_connect_kbox(task_id);
     128        errno_t rc;
     129        async_sess_t *ksess = async_connect_kbox(task_id, &rc);
    129130
    130131        if (!ksess) {
    131                 if (errno == ENOTSUP) {
     132                if (rc == ENOTSUP) {
    132133                        printf("You do not have userspace debugging support "
    133134                            "compiled in the kernel.\n");
    134135                        printf("Compile kernel with 'Support for userspace debuggers' "
    135136                            "(CONFIG_UDEBUG) enabled.\n");
    136                         return errno;
     137                        return rc;
    137138                }
    138139
    139140                printf("Error connecting\n");
    140141                printf("async_connect_kbox(%" PRIu64 ") -> %s", task_id, str_error_name(errno));
    141                 return errno;
    142         }
    143 
    144         errno_t rc = udebug_begin(ksess);
     142                return rc;
     143        }
     144
     145        rc = udebug_begin(ksess);
    145146        if (rc != EOK) {
    146147                printf("udebug_begin() -> %s\n", str_error_name(rc));
  • uspace/app/tester/mm/pager1.c

    rf8fb03b r01900b6  
    6565        TPRINTF("Connecting to VFS pager...\n");
    6666
    67         vfs_pager_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_PAGER, 0);
     67        vfs_pager_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_PAGER,
     68            0, NULL);
    6869
    6970        if (!vfs_pager_sess) {
  • uspace/app/trace/trace.c

    rf8fb03b r01900b6  
    139139
    140140        if (sess == NULL) {
    141                 sess = async_connect_kbox(task_id);
     141                sess = async_connect_kbox(task_id, &rc);
    142142                if (sess == NULL) {
    143143                        printf("Error connecting to task %" PRIu64 ".\n",
    144144                            task_id);
    145                         rc = EIO;
    146145                        goto error;
    147146                }
  • uspace/lib/c/generic/async/client.c

    rf8fb03b r01900b6  
    889889 * @param arg2  User defined argument.
    890890 * @param arg3  User defined argument.
     891 * @param rc    Placeholder for return code. Unused if NULL.
    891892 *
    892893 * @return New session on success or NULL on error.
     
    894895 */
    895896async_sess_t *async_connect_me_to(async_exch_t *exch, iface_t iface,
    896     sysarg_t arg2, sysarg_t arg3)
     897    sysarg_t arg2, sysarg_t arg3, errno_t *rc)
    897898{
    898899        if (exch == NULL) {
    899                 errno = ENOENT;
     900                if (rc != NULL)
     901                        *rc = ENOENT;
     902
    900903                return NULL;
    901904        }
     
    903906        async_sess_t *sess = calloc(1, sizeof(async_sess_t));
    904907        if (sess == NULL) {
    905                 errno = ENOMEM;
     908                if (rc != NULL)
     909                        *rc = ENOMEM;
     910
    906911                return NULL;
    907912        }
    908913
    909914        cap_phone_handle_t phone;
    910         errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
     915        errno_t ret = async_connect_me_to_internal(exch->phone, iface, arg2,
    911916            arg3, 0, &phone);
    912         if (rc != EOK) {
    913                 errno = rc;
     917        if (ret != EOK) {
     918                if (rc != NULL)
     919                        *rc = ret;
     920
    914921                free(sess);
    915922                return NULL;
     
    957964 * @param arg2  User defined argument.
    958965 * @param arg3  User defined argument.
     966 * @param rc    Placeholder for return code. Unused if NULL.
    959967 *
    960968 * @return New session on success or NULL on error.
     
    962970 */
    963971async_sess_t *async_connect_me_to_blocking(async_exch_t *exch, iface_t iface,
    964     sysarg_t arg2, sysarg_t arg3)
     972    sysarg_t arg2, sysarg_t arg3, errno_t *rc)
    965973{
    966974        if (exch == NULL) {
    967                 errno = ENOENT;
     975                if (rc != NULL)
     976                        *rc = ENOENT;
     977
    968978                return NULL;
    969979        }
     
    971981        async_sess_t *sess = calloc(1, sizeof(async_sess_t));
    972982        if (sess == NULL) {
    973                 errno = ENOMEM;
     983                if (rc != NULL)
     984                        *rc = ENOMEM;
     985
    974986                return NULL;
    975987        }
    976988
    977989        cap_phone_handle_t phone;
    978         errno_t rc = async_connect_me_to_internal(exch->phone, iface, arg2,
     990        errno_t ret = async_connect_me_to_internal(exch->phone, iface, arg2,
    979991            arg3, IPC_FLAG_BLOCKING, &phone);
    980         if (rc != EOK) {
    981                 errno = rc;
     992        if (ret != EOK) {
     993                if (rc != NULL)
     994                        *rc = ret;
     995
    982996                free(sess);
    983997                return NULL;
     
    9991013/** Connect to a task specified by id.
    10001014 *
    1001  */
    1002 async_sess_t *async_connect_kbox(task_id_t id)
     1015 * @param id Task to which to connect.
     1016 * @param rc Placeholder for return code. Unused if NULL.
     1017 *
     1018 * @return New session on success or NULL on error.
     1019 *
     1020 */
     1021async_sess_t *async_connect_kbox(task_id_t id, errno_t *rc)
    10031022{
    10041023        async_sess_t *sess = calloc(1, sizeof(async_sess_t));
    10051024        if (sess == NULL) {
    1006                 errno = ENOMEM;
     1025                if (rc != NULL)
     1026                        *rc = ENOMEM;
     1027
    10071028                return NULL;
    10081029        }
    10091030
    10101031        cap_phone_handle_t phone;
    1011         errno_t rc = ipc_connect_kbox(id, &phone);
    1012         if (rc != EOK) {
    1013                 errno = rc;
     1032        errno_t ret = ipc_connect_kbox(id, &phone);
     1033        if (ret != EOK) {
     1034                if (rc != NULL)
     1035                        *rc = ret;
     1036
    10141037                free(sess);
    10151038                return NULL;
  • uspace/lib/c/generic/devman.c

    rf8fb03b r01900b6  
    8989                                devman_driver_block_sess =
    9090                                    service_connect_blocking(SERVICE_DEVMAN,
    91                                     INTERFACE_DDF_DRIVER, 0);
     91                                    INTERFACE_DDF_DRIVER, 0, NULL);
    9292                }
    9393
     
    108108                                devman_client_block_sess =
    109109                                    service_connect_blocking(SERVICE_DEVMAN,
    110                                     INTERFACE_DDF_CLIENT, 0);
     110                                    INTERFACE_DDF_CLIENT, 0, NULL);
    111111                }
    112112
     
    138138                        devman_driver_sess =
    139139                            service_connect(SERVICE_DEVMAN,
    140                             INTERFACE_DDF_DRIVER, 0);
     140                            INTERFACE_DDF_DRIVER, 0, NULL);
    141141
    142142                fibril_mutex_unlock(&devman_driver_mutex);
     
    152152                        devman_client_sess =
    153153                            service_connect(SERVICE_DEVMAN,
    154                             INTERFACE_DDF_CLIENT, 0);
     154                            INTERFACE_DDF_CLIENT, 0, NULL);
    155155
    156156                fibril_mutex_unlock(&devman_client_mutex);
     
    292292        if (flags & IPC_FLAG_BLOCKING)
    293293                sess = service_connect_blocking(SERVICE_DEVMAN,
    294                     INTERFACE_DEVMAN_DEVICE, handle);
     294                    INTERFACE_DEVMAN_DEVICE, handle, NULL);
    295295        else
    296296                sess = service_connect(SERVICE_DEVMAN,
    297                     INTERFACE_DEVMAN_DEVICE, handle);
     297                    INTERFACE_DEVMAN_DEVICE, handle, NULL);
    298298
    299299        return sess;
     
    350350        if (flags & IPC_FLAG_BLOCKING)
    351351                sess = service_connect_blocking(SERVICE_DEVMAN,
    352                     INTERFACE_DEVMAN_PARENT, handle);
     352                    INTERFACE_DEVMAN_PARENT, handle, NULL);
    353353        else
    354                 sess = service_connect_blocking(SERVICE_DEVMAN,
    355                     INTERFACE_DEVMAN_PARENT, handle);
     354                sess = service_connect(SERVICE_DEVMAN,
     355                    INTERFACE_DEVMAN_PARENT, handle, NULL);
    356356
    357357        return sess;
  • uspace/lib/c/generic/io/log.c

    rf8fb03b r01900b6  
    167167                return ENOMEM;
    168168
     169        errno_t rc;
    169170        logger_session = service_connect_blocking(SERVICE_LOGGER,
    170             INTERFACE_LOGGER_WRITER, 0);
    171         if (logger_session == NULL) {
    172                 return ENOMEM;
    173         }
     171            INTERFACE_LOGGER_WRITER, 0, &rc);
     172        if (logger_session == NULL)
     173                return rc;
    174174
    175175        default_log_id = log_create(prog_name, LOG_NO_PARENT);
  • uspace/lib/c/generic/io/logctl.c

    rf8fb03b r01900b6  
    4848
    4949        if (logger_session == NULL) {
     50                errno_t rc;
    5051                logger_session = service_connect_blocking(SERVICE_LOGGER,
    51                     INTERFACE_LOGGER_CONTROL, 0);
     52                    INTERFACE_LOGGER_CONTROL, 0, &rc);
    5253                if (logger_session == NULL)
    53                         return ENOMEM;
     54                        return rc;
    5455        }
    5556
  • uspace/lib/c/generic/loader.c

    rf8fb03b r01900b6  
    4646#include "private/loader.h"
    4747
    48 /** Connect to a new program loader.
    49  *
    50  * Spawns a new program loader task and returns the connection structure.
     48/** Spawn a new program loader.
     49 *
     50 * Spawn a new program loader task. The loader then independetly
     51 * connects to the naming service.
    5152 *
    5253 * @param name Symbolic name to set on the newly created task.
    5354 *
    5455 * @return Error code.
     56 *
    5557 */
    5658errno_t loader_spawn(const char *name)
     
    6062}
    6163
    62 loader_t *loader_connect(void)
     64/** Connect to a program loader.
     65 *
     66 * @param rc Placeholder for return code. Unused if NULL.
     67 *
     68 * @return Loader structure.
     69 *
     70 */
     71loader_t *loader_connect(errno_t *rc)
    6372{
    6473        loader_t *ldr = malloc(sizeof(loader_t));
     
    6776
    6877        async_sess_t *sess =
    69             service_connect_blocking(SERVICE_LOADER, INTERFACE_LOADER, 0);
     78            service_connect_blocking(SERVICE_LOADER, INTERFACE_LOADER, 0, rc);
    7079        if (sess == NULL) {
    7180                free(ldr);
  • uspace/lib/c/generic/loc.c

    rf8fb03b r01900b6  
    153153                                loc_supp_block_sess =
    154154                                    service_connect_blocking(SERVICE_LOC,
    155                                     INTERFACE_LOC_SUPPLIER, 0);
     155                                    INTERFACE_LOC_SUPPLIER, 0, NULL);
    156156                }
    157157
     
    172172                                loc_cons_block_sess =
    173173                                    service_connect_blocking(SERVICE_LOC,
    174                                     INTERFACE_LOC_CONSUMER, 0);
     174                                    INTERFACE_LOC_CONSUMER, 0, NULL);
    175175                }
    176176
     
    202202                        loc_supplier_sess =
    203203                            service_connect(SERVICE_LOC,
    204                             INTERFACE_LOC_SUPPLIER, 0);
     204                            INTERFACE_LOC_SUPPLIER, 0, NULL);
    205205
    206206                fibril_mutex_unlock(&loc_supplier_mutex);
     
    216216                        loc_consumer_sess =
    217217                            service_connect(SERVICE_LOC,
    218                             INTERFACE_LOC_CONSUMER, 0);
     218                            INTERFACE_LOC_CONSUMER, 0, NULL);
    219219
    220220                fibril_mutex_unlock(&loc_consumer_mutex);
     
    567567
    568568        if (flags & IPC_FLAG_BLOCKING)
    569                 sess = service_connect_blocking(SERVICE_LOC, iface, handle);
     569                sess = service_connect_blocking(SERVICE_LOC, iface, handle, NULL);
    570570        else
    571                 sess = service_connect(SERVICE_LOC, iface, handle);
     571                sess = service_connect(SERVICE_LOC, iface, handle, NULL);
    572572
    573573        return sess;
  • uspace/lib/c/generic/ns.c

    rf8fb03b r01900b6  
    4949    async_port_handler_t handler, void *data)
    5050{
    51         async_sess_t *sess = ns_session_get();
    52         if (sess == NULL)
    53                 return EIO;
     51        errno_t rc;
     52        async_sess_t *sess = ns_session_get(&rc);
     53        if (sess == NULL)
     54                return rc;
    5455
    5556        port_id_t port;
    56         errno_t rc = async_create_port(iface, handler, data, &port);
     57        rc = async_create_port(iface, handler, data, &port);
    5758        if (rc != EOK)
    5859                return rc;
     
    8182        async_set_fallback_port_handler(handler, data);
    8283
    83         async_sess_t *sess = ns_session_get();
    84         if (sess == NULL)
    85                 return EIO;
     84        errno_t rc;
     85        async_sess_t *sess = ns_session_get(&rc);
     86        if (sess == NULL)
     87                return rc;
    8688
    8789        async_exch_t *exch = async_exchange_begin(sess);
     
    8991        ipc_call_t answer;
    9092        aid_t req = async_send_1(exch, NS_REGISTER_BROKER, service, &answer);
    91         errno_t rc = async_connect_to_me(exch, INTERFACE_ANY, service, 0);
     93        rc = async_connect_to_me(exch, INTERFACE_ANY, service, 0);
    9294
    9395        async_exchange_end(exch);
     
    103105}
    104106
    105 async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3)
    106 {
    107         async_sess_t *sess = ns_session_get();
     107/** Connect to a singleton service.
     108 *
     109 * @param service Singleton service ID.
     110 * @param iface   Interface to connect to.
     111 * @param arg3    Custom connection argument.
     112 * @param rc      Placeholder for return code. Unused if NULL.
     113 *
     114 * @return New session on success or NULL on error.
     115 *
     116 */
     117async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3,
     118    errno_t *rc)
     119{
     120        async_sess_t *sess = ns_session_get(rc);
    108121        if (sess == NULL)
    109122                return NULL;
     
    114127
    115128        async_sess_t *csess =
    116             async_connect_me_to(exch, iface, service, arg3);
     129            async_connect_me_to(exch, iface, service, arg3, rc);
    117130        async_exchange_end(exch);
    118131
     
    130143}
    131144
     145/** Wait and connect to a singleton service.
     146 *
     147 * @param service Singleton service ID.
     148 * @param iface   Interface to connect to.
     149 * @param arg3    Custom connection argument.
     150 * @param rc      Placeholder for return code. Unused if NULL.
     151 *
     152 * @return New session on success or NULL on error.
     153 *
     154 */
    132155async_sess_t *service_connect_blocking(service_t service, iface_t iface,
    133     sysarg_t arg3)
    134 {
    135         async_sess_t *sess = ns_session_get();
     156    sysarg_t arg3, errno_t *rc)
     157{
     158        async_sess_t *sess = ns_session_get(rc);
    136159        if (sess == NULL)
    137160                return NULL;
     
    139162        async_exch_t *exch = async_exchange_begin(sess);
    140163        async_sess_t *csess =
    141             async_connect_me_to_blocking(exch, iface, service, arg3);
     164            async_connect_me_to_blocking(exch, iface, service, arg3, rc);
    142165        async_exchange_end(exch);
    143166
     
    157180errno_t ns_ping(void)
    158181{
    159         async_sess_t *sess = ns_session_get();
     182        errno_t rc;
     183        async_sess_t *sess = ns_session_get(&rc);
     184        if (sess == NULL)
     185                return rc;
     186
     187        async_exch_t *exch = async_exchange_begin(sess);
     188        rc = async_req_0_0(exch, NS_PING);
     189        async_exchange_end(exch);
     190
     191        return rc;
     192}
     193
     194errno_t ns_intro(task_id_t id)
     195{
     196        errno_t rc;
     197        async_sess_t *sess = ns_session_get(&rc);
    160198        if (sess == NULL)
    161199                return EIO;
    162200
    163201        async_exch_t *exch = async_exchange_begin(sess);
    164         errno_t rc = async_req_0_0(exch, NS_PING);
    165         async_exchange_end(exch);
    166 
    167         return rc;
    168 }
    169 
    170 errno_t ns_intro(task_id_t id)
    171 {
    172         async_exch_t *exch;
    173         async_sess_t *sess = ns_session_get();
    174         if (sess == NULL)
    175                 return EIO;
    176 
    177         exch = async_exchange_begin(sess);
    178         errno_t rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));
    179         async_exchange_end(exch);
    180 
    181         return rc;
    182 }
    183 
    184 async_sess_t *ns_session_get(void)
     202        rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));
     203        async_exchange_end(exch);
     204
     205        return rc;
     206}
     207
     208async_sess_t *ns_session_get(errno_t *rc)
    185209{
    186210        async_exch_t *exch;
     
    188212        if (sess_ns == NULL) {
    189213                exch = async_exchange_begin(&session_ns);
    190                 sess_ns = async_connect_me_to(exch, 0, 0, 0);
     214                sess_ns = async_connect_me_to(exch, 0, 0, 0, rc);
    191215                async_exchange_end(exch);
    192216                if (sess_ns == NULL)
  • uspace/lib/c/generic/task.c

    rf8fb03b r01900b6  
    181181
    182182        /* Connect to a program loader. */
    183         loader_t *ldr = loader_connect();
     183        errno_t rc;
     184        loader_t *ldr = loader_connect(&rc);
    184185        if (ldr == NULL)
    185                 return EREFUSED;
     186                return rc;
    186187
    187188        bool wait_initialized = false;
     
    189190        /* Get task ID. */
    190191        task_id_t task_id;
    191         errno_t rc = loader_get_task_id(ldr, &task_id);
     192        rc = loader_get_task_id(ldr, &task_id);
    192193        if (rc != EOK)
    193194                goto error;
     
    250251        /* Start a debug session if requested */
    251252        if (rsess != NULL) {
    252                 ksess = async_connect_kbox(task_id);
     253                ksess = async_connect_kbox(task_id, &rc);
    253254                if (ksess == NULL) {
    254255                        /* Most likely debugging support is not compiled in */
    255                         rc = ENOTSUP;
    256256                        goto error;
    257257                }
     
    402402errno_t task_setup_wait(task_id_t id, task_wait_t *wait)
    403403{
    404         async_sess_t *sess_ns = ns_session_get();
     404        errno_t rc;
     405        async_sess_t *sess_ns = ns_session_get(&rc);
    405406        if (sess_ns == NULL)
    406                 return EIO;
     407                return rc;
    407408
    408409        async_exch_t *exch = async_exchange_begin(sess_ns);
     
    484485errno_t task_retval(int val)
    485486{
    486         async_sess_t *sess_ns = ns_session_get();
     487        errno_t rc;
     488        async_sess_t *sess_ns = ns_session_get(&rc);
    487489        if (sess_ns == NULL)
    488                 return EIO;
     490                return rc;
    489491
    490492        async_exch_t *exch = async_exchange_begin(sess_ns);
    491         errno_t rc = (errno_t) async_req_1_0(exch, NS_RETVAL, val);
     493        rc = (errno_t) async_req_1_0(exch, NS_RETVAL, val);
    492494        async_exchange_end(exch);
    493495
  • uspace/lib/c/generic/vfs/vfs.c

    rf8fb03b r01900b6  
    322322        while (vfs_sess == NULL) {
    323323                vfs_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_VFS,
    324                     0);
     324                    0, NULL);
    325325        }
    326326
  • uspace/lib/c/include/async.h

    rf8fb03b r01900b6  
    275275
    276276extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t,
    277     sysarg_t);
     277    sysarg_t, errno_t *);
    278278extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t,
    279     sysarg_t, sysarg_t);
    280 extern async_sess_t *async_connect_kbox(task_id_t);
     279    sysarg_t, sysarg_t, errno_t *);
     280extern async_sess_t *async_connect_kbox(task_id_t, errno_t *);
    281281
    282282extern errno_t async_connect_to_me(async_exch_t *, iface_t, sysarg_t, sysarg_t);
  • uspace/lib/c/include/loader/loader.h

    rf8fb03b r01900b6  
    4444
    4545extern errno_t loader_spawn(const char *);
    46 extern loader_t *loader_connect(void);
     46extern loader_t *loader_connect(errno_t *);
    4747extern errno_t loader_get_task_id(loader_t *, task_id_t *);
    4848extern errno_t loader_set_cwd(loader_t *);
  • uspace/lib/c/include/ns.h

    rf8fb03b r01900b6  
    4343    void *);
    4444extern errno_t service_register_broker(service_t, async_port_handler_t, void *);
    45 extern async_sess_t *service_connect(service_t, iface_t, sysarg_t);
    46 extern async_sess_t *service_connect_blocking(service_t, iface_t, sysarg_t);
     45extern async_sess_t *service_connect(service_t, iface_t, sysarg_t, errno_t *);
     46extern async_sess_t *service_connect_blocking(service_t, iface_t, sysarg_t,
     47    errno_t *);
    4748
    4849extern errno_t ns_ping(void);
    4950extern errno_t ns_intro(task_id_t);
    50 extern async_sess_t *ns_session_get(void);
     51extern async_sess_t *ns_session_get(errno_t *);
    5152
    5253#endif
  • uspace/srv/fs/cdfs/cdfs.c

    rf8fb03b r01900b6  
    7575        }
    7676
     77        errno_t rc;
    7778        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    78             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    7980        if (!vfs_sess) {
    80                 printf("%s: Unable to connect to VFS\n", NAME);
     81                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8182                return -1;
    8283        }
    8384
    84         errno_t rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
     85        rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
    8586            &cdfs_libfs_ops);
    8687        if (rc != EOK) {
  • uspace/srv/fs/exfat/exfat.c

    rf8fb03b r01900b6  
    7777
    7878        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    79             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    8080        if (!vfs_sess) {
    81                 printf(NAME ": failed to connect to VFS\n");
     81                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8282                return -1;
    8383        }
  • uspace/srv/fs/ext4fs/ext4fs.c

    rf8fb03b r01900b6  
    4343#include <ipc/services.h>
    4444#include <str.h>
     45#include <str_error.h>
    4546#include "ext4/ops.h"
    4647#include "../../vfs/vfs.h"
     
    6667        }
    6768
     69        errno_t rc;
    6870        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    69             INTERFACE_VFS_DRIVER, 0);
     71            INTERFACE_VFS_DRIVER, 0, &rc);
    7072        if (!vfs_sess) {
    71                 printf("%s: Failed to connect to VFS\n", NAME);
     73                printf("%s: Failed to connect to VFS: %s\n", NAME, str_error(rc));
    7274                return 2;
    7375        }
    7476
    75         errno_t rc = ext4_global_init();
     77        rc = ext4_global_init();
    7678        if (rc != EOK) {
    77                 printf("%s: Global initialization failed\n", NAME);
     79                printf("%s: Global initialization failed: %s\n", NAME,
     80                    str_error(rc));
    7881                return rc;
    7982        }
     
    8285            &ext4_libfs_ops);
    8386        if (rc != EOK) {
    84                 printf("%s: Failed to register file system\n", NAME);
     87                printf("%s: Failed to register file system: %s\n", NAME,
     88                    str_error(rc));
    8589                return rc;
    8690        }
  • uspace/srv/fs/fat/fat.c

    rf8fb03b r01900b6  
    7777
    7878        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    79             INTERFACE_VFS_DRIVER, 0);
     79            INTERFACE_VFS_DRIVER, 0, &rc);
    8080        if (!vfs_sess) {
    81                 printf(NAME ": failed to connect to VFS\n");
     81                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8282                return -1;
    8383        }
  • uspace/srv/fs/locfs/locfs.c

    rf8fb03b r01900b6  
    7878        }
    7979
     80        errno_t rc;
    8081        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    81             INTERFACE_VFS_DRIVER, 0);
     82            INTERFACE_VFS_DRIVER, 0, &rc);
    8283        if (!vfs_sess) {
    83                 printf("%s: Unable to connect to VFS\n", NAME);
     84                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8485                return -1;
    8586        }
    8687
    87         errno_t rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
     88        rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
    8889            &locfs_libfs_ops);
    8990        if (rc != EOK) {
  • uspace/srv/fs/mfs/mfs.c

    rf8fb03b r01900b6  
    7474
    7575        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    76             INTERFACE_VFS_DRIVER, 0);
    77 
     76            INTERFACE_VFS_DRIVER, 0, &rc);
    7877        if (!vfs_sess) {
    79                 printf(NAME ": failed to connect to VFS\n");
     78                printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
    8079                rc = errno;
    8180                goto err;
  • uspace/srv/fs/tmpfs/tmpfs.c

    rf8fb03b r01900b6  
    8080        }
    8181
     82        errno_t rc;
    8283        async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
    83             INTERFACE_VFS_DRIVER, 0);
     84            INTERFACE_VFS_DRIVER, 0, &rc);
    8485        if (!vfs_sess) {
    85                 printf("%s: Unable to connect to VFS\n", NAME);
     86                printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
    8687                return -1;
    8788        }
    8889
    89         errno_t rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
     90        rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
    9091            &tmpfs_libfs_ops);
    9192        if (rc != EOK) {
  • uspace/srv/fs/udf/udf.c

    rf8fb03b r01900b6  
    7373        }
    7474
     75        errno_t rc;
    7576        async_sess_t *vfs_sess =
    76             service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0);
     77            service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0, &rc);
    7778        if (!vfs_sess) {
    78                 log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS");
     79                log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS: %s",
     80                    str_error(rc));
    7981                return 2;
    8082        }
    8183
    82         errno_t rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
     84        rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
    8385            &udf_libfs_ops);
    8486        if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.