(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. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/817326 Title: [Upstream] Previously-saved LibreOffice document lost by power outage (became 0 bytes long) - LibreOffice should call fsync To manage notifications about this bug go to: https://bugs.launchpad.net/df-libreoffice/+bug/817326/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs