Changes in uspace/lib/c/generic/vbd.c [cde999a:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vbd.c
rcde999a rb7fd2a0 44 44 #include <vbd.h> 45 45 46 static int vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **,46 static errno_t vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **, 47 47 size_t *); 48 48 49 int vbd_create(vbd_t **rvbd)49 errno_t vbd_create(vbd_t **rvbd) 50 50 { 51 51 vbd_t *vbd; 52 52 service_id_t vbd_svcid; 53 int rc;53 errno_t rc; 54 54 55 55 vbd = calloc(1, sizeof(vbd_t)); … … 97 97 * @return EOK on success or an error code 98 98 */ 99 int vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count)99 errno_t vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count) 100 100 { 101 101 return vbd_get_ids_internal(vbd, VBD_GET_DISKS, 0, data, count); … … 103 103 104 104 /** Get disk information. */ 105 int vbd_disk_info(vbd_t *vbd, service_id_t sid, vbd_disk_info_t *vinfo)106 { 107 async_exch_t *exch; 108 int retval;105 errno_t vbd_disk_info(vbd_t *vbd, service_id_t sid, vbd_disk_info_t *vinfo) 106 { 107 async_exch_t *exch; 108 errno_t retval; 109 109 ipc_call_t answer; 110 110 111 111 exch = async_exchange_begin(vbd->sess); 112 112 aid_t req = async_send_1(exch, VBD_DISK_INFO, sid, &answer); 113 int rc = async_data_read_start(exch, vinfo, sizeof(vbd_disk_info_t));114 async_exchange_end(exch); 115 116 if (rc != EOK) { 117 async_forget(req); 118 return EIO; 119 } 120 121 async_wait_for(req, &retval); 122 if (retval != EOK) 123 return EIO; 124 125 return EOK; 126 } 127 128 int vbd_label_create(vbd_t *vbd, service_id_t sid, label_type_t ltype)129 { 130 async_exch_t *exch; 131 int retval;113 errno_t rc = async_data_read_start(exch, vinfo, sizeof(vbd_disk_info_t)); 114 async_exchange_end(exch); 115 116 if (rc != EOK) { 117 async_forget(req); 118 return EIO; 119 } 120 121 async_wait_for(req, &retval); 122 if (retval != EOK) 123 return EIO; 124 125 return EOK; 126 } 127 128 errno_t vbd_label_create(vbd_t *vbd, service_id_t sid, label_type_t ltype) 129 { 130 async_exch_t *exch; 131 errno_t retval; 132 132 133 133 exch = async_exchange_begin(vbd->sess); … … 141 141 } 142 142 143 int vbd_label_delete(vbd_t *vbd, service_id_t sid)144 { 145 async_exch_t *exch; 146 int retval;143 errno_t vbd_label_delete(vbd_t *vbd, service_id_t sid) 144 { 145 async_exch_t *exch; 146 errno_t retval; 147 147 148 148 exch = async_exchange_begin(vbd->sess); … … 167 167 * @return EOK on success or an error code. 168 168 */ 169 static int vbd_get_ids_once(vbd_t *vbd, sysarg_t method, sysarg_t arg1,169 static errno_t vbd_get_ids_once(vbd_t *vbd, sysarg_t method, sysarg_t arg1, 170 170 sysarg_t *id_buf, size_t buf_size, size_t *act_size) 171 171 { … … 174 174 ipc_call_t answer; 175 175 aid_t req = async_send_1(exch, method, arg1, &answer); 176 int rc = async_data_read_start(exch, id_buf, buf_size);176 errno_t rc = async_data_read_start(exch, id_buf, buf_size); 177 177 178 178 async_exchange_end(exch); … … 183 183 } 184 184 185 int retval;185 errno_t retval; 186 186 async_wait_for(req, &retval); 187 187 … … 205 205 * @return EOK on success or an error code 206 206 */ 207 static int vbd_get_ids_internal(vbd_t *vbd, sysarg_t method, sysarg_t arg1,207 static errno_t vbd_get_ids_internal(vbd_t *vbd, sysarg_t method, sysarg_t arg1, 208 208 sysarg_t **data, size_t *count) 209 209 { … … 212 212 213 213 size_t act_size = 0; 214 int rc = vbd_get_ids_once(vbd, method, arg1, NULL, 0, &act_size);214 errno_t rc = vbd_get_ids_once(vbd, method, arg1, NULL, 0, &act_size); 215 215 if (rc != EOK) 216 216 return rc; … … 249 249 * @return EOK on success or an error code 250 250 */ 251 int vbd_label_get_parts(vbd_t *vbd, service_id_t disk,251 errno_t vbd_label_get_parts(vbd_t *vbd, service_id_t disk, 252 252 service_id_t **data, size_t *count) 253 253 { … … 256 256 } 257 257 258 int vbd_part_get_info(vbd_t *vbd, vbd_part_id_t part, vbd_part_info_t *pinfo)259 { 260 async_exch_t *exch; 261 int retval;258 errno_t vbd_part_get_info(vbd_t *vbd, vbd_part_id_t part, vbd_part_info_t *pinfo) 259 { 260 async_exch_t *exch; 261 errno_t retval; 262 262 ipc_call_t answer; 263 263 264 264 exch = async_exchange_begin(vbd->sess); 265 265 aid_t req = async_send_1(exch, VBD_PART_GET_INFO, part, &answer); 266 int rc = async_data_read_start(exch, pinfo, sizeof(vbd_part_info_t));267 async_exchange_end(exch); 268 269 if (rc != EOK) { 270 async_forget(req); 271 return EIO; 272 } 273 274 async_wait_for(req, &retval); 275 if (retval != EOK) 276 return EIO; 277 278 return EOK; 279 } 280 281 int vbd_part_create(vbd_t *vbd, service_id_t disk, vbd_part_spec_t *pspec,266 errno_t rc = async_data_read_start(exch, pinfo, sizeof(vbd_part_info_t)); 267 async_exchange_end(exch); 268 269 if (rc != EOK) { 270 async_forget(req); 271 return EIO; 272 } 273 274 async_wait_for(req, &retval); 275 if (retval != EOK) 276 return EIO; 277 278 return EOK; 279 } 280 281 errno_t vbd_part_create(vbd_t *vbd, service_id_t disk, vbd_part_spec_t *pspec, 282 282 vbd_part_id_t *rpart) 283 283 { 284 284 async_exch_t *exch; 285 int retval;285 errno_t retval; 286 286 ipc_call_t answer; 287 287 288 288 exch = async_exchange_begin(vbd->sess); 289 289 aid_t req = async_send_1(exch, VBD_PART_CREATE, disk, &answer); 290 int rc = async_data_write_start(exch, pspec, sizeof(vbd_part_spec_t));290 errno_t rc = async_data_write_start(exch, pspec, sizeof(vbd_part_spec_t)); 291 291 async_exchange_end(exch); 292 292 … … 305 305 } 306 306 307 int vbd_part_delete(vbd_t *vbd, vbd_part_id_t part)308 { 309 async_exch_t *exch; 310 int retval;307 errno_t vbd_part_delete(vbd_t *vbd, vbd_part_id_t part) 308 { 309 async_exch_t *exch; 310 errno_t retval; 311 311 312 312 exch = async_exchange_begin(vbd->sess); … … 334 334 * @return EOK on success or an error code 335 335 */ 336 int vbd_suggest_ptype(vbd_t *vbd, service_id_t disk, label_pcnt_t pcnt,336 errno_t vbd_suggest_ptype(vbd_t *vbd, service_id_t disk, label_pcnt_t pcnt, 337 337 label_ptype_t *ptype) 338 338 { 339 339 async_exch_t *exch; 340 int retval;340 errno_t retval; 341 341 ipc_call_t answer; 342 342 343 343 exch = async_exchange_begin(vbd->sess); 344 344 aid_t req = async_send_2(exch, VBD_SUGGEST_PTYPE, disk, pcnt, &answer); 345 int rc = async_data_read_start(exch, ptype, sizeof(label_ptype_t));345 errno_t rc = async_data_read_start(exch, ptype, sizeof(label_ptype_t)); 346 346 async_exchange_end(exch); 347 347
Note:
See TracChangeset
for help on using the changeset viewer.