Changes in uspace/srv/bd/part/guid_part/guid_part.c [47b7006:15f3c3f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/part/guid_part/guid_part.c
r47b7006 r15f3c3f 51 51 #include <as.h> 52 52 #include <fibril_synch.h> 53 #include < devmap.h>53 #include <loc.h> 54 54 #include <sys/types.h> 55 55 #include <sys/typefmt.h> 56 56 #include <inttypes.h> 57 57 #include <libblock.h> 58 #include < devmap.h>58 #include <loc.h> 59 59 #include <errno.h> 60 60 #include <bool.h> … … 81 81 /** Number of blocks */ 82 82 aoff64_t length; 83 /** Device representing the partition (outbound device) */84 devmap_handle_t dev;83 /** Service representing the partition (outbound device) */ 84 service_id_t dsid; 85 85 /** Points to next partition structure. */ 86 86 struct part *next; … … 90 90 91 91 /** Partitioned device (inbound device) */ 92 static devmap_handle_t indev_handle;92 static service_id_t indev_sid; 93 93 94 94 /** List of partitions. This structure is an empty head. */ … … 99 99 static part_t *gpt_part_new(void); 100 100 static void gpt_pte_to_part(const gpt_entry_t *pte, part_t *part); 101 static void gpt_connection(ipc_callid_t iid, ipc_call_t *icall );101 static void gpt_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg); 102 102 static int gpt_bd_read(part_t *p, aoff64_t ba, size_t cnt, void *buf); 103 103 static int gpt_bd_write(part_t *p, aoff64_t ba, size_t cnt, const void *buf); … … 129 129 int i; 130 130 char *name; 131 devmap_handle_t dev;131 service_id_t dsid; 132 132 uint64_t size_mb; 133 133 part_t *part; 134 134 135 rc = devmap_device_get_handle(dev_name, &indev_handle, 0);135 rc = loc_service_get_id(dev_name, &indev_sid, 0); 136 136 if (rc != EOK) { 137 137 printf(NAME ": could not resolve device `%s'.\n", dev_name); … … 139 139 } 140 140 141 rc = block_init( indev_handle, 2048);141 rc = block_init(EXCHANGE_SERIALIZE, indev_sid, 2048); 142 142 if (rc != EOK) { 143 143 printf(NAME ": could not init libblock.\n"); … … 147 147 /* Determine and verify block size. */ 148 148 149 rc = block_get_bsize(indev_ handle, &block_size);149 rc = block_get_bsize(indev_sid, &block_size); 150 150 if (rc != EOK) { 151 151 printf(NAME ": error getting block size.\n"); … … 163 163 return rc; 164 164 165 /* Register the driver with device mapper. */166 rc = devmap_driver_register(NAME, gpt_connection);165 /* Register server with location service. */ 166 rc = loc_server_register(NAME, gpt_connection); 167 167 if (rc != EOK) { 168 printf(NAME ": Unable to register driver.\n");168 printf(NAME ": Unable to register server.\n"); 169 169 return rc; 170 170 } … … 188 188 return ENOMEM; 189 189 190 rc = devmap_device_register(name, &dev);190 rc = loc_service_register(name, &dsid); 191 191 if (rc != EOK) { 192 printf(NAME ": Unable to register device %s.\n", name);192 printf(NAME ": Unable to register service %s.\n", name); 193 193 return rc; 194 194 } … … 199 199 "%" PRIuOFF64 " MB.\n", name, part->length, size_mb); 200 200 201 part->d ev = dev;201 part->dsid = dsid; 202 202 free(name); 203 203 … … 228 228 } 229 229 230 rc = block_read_direct(indev_ handle, GPT_HDR_BA, 1, gpt_hdr);230 rc = block_read_direct(indev_sid, GPT_HDR_BA, 1, gpt_hdr); 231 231 if (rc != EOK) { 232 232 printf(NAME ": Failed reading GPT header block.\n"); … … 256 256 } 257 257 258 rc = block_read_direct(indev_ handle, ba, bcnt, etable);258 rc = block_read_direct(indev_sid, ba, bcnt, etable); 259 259 if (rc != EOK) { 260 260 printf(NAME ": Failed reading GPT entries.\n"); … … 303 303 } 304 304 305 part->d ev= 0;305 part->dsid = 0; 306 306 part->next = NULL; 307 307 } 308 308 309 static void gpt_connection(ipc_callid_t iid, ipc_call_t *icall )309 static void gpt_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 310 310 { 311 311 size_t comm_size; … … 314 314 ipc_call_t call; 315 315 sysarg_t method; 316 devmap_handle_t dh;316 service_id_t dh; 317 317 unsigned int flags; 318 318 int retval; … … 330 330 */ 331 331 part = plist_head.next; 332 while (part != NULL && part->d ev!= dh)332 while (part != NULL && part->dsid != dh) 333 333 part = part->next; 334 334 … … 356 356 (void) async_share_out_finalize(callid, fs_va); 357 357 358 while ( 1) {358 while (true) { 359 359 callid = async_get_call(&call); 360 360 method = IPC_GET_IMETHOD(call); 361 switch (method) {362 case IPC_M_PHONE_HUNGUP:361 362 if (!method) { 363 363 /* The other side has hung up. */ 364 364 async_answer_0(callid, EOK); 365 365 return; 366 } 367 368 switch (method) { 366 369 case BD_READ_BLOCKS: 367 370 ba = MERGE_LOUP32(IPC_GET_ARG1(call), … … 407 410 return ELIMIT; 408 411 409 return block_read_direct(indev_ handle, gba, cnt, buf);412 return block_read_direct(indev_sid, gba, cnt, buf); 410 413 } 411 414 … … 418 421 return ELIMIT; 419 422 420 return block_write_direct(indev_ handle, gba, cnt, buf);423 return block_write_direct(indev_sid, gba, cnt, buf); 421 424 } 422 425
Note:
See TracChangeset
for help on using the changeset viewer.