diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2023-04-30 18:44:29 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2023-04-30 18:44:29 +0000 |
commit | d24b5a7a0e45186f13d19ddefde62b0932726e42 (patch) | |
tree | a3cfeee8dd915bbd60e9f6be96c7318f81e1dfd1 /sys/src/cmd/dossrv/iotrack.h | |
parent | 101b3c2724779fcb0e503ae274abd7b751a3a48f (diff) |
dossrv: Implement support for != 512 sector and track sizes
The iotrack buffer layer always assumed 512 byte sector
size and 9 sectors per track.
To support 4K sector size fats, make the iotrack code
deal with it.
Instead of the fixed size Track structure, we just allocate
the pointers and buffers dynamically, and move the sector
size and tack size in the Xfs structure.
Tracks can still be reused between differnet file-systems
after a purgetrack().
The initial fat header has to be read with devread()
instead of getsect() to determine the sector/track size
of the file-system.
Diffstat (limited to 'sys/src/cmd/dossrv/iotrack.h')
-rw-r--r-- | sys/src/cmd/dossrv/iotrack.h | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/sys/src/cmd/dossrv/iotrack.h b/sys/src/cmd/dossrv/iotrack.h index 921a75c3f..098677ab2 100644 --- a/sys/src/cmd/dossrv/iotrack.h +++ b/sys/src/cmd/dossrv/iotrack.h @@ -1,7 +1,6 @@ typedef struct MLock MLock; typedef struct Iosect Iosect; typedef struct Iotrack Iotrack; -typedef struct Track Track; typedef struct Xfs Xfs; struct MLock @@ -29,41 +28,23 @@ struct Iotrack Iotrack *hprev; MLock lock; int ref; - Track *tp; -}; - -enum{ - Sectorsize = 512, - Sect2trk = 9, - Trksize = Sectorsize*Sect2trk -}; - -struct Track -{ - Iosect *p[Sect2trk]; - uchar buf[Sect2trk][Sectorsize]; + Iosect **tp; }; #define BMOD (1<<0) #define BIMM (1<<1) #define BSTALE (1<<2) -Iosect* getiosect(Xfs*, vlong, int); Iosect* getosect(Xfs*, vlong); Iosect* getsect(Xfs*, vlong); -Iosect* newsect(void); -Iotrack* getiotrack(Xfs*, vlong); int canmlock(MLock*); -int devcheck(Xfs*); int devread(Xfs*, vlong, void*, long); int devwrite(Xfs*, vlong, void*, long); int tread(Iotrack*); int twrite(Iotrack*); -void freesect(Iosect*); void iotrack_init(void); void mlock(MLock*); void purgebuf(Xfs*); -void purgetrack(Iotrack*); void putsect(Iosect*); void sync(void); void unmlock(MLock*); |