vde.c (cebea510579ed43724156cc596a8ff14ba208740) vde.c (f394b2e20d9a666fb194fb692179a0eeaca5daea)
1/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 54 unchanged lines hidden (view full) ---

63static void vde_cleanup(NetClientState *nc)
64{
65 VDEState *s = DO_UPCAST(VDEState, nc, nc);
66 qemu_set_fd_handler(vde_datafd(s->vde), NULL, NULL, NULL);
67 vde_close(s->vde);
68}
69
70static NetClientInfo net_vde_info = {
1/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 54 unchanged lines hidden (view full) ---

63static void vde_cleanup(NetClientState *nc)
64{
65 VDEState *s = DO_UPCAST(VDEState, nc, nc);
66 qemu_set_fd_handler(vde_datafd(s->vde), NULL, NULL, NULL);
67 vde_close(s->vde);
68}
69
70static NetClientInfo net_vde_info = {
71 .type = NET_CLIENT_OPTIONS_KIND_VDE,
71 .type = NET_CLIENT_DRIVER_VDE,
72 .size = sizeof(VDEState),
73 .receive = vde_receive,
74 .cleanup = vde_cleanup,
75};
76
77static int net_vde_init(NetClientState *peer, const char *model,
78 const char *name, const char *sock,
79 int port, const char *group, int mode)

--- 30 unchanged lines hidden (view full) ---

110}
111
112int net_init_vde(const Netdev *netdev, const char *name,
113 NetClientState *peer, Error **errp)
114{
115 /* FIXME error_setg(errp, ...) on failure */
116 const NetdevVdeOptions *vde;
117
72 .size = sizeof(VDEState),
73 .receive = vde_receive,
74 .cleanup = vde_cleanup,
75};
76
77static int net_vde_init(NetClientState *peer, const char *model,
78 const char *name, const char *sock,
79 int port, const char *group, int mode)

--- 30 unchanged lines hidden (view full) ---

110}
111
112int net_init_vde(const Netdev *netdev, const char *name,
113 NetClientState *peer, Error **errp)
114{
115 /* FIXME error_setg(errp, ...) on failure */
116 const NetdevVdeOptions *vde;
117
118 assert(netdev->opts->type == NET_CLIENT_OPTIONS_KIND_VDE);
119 vde = netdev->opts->u.vde.data;
118 assert(netdev->type == NET_CLIENT_DRIVER_VDE);
119 vde = &netdev->u.vde;
120
121 /* missing optional values have been initialized to "all bits zero" */
122 if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group,
123 vde->has_mode ? vde->mode : 0700) == -1) {
124 return -1;
125 }
126
127 return 0;
128}
120
121 /* missing optional values have been initialized to "all bits zero" */
122 if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group,
123 vde->has_mode ? vde->mode : 0700) == -1) {
124 return -1;
125 }
126
127 return 0;
128}