static void v9fs_create_post_lstat(V9fsState *s, V9fsCreateState *vs, int err)

{



    if (err == 0 || errno != ENOENT) {

        err = -errno;

        goto out;

    }



    if (vs->perm & P9_STAT_MODE_DIR) {

        err = v9fs_do_mkdir(s, vs);

        v9fs_create_post_mkdir(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_SYMLINK) {

        err = v9fs_do_symlink(s, vs);

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_LINK) {

        int32_t nfid = atoi(vs->extension.data);

        V9fsFidState *nfidp = lookup_fid(s, nfid);

        if (nfidp == NULL) {

            err = -errno;

            v9fs_post_create(s, vs, err);

        }

        err = v9fs_do_link(s, &nfidp->path, &vs->fullname);

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_DEVICE) {

        char ctype;

        uint32_t major, minor;

        mode_t nmode = 0;



        if (sscanf(vs->extension.data, "%c %u %u", &ctype, &major,

                                        &minor) != 3) {

            err = -errno;

            v9fs_post_create(s, vs, err);

        }



        switch (ctype) {

        case 'c':

            nmode = S_IFCHR;

            break;

        case 'b':

            nmode = S_IFBLK;

            break;

        default:

            err = -EIO;

            v9fs_post_create(s, vs, err);

        }



        nmode |= vs->perm & 0777;

        err = v9fs_do_mknod(s, vs, nmode, makedev(major, minor));

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_NAMED_PIPE) {

        err = v9fs_do_mknod(s, vs, S_IFIFO | (vs->perm & 0777), 0);

        v9fs_post_create(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_SOCKET) {

        err = v9fs_do_mksock(s, &vs->fullname);

        v9fs_create_post_mksock(s, vs, err);

    } else {

        vs->fidp->fd = v9fs_do_open2(s, vs);

        v9fs_create_post_open2(s, vs, err);

    }



    return;



out:

    v9fs_post_create(s, vs, err);

}

static void v9fs_create_post_lstat(V9fsState *s, V9fsCreateState *vs, int err)

{



    if (err == 0 || errno != ENOENT) {

        err = -errno;

        goto out;

    }



    if (vs->perm & P9_STAT_MODE_DIR) {

        err = v9fs_do_mkdir(s, vs);

        v9fs_create_post_mkdir(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_SYMLINK) {

        err = v9fs_do_symlink(s, vs);

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_LINK) {

        int32_t nfid = atoi(vs->extension.data);

        V9fsFidState *nfidp = lookup_fid(s, nfid);

        if (nfidp == NULL) {

            err = -errno;

            v9fs_post_create(s, vs, err);

        }

        err = v9fs_do_link(s, &nfidp->path, &vs->fullname);

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_DEVICE) {

        char ctype;

        uint32_t major, minor;

        mode_t nmode = 0;



        if (sscanf(vs->extension.data, "%c %u %u", &ctype, &major,

                                        &minor) != 3) {

            err = -errno;

            v9fs_post_create(s, vs, err);

        }



        switch (ctype) {

        case 'c':

            nmode = S_IFCHR;

            break;

        case 'b':

            nmode = S_IFBLK;

            break;

        default:

            err = -EIO;

            v9fs_post_create(s, vs, err);

        }



        nmode |= vs->perm & 0777;

        err = v9fs_do_mknod(s, vs, nmode, makedev(major, minor));

        v9fs_create_post_perms(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_NAMED_PIPE) {

        err = v9fs_do_mknod(s, vs, S_IFIFO | (vs->perm & 0777), 0);

        v9fs_post_create(s, vs, err);

    } else if (vs->perm & P9_STAT_MODE_SOCKET) {

        err = v9fs_do_mksock(s, &vs->fullname);

        v9fs_create_post_mksock(s, vs, err);

    } else {

        vs->fidp->fd = v9fs_do_open2(s, vs);

        v9fs_create_post_open2(s, vs, err);

    }



    return;



out:

    v9fs_post_create(s, vs, err);

}

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

{



    if (VAR_2 == 0 || errno != ENOENT) {

        VAR_2 = -errno;

        goto out;

    }



    if (VAR_1->perm & P9_STAT_MODE_DIR) {

        VAR_2 = v9fs_do_mkdir(VAR_0, VAR_1);

        v9fs_create_post_mkdir(VAR_0, VAR_1, VAR_2);

    } else if (VAR_1->perm & P9_STAT_MODE_SYMLINK) {

        VAR_2 = v9fs_do_symlink(VAR_0, VAR_1);

        v9fs_create_post_perms(VAR_0, VAR_1, VAR_2);

    } else if (VAR_1->perm & P9_STAT_MODE_LINK) {

        int32_t nfid = atoi(VAR_1->extension.data);

        V9fsFidState *nfidp = lookup_fid(VAR_0, nfid);

        if (nfidp == NULL) {

            VAR_2 = -errno;

            v9fs_post_create(VAR_0, VAR_1, VAR_2);

        }

        VAR_2 = v9fs_do_link(VAR_0, &nfidp->path, &VAR_1->fullname);

        v9fs_create_post_perms(VAR_0, VAR_1, VAR_2);

    } else if (VAR_1->perm & P9_STAT_MODE_DEVICE) {

        char VAR_3;

        uint32_t major, minor;

        mode_t nmode = 0;



        if (sscanf(VAR_1->extension.data, "%c %u %u", &VAR_3, &major,

                                        &minor) != 3) {

            VAR_2 = -errno;

            v9fs_post_create(VAR_0, VAR_1, VAR_2);

        }



        switch (VAR_3) {

        case 'c':

            nmode = S_IFCHR;

            break;

        case 'b':

            nmode = S_IFBLK;

            break;

        default:

            VAR_2 = -EIO;

            v9fs_post_create(VAR_0, VAR_1, VAR_2);

        }



        nmode |= VAR_1->perm & 0777;

        VAR_2 = v9fs_do_mknod(VAR_0, VAR_1, nmode, makedev(major, minor));

        v9fs_create_post_perms(VAR_0, VAR_1, VAR_2);

    } else if (VAR_1->perm & P9_STAT_MODE_NAMED_PIPE) {

        VAR_2 = v9fs_do_mknod(VAR_0, VAR_1, S_IFIFO | (VAR_1->perm & 0777), 0);

        v9fs_post_create(VAR_0, VAR_1, VAR_2);

    } else if (VAR_1->perm & P9_STAT_MODE_SOCKET) {

        VAR_2 = v9fs_do_mksock(VAR_0, &VAR_1->fullname);

        v9fs_create_post_mksock(VAR_0, VAR_1, VAR_2);

    } else {

        VAR_1->fidp->fd = v9fs_do_open2(VAR_0, VAR_1);

        v9fs_create_post_open2(VAR_0, VAR_1, VAR_2);

    }



    return;



out:

    v9fs_post_create(VAR_0, VAR_1, VAR_2);

}

static void FUNC_0(V9fsState *VAR_0, V9fsCreateState *VAR_1, int VAR_2)
{ if (VAR_2 == 0 || errno != ENOENT) { VAR_2 = -errno; goto out; } if (VAR_1->perm & P9_STAT_MODE_DIR) { VAR_2 = v9fs_do_mkdir(VAR_0, VAR_1); v9fs_create_post_mkdir(VAR_0, VAR_1, VAR_2); } else if (VAR_1->perm & P9_STAT_MODE_SYMLINK) { VAR_2 = v9fs_do_symlink(VAR_0, VAR_1); v9fs_create_post_perms(VAR_0, VAR_1, VAR_2); } else if (VAR_1->perm & P9_STAT_MODE_LINK) { int32_t nfid = atoi(VAR_1->extension.data); V9fsFidState *nfidp = lookup_fid(VAR_0, nfid); if (nfidp == NULL) { VAR_2 = -errno; v9fs_post_create(VAR_0, VAR_1, VAR_2); } VAR_2 = v9fs_do_link(VAR_0, &nfidp->path, &VAR_1->fullname); v9fs_create_post_perms(VAR_0, VAR_1, VAR_2); } else if (VAR_1->perm & P9_STAT_MODE_DEVICE) { char VAR_3; uint32_t major, minor; mode_t nmode = 0; if (sscanf(VAR_1->extension.data, "%c %u %u", &VAR_3, &major,
&minor) != 3) { VAR_2 = -errno; v9fs_post_create(VAR_0, VAR_1, VAR_2); } switch (VAR_3) { case 'c':
nmode = S_IFCHR; break; case 'b':
nmode = S_IFBLK; break; default:
VAR_2 = -EIO; v9fs_post_create(VAR_0, VAR_1, VAR_2); } nmode |= VAR_1->perm & 0777; VAR_2 = v9fs_do_mknod(VAR_0, VAR_1, nmode, makedev(major, minor)); v9fs_create_post_perms(VAR_0, VAR_1, VAR_2); } else if (VAR_1->perm & P9_STAT_MODE_NAMED_PIPE) { VAR_2 = v9fs_do_mknod(VAR_0, VAR_1, S_IFIFO | (VAR_1->perm & 0777), 0); v9fs_post_create(VAR_0, VAR_1, VAR_2); } else if (VAR_1->perm & P9_STAT_MODE_SOCKET) { VAR_2 = v9fs_do_mksock(VAR_0, &VAR_1->fullname); v9fs_create_post_mksock(VAR_0, VAR_1, VAR_2); } else { VAR_1->fidp->fd = v9fs_do_open2(VAR_0, VAR_1); v9fs_create_post_open2(VAR_0, VAR_1, VAR_2); } return; out:
v9fs_post_create(VAR_0, VAR_1, VAR_2); }