简体   繁体   中英

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?

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

mountstats_open() in base.c

refer get filesystem mount point in kernel module

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM