Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    refcebe1 rb33870b  
    4242#include <libext2.h>
    4343#include <ipc/services.h>
    44 #include <ipc/devmap.h>
     44#include <ipc/loc.h>
    4545#include <macros.h>
    4646#include <async.h>
     
    6969typedef struct ext2fs_instance {
    7070        link_t link;
    71         devmap_handle_t devmap_handle;
     71        service_id_t service_id;
    7272        ext2_filesystem_t *filesystem;
    7373        unsigned int open_nodes_count;
     
    8585 * Forward declarations of auxiliary functions
    8686 */
    87 static int ext2fs_instance_get(devmap_handle_t, ext2fs_instance_t **);
     87static int ext2fs_instance_get(service_id_t, ext2fs_instance_t **);
    8888static int ext2fs_read_directory(ipc_callid_t, aoff64_t, size_t,
    8989    ext2fs_instance_t *, ext2_inode_ref_t *, size_t *);
     
    9797 * Forward declarations of EXT2 libfs operations.
    9898 */
    99 static int ext2fs_root_get(fs_node_t **, devmap_handle_t);
     99static int ext2fs_root_get(fs_node_t **, service_id_t);
    100100static int ext2fs_match(fs_node_t **, fs_node_t *, const char *);
    101 static int ext2fs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);
     101static int ext2fs_node_get(fs_node_t **, service_id_t, fs_index_t);
    102102static int ext2fs_node_open(fs_node_t *);
    103103static int ext2fs_node_put(fs_node_t *);
    104 static int ext2fs_create_node(fs_node_t **, devmap_handle_t, int);
     104static int ext2fs_create_node(fs_node_t **, service_id_t, int);
    105105static int ext2fs_destroy_node(fs_node_t *);
    106106static int ext2fs_link(fs_node_t *, fs_node_t *, const char *);
     
    112112static bool ext2fs_is_directory(fs_node_t *);
    113113static bool ext2fs_is_file(fs_node_t *node);
    114 static devmap_handle_t ext2fs_device_get(fs_node_t *node);
     114static service_id_t ext2fs_service_get(fs_node_t *node);
    115115
    116116/*
     
    134134        ext2fs_node_t *enode = hash_table_get_instance(item, ext2fs_node_t, link);
    135135        assert(keys > 0);
    136         if (enode->instance->devmap_handle !=
    137             ((devmap_handle_t) key[OPEN_NODES_DEV_HANDLE_KEY])) {
     136        if (enode->instance->service_id !=
     137            ((service_id_t) key[OPEN_NODES_DEV_HANDLE_KEY])) {
    138138                return false;
    139139        }
     
    180180
    181181/**
    182  * Find an instance of filesystem for the given devmap_handle
    183  */
    184 int ext2fs_instance_get(devmap_handle_t devmap_handle, ext2fs_instance_t **inst)
    185 {
    186         EXT2FS_DBG("(%" PRIun ", -)", devmap_handle);
     182 * Find an instance of filesystem for the given service_id
     183 */
     184int ext2fs_instance_get(service_id_t service_id, ext2fs_instance_t **inst)
     185{
     186        EXT2FS_DBG("(%" PRIun ", -)", service_id);
    187187        ext2fs_instance_t *tmp;
    188188       
     
    198198                tmp = list_get_instance(link, ext2fs_instance_t, link);
    199199               
    200                 if (tmp->devmap_handle == devmap_handle) {
     200                if (tmp->service_id == service_id) {
    201201                        *inst = tmp;
    202202                        fibril_mutex_unlock(&instance_list_mutex);
     
    213213
    214214
    215 int ext2fs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)
    216 {
    217         EXT2FS_DBG("(-, %" PRIun ")", devmap_handle);
    218         return ext2fs_node_get(rfn, devmap_handle, EXT2_INODE_ROOT_INDEX);
     215int ext2fs_root_get(fs_node_t **rfn, service_id_t service_id)
     216{
     217        EXT2FS_DBG("(-, %" PRIun ")", service_id);
     218        return ext2fs_node_get(rfn, service_id, EXT2_INODE_ROOT_INDEX);
    219219}
    220220
     
    289289
    290290/** Instantiate a EXT2 in-core node. */
    291 int ext2fs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)
    292 {
    293         EXT2FS_DBG("(-,%" PRIun ",%u)", devmap_handle, index);
     291int ext2fs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
     292{
     293        EXT2FS_DBG("(-,%" PRIun ",%u)", service_id, index);
    294294       
    295295        ext2fs_instance_t *inst = NULL;
    296296        int rc;
    297297       
    298         rc = ext2fs_instance_get(devmap_handle, &inst);
     298        rc = ext2fs_instance_get(service_id, &inst);
    299299        if (rc != EOK) {
    300300                return rc;
     
    317317        /* Check if the node is not already open */
    318318        unsigned long key[] = {
    319                 [OPEN_NODES_DEV_HANDLE_KEY] = inst->devmap_handle,
     319                [OPEN_NODES_DEV_HANDLE_KEY] = inst->service_id,
    320320                [OPEN_NODES_INODE_KEY] = index,
    321321        };
     
    411411
    412412        unsigned long key[] = {
    413                 [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance->devmap_handle,
     413                [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance->service_id,
    414414                [OPEN_NODES_INODE_KEY] = enode->inode_ref->index,
    415415        };
     
    429429}
    430430
    431 int ext2fs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)
     431int ext2fs_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
    432432{
    433433        EXT2FS_DBG("");
     
    557557}
    558558
    559 devmap_handle_t ext2fs_device_get(fs_node_t *fn)
     559service_id_t ext2fs_service_get(fs_node_t *fn)
    560560{
    561561        EXT2FS_DBG("");
    562562        ext2fs_node_t *enode = EXT2FS_NODE(fn);
    563         return enode->instance->devmap_handle;
     563        return enode->instance->service_id;
    564564}
    565565
     
    581581        .is_directory = ext2fs_is_directory,
    582582        .is_file = ext2fs_is_file,
    583         .device_get = ext2fs_device_get
     583        .service_get = ext2fs_service_get
    584584};
    585585
     
    588588 */
    589589
    590 static int ext2fs_mounted(devmap_handle_t devmap_handle, const char *opts,
     590static int ext2fs_mounted(service_id_t service_id, const char *opts,
    591591   fs_index_t *index, aoff64_t *size, unsigned *lnkcnt)
    592592{
     
    610610       
    611611        /* Initialize the filesystem  */
    612         rc = ext2_filesystem_init(fs, devmap_handle);
     612        rc = ext2_filesystem_init(fs, service_id);
    613613        if (rc != EOK) {
    614614                free(fs);
     
    637637        /* Initialize instance */
    638638        link_initialize(&inst->link);
    639         inst->devmap_handle = devmap_handle;
     639        inst->service_id = service_id;
    640640        inst->filesystem = fs;
    641641        inst->open_nodes_count = 0;
     
    666666}
    667667
    668 static int ext2fs_unmounted(devmap_handle_t devmap_handle)
     668static int ext2fs_unmounted(service_id_t service_id)
    669669{
    670670        EXT2FS_DBG("");
     
    672672        int rc;
    673673       
    674         rc = ext2fs_instance_get(devmap_handle, &inst);
     674        rc = ext2fs_instance_get(service_id, &inst);
    675675       
    676676        if (rc != EOK)
     
    698698
    699699static int
    700 ext2fs_read(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
     700ext2fs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
    701701    size_t *rbytes)
    702702{
     
    717717        }
    718718       
    719         rc = ext2fs_instance_get(devmap_handle, &inst);
     719        rc = ext2fs_instance_get(service_id, &inst);
    720720        if (rc != EOK) {
    721721                async_answer_0(callid, rc);
     
    907907       
    908908        /* Usual case - we need to read a block from device */
    909         rc = block_get(&block, inst->devmap_handle, fs_block, BLOCK_FLAGS_NONE);
     909        rc = block_get(&block, inst->service_id, fs_block, BLOCK_FLAGS_NONE);
    910910        if (rc != EOK) {
    911911                async_answer_0(callid, rc);
     
    925925
    926926static int
    927 ext2fs_write(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,
     927ext2fs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
    928928    size_t *wbytes, aoff64_t *nsize)
    929929{
     
    933933
    934934static int
    935 ext2fs_truncate(devmap_handle_t devmap_handle, fs_index_t index, aoff64_t size)
     935ext2fs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
    936936{
    937937        EXT2FS_DBG("");
     
    939939}
    940940
    941 static int ext2fs_close(devmap_handle_t devmap_handle, fs_index_t index)
    942 {
    943         EXT2FS_DBG("");
    944         return EOK;
    945 }
    946 
    947 static int ext2fs_destroy(devmap_handle_t devmap_handle, fs_index_t index)
     941static int ext2fs_close(service_id_t service_id, fs_index_t index)
     942{
     943        EXT2FS_DBG("");
     944        return EOK;
     945}
     946
     947static int ext2fs_destroy(service_id_t service_id, fs_index_t index)
    948948{
    949949        EXT2FS_DBG("");
     
    951951}
    952952
    953 static int ext2fs_sync(devmap_handle_t devmap_handle, fs_index_t index)
     953static int ext2fs_sync(service_id_t service_id, fs_index_t index)
    954954{
    955955        EXT2FS_DBG("");
Note: See TracChangeset for help on using the changeset viewer.