Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vol.c

    r44fe800 r9c2c7d2  
    3333 */
    3434
     35#include <abi/ipc/interfaces.h>
    3536#include <errno.h>
    3637#include <ipc/services.h>
     
    3839#include <loc.h>
    3940#include <stdlib.h>
     41#include <str.h>
    4042#include <vol.h>
    4143
     
    6062        rc = loc_service_get_id(SERVICE_NAME_VOLSRV, &vol_svcid, 0);
    6163        if (rc != EOK) {
    62                 rc = EIO;
     64                rc = ENOENT;
    6365                goto error;
    6466        }
    6567
    66         vol->sess = loc_service_connect(EXCHANGE_SERIALIZE, vol_svcid, 0);
     68        vol->sess = loc_service_connect(vol_svcid, INTERFACE_VOL, 0);
    6769        if (vol->sess == NULL) {
    6870                rc = EIO;
     
    250252}
    251253
     254/** Get volume label support. */
     255int vol_part_get_lsupp(vol_t *vol, vol_fstype_t fstype,
     256    vol_label_supp_t *vlsupp)
     257{
     258        async_exch_t *exch;
     259        sysarg_t retval;
     260        ipc_call_t answer;
     261
     262        exch = async_exchange_begin(vol->sess);
     263        aid_t req = async_send_1(exch, VOL_PART_LSUPP, fstype, &answer);
     264        int rc = async_data_read_start(exch, vlsupp, sizeof(vol_label_supp_t));
     265        async_exchange_end(exch);
     266
     267        if (rc != EOK) {
     268                async_forget(req);
     269                return EIO;
     270        }
     271
     272        async_wait_for(req, &retval);
     273        if (retval != EOK)
     274                return EIO;
     275
     276        return EOK;
     277}
     278
    252279/** Create file system. */
    253 int vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype)
    254 {
    255         async_exch_t *exch;
    256         int retval;
    257 
    258         exch = async_exchange_begin(vol->sess);
    259         retval = async_req_2_0(exch, VOL_PART_MKFS, sid, fstype);
    260         async_exchange_end(exch);
     280int vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype,
     281    const char *label)
     282{
     283        async_exch_t *exch;
     284        ipc_call_t answer;
     285        sysarg_t retval;
     286
     287        exch = async_exchange_begin(vol->sess);
     288        aid_t req = async_send_2(exch, VOL_PART_MKFS, sid, fstype, &answer);
     289        retval = async_data_write_start(exch, label, str_size(label));
     290        async_exchange_end(exch);
     291
     292        if (retval != EOK) {
     293                async_forget(req);
     294                return retval;
     295        }
     296
     297        async_wait_for(req, &retval);
    261298
    262299        if (retval != EOK)
Note: See TracChangeset for help on using the changeset viewer.