0


We are implementing a Filesystem using Python Fuse Library. We have implemented "Snapshot" feature (api) for this file system. We want to now call this snapshotting api, via a system call like (ls,mkdir,etc) - Snapshot? How do we create this new system call?

flowerpot
  • 519
  • 2
  • 7
  • 18

2 Answers2

1

Unfortunately, you can't just add a system call to FUSE, since FUSE relies on the kernel to do the heavy lifting of syscalls. You'll need to add it to the kernel.

On the other hand, are you sure you need a full blown system call, or can you implement what you need at the user level? (For instance, ls, i.e. readdir() is not actually a system call, it's a user level library routine which calls some other system calls, like getdents().)

If you just need to make a call available to all programs running on the system, add it into one of the standard libraries, or hack it in using LD_PRELOAD.

For adding system calls to the kernel, see here: http://www.csee.umbc.edu/courses/undergraduate/CMSC421/fall02/burt/projects/howto_add_systemcall.html

For the LD_PRELOAD approach, see here: What is the LD_PRELOAD trick?

Community
  • 1
  • 1
aleatha
  • 808
  • 5
  • 7
  • I had skipped overriding an existing call, I had assumed there was some reason you didn't want to go that route. Glad you got it working! – aleatha Aug 16 '13 at 12:45
1

IOCTL is the mechanism that is meant to implement custom operations that are filesystem-dependant. Btrfs implements cloning files, creating snapshots and send/receive through IOCTL.

ArekBulski
  • 4,520
  • 4
  • 39
  • 61