static void local_mapped_file_attr(int dirfd, const char *name,

                                   struct stat *stbuf)

{

    FILE *fp;

    char buf[ATTR_MAX];

    int map_dirfd;



    map_dirfd = openat(dirfd, VIRTFS_META_DIR,

                       O_RDONLY | O_DIRECTORY | O_NOFOLLOW);

    if (map_dirfd == -1) {

        return;

    }



    fp = local_fopenat(map_dirfd, name, "r");

    close_preserve_errno(map_dirfd);

    if (!fp) {

        return;

    }

    memset(buf, 0, ATTR_MAX);

    while (fgets(buf, ATTR_MAX, fp)) {

        if (!strncmp(buf, "virtfs.uid", 10)) {

            stbuf->st_uid = atoi(buf+11);

        } else if (!strncmp(buf, "virtfs.gid", 10)) {

            stbuf->st_gid = atoi(buf+11);

        } else if (!strncmp(buf, "virtfs.mode", 11)) {

            stbuf->st_mode = atoi(buf+12);

        } else if (!strncmp(buf, "virtfs.rdev", 11)) {

            stbuf->st_rdev = atoi(buf+12);

        }

        memset(buf, 0, ATTR_MAX);

    }

    fclose(fp);

}

static void local_mapped_file_attr(int dirfd, const char *name,

                                   struct stat *stbuf)

{

    FILE *fp;

    char buf[ATTR_MAX];

    int map_dirfd;



    map_dirfd = openat(dirfd, VIRTFS_META_DIR,

                       O_RDONLY | O_DIRECTORY | O_NOFOLLOW);

    if (map_dirfd == -1) {

        return;

    }



    fp = local_fopenat(map_dirfd, name, "r");

    close_preserve_errno(map_dirfd);

    if (!fp) {

        return;

    }

    memset(buf, 0, ATTR_MAX);

    while (fgets(buf, ATTR_MAX, fp)) {

        if (!strncmp(buf, "virtfs.uid", 10)) {

            stbuf->st_uid = atoi(buf+11);

        } else if (!strncmp(buf, "virtfs.gid", 10)) {

            stbuf->st_gid = atoi(buf+11);

        } else if (!strncmp(buf, "virtfs.mode", 11)) {

            stbuf->st_mode = atoi(buf+12);

        } else if (!strncmp(buf, "virtfs.rdev", 11)) {

            stbuf->st_rdev = atoi(buf+12);

        }

        memset(buf, 0, ATTR_MAX);

    }

    fclose(fp);

}

    map_dirfd = openat(dirfd, VIRTFS_META_DIR,                        O_RDONLY | O_DIRECTORY | O_NOFOLLOW);
static void FUNC_0(int VAR_0, const char *VAR_1,

                                   struct stat *VAR_2)

{

    FILE *fp;

    char VAR_3[ATTR_MAX];

    int VAR_4;



    VAR_4 = openat(VAR_0, VIRTFS_META_DIR,

                       O_RDONLY | O_DIRECTORY | O_NOFOLLOW);

    if (VAR_4 == -1) {

        return;

    }



    fp = local_fopenat(VAR_4, VAR_1, "r");

    close_preserve_errno(VAR_4);

    if (!fp) {

        return;

    }

    memset(VAR_3, 0, ATTR_MAX);

    while (fgets(VAR_3, ATTR_MAX, fp)) {

        if (!strncmp(VAR_3, "virtfs.uid", 10)) {

            VAR_2->st_uid = atoi(VAR_3+11);

        } else if (!strncmp(VAR_3, "virtfs.gid", 10)) {

            VAR_2->st_gid = atoi(VAR_3+11);

        } else if (!strncmp(VAR_3, "virtfs.mode", 11)) {

            VAR_2->st_mode = atoi(VAR_3+12);

        } else if (!strncmp(VAR_3, "virtfs.rdev", 11)) {

            VAR_2->st_rdev = atoi(VAR_3+12);

        }

        memset(VAR_3, 0, ATTR_MAX);

    }

    fclose(fp);

}

static void FUNC_0(int VAR_0, const char *VAR_1,
struct stat *VAR_2)
{ FILE *fp; char VAR_3[ATTR_MAX]; int VAR_4; VAR_4 = openat(VAR_0, VIRTFS_META_DIR,
O_RDONLY | O_DIRECTORY | O_NOFOLLOW); if (VAR_4 == -1) { return; } fp = local_fopenat(VAR_4, VAR_1, "r"); close_preserve_errno(VAR_4); if (!fp) { return; } memset(VAR_3, 0, ATTR_MAX); while (fgets(VAR_3, ATTR_MAX, fp)) { if (!strncmp(VAR_3, "virtfs.uid", 10)) { VAR_2->st_uid = atoi(VAR_3+11); } else if (!strncmp(VAR_3, "virtfs.gid", 10)) { VAR_2->st_gid = atoi(VAR_3+11); } else if (!strncmp(VAR_3, "virtfs.mode", 11)) { VAR_2->st_mode = atoi(VAR_3+12); } else if (!strncmp(VAR_3, "virtfs.rdev", 11)) { VAR_2->st_rdev = atoi(VAR_3+12); } memset(VAR_3, 0, ATTR_MAX); } fclose(fp); }