Changeset 372df8f in mainline
- Timestamp:
- 2015-10-09T07:00:23Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0ecfc62
- Parents:
- 0bde8523
- Location:
- uspace
- Files:
-
- 3 added
- 1 deleted
- 17 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fdisk/fdisk.c
r0bde8523 r372df8f 212 212 } 213 213 214 for (i = 0; i < LT_LIMIT; i++) {214 for (i = LT_FIRST; i < LT_LIMIT; i++) { 215 215 rc = fdisk_ltype_format(i, &sltype); 216 216 if (rc != EOK) -
uspace/lib/c/generic/vbd.c
r0bde8523 r372df8f 43 43 #include <vbd.h> 44 44 45 static int vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **, 46 size_t *); 47 45 48 int vbd_create(vbd_t **rvbd) 46 49 { … … 85 88 } 86 89 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 */ 98 int 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); 107 101 } 108 102 -
uspace/lib/c/generic/vol.c
r0bde8523 r372df8f 175 175 } 176 176 177 /** Get list of disks as array of service IDs.177 /** Get list of partitions as array of service IDs. 178 178 * 179 179 * @param vol Volume service … … 183 183 * @return EOK on success or negative error code 184 184 */ 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 diskinformation. */191 int vol_ disk_info(vol_t *vol, service_id_t sid, vol_disk_info_t *vinfo)185 int 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. */ 191 int vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo) 192 192 { 193 193 async_exch_t *exch; … … 196 196 197 197 exch = async_exchange_begin(vol->sess); 198 retval = async_req_1_3(exch, VOL_ DISK_INFO, sid, &dcnt, <ype,198 retval = async_req_1_3(exch, VOL_PART_INFO, sid, &dcnt, <ype, 199 199 &flags); 200 200 async_exchange_end(exch); … … 209 209 } 210 210 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. */ 213 int vol_part_empty(vol_t *vol, service_id_t sid) 213 214 { 214 215 async_exch_t *exch; … … 216 217 217 218 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); 219 220 async_exchange_end(exch); 220 221 … … 225 226 } 226 227 227 /** Erase disk (to the extent where we will consider it not containing228 * 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 244 228 /** @} 245 229 */ -
uspace/lib/c/include/ipc/vbd.h
r0bde8523 r372df8f 37 37 38 38 typedef enum { 39 VBD_DISK_ADD = IPC_FIRST_USER_METHOD, 40 VBD_DISK_REMOVE, 39 VBD_GET_DISKS = IPC_FIRST_USER_METHOD, 41 40 VBD_DISK_INFO, 42 41 VBD_LABEL_CREATE, -
uspace/lib/c/include/ipc/vol.h
r0bde8523 r372df8f 37 37 38 38 typedef 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 43 42 } vol_request_t; 44 43 -
uspace/lib/c/include/types/label.h
r0bde8523 r372df8f 52 52 /** Disk label type */ 53 53 typedef enum { 54 /** No label */ 55 lt_none, 54 56 /** BIOS Master Boot Record */ 55 57 lt_mbr, … … 58 60 } label_type_t; 59 61 62 #define LT_FIRST (lt_mbr) 60 63 #define LT_LIMIT (lt_gpt + 1) 61 64 -
uspace/lib/c/include/vbd.h
r0bde8523 r372df8f 93 93 extern int vbd_create(vbd_t **); 94 94 extern 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); 95 extern int vbd_get_disks(vbd_t *, service_id_t **, size_t *); 97 96 extern int vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *); 98 97 extern int vbd_label_create(vbd_t *, service_id_t, label_type_t); -
uspace/lib/c/include/vol.h
r0bde8523 r372df8f 47 47 } vol_t; 48 48 49 /** Diskinformation */49 /** Partition information */ 50 50 typedef struct { 51 /** Diskcontents */51 /** Partition contents */ 52 52 label_disk_cnt_t dcnt; 53 /** Label type, if disk contents is label*/53 /** Label type, if partition contents is label XXX */ 54 54 label_type_t ltype; 55 55 /** Label flags */ 56 56 label_flags_t flags; 57 } vol_ disk_info_t;57 } vol_part_info_t; 58 58 59 59 extern int vol_create(vol_t **); 60 60 extern 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); 61 extern int vol_get_parts(vol_t *, service_id_t **, size_t *); 62 extern int vol_part_info(vol_t *, service_id_t, vol_part_info_t *); 63 extern int vol_part_empty(vol_t *, service_id_t); 65 64 66 65 #endif -
uspace/lib/fdisk/src/fdisk.c
r0bde8523 r372df8f 133 133 list_initialize(&devlist->devinfos); 134 134 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); 136 138 if (rc != EOK) { 137 139 rc = EIO; … … 363 365 int fdisk_dev_open(fdisk_t *fdisk, service_id_t sid, fdisk_dev_t **rdev) 364 366 { 365 v ol_disk_info_t vinfo;367 vbd_disk_info_t vinfo; 366 368 fdisk_dev_t *dev = NULL; 367 369 service_id_t *psids = NULL; … … 380 382 list_initialize(&dev->log_ba); 381 383 382 rc = v ol_disk_info(fdisk->vol, sid, &vinfo);384 rc = vbd_disk_info(fdisk->vbd, sid, &vinfo); 383 385 if (rc != EOK) { 384 386 rc = EIO; … … 386 388 } 387 389 388 dev->dcnt = vinfo.dcnt; 389 390 if (dev->dcnt != dc_label) 391 goto done; 390 dev->dcnt = dc_label; 392 391 393 392 printf("get label info\n"); … … 421 420 422 421 free(psids); 423 done:424 422 *rdev = dev; 425 423 return EOK; … … 479 477 int fdisk_label_get_info(fdisk_dev_t *dev, fdisk_label_info_t *info) 480 478 { 481 v ol_disk_info_t vinfo;482 int rc; 483 484 rc = v ol_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); 485 483 if (rc != EOK) { 486 484 rc = EIO; … … 488 486 } 489 487 490 info->dcnt = vinfo.dcnt;488 info->dcnt = dc_label; 491 489 info->ltype = vinfo.ltype; 492 490 info->flags = vinfo.flags; … … 500 498 int rc; 501 499 502 rc = v ol_label_create(dev->fdisk->vol, dev->sid, ltype);500 rc = vbd_label_create(dev->fdisk->vbd, dev->sid, ltype); 503 501 if (rc != EOK) 504 502 return rc; … … 518 516 part = fdisk_part_first(dev); 519 517 while (part != NULL) { 520 (void) fdisk_part_destroy(part); /* XXX */ 518 rc = fdisk_part_destroy(part); 519 if (rc != EOK) 520 return EIO; 521 521 part = fdisk_part_first(dev); 522 522 } 523 523 524 rc = v ol_disk_empty(dev->fdisk->vol, dev->sid);524 rc = vbd_label_delete(dev->fdisk->vbd, dev->sid); 525 525 if (rc != EOK) 526 526 return EIO; … … 685 685 sltype = NULL; 686 686 switch (ltype) { 687 case lt_none: 688 sltype = "None"; 689 break; 687 690 case lt_mbr: 688 691 sltype = "MBR"; -
uspace/lib/label/Makefile
r0bde8523 r372df8f 33 33 34 34 SOURCES = \ 35 src/dummy.c \ 35 36 src/mbr.c \ 36 37 src/gpt.c \ -
uspace/lib/label/src/label.c
r0bde8523 r372df8f 40 40 #include <stdlib.h> 41 41 42 #include "dummy.h" 42 43 #include "gpt.h" 43 44 #include "mbr.h" … … 46 47 &gpt_label_ops, 47 48 &mbr_label_ops, 49 &dummy_label_ops, 48 50 NULL 49 51 }; … … 70 72 71 73 switch (ltype) { 74 case lt_none: 75 return EINVAL; 72 76 case lt_gpt: 73 77 ops = &gpt_label_ops; -
uspace/srv/bd/vbd/disk.c
r0bde8523 r372df8f 48 48 #include "types/vbd.h" 49 49 50 static fibril_mutex_t vbds_disks_lock; 50 51 static list_t vbds_disks; /* of vbds_disk_t */ 51 52 static list_t vbds_parts; /* of vbds_part_t */ 53 54 static category_id_t part_cid; 52 55 53 56 static int vbds_bd_open(bd_srvs_t *, bd_srv_t *); … … 83 86 } 84 87 85 void vbds_disks_init(void) 86 { 88 int vbds_disks_init(void) 89 { 90 int rc; 91 92 fibril_mutex_initialize(&vbds_disks_lock); 87 93 list_initialize(&vbds_disks); 88 94 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 */ 107 static 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 90 157 91 158 static int vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk) … … 210 277 } 211 278 279 static void vbds_disk_cat_change_cb(void) 280 { 281 (void) vbds_disks_check_new(); 282 } 283 284 int 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 212 298 int vbds_disk_add(service_id_t sid) 213 299 { … … 277 363 rc = vbds_part_add(disk, part, NULL); 278 364 if (rc != EOK) { 279 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partitio "365 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partition " 280 366 "(disk %s)", disk->svc_name); 281 367 } … … 313 399 block_fini(sid); 314 400 free(disk); 401 return EOK; 402 } 403 404 /** Get list of disks as array of service IDs. */ 405 int 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); 315 430 return EOK; 316 431 } … … 751 866 if (rc != EOK) { 752 867 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering " 753 "service %s .", name);868 "service %s (%d).", name, rc); 754 869 free(name); 755 870 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 } 756 886 return EIO; 757 887 } -
uspace/srv/bd/vbd/disk.h
r0bde8523 r372df8f 42 42 #include <vbd.h> 43 43 44 extern void vbds_disks_init(void); 44 extern int vbds_disks_init(void); 45 extern int vbds_disk_discovery_start(void); 45 46 extern int vbds_disk_add(service_id_t); 46 47 extern int vbds_disk_remove(service_id_t); 48 extern int vbds_disk_get_ids(service_id_t *, size_t, size_t *); 47 49 extern int vbds_disk_info(service_id_t, vbd_disk_info_t *); 48 50 extern int vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *); -
uspace/srv/bd/vbd/vbd.c
r0bde8523 r372df8f 60 60 log_msg(LOG_DEFAULT, LVL_NOTE, "vbds_init()"); 61 61 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; 63 69 64 70 async_set_client_connection(vbds_client_conn); … … 79 85 } 80 86 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); 87 static 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); 104 118 } 105 119 … … 362 376 363 377 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); 369 380 break; 370 381 case VBD_DISK_INFO: -
uspace/srv/locsrv/locsrv.c
r0bde8523 r372df8f 1328 1328 categ_dir_add_cat(&cdir, cat); 1329 1329 1330 cat = category_new("partition"); 1331 categ_dir_add_cat(&cdir, cat); 1332 1330 1333 cat = category_new("iplink"); 1331 1334 categ_dir_add_cat(&cdir, cat); -
uspace/srv/volsrv/Makefile
r0bde8523 r372df8f 31 31 32 32 SOURCES = \ 33 disk.c \33 part.c \ 34 34 volsrv.c 35 35 -
uspace/srv/volsrv/part.h
r0bde8523 r372df8f 35 35 */ 36 36 37 #ifndef DISK_H_38 #define DISK_H_37 #ifndef PART_H_ 38 #define pART_H_ 39 39 40 40 #include <sys/types.h> 41 41 #include <vol.h> 42 #include "types/ disk.h"42 #include "types/part.h" 43 43 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 *); 44 extern int vol_part_init(void); 45 extern int vol_part_discovery_start(void); 46 extern int vol_part_get_ids(service_id_t *, size_t, size_t *); 47 extern int vol_part_find_by_id(service_id_t, vol_part_t **); 48 extern int vol_part_empty_part(vol_part_t *); 49 extern int vol_part_get_info(vol_part_t *, vol_part_info_t *); 51 50 52 51 #endif -
uspace/srv/volsrv/types/part.h
r0bde8523 r372df8f 35 35 */ 36 36 37 #ifndef TYPES_ DISK_H_38 #define TYPES_ DISK_H_37 #ifndef TYPES_PART_H_ 38 #define TYPES_PART_H_ 39 39 40 40 #include <types/label.h> 41 41 42 /** Disk*/42 /** Partition */ 43 43 typedef struct { 44 /** Link to vol_ disks */45 link_t l disks;44 /** Link to vol_parts */ 45 link_t lparts; 46 46 /** Service ID */ 47 47 service_id_t svc_id; … … 52 52 /** Label type */ 53 53 label_type_t ltype; 54 } vol_ disk_t;54 } vol_part_t; 55 55 56 56 #endif -
uspace/srv/volsrv/volsrv.c
r0bde8523 r372df8f 45 45 #include <vol.h> 46 46 47 #include " disk.h"47 #include "part.h" 48 48 49 49 #define NAME "volsrv" … … 56 56 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()"); 57 57 58 rc = vol_ disk_init();58 rc = vol_part_init(); 59 59 if (rc != EOK) 60 60 return rc; 61 61 62 rc = vol_ disk_discovery_start();62 rc = vol_part_discovery_start(); 63 63 if (rc != EOK) 64 64 return rc; … … 82 82 } 83 83 84 static void vol_get_ disks_srv(ipc_callid_t iid, ipc_call_t *icall)84 static void vol_get_parts_srv(ipc_callid_t iid, ipc_call_t *icall) 85 85 { 86 86 ipc_callid_t callid; … … 102 102 } 103 103 104 rc = vol_ disk_get_ids(id_buf, size, &act_size);104 rc = vol_part_get_ids(id_buf, size, &act_size); 105 105 if (rc != EOK) { 106 106 async_answer_0(callid, rc); … … 115 115 } 116 116 117 static void vol_ disk_info_srv(ipc_callid_t iid, ipc_call_t *icall)117 static void vol_part_info_srv(ipc_callid_t iid, ipc_call_t *icall) 118 118 { 119 119 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; 122 122 int rc; 123 123 124 124 sid = IPC_GET_ARG1(*icall); 125 rc = vol_ disk_find_by_id(sid, &disk);125 rc = vol_part_find_by_id(sid, &part); 126 126 if (rc != EOK) { 127 127 async_answer_0(iid, ENOENT); … … 129 129 } 130 130 131 rc = vol_ disk_get_info(disk, &dinfo);131 rc = vol_part_get_info(part, &pinfo); 132 132 if (rc != EOK) { 133 133 async_answer_0(iid, EIO); … … 135 135 } 136 136 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 140 static void vol_part_empty_srv(ipc_callid_t iid, ipc_call_t *icall) 141 141 { 142 142 service_id_t sid; 143 vol_disk_t *disk; 144 label_type_t ltype; 143 vol_part_t *part; 145 144 int rc; 146 145 147 146 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); 151 149 if (rc != EOK) { 152 150 async_answer_0(iid, ENOENT); … … 154 152 } 155 153 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); 180 155 if (rc != EOK) { 181 156 async_answer_0(iid, EIO); … … 205 180 206 181 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); 209 184 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); 212 187 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); 218 190 break; 219 191 default:
Note:
See TracChangeset
for help on using the changeset viewer.