static int proxy_opendir(FsContext *ctx,

                         V9fsPath *fs_path, V9fsFidOpenState *fs)

{

    int serrno, fd;



    fs->dir = NULL;

    fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, O_DIRECTORY);

    if (fd < 0) {

        errno = -fd;

        return -1;

    }

    fs->dir = fdopendir(fd);

    if (!fs->dir) {

        serrno = errno;

        close(fd);

        errno = serrno;

        return -1;

    }

    return 0;

}

static int proxy_opendir(FsContext *ctx,

                         V9fsPath *fs_path, V9fsFidOpenState *fs)

{

    int serrno, fd;



    fs->dir = NULL;

    fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, O_DIRECTORY);

    if (fd < 0) {

        errno = -fd;

        return -1;

    }

    fs->dir = fdopendir(fd);

    if (!fs->dir) {

        serrno = errno;

        close(fd);

        errno = serrno;

        return -1;

    }

    return 0;

}

static int FUNC_0(FsContext *VAR_0,

                         V9fsPath *VAR_1, V9fsFidOpenState *VAR_2)

{

    int VAR_3, VAR_4;



    VAR_2->dir = NULL;

    VAR_4 = v9fs_request(VAR_0->private, T_OPEN, NULL, "sd", VAR_1, O_DIRECTORY);

    if (VAR_4 < 0) {

        errno = -VAR_4;

        return -1;

    }

    VAR_2->dir = fdopendir(VAR_4);

    if (!VAR_2->dir) {

        VAR_3 = errno;

        close(VAR_4);

        errno = VAR_3;

        return -1;

    }

    return 0;

}

static int FUNC_0(FsContext *VAR_0,
V9fsPath *VAR_1, V9fsFidOpenState *VAR_2)
{ int VAR_3, VAR_4; VAR_2->dir = NULL; VAR_4 = v9fs_request(VAR_0->private, T_OPEN, NULL, "sd", VAR_1, O_DIRECTORY); if (VAR_4 < 0) { errno = -VAR_4; return -1; } VAR_2->dir = fdopendir(VAR_4); if (!VAR_2->dir) { VAR_3 = errno; close(VAR_4); errno = VAR_3; return -1; } return 0; }