Changeset 4c3c4a5 in mainline for uspace/srv/fs/exfat/exfat.h


Ignore:
Timestamp:
2011-06-29T04:04:19Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fb88ea
Parents:
fcc3cd8
Message:
  1. Integrate fat_udx.c as exfat_idx.c
  2. Add skeleton for libfs_ops
  3. Improve mount/unmount
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat.h

    rfcc3cd8 r4c3c4a5  
    3535#define EXFAT_FAT_H_
    3636
     37#include "exfat_fat.h"
    3738#include <fibril_synch.h>
    3839#include <libfs.h>
     
    5859#define DATA_CNT(bs)    uint32_t_le2host(bs->data_clusters)
    5960#define ROOT_ST(bs)             uint32_t_le2host(bs->rootdir_cluster)
    60 #define VOL_FLAGS               uint16_t_le2host(bs->volume_flags)
     61#define VOL_FLAGS(bs)   uint16_t_le2host(bs->volume_flags)
    6162
    6263
     
    8889} __attribute__((__packed__)) exfat_bs_t;
    8990
     91typedef enum {
     92        EXFAT_DIRECTORY,
     93        EXFAT_FILE
     94} exfat_node_type_t;
     95
     96struct exfat_node;
     97
     98typedef struct {
     99        /** Used indices (position) hash table link. */
     100        link_t          uph_link;
     101        /** Used indices (index) hash table link. */
     102        link_t          uih_link;
     103
     104        fibril_mutex_t  lock;
     105        devmap_handle_t devmap_handle;
     106        fs_index_t      index;
     107        /**
     108         * Parent node's first cluster.
     109         * Zero is used if this node is not linked, in which case nodep must
     110         * contain a pointer to the in-core node structure.
     111         * One is used when the parent is the root directory.
     112         */
     113        exfat_cluster_t pfc;
     114        /** Directory entry index within the parent node. */
     115        unsigned        pdi;
     116        /** Pointer to in-core node instance. */
     117        struct exfat_node       *nodep;
     118} exfat_idx_t;
     119
     120/** exFAT in-core node. */
     121typedef struct exfat_node {
     122        /** Back pointer to the FS node. */
     123        fs_node_t               *bp;
     124       
     125        fibril_mutex_t          lock;
     126        exfat_node_type_t       type;
     127        exfat_idx_t                     *idx;
     128        /**
     129         *  Node's first cluster.
     130         *  Zero is used for zero-length nodes.
     131         *  One is used to mark root directory.
     132         */
     133        exfat_cluster_t         firstc;
     134        /** exFAT in-core node free list link. */
     135        link_t                  ffn_link;
     136        aoff64_t                size;
     137        unsigned                lnkcnt;
     138        unsigned                refcnt;
     139        bool                    dirty;
     140
     141        /*
     142         * Cache of the node's last and "current" cluster to avoid some
     143         * unnecessary FAT walks.
     144         */
     145        /* Node's last cluster in FAT. */
     146        bool            lastc_cached_valid;
     147        exfat_cluster_t lastc_cached_value;
     148        /* Node's "current" cluster, i.e. where the last I/O took place. */
     149        bool            currc_cached_valid;
     150        aoff64_t        currc_cached_bn;
     151        exfat_cluster_t currc_cached_value;
     152} exfat_node_t;
     153
    90154
    91155extern fs_reg_t exfat_reg;
     
    95159extern void exfat_unmounted(ipc_callid_t, ipc_call_t *);
    96160extern void exfat_unmount(ipc_callid_t, ipc_call_t *);
     161extern void exfat_lookup(ipc_callid_t, ipc_call_t *);
     162extern void exfat_read(ipc_callid_t, ipc_call_t *);
     163extern void exfat_write(ipc_callid_t, ipc_call_t *);
     164extern void exfat_truncate(ipc_callid_t, ipc_call_t *);
     165extern void exfat_stat(ipc_callid_t, ipc_call_t *);
     166extern void exfat_close(ipc_callid_t, ipc_call_t *);
     167extern void exfat_destroy(ipc_callid_t, ipc_call_t *);
     168extern void exfat_open_node(ipc_callid_t, ipc_call_t *);
     169extern void exfat_stat(ipc_callid_t, ipc_call_t *);
     170extern void exfat_sync(ipc_callid_t, ipc_call_t *);
     171
     172extern int exfat_idx_get_new(exfat_idx_t **, devmap_handle_t);
     173extern exfat_idx_t *exfat_idx_get_by_pos(devmap_handle_t, exfat_cluster_t, unsigned);
     174extern exfat_idx_t *exfat_idx_get_by_index(devmap_handle_t, fs_index_t);
     175extern void exfat_idx_destroy(exfat_idx_t *);
     176extern void exfat_idx_hashin(exfat_idx_t *);
     177extern void exfat_idx_hashout(exfat_idx_t *);
     178
     179extern int exfat_idx_init(void);
     180extern void exfat_idx_fini(void);
     181extern int exfat_idx_init_by_devmap_handle(devmap_handle_t);
     182extern void exfat_idx_fini_by_devmap_handle(devmap_handle_t);
    97183
    98184#endif
Note: See TracChangeset for help on using the changeset viewer.