Changeset b7a4d06 in mainline for uspace/srv/bd


Ignore:
Timestamp:
2015-07-18T12:55:12Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c43db5f
Parents:
70815a24
Message:

Most of extended (but not logical) partition support.

Location:
uspace/srv/bd/vbd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/vbd/disk.c

    r70815a24 rb7a4d06  
    125125            disk->svc_name, lpart);
    126126
     127        label_part_get_info(lpart, &lpinfo);
     128
    127129        part = calloc(1, sizeof(vbds_part_t));
    128130        if (part == NULL) {
     
    148150
    149151        free(name);
    150         label_part_get_info(lpart, &lpinfo);
    151152
    152153        part->lpart = lpart;
     
    302303}
    303304
    304 int vbds_disk_info(service_id_t sid, vbds_disk_info_t *info)
     305int vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
    305306{
    306307        vbds_disk_t *disk;
     
    317318
    318319        info->ltype = linfo.ltype;
     320        info->flags = linfo.flags;
    319321        info->ablock0 = linfo.ablock0;
    320322        info->anblocks = linfo.anblocks;
     
    467469
    468470        pinfo->index = lpinfo.index;
     471        pinfo->pkind = lpinfo.pkind;
    469472        pinfo->block0 = lpinfo.block0;
    470473        pinfo->nblocks = lpinfo.nblocks;
     
    492495        lpspec.block0 = pspec->block0;
    493496        lpspec.nblocks = pspec->nblocks;
     497        lpspec.pkind = pspec->pkind;
    494498        lpspec.ptype = pspec->ptype;
    495499
  • uspace/srv/bd/vbd/disk.h

    r70815a24 rb7a4d06  
    4545extern int vbds_disk_add(service_id_t);
    4646extern int vbds_disk_remove(service_id_t);
    47 extern int vbds_disk_info(service_id_t, vbds_disk_info_t *);
     47extern int vbds_disk_info(service_id_t, vbd_disk_info_t *);
    4848extern int vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *);
    4949extern int vbds_label_create(service_id_t, label_type_t);
  • uspace/srv/bd/vbd/types/vbd.h

    r70815a24 rb7a4d06  
    4747typedef sysarg_t vbds_part_id_t;
    4848
    49 /** Disk info */
    50 typedef struct {
    51         /** Label type */
    52         label_type_t ltype;
    53         /** First block that can be allocated */
    54         aoff64_t ablock0;
    55         /** Number of blocks that can be allocated */
    56         aoff64_t anblocks;
    57         /** Block size */
    58         size_t block_size;
    59 } vbds_disk_info_t;
    60 
    6149/** Partition */
    6250typedef struct {
  • uspace/srv/bd/vbd/vbd.c

    r70815a24 rb7a4d06  
    107107{
    108108        service_id_t disk_sid;
    109         vbds_disk_info_t dinfo;
     109        vbd_disk_info_t dinfo;
    110110        int rc;
    111111
     
    127127        }
    128128
    129         if (size != sizeof(vbds_disk_info_t)) {
     129        if (size != sizeof(vbd_disk_info_t)) {
    130130                async_answer_0(callid, EINVAL);
    131131                async_answer_0(iid, EINVAL);
     
    219219        part = IPC_GET_ARG1(*icall);
    220220        rc = vbds_part_get_info(part, &pinfo);
    221         async_answer_5(iid, (sysarg_t)rc, pinfo.index,
    222             LOWER32(pinfo.block0), UPPER32(pinfo.block0),
    223             LOWER32(pinfo.nblocks), UPPER32(pinfo.nblocks));
     221        if (rc != EOK) {
     222                async_answer_0(iid, rc);
     223                return;
     224        }
     225
     226        ipc_callid_t callid;
     227        size_t size;
     228        if (!async_data_read_receive(&callid, &size)) {
     229                async_answer_0(callid, EREFUSED);
     230                async_answer_0(iid, EREFUSED);
     231                return;
     232        }
     233
     234        if (size != sizeof(vbd_part_info_t)) {
     235                async_answer_0(callid, EINVAL);
     236                async_answer_0(iid, EINVAL);
     237                return;
     238        }
     239
     240        rc = async_data_read_finalize(callid, &pinfo,
     241            min(size, sizeof(pinfo)));
     242        if (rc != EOK) {
     243                async_answer_0(callid, rc);
     244                async_answer_0(iid, rc);
     245                return;
     246        }
     247
     248        async_answer_0(iid, EOK);
    224249}
    225250
Note: See TracChangeset for help on using the changeset viewer.