Changeset 6bc542b in mainline for uspace/srv/bd/vbd/disk.c
- Timestamp:
- 2015-07-02T21:53:12Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 99c23405
- Parents:
- 6a0d4ce2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/vbd/disk.c
r6a0d4ce2 r6bc542b 112 112 } 113 113 114 static int vbds_part_add(vbds_disk_t *disk, label_part_t *lpart) 114 static int vbds_part_add(vbds_disk_t *disk, label_part_t *lpart, 115 vbds_part_t **rpart) 115 116 { 116 117 vbds_part_t *part; … … 163 164 list_append(&part->lparts, &vbds_parts); 164 165 166 if (rpart != NULL) 167 *rpart = part; 165 168 return EOK; 166 169 } … … 230 233 part = label_part_first(label); 231 234 while (part != NULL) { 232 rc = vbds_part_add(disk, part );235 rc = vbds_part_add(disk, part, NULL); 233 236 if (rc != EOK) { 234 237 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partitio " … … 389 392 } 390 393 391 int vbds_part_create(service_id_t sid, vbds_part_id_t *rpart) 394 int vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec, 395 vbds_part_id_t *rpart) 392 396 { 393 397 vbds_disk_t *disk; 394 398 vbds_part_t *part; 395 label_part_spec_t pspec;399 label_part_spec_t lpspec; 396 400 label_part_t *lpart; 397 401 int rc; 398 399 part = calloc(1, sizeof(vbds_part_t));400 if (part == NULL)401 return ENOMEM;402 402 403 403 rc = vbds_disk_by_svcid(sid, &disk); … … 408 408 } 409 409 410 label_pspec_init(&pspec); 411 rc = label_part_create(disk->label, &pspec, &lpart); 410 label_pspec_init(&lpspec); 411 lpspec.index = pspec->index; 412 lpspec.block0 = pspec->block0; 413 lpspec.nblocks = pspec->nblocks; 414 lpspec.ptype = pspec->ptype; 415 416 rc = label_part_create(disk->label, &lpspec, &lpart); 412 417 if (rc != EOK) { 413 418 log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating partition."); … … 415 420 } 416 421 417 rc = vbds_part_add(disk, lpart );422 rc = vbds_part_add(disk, lpart, &part); 418 423 if (rc != EOK) { 419 424 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed while creating " … … 427 432 } 428 433 434 if (rpart != NULL) 435 *rpart = part->id; 429 436 return EOK; 430 437 error: 431 free(part);432 438 return rc; 433 439 }
Note:
See TracChangeset
for help on using the changeset viewer.