static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,

                       const char *name, FsCred *credp)

{

    char *path;

    int err = -1;

    int serrno = 0;

    V9fsString fullname;

    char *buffer;



    v9fs_string_init(&fullname);

    v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);

    path = fullname.data;



    /* Determine the security model */

    if (fs_ctx->export_flags & V9FS_SM_MAPPED) {

        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_set_xattr(buffer, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {



        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_set_mapped_file_attr(fs_ctx, path, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||

               (fs_ctx->export_flags & V9FS_SM_NONE)) {

        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, credp->fc_mode, credp->fc_rdev);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_post_create_passthrough(fs_ctx, path, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    }

    goto out;



err_end:

    remove(buffer);

    errno = serrno;

    g_free(buffer);

out:

    v9fs_string_free(&fullname);

    return err;

}

static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,

                       const char *name, FsCred *credp)

{

    char *path;

    int err = -1;

    int serrno = 0;

    V9fsString fullname;

    char *buffer;



    v9fs_string_init(&fullname);

    v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);

    path = fullname.data;



    

    if (fs_ctx->export_flags & V9FS_SM_MAPPED) {

        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_set_xattr(buffer, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {



        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_set_mapped_file_attr(fs_ctx, path, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||

               (fs_ctx->export_flags & V9FS_SM_NONE)) {

        buffer = rpath(fs_ctx, path);

        err = mknod(buffer, credp->fc_mode, credp->fc_rdev);

        if (err == -1) {

            g_free(buffer);

            goto out;

        }

        err = local_post_create_passthrough(fs_ctx, path, credp);

        if (err == -1) {

            serrno = errno;

            goto err_end;

        }

    }

    goto out;



err_end:

    remove(buffer);

    errno = serrno;

    g_free(buffer);

out:

    v9fs_string_free(&fullname);

    return err;

}

    char *buffer;             g_free(buffer);             g_free(buffer);             g_free(buffer);     g_free(buffer);     char *buffer;             g_free(buffer);             g_free(buffer);             g_free(buffer);     g_free(buffer);     char *buffer;             g_free(buffer);             g_free(buffer);             g_free(buffer);     g_free(buffer);     char *buffer;             g_free(buffer);             g_free(buffer);             g_free(buffer);     g_free(buffer);
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,

                       const char *VAR_2, FsCred *VAR_3)

{

    char *VAR_4;

    int VAR_5 = -1;

    int VAR_6 = 0;

    V9fsString fullname;

    char *VAR_7;



    v9fs_string_init(&fullname);

    v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2);

    VAR_4 = fullname.data;



    

    if (VAR_0->export_flags & V9FS_SM_MAPPED) {

        VAR_7 = rpath(VAR_0, VAR_4);

        VAR_5 = mknod(VAR_7, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (VAR_5 == -1) {

            g_free(VAR_7);

            goto out;

        }

        VAR_5 = local_set_xattr(VAR_7, VAR_3);

        if (VAR_5 == -1) {

            VAR_6 = errno;

            goto err_end;

        }

    } else if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) {



        VAR_7 = rpath(VAR_0, VAR_4);

        VAR_5 = mknod(VAR_7, SM_LOCAL_MODE_BITS|S_IFREG, 0);

        if (VAR_5 == -1) {

            g_free(VAR_7);

            goto out;

        }

        VAR_5 = local_set_mapped_file_attr(VAR_0, VAR_4, VAR_3);

        if (VAR_5 == -1) {

            VAR_6 = errno;

            goto err_end;

        }

    } else if ((VAR_0->export_flags & V9FS_SM_PASSTHROUGH) ||

               (VAR_0->export_flags & V9FS_SM_NONE)) {

        VAR_7 = rpath(VAR_0, VAR_4);

        VAR_5 = mknod(VAR_7, VAR_3->fc_mode, VAR_3->fc_rdev);

        if (VAR_5 == -1) {

            g_free(VAR_7);

            goto out;

        }

        VAR_5 = local_post_create_passthrough(VAR_0, VAR_4, VAR_3);

        if (VAR_5 == -1) {

            VAR_6 = errno;

            goto err_end;

        }

    }

    goto out;



err_end:

    remove(VAR_7);

    errno = VAR_6;

    g_free(VAR_7);

out:

    v9fs_string_free(&fullname);

    return VAR_5;

}

static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,
const char *VAR_2, FsCred *VAR_3)
{ char *VAR_4; int VAR_5 = -1; int VAR_6 = 0; V9fsString fullname; char *VAR_7; v9fs_string_init(&fullname); v9fs_string_sprintf(&fullname, "%s/%s", VAR_1->data, VAR_2); VAR_4 = fullname.data; if (VAR_0->export_flags & V9FS_SM_MAPPED) { VAR_7 = rpath(VAR_0, VAR_4); VAR_5 = mknod(VAR_7, SM_LOCAL_MODE_BITS|S_IFREG, 0); if (VAR_5 == -1) { g_free(VAR_7); goto out; } VAR_5 = local_set_xattr(VAR_7, VAR_3); if (VAR_5 == -1) { VAR_6 = errno; goto err_end; } } else if (VAR_0->export_flags & V9FS_SM_MAPPED_FILE) { VAR_7 = rpath(VAR_0, VAR_4); VAR_5 = mknod(VAR_7, SM_LOCAL_MODE_BITS|S_IFREG, 0); if (VAR_5 == -1) { g_free(VAR_7); goto out; } VAR_5 = local_set_mapped_file_attr(VAR_0, VAR_4, VAR_3); if (VAR_5 == -1) { VAR_6 = errno; goto err_end; } } else if ((VAR_0->export_flags & V9FS_SM_PASSTHROUGH) || (VAR_0->export_flags & V9FS_SM_NONE)) { VAR_7 = rpath(VAR_0, VAR_4); VAR_5 = mknod(VAR_7, VAR_3->fc_mode, VAR_3->fc_rdev); if (VAR_5 == -1) { g_free(VAR_7); goto out; } VAR_5 = local_post_create_passthrough(VAR_0, VAR_4, VAR_3); if (VAR_5 == -1) { VAR_6 = errno; goto err_end; } } goto out; err_end:
remove(VAR_7); errno = VAR_6; g_free(VAR_7); out:
v9fs_string_free(&fullname); return VAR_5; }