Skip to content
Advertisement

Linux filesystem nesting and syscall hooking

Using 2.6.32 linux kernel, I need to use a specific filesystem on a block device partition and I wan’t to hook open/write/read/close (and few others) syscalls to read/write, in an other fashion that the specific filesystem, what should be written on this partition.

It would be only for this partition, others partitions using this filesystem would act as usual.

Fuse would have been perfect for this but I can’t use it because of the memory consumption (too large for the targeted system)

How could I hook syscalls between VFS and the mounted filesystem, for, e.g. having an intermediate index and buffering all the read / write ?

I tried stuff like that :

mount -t ext3 /dev/sda1 /my/mount/data
mkfs.vfat /my/mount/data/big_file
mount -o loop -t vfat /my/mount/data/big_file /my_mount/custom_data

where vfat would be my custom filesystem, but debug shows that vfat is never referencing to jfs files operations where there is file operation that are done inside custom_data mount.

Any hints on how I should proceed ?

Advertisement

Answer

I discovered the stackable file system. Wrapfs is interesting and should fit my needs : http://wrapfs.filesystems.org/

It allows to catch, in an intermediate layer between vfs and the lower fs, all the system calls.

Solve.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement