21#define MINIX_MAGIC 0x137F
22#define MINIX_MAGIC2 0x138F
24#define MINIX2_MAGIC 0x2468
25#define MINIX2_MAGIC2 0x2478
27#define MINIX3_MAGIC 0x4D5A
29#define MINIX_DIRECT_ZONES 7
ssize_t minix_block_write(struct minix *desc, blk_t blk, void *buf)
Writes a block to the disk.
void minix_block_free(struct minix *desc, blk_t blk)
Frees a zone: its bit is cleared in the zone bitmap, which is written back at once,...
ssize_t minix_block_read(struct minix *desc, blk_t blk, void *buf)
Reads a block from the disk.
int minix_bcache_get(struct minix *desc, blk_t blk, void **data)
Gets a block from the block cache, reading it from the disk into the cache if it isn't there.
blk_t minix_block_alloc(struct minix *desc)
Allocates a free zone: its bit is set in the zone bitmap, which is written back to the disk at once.
uint32_t minix_dentry_find(struct minix *desc, struct minix_inode *m_inode, const char *name)
Finds the inode number of a name in a directory.
int minix_dentry_create(struct vnode *dir, const char *name, ino_t ino, mode_t mode)
Adds an entry to a directory, in its first free slot.
ssize_t minix_inode_block_write(struct minix *desc, struct minix_inode *inode, ino_t ino, size_t idx, void *buf)
Writes a zone of a file, allocating it and the indirect zones above it if they don't exist yet.
ssize_t minix_inode_block_read(struct minix *desc, struct minix_inode *m_inode, size_t idx, void *buf)
Reads a zone of a file.
int minix_inode_read(struct minix *desc, ino_t ino, struct minix_inode *ref)
Reads an inode from the disk.
int minix_inode_write(struct minix *desc, ino_t ino, struct minix_inode *ref)
Writes an inode to the disk.
void minix_zones_free(struct minix *desc, struct minix_inode *inode, size_t from)
Frees a file's zones, from a zone on, when the file is truncated or removed.
void minix_inode_free(struct minix *desc, ino_t ino)
Frees an inode: its bit is cleared in the inode bitmap, which is written back at once.
ino_t minix_inode_alloc(struct minix *desc)
Allocates a free inode: its bit is set in the inode bitmap, which is written back to the disk at once...
int minix_inode_build(struct minix *desc, ino_t ino, struct vnode **ref)
Gets the vnode of an inode: the cached one if it's in use, or a new one made from the inode on the di...
int minix_inode_sync(struct vnode *inode)
Writes a vnode's attributes back to its inode on the disk.
ssize_t minix_read(struct vnode *inode, off_t offset, struct iobuf *io)
Reads from a file.
int minix_vget(struct vnode *super, ino_t ino, struct vnode **ref)
Gets the vnode of an inode, by its number.
int minix_finddir(struct vnode *dir, const char *fn, struct dirent *dirent)
Finds the entry of a directory that has a name.
void minix_superblock_rewrite(struct minix *desc)
Writes the in-memory copy of the superblock back to the disk.
int minix_trunc(struct vnode *inode, off_t len)
Changes a file's length.
ssize_t minix_readdir(struct vnode *dir, off_t offset, struct dirent *dirent)
Reads a directory's entry at an offset; unused entries don't count.
int minix_vmknod(struct vnode *dir, const char *fn, mode_t mode, dev_t dev, struct uio *uio, struct vnode **ref)
Makes a node in a directory: a new inode, and an entry for it.
ssize_t minix_write(struct vnode *inode, off_t offset, struct iobuf *io)
Writes to a file, which grows if the write goes past its end.
unsigned short int uint16_t
A bitmap: its blocks, and its last bit's index.
A device driver: its operations, any of which may be NULL.
The superblock of minix v3, as it is on the disk (not supported).
A directory entry, as it is on the disk: 0 as the inode number is an unused entry.
A minix v1 inode, as it is on the disk.
The superblock of minix v1 and v2, as it is on the disk.
A mounted minix filesystem.
struct minix_superblock * superblock
Who does a filesystem operation: where its paths start, and its credentials and umask.
A file in memory (a vnode): what its inode says, and the kernel's own state.