Release 4.14 arch/um/drivers/vde_user.c
/*
* Copyright (C) 2007 Luca Bigliardi (shammash@artha.org).
* Licensed under the GPL.
*/
#include <stddef.h>
#include <errno.h>
#include <libvdeplug.h>
#include <net_user.h>
#include <um_malloc.h>
#include "vde.h"
static int vde_user_init(void *data, void *dev)
{
struct vde_data *pri = data;
VDECONN *conn = NULL;
int err = -EINVAL;
pri->dev = dev;
conn = vde_open(pri->vde_switch, pri->descr, pri->args);
if (conn == NULL) {
err = -errno;
printk(UM_KERN_ERR "vde_user_init: vde_open failed, "
"errno = %d\n", errno);
return err;
}
printk(UM_KERN_INFO "vde backend - connection opened\n");
pri->conn = conn;
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 96 | 100.00% | 1 | 100.00% |
Total | 96 | 100.00% | 1 | 100.00% |
static int vde_user_open(void *data)
{
struct vde_data *pri = data;
if (pri->conn != NULL)
return vde_datafd(pri->conn);
printk(UM_KERN_WARNING "vde_open - we have no VDECONN to open");
return -EINVAL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 43 | 100.00% | 1 | 100.00% |
Total | 43 | 100.00% | 1 | 100.00% |
static void vde_remove(void *data)
{
struct vde_data *pri = data;
if (pri->conn != NULL) {
printk(UM_KERN_INFO "vde backend - closing connection\n");
vde_close(pri->conn);
pri->conn = NULL;
kfree(pri->args);
pri->args = NULL;
return;
}
printk(UM_KERN_WARNING "vde_remove - we have no VDECONN to remove");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 66 | 100.00% | 1 | 100.00% |
Total | 66 | 100.00% | 1 | 100.00% |
const struct net_user_info vde_user_info = {
.init = vde_user_init,
.open = vde_user_open,
.close = NULL,
.remove = vde_remove,
.add_address = NULL,
.delete_address = NULL,
.mtu = ETH_MAX_PACKET,
.max_packet = ETH_MAX_PACKET + ETH_HEADER_OTHER,
};
void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
{
struct vde_open_args *args;
vpri->args = uml_kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL);
if (vpri->args == NULL) {
printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args "
"allocation failed");
return;
}
args = vpri->args;
args->port = init->port;
args->group = init->group;
args->mode = init->mode ? init->mode : 0700;
args->port ? printk("port %d", args->port) :
printk("undefined port");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 105 | 98.13% | 1 | 33.33% |
Joe Perches | 1 | 0.93% | 1 | 33.33% |
Luca Bigliardi | 1 | 0.93% | 1 | 33.33% |
Total | 107 | 100.00% | 3 | 100.00% |
int vde_user_read(void *conn, void *buf, int len)
{
VDECONN *vconn = conn;
int rv;
if (vconn == NULL)
return 0;
rv = vde_recv(vconn, buf, len, 0);
if (rv < 0) {
if (errno == EAGAIN)
return 0;
return -errno;
}
else if (rv == 0)
return -ENOTCONN;
return rv;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 82 | 100.00% | 1 | 100.00% |
Total | 82 | 100.00% | 1 | 100.00% |
int vde_user_write(void *conn, void *buf, int len)
{
VDECONN *vconn = conn;
if (vconn == NULL)
return 0;
return vde_send(vconn, buf, len, 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 43 | 100.00% | 1 | 100.00% |
Total | 43 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jeff Dike | 501 | 99.21% | 3 | 50.00% |
Al Viro | 2 | 0.40% | 1 | 16.67% |
Luca Bigliardi | 1 | 0.20% | 1 | 16.67% |
Joe Perches | 1 | 0.20% | 1 | 16.67% |
Total | 505 | 100.00% | 6 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.