Changeset 372df8f in mainline


Ignore:
Timestamp:
2015-10-09T07:00:23Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0ecfc62
Parents:
0bde8523
Message:

Let VBD handle unlabeled devices too. Now volsrv only cares about partitions.

Location:
uspace
Files:
3 added
1 deleted
17 edited
2 moved

Legend:

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

    r0bde8523 r372df8f  
    212212        }
    213213
    214         for (i = 0; i < LT_LIMIT; i++) {
     214        for (i = LT_FIRST; i < LT_LIMIT; i++) {
    215215                rc = fdisk_ltype_format(i, &sltype);
    216216                if (rc != EOK)
  • uspace/lib/c/generic/vbd.c

    r0bde8523 r372df8f  
    4343#include <vbd.h>
    4444
     45static int vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **,
     46    size_t *);
     47
    4548int vbd_create(vbd_t **rvbd)
    4649{
     
    8588}
    8689
    87 int vbd_disk_add(vbd_t *vbd, service_id_t disk_sid)
    88 {
    89         async_exch_t *exch;
    90 
    91         exch = async_exchange_begin(vbd->sess);
    92         sysarg_t rc = async_req_1_0(exch, VBD_DISK_ADD, disk_sid);
    93         async_exchange_end(exch);
    94 
    95         return (int)rc;
    96 }
    97 
    98 int vbd_disk_remove(vbd_t *vbd, service_id_t disk_sid)
    99 {
    100         async_exch_t *exch;
    101 
    102         exch = async_exchange_begin(vbd->sess);
    103         sysarg_t rc = async_req_1_0(exch, VBD_DISK_REMOVE, disk_sid);
    104         async_exchange_end(exch);
    105 
    106         return (int)rc;
     90/** Get list of partitions as array of service IDs.
     91 *
     92 * @param vbd Virtual block device service
     93 * @param data Place to store pointer to array
     94 * @param count Place to store length of array (number of entries)
     95 *
     96 * @return EOK on success or negative error code
     97 */
     98int vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count)
     99{
     100        return vbd_get_ids_internal(vbd, VBD_GET_DISKS, 0, data, count);
    107101}
    108102
  • uspace/lib/c/generic/vol.c

    r0bde8523 r372df8f  
    175175}
    176176
    177 /** Get list of disks as array of service IDs.
     177/** Get list of partitions as array of service IDs.
    178178 *
    179179 * @param vol Volume service
     
    183183 * @return EOK on success or negative error code
    184184 */
    185 int vol_get_disks(vol_t *vol, service_id_t **data, size_t *count)
    186 {
    187         return vol_get_ids_internal(vol, VOL_GET_DISKS, 0, data, count);
    188 }
    189 
    190 /** Get disk information. */
    191 int vol_disk_info(vol_t *vol, service_id_t sid, vol_disk_info_t *vinfo)
     185int vol_get_parts(vol_t *vol, service_id_t **data, size_t *count)
     186{
     187        return vol_get_ids_internal(vol, VOL_GET_PARTS, 0, data, count);
     188}
     189
     190/** Get partition information. */
     191int vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo)
    192192{
    193193        async_exch_t *exch;
     
    196196
    197197        exch = async_exchange_begin(vol->sess);
    198         retval = async_req_1_3(exch, VOL_DISK_INFO, sid, &dcnt, &ltype,
     198        retval = async_req_1_3(exch, VOL_PART_INFO, sid, &dcnt, &ltype,
    199199            &flags);
    200200        async_exchange_end(exch);
     
    209209}
    210210
    211 /** Create new label. */
    212 int vol_label_create(vol_t *vol, service_id_t sid, label_type_t ltype)
     211/** Erase partition (to the extent where we will consider it not containing
     212 * a file system. */
     213int vol_part_empty(vol_t *vol, service_id_t sid)
    213214{
    214215        async_exch_t *exch;
     
    216217
    217218        exch = async_exchange_begin(vol->sess);
    218         retval = async_req_2_0(exch, VOL_LABEL_CREATE, sid, ltype);
     219        retval = async_req_1_0(exch, VOL_PART_EMPTY, sid);
    219220        async_exchange_end(exch);
    220221
     
    225226}
    226227
    227 /** Erase disk (to the extent where we will consider it not containing
    228  * a label or file system. */
    229 int vol_disk_empty(vol_t *vol, service_id_t sid)
    230 {
    231         async_exch_t *exch;
    232         int retval;
    233 
    234         exch = async_exchange_begin(vol->sess);
    235         retval = async_req_1_0(exch, VOL_DISK_EMPTY, sid);
    236         async_exchange_end(exch);
    237 
    238         if (retval != EOK)
    239                 return EIO;
    240 
    241         return EOK;
    242 }
    243 
    244228/** @}
    245229 */
  • uspace/lib/c/include/ipc/vbd.h

    r0bde8523 r372df8f  
    3737
    3838typedef enum {
    39         VBD_DISK_ADD = IPC_FIRST_USER_METHOD,
    40         VBD_DISK_REMOVE,
     39        VBD_GET_DISKS = IPC_FIRST_USER_METHOD,
    4140        VBD_DISK_INFO,
    4241        VBD_LABEL_CREATE,
  • uspace/lib/c/include/ipc/vol.h

    r0bde8523 r372df8f  
    3737
    3838typedef enum {
    39         VOL_GET_DISKS = IPC_FIRST_USER_METHOD,
    40         VOL_DISK_INFO,
    41         VOL_LABEL_CREATE,
    42         VOL_DISK_EMPTY
     39        VOL_GET_PARTS = IPC_FIRST_USER_METHOD,
     40        VOL_PART_INFO,
     41        VOL_PART_EMPTY
    4342} vol_request_t;
    4443
  • uspace/lib/c/include/types/label.h

    r0bde8523 r372df8f  
    5252/** Disk label type */
    5353typedef enum {
     54        /** No label */
     55        lt_none,
    5456        /** BIOS Master Boot Record */
    5557        lt_mbr,
     
    5860} label_type_t;
    5961
     62#define LT_FIRST (lt_mbr)
    6063#define LT_LIMIT (lt_gpt + 1)
    6164
  • uspace/lib/c/include/vbd.h

    r0bde8523 r372df8f  
    9393extern int vbd_create(vbd_t **);
    9494extern void vbd_destroy(vbd_t *);
    95 extern int vbd_disk_add(vbd_t *, service_id_t);
    96 extern int vbd_disk_remove(vbd_t *, service_id_t);
     95extern int vbd_get_disks(vbd_t *, service_id_t **, size_t *);
    9796extern int vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *);
    9897extern int vbd_label_create(vbd_t *, service_id_t, label_type_t);
  • uspace/lib/c/include/vol.h

    r0bde8523 r372df8f  
    4747} vol_t;
    4848
    49 /** Disk information */
     49/** Partition information */
    5050typedef struct {
    51         /** Disk contents */
     51        /** Partition contents */
    5252        label_disk_cnt_t dcnt;
    53         /** Label type, if disk contents is label */
     53        /** Label type, if partition contents is label XXX */
    5454        label_type_t ltype;
    5555        /** Label flags */
    5656        label_flags_t flags;
    57 } vol_disk_info_t;
     57} vol_part_info_t;
    5858
    5959extern int vol_create(vol_t **);
    6060extern void vol_destroy(vol_t *);
    61 extern int vol_get_disks(vol_t *, service_id_t **, size_t *);
    62 extern int vol_disk_info(vol_t *, service_id_t, vol_disk_info_t *);
    63 extern int vol_label_create(vol_t *, service_id_t, label_type_t);
    64 extern int vol_disk_empty(vol_t *, service_id_t);
     61extern int vol_get_parts(vol_t *, service_id_t **, size_t *);
     62extern int vol_part_info(vol_t *, service_id_t, vol_part_info_t *);
     63extern int vol_part_empty(vol_t *, service_id_t);
    6564
    6665#endif
  • uspace/lib/fdisk/src/fdisk.c

    r0bde8523 r372df8f  
    133133        list_initialize(&devlist->devinfos);
    134134
    135         rc = vol_get_disks(fdisk->vol, &svcs, &count);
     135        printf("vbd_get_disks()\n");
     136        rc = vbd_get_disks(fdisk->vbd, &svcs, &count);
     137        printf(" -> %d\n", rc);
    136138        if (rc != EOK) {
    137139                rc = EIO;
     
    363365int fdisk_dev_open(fdisk_t *fdisk, service_id_t sid, fdisk_dev_t **rdev)
    364366{
    365         vol_disk_info_t vinfo;
     367        vbd_disk_info_t vinfo;
    366368        fdisk_dev_t *dev = NULL;
    367369        service_id_t *psids = NULL;
     
    380382        list_initialize(&dev->log_ba);
    381383
    382         rc = vol_disk_info(fdisk->vol, sid, &vinfo);
     384        rc = vbd_disk_info(fdisk->vbd, sid, &vinfo);
    383385        if (rc != EOK) {
    384386                rc = EIO;
     
    386388        }
    387389
    388         dev->dcnt = vinfo.dcnt;
    389 
    390         if (dev->dcnt != dc_label)
    391                 goto done;
     390        dev->dcnt = dc_label;
    392391
    393392        printf("get label info\n");
     
    421420
    422421        free(psids);
    423 done:
    424422        *rdev = dev;
    425423        return EOK;
     
    479477int fdisk_label_get_info(fdisk_dev_t *dev, fdisk_label_info_t *info)
    480478{
    481         vol_disk_info_t vinfo;
    482         int rc;
    483 
    484         rc = vol_disk_info(dev->fdisk->vol, dev->sid, &vinfo);
     479        vbd_disk_info_t vinfo;
     480        int rc;
     481
     482        rc = vbd_disk_info(dev->fdisk->vbd, dev->sid, &vinfo);
    485483        if (rc != EOK) {
    486484                rc = EIO;
     
    488486        }
    489487
    490         info->dcnt = vinfo.dcnt;
     488        info->dcnt = dc_label;
    491489        info->ltype = vinfo.ltype;
    492490        info->flags = vinfo.flags;
     
    500498        int rc;
    501499
    502         rc = vol_label_create(dev->fdisk->vol, dev->sid, ltype);
     500        rc = vbd_label_create(dev->fdisk->vbd, dev->sid, ltype);
    503501        if (rc != EOK)
    504502                return rc;
     
    518516        part = fdisk_part_first(dev);
    519517        while (part != NULL) {
    520                 (void) fdisk_part_destroy(part); /* XXX */
     518                rc = fdisk_part_destroy(part);
     519                if (rc != EOK)
     520                        return EIO;
    521521                part = fdisk_part_first(dev);
    522522        }
    523523
    524         rc = vol_disk_empty(dev->fdisk->vol, dev->sid);
     524        rc = vbd_label_delete(dev->fdisk->vbd, dev->sid);
    525525        if (rc != EOK)
    526526                return EIO;
     
    685685        sltype = NULL;
    686686        switch (ltype) {
     687        case lt_none:
     688                sltype = "None";
     689                break;
    687690        case lt_mbr:
    688691                sltype = "MBR";
  • uspace/lib/label/Makefile

    r0bde8523 r372df8f  
    3333
    3434SOURCES = \
     35        src/dummy.c \
    3536        src/mbr.c \
    3637        src/gpt.c \
  • uspace/lib/label/src/label.c

    r0bde8523 r372df8f  
    4040#include <stdlib.h>
    4141
     42#include "dummy.h"
    4243#include "gpt.h"
    4344#include "mbr.h"
     
    4647        &gpt_label_ops,
    4748        &mbr_label_ops,
     49        &dummy_label_ops,
    4850        NULL
    4951};
     
    7072
    7173        switch (ltype) {
     74        case lt_none:
     75                return EINVAL;
    7276        case lt_gpt:
    7377                ops = &gpt_label_ops;
  • uspace/srv/bd/vbd/disk.c

    r0bde8523 r372df8f  
    4848#include "types/vbd.h"
    4949
     50static fibril_mutex_t vbds_disks_lock;
    5051static list_t vbds_disks; /* of vbds_disk_t */
    5152static list_t vbds_parts; /* of vbds_part_t */
     53
     54static category_id_t part_cid;
    5255
    5356static int vbds_bd_open(bd_srvs_t *, bd_srv_t *);
     
    8386}
    8487
    85 void vbds_disks_init(void)
    86 {
     88int vbds_disks_init(void)
     89{
     90        int rc;
     91
     92        fibril_mutex_initialize(&vbds_disks_lock);
    8793        list_initialize(&vbds_disks);
    8894        list_initialize(&vbds_parts);
    89 }
     95
     96        rc = loc_category_get_id("partition", &part_cid, 0);
     97        if (rc != EOK) {
     98                log_msg(LOG_DEFAULT, LVL_ERROR, "Error looking up partition "
     99                    "category.");
     100                return EIO;
     101        }
     102
     103        return EOK;
     104}
     105
     106/** Check for new disk devices */
     107static int vbds_disks_check_new(void)
     108{
     109        bool already_known;
     110        category_id_t disk_cat;
     111        service_id_t *svcs;
     112        size_t count, i;
     113        int rc;
     114
     115        fibril_mutex_lock(&vbds_disks_lock);
     116
     117        rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
     118        if (rc != EOK) {
     119                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'disk'.");
     120                fibril_mutex_unlock(&vbds_disks_lock);
     121                return ENOENT;
     122        }
     123
     124        rc = loc_category_get_svcs(disk_cat, &svcs, &count);
     125        if (rc != EOK) {
     126                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of disk "
     127                    "devices.");
     128                fibril_mutex_unlock(&vbds_disks_lock);
     129                return EIO;
     130        }
     131
     132        for (i = 0; i < count; i++) {
     133                already_known = false;
     134
     135                list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
     136                        if (disk->svc_id == svcs[i]) {
     137                                already_known = true;
     138                                break;
     139                        }
     140                }
     141
     142                if (!already_known) {
     143                        log_msg(LOG_DEFAULT, LVL_NOTE, "Found disk '%lu'",
     144                            (unsigned long) svcs[i]);
     145                        rc = vbds_disk_add(svcs[i]);
     146                        if (rc != EOK) {
     147                                log_msg(LOG_DEFAULT, LVL_ERROR, "Could not add "
     148                                    "disk.");
     149                        }
     150                }
     151        }
     152
     153        fibril_mutex_unlock(&vbds_disks_lock);
     154        return EOK;
     155}
     156
    90157
    91158static int vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
     
    210277}
    211278
     279static void vbds_disk_cat_change_cb(void)
     280{
     281        (void) vbds_disks_check_new();
     282}
     283
     284int vbds_disk_discovery_start(void)
     285{
     286        int rc;
     287
     288        rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb);
     289        if (rc != EOK) {
     290                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
     291                    "for disk discovery (%d).", rc);
     292                return rc;
     293        }
     294
     295        return vbds_disks_check_new();
     296}
     297
    212298int vbds_disk_add(service_id_t sid)
    213299{
     
    277363                rc = vbds_part_add(disk, part, NULL);
    278364                if (rc != EOK) {
    279                         log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partitio "
     365                        log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partition "
    280366                            "(disk %s)", disk->svc_name);
    281367                }
     
    313399        block_fini(sid);
    314400        free(disk);
     401        return EOK;
     402}
     403
     404/** Get list of disks as array of service IDs. */
     405int vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
     406{
     407        size_t act_cnt;
     408        size_t buf_cnt;
     409
     410        fibril_mutex_lock(&vbds_disks_lock);
     411
     412        buf_cnt = buf_size / sizeof(service_id_t);
     413
     414        act_cnt = list_count(&vbds_disks);
     415        *act_size = act_cnt * sizeof(service_id_t);
     416
     417        if (buf_size % sizeof(service_id_t) != 0) {
     418                fibril_mutex_unlock(&vbds_disks_lock);
     419                return EINVAL;
     420        }
     421
     422        size_t pos = 0;
     423        list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
     424                if (pos < buf_cnt)
     425                        id_buf[pos] = disk->svc_id;
     426                pos++;
     427        }
     428
     429        fibril_mutex_unlock(&vbds_disks_lock);
    315430        return EOK;
    316431}
     
    751866        if (rc != EOK) {
    752867                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering "
    753                     "service %s.", name);
     868                    "service %s (%d).", name, rc);
    754869                free(name);
    755870                free(part);
     871                return EIO;
     872        }
     873
     874        rc = loc_service_add_to_cat(psid, part_cid);
     875        if (rc != EOK) {
     876                log_msg(LOG_DEFAULT, LVL_ERROR, "Failled adding partition "
     877                    "service %s to partition category.", name);
     878                free(name);
     879                free(part);
     880
     881                rc = loc_service_unregister(psid);
     882                if (rc != EOK) {
     883                        log_msg(LOG_DEFAULT, LVL_ERROR, "Error unregistering "
     884                            "service. Rollback failed.");
     885                }
    756886                return EIO;
    757887        }
  • uspace/srv/bd/vbd/disk.h

    r0bde8523 r372df8f  
    4242#include <vbd.h>
    4343
    44 extern void vbds_disks_init(void);
     44extern int vbds_disks_init(void);
     45extern int vbds_disk_discovery_start(void);
    4546extern int vbds_disk_add(service_id_t);
    4647extern int vbds_disk_remove(service_id_t);
     48extern int vbds_disk_get_ids(service_id_t *, size_t, size_t *);
    4749extern int vbds_disk_info(service_id_t, vbd_disk_info_t *);
    4850extern int vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *);
  • uspace/srv/bd/vbd/vbd.c

    r0bde8523 r372df8f  
    6060        log_msg(LOG_DEFAULT, LVL_NOTE, "vbds_init()");
    6161
    62         vbds_disks_init();
     62        rc = vbds_disks_init();
     63        if (rc != EOK)
     64                return rc;
     65
     66        rc = vbds_disk_discovery_start();
     67        if (rc != EOK)
     68                return rc;
    6369
    6470        async_set_client_connection(vbds_client_conn);
     
    7985}
    8086
    81 
    82 static void vbds_disk_add_srv(ipc_callid_t iid, ipc_call_t *icall)
    83 {
    84         service_id_t disk_sid;
    85         int rc;
    86 
    87         log_msg(LOG_DEFAULT, LVL_NOTE, "vbds_disk_add_srv()");
    88 
    89         disk_sid = IPC_GET_ARG1(*icall);
    90         rc = vbds_disk_add(disk_sid);
    91         async_answer_0(iid, (sysarg_t) rc);
    92 }
    93 
    94 static void vbds_disk_remove_srv(ipc_callid_t iid, ipc_call_t *icall)
    95 {
    96         service_id_t disk_sid;
    97         int rc;
    98 
    99         log_msg(LOG_DEFAULT, LVL_NOTE, "vbds_disk_remove_srv()");
    100 
    101         disk_sid = IPC_GET_ARG1(*icall);
    102         rc = vbds_disk_remove(disk_sid);
    103         async_answer_0(iid, (sysarg_t) rc);
     87static void vbds_get_disks_srv(ipc_callid_t iid, ipc_call_t *icall)
     88{
     89        ipc_callid_t callid;
     90        size_t size;
     91        size_t act_size;
     92        int rc;
     93
     94        if (!async_data_read_receive(&callid, &size)) {
     95                async_answer_0(callid, EREFUSED);
     96                async_answer_0(iid, EREFUSED);
     97                return;
     98        }
     99
     100        service_id_t *id_buf = (service_id_t *) malloc(size);
     101        if (id_buf == NULL) {
     102                async_answer_0(callid, ENOMEM);
     103                async_answer_0(iid, ENOMEM);
     104                return;
     105        }
     106
     107        rc = vbds_disk_get_ids(id_buf, size, &act_size);
     108        if (rc != EOK) {
     109                async_answer_0(callid, rc);
     110                async_answer_0(iid, rc);
     111                return;
     112        }
     113
     114        sysarg_t retval = async_data_read_finalize(callid, id_buf, size);
     115        free(id_buf);
     116
     117        async_answer_1(iid, retval, act_size);
    104118}
    105119
     
    362376
    363377                switch (method) {
    364                 case VBD_DISK_ADD:
    365                         vbds_disk_add_srv(callid, &call);
    366                         break;
    367                 case VBD_DISK_REMOVE:
    368                         vbds_disk_remove_srv(callid, &call);
     378                case VBD_GET_DISKS:
     379                        vbds_get_disks_srv(callid, &call);
    369380                        break;
    370381                case VBD_DISK_INFO:
  • uspace/srv/locsrv/locsrv.c

    r0bde8523 r372df8f  
    13281328        categ_dir_add_cat(&cdir, cat);
    13291329
     1330        cat = category_new("partition");
     1331        categ_dir_add_cat(&cdir, cat);
     1332
    13301333        cat = category_new("iplink");
    13311334        categ_dir_add_cat(&cdir, cat);
  • uspace/srv/volsrv/Makefile

    r0bde8523 r372df8f  
    3131
    3232SOURCES = \
    33         disk.c \
     33        part.c \
    3434        volsrv.c
    3535
  • uspace/srv/volsrv/part.h

    r0bde8523 r372df8f  
    3535 */
    3636
    37 #ifndef DISK_H_
    38 #define DISK_H_
     37#ifndef PART_H_
     38#define pART_H_
    3939
    4040#include <sys/types.h>
    4141#include <vol.h>
    42 #include "types/disk.h"
     42#include "types/part.h"
    4343
    44 extern int vol_disk_init(void);
    45 extern int vol_disk_discovery_start(void);
    46 extern int vol_disk_get_ids(service_id_t *, size_t, size_t *);
    47 extern int vol_disk_find_by_id(service_id_t, vol_disk_t **);
    48 extern int vol_disk_label_create(vol_disk_t *, label_type_t);
    49 extern int vol_disk_empty_disk(vol_disk_t *);
    50 extern int vol_disk_get_info(vol_disk_t *, vol_disk_info_t *);
     44extern int vol_part_init(void);
     45extern int vol_part_discovery_start(void);
     46extern int vol_part_get_ids(service_id_t *, size_t, size_t *);
     47extern int vol_part_find_by_id(service_id_t, vol_part_t **);
     48extern int vol_part_empty_part(vol_part_t *);
     49extern int vol_part_get_info(vol_part_t *, vol_part_info_t *);
    5150
    5251#endif
  • uspace/srv/volsrv/types/part.h

    r0bde8523 r372df8f  
    3535 */
    3636
    37 #ifndef TYPES_DISK_H_
    38 #define TYPES_DISK_H_
     37#ifndef TYPES_PART_H_
     38#define TYPES_PART_H_
    3939
    4040#include <types/label.h>
    4141
    42 /** Disk */
     42/** Partition */
    4343typedef struct {
    44         /** Link to vol_disks */
    45         link_t ldisks;
     44        /** Link to vol_parts */
     45        link_t lparts;
    4646        /** Service ID */
    4747        service_id_t svc_id;
     
    5252        /** Label type */
    5353        label_type_t ltype;
    54 } vol_disk_t;
     54} vol_part_t;
    5555
    5656#endif
  • uspace/srv/volsrv/volsrv.c

    r0bde8523 r372df8f  
    4545#include <vol.h>
    4646
    47 #include "disk.h"
     47#include "part.h"
    4848
    4949#define NAME  "volsrv"
     
    5656        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()");
    5757
    58         rc = vol_disk_init();
     58        rc = vol_part_init();
    5959        if (rc != EOK)
    6060                return rc;
    6161
    62         rc = vol_disk_discovery_start();
     62        rc = vol_part_discovery_start();
    6363        if (rc != EOK)
    6464                return rc;
     
    8282}
    8383
    84 static void vol_get_disks_srv(ipc_callid_t iid, ipc_call_t *icall)
     84static void vol_get_parts_srv(ipc_callid_t iid, ipc_call_t *icall)
    8585{
    8686        ipc_callid_t callid;
     
    102102        }
    103103
    104         rc = vol_disk_get_ids(id_buf, size, &act_size);
     104        rc = vol_part_get_ids(id_buf, size, &act_size);
    105105        if (rc != EOK) {
    106106                async_answer_0(callid, rc);
     
    115115}
    116116
    117 static void vol_disk_info_srv(ipc_callid_t iid, ipc_call_t *icall)
     117static void vol_part_info_srv(ipc_callid_t iid, ipc_call_t *icall)
    118118{
    119119        service_id_t sid;
    120         vol_disk_t *disk;
    121         vol_disk_info_t dinfo;
     120        vol_part_t *part;
     121        vol_part_info_t pinfo;
    122122        int rc;
    123123
    124124        sid = IPC_GET_ARG1(*icall);
    125         rc = vol_disk_find_by_id(sid, &disk);
     125        rc = vol_part_find_by_id(sid, &part);
    126126        if (rc != EOK) {
    127127                async_answer_0(iid, ENOENT);
     
    129129        }
    130130
    131         rc = vol_disk_get_info(disk, &dinfo);
     131        rc = vol_part_get_info(part, &pinfo);
    132132        if (rc != EOK) {
    133133                async_answer_0(iid, EIO);
     
    135135        }
    136136
    137         async_answer_3(iid, rc, dinfo.dcnt, dinfo.ltype, dinfo.flags);
    138 }
    139 
    140 static void vol_label_create_srv(ipc_callid_t iid, ipc_call_t *icall)
     137        async_answer_3(iid, rc, pinfo.dcnt, pinfo.ltype, pinfo.flags);
     138}
     139
     140static void vol_part_empty_srv(ipc_callid_t iid, ipc_call_t *icall)
    141141{
    142142        service_id_t sid;
    143         vol_disk_t *disk;
    144         label_type_t ltype;
     143        vol_part_t *part;
    145144        int rc;
    146145
    147146        sid = IPC_GET_ARG1(*icall);
    148         ltype = IPC_GET_ARG2(*icall);
    149 
    150         rc = vol_disk_find_by_id(sid, &disk);
     147
     148        rc = vol_part_find_by_id(sid, &part);
    151149        if (rc != EOK) {
    152150                async_answer_0(iid, ENOENT);
     
    154152        }
    155153
    156         rc = vol_disk_label_create(disk, ltype);
    157         if (rc != EOK) {
    158                 async_answer_0(iid, EIO);
    159                 return;
    160         }
    161 
    162         async_answer_0(iid, EOK);
    163 }
    164 
    165 static void vol_disk_empty_srv(ipc_callid_t iid, ipc_call_t *icall)
    166 {
    167         service_id_t sid;
    168         vol_disk_t *disk;
    169         int rc;
    170 
    171         sid = IPC_GET_ARG1(*icall);
    172 
    173         rc = vol_disk_find_by_id(sid, &disk);
    174         if (rc != EOK) {
    175                 async_answer_0(iid, ENOENT);
    176                 return;
    177         }
    178 
    179         rc = vol_disk_empty_disk(disk);
     154        rc = vol_part_empty_part(part);
    180155        if (rc != EOK) {
    181156                async_answer_0(iid, EIO);
     
    205180
    206181                switch (method) {
    207                 case VOL_GET_DISKS:
    208                         vol_get_disks_srv(callid, &call);
     182                case VOL_GET_PARTS:
     183                        vol_get_parts_srv(callid, &call);
    209184                        break;
    210                 case VOL_DISK_INFO:
    211                         vol_disk_info_srv(callid, &call);
     185                case VOL_PART_INFO:
     186                        vol_part_info_srv(callid, &call);
    212187                        break;
    213                 case VOL_LABEL_CREATE:
    214                         vol_label_create_srv(callid, &call);
    215                         break;
    216                 case VOL_DISK_EMPTY:
    217                         vol_disk_empty_srv(callid, &call);
     188                case VOL_PART_EMPTY:
     189                        vol_part_empty_srv(callid, &call);
    218190                        break;
    219191                default:
Note: See TracChangeset for help on using the changeset viewer.