On Sat, Jan 22, 2011 at 01:53:40AM +0100, Pavel Sanda wrote:

> this patch should help at least for symlinks.

Why not restricting the workaround to the case where the file actually
is stored on an ext4 file system?

We could introduce a fileName().isOnExt4() method for that purpose.
See the attached example. I am sure that it has to be tailored to
a given platform, but it should be doable. For example, looking at
the Qt sources, we could model that method on the lines of the
isLikelyToBeNfs() method in src/corelib/io/qsettings.cpp.

-- 
Enrico
#include <stdio.h>
#include <stdlib.h>
#include <sys/vfs.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int ac, char **av)
{
    struct statfs buf;

    if (ac != 2)
        return 0;

    int fd = open(av[1], O_RDONLY);

    if (fd < 0) {
        printf("cannot open %s\n", av[1]);
        exit(1);
    }

    if (fstatfs(fd, &buf) != 0) {
        printf("fstatfs failed on %s\n", av[1]);
        exit(1);
    }

    printf("0x%08x\n", buf.f_type);
    return 0;
}

Reply via email to