3.2 KiB
After our initial dig
After getting all of that understood, we can continue our journey, starting with what looks like it's the most reasonable file:
ext2fs_extern.h
Immidiately we find a lot of structs, an inode pool and declarations of some functions from line 57 onwards that interest us.
Turns out this is the entire list of functions we have defined and where we will put what we have yet to define.
/* ext2fs_alloc.c */
int ext2fs_alloc(struct inode *, u_int32_t, u_int32_t , struct ucred *,
u_int32_t *);
int ext2fs_inode_alloc(struct inode *, mode_t mode, struct ucred *,
struct vnode **);
daddr_t ext2fs_blkpref(struct inode *, u_int32_t, int, u_int32_t *);
void ext2fs_blkfree(struct inode *, u_int32_t);
void ext2fs_inode_free(struct inode *, ufsino_t, mode_t);
Here we have allocations and removals. This is definitely something to do with writing, so we can skip over this for now. We don't care about that. Skip to line 83.
/* ext2fs_lookup.c */
int ext2fs_readdir(void *);
int ext2fs_lookup(void *);
int ext2fs_direnter(struct inode *, struct vnode *, struct componentname *);
int ext2fs_dirremove(struct vnode *, struct componentname *);
int ext2fs_dirrewrite(struct inode *, struct inode *, struct componentname *);
int ext2fs_dirempty(struct inode *, ufsino_t, struct ucred *);
int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *);
This looks a little bit more relevant, but it's not very likely to be the chief focus for implementing 64-bit mode, or the checksum seed. So, let's keep going.
/* ext2fs_vfsops.c */
int ext2fs_mountroot(void);
int ext2fs_mount(struct mount *, const char *, void *, struct nameidata *,
struct proc *);
int ext2fs_reload(struct mount *, struct ucred *, struct proc *);
int ext2fs_mountfs(struct vnode *, struct mount *, struct proc *);
int ext2fs_unmount(struct mount *, int, struct proc *);
int ext2fs_flushfiles(struct mount *, int, struct proc *);
int ext2fs_statfs(struct mount *, struct statfs *, struct proc *);
int ext2fs_sync(struct mount *, int, int, struct ucred *, struct proc *);
int ext2fs_vget(struct mount *, ino_t, struct vnode **);
int ext2fs_fhtovp(struct mount *, struct fid *, struct vnode **);
int ext2fs_vptofh(struct vnode *, struct fid *);
int ext2fs_sbupdate(struct ufsmount *, int);
int ext2fs_cgupdate(struct ufsmount *, int);
int ext2fs_sysctl(int *, u_int, void *, size_t *, void *, size_t,
struct proc *);
Here we have some information regarding mounts. Obviously, this is the first thing we need to implement. We can try to mount a 64-bit filesystem successfully and having errors on every read first, and then slowly break our way out of that.
/* ext2fs_readwrite.c */
int ext2fs_read(void *);
int ext2fs_write(void *);
Just check for r/w, looks useful but we won't be using it until 64-bit is properly implemented. Judging by my guesses, if we implement mount correctly, reading and writing should not change for read only mode.
For the rest of the file, we don't have any other useful declarations; just touch
, ls
, ln
, rm
, etc implementations. We won't need to modify these too much yet, so let's move on.
I guess then, our second dive starts in ext2fs_vfsops.c
. It's around 1142 lines, so let's read it in the next chapter.