Pete's Log: ltfs port-o-rama
Entry #871, (Coding, Hacking, & CS stuff)(posted when I was 22 years old.)
So I'm trying to get LTFS to compile under the 2.4 kernel. This is proving to be nontrivial. I've decided to take notes on where I'm making changes in my code and why:
- in most of my code:
it seems they've gotten rid of thestruct wait_queue
in favor of await_queue_head_t
. This affects various variables and how I initialize them.struct wait_queue*
's got initialized to NULL. You need to use a special macro to initializewait_queue_head_t
's. I'll need to make sure I properly initialize all of these guys, because I had an evil bug a long time ago when I didn't properly initialize one of these... this also affects semaphore initialization, since they contains waitqs... - in
module/module.h
:
Had to changecurrent->signal.sig[i]
tocurrent->pending.signal.sig[i]
. Apparently they decided they needed an extra layer of abstraction. - in
module/super.h
:
Apparentlystruct super_operations
has ditched thenotify_change
member. This is fine with me, sinceltfs_notify_change
was an empty function anyway. - in
module/ku_if.h
:
Apparently thestruct file_operations
that is used by device drivers to indicate what functions are applicable to their device nodes has changed a bit. Most notable, to me at least, seems the addition of theowner
field which is of typestruct module*
. I'm curious as to what this is used for, but I've discovered the convenient macroTHIS_MODULE
and thus I won't be concerning myself with this. - in
module/super.h
:
It seems that thewrite_inode
member ofstruct super_operations
has a new prototype. Instead of just taking astruct inode*
as an argument, it now also takes anint
argument. I'll need to investigate what that's for, I just changed my prototype to get it to compile, but never use that int. - in
module/super.c
:
d_alloc_root
now only takes one argument instead of two. But the second argument I used to pass it wasNULL
, so I just ditched theNULL
and will hope that that works... - in
module/super.c
:
the prototype for thestatfs
member ofsuper_operations
has changed. Seeing thatltfs_statfs
is currently an empty function, this doesn't affect me ... - in
module/super.c
:
they've gotten rid of such things aschrdev_inode_operations
andblkdev_inode_operations
. Instead, there's now a functioninit_special_inode
, which is actually quite nice as it eliminates some common code out of all the filesystems. So I'll use it in mine, too! The only problem is that the third argument toinit_special_inode
isint rdev
, and ltfs filesystems tend to not have devices associated with them, so I'm not quite sure what to pass for that. So for now I'm going with 0. - in
module/file.c
:
so the prototype forfilldir
seems to have changed, they've added anunsigned int
argument d_type, which apparently is supposed to be used to pass the file type back to the kernel. This means adding a bit of extra code to figure this bit out, so for the time being, I'm just gonna passDT_UNKNOWN
. That looks like what ext2 is doing. If they wanna know what kinda file it is, they can use stat, just like everyone else! - in
module/inode.c
:
it seems thatlookup_dentry
is no longer defined. The fun thing is this is used in symlink code, which is funny, since I don't remember ever implementing symlinks. But I'm beginning to vaguely recall having them working, which means I was cooler than I thought. I'm not sure how to fix this right now. So I'll label thisltfs_follow_link
as broken for now. I just want LTFS to compile... - in
module/request.c
:
oh, god. request.c generates dozens of errors. I think I'm gonna call it a night!