Changeset 6d57e1c in mainline for uspace/srv/fs/exfat/exfat_ops.c


Ignore:
Timestamp:
2011-06-27T19:39:06Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
620a367
Parents:
efa8ed93
Message:

exFAT:

  1. Structure for BootSector
  2. Skeleton for mount/umount ops
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_ops.c

    refa8ed93 r6d57e1c  
    5656#include <malloc.h>
    5757
     58/** libfs operations */
     59
     60libfs_ops_t exfat_libfs_ops;
     61/*
     62libfs_ops_t exfat_libfs_ops = {
     63        .root_get = exfat_root_get,
     64        .match = exfat_match,
     65        .node_get = exfat_node_get,
     66        .node_open = exfat_node_open,
     67        .node_put = exfat_node_put,
     68        .create = exfat_create_node,
     69        .destroy = exfat_destroy_node,
     70        .link = exfat_link,
     71        .unlink = exfat_unlink,
     72        .has_children = exfat_has_children,
     73        .index_get = exfat_index_get,
     74        .size_get = exfat_size_get,
     75        .lnkcnt_get = exfat_lnkcnt_get,
     76        .plb_get_char = exfat_plb_get_char,
     77        .is_directory = exfat_is_directory,
     78        .is_file = exfat_is_file,
     79        .device_get = exfat_device_get
     80};
     81*/
     82
     83/*
     84 * VFS operations.
     85 */
     86
     87void exfat_mounted(ipc_callid_t rid, ipc_call_t *request)
     88{
     89        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     90        enum cache_mode cmode;
     91        exfat_bs_t *bs;
     92
     93        /* Accept the mount options */
     94        char *opts;
     95        int rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL);
     96
     97        if (rc != EOK) {
     98                async_answer_0(rid, rc);
     99                return;
     100        }
     101
     102        /* Check for option enabling write through. */
     103        if (str_cmp(opts, "wtcache") == 0)
     104                cmode = CACHE_MODE_WT;
     105        else
     106                cmode = CACHE_MODE_WB;
     107
     108        free(opts);
     109
     110        /* initialize libblock */
     111        rc = block_init(devmap_handle, BS_SIZE);
     112        if (rc != EOK) {
     113                async_answer_0(rid, rc);
     114                return;
     115        }
     116
     117        /* prepare the boot block */
     118        rc = block_bb_read(devmap_handle, BS_BLOCK);
     119        if (rc != EOK) {
     120                block_fini(devmap_handle);
     121                async_answer_0(rid, rc);
     122                return;
     123        }
     124
     125        /* get the buffer with the boot sector */
     126        bs = block_bb_get(devmap_handle);
     127       
     128        (void) bs;
     129
     130        /* Initialize the block cache */
     131        rc = block_cache_init(devmap_handle, BS_SIZE, 0 /* XXX */, cmode);
     132        if (rc != EOK) {
     133                block_fini(devmap_handle);
     134                async_answer_0(rid, rc);
     135                return;
     136        }
     137
     138        async_answer_0(rid, EOK);
     139/*      async_answer_3(rid, EOK, ridxp->index, rootp->size, rootp->lnkcnt); */
     140}
     141
     142void exfat_mount(ipc_callid_t rid, ipc_call_t *request)
     143{
     144        libfs_mount(&exfat_libfs_ops, exfat_reg.fs_handle, rid, request);
     145}
     146
     147void exfat_unmounted(ipc_callid_t rid, ipc_call_t *request)
     148{
     149        devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     150
     151        /*
     152         * Perform cleanup of the node structures, index structures and
     153         * associated data. Write back this file system's dirty blocks and
     154         * stop using libblock for this instance.
     155         */
     156        (void) block_cache_fini(devmap_handle);
     157        block_fini(devmap_handle);
     158
     159        async_answer_0(rid, EOK);
     160}
     161
     162void exfat_unmount(ipc_callid_t rid, ipc_call_t *request)
     163{
     164        libfs_unmount(&exfat_libfs_ops, rid, request);
     165}
    58166
    59167
Note: See TracChangeset for help on using the changeset viewer.