]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/dossrv/iotrack.h
Libflac: Tell it that we have stdint.h so it finds SIZE_MAX
[plan9front.git] / sys / src / cmd / dossrv / iotrack.h
1 typedef struct MLock    MLock;
2 typedef struct Iosect   Iosect;
3 typedef struct Iotrack  Iotrack;
4 typedef struct Track    Track;
5 typedef struct Xfs      Xfs;
6
7 struct MLock
8 {
9         char    key;
10 };
11
12 struct Iosect
13 {
14         Iosect *next;
15         short   flags;
16         MLock   lock;
17         Iotrack *t;
18         uchar * iobuf;
19 };
20
21 struct Iotrack
22 {
23         short   flags;
24         Xfs *   xf;
25         vlong   addr;
26         Iotrack *next;          /* in lru list */
27         Iotrack *prev;
28         Iotrack *hnext;         /* in hash list */
29         Iotrack *hprev;
30         MLock   lock;
31         int     ref;
32         Track   *tp;
33 };
34
35 enum{
36         Sectorsize = 512,
37         Sect2trk = 9,
38         Trksize = Sectorsize*Sect2trk
39 };
40
41 struct Track
42 {
43         Iosect *p[Sect2trk];
44         uchar   buf[Sect2trk][Sectorsize];
45 };
46
47 #define BMOD            (1<<0)
48 #define BIMM            (1<<1)
49 #define BSTALE          (1<<2)
50
51 Iosect* getiosect(Xfs*, vlong, int);
52 Iosect* getosect(Xfs*, vlong);
53 Iosect* getsect(Xfs*, vlong);
54 Iosect* newsect(void);
55 Iotrack*        getiotrack(Xfs*, vlong);
56 int     canmlock(MLock*);
57 int     devcheck(Xfs*);
58 int     devread(Xfs*, vlong, void*, long);
59 int     devwrite(Xfs*, vlong, void*, long);
60 int     tread(Iotrack*);
61 int     twrite(Iotrack*);
62 void    freesect(Iosect*);
63 void    iotrack_init(void);
64 void    mlock(MLock*);
65 void    purgebuf(Xfs*);
66 void    purgetrack(Iotrack*);
67 void    putsect(Iosect*);
68 void    sync(void);
69 void    unmlock(MLock*);