Ignore:
File:
1 edited

Legend:

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

    r852b801 rffa2c8ef  
    3535
    3636#include "fat_fat.h"
    37 #include <ipc/ipc.h>
    38 #include <fibril_sync.h>
     37#include <fibril_synch.h>
    3938#include <libfs.h>
    4039#include <atomic.h>
     
    4847
    4948#define min(a, b)               ((a) < (b) ? (a) : (b))
     49
     50/*
     51 * Convenience macros for accessing some frequently used boot sector members.
     52 */
     53#define BPS(bs)         uint16_t_le2host((bs)->bps)
     54#define SPC(bs)         (bs)->spc
     55#define RSCNT(bs)       uint16_t_le2host((bs)->rscnt)
     56#define FATCNT(bs)      (bs)->fatcnt
     57#define SF(bs)          uint16_t_le2host((bs)->sec_per_fat)
     58#define RDE(bs)         uint16_t_le2host((bs)->root_ent_max)
     59#define TS(bs)          (uint16_t_le2host((bs)->totsec16) != 0 ? \
     60                        uint16_t_le2host((bs)->totsec16) : \
     61                        uint32_t_le2host(bs->totsec32))
    5062
    5163#define BS_BLOCK                0
     
    119131                        /** Signature. */
    120132                        uint16_t        signature;
    121                 } __attribute__ ((packed));
    122         }; 
     133                } fat32 __attribute__ ((packed));
     134        };
    123135} __attribute__ ((packed)) fat_bs_t;
    124136
     
    163175
    164176        fibril_mutex_t  lock;
    165         dev_handle_t    dev_handle;
     177        devmap_handle_t devmap_handle;
    166178        fs_index_t      index;
    167179        /**
     
    194206        /** FAT in-core node free list link. */
    195207        link_t                  ffn_link;
    196         size_t                  size;
     208        aoff64_t                size;
    197209        unsigned                lnkcnt;
    198210        unsigned                refcnt;
    199211        bool                    dirty;
     212
     213        /*
     214         * Cache of the node's last and "current" cluster to avoid some
     215         * unnecessary FAT walks.
     216         */
     217        /* Node's last cluster in FAT. */
     218        bool            lastc_cached_valid;
     219        fat_cluster_t   lastc_cached_value;
     220        /* Node's "current" cluster, i.e. where the last I/O took place. */
     221        bool            currc_cached_valid;
     222        aoff64_t        currc_cached_bn;
     223        fat_cluster_t   currc_cached_value;
    200224} fat_node_t;
    201225
     
    204228extern void fat_mounted(ipc_callid_t, ipc_call_t *);
    205229extern void fat_mount(ipc_callid_t, ipc_call_t *);
     230extern void fat_unmounted(ipc_callid_t, ipc_call_t *);
     231extern void fat_unmount(ipc_callid_t, ipc_call_t *);
    206232extern void fat_lookup(ipc_callid_t, ipc_call_t *);
    207233extern void fat_read(ipc_callid_t, ipc_call_t *);
     
    215241extern void fat_sync(ipc_callid_t, ipc_call_t *);
    216242
    217 extern fat_idx_t *fat_idx_get_new(dev_handle_t);
    218 extern fat_idx_t *fat_idx_get_by_pos(dev_handle_t, fat_cluster_t, unsigned);
    219 extern fat_idx_t *fat_idx_get_by_index(dev_handle_t, fs_index_t);
     243extern int fat_idx_get_new(fat_idx_t **, devmap_handle_t);
     244extern fat_idx_t *fat_idx_get_by_pos(devmap_handle_t, fat_cluster_t, unsigned);
     245extern fat_idx_t *fat_idx_get_by_index(devmap_handle_t, fs_index_t);
    220246extern void fat_idx_destroy(fat_idx_t *);
    221247extern void fat_idx_hashin(fat_idx_t *);
     
    224250extern int fat_idx_init(void);
    225251extern void fat_idx_fini(void);
    226 extern int fat_idx_init_by_dev_handle(dev_handle_t);
    227 extern void fat_idx_fini_by_dev_handle(dev_handle_t);
     252extern int fat_idx_init_by_devmap_handle(devmap_handle_t);
     253extern void fat_idx_fini_by_devmap_handle(devmap_handle_t);
    228254
    229255#endif
Note: See TracChangeset for help on using the changeset viewer.