[Merge] lp:~jamesodhunt/upstart/check-for-overlayfs into lp:upstart

Steve Langasek steve.langasek at canonical.com
Mon Nov 4 01:14:30 UTC 2013


Since we're checking the type of a single mountpoint, we should be able to use statfs instead of walking around in /proc/self/mounts.  E.g.:

        struct statfs statbuf;

        /* Create a file in the temporary work area */
        TEST_FILENAME (path);
        fclose (fopen (path, "w"));

        assert0 (statfs (path, &statbuf));

        if (statbuf.f_type == OVERLAYFS_SUPER_MAGIC) {
                nih_warn ("Mountpoint for '%s' (needed by the Upstart tests) is an overlayfs "
                                        "filesystem, which does not support inotify.",
                                        path);
                found = TRUE;
        }

        assert0 (unlink (path));

        return found;

It seems that the linux-kernel-headers package does not currently export a define for OVERLAYFS_SUPER_MAGIC, which is an oversight.  We can copy this define from the kernel source for now, since it shouldn't change, and ask the kernel team to have it properly exported.

#define OVERLAYFS_SUPER_MAGIC 0x794c764f

What do you think of this approach?
-- 
https://code.launchpad.net/~jamesodhunt/upstart/check-for-overlayfs/+merge/191393
Your team Upstart Reviewers is subscribed to branch lp:upstart.



More information about the upstart-devel mailing list