Changeset 15f3c3f in mainline for uspace/srv/bd/part/mbr_part/mbr_part.c
- Timestamp:
- 2011-06-22T22:00:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86ffa27f
- Parents:
- ef09a7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/part/mbr_part/mbr_part.c
ref09a7a r15f3c3f 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>68 #include <loc.h> 69 69 #include <errno.h> 70 70 #include <bool.h> … … 100 100 aoff64_t length; 101 101 /** Device representing the partition (outbound device) */ 102 devmap_handle_t dev;102 service_id_t dsid; 103 103 /** Points to next partition structure. */ 104 104 struct part *next; … … 141 141 142 142 /** Partitioned device (inbound device) */ 143 static devmap_handle_t indev_handle;143 static service_id_t indef_sid; 144 144 145 145 /** List of partitions. This structure is an empty head. */ … … 180 180 int i; 181 181 char *name; 182 devmap_handle_t dev;182 service_id_t dsid; 183 183 uint64_t size_mb; 184 184 part_t *part; 185 185 186 rc = devmap_device_get_handle(dev_name, &indev_handle, 0);186 rc = loc_service_get_id(dev_name, &indef_sid, 0); 187 187 if (rc != EOK) { 188 188 printf(NAME ": could not resolve device `%s'.\n", dev_name); … … 190 190 } 191 191 192 rc = block_init(EXCHANGE_SERIALIZE, inde v_handle, 2048);192 rc = block_init(EXCHANGE_SERIALIZE, indef_sid, 2048); 193 193 if (rc != EOK) { 194 194 printf(NAME ": could not init libblock.\n"); … … 198 198 /* Determine and verify block size. */ 199 199 200 rc = block_get_bsize(inde v_handle, &block_size);200 rc = block_get_bsize(indef_sid, &block_size); 201 201 if (rc != EOK) { 202 202 printf(NAME ": error getting block size.\n"); … … 214 214 return rc; 215 215 216 /* Register the driver with device mapper. */217 rc = devmap_driver_register(NAME, mbr_connection);216 /* Register server with location service. */ 217 rc = loc_server_register(NAME, mbr_connection); 218 218 if (rc != EOK) { 219 printf(NAME ": Unable to register driver.\n");219 printf(NAME ": Unable to register server.\n"); 220 220 return rc; 221 221 } … … 239 239 return ENOMEM; 240 240 241 rc = devmap_device_register(name, &dev);241 rc = loc_service_register(name, &dsid); 242 242 if (rc != EOK) { 243 printf(NAME ": Unable to register device %s.\n", name);243 printf(NAME ": Unable to register service %s.\n", name); 244 244 return rc; 245 245 } … … 250 250 "%" PRIu64 " MB.\n", name, part->length, size_mb); 251 251 252 part->d ev = dev;252 part->dsid = dsid; 253 253 free(name); 254 254 … … 281 281 */ 282 282 283 rc = block_read_direct(inde v_handle, 0, 1, brb);283 rc = block_read_direct(indef_sid, 0, 1, brb); 284 284 if (rc != EOK) { 285 285 printf(NAME ": Failed reading MBR block.\n"); … … 332 332 */ 333 333 ba = cp.start_addr; 334 rc = block_read_direct(inde v_handle, ba, 1, brb);334 rc = block_read_direct(indef_sid, ba, 1, brb); 335 335 if (rc != EOK) { 336 336 printf(NAME ": Failed reading EBR block at %" … … 381 381 part->present = (pte->ptype != PT_UNUSED) ? true : false; 382 382 383 part->d ev= 0;383 part->dsid = 0; 384 384 part->next = NULL; 385 385 } … … 392 392 ipc_call_t call; 393 393 sysarg_t method; 394 devmap_handle_t dh;394 service_id_t dh; 395 395 unsigned int flags; 396 396 int retval; … … 408 408 */ 409 409 part = plist_head.next; 410 while (part != NULL && part->d ev!= dh)410 while (part != NULL && part->dsid != dh) 411 411 part = part->next; 412 412 … … 488 488 return ELIMIT; 489 489 490 return block_read_direct(inde v_handle, gba, cnt, buf);490 return block_read_direct(indef_sid, gba, cnt, buf); 491 491 } 492 492 … … 499 499 return ELIMIT; 500 500 501 return block_write_direct(inde v_handle, gba, cnt, buf);501 return block_write_direct(indef_sid, gba, cnt, buf); 502 502 } 503 503
Note:
See TracChangeset
for help on using the changeset viewer.