Changeset 15f3c3f in mainline for uspace/srv/bd
- Timestamp:
- 2011-06-22T22:00:52Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86ffa27f
- Parents:
- ef09a7a
- Location:
- uspace/srv/bd
- Files:
-
- 7 edited
-
ata_bd/ata_bd.c (modified) (5 diffs)
-
ata_bd/ata_bd.h (modified) (1 diff)
-
file_bd/file_bd.c (modified) (4 diffs)
-
gxe_bd/gxe_bd.c (modified) (6 diffs)
-
part/guid_part/guid_part.c (modified) (16 diffs)
-
part/mbr_part/mbr_part.c (modified) (16 diffs)
-
rd/rd.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
ref09a7a r15f3c3f 57 57 #include <stdint.h> 58 58 #include <str.h> 59 #include < devmap.h>59 #include <loc.h> 60 60 #include <sys/types.h> 61 61 #include <inttypes.h> … … 179 179 180 180 snprintf(name, 16, "%s/ata%udisk%d", NAMESPACE, ctl_num, i); 181 rc = devmap_device_register(name, &disk[i].devmap_handle);181 rc = loc_service_register(name, &disk[i].service_id); 182 182 if (rc != EOK) { 183 183 printf(NAME ": Unable to register device %s.\n", name); … … 247 247 int rc; 248 248 249 rc = devmap_driver_register(NAME, ata_bd_connection);249 rc = loc_server_register(NAME, ata_bd_connection); 250 250 if (rc < 0) { 251 251 printf(NAME ": Unable to register driver.\n"); … … 280 280 ipc_call_t call; 281 281 sysarg_t method; 282 devmap_handle_t dh;282 service_id_t dsid; 283 283 unsigned int flags; 284 284 int retval; … … 287 287 int disk_id, i; 288 288 289 /* Get the device handle. */290 d h= IPC_GET_ARG1(*icall);289 /* Get the device service ID. */ 290 dsid = IPC_GET_ARG1(*icall); 291 291 292 292 /* Determine which disk device is the client connecting to. */ 293 293 disk_id = -1; 294 294 for (i = 0; i < MAX_DISKS; i++) 295 if (disk[i]. devmap_handle == dh)295 if (disk[i].service_id == dsid) 296 296 disk_id = i; 297 297 -
uspace/srv/bd/ata_bd/ata_bd.h
ref09a7a r15f3c3f 116 116 117 117 fibril_mutex_t lock; 118 devmap_handle_t devmap_handle;118 service_id_t service_id; 119 119 } disk_t; 120 120 -
uspace/srv/bd/file_bd/file_bd.c
ref09a7a r15f3c3f 45 45 #include <as.h> 46 46 #include <fibril_synch.h> 47 #include < devmap.h>47 #include <loc.h> 48 48 #include <sys/types.h> 49 49 #include <sys/typefmt.h> … … 61 61 static FILE *img; 62 62 63 static devmap_handle_t devmap_handle;63 static service_id_t service_id; 64 64 static fibril_mutex_t dev_lock; 65 65 … … 117 117 return -1; 118 118 119 rc = devmap_device_register(device_name, &devmap_handle);119 rc = loc_service_register(device_name, &service_id); 120 120 if (rc != EOK) { 121 121 printf(NAME ": Unable to register device '%s'.\n", … … 142 142 long img_size; 143 143 144 rc = devmap_driver_register(NAME, file_bd_connection);144 rc = loc_server_register(NAME, file_bd_connection); 145 145 if (rc < 0) { 146 146 printf(NAME ": Unable to register driver.\n"); -
uspace/srv/bd/gxe_bd/gxe_bd.c
ref09a7a r15f3c3f 43 43 #include <as.h> 44 44 #include <fibril_synch.h> 45 #include < devmap.h>45 #include <loc.h> 46 46 #include <sys/types.h> 47 47 #include <errno.h> … … 92 92 static gxe_bd_t *dev; 93 93 94 static devmap_handle_t devmap_handle[MAX_DISKS];94 static service_id_t service_id[MAX_DISKS]; 95 95 96 96 static fibril_mutex_t dev_lock[MAX_DISKS]; … … 126 126 char name[16]; 127 127 128 rc = devmap_driver_register(NAME, gxe_bd_connection);128 rc = loc_server_register(NAME, gxe_bd_connection); 129 129 if (rc < 0) { 130 130 printf(NAME ": Unable to register driver.\n"); … … 142 142 for (i = 0; i < MAX_DISKS; i++) { 143 143 snprintf(name, 16, "%s/disk%d", NAMESPACE, i); 144 rc = devmap_device_register(name, &devmap_handle[i]);144 rc = loc_service_register(name, &service_id[i]); 145 145 if (rc != EOK) { 146 146 printf(NAME ": Unable to register device %s.\n", name); … … 159 159 ipc_call_t call; 160 160 sysarg_t method; 161 devmap_handle_t dh;161 service_id_t dsid; 162 162 unsigned int flags; 163 163 int retval; … … 167 167 168 168 /* Get the device handle. */ 169 d h= IPC_GET_ARG1(*icall);169 dsid = IPC_GET_ARG1(*icall); 170 170 171 171 /* Determine which disk device is the client connecting to. */ 172 172 disk_id = -1; 173 173 for (i = 0; i < MAX_DISKS; i++) 174 if ( devmap_handle[i] == dh)174 if (service_id[i] == dsid) 175 175 disk_id = i; 176 176 -
uspace/srv/bd/part/guid_part/guid_part.c
ref09a7a 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. */ … … 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(EXCHANGE_SERIALIZE, 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 } … … 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 … … 410 410 return ELIMIT; 411 411 412 return block_read_direct(indev_ handle, gba, cnt, buf);412 return block_read_direct(indev_sid, gba, cnt, buf); 413 413 } 414 414 … … 421 421 return ELIMIT; 422 422 423 return block_write_direct(indev_ handle, gba, cnt, buf);423 return block_write_direct(indev_sid, gba, cnt, buf); 424 424 } 425 425 -
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 -
uspace/srv/bd/rd/rd.c
ref09a7a r15f3c3f 52 52 #include <fibril_synch.h> 53 53 #include <stdio.h> 54 #include < devmap.h>54 #include <loc.h> 55 55 #include <ipc/bd.h> 56 56 #include <macros.h> … … 235 235 (void *) rd_ph_addr, rd_size); 236 236 237 int rc = devmap_driver_register(NAME, rd_connection);237 int rc = loc_server_register(NAME, rd_connection); 238 238 if (rc < 0) { 239 239 printf("%s: Unable to register driver (%d)\n", NAME, rc); … … 241 241 } 242 242 243 devmap_handle_t devmap_handle;244 if ( devmap_device_register("bd/initrd", &devmap_handle) != EOK) {245 printf("%s: Unable to register device \n", NAME);243 service_id_t service_id; 244 if (loc_service_register("bd/initrd", &service_id) != EOK) { 245 printf("%s: Unable to register device service\n", NAME); 246 246 return false; 247 247 }
Note:
See TracChangeset
for help on using the changeset viewer.
