Linux: get low-level file structure information in userspace using C
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Linux: get low-level file structure information in userspace using C
Hi,
Is anyone aware if there is a way to get low-level file structure information available in userspace C using system calls or whatever? Or is this info only available in kernel mode using a module?
What I would like to do is get a list of all block pointers back from the inode.
Second to that: is it possible to see which block was written to disk last?
errm, that's a pretty roundabout way of doing it...
stat() and fstatat() are better choices.
man 2 stat
man 2 fstatat
Thanks, but this does not give back the details I am looking for. I would really like to get an insight of all blocks contained in a file, and if possible a way to check when they are written (either on-the-fly or using some time stamps I did not discover yet).
If you really need more detail than stat() returns (unlikely, in my opinion, unless you're writing a low-level file system utility) then check out the source for fsck.
If you really need more detail than stat() returns (unlikely, in my opinion, unless you're writing a low-level file system utility) then check out the source for fsck.
Yeah it's a bit academic at the moment but I need it to implement some of the ideas I have on some new storage routines I was thinking of...
Thank you for the suggestion, I will look into that!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.