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 the struct wait_queue in favor of a wait_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 initialize wait_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 change current->signal.sig[i] to current->pending.signal.sig[i]. Apparently they decided they needed an extra layer of abstraction.
  • in module/super.h:
    Apparently struct super_operations has ditched the notify_change member. This is fine with me, since ltfs_notify_change was an empty function anyway.
  • in module/ku_if.h:
    Apparently the struct 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 the owner field which is of type struct module*. I'm curious as to what this is used for, but I've discovered the convenient macro THIS_MODULE and thus I won't be concerning myself with this.
  • in module/super.h:
    It seems that the write_inode member of struct super_operations has a new prototype. Instead of just taking a struct inode* as an argument, it now also takes an int 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 was NULL, so I just ditched the NULL and will hope that that works...
  • in module/super.c:
    the prototype for the statfs member of super_operations has changed. Seeing that ltfs_statfs is currently an empty function, this doesn't affect me ...
  • in module/super.c:
    they've gotten rid of such things as chrdev_inode_operations and blkdev_inode_operations. Instead, there's now a function init_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 to init_special_inode is int 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 for filldir seems to have changed, they've added an unsigned 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 pass DT_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 that lookup_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 this ltfs_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!
unrelatedely, it seems that with recent binutils (at least in debian), the assembler generates some interesting warnings when compiling modules: "Warning: Ignoring changed section attributes for .modinfo" ... preliminary research indicates I can hopefully ignore those messages for the time being. More info at http://lists.insecure.org/linux-kernel/2000/Nov/0068.html or at your favorite kernel mailing list mirror.