Hao
Hao

Reputation: 153

get linux file system information via kernel function

I have to write a linux module and I can't find a proper function to list all mounted file system and their information. I know command "df -T" can achieve this and sadly I can't use that. Is there a kernel function that can do this or other way?

Upvotes: 1

Views: 748

Answers (2)

user3629249
user3629249

Reputation: 16550

Your code could open/read the /proc/mounts file, line by line. It contains everything that is mounted, including many mount points that you would not expect.

In general, the format is the same as the /etc/fstab file, but will also include all the mounts that the OS adds.

Upvotes: 0

Milind Dumbare
Milind Dumbare

Reputation: 3244

Why not see the kernel code which fills /proc/mounts

mountstats_open() in base.c

refer get filesystem mount point in kernel module

Upvotes: 1

Related Questions