static void v9fs_open_post_lstat(V9fsState *s, V9fsOpenState *vs, int err)

{

    int flags;



    if (err) {

        err = -errno;

        goto out;

    }



    stat_to_qid(&vs->stbuf, &vs->qid);



    if (S_ISDIR(vs->stbuf.st_mode)) {

        vs->fidp->fs.dir = v9fs_do_opendir(s, &vs->fidp->path);

        v9fs_open_post_opendir(s, vs, err);

    } else {

        if (s->proto_version == V9FS_PROTO_2000L) {

            if (!valid_flags(vs->mode)) {

                err = -EINVAL;

                goto out;

            }

            flags = vs->mode;

        } else {

            flags = omode_to_uflags(vs->mode);

        }

        vs->fidp->fs.fd = v9fs_do_open(s, &vs->fidp->path, flags);

        v9fs_open_post_open(s, vs, err);

    }

    return;

out:

    complete_pdu(s, vs->pdu, err);

    qemu_free(vs);

}

static void v9fs_open_post_lstat(V9fsState *s, V9fsOpenState *vs, int err)

{

    int flags;



    if (err) {

        err = -errno;

        goto out;

    }



    stat_to_qid(&vs->stbuf, &vs->qid);



    if (S_ISDIR(vs->stbuf.st_mode)) {

        vs->fidp->fs.dir = v9fs_do_opendir(s, &vs->fidp->path);

        v9fs_open_post_opendir(s, vs, err);

    } else {

        if (s->proto_version == V9FS_PROTO_2000L) {

            if (!valid_flags(vs->mode)) {

                err = -EINVAL;

                goto out;

            }

            flags = vs->mode;

        } else {

            flags = omode_to_uflags(vs->mode);

        }

        vs->fidp->fs.fd = v9fs_do_open(s, &vs->fidp->path, flags);

        v9fs_open_post_open(s, vs, err);

    }

    return;

out:

    complete_pdu(s, vs->pdu, err);

    qemu_free(vs);

}

static void FUNC_0(V9fsState *VAR_0, V9fsOpenState *VAR_1, int VAR_2)

{

    int VAR_3;



    if (VAR_2) {

        VAR_2 = -errno;

        goto out;

    }



    stat_to_qid(&VAR_1->stbuf, &VAR_1->qid);



    if (S_ISDIR(VAR_1->stbuf.st_mode)) {

        VAR_1->fidp->fs.dir = v9fs_do_opendir(VAR_0, &VAR_1->fidp->path);

        v9fs_open_post_opendir(VAR_0, VAR_1, VAR_2);

    } else {

        if (VAR_0->proto_version == V9FS_PROTO_2000L) {

            if (!valid_flags(VAR_1->mode)) {

                VAR_2 = -EINVAL;

                goto out;

            }

            VAR_3 = VAR_1->mode;

        } else {

            VAR_3 = omode_to_uflags(VAR_1->mode);

        }

        VAR_1->fidp->fs.fd = v9fs_do_open(VAR_0, &VAR_1->fidp->path, VAR_3);

        v9fs_open_post_open(VAR_0, VAR_1, VAR_2);

    }

    return;

out:

    complete_pdu(VAR_0, VAR_1->pdu, VAR_2);

    qemu_free(VAR_1);

}

static void FUNC_0(V9fsState *VAR_0, V9fsOpenState *VAR_1, int VAR_2)
{ int VAR_3; if (VAR_2) { VAR_2 = -errno; goto out; } stat_to_qid(&VAR_1->stbuf, &VAR_1->qid); if (S_ISDIR(VAR_1->stbuf.st_mode)) { VAR_1->fidp->fs.dir = v9fs_do_opendir(VAR_0, &VAR_1->fidp->path); v9fs_open_post_opendir(VAR_0, VAR_1, VAR_2); } else { if (VAR_0->proto_version == V9FS_PROTO_2000L) { if (!valid_flags(VAR_1->mode)) { VAR_2 = -EINVAL; goto out; } VAR_3 = VAR_1->mode; } else { VAR_3 = omode_to_uflags(VAR_1->mode); } VAR_1->fidp->fs.fd = v9fs_do_open(VAR_0, &VAR_1->fidp->path, VAR_3); v9fs_open_post_open(VAR_0, VAR_1, VAR_2); } return; out:
complete_pdu(VAR_0, VAR_1->pdu, VAR_2); qemu_free(VAR_1); }