Ignore:
File:
1 edited

Legend:

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

    rb69e4c0 rffa2c8ef  
    11/*
    22 * Copyright (c) 2008 Jakub Jermar
    3  * Copyright (c) 2011 Oleg Romanenko
    43 * All rights reserved.
    54 *
     
    4746#endif
    4847
    49 #define min(a, b)       ((a) < (b) ? (a) : (b))
     48#define min(a, b)               ((a) < (b) ? (a) : (b))
    5049
    5150/*
     
    5655#define RSCNT(bs)       uint16_t_le2host((bs)->rscnt)
    5756#define FATCNT(bs)      (bs)->fatcnt
    58 
    59 #define SF(bs)          (uint16_t_le2host((bs)->sec_per_fat) ? \
    60     uint16_t_le2host((bs)->sec_per_fat) : \
    61     uint32_t_le2host(bs->fat32.sectors_per_fat))
    62 
     57#define SF(bs)          uint16_t_le2host((bs)->sec_per_fat)
    6358#define RDE(bs)         uint16_t_le2host((bs)->root_ent_max)
    64 
    65 #define TS(bs)          (uint16_t_le2host((bs)->totsec16) ? \
    66     uint16_t_le2host((bs)->totsec16) : \
    67     uint32_t_le2host(bs->totsec32))
    68 
    69 #define BS_BLOCK        0
    70 #define BS_SIZE         512
     59#define TS(bs)          (uint16_t_le2host((bs)->totsec16) != 0 ? \
     60                        uint16_t_le2host((bs)->totsec16) : \
     61                        uint32_t_le2host(bs->totsec32))
     62
     63#define BS_BLOCK                0
     64#define BS_SIZE                 512
    7165
    7266typedef struct fat_bs {
     
    141135} __attribute__ ((packed)) fat_bs_t;
    142136
    143 #define FAT32_FSINFO_SIG1       "RRaA"
    144 #define FAT32_FSINFO_SIG2       "rrAa"
    145 #define FAT32_FSINFO_SIG3       "\x00\x00\x55\xaa"
    146 
    147 typedef struct {
    148         uint8_t sig1[4];
    149         uint8_t res1[480];
    150         uint8_t sig2[4];
    151         uint32_t free_clusters;
    152         uint32_t last_allocated_cluster;
    153         uint8_t res2[12];
    154         uint8_t sig3[4];
    155 } __attribute__ ((packed)) fat32_fsinfo_t;
    156 
    157137typedef enum {
    158138        FAT_INVALID,
     
    195175
    196176        fibril_mutex_t  lock;
    197         service_id_t    service_id;
     177        devmap_handle_t devmap_handle;
    198178        fs_index_t      index;
    199179        /**
     
    244224} fat_node_t;
    245225
    246 typedef struct {
    247         bool lfn_enabled;
    248 } fat_instance_t;
    249 
    250 extern vfs_out_ops_t fat_ops;
    251 extern libfs_ops_t fat_libfs_ops;
    252 
    253 extern int fat_idx_get_new(fat_idx_t **, service_id_t);
    254 extern fat_idx_t *fat_idx_get_by_pos(service_id_t, fat_cluster_t, unsigned);
    255 extern fat_idx_t *fat_idx_get_by_index(service_id_t, fs_index_t);
     226extern fs_reg_t fat_reg;
     227
     228extern void fat_mounted(ipc_callid_t, ipc_call_t *);
     229extern 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 *);
     232extern void fat_lookup(ipc_callid_t, ipc_call_t *);
     233extern void fat_read(ipc_callid_t, ipc_call_t *);
     234extern void fat_write(ipc_callid_t, ipc_call_t *);
     235extern void fat_truncate(ipc_callid_t, ipc_call_t *);
     236extern void fat_stat(ipc_callid_t, ipc_call_t *);
     237extern void fat_close(ipc_callid_t, ipc_call_t *);
     238extern void fat_destroy(ipc_callid_t, ipc_call_t *);
     239extern void fat_open_node(ipc_callid_t, ipc_call_t *);
     240extern void fat_stat(ipc_callid_t, ipc_call_t *);
     241extern void fat_sync(ipc_callid_t, ipc_call_t *);
     242
     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);
    256246extern void fat_idx_destroy(fat_idx_t *);
    257247extern void fat_idx_hashin(fat_idx_t *);
     
    260250extern int fat_idx_init(void);
    261251extern void fat_idx_fini(void);
    262 extern int fat_idx_init_by_service_id(service_id_t);
    263 extern void fat_idx_fini_by_service_id(service_id_t);
     252extern int fat_idx_init_by_devmap_handle(devmap_handle_t);
     253extern void fat_idx_fini_by_devmap_handle(devmap_handle_t);
    264254
    265255#endif
Note: See TracChangeset for help on using the changeset viewer.