// Initialize the handle // // Returns 0 if everything went fine, or -1 in case of error static int __twopence_tcp_init(struct twopence_tcp_target *handle, const char *server_spec) { twopence_pipe_target_init(&handle->pipe, TWOPENCE_PLUGIN_TCP, &twopence_tcp_ops, &twopence_tcp_link_ops); handle->server_spec = twopence_strdup(server_spec); return 0; }
// Initialize the handle // // Returns 0 if everything went fine, or -1 in case of error static int __twopence_virtio_init(struct twopence_virtio_target *handle, const char *sockname) { twopence_pipe_target_init(&handle->pipe, TWOPENCE_PLUGIN_VIRTIO, &twopence_virtio_ops, &twopence_virtio_link_ops); // Initialize the socket address handle->address.sun_family = AF_LOCAL; if (strlen(sockname) >= sizeof(handle->address.sun_path)) return -1; strcpy(handle->address.sun_path, sockname); return 0; }