hrev53077 adds 1 changeset to branch 'master'
old head: 64948daae87758e6c54bff5ce8ff7f7305fef6e0
new head: 612c05bd76765ee7afafe094b87ff502bf8a46ae
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=612c05bd7676+%5E64948daae877
----------------------------------------------------------------------------
612c05bd7676: network/tun: Style fixes; no functional change
[ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53077
Commit: 612c05bd76765ee7afafe094b87ff502bf8a46ae
URL: https://git.haiku-os.org/haiku/commit/?id=612c05bd7676
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Wed Apr 17 19:24:19 2019 UTC
----------------------------------------------------------------------------
4 files changed, 88 insertions(+), 47 deletions(-)
headers/private/net/net_tun.h | 4 +-
src/add-ons/kernel/drivers/network/tun/Jamfile | 3 -
src/add-ons/kernel/drivers/network/tun/driver.c | 90 +++++++++++++++------
src/add-ons/kernel/network/devices/tun/tun.cpp | 38 ++++-----
----------------------------------------------------------------------------
diff --git a/headers/private/net/net_tun.h b/headers/private/net/net_tun.h
index 11385aa4a2..e9d2eb848d 100644
--- a/headers/private/net/net_tun.h
+++ b/headers/private/net/net_tun.h
@@ -1,6 +1,6 @@
/*
- * Copyright 2008, Haiku, Inc. All Rights Reserved.
- * This file may be used under the terms of the MIT License.
+ * Copyright 2008-2019, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT license.
*/
#ifndef NET_TUN_H
#define NET_TUN_H
diff --git a/src/add-ons/kernel/drivers/network/tun/Jamfile
b/src/add-ons/kernel/drivers/network/tun/Jamfile
index 99fb0ebad3..54dca5dc9c 100644
--- a/src/add-ons/kernel/drivers/network/tun/Jamfile
+++ b/src/add-ons/kernel/drivers/network/tun/Jamfile
@@ -7,6 +7,3 @@ UsePrivateHeaders net ;
KernelAddon tun_config :
driver.c
;
-
-
-
diff --git a/src/add-ons/kernel/drivers/network/tun/driver.c
b/src/add-ons/kernel/drivers/network/tun/driver.c
index 5eb56269ab..65a14d7237 100644
--- a/src/add-ons/kernel/drivers/network/tun/driver.c
+++ b/src/add-ons/kernel/drivers/network/tun/driver.c
@@ -1,3 +1,8 @@
+/*
+ * /dev/config/tun network tunnel driver for BeOS
+ * (c) 2003, mmu_man, revol@xxxxxxx
+ * licenced under MIT licence.
+ */
#include <Drivers.h>
#include <KernelExport.h>
#include <OS.h>
@@ -10,14 +15,8 @@
#include <fsproto.h>
#include "bone_tun.h"
-/*
- * /dev/config/tun network tunnel driver for BeOS
- * (c) 2003, mmu_man, revol@xxxxxxx
- * licenced under MIT licence.
- */
-
-const char * device_names[]={TUN_DRIVER_NAME, NULL};
+const char * device_names[] = {TUN_DRIVER_NAME, NULL};
extern device_hooks tun_hooks;
int32 api_version = B_CUR_DRIVER_API_VERSION;
@@ -26,30 +25,48 @@ vint32 if_mod_ref_count = 0;
bone_tun_interface_info_t *gIfaceModule = NULL;
bone_util_info_t *gUtil = NULL;
-status_t init_hardware(void) {
+
+status_t
+init_hardware(void)
+{
dprintf("tun:init_hardware()\n");
return B_OK;
}
-status_t init_driver(void) {
+
+status_t
+init_driver(void)
+{
dprintf("tun:init_driver()\n");
return B_OK;
}
-void uninit_driver(void) {
+
+void
+uninit_driver(void)
+{
dprintf("tun:uninit_driver()\n");
}
-const char **publish_devices() {
+
+const char**
+publish_devices()
+{
return device_names;
}
-device_hooks *find_device(const char *name) {
+
+device_hooks*
+find_device(const char *name)
+{
(void)name;
return &tun_hooks;
}
-status_t tun_open(const char *name, uint32 flags, cookie_t **cookie) {
+
+status_t
+tun_open(const char *name, uint32 flags, cookie_t **cookie)
+{
status_t err = B_OK;
(void)name; (void)flags;
/* XXX: add O_NONBLOCK + FIONBIO */
@@ -88,12 +105,18 @@ err0:
return B_ERROR;
}
-status_t tun_close(void *cookie) {
+
+status_t
+tun_close(void *cookie)
+{
(void)cookie;
return B_OK;
}
-status_t tun_free(cookie_t *cookie) {
+
+status_t
+tun_free(cookie_t *cookie)
+{
status_t err = B_OK;
#if DEBUG > 1
dprintf("tun_close()\n");
@@ -107,7 +130,10 @@ status_t tun_free(cookie_t *cookie) {
return err;
}
-status_t tun_ioctl(cookie_t *cookie, uint32 op, void *data, size_t len) {
+
+status_t
+tun_ioctl(cookie_t *cookie, uint32 op, void *data, size_t len)
+{
ifreq_t *ifr;
bone_tun_if_interface_t *iface;
(void)cookie; (void)op; (void)data; (void)len;
@@ -165,7 +191,10 @@ status_t tun_ioctl(cookie_t *cookie, uint32 op, void
*data, size_t len) {
return B_ERROR;
}
-status_t tun_read(cookie_t *cookie, off_t position, void *data, size_t
*numbytes) {
+
+status_t
+tun_read(cookie_t *cookie, off_t position, void *data, size_t *numbytes)
+{
bone_data_t *bdata;
uint32 got;
ssize_t pktsize;
@@ -201,7 +230,10 @@ ERROR_EOF:
return B_OK;
}
-status_t tun_write(cookie_t *cookie, off_t position, const void *data, size_t
*numbytes) {
+
+status_t
+tun_write(cookie_t *cookie, off_t position, const void *data, size_t *numbytes)
+{
bone_data_t *bdata = NULL;
void *buf;
status_t err = B_NO_MEMORY;
@@ -233,7 +265,9 @@ ERROR_1:
return err;
}
-status_t tun_select(cookie_t *cookie, uint8 event, uint32 ref, selectsync
*sync)
+
+status_t
+tun_select(cookie_t *cookie, uint8 event, uint32 ref, selectsync *sync)
{
status_t err = B_OK;
#if DEBUG > 1
@@ -291,7 +325,10 @@ status_t tun_select(cookie_t *cookie, uint8 event, uint32
ref, selectsync *sync)
/* iface UNLOCKED */
return err;
}
-status_t tun_deselect(cookie_t *cookie, uint8 event, selectsync *sync)
+
+
+status_t
+tun_deselect(cookie_t *cookie, uint8 event, selectsync *sync)
{
status_t err = B_OK;
#if DEBUG > 1
@@ -310,18 +347,25 @@ status_t tun_deselect(cookie_t *cookie, uint8 event,
selectsync *sync)
/* iface LOCKED */
return B_OK;
}
-status_t tun_readv(cookie_t *cookie, off_t position, const iovec *vec, size_t
count, size_t *numBytes)
+
+
+status_t
+tun_readv(cookie_t *cookie, off_t position, const iovec *vec, size_t count,
size_t *numBytes)
{
dprintf("tun: readv(, %Ld, , %ld)\n", position, count);
return EOPNOTSUPP;
}
-status_t tun_writev(cookie_t *cookie, off_t position, const iovec *vec, size_t
count, size_t *numBytes)
+
+
+status_t
+tun_writev(cookie_t *cookie, off_t position, const iovec *vec, size_t count,
size_t *numBytes)
{
dprintf("tun: writev(, %Ld, , %ld)\n", position, count);
return EOPNOTSUPP;
}
-device_hooks tun_hooks={
+
+device_hooks tun_hooks = {
(device_open_hook)tun_open,
tun_close,
(device_free_hook)tun_free,
diff --git a/src/add-ons/kernel/network/devices/tun/tun.cpp
b/src/add-ons/kernel/network/devices/tun/tun.cpp
index 4fa665a919..e14813549b 100644
--- a/src/add-ons/kernel/network/devices/tun/tun.cpp
+++ b/src/add-ons/kernel/network/devices/tun/tun.cpp
@@ -23,8 +23,8 @@
-struct net_buffer_module_info *gBufferModule;
-static struct net_stack_module_info *sStackModule;
+struct net_buffer_module_info* gBufferModule;
+static struct net_stack_module_info* sStackModule;
//static mutex sListLock;
//static DoublyLinkedList<ethernet_device> sCheckList;
@@ -34,9 +34,9 @@ static struct net_stack_module_info *sStackModule;
status_t
-tun_init(const char *name, net_device **_device)
+tun_init(const char* name, net_device** _device)
{
- tun_device *device;
+ tun_device* device;
if (strncmp(name, "tun", 3)
&& strncmp(name, "tap", 3)
@@ -62,9 +62,9 @@ tun_init(const char *name, net_device **_device)
status_t
-tun_uninit(net_device *_device)
+tun_uninit(net_device* _device)
{
- tun_device *device = (tun_device *)_device;
+ tun_device* device = (tun_device*)_device;
put_module(NET_STACK_MODULE_NAME);
put_module(NET_BUFFER_MODULE_NAME);
@@ -75,20 +75,20 @@ tun_uninit(net_device *_device)
status_t
-tun_up(net_device *device)
+tun_up(net_device* device)
{
return B_OK;
}
void
-tun_down(net_device *device)
+tun_down(net_device* device)
{
}
status_t
-tun_control(net_device *device, int32 op, void *argument,
+tun_control(net_device* device, int32 op, void* argument,
size_t length)
{
return B_BAD_VALUE;
@@ -96,14 +96,14 @@ tun_control(net_device *device, int32 op, void *argument,
status_t
-tun_send_data(net_device *device, net_buffer *buffer)
+tun_send_data(net_device* device, net_buffer* buffer)
{
return sStackModule->device_enqueue_buffer(device, buffer);
}
status_t
-tun_set_mtu(net_device *device, size_t mtu)
+tun_set_mtu(net_device* device, size_t mtu)
{
if (mtu > 65536 || mtu < 16)
return B_BAD_VALUE;
@@ -114,28 +114,28 @@ tun_set_mtu(net_device *device, size_t mtu)
status_t
-tun_set_promiscuous(net_device *device, bool promiscuous)
+tun_set_promiscuous(net_device* device, bool promiscuous)
{
return EOPNOTSUPP;
}
status_t
-tun_set_media(net_device *device, uint32 media)
+tun_set_media(net_device* device, uint32 media)
{
return EOPNOTSUPP;
}
status_t
-tun_add_multicast(net_device *device, const sockaddr *address)
+tun_add_multicast(net_device* device, const sockaddr* address)
{
return B_OK;
}
status_t
-tun_remove_multicast(net_device *device, const sockaddr *address)
+tun_remove_multicast(net_device* device, const sockaddr* address)
{
return B_OK;
}
@@ -148,11 +148,11 @@ tun_std_ops(int32 op, ...)
case B_MODULE_INIT:
{
status_t status = get_module(NET_STACK_MODULE_NAME,
- (module_info **)&sStackModule);
+ (module_info**)&sStackModule);
if (status < B_OK)
return status;
status = get_module(NET_BUFFER_MODULE_NAME,
- (module_info **)&gBufferModule);
+ (module_info**)&gBufferModule);
if (status < B_OK) {
put_module(NET_STACK_MODULE_NAME);
return status;
@@ -190,7 +190,7 @@ net_device_module_info sLoopbackModule = {
};
-module_info *modules[] = {
- (module_info *)&sLoopbackModule,
+module_info* modules[] = {
+ (module_info*)&sLoopbackModule,
NULL
};