Changeset 903bac0a in mainline for uspace/srv/bd/part/mbr_part/mbr_part.c
- Timestamp:
- 2011-08-19T09:00:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2ab36f1
- Parents:
- d894fbd (diff), 42a619b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/part/mbr_part/mbr_part.c
rd894fbd r903bac0a 61 61 #include <as.h> 62 62 #include <fibril_synch.h> 63 #include < devmap.h>63 #include <loc.h> 64 64 #include <sys/types.h> 65 65 #include <sys/typefmt.h> 66 66 #include <inttypes.h> 67 67 #include <libblock.h> 68 #include <devmap.h>69 68 #include <errno.h> 70 69 #include <bool.h> … … 100 99 aoff64_t length; 101 100 /** Device representing the partition (outbound device) */ 102 devmap_handle_t dev;101 service_id_t dsid; 103 102 /** Points to next partition structure. */ 104 103 struct part *next; … … 141 140 142 141 /** Partitioned device (inbound device) */ 143 static devmap_handle_t indev_handle;142 static service_id_t indef_sid; 144 143 145 144 /** List of partitions. This structure is an empty head. */ … … 180 179 int i; 181 180 char *name; 182 devmap_handle_t dev;181 service_id_t dsid; 183 182 uint64_t size_mb; 184 183 part_t *part; 185 184 186 rc = devmap_device_get_handle(dev_name, &indev_handle, 0);185 rc = loc_service_get_id(dev_name, &indef_sid, 0); 187 186 if (rc != EOK) { 188 187 printf(NAME ": could not resolve device `%s'.\n", dev_name); … … 190 189 } 191 190 192 rc = block_init(EXCHANGE_SERIALIZE, inde v_handle, 2048);191 rc = block_init(EXCHANGE_SERIALIZE, indef_sid, 2048); 193 192 if (rc != EOK) { 194 193 printf(NAME ": could not init libblock.\n"); … … 198 197 /* Determine and verify block size. */ 199 198 200 rc = block_get_bsize(inde v_handle, &block_size);199 rc = block_get_bsize(indef_sid, &block_size); 201 200 if (rc != EOK) { 202 201 printf(NAME ": error getting block size.\n"); … … 214 213 return rc; 215 214 216 /* Register the driver with device mapper. */217 rc = devmap_driver_register(NAME, mbr_connection);215 /* Register server with location service. */ 216 rc = loc_server_register(NAME, mbr_connection); 218 217 if (rc != EOK) { 219 printf(NAME ": Unable to register driver.\n");218 printf(NAME ": Unable to register server.\n"); 220 219 return rc; 221 220 } … … 239 238 return ENOMEM; 240 239 241 rc = devmap_device_register(name, &dev);240 rc = loc_service_register(name, &dsid); 242 241 if (rc != EOK) { 243 printf(NAME ": Unable to register device %s.\n", name);242 printf(NAME ": Unable to register service %s.\n", name); 244 243 return rc; 245 244 } … … 250 249 "%" PRIu64 " MB.\n", name, part->length, size_mb); 251 250 252 part->d ev = dev;251 part->dsid = dsid; 253 252 free(name); 254 253 … … 281 280 */ 282 281 283 rc = block_read_direct(inde v_handle, 0, 1, brb);282 rc = block_read_direct(indef_sid, 0, 1, brb); 284 283 if (rc != EOK) { 285 284 printf(NAME ": Failed reading MBR block.\n"); … … 332 331 */ 333 332 ba = cp.start_addr; 334 rc = block_read_direct(inde v_handle, ba, 1, brb);333 rc = block_read_direct(indef_sid, ba, 1, brb); 335 334 if (rc != EOK) { 336 335 printf(NAME ": Failed reading EBR block at %" … … 381 380 part->present = (pte->ptype != PT_UNUSED) ? true : false; 382 381 383 part->d ev= 0;382 part->dsid = 0; 384 383 part->next = NULL; 385 384 } … … 392 391 ipc_call_t call; 393 392 sysarg_t method; 394 devmap_handle_t dh;393 service_id_t dh; 395 394 unsigned int flags; 396 395 int retval; … … 408 407 */ 409 408 part = plist_head.next; 410 while (part != NULL && part->d ev!= dh)409 while (part != NULL && part->dsid != dh) 411 410 part = part->next; 412 411 … … 488 487 return ELIMIT; 489 488 490 return block_read_direct(inde v_handle, gba, cnt, buf);489 return block_read_direct(indef_sid, gba, cnt, buf); 491 490 } 492 491 … … 499 498 return ELIMIT; 500 499 501 return block_write_direct(inde v_handle, gba, cnt, buf);500 return block_write_direct(indef_sid, gba, cnt, buf); 502 501 } 503 502
Note:
See TracChangeset
for help on using the changeset viewer.