Welcome! Log In Create A New Profile


Learning kernel hacking, filesystems and user squashed ext4

Posted by John Allsup 
Learning kernel hacking, filesystems and user squashed ext4
February 15, 2015 10:54PM

I'm new here, though have been dablling with Linux since Slackware came on a covercd back in 1995/1996.

I've finally decided to try to get into kernel hacking. I'll look for tutorials etc, but there is one itch I'd like to scratch, and was wondering whether anybody could advise me.

One thing I like about external hard drives using NTFS is that I can specify a uid/gid that all files will get. Other than that I'd rather use ext4. The trouble is that ext4 insists upon using the owner/group data stored in the filesystem. What I'd like to do is to modify ext4 to produce a new driver (ext4jda) so that
mount -o uid=1000,gid=1000 -t ext4jda /dev/sdc1 /mnt/a
would mount the drive (at /mnt/a in this example) with the following modified behaviour.

1. All file creation causes the file to be created with the uid/gid given in the options
2. All file accesses see file permissions as given in the options.

I imagine this would be easy to hack, but the first thing I need to know is how to fork the ext4 code and get the resulting fork to build. Once I can get an ext4jda module that builds and behaves identically to the original ext4 driver, I'd be happy to poke around in the source on my own for now and figure out how it works.

Please understand that this is the use case I want, and that at present I am prepared to either use NTFS (ugly) or else have a setuid root program that chmod/chown -R's the whole filesystem (pehaps even more ugly) and I want a simple elegant solution. (The use case basically involves external hard drives that, when mounted, I want to map entirely to the user who mounted it, but otherwise want a linux filesystem rather than a DOS or Windows one). Please also understand that this is effectively a motivation to learn kernel hacking, and I just want to see how this is done for the sake of it. (Workarounds like chown/chmod -R and ntfs do not interest me).

Does anybody have any advice they can give?
Re: Learning kernel hacking, filesystems and user squashed ext4
February 17, 2015 05:25AM
And as a simpler request, if I start with the kernel source as downloaded, what is the minimum necessary to fork a pre-existing filesystem driver to produce a new one so that the result will compile?

Your Email:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 15 plus 11?