https://bugs.freedesktop.org/show_bug.cgi?id=40607

--- Comment #14 from Tristan Schmelcher 
<[email protected]> 2012-01-09 07:38:56 PST ---
(In reply to comment #13)
> If some
> enterprising kernel hacker wants to create a nice, ultra-liberally licensed
> library that turns a dev_t into a boolean: int is_it_safe_to_fsync (dev_t *t);
> then I'd be more than happy to see it used un-conditionally in our
> system-abstraction for Unix / Linux.

I was actually looking into that recently as part of another project and it's
pretty easy. Basically,

1) Stat the file to get the st_dev.
2) Stat each file in /dev/disk/by-uuid to find one with a matching st_rdev.
3) Run realpath() on that file. Now you have the device file holding the
filesystem.

>From there you can easily look up the filesystem type in many places, e.g.
/etc/mtab, /proc/fs, or /sys/fs. Probably /etc/mtab is your best bet since it
is a generic UNIX thing.

On non-Linux or on Linux without udev you could fall back to stat'ing each file
in /dev rather than /dev/disk/by-uuid.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to