summaryrefslogtreecommitdiff
path: root/core/include/fs.h
blob: ca4e281ab66631b3b5a2dbbfb467c35c582381f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef FS_H
#define FS_H

#include <stddef.h>
#include <stdbool.h>
#include <com32.h>
#include "core.h"
#include "disk.h"

struct fs_info {
    char *fs_name;
    struct fs_ops *fs_ops;
    struct device *fs_dev;
};

struct file {
    void*    open_file; /* points to the fs-specific open_file_t */
    struct   fs_info *fs;
    uint32_t file_len;
};


struct fs_ops {
    /* in fact, we use fs_ops structure to find the right fs */
    char *fs_name;
    
    int      (*fs_init)(struct fs_info *);
    void     (*searchdir)(char *, struct file *);
    uint32_t (*getfssec)(struct fs_info *, char *, void * , int, int *);
    void     (*mangle_name)(char *, char *);
    int      (*unmangle_name)(char *, char *);
    void     (*load_config)(com32sys_t *);
};

enum dev_type {CHS, EDD};
    
/*
 * Struct device contains:
 *     the pointer points to the disk structure,
 *     the cache stuff.
 */
struct device {
    struct disk *disk;

    /* the cache stuff */
    char* cache_data;
    void* cache_head;
    uint16_t cache_block_size;
    uint16_t cache_entries;
    uint32_t cache_size;
};

#endif /* FS_H */