Linux – Does Linux have system calls to access all the features of the file systems it supports

filesystemslinux

Linux supports many file systems (for example: ext3, NTFS, FAT32, etc.).

The following diagram shows how Linux allows a process to access files:

enter image description here

So assume that a process called the read() system call to read a file, what will happen is that the VFS layer will be accessed, and the VFS layer will decide which file system driver to access based on the file system of the partition that the file to be read resides on.

Linux provides many system calls to access files (for example: read(), write(), rename(), etc.).

Now read() and write() and rename() work on all the file systems that Linux supports.

But there are specific features that exist only on some file systems while not existing on others. For example: on a NTFS file system, you can set the Archive bit for a file, while this can't be done on an ext3 file system.

Now my question is, does Linux have system calls to access all the features of the file systems it supports? for example: does Linux have a system call to set the Archive bit for a file on a NTFS file system?

Best Answer

does Linux have a system call to set the Archive bit for a file on a NTFS file system?

For this particular case, the ntfs-3g driver exports the file attributes via extended attributes, see Can I set the "Archive" bit on a file on NTFS on Linux?

The (V)FAT file system has the similar file attributes, but it uses an ioctl() function to access them, see ioctl_fat(2). (ioctl() is a sort of a multipurpose system call, used for all kinds of device specific stuff that don't warrant a real system call.)

Now my question is, does Linux have system calls to access all the features of the file systems it supports?

It's hard to answer for sure, but there has been at least one example of the opposite. ext4 internally supports a "birth time" timestamp for files (like, a real creation time, unlike ctime that changes on inode modification). But even though ext4 is the "standard" filesystem, for a long time, there was no system call to access the birth time.

It should be supported now, with the statx() system call added in Linux 4.11, in April 2017.

Related:

Related Question