static int proxy_init(FsContext *ctx)

{

    V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));

    int sock_id;



    if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {

        sock_id = connect_namedsocket(ctx->fs_root);

    } else {

        sock_id = atoi(ctx->fs_root);

        if (sock_id < 0) {

            fprintf(stderr, "socket descriptor not initialized\n");


            return -1;

        }

    }

    g_free(ctx->fs_root);




    proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;



    ctx->private = proxy;

    proxy->sockfd = sock_id;

    qemu_mutex_init(&proxy->mutex);



    ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT;

    ctx->exops.get_st_gen = proxy_ioc_getversion;

    return 0;

}
static int proxy_init(FsContext *ctx)

{

    V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));

    int sock_id;



    if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {

        sock_id = connect_namedsocket(ctx->fs_root);

    } else {

        sock_id = atoi(ctx->fs_root);

        if (sock_id < 0) {

            fprintf(stderr, "socket descriptor not initialized\n");


            return -1;

        }

    }

    g_free(ctx->fs_root);




    proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;



    ctx->private = proxy;

    proxy->sockfd = sock_id;

    qemu_mutex_init(&proxy->mutex);



    ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT;

    ctx->exops.get_st_gen = proxy_ioc_getversion;

    return 0;

}
static int FUNC_0(FsContext *VAR_0)

{

    V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy));

    int VAR_1;



    if (VAR_0->export_flags & V9FS_PROXY_SOCK_NAME) {

        VAR_1 = connect_namedsocket(VAR_0->fs_root);

    } else {

        VAR_1 = atoi(VAR_0->fs_root);

        if (VAR_1 < 0) {

            fprintf(stderr, "socket descriptor not initialized\n");


            return -1;

        }

    }

    g_free(VAR_0->fs_root);




    proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;

    proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ);

    proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ;



    VAR_0->private = proxy;

    proxy->sockfd = VAR_1;

    qemu_mutex_init(&proxy->mutex);



    VAR_0->export_flags |= V9FS_PATHNAME_FSCONTEXT;

    VAR_0->exops.get_st_gen = proxy_ioc_getversion;

    return 0;

}
static int FUNC_0(FsContext *VAR_0)
{ V9fsProxy *proxy = g_malloc(sizeof(V9fsProxy)); int VAR_1; if (VAR_0->export_flags & V9FS_PROXY_SOCK_NAME) { VAR_1 = connect_namedsocket(VAR_0->fs_root); } else { VAR_1 = atoi(VAR_0->fs_root); if (VAR_1 < 0) { fprintf(stderr, "socket descriptor not initialized\n"); return -1; } } g_free(VAR_0->fs_root); proxy->in_iovec.iov_base  = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); proxy->in_iovec.iov_len   = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; proxy->out_iovec.iov_base = g_malloc(PROXY_MAX_IO_SZ + PROXY_HDR_SZ); proxy->out_iovec.iov_len  = PROXY_MAX_IO_SZ + PROXY_HDR_SZ; VAR_0->private = proxy; proxy->sockfd = VAR_1; qemu_mutex_init(&proxy->mutex); VAR_0->export_flags |= V9FS_PATHNAME_FSCONTEXT; VAR_0->exops.get_st_gen = proxy_ioc_getversion; return 0; }