Changeset 991f645 in mainline for uspace/srv
- Timestamp:
- 2010-11-18T17:39:28Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0b5a4131
- Parents:
- 51a268f
- Location:
- uspace/srv
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
r51a268f r991f645 139 139 140 140 snprintf(name, 16, "%s/disk%d", NAMESPACE, i); 141 rc = devmap_device_register(name, &disk[i].dev _handle);141 rc = devmap_device_register(name, &disk[i].devmap_handle); 142 142 if (rc != EOK) { 143 143 devmap_hangup_phone(DEVMAP_DRIVER); … … 229 229 ipc_call_t call; 230 230 ipcarg_t method; 231 dev _handle_t dh;231 devmap_handle_t dh; 232 232 int flags; 233 233 int retval; … … 242 242 disk_id = -1; 243 243 for (i = 0; i < MAX_DISKS; i++) 244 if (disk[i].dev _handle == dh)244 if (disk[i].devmap_handle == dh) 245 245 disk_id = i; 246 246 -
uspace/srv/bd/ata_bd/ata_bd.h
r51a268f r991f645 287 287 288 288 fibril_mutex_t lock; 289 dev _handle_t dev_handle;289 devmap_handle_t devmap_handle; 290 290 } disk_t; 291 291 -
uspace/srv/bd/file_bd/file_bd.c
r51a268f r991f645 60 60 static FILE *img; 61 61 62 static dev _handle_t dev_handle;62 static devmap_handle_t devmap_handle; 63 63 static fibril_mutex_t dev_lock; 64 64 … … 82 82 return -1; 83 83 84 rc = devmap_device_register(argv[2], &dev _handle);84 rc = devmap_device_register(argv[2], &devmap_handle); 85 85 if (rc != EOK) { 86 86 devmap_hangup_phone(DEVMAP_DRIVER); -
uspace/srv/bd/gxe_bd/gxe_bd.c
r51a268f r991f645 93 93 static gxe_bd_t *dev; 94 94 95 static dev _handle_t dev_handle[MAX_DISKS];95 static devmap_handle_t devmap_handle[MAX_DISKS]; 96 96 97 97 static fibril_mutex_t dev_lock[MAX_DISKS]; … … 143 143 for (i = 0; i < MAX_DISKS; i++) { 144 144 snprintf(name, 16, "%s/disk%d", NAMESPACE, i); 145 rc = devmap_device_register(name, &dev _handle[i]);145 rc = devmap_device_register(name, &devmap_handle[i]); 146 146 if (rc != EOK) { 147 147 devmap_hangup_phone(DEVMAP_DRIVER); … … 161 161 ipc_call_t call; 162 162 ipcarg_t method; 163 dev _handle_t dh;163 devmap_handle_t dh; 164 164 int flags; 165 165 int retval; … … 174 174 disk_id = -1; 175 175 for (i = 0; i < MAX_DISKS; i++) 176 if (dev _handle[i] == dh)176 if (devmap_handle[i] == dh) 177 177 disk_id = i; 178 178 -
uspace/srv/bd/part/guid_part/guid_part.c
r51a268f r991f645 83 83 aoff64_t length; 84 84 /** Device representing the partition (outbound device) */ 85 dev _handle_t dev;85 devmap_handle_t dev; 86 86 /** Points to next partition structure. */ 87 87 struct part *next; … … 91 91 92 92 /** Partitioned device (inbound device) */ 93 static dev _handle_t indev_handle;93 static devmap_handle_t indev_handle; 94 94 95 95 /** List of partitions. This structure is an empty head. */ … … 130 130 int i; 131 131 char *name; 132 dev _handle_t dev;132 devmap_handle_t dev; 133 133 uint64_t size_mb; 134 134 part_t *part; … … 316 316 ipc_call_t call; 317 317 ipcarg_t method; 318 dev _handle_t dh;318 devmap_handle_t dh; 319 319 int flags; 320 320 int retval; -
uspace/srv/bd/part/mbr_part/mbr_part.c
r51a268f r991f645 101 101 aoff64_t length; 102 102 /** Device representing the partition (outbound device) */ 103 dev _handle_t dev;103 devmap_handle_t dev; 104 104 /** Points to next partition structure. */ 105 105 struct part *next; … … 142 142 143 143 /** Partitioned device (inbound device) */ 144 static dev _handle_t indev_handle;144 static devmap_handle_t indev_handle; 145 145 146 146 /** List of partitions. This structure is an empty head. */ … … 181 181 int i; 182 182 char *name; 183 dev _handle_t dev;183 devmap_handle_t dev; 184 184 uint64_t size_mb; 185 185 part_t *part; … … 394 394 ipc_call_t call; 395 395 ipcarg_t method; 396 dev _handle_t dh;396 devmap_handle_t dh; 397 397 int flags; 398 398 int retval; -
uspace/srv/bd/rd/rd.c
r51a268f r991f645 238 238 } 239 239 240 dev _handle_t dev_handle;241 if (devmap_device_register("bd/initrd", &dev _handle) != EOK) {240 devmap_handle_t devmap_handle; 241 if (devmap_device_register("bd/initrd", &devmap_handle) != EOK) { 242 242 devmap_hangup_phone(DEVMAP_DRIVER); 243 243 printf("%s: Unable to register device\n", NAME); -
uspace/srv/devman/devman.c
r51a268f r991f645 59 59 { 60 60 node_t *dev = hash_table_get_instance(item, node_t, devmap_link); 61 return (dev->devmap_handle == (dev _handle_t) key[0]);61 return (dev->devmap_handle == (devmap_handle_t) key[0]); 62 62 } 63 63 … … 1106 1106 /* Devmap devices */ 1107 1107 1108 node_t *find_devmap_tree_device(dev_tree_t *tree, dev _handle_t devmap_handle)1108 node_t *find_devmap_tree_device(dev_tree_t *tree, devmap_handle_t devmap_handle) 1109 1109 { 1110 1110 node_t *dev = NULL; … … 1122 1122 1123 1123 node_t *find_devmap_class_device(class_list_t *classes, 1124 dev _handle_t devmap_handle)1124 devmap_handle_t devmap_handle) 1125 1125 { 1126 1126 node_t *dev = NULL; -
uspace/srv/devman/devman.h
r51a268f r991f645 157 157 link_t classes; 158 158 /** Devmap handle if the device is registered by devmapper. */ 159 dev _handle_t devmap_handle;159 devmap_handle_t devmap_handle; 160 160 161 161 /** … … 248 248 char *dev_name; 249 249 /** The handle of the device by device mapper in the class namespace. */ 250 dev _handle_t devmap_handle;250 devmap_handle_t devmap_handle; 251 251 252 252 /** … … 337 337 /* Devmap devices */ 338 338 339 extern node_t *find_devmap_tree_device(dev_tree_t *, dev _handle_t);340 extern node_t *find_devmap_class_device(class_list_t *, dev _handle_t);339 extern node_t *find_devmap_tree_device(dev_tree_t *, devmap_handle_t); 340 extern node_t *find_devmap_class_device(class_list_t *, devmap_handle_t); 341 341 342 342 extern void class_add_devmap_device(class_list_t *, dev_class_info_t *); -
uspace/srv/devman/main.c
r51a268f r991f645 464 464 static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall) 465 465 { 466 dev _handle_t devmap_handle = IPC_GET_METHOD(*icall);466 devmap_handle_t devmap_handle = IPC_GET_METHOD(*icall); 467 467 node_t *dev; 468 468 -
uspace/srv/devmap/devmap.c
r51a268f r991f645 75 75 link_t namespaces; 76 76 /** Unique namespace identifier */ 77 dev _handle_t handle;77 devmap_handle_t handle; 78 78 /** Namespace name */ 79 79 char *name; … … 92 92 link_t driver_devices; 93 93 /** Unique device identifier */ 94 dev _handle_t handle;94 devmap_handle_t handle; 95 95 /** Device namespace */ 96 96 devmap_namespace_t *namespace; … … 118 118 static FIBRIL_MUTEX_INITIALIZE(null_devices_mutex); 119 119 120 static dev _handle_t last_handle = 0;120 static devmap_handle_t last_handle = 0; 121 121 static devmap_device_t *null_devices[NULL_DEVICES]; 122 122 123 static dev _handle_t devmap_create_handle(void)123 static devmap_handle_t devmap_create_handle(void) 124 124 { 125 125 /* TODO: allow reusing old handles after their unregistration … … 233 233 * 234 234 */ 235 static devmap_namespace_t *devmap_namespace_find_handle(dev _handle_t handle)235 static devmap_namespace_t *devmap_namespace_find_handle(devmap_handle_t handle) 236 236 { 237 237 link_t *item; … … 275 275 * 276 276 */ 277 static devmap_device_t *devmap_device_find_handle(dev _handle_t handle)277 static devmap_device_t *devmap_device_find_handle(devmap_handle_t handle) 278 278 { 279 279 link_t *item; … … 608 608 * Get handle from request 609 609 */ 610 dev _handle_t handle = IPC_GET_ARG2(*call);610 devmap_handle_t handle = IPC_GET_ARG2(*call); 611 611 devmap_device_t *dev = devmap_device_find_handle(handle); 612 612 -
uspace/srv/fs/devfs/devfs_ops.c
r51a268f r991f645 54 54 typedef struct { 55 55 devmap_handle_type_t type; 56 dev _handle_t handle;56 devmap_handle_t handle; 57 57 } devfs_node_t; 58 58 59 59 /** Opened devices structure */ 60 60 typedef struct { 61 dev _handle_t handle;61 devmap_handle_t handle; 62 62 int phone; 63 63 size_t refcount; … … 84 84 { 85 85 device_t *dev = hash_table_get_instance(item, device_t, link); 86 return (dev->handle == (dev _handle_t) key[DEVICES_KEY_HANDLE]);86 return (dev->handle == (devmap_handle_t) key[DEVICES_KEY_HANDLE]); 87 87 } 88 88 … … 99 99 100 100 static int devfs_node_get_internal(fs_node_t **rfn, devmap_handle_type_t type, 101 dev _handle_t handle)101 devmap_handle_t handle) 102 102 { 103 103 devfs_node_t *node = (devfs_node_t *) malloc(sizeof(devfs_node_t)); … … 122 122 } 123 123 124 static int devfs_root_get(fs_node_t **rfn, dev _handle_t dev_handle)124 static int devfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle) 125 125 { 126 126 return devfs_node_get_internal(rfn, DEV_HANDLE_NONE, 0); … … 154 154 155 155 /* Search root namespace */ 156 dev _handle_t namespace;156 devmap_handle_t namespace; 157 157 if (devmap_namespace_get_handle("", &namespace, 0) == EOK) { 158 158 count = devmap_get_devices(namespace, &devs); … … 200 200 } 201 201 202 static int devfs_node_get(fs_node_t **rfn, dev _handle_t dev_handle, fs_index_t index)202 static int devfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index) 203 203 { 204 204 return devfs_node_get_internal(rfn, devmap_handle_probe(index), index); … … 269 269 } 270 270 271 static int devfs_create_node(fs_node_t **rfn, dev _handle_t dev_handle, int lflag)271 static int devfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag) 272 272 { 273 273 assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY)); … … 304 304 305 305 /* Root namespace */ 306 dev _handle_t namespace;306 devmap_handle_t namespace; 307 307 if (devmap_namespace_get_handle("", &namespace, 0) == EOK) { 308 308 count = devmap_count_devices(namespace); … … 372 372 } 373 373 374 static dev _handle_t devfs_device_get(fs_node_t *fn)374 static devmap_handle_t devfs_device_get(fs_node_t *fn) 375 375 { 376 376 devfs_node_t *node = (devfs_node_t *) fn->data; … … 501 501 502 502 /* Search root namespace */ 503 dev _handle_t namespace;503 devmap_handle_t namespace; 504 504 if (devmap_namespace_get_handle("", &namespace, 0) == EOK) { 505 505 count = devmap_get_devices(namespace, &desc); -
uspace/srv/fs/fat/fat.h
r51a268f r991f645 176 176 177 177 fibril_mutex_t lock; 178 dev _handle_t dev_handle;178 devmap_handle_t devmap_handle; 179 179 fs_index_t index; 180 180 /** … … 242 242 extern void fat_sync(ipc_callid_t, ipc_call_t *); 243 243 244 extern int fat_idx_get_new(fat_idx_t **, dev _handle_t);245 extern fat_idx_t *fat_idx_get_by_pos(dev _handle_t, fat_cluster_t, unsigned);246 extern fat_idx_t *fat_idx_get_by_index(dev _handle_t, fs_index_t);244 extern int fat_idx_get_new(fat_idx_t **, devmap_handle_t); 245 extern fat_idx_t *fat_idx_get_by_pos(devmap_handle_t, fat_cluster_t, unsigned); 246 extern fat_idx_t *fat_idx_get_by_index(devmap_handle_t, fs_index_t); 247 247 extern void fat_idx_destroy(fat_idx_t *); 248 248 extern void fat_idx_hashin(fat_idx_t *); … … 251 251 extern int fat_idx_init(void); 252 252 extern void fat_idx_fini(void); 253 extern int fat_idx_init_by_dev _handle(dev_handle_t);254 extern void fat_idx_fini_by_dev _handle(dev_handle_t);253 extern int fat_idx_init_by_devmap_handle(devmap_handle_t); 254 extern void fat_idx_fini_by_devmap_handle(devmap_handle_t); 255 255 256 256 #endif -
uspace/srv/fs/fat/fat_fat.c
r51a268f r991f645 70 70 * 71 71 * @param bs Buffer holding the boot sector for the file. 72 * @param dev _handle Device handle of the device with the file.72 * @param devmap_handle Device handle of the device with the file. 73 73 * @param firstc First cluster to start the walk with. 74 74 * @param lastc If non-NULL, output argument hodling the last cluster … … 81 81 */ 82 82 int 83 fat_cluster_walk(fat_bs_t *bs, dev _handle_t dev_handle, fat_cluster_t firstc,83 fat_cluster_walk(fat_bs_t *bs, devmap_handle_t devmap_handle, fat_cluster_t firstc, 84 84 fat_cluster_t *lastc, uint16_t *numc, uint16_t max_clusters) 85 85 { … … 108 108 fidx = clst % (BPS(bs) / sizeof(fat_cluster_t)); 109 109 /* read FAT1 */ 110 rc = block_get(&b, dev _handle, RSCNT(bs) + fsec,110 rc = block_get(&b, devmap_handle, RSCNT(bs) + fsec, 111 111 BLOCK_FLAGS_NONE); 112 112 if (rc != EOK) … … 159 159 * when fortunately we have the last cluster number cached. 160 160 */ 161 return block_get(block, nodep->idx->dev _handle,161 return block_get(block, nodep->idx->devmap_handle, 162 162 CLBN2PBN(bs, nodep->lastc_cached_value, bn), flags); 163 163 } … … 173 173 174 174 fall_through: 175 rc = _fat_block_get(block, bs, nodep->idx->dev _handle, firstc,175 rc = _fat_block_get(block, bs, nodep->idx->devmap_handle, firstc, 176 176 &currc, relbn, flags); 177 177 if (rc != EOK) … … 192 192 * @param block Pointer to a block pointer for storing result. 193 193 * @param bs Buffer holding the boot sector of the file system. 194 * @param dev _handle Device handle of the file system.194 * @param devmap_handle Device handle of the file system. 195 195 * @param fcl First cluster used by the file. Can be zero if the file 196 196 * is empty. … … 204 204 */ 205 205 int 206 _fat_block_get(block_t **block, fat_bs_t *bs, dev _handle_t dev_handle,206 _fat_block_get(block_t **block, fat_bs_t *bs, devmap_handle_t devmap_handle, 207 207 fat_cluster_t fcl, fat_cluster_t *clp, aoff64_t bn, int flags) 208 208 { … … 221 221 /* root directory special case */ 222 222 assert(bn < RDS(bs)); 223 rc = block_get(block, dev _handle,223 rc = block_get(block, devmap_handle, 224 224 RSCNT(bs) + FATCNT(bs) * SF(bs) + bn, flags); 225 225 return rc; … … 227 227 228 228 max_clusters = bn / SPC(bs); 229 rc = fat_cluster_walk(bs, dev _handle, fcl, &c, &clusters, max_clusters);229 rc = fat_cluster_walk(bs, devmap_handle, fcl, &c, &clusters, max_clusters); 230 230 if (rc != EOK) 231 231 return rc; 232 232 assert(clusters == max_clusters); 233 233 234 rc = block_get(block, dev _handle, CLBN2PBN(bs, c, bn), flags);234 rc = block_get(block, devmap_handle, CLBN2PBN(bs, c, bn), flags); 235 235 236 236 if (clp) … … 280 280 /* zero out the initial part of the new cluster chain */ 281 281 for (o = boundary; o < pos; o += BPS(bs)) { 282 rc = _fat_block_get(&b, bs, nodep->idx->dev _handle, mcl,282 rc = _fat_block_get(&b, bs, nodep->idx->devmap_handle, mcl, 283 283 NULL, (o - boundary) / BPS(bs), BLOCK_FLAGS_NOREAD); 284 284 if (rc != EOK) … … 297 297 * 298 298 * @param bs Buffer holding the boot sector for the file system. 299 * @param dev _handle Device handle for the file system.299 * @param devmap_handle Device handle for the file system. 300 300 * @param clst Cluster which to get. 301 301 * @param value Output argument holding the value of the cluster. … … 304 304 */ 305 305 int 306 fat_get_cluster(fat_bs_t *bs, dev _handle_t dev_handle, unsigned fatno,306 fat_get_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno, 307 307 fat_cluster_t clst, fat_cluster_t *value) 308 308 { … … 311 311 int rc; 312 312 313 rc = block_get(&b, dev _handle, RSCNT(bs) + SF(bs) * fatno +313 rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno + 314 314 (clst * sizeof(fat_cluster_t)) / BPS(bs), BLOCK_FLAGS_NONE); 315 315 if (rc != EOK) … … 326 326 * 327 327 * @param bs Buffer holding the boot sector for the file system. 328 * @param dev _handle Device handle for the file system.328 * @param devmap_handle Device handle for the file system. 329 329 * @param fatno Number of the FAT instance where to make the change. 330 330 * @param clst Cluster which is to be set. … … 334 334 */ 335 335 int 336 fat_set_cluster(fat_bs_t *bs, dev _handle_t dev_handle, unsigned fatno,336 fat_set_cluster(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned fatno, 337 337 fat_cluster_t clst, fat_cluster_t value) 338 338 { … … 342 342 343 343 assert(fatno < FATCNT(bs)); 344 rc = block_get(&b, dev _handle, RSCNT(bs) + SF(bs) * fatno +344 rc = block_get(&b, devmap_handle, RSCNT(bs) + SF(bs) * fatno + 345 345 (clst * sizeof(fat_cluster_t)) / BPS(bs), BLOCK_FLAGS_NONE); 346 346 if (rc != EOK) … … 357 357 * 358 358 * @param bs Buffer holding the boot sector of the file system. 359 * @param dev _handle Device handle of the file system.359 * @param devmap_handle Device handle of the file system. 360 360 * @param lifo Chain of allocated clusters. 361 361 * @param nclsts Number of clusters in the lifo chain. … … 363 363 * @return EOK on success or a negative error code. 364 364 */ 365 int fat_alloc_shadow_clusters(fat_bs_t *bs, dev _handle_t dev_handle,365 int fat_alloc_shadow_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle, 366 366 fat_cluster_t *lifo, unsigned nclsts) 367 367 { … … 372 372 for (fatno = FAT1 + 1; fatno < bs->fatcnt; fatno++) { 373 373 for (c = 0; c < nclsts; c++) { 374 rc = fat_set_cluster(bs, dev _handle, fatno, lifo[c],374 rc = fat_set_cluster(bs, devmap_handle, fatno, lifo[c], 375 375 c == 0 ? FAT_CLST_LAST1 : lifo[c - 1]); 376 376 if (rc != EOK) … … 390 390 * 391 391 * @param bs Buffer holding the boot sector of the file system. 392 * @param dev _handle Device handle of the file system.392 * @param devmap_handle Device handle of the file system. 393 393 * @param nclsts Number of clusters to allocate. 394 394 * @param mcl Output parameter where the first cluster in the chain … … 400 400 */ 401 401 int 402 fat_alloc_clusters(fat_bs_t *bs, dev _handle_t dev_handle, unsigned nclsts,402 fat_alloc_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle, unsigned nclsts, 403 403 fat_cluster_t *mcl, fat_cluster_t *lcl) 404 404 { … … 418 418 fibril_mutex_lock(&fat_alloc_lock); 419 419 for (b = 0, cl = 0; b < SF(bs); b++) { 420 rc = block_get(&blk, dev _handle, RSCNT(bs) + b,420 rc = block_get(&blk, devmap_handle, RSCNT(bs) + b, 421 421 BLOCK_FLAGS_NONE); 422 422 if (rc != EOK) … … 457 457 /* update the shadow copies of FAT */ 458 458 rc = fat_alloc_shadow_clusters(bs, 459 dev _handle, lifo, nclsts);459 devmap_handle, lifo, nclsts); 460 460 if (rc != EOK) 461 461 goto error; … … 484 484 */ 485 485 while (found--) { 486 rc = fat_set_cluster(bs, dev _handle, FAT1, lifo[found],486 rc = fat_set_cluster(bs, devmap_handle, FAT1, lifo[found], 487 487 FAT_CLST_RES0); 488 488 if (rc != EOK) { … … 499 499 * 500 500 * @param bs Buffer hodling the boot sector of the file system. 501 * @param dev _handle Device handle of the file system.501 * @param devmap_handle Device handle of the file system. 502 502 * @param firstc First cluster in the chain which is to be freed. 503 503 * … … 505 505 */ 506 506 int 507 fat_free_clusters(fat_bs_t *bs, dev _handle_t dev_handle, fat_cluster_t firstc)507 fat_free_clusters(fat_bs_t *bs, devmap_handle_t devmap_handle, fat_cluster_t firstc) 508 508 { 509 509 unsigned fatno; … … 514 514 while (firstc < FAT_CLST_LAST1) { 515 515 assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD); 516 rc = fat_get_cluster(bs, dev _handle, FAT1, firstc, &nextc);516 rc = fat_get_cluster(bs, devmap_handle, FAT1, firstc, &nextc); 517 517 if (rc != EOK) 518 518 return rc; 519 519 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) { 520 rc = fat_set_cluster(bs, dev _handle, fatno, firstc,520 rc = fat_set_cluster(bs, devmap_handle, fatno, firstc, 521 521 FAT_CLST_RES0); 522 522 if (rc != EOK) … … 543 543 fat_cluster_t lcl) 544 544 { 545 dev _handle_t dev_handle = nodep->idx->dev_handle;545 devmap_handle_t devmap_handle = nodep->idx->devmap_handle; 546 546 fat_cluster_t lastc; 547 547 uint8_t fatno; … … 557 557 nodep->lastc_cached_valid = false; 558 558 } else { 559 rc = fat_cluster_walk(bs, dev _handle, nodep->firstc,559 rc = fat_cluster_walk(bs, devmap_handle, nodep->firstc, 560 560 &lastc, NULL, (uint16_t) -1); 561 561 if (rc != EOK) … … 564 564 565 565 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) { 566 rc = fat_set_cluster(bs, nodep->idx->dev _handle, fatno,566 rc = fat_set_cluster(bs, nodep->idx->devmap_handle, fatno, 567 567 lastc, mcl); 568 568 if (rc != EOK) … … 590 590 { 591 591 int rc; 592 dev _handle_t dev_handle = nodep->idx->dev_handle;592 devmap_handle_t devmap_handle = nodep->idx->devmap_handle; 593 593 594 594 /* … … 601 601 if (lcl == FAT_CLST_RES0) { 602 602 /* The node will have zero size and no clusters allocated. */ 603 rc = fat_free_clusters(bs, dev _handle, nodep->firstc);603 rc = fat_free_clusters(bs, devmap_handle, nodep->firstc); 604 604 if (rc != EOK) 605 605 return rc; … … 610 610 unsigned fatno; 611 611 612 rc = fat_get_cluster(bs, dev _handle, FAT1, lcl, &nextc);612 rc = fat_get_cluster(bs, devmap_handle, FAT1, lcl, &nextc); 613 613 if (rc != EOK) 614 614 return rc; … … 616 616 /* Terminate the cluster chain in all copies of FAT. */ 617 617 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) { 618 rc = fat_set_cluster(bs, dev _handle, fatno, lcl,618 rc = fat_set_cluster(bs, devmap_handle, fatno, lcl, 619 619 FAT_CLST_LAST1); 620 620 if (rc != EOK) … … 623 623 624 624 /* Free all following clusters. */ 625 rc = fat_free_clusters(bs, dev _handle, nextc);625 rc = fat_free_clusters(bs, devmap_handle, nextc); 626 626 if (rc != EOK) 627 627 return rc; … … 638 638 639 639 int 640 fat_zero_cluster(struct fat_bs *bs, dev _handle_t dev_handle, fat_cluster_t c)640 fat_zero_cluster(struct fat_bs *bs, devmap_handle_t devmap_handle, fat_cluster_t c) 641 641 { 642 642 int i; … … 645 645 646 646 for (i = 0; i < SPC(bs); i++) { 647 rc = _fat_block_get(&b, bs, dev _handle, c, NULL, i,647 rc = _fat_block_get(&b, bs, devmap_handle, c, NULL, i, 648 648 BLOCK_FLAGS_NOREAD); 649 649 if (rc != EOK) … … 665 665 * does not contain a fat file system. 666 666 */ 667 int fat_sanity_check(fat_bs_t *bs, dev _handle_t dev_handle)667 int fat_sanity_check(fat_bs_t *bs, devmap_handle_t devmap_handle) 668 668 { 669 669 fat_cluster_t e0, e1; … … 706 706 707 707 for (fat_no = 0; fat_no < bs->fatcnt; fat_no++) { 708 rc = fat_get_cluster(bs, dev _handle, fat_no, 0, &e0);708 rc = fat_get_cluster(bs, devmap_handle, fat_no, 0, &e0); 709 709 if (rc != EOK) 710 710 return EIO; 711 711 712 rc = fat_get_cluster(bs, dev _handle, fat_no, 1, &e1);712 rc = fat_get_cluster(bs, devmap_handle, fat_no, 1, &e1); 713 713 if (rc != EOK) 714 714 return EIO; -
uspace/srv/fs/fat/fat_fat.h
r51a268f r991f645 61 61 #define fat_clusters_get(numc, bs, dh, fc) \ 62 62 fat_cluster_walk((bs), (dh), (fc), NULL, (numc), (uint16_t) -1) 63 extern int fat_cluster_walk(struct fat_bs *, dev _handle_t, fat_cluster_t,63 extern int fat_cluster_walk(struct fat_bs *, devmap_handle_t, fat_cluster_t, 64 64 fat_cluster_t *, uint16_t *, uint16_t); 65 65 66 66 extern int fat_block_get(block_t **, struct fat_bs *, struct fat_node *, 67 67 aoff64_t, int); 68 extern int _fat_block_get(block_t **, struct fat_bs *, dev _handle_t,68 extern int _fat_block_get(block_t **, struct fat_bs *, devmap_handle_t, 69 69 fat_cluster_t, fat_cluster_t *, aoff64_t, int); 70 70 … … 73 73 extern int fat_chop_clusters(struct fat_bs *, struct fat_node *, 74 74 fat_cluster_t); 75 extern int fat_alloc_clusters(struct fat_bs *, dev _handle_t, unsigned,75 extern int fat_alloc_clusters(struct fat_bs *, devmap_handle_t, unsigned, 76 76 fat_cluster_t *, fat_cluster_t *); 77 extern int fat_free_clusters(struct fat_bs *, dev _handle_t, fat_cluster_t);78 extern int fat_alloc_shadow_clusters(struct fat_bs *, dev _handle_t,77 extern int fat_free_clusters(struct fat_bs *, devmap_handle_t, fat_cluster_t); 78 extern int fat_alloc_shadow_clusters(struct fat_bs *, devmap_handle_t, 79 79 fat_cluster_t *, unsigned); 80 extern int fat_get_cluster(struct fat_bs *, dev _handle_t, unsigned,80 extern int fat_get_cluster(struct fat_bs *, devmap_handle_t, unsigned, 81 81 fat_cluster_t, fat_cluster_t *); 82 extern int fat_set_cluster(struct fat_bs *, dev _handle_t, unsigned,82 extern int fat_set_cluster(struct fat_bs *, devmap_handle_t, unsigned, 83 83 fat_cluster_t, fat_cluster_t); 84 84 extern int fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t, 85 85 aoff64_t); 86 extern int fat_zero_cluster(struct fat_bs *, dev _handle_t, fat_cluster_t);87 extern int fat_sanity_check(struct fat_bs *, dev _handle_t);86 extern int fat_zero_cluster(struct fat_bs *, devmap_handle_t, fat_cluster_t); 87 extern int fat_sanity_check(struct fat_bs *, devmap_handle_t); 88 88 89 89 #endif -
uspace/srv/fs/fat/fat_idx.c
r51a268f r991f645 58 58 typedef struct { 59 59 link_t link; 60 dev _handle_t dev_handle;60 devmap_handle_t devmap_handle; 61 61 62 62 /** Next unassigned index. */ … … 75 75 static LIST_INITIALIZE(unused_head); 76 76 77 static void unused_initialize(unused_t *u, dev _handle_t dev_handle)77 static void unused_initialize(unused_t *u, devmap_handle_t devmap_handle) 78 78 { 79 79 link_initialize(&u->link); 80 u->dev _handle = dev_handle;80 u->devmap_handle = devmap_handle; 81 81 u->next = 0; 82 82 u->remaining = ((uint64_t)((fs_index_t)-1)) + 1; … … 84 84 } 85 85 86 static unused_t *unused_find(dev _handle_t dev_handle, bool lock)86 static unused_t *unused_find(devmap_handle_t devmap_handle, bool lock) 87 87 { 88 88 unused_t *u; … … 93 93 for (l = unused_head.next; l != &unused_head; l = l->next) { 94 94 u = list_get_instance(l, unused_t, link); 95 if (u->dev _handle == dev_handle)95 if (u->devmap_handle == devmap_handle) 96 96 return u; 97 97 } … … 106 106 /** 107 107 * Global hash table of all used fat_idx_t structures. 108 * The index structures are hashed by the dev _handle, parent node's first108 * The index structures are hashed by the devmap_handle, parent node's first 109 109 * cluster and index within the parent directory. 110 110 */ … … 120 120 static hash_index_t pos_hash(unsigned long key[]) 121 121 { 122 dev _handle_t dev_handle = (dev_handle_t)key[UPH_DH_KEY];122 devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY]; 123 123 fat_cluster_t pfc = (fat_cluster_t)key[UPH_PFC_KEY]; 124 124 unsigned pdi = (unsigned)key[UPH_PDI_KEY]; … … 140 140 h |= (pdi & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) << 141 141 (UPH_BUCKETS_LOG / 2); 142 h |= (dev _handle & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) <<142 h |= (devmap_handle & ((1 << (UPH_BUCKETS_LOG / 4)) - 1)) << 143 143 (3 * (UPH_BUCKETS_LOG / 4)); 144 144 … … 148 148 static int pos_compare(unsigned long key[], hash_count_t keys, link_t *item) 149 149 { 150 dev _handle_t dev_handle = (dev_handle_t)key[UPH_DH_KEY];150 devmap_handle_t devmap_handle = (devmap_handle_t)key[UPH_DH_KEY]; 151 151 fat_cluster_t pfc; 152 152 unsigned pdi; … … 155 155 switch (keys) { 156 156 case 1: 157 return (dev _handle == fidx->dev_handle);157 return (devmap_handle == fidx->devmap_handle); 158 158 case 3: 159 159 pfc = (fat_cluster_t) key[UPH_PFC_KEY]; 160 160 pdi = (unsigned) key[UPH_PDI_KEY]; 161 return (dev _handle == fidx->dev_handle) && (pfc == fidx->pfc) &&161 return (devmap_handle == fidx->devmap_handle) && (pfc == fidx->pfc) && 162 162 (pdi == fidx->pdi); 163 163 default: … … 181 181 /** 182 182 * Global hash table of all used fat_idx_t structures. 183 * The index structures are hashed by the dev _handle and index.183 * The index structures are hashed by the devmap_handle and index. 184 184 */ 185 185 static hash_table_t ui_hash; … … 193 193 static hash_index_t idx_hash(unsigned long key[]) 194 194 { 195 dev _handle_t dev_handle = (dev_handle_t)key[UIH_DH_KEY];195 devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY]; 196 196 fs_index_t index = (fs_index_t)key[UIH_INDEX_KEY]; 197 197 198 198 hash_index_t h; 199 199 200 h = dev _handle & ((1 << (UIH_BUCKETS_LOG / 2)) - 1);200 h = devmap_handle & ((1 << (UIH_BUCKETS_LOG / 2)) - 1); 201 201 h |= (index & ((1 << (UIH_BUCKETS_LOG / 2)) - 1)) << 202 202 (UIH_BUCKETS_LOG / 2); … … 207 207 static int idx_compare(unsigned long key[], hash_count_t keys, link_t *item) 208 208 { 209 dev _handle_t dev_handle = (dev_handle_t)key[UIH_DH_KEY];209 devmap_handle_t devmap_handle = (devmap_handle_t)key[UIH_DH_KEY]; 210 210 fs_index_t index; 211 211 fat_idx_t *fidx = list_get_instance(item, fat_idx_t, uih_link); … … 213 213 switch (keys) { 214 214 case 1: 215 return (dev _handle == fidx->dev_handle);215 return (devmap_handle == fidx->devmap_handle); 216 216 case 2: 217 217 index = (fs_index_t) key[UIH_INDEX_KEY]; 218 return (dev _handle == fidx->dev_handle) &&218 return (devmap_handle == fidx->devmap_handle) && 219 219 (index == fidx->index); 220 220 default: … … 239 239 240 240 /** Allocate a VFS index which is not currently in use. */ 241 static bool fat_index_alloc(dev _handle_t dev_handle, fs_index_t *index)241 static bool fat_index_alloc(devmap_handle_t devmap_handle, fs_index_t *index) 242 242 { 243 243 unused_t *u; 244 244 245 245 assert(index); 246 u = unused_find(dev _handle, true);246 u = unused_find(devmap_handle, true); 247 247 if (!u) 248 248 return false; … … 301 301 302 302 /** Free a VFS index, which is no longer in use. */ 303 static void fat_index_free(dev _handle_t dev_handle, fs_index_t index)303 static void fat_index_free(devmap_handle_t devmap_handle, fs_index_t index) 304 304 { 305 305 unused_t *u; 306 306 307 u = unused_find(dev _handle, true);307 u = unused_find(devmap_handle, true); 308 308 assert(u); 309 309 … … 363 363 } 364 364 365 static int fat_idx_create(fat_idx_t **fidxp, dev _handle_t dev_handle)365 static int fat_idx_create(fat_idx_t **fidxp, devmap_handle_t devmap_handle) 366 366 { 367 367 fat_idx_t *fidx; … … 370 370 if (!fidx) 371 371 return ENOMEM; 372 if (!fat_index_alloc(dev _handle, &fidx->index)) {372 if (!fat_index_alloc(devmap_handle, &fidx->index)) { 373 373 free(fidx); 374 374 return ENOSPC; … … 378 378 link_initialize(&fidx->uih_link); 379 379 fibril_mutex_initialize(&fidx->lock); 380 fidx->dev _handle = dev_handle;380 fidx->devmap_handle = devmap_handle; 381 381 fidx->pfc = FAT_CLST_RES0; /* no parent yet */ 382 382 fidx->pdi = 0; … … 387 387 } 388 388 389 int fat_idx_get_new(fat_idx_t **fidxp, dev _handle_t dev_handle)389 int fat_idx_get_new(fat_idx_t **fidxp, devmap_handle_t devmap_handle) 390 390 { 391 391 fat_idx_t *fidx; … … 393 393 394 394 fibril_mutex_lock(&used_lock); 395 rc = fat_idx_create(&fidx, dev _handle);395 rc = fat_idx_create(&fidx, devmap_handle); 396 396 if (rc != EOK) { 397 397 fibril_mutex_unlock(&used_lock); … … 400 400 401 401 unsigned long ikey[] = { 402 [UIH_DH_KEY] = dev _handle,402 [UIH_DH_KEY] = devmap_handle, 403 403 [UIH_INDEX_KEY] = fidx->index, 404 404 }; … … 413 413 414 414 fat_idx_t * 415 fat_idx_get_by_pos(dev _handle_t dev_handle, fat_cluster_t pfc, unsigned pdi)415 fat_idx_get_by_pos(devmap_handle_t devmap_handle, fat_cluster_t pfc, unsigned pdi) 416 416 { 417 417 fat_idx_t *fidx; 418 418 link_t *l; 419 419 unsigned long pkey[] = { 420 [UPH_DH_KEY] = dev _handle,420 [UPH_DH_KEY] = devmap_handle, 421 421 [UPH_PFC_KEY] = pfc, 422 422 [UPH_PDI_KEY] = pdi, … … 430 430 int rc; 431 431 432 rc = fat_idx_create(&fidx, dev _handle);432 rc = fat_idx_create(&fidx, devmap_handle); 433 433 if (rc != EOK) { 434 434 fibril_mutex_unlock(&used_lock); … … 437 437 438 438 unsigned long ikey[] = { 439 [UIH_DH_KEY] = dev _handle,439 [UIH_DH_KEY] = devmap_handle, 440 440 [UIH_INDEX_KEY] = fidx->index, 441 441 }; … … 456 456 { 457 457 unsigned long pkey[] = { 458 [UPH_DH_KEY] = idx->dev _handle,458 [UPH_DH_KEY] = idx->devmap_handle, 459 459 [UPH_PFC_KEY] = idx->pfc, 460 460 [UPH_PDI_KEY] = idx->pdi, … … 469 469 { 470 470 unsigned long pkey[] = { 471 [UPH_DH_KEY] = idx->dev _handle,471 [UPH_DH_KEY] = idx->devmap_handle, 472 472 [UPH_PFC_KEY] = idx->pfc, 473 473 [UPH_PDI_KEY] = idx->pdi, … … 480 480 481 481 fat_idx_t * 482 fat_idx_get_by_index(dev _handle_t dev_handle, fs_index_t index)482 fat_idx_get_by_index(devmap_handle_t devmap_handle, fs_index_t index) 483 483 { 484 484 fat_idx_t *fidx = NULL; 485 485 link_t *l; 486 486 unsigned long ikey[] = { 487 [UIH_DH_KEY] = dev _handle,487 [UIH_DH_KEY] = devmap_handle, 488 488 [UIH_INDEX_KEY] = index, 489 489 }; … … 507 507 { 508 508 unsigned long ikey[] = { 509 [UIH_DH_KEY] = idx->dev _handle,509 [UIH_DH_KEY] = idx->devmap_handle, 510 510 [UIH_INDEX_KEY] = idx->index, 511 511 }; 512 dev _handle_t dev_handle = idx->dev_handle;512 devmap_handle_t devmap_handle = idx->devmap_handle; 513 513 fs_index_t index = idx->index; 514 514 … … 524 524 fibril_mutex_unlock(&used_lock); 525 525 /* Release the VFS index. */ 526 fat_index_free(dev _handle, index);526 fat_index_free(devmap_handle, index); 527 527 /* The index structure itself is freed in idx_remove_callback(). */ 528 528 } … … 546 546 } 547 547 548 int fat_idx_init_by_dev _handle(dev_handle_t dev_handle)548 int fat_idx_init_by_devmap_handle(devmap_handle_t devmap_handle) 549 549 { 550 550 unused_t *u; … … 554 554 if (!u) 555 555 return ENOMEM; 556 unused_initialize(u, dev _handle);556 unused_initialize(u, devmap_handle); 557 557 fibril_mutex_lock(&unused_lock); 558 if (!unused_find(dev _handle, false)) {558 if (!unused_find(devmap_handle, false)) { 559 559 list_append(&u->link, &unused_head); 560 560 } else { … … 566 566 } 567 567 568 void fat_idx_fini_by_dev _handle(dev_handle_t dev_handle)568 void fat_idx_fini_by_devmap_handle(devmap_handle_t devmap_handle) 569 569 { 570 570 unsigned long ikey[] = { 571 [UIH_DH_KEY] = dev _handle571 [UIH_DH_KEY] = devmap_handle 572 572 }; 573 573 unsigned long pkey[] = { 574 [UPH_DH_KEY] = dev _handle574 [UPH_DH_KEY] = devmap_handle 575 575 }; 576 576 … … 588 588 * Free the unused and freed structures for this instance. 589 589 */ 590 unused_t *u = unused_find(dev _handle, true);590 unused_t *u = unused_find(devmap_handle, true); 591 591 assert(u); 592 592 list_remove(&u->link); -
uspace/srv/fs/fat/fat_ops.c
r51a268f r991f645 72 72 * Forward declarations of FAT libfs operations. 73 73 */ 74 static int fat_root_get(fs_node_t **, dev _handle_t);74 static int fat_root_get(fs_node_t **, devmap_handle_t); 75 75 static int fat_match(fs_node_t **, fs_node_t *, const char *); 76 static int fat_node_get(fs_node_t **, dev _handle_t, fs_index_t);76 static int fat_node_get(fs_node_t **, devmap_handle_t, fs_index_t); 77 77 static int fat_node_open(fs_node_t *); 78 78 static int fat_node_put(fs_node_t *); 79 static int fat_create_node(fs_node_t **, dev _handle_t, int);79 static int fat_create_node(fs_node_t **, devmap_handle_t, int); 80 80 static int fat_destroy_node(fs_node_t *); 81 81 static int fat_link(fs_node_t *, fs_node_t *, const char *); … … 88 88 static bool fat_is_directory(fs_node_t *); 89 89 static bool fat_is_file(fs_node_t *node); 90 static dev _handle_t fat_device_get(fs_node_t *node);90 static devmap_handle_t fat_device_get(fs_node_t *node); 91 91 92 92 /* … … 120 120 assert(node->dirty); 121 121 122 bs = block_bb_get(node->idx->dev _handle);122 bs = block_bb_get(node->idx->devmap_handle); 123 123 124 124 /* Read the block that contains the dentry of interest. */ 125 rc = _fat_block_get(&b, bs, node->idx->dev _handle, node->idx->pfc,125 rc = _fat_block_get(&b, bs, node->idx->devmap_handle, node->idx->pfc, 126 126 NULL, (node->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs), 127 127 BLOCK_FLAGS_NONE); … … 145 145 } 146 146 147 static int fat_node_fini_by_dev _handle(dev_handle_t dev_handle)147 static int fat_node_fini_by_devmap_handle(devmap_handle_t devmap_handle) 148 148 { 149 149 link_t *lnk; … … 170 170 goto restart; 171 171 } 172 if (nodep->idx->dev _handle != dev_handle) {172 if (nodep->idx->devmap_handle != devmap_handle) { 173 173 fibril_mutex_unlock(&nodep->idx->lock); 174 174 fibril_mutex_unlock(&nodep->lock); … … 299 299 return rc; 300 300 301 bs = block_bb_get(idxp->dev _handle);301 bs = block_bb_get(idxp->devmap_handle); 302 302 303 303 /* Read the block that contains the dentry of interest. */ 304 rc = _fat_block_get(&b, bs, idxp->dev _handle, idxp->pfc, NULL,304 rc = _fat_block_get(&b, bs, idxp->devmap_handle, idxp->pfc, NULL, 305 305 (idxp->pdi * sizeof(fat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE); 306 306 if (rc != EOK) { … … 323 323 */ 324 324 uint16_t clusters; 325 rc = fat_clusters_get(&clusters, bs, idxp->dev _handle,325 rc = fat_clusters_get(&clusters, bs, idxp->devmap_handle, 326 326 uint16_t_le2host(d->firstc)); 327 327 if (rc != EOK) { … … 356 356 */ 357 357 358 int fat_root_get(fs_node_t **rfn, dev _handle_t dev_handle)359 { 360 return fat_node_get(rfn, dev _handle, 0);358 int fat_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle) 359 { 360 return fat_node_get(rfn, devmap_handle, 0); 361 361 } 362 362 … … 369 369 unsigned blocks; 370 370 fat_dentry_t *d; 371 dev _handle_t dev_handle;371 devmap_handle_t devmap_handle; 372 372 block_t *b; 373 373 int rc; 374 374 375 375 fibril_mutex_lock(&parentp->idx->lock); 376 dev _handle = parentp->idx->dev_handle;376 devmap_handle = parentp->idx->devmap_handle; 377 377 fibril_mutex_unlock(&parentp->idx->lock); 378 378 379 bs = block_bb_get(dev _handle);379 bs = block_bb_get(devmap_handle); 380 380 blocks = parentp->size / BPS(bs); 381 381 for (i = 0; i < blocks; i++) { … … 402 402 /* hit */ 403 403 fat_node_t *nodep; 404 fat_idx_t *idx = fat_idx_get_by_pos(dev _handle,404 fat_idx_t *idx = fat_idx_get_by_pos(devmap_handle, 405 405 parentp->firstc, i * DPS(bs) + j); 406 406 if (!idx) { … … 435 435 436 436 /** Instantiate a FAT in-core node. */ 437 int fat_node_get(fs_node_t **rfn, dev _handle_t dev_handle, fs_index_t index)437 int fat_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index) 438 438 { 439 439 fat_node_t *nodep; … … 441 441 int rc; 442 442 443 idxp = fat_idx_get_by_index(dev _handle, index);443 idxp = fat_idx_get_by_index(devmap_handle, index); 444 444 if (!idxp) { 445 445 *rfn = NULL; … … 492 492 } 493 493 494 int fat_create_node(fs_node_t **rfn, dev _handle_t dev_handle, int flags)494 int fat_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags) 495 495 { 496 496 fat_idx_t *idxp; … … 500 500 int rc; 501 501 502 bs = block_bb_get(dev _handle);502 bs = block_bb_get(devmap_handle); 503 503 if (flags & L_DIRECTORY) { 504 504 /* allocate a cluster */ 505 rc = fat_alloc_clusters(bs, dev _handle, 1, &mcl, &lcl);505 rc = fat_alloc_clusters(bs, devmap_handle, 1, &mcl, &lcl); 506 506 if (rc != EOK) 507 507 return rc; 508 508 /* populate the new cluster with unused dentries */ 509 rc = fat_zero_cluster(bs, dev _handle, mcl);509 rc = fat_zero_cluster(bs, devmap_handle, mcl); 510 510 if (rc != EOK) { 511 (void) fat_free_clusters(bs, dev _handle, mcl);511 (void) fat_free_clusters(bs, devmap_handle, mcl); 512 512 return rc; 513 513 } … … 516 516 rc = fat_node_get_new(&nodep); 517 517 if (rc != EOK) { 518 (void) fat_free_clusters(bs, dev _handle, mcl);518 (void) fat_free_clusters(bs, devmap_handle, mcl); 519 519 return rc; 520 520 } 521 rc = fat_idx_get_new(&idxp, dev _handle);522 if (rc != EOK) { 523 (void) fat_free_clusters(bs, dev _handle, mcl);521 rc = fat_idx_get_new(&idxp, devmap_handle); 522 if (rc != EOK) { 523 (void) fat_free_clusters(bs, devmap_handle, mcl); 524 524 (void) fat_node_put(FS_NODE(nodep)); 525 525 return rc; … … 570 570 assert(!has_children); 571 571 572 bs = block_bb_get(nodep->idx->dev _handle);572 bs = block_bb_get(nodep->idx->devmap_handle); 573 573 if (nodep->firstc != FAT_CLST_RES0) { 574 574 assert(nodep->size); 575 575 /* Free all clusters allocated to the node. */ 576 rc = fat_free_clusters(bs, nodep->idx->dev _handle,576 rc = fat_free_clusters(bs, nodep->idx->devmap_handle, 577 577 nodep->firstc); 578 578 } … … 620 620 621 621 fibril_mutex_lock(&parentp->idx->lock); 622 bs = block_bb_get(parentp->idx->dev _handle);622 bs = block_bb_get(parentp->idx->devmap_handle); 623 623 624 624 blocks = parentp->size / BPS(bs); … … 659 659 return ENOSPC; 660 660 } 661 rc = fat_alloc_clusters(bs, parentp->idx->dev _handle, 1, &mcl, &lcl);661 rc = fat_alloc_clusters(bs, parentp->idx->devmap_handle, 1, &mcl, &lcl); 662 662 if (rc != EOK) { 663 663 fibril_mutex_unlock(&parentp->idx->lock); 664 664 return rc; 665 665 } 666 rc = fat_zero_cluster(bs, parentp->idx->dev _handle, mcl);667 if (rc != EOK) { 668 (void) fat_free_clusters(bs, parentp->idx->dev _handle, mcl);666 rc = fat_zero_cluster(bs, parentp->idx->devmap_handle, mcl); 667 if (rc != EOK) { 668 (void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl); 669 669 fibril_mutex_unlock(&parentp->idx->lock); 670 670 return rc; … … 672 672 rc = fat_append_clusters(bs, parentp, mcl, lcl); 673 673 if (rc != EOK) { 674 (void) fat_free_clusters(bs, parentp->idx->dev _handle, mcl);674 (void) fat_free_clusters(bs, parentp->idx->devmap_handle, mcl); 675 675 fibril_mutex_unlock(&parentp->idx->lock); 676 676 return rc; … … 789 789 assert(childp->lnkcnt == 1); 790 790 fibril_mutex_lock(&childp->idx->lock); 791 bs = block_bb_get(childp->idx->dev _handle);792 793 rc = _fat_block_get(&b, bs, childp->idx->dev _handle, childp->idx->pfc,791 bs = block_bb_get(childp->idx->devmap_handle); 792 793 rc = _fat_block_get(&b, bs, childp->idx->devmap_handle, childp->idx->pfc, 794 794 NULL, (childp->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs), 795 795 BLOCK_FLAGS_NONE); … … 840 840 841 841 fibril_mutex_lock(&nodep->idx->lock); 842 bs = block_bb_get(nodep->idx->dev _handle);842 bs = block_bb_get(nodep->idx->devmap_handle); 843 843 844 844 blocks = nodep->size / BPS(bs); … … 914 914 } 915 915 916 dev _handle_t fat_device_get(fs_node_t *node)916 devmap_handle_t fat_device_get(fs_node_t *node) 917 917 { 918 918 return 0; … … 946 946 void fat_mounted(ipc_callid_t rid, ipc_call_t *request) 947 947 { 948 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);948 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 949 949 enum cache_mode cmode; 950 950 fat_bs_t *bs; … … 968 968 969 969 /* initialize libblock */ 970 rc = block_init(dev _handle, BS_SIZE);970 rc = block_init(devmap_handle, BS_SIZE); 971 971 if (rc != EOK) { 972 972 ipc_answer_0(rid, rc); … … 975 975 976 976 /* prepare the boot block */ 977 rc = block_bb_read(dev _handle, BS_BLOCK);978 if (rc != EOK) { 979 block_fini(dev _handle);977 rc = block_bb_read(devmap_handle, BS_BLOCK); 978 if (rc != EOK) { 979 block_fini(devmap_handle); 980 980 ipc_answer_0(rid, rc); 981 981 return; … … 983 983 984 984 /* get the buffer with the boot sector */ 985 bs = block_bb_get(dev _handle);985 bs = block_bb_get(devmap_handle); 986 986 987 987 if (BPS(bs) != BS_SIZE) { 988 block_fini(dev _handle);988 block_fini(devmap_handle); 989 989 ipc_answer_0(rid, ENOTSUP); 990 990 return; … … 992 992 993 993 /* Initialize the block cache */ 994 rc = block_cache_init(dev _handle, BPS(bs), 0 /* XXX */, cmode);995 if (rc != EOK) { 996 block_fini(dev _handle);994 rc = block_cache_init(devmap_handle, BPS(bs), 0 /* XXX */, cmode); 995 if (rc != EOK) { 996 block_fini(devmap_handle); 997 997 ipc_answer_0(rid, rc); 998 998 return; … … 1000 1000 1001 1001 /* Do some simple sanity checks on the file system. */ 1002 rc = fat_sanity_check(bs, dev _handle);1003 if (rc != EOK) { 1004 (void) block_cache_fini(dev _handle);1005 block_fini(dev _handle);1002 rc = fat_sanity_check(bs, devmap_handle); 1003 if (rc != EOK) { 1004 (void) block_cache_fini(devmap_handle); 1005 block_fini(devmap_handle); 1006 1006 ipc_answer_0(rid, rc); 1007 1007 return; 1008 1008 } 1009 1009 1010 rc = fat_idx_init_by_dev _handle(dev_handle);1011 if (rc != EOK) { 1012 (void) block_cache_fini(dev _handle);1013 block_fini(dev _handle);1010 rc = fat_idx_init_by_devmap_handle(devmap_handle); 1011 if (rc != EOK) { 1012 (void) block_cache_fini(devmap_handle); 1013 block_fini(devmap_handle); 1014 1014 ipc_answer_0(rid, rc); 1015 1015 return; … … 1019 1019 fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t)); 1020 1020 if (!rfn) { 1021 (void) block_cache_fini(dev _handle);1022 block_fini(dev _handle);1023 fat_idx_fini_by_dev _handle(dev_handle);1021 (void) block_cache_fini(devmap_handle); 1022 block_fini(devmap_handle); 1023 fat_idx_fini_by_devmap_handle(devmap_handle); 1024 1024 ipc_answer_0(rid, ENOMEM); 1025 1025 return; … … 1029 1029 if (!rootp) { 1030 1030 free(rfn); 1031 (void) block_cache_fini(dev _handle);1032 block_fini(dev _handle);1033 fat_idx_fini_by_dev _handle(dev_handle);1031 (void) block_cache_fini(devmap_handle); 1032 block_fini(devmap_handle); 1033 fat_idx_fini_by_devmap_handle(devmap_handle); 1034 1034 ipc_answer_0(rid, ENOMEM); 1035 1035 return; … … 1037 1037 fat_node_initialize(rootp); 1038 1038 1039 fat_idx_t *ridxp = fat_idx_get_by_pos(dev _handle, FAT_CLST_ROOTPAR, 0);1039 fat_idx_t *ridxp = fat_idx_get_by_pos(devmap_handle, FAT_CLST_ROOTPAR, 0); 1040 1040 if (!ridxp) { 1041 1041 free(rfn); 1042 1042 free(rootp); 1043 (void) block_cache_fini(dev _handle);1044 block_fini(dev _handle);1045 fat_idx_fini_by_dev _handle(dev_handle);1043 (void) block_cache_fini(devmap_handle); 1044 block_fini(devmap_handle); 1045 fat_idx_fini_by_devmap_handle(devmap_handle); 1046 1046 ipc_answer_0(rid, ENOMEM); 1047 1047 return; … … 1072 1072 void fat_unmounted(ipc_callid_t rid, ipc_call_t *request) 1073 1073 { 1074 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);1074 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 1075 1075 fs_node_t *fn; 1076 1076 fat_node_t *nodep; 1077 1077 int rc; 1078 1078 1079 rc = fat_root_get(&fn, dev _handle);1079 rc = fat_root_get(&fn, devmap_handle); 1080 1080 if (rc != EOK) { 1081 1081 ipc_answer_0(rid, rc); … … 1105 1105 * stop using libblock for this instance. 1106 1106 */ 1107 (void) fat_node_fini_by_dev _handle(dev_handle);1108 fat_idx_fini_by_dev _handle(dev_handle);1109 (void) block_cache_fini(dev _handle);1110 block_fini(dev _handle);1107 (void) fat_node_fini_by_devmap_handle(devmap_handle); 1108 fat_idx_fini_by_devmap_handle(devmap_handle); 1109 (void) block_cache_fini(devmap_handle); 1110 block_fini(devmap_handle); 1111 1111 1112 1112 ipc_answer_0(rid, EOK); … … 1125 1125 void fat_read(ipc_callid_t rid, ipc_call_t *request) 1126 1126 { 1127 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);1127 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 1128 1128 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1129 1129 aoff64_t pos = … … 1136 1136 int rc; 1137 1137 1138 rc = fat_node_get(&fn, dev _handle, index);1138 rc = fat_node_get(&fn, devmap_handle, index); 1139 1139 if (rc != EOK) { 1140 1140 ipc_answer_0(rid, rc); … … 1156 1156 } 1157 1157 1158 bs = block_bb_get(dev _handle);1158 bs = block_bb_get(devmap_handle); 1159 1159 1160 1160 if (nodep->type == FAT_FILE) { … … 1262 1262 void fat_write(ipc_callid_t rid, ipc_call_t *request) 1263 1263 { 1264 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);1264 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 1265 1265 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1266 1266 aoff64_t pos = … … 1275 1275 int rc; 1276 1276 1277 rc = fat_node_get(&fn, dev _handle, index);1277 rc = fat_node_get(&fn, devmap_handle, index); 1278 1278 if (rc != EOK) { 1279 1279 ipc_answer_0(rid, rc); … … 1295 1295 } 1296 1296 1297 bs = block_bb_get(dev _handle);1297 bs = block_bb_get(devmap_handle); 1298 1298 1299 1299 /* … … 1357 1357 nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs); 1358 1358 /* create an independent chain of nclsts clusters in all FATs */ 1359 rc = fat_alloc_clusters(bs, dev _handle, nclsts, &mcl, &lcl);1359 rc = fat_alloc_clusters(bs, devmap_handle, nclsts, &mcl, &lcl); 1360 1360 if (rc != EOK) { 1361 1361 /* could not allocate a chain of nclsts clusters */ … … 1368 1368 rc = fat_fill_gap(bs, nodep, mcl, pos); 1369 1369 if (rc != EOK) { 1370 (void) fat_free_clusters(bs, dev _handle, mcl);1370 (void) fat_free_clusters(bs, devmap_handle, mcl); 1371 1371 (void) fat_node_put(fn); 1372 1372 ipc_answer_0(callid, rc); … … 1374 1374 return; 1375 1375 } 1376 rc = _fat_block_get(&b, bs, dev _handle, lcl, NULL,1376 rc = _fat_block_get(&b, bs, devmap_handle, lcl, NULL, 1377 1377 (pos / BPS(bs)) % SPC(bs), flags); 1378 1378 if (rc != EOK) { 1379 (void) fat_free_clusters(bs, dev _handle, mcl);1379 (void) fat_free_clusters(bs, devmap_handle, mcl); 1380 1380 (void) fat_node_put(fn); 1381 1381 ipc_answer_0(callid, rc); … … 1388 1388 rc = block_put(b); 1389 1389 if (rc != EOK) { 1390 (void) fat_free_clusters(bs, dev _handle, mcl);1390 (void) fat_free_clusters(bs, devmap_handle, mcl); 1391 1391 (void) fat_node_put(fn); 1392 1392 ipc_answer_0(rid, rc); … … 1399 1399 rc = fat_append_clusters(bs, nodep, mcl, lcl); 1400 1400 if (rc != EOK) { 1401 (void) fat_free_clusters(bs, dev _handle, mcl);1401 (void) fat_free_clusters(bs, devmap_handle, mcl); 1402 1402 (void) fat_node_put(fn); 1403 1403 ipc_answer_0(rid, rc); … … 1414 1414 void fat_truncate(ipc_callid_t rid, ipc_call_t *request) 1415 1415 { 1416 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);1416 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 1417 1417 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1418 1418 aoff64_t size = … … 1423 1423 int rc; 1424 1424 1425 rc = fat_node_get(&fn, dev _handle, index);1425 rc = fat_node_get(&fn, devmap_handle, index); 1426 1426 if (rc != EOK) { 1427 1427 ipc_answer_0(rid, rc); … … 1434 1434 nodep = FAT_NODE(fn); 1435 1435 1436 bs = block_bb_get(dev _handle);1436 bs = block_bb_get(devmap_handle); 1437 1437 1438 1438 if (nodep->size == size) { … … 1461 1461 } else { 1462 1462 fat_cluster_t lastc; 1463 rc = fat_cluster_walk(bs, dev _handle, nodep->firstc,1463 rc = fat_cluster_walk(bs, devmap_handle, nodep->firstc, 1464 1464 &lastc, NULL, (size - 1) / BPC(bs)); 1465 1465 if (rc != EOK) … … 1486 1486 void fat_destroy(ipc_callid_t rid, ipc_call_t *request) 1487 1487 { 1488 dev _handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);1488 devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request); 1489 1489 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1490 1490 fs_node_t *fn; 1491 1491 int rc; 1492 1492 1493 rc = fat_node_get(&fn, dev _handle, index);1493 rc = fat_node_get(&fn, devmap_handle, index); 1494 1494 if (rc != EOK) { 1495 1495 ipc_answer_0(rid, rc); … … 1517 1517 void fat_sync(ipc_callid_t rid, ipc_call_t *request) 1518 1518 { 1519 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);1519 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 1520 1520 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1521 1521 1522 1522 fs_node_t *fn; 1523 int rc = fat_node_get(&fn, dev _handle, index);1523 int rc = fat_node_get(&fn, devmap_handle, index); 1524 1524 if (rc != EOK) { 1525 1525 ipc_answer_0(rid, rc); -
uspace/srv/fs/tmpfs/tmpfs.h
r51a268f r991f645 62 62 fs_node_t *bp; /**< Back pointer to the FS node. */ 63 63 fs_index_t index; /**< TMPFS node index. */ 64 dev _handle_t dev_handle;/**< Device handle. */64 devmap_handle_t devmap_handle;/**< Device handle. */ 65 65 link_t nh_link; /**< Nodes hash table link. */ 66 66 tmpfs_dentry_type_t type; … … 91 91 extern void tmpfs_sync(ipc_callid_t, ipc_call_t *); 92 92 93 extern bool tmpfs_restore(dev _handle_t);93 extern bool tmpfs_restore(devmap_handle_t); 94 94 95 95 #endif -
uspace/srv/fs/tmpfs/tmpfs_dump.c
r51a268f r991f645 55 55 56 56 static bool 57 tmpfs_restore_recursion(dev _handle_t dev, size_t *bufpos, size_t *buflen,57 tmpfs_restore_recursion(devmap_handle_t dev, size_t *bufpos, size_t *buflen, 58 58 aoff64_t *pos, fs_node_t *pfn) 59 59 { … … 161 161 } 162 162 163 bool tmpfs_restore(dev _handle_t dev)163 bool tmpfs_restore(devmap_handle_t dev) 164 164 { 165 165 libfs_ops_t *ops = &tmpfs_libfs_ops; -
uspace/srv/fs/tmpfs/tmpfs_ops.c
r51a268f r991f645 70 70 /* Forward declarations of static functions. */ 71 71 static int tmpfs_match(fs_node_t **, fs_node_t *, const char *); 72 static int tmpfs_node_get(fs_node_t **, dev _handle_t, fs_index_t);72 static int tmpfs_node_get(fs_node_t **, devmap_handle_t, fs_index_t); 73 73 static int tmpfs_node_open(fs_node_t *); 74 74 static int tmpfs_node_put(fs_node_t *); 75 static int tmpfs_create_node(fs_node_t **, dev _handle_t, int);75 static int tmpfs_create_node(fs_node_t **, devmap_handle_t, int); 76 76 static int tmpfs_destroy_node(fs_node_t *); 77 77 static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *); … … 79 79 80 80 /* Implementation of helper functions. */ 81 static int tmpfs_root_get(fs_node_t **rfn, dev _handle_t dev_handle)82 { 83 return tmpfs_node_get(rfn, dev _handle, TMPFS_SOME_ROOT);81 static int tmpfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle) 82 { 83 return tmpfs_node_get(rfn, devmap_handle, TMPFS_SOME_ROOT); 84 84 } 85 85 … … 120 120 } 121 121 122 static dev _handle_t tmpfs_device_get(fs_node_t *fn)122 static devmap_handle_t tmpfs_device_get(fs_node_t *fn) 123 123 { 124 124 return 0; … … 165 165 switch (keys) { 166 166 case 1: 167 return (nodep->dev _handle == key[NODES_KEY_DEV]);167 return (nodep->devmap_handle == key[NODES_KEY_DEV]); 168 168 case 2: 169 return ((nodep->dev _handle == key[NODES_KEY_DEV]) &&169 return ((nodep->devmap_handle == key[NODES_KEY_DEV]) && 170 170 (nodep->index == key[NODES_KEY_INDEX])); 171 171 default: … … 209 209 nodep->bp = NULL; 210 210 nodep->index = 0; 211 nodep->dev _handle = 0;211 nodep->devmap_handle = 0; 212 212 nodep->type = TMPFS_NONE; 213 213 nodep->lnkcnt = 0; … … 233 233 } 234 234 235 static bool tmpfs_instance_init(dev _handle_t dev_handle)235 static bool tmpfs_instance_init(devmap_handle_t devmap_handle) 236 236 { 237 237 fs_node_t *rfn; 238 238 int rc; 239 239 240 rc = tmpfs_create_node(&rfn, dev _handle, L_DIRECTORY);240 rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY); 241 241 if (rc != EOK || !rfn) 242 242 return false; … … 245 245 } 246 246 247 static void tmpfs_instance_done(dev _handle_t dev_handle)247 static void tmpfs_instance_done(devmap_handle_t devmap_handle) 248 248 { 249 249 unsigned long key[] = { 250 [NODES_KEY_DEV] = dev _handle250 [NODES_KEY_DEV] = devmap_handle 251 251 }; 252 252 /* … … 279 279 } 280 280 281 int tmpfs_node_get(fs_node_t **rfn, dev _handle_t dev_handle, fs_index_t index)281 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index) 282 282 { 283 283 unsigned long key[] = { 284 [NODES_KEY_DEV] = dev _handle,284 [NODES_KEY_DEV] = devmap_handle, 285 285 [NODES_KEY_INDEX] = index 286 286 }; … … 308 308 } 309 309 310 int tmpfs_create_node(fs_node_t **rfn, dev _handle_t dev_handle, int lflag)310 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag) 311 311 { 312 312 fs_node_t *rootfn; … … 327 327 nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ 328 328 329 rc = tmpfs_root_get(&rootfn, dev _handle);329 rc = tmpfs_root_get(&rootfn, devmap_handle); 330 330 assert(rc == EOK); 331 331 if (!rootfn) … … 333 333 else 334 334 nodep->index = tmpfs_next_index++; 335 nodep->dev _handle = dev_handle;335 nodep->devmap_handle = devmap_handle; 336 336 if (lflag & L_DIRECTORY) 337 337 nodep->type = TMPFS_DIRECTORY; … … 341 341 /* Insert the new node into the nodes hash table. */ 342 342 unsigned long key[] = { 343 [NODES_KEY_DEV] = nodep->dev _handle,343 [NODES_KEY_DEV] = nodep->devmap_handle, 344 344 [NODES_KEY_INDEX] = nodep->index 345 345 }; … … 357 357 358 358 unsigned long key[] = { 359 [NODES_KEY_DEV] = nodep->dev _handle,359 [NODES_KEY_DEV] = nodep->devmap_handle, 360 360 [NODES_KEY_INDEX] = nodep->index 361 361 }; … … 442 442 void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request) 443 443 { 444 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);444 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 445 445 fs_node_t *rootfn; 446 446 int rc; … … 455 455 456 456 /* Check if this device is not already mounted. */ 457 rc = tmpfs_root_get(&rootfn, dev _handle);457 rc = tmpfs_root_get(&rootfn, devmap_handle); 458 458 if ((rc == EOK) && (rootfn)) { 459 459 (void) tmpfs_node_put(rootfn); … … 464 464 465 465 /* Initialize TMPFS instance. */ 466 if (!tmpfs_instance_init(dev _handle)) {466 if (!tmpfs_instance_init(devmap_handle)) { 467 467 free(opts); 468 468 ipc_answer_0(rid, ENOMEM); … … 470 470 } 471 471 472 rc = tmpfs_root_get(&rootfn, dev _handle);472 rc = tmpfs_root_get(&rootfn, devmap_handle); 473 473 assert(rc == EOK); 474 474 tmpfs_node_t *rootp = TMPFS_NODE(rootfn); 475 475 if (str_cmp(opts, "restore") == 0) { 476 if (tmpfs_restore(dev _handle))476 if (tmpfs_restore(devmap_handle)) 477 477 ipc_answer_3(rid, EOK, rootp->index, rootp->size, 478 478 rootp->lnkcnt); … … 493 493 void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request) 494 494 { 495 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);496 497 tmpfs_instance_done(dev _handle);495 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 496 497 tmpfs_instance_done(devmap_handle); 498 498 ipc_answer_0(rid, EOK); 499 499 } … … 511 511 void tmpfs_read(ipc_callid_t rid, ipc_call_t *request) 512 512 { 513 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);513 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 514 514 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 515 515 aoff64_t pos = … … 521 521 link_t *hlp; 522 522 unsigned long key[] = { 523 [NODES_KEY_DEV] = dev _handle,523 [NODES_KEY_DEV] = devmap_handle, 524 524 [NODES_KEY_INDEX] = index 525 525 }; … … 586 586 void tmpfs_write(ipc_callid_t rid, ipc_call_t *request) 587 587 { 588 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);588 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 589 589 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 590 590 aoff64_t pos = … … 596 596 link_t *hlp; 597 597 unsigned long key[] = { 598 [NODES_KEY_DEV] = dev _handle,598 [NODES_KEY_DEV] = devmap_handle, 599 599 [NODES_KEY_INDEX] = index 600 600 }; … … 651 651 void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request) 652 652 { 653 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);653 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 654 654 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 655 655 aoff64_t size = … … 660 660 */ 661 661 unsigned long key[] = { 662 [NODES_KEY_DEV] = dev _handle,662 [NODES_KEY_DEV] = devmap_handle, 663 663 [NODES_KEY_INDEX] = index 664 664 }; … … 704 704 void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) 705 705 { 706 dev _handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);706 devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request); 707 707 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 708 708 int rc; … … 710 710 link_t *hlp; 711 711 unsigned long key[] = { 712 [NODES_KEY_DEV] = dev _handle,712 [NODES_KEY_DEV] = devmap_handle, 713 713 [NODES_KEY_INDEX] = index 714 714 }; -
uspace/srv/hid/adb_mouse/adb_mouse.c
r51a268f r991f645 78 78 snprintf(dev_path, DEVMAP_NAME_MAXLEN, "%s/mouse", NAMESPACE); 79 79 80 dev _handle_t dev_handle;81 if (devmap_device_register(dev_path, &dev _handle) != EOK) {80 devmap_handle_t devmap_handle; 81 if (devmap_device_register(dev_path, &devmap_handle) != EOK) { 82 82 printf(NAME ": Unable to register device %s\n", dev_path); 83 83 return -1; -
uspace/srv/hid/char_mouse/char_mouse.c
r51a268f r991f645 134 134 snprintf(dev_path, DEVMAP_NAME_MAXLEN, "%s/%s", NAMESPACE, NAME); 135 135 136 dev _handle_t dev_handle;137 if (devmap_device_register(dev_path, &dev _handle) != EOK) {136 devmap_handle_t devmap_handle; 137 if (devmap_device_register(dev_path, &devmap_handle) != EOK) { 138 138 printf(NAME ": Unable to register device %s\n", dev_path); 139 139 return -1; -
uspace/srv/hid/console/console.c
r51a268f r991f645 82 82 size_t index; /**< Console index */ 83 83 size_t refcount; /**< Connection reference count */ 84 dev _handle_t dev_handle; /**< Device handle */84 devmap_handle_t devmap_handle; /**< Device handle */ 85 85 keybuffer_t keybuffer; /**< Buffer for incoming keys. */ 86 86 screenbuffer_t scr; /**< Screenbuffer for saving screen … … 571 571 continue; 572 572 573 if (consoles[i].dev _handle == (dev_handle_t) IPC_GET_ARG1(*icall)) {573 if (consoles[i].devmap_handle == (devmap_handle_t) IPC_GET_ARG1(*icall)) { 574 574 cons = &consoles[i]; 575 575 break; … … 815 815 snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc%u", NAMESPACE, i); 816 816 817 if (devmap_device_register(vc, &consoles[i].dev _handle) != EOK) {817 if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) { 818 818 devmap_hangup_phone(DEVMAP_DRIVER); 819 819 printf(NAME ": Unable to register device %s\n", vc); -
uspace/srv/hid/kbd/generic/kbd.c
r51a268f r991f645 250 250 snprintf(kbd, DEVMAP_NAME_MAXLEN, "%s/%s", NAMESPACE, NAME); 251 251 252 dev _handle_t dev_handle;253 if (devmap_device_register(kbd, &dev _handle) != EOK) {252 devmap_handle_t devmap_handle; 253 if (devmap_device_register(kbd, &devmap_handle) != EOK) { 254 254 printf("%s: Unable to register device %s\n", NAME, kbd); 255 255 return -1; -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
r51a268f r991f645 99 99 return -1; 100 100 101 rc = devmap_device_register(NAMESPACE "/mouse", &ts->dev _handle);101 rc = devmap_device_register(NAMESPACE "/mouse", &ts->devmap_handle); 102 102 if (rc != EOK) { 103 103 devmap_hangup_phone(DEVMAP_DRIVER); -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.h
r51a268f r991f645 125 125 126 126 /** Device handle */ 127 dev _handle_t dev_handle;127 devmap_handle_t devmap_handle; 128 128 129 129 /** Device/driver state */ -
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
r51a268f r991f645 143 143 int main(int argc, char *argv[]) 144 144 { 145 dev _handle_t dev_handle;145 devmap_handle_t devmap_handle; 146 146 int rc; 147 147 int i; … … 151 151 for (i = 0; i < ADB_MAX_ADDR; ++i) { 152 152 adb_dev[i].client_phone = -1; 153 adb_dev[i].dev _handle = 0;153 adb_dev[i].devmap_handle = 0; 154 154 } 155 155 … … 160 160 } 161 161 162 rc = devmap_device_register("adb/kbd", &dev _handle);162 rc = devmap_device_register("adb/kbd", &devmap_handle); 163 163 if (rc != EOK) { 164 164 devmap_hangup_phone(DEVMAP_DRIVER); … … 167 167 } 168 168 169 adb_dev[2].dev _handle = dev_handle;170 adb_dev[8].dev _handle = dev_handle;171 172 rc = devmap_device_register("adb/mouse", &dev _handle);169 adb_dev[2].devmap_handle = devmap_handle; 170 adb_dev[8].devmap_handle = devmap_handle; 171 172 rc = devmap_device_register("adb/mouse", &devmap_handle); 173 173 if (rc != EOK) { 174 174 devmap_hangup_phone(DEVMAP_DRIVER); … … 177 177 } 178 178 179 adb_dev[9].dev _handle = dev_handle;179 adb_dev[9].devmap_handle = devmap_handle; 180 180 181 181 if (cuda_init() < 0) { … … 196 196 ipc_call_t call; 197 197 ipcarg_t method; 198 dev _handle_t dh;198 devmap_handle_t dh; 199 199 int retval; 200 200 int dev_addr, i; … … 206 206 dev_addr = -1; 207 207 for (i = 0; i < ADB_MAX_ADDR; i++) { 208 if (adb_dev[i].dev _handle == dh)208 if (adb_dev[i].devmap_handle == dh) 209 209 dev_addr = i; 210 210 } … … 237 237 */ 238 238 for (i = 0; i < ADB_MAX_ADDR; ++i) { 239 if (adb_dev[i].dev _handle == dh) {239 if (adb_dev[i].devmap_handle == dh) { 240 240 adb_dev[i].client_phone = IPC_GET_ARG5(call); 241 241 } -
uspace/srv/hw/bus/cuda_adb/cuda_adb.h
r51a268f r991f645 104 104 105 105 typedef struct { 106 dev _handle_t dev_handle;106 devmap_handle_t devmap_handle; 107 107 int client_phone; 108 108 } adb_dev_t; -
uspace/srv/hw/char/i8042/i8042.c
r51a268f r991f645 145 145 146 146 snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]); 147 rc = devmap_device_register(name, &i8042_port[i].dev _handle);147 rc = devmap_device_register(name, &i8042_port[i].devmap_handle); 148 148 if (rc != EOK) { 149 149 devmap_hangup_phone(DEVMAP_DRIVER); … … 218 218 ipc_call_t call; 219 219 ipcarg_t method; 220 dev _handle_t dh;220 devmap_handle_t dh; 221 221 int retval; 222 222 int dev_id, i; … … 230 230 dev_id = -1; 231 231 for (i = 0; i < MAX_DEVS; i++) { 232 if (i8042_port[i].dev _handle == dh)232 if (i8042_port[i].devmap_handle == dh) 233 233 dev_id = i; 234 234 } -
uspace/srv/hw/char/i8042/i8042.h
r51a268f r991f645 52 52 /** Softstate structure, one for each serial port (primary and aux). */ 53 53 typedef struct { 54 dev _handle_t dev_handle;54 devmap_handle_t devmap_handle; 55 55 int client_phone; 56 56 } i8042_port_t; -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
r51a268f r991f645 92 92 return -1; 93 93 94 rc = devmap_device_register(NAMESPACE "/" NAME, &uart->dev _handle);94 rc = devmap_device_register(NAMESPACE "/" NAME, &uart->devmap_handle); 95 95 if (rc != EOK) { 96 96 devmap_hangup_phone(DEVMAP_DRIVER); -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h
r51a268f r991f645 88 88 89 89 /** Device handle */ 90 dev _handle_t dev_handle;90 devmap_handle_t devmap_handle; 91 91 } s3c24xx_uart_t; 92 92 -
uspace/srv/vfs/vfs.h
r51a268f r991f645 62 62 #define VFS_PAIR \ 63 63 fs_handle_t fs_handle; \ 64 dev _handle_t dev_handle;64 devmap_handle_t devmap_handle; 65 65 66 66 /** … … 68 68 * doesn't contain any state. For a stateful structure, see vfs_node_t. 69 69 * 70 * @note fs_handle, dev _handle and index are meant to be returned in one70 * @note fs_handle, devmap_handle and index are meant to be returned in one 71 71 * IPC reply. 72 72 */ … … 182 182 extern void vfs_node_put(vfs_node_t *); 183 183 extern void vfs_node_forget(vfs_node_t *); 184 extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, dev _handle_t);184 extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, devmap_handle_t); 185 185 186 186 -
uspace/srv/vfs/vfs_lookup.c
r51a268f r991f645 163 163 aid_t req = async_send_5(phone, VFS_OUT_LOOKUP, (ipcarg_t) first, 164 164 (ipcarg_t) (first + len - 1) % PLB_SIZE, 165 (ipcarg_t) root->dev _handle, (ipcarg_t) lflag, (ipcarg_t) index,165 (ipcarg_t) root->devmap_handle, (ipcarg_t) lflag, (ipcarg_t) index, 166 166 &answer); 167 167 … … 183 183 184 184 result->triplet.fs_handle = (fs_handle_t) rc; 185 result->triplet.dev _handle = (dev_handle_t) IPC_GET_ARG1(answer);185 result->triplet.devmap_handle = (devmap_handle_t) IPC_GET_ARG1(answer); 186 186 result->triplet.index = (fs_index_t) IPC_GET_ARG2(answer); 187 187 result->size = … … 210 210 ipc_call_t answer; 211 211 aid_t req = async_send_2(phone, VFS_OUT_OPEN_NODE, 212 (ipcarg_t) result->triplet.dev _handle,212 (ipcarg_t) result->triplet.devmap_handle, 213 213 (ipcarg_t) result->triplet.index, &answer); 214 214 -
uspace/srv/vfs/vfs_node.c
r51a268f r991f645 113 113 unsigned long key[] = { 114 114 [KEY_FS_HANDLE] = node->fs_handle, 115 [KEY_DEV_HANDLE] = node->dev _handle,115 [KEY_DEV_HANDLE] = node->devmap_handle, 116 116 [KEY_INDEX] = node->index 117 117 }; … … 131 131 ipcarg_t rc; 132 132 rc = async_req_2_0(phone, VFS_OUT_DESTROY, 133 (ipcarg_t)node->dev _handle, (ipcarg_t)node->index);133 (ipcarg_t)node->devmap_handle, (ipcarg_t)node->index); 134 134 assert(rc == EOK); 135 135 vfs_release_phone(node->fs_handle, phone); … … 151 151 unsigned long key[] = { 152 152 [KEY_FS_HANDLE] = node->fs_handle, 153 [KEY_DEV_HANDLE] = node->dev _handle,153 [KEY_DEV_HANDLE] = node->devmap_handle, 154 154 [KEY_INDEX] = node->index 155 155 }; … … 175 175 unsigned long key[] = { 176 176 [KEY_FS_HANDLE] = result->triplet.fs_handle, 177 [KEY_DEV_HANDLE] = result->triplet.dev _handle,177 [KEY_DEV_HANDLE] = result->triplet.devmap_handle, 178 178 [KEY_INDEX] = result->triplet.index 179 179 }; … … 191 191 memset(node, 0, sizeof(vfs_node_t)); 192 192 node->fs_handle = result->triplet.fs_handle; 193 node->dev _handle = result->triplet.dev_handle;193 node->devmap_handle = result->triplet.devmap_handle; 194 194 node->index = result->triplet.index; 195 195 node->size = result->size; … … 243 243 vfs_node_t *node = hash_table_get_instance(item, vfs_node_t, nh_link); 244 244 return (node->fs_handle == (fs_handle_t) key[KEY_FS_HANDLE]) && 245 (node->dev _handle == key[KEY_DEV_HANDLE]) &&245 (node->devmap_handle == key[KEY_DEV_HANDLE]) && 246 246 (node->index == key[KEY_INDEX]); 247 247 } … … 255 255 unsigned refcnt; 256 256 fs_handle_t fs_handle; 257 dev _handle_t dev_handle;257 devmap_handle_t devmap_handle; 258 258 }; 259 259 … … 264 264 265 265 if ((node->fs_handle == rd->fs_handle) && 266 (node->dev _handle == rd->dev_handle))266 (node->devmap_handle == rd->devmap_handle)) 267 267 rd->refcnt += node->refcnt; 268 268 } 269 269 270 270 unsigned 271 vfs_nodes_refcount_sum_get(fs_handle_t fs_handle, dev _handle_t dev_handle)271 vfs_nodes_refcount_sum_get(fs_handle_t fs_handle, devmap_handle_t devmap_handle) 272 272 { 273 273 struct refcnt_data rd = { 274 274 .refcnt = 0, 275 275 .fs_handle = fs_handle, 276 .dev _handle = dev_handle276 .devmap_handle = devmap_handle 277 277 }; 278 278 -
uspace/srv/vfs/vfs_ops.c
r51a268f r991f645 55 55 56 56 /* Forward declarations of static functions. */ 57 static int vfs_truncate_internal(fs_handle_t, dev _handle_t, fs_index_t, aoff64_t);57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t); 58 58 59 59 /** … … 65 65 vfs_pair_t rootfs = { 66 66 .fs_handle = 0, 67 .dev _handle = 067 .devmap_handle = 0 68 68 }; 69 69 70 static void vfs_mount_internal(ipc_callid_t rid, dev _handle_t dev_handle,70 static void vfs_mount_internal(ipc_callid_t rid, devmap_handle_t devmap_handle, 71 71 fs_handle_t fs_handle, char *mp, char *opts) 72 72 { … … 125 125 phone = vfs_grab_phone(fs_handle); 126 126 msg = async_send_1(phone, VFS_OUT_MOUNTED, 127 (ipcarg_t) dev _handle, &answer);127 (ipcarg_t) devmap_handle, &answer); 128 128 /* send the mount options */ 129 129 rc = async_data_write_start(phone, (void *)opts, … … 150 150 151 151 mr_res.triplet.fs_handle = fs_handle; 152 mr_res.triplet.dev _handle = dev_handle;152 mr_res.triplet.devmap_handle = devmap_handle; 153 153 mr_res.triplet.index = rindex; 154 154 mr_res.size = rsize; … … 157 157 158 158 rootfs.fs_handle = fs_handle; 159 rootfs.dev _handle = dev_handle;159 rootfs.devmap_handle = devmap_handle; 160 160 161 161 /* Add reference to the mounted root. */ … … 187 187 phone = vfs_grab_phone(mp_res.triplet.fs_handle); 188 188 msg = async_send_4(phone, VFS_OUT_MOUNT, 189 (ipcarg_t) mp_res.triplet.dev _handle,189 (ipcarg_t) mp_res.triplet.devmap_handle, 190 190 (ipcarg_t) mp_res.triplet.index, 191 191 (ipcarg_t) fs_handle, 192 (ipcarg_t) dev _handle, &answer);192 (ipcarg_t) devmap_handle, &answer); 193 193 194 194 /* send connection */ … … 229 229 230 230 mr_res.triplet.fs_handle = fs_handle; 231 mr_res.triplet.dev _handle = dev_handle;231 mr_res.triplet.devmap_handle = devmap_handle; 232 232 mr_res.triplet.index = rindex; 233 233 mr_res.size = rsize; … … 255 255 * in the request. 256 256 */ 257 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);257 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 258 258 259 259 /* … … 343 343 344 344 /* Do the mount */ 345 vfs_mount_internal(rid, dev _handle, fs_handle, mp, opts);345 vfs_mount_internal(rid, devmap_handle, fs_handle, mp, opts); 346 346 free(mp); 347 347 free(fs_name); … … 402 402 */ 403 403 if (vfs_nodes_refcount_sum_get(mr_node->fs_handle, 404 mr_node->dev _handle) != 2) {404 mr_node->devmap_handle) != 2) { 405 405 fibril_rwlock_write_unlock(&namespace_rwlock); 406 406 vfs_node_put(mr_node); … … 422 422 phone = vfs_grab_phone(mr_node->fs_handle); 423 423 rc = async_req_1_0(phone, VFS_OUT_UNMOUNTED, 424 mr_node->dev _handle);424 mr_node->devmap_handle); 425 425 vfs_release_phone(mr_node->fs_handle, phone); 426 426 if (rc != EOK) { … … 431 431 } 432 432 rootfs.fs_handle = 0; 433 rootfs.dev _handle = 0;433 rootfs.devmap_handle = 0; 434 434 } else { 435 435 … … 458 458 459 459 phone = vfs_grab_phone(mp_node->fs_handle); 460 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->dev _handle,460 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->devmap_handle, 461 461 mp_node->index); 462 462 vfs_release_phone(mp_node->fs_handle, phone); … … 569 569 if (node->size) { 570 570 rc = vfs_truncate_internal(node->fs_handle, 571 node->dev _handle, node->index, 0);571 node->devmap_handle, node->index, 0); 572 572 if (rc) { 573 573 fibril_rwlock_write_unlock(&node->contents_rwlock); … … 626 626 627 627 lr.triplet.fs_handle = IPC_GET_ARG1(*request); 628 lr.triplet.dev _handle = IPC_GET_ARG2(*request);628 lr.triplet.devmap_handle = IPC_GET_ARG2(*request); 629 629 lr.triplet.index = IPC_GET_ARG3(*request); 630 630 int oflag = IPC_GET_ARG4(*request); … … 647 647 if (node->size) { 648 648 rc = vfs_truncate_internal(node->fs_handle, 649 node->dev _handle, node->index, 0);649 node->devmap_handle, node->index, 0); 650 650 if (rc) { 651 651 fibril_rwlock_write_unlock(&node->contents_rwlock); … … 709 709 aid_t msg; 710 710 ipc_call_t answer; 711 msg = async_send_2(fs_phone, VFS_OUT_SYNC, file->node->dev _handle,711 msg = async_send_2(fs_phone, VFS_OUT_SYNC, file->node->devmap_handle, 712 712 file->node->index, &answer); 713 713 … … 740 740 aid_t msg; 741 741 ipc_call_t answer; 742 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->dev _handle,742 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->devmap_handle, 743 743 file->node->index, &answer); 744 744 … … 838 838 839 839 rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ, 840 file->node->dev _handle, file->node->index, file->pos,840 file->node->devmap_handle, file->node->index, file->pos, 841 841 &answer); 842 842 } else { 843 843 rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE, 844 file->node->dev _handle, file->node->index, file->pos,844 file->node->devmap_handle, file->node->index, file->pos, 845 845 &answer); 846 846 } … … 961 961 } 962 962 963 int vfs_truncate_internal(fs_handle_t fs_handle, dev _handle_t dev_handle,963 int vfs_truncate_internal(fs_handle_t fs_handle, devmap_handle_t devmap_handle, 964 964 fs_index_t index, aoff64_t size) 965 965 { … … 968 968 969 969 fs_phone = vfs_grab_phone(fs_handle); 970 rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) dev _handle,970 rc = async_req_4_0(fs_phone, VFS_OUT_TRUNCATE, (ipcarg_t) devmap_handle, 971 971 (ipcarg_t) index, LOWER32(size), UPPER32(size)); 972 972 vfs_release_phone(fs_handle, fs_phone); … … 990 990 fibril_rwlock_write_lock(&file->node->contents_rwlock); 991 991 rc = vfs_truncate_internal(file->node->fs_handle, 992 file->node->dev _handle, file->node->index, size);992 file->node->devmap_handle, file->node->index, size); 993 993 if (rc == EOK) 994 994 file->node->size = size; … … 1022 1022 1023 1023 aid_t msg; 1024 msg = async_send_3(fs_phone, VFS_OUT_STAT, file->node->dev _handle,1024 msg = async_send_3(fs_phone, VFS_OUT_STAT, file->node->devmap_handle, 1025 1025 file->node->index, true, NULL); 1026 1026 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); … … 1071 1071 int fs_phone = vfs_grab_phone(node->fs_handle); 1072 1072 aid_t msg; 1073 msg = async_send_3(fs_phone, VFS_OUT_STAT, node->dev _handle,1073 msg = async_send_3(fs_phone, VFS_OUT_STAT, node->devmap_handle, 1074 1074 node->index, false, NULL); 1075 1075 ipc_forward_fast(callid, fs_phone, 0, 0, 0, IPC_FF_ROUTE_FROM_ME); … … 1245 1245 /* Check whether linking to the same file system instance. */ 1246 1246 if ((old_node->fs_handle != new_par_lr.triplet.fs_handle) || 1247 (old_node->dev _handle != new_par_lr.triplet.dev_handle)) {1247 (old_node->devmap_handle != new_par_lr.triplet.devmap_handle)) { 1248 1248 fibril_rwlock_write_unlock(&namespace_rwlock); 1249 1249 ipc_answer_0(rid, EXDEV); /* different file systems */
Note:
See TracChangeset
for help on using the changeset viewer.