Changeset b7a4d06 in mainline for uspace/srv
- Timestamp:
- 2015-07-18T12:55:12Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c43db5f
- Parents:
- 70815a24
- Location:
- uspace/srv
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/vbd/disk.c
r70815a24 rb7a4d06 125 125 disk->svc_name, lpart); 126 126 127 label_part_get_info(lpart, &lpinfo); 128 127 129 part = calloc(1, sizeof(vbds_part_t)); 128 130 if (part == NULL) { … … 148 150 149 151 free(name); 150 label_part_get_info(lpart, &lpinfo);151 152 152 153 part->lpart = lpart; … … 302 303 } 303 304 304 int vbds_disk_info(service_id_t sid, vbd s_disk_info_t *info)305 int vbds_disk_info(service_id_t sid, vbd_disk_info_t *info) 305 306 { 306 307 vbds_disk_t *disk; … … 317 318 318 319 info->ltype = linfo.ltype; 320 info->flags = linfo.flags; 319 321 info->ablock0 = linfo.ablock0; 320 322 info->anblocks = linfo.anblocks; … … 467 469 468 470 pinfo->index = lpinfo.index; 471 pinfo->pkind = lpinfo.pkind; 469 472 pinfo->block0 = lpinfo.block0; 470 473 pinfo->nblocks = lpinfo.nblocks; … … 492 495 lpspec.block0 = pspec->block0; 493 496 lpspec.nblocks = pspec->nblocks; 497 lpspec.pkind = pspec->pkind; 494 498 lpspec.ptype = pspec->ptype; 495 499 -
uspace/srv/bd/vbd/disk.h
r70815a24 rb7a4d06 45 45 extern int vbds_disk_add(service_id_t); 46 46 extern int vbds_disk_remove(service_id_t); 47 extern int vbds_disk_info(service_id_t, vbd s_disk_info_t *);47 extern int vbds_disk_info(service_id_t, vbd_disk_info_t *); 48 48 extern int vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *); 49 49 extern int vbds_label_create(service_id_t, label_type_t); -
uspace/srv/bd/vbd/types/vbd.h
r70815a24 rb7a4d06 47 47 typedef sysarg_t vbds_part_id_t; 48 48 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 61 49 /** Partition */ 62 50 typedef struct { -
uspace/srv/bd/vbd/vbd.c
r70815a24 rb7a4d06 107 107 { 108 108 service_id_t disk_sid; 109 vbd s_disk_info_t dinfo;109 vbd_disk_info_t dinfo; 110 110 int rc; 111 111 … … 127 127 } 128 128 129 if (size != sizeof(vbd s_disk_info_t)) {129 if (size != sizeof(vbd_disk_info_t)) { 130 130 async_answer_0(callid, EINVAL); 131 131 async_answer_0(iid, EINVAL); … … 219 219 part = IPC_GET_ARG1(*icall); 220 220 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); 224 249 } 225 250 -
uspace/srv/volsrv/disk.c
r70815a24 rb7a4d06 271 271 } 272 272 273 int vol_disk_empty (vol_disk_t *disk)273 int vol_disk_empty_disk(vol_disk_t *disk) 274 274 { 275 275 int rc; … … 286 286 } 287 287 288 int vol_disk_get_info(vol_disk_t *disk, vol_disk_info_t *dinfo) 289 { 290 vbd_disk_info_t vdinfo; 291 int rc; 292 293 dinfo->dcnt = disk->dcnt; 294 295 if (disk->dcnt == dc_label) { 296 rc = vbd_disk_info(vbd, disk->svc_id, &vdinfo); 297 if (rc != EOK) 298 return rc; 299 300 dinfo->ltype = vdinfo.ltype; 301 dinfo->flags = vdinfo.flags; 302 } 303 304 return EOK; 305 } 306 288 307 289 308 /** @} -
uspace/srv/volsrv/disk.h
r70815a24 rb7a4d06 39 39 40 40 #include <sys/types.h> 41 #include <vol.h> 41 42 #include "types/disk.h" 42 43 … … 46 47 extern int vol_disk_find_by_id(service_id_t, vol_disk_t **); 47 48 extern int vol_disk_label_create(vol_disk_t *, label_type_t); 48 extern int vol_disk_empty(vol_disk_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 *); 49 51 50 52 #endif -
uspace/srv/volsrv/volsrv.c
r70815a24 rb7a4d06 43 43 #include <stdlib.h> 44 44 #include <task.h> 45 #include <vol.h> 45 46 46 47 #include "disk.h" … … 118 119 service_id_t sid; 119 120 vol_disk_t *disk; 121 vol_disk_info_t dinfo; 120 122 int rc; 121 123 … … 127 129 } 128 130 129 async_answer_2(iid, rc, disk->dcnt, disk->ltype); 131 rc = vol_disk_get_info(disk, &dinfo); 132 if (rc != EOK) { 133 async_answer_0(iid, EIO); 134 return; 135 } 136 137 async_answer_3(iid, rc, dinfo.dcnt, dinfo.ltype, dinfo.flags); 130 138 } 131 139 … … 169 177 } 170 178 171 rc = vol_disk_empty (disk);179 rc = vol_disk_empty_disk(disk); 172 180 if (rc != EOK) { 173 181 async_answer_0(iid, EIO);
Note:
See TracChangeset
for help on using the changeset viewer.