[haiku-commits] haiku: hrev52389 - src/libs/compat/freebsd11_wlan/net80211 src/libs/compat/freebsd11_network/compat/net headers/private/net src/libs/compat/freebsd11_network/compat/sys

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 5 Oct 2018 11:10:56 -0400 (EDT)

hrev52389 adds 2 changesets to branch 'master'
old head: bb40dfec8f5609197dbe3c87942dcee1860d66e9
new head: ece593e6cdd319ad67de2c604fe83a922674e3e8
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=ece593e6cdd3+%5Ebb40dfec8f56

----------------------------------------------------------------------------

8dea3e53a9c0: freebsd11_network: Fixup last commit for C++ compatibility.

ece593e6cdd3: freebsd11_wlan: Remove the BOSII_* ioctls.
  
  They are not used anywhere (the rest of the stack uses the FreeBSD
  ioctls instead), and there has been a TODO to remove them for
  quite some time.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 13 insertions(+), 176 deletions(-)
headers/private/net/bosii_driver.h               |  24 ---
.../compat/freebsd11_network/compat/net/if_var.h |  16 +-
.../freebsd11_network/compat/sys/buf_ring.h      |   4 +-
.../freebsd11_wlan/net80211/ieee80211_haiku.cpp  | 145 +------------------

############################################################################

Commit:      8dea3e53a9c0795777401b723c9b5be1405d4c05
URL:         https://git.haiku-os.org/haiku/commit/?id=8dea3e53a9c0
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Oct  5 00:06:15 2018 UTC

freebsd11_network: Fixup last commit for C++ compatibility.

----------------------------------------------------------------------------

diff --git a/src/libs/compat/freebsd11_network/compat/net/if_var.h 
b/src/libs/compat/freebsd11_network/compat/net/if_var.h
index e77ffdab2f..0142601aca 100644
--- a/src/libs/compat/freebsd11_network/compat/net/if_var.h
+++ b/src/libs/compat/freebsd11_network/compat/net/if_var.h
@@ -645,7 +645,7 @@ drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct 
mbuf *m)
 }
 
 static __inline void
-drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new)
+drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *_new)
 {
        /*
         * The top of the list needs to be swapped
@@ -657,11 +657,11 @@ drbr_putback(struct ifnet *ifp, struct buf_ring *br, 
struct mbuf *new)
                 * Peek in altq case dequeued it
                 * so put it back.
                 */
-               IFQ_DRV_PREPEND(&ifp->if_snd, new);
+               IFQ_DRV_PREPEND(&ifp->if_snd, _new);
                return;
        }
 #endif
-       buf_ring_putback_sc(br, new);
+       buf_ring_putback_sc(br, _new);
 }
 
 static __inline struct mbuf *
@@ -680,7 +680,7 @@ drbr_peek(struct ifnet *ifp, struct buf_ring *br)
                return (m);
        }
 #endif
-       return(buf_ring_peek_clear_sc(br));
+       return (struct mbuf*)buf_ring_peek_clear_sc(br);
 }
 
 static __inline void
@@ -692,7 +692,7 @@ drbr_flush(struct ifnet *ifp, struct buf_ring *br)
        if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd))
                IFQ_PURGE(&ifp->if_snd);
 #endif
-       while ((m = buf_ring_dequeue_sc(br)) != NULL)
+       while ((m = (struct mbuf*)buf_ring_dequeue_sc(br)) != NULL)
                m_freem(m);
 }
 
@@ -715,7 +715,7 @@ drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
                return (m);
        }
 #endif
-       return (buf_ring_dequeue_sc(br));
+       return (struct mbuf*)buf_ring_dequeue_sc(br);
 }
 
 static __inline void
@@ -748,11 +748,11 @@ drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,
                return (m);
        }
 #endif
-       m = buf_ring_peek(br);
+       m = (struct mbuf*)buf_ring_peek(br);
        if (m == NULL || func(m, arg) == 0)
                return (NULL);
 
-       return (buf_ring_dequeue_sc(br));
+       return (struct mbuf*)buf_ring_dequeue_sc(br);
 }
 
 static __inline int
diff --git a/src/libs/compat/freebsd11_network/compat/sys/buf_ring.h 
b/src/libs/compat/freebsd11_network/compat/sys/buf_ring.h
index fe307e7cef..9cecf41efc 100644
--- a/src/libs/compat/freebsd11_network/compat/sys/buf_ring.h
+++ b/src/libs/compat/freebsd11_network/compat/sys/buf_ring.h
@@ -267,11 +267,11 @@ buf_ring_advance_sc(struct buf_ring *br)
  * the compare and an atomic.
  */
 static __inline void
-buf_ring_putback_sc(struct buf_ring *br, void *new)
+buf_ring_putback_sc(struct buf_ring *br, void *_new)
 {
        KASSERT(br->br_cons_head != br->br_prod_tail,
                ("Buf-Ring has none in putback")) ;
-       br->br_ring[br->br_cons_head] = new;
+       br->br_ring[br->br_cons_head] = _new;
 }
 
 /*

############################################################################

Revision:    hrev52389
Commit:      ece593e6cdd319ad67de2c604fe83a922674e3e8
URL:         https://git.haiku-os.org/haiku/commit/?id=ece593e6cdd3
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Oct  5 00:07:11 2018 UTC

freebsd11_wlan: Remove the BOSII_* ioctls.

They are not used anywhere (the rest of the stack uses the FreeBSD
ioctls instead), and there has been a TODO to remove them for
quite some time.

----------------------------------------------------------------------------

diff --git a/headers/private/net/bosii_driver.h 
b/headers/private/net/bosii_driver.h
deleted file mode 100644
index 163f9f2190..0000000000
--- a/headers/private/net/bosii_driver.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
- * Distributed under the terms of the MIT License.
- */
-#ifndef _BOSII_DRIVER_H_
-#define _BOSII_DRIVER_H_
-
-
-#include <ether_driver.h>
-
-
-#define ETHER_OP_CODES_END (ETHER_GET_LINK_STATE + 1)
-
-// TODO: those will be removed again
-/* ioctl() opcodes a wlan driver should support */
-enum {
-       BOSII_DEVICE = ETHER_OP_CODES_END,
-       BOSII_DETECT_NETWORKS,
-       BOSII_GET_DETECTED_NETWORKS,
-       BOSII_JOIN_NETWORK,
-       BOSII_GET_ASSOCIATED_NETWORK
-};
-
-#endif /* _BOSII_DRIVER_H_ */
diff --git a/src/libs/compat/freebsd11_wlan/net80211/ieee80211_haiku.cpp 
b/src/libs/compat/freebsd11_wlan/net80211/ieee80211_haiku.cpp
index 6ef18cde31..180f9245fa 100644
--- a/src/libs/compat/freebsd11_wlan/net80211/ieee80211_haiku.cpp
+++ b/src/libs/compat/freebsd11_wlan/net80211/ieee80211_haiku.cpp
@@ -1,7 +1,7 @@
 /*
- * Copyright 2009, Colin Günther, coling@xxxxxx.
- * Copyright 2018, Haiku, Inc.
- * All rights reserved. Distributed under the terms of the MIT License.
+ * Copyright 2009, Colin Günther, coling@xxxxxx. All rights reserved.
+ * Copyright 2018, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
  */
 
 
@@ -57,7 +57,6 @@ extern "C" {
 #include <util/KMessage.h>
 
 #include <ether_driver.h>
-#include <bosii_driver.h>
 #include <net_notifications.h>
 
 #include <shared.h>
@@ -207,147 +206,9 @@ wlan_control(void* cookie, uint32 op, void* arg, size_t 
length)
        struct ifnet* ifp = (struct ifnet*)cookie;
 
        switch (op) {
-               case BOSII_DEVICE:
-                       return B_OK;
-
-               case BOSII_DETECT_NETWORKS:
-               {
-                       struct ieee80211req request;
-                       struct ieee80211_scan_req scanRequest;
-
-                       if_printf(ifp, "%s: BOSII_DETECT_NETWORKS\n", __func__);
-                       memset(&scanRequest, 0, sizeof(scanRequest));
-                       scanRequest.sr_flags = IEEE80211_IOC_SCAN_ACTIVE
-                               | IEEE80211_IOC_SCAN_NOPICK
-                               | IEEE80211_IOC_SCAN_ONCE;
-                       scanRequest.sr_duration = 10000; // 10 s
-                       scanRequest.sr_nssid = 0;
-
-                       memset(&request, 0, sizeof(request));
-                       request.i_type = IEEE80211_IOC_SCAN_REQ;
-                       request.i_data = &scanRequest;
-                       request.i_len = sizeof(scanRequest);
-
-                       ifp->if_ioctl(ifp, SIOCS80211, (caddr_t)&request);
-
-                       acquire_sem_etc(ifp->scan_done_sem, 1, 
B_RELATIVE_TIMEOUT,
-                               10000000); // 10 s
-
-                       return B_OK;
-               }
-
-               case BOSII_GET_DETECTED_NETWORKS:
-               {
-                       struct ieee80211req request;
-                       struct ifreq ifRequest;
-                       struct route_entry* networkRequest = 
&ifRequest.ifr_route;
-
-                       if_printf(ifp, "%s: BOSII_GET_DETECTED_NETWORKS\n", 
__func__);
-
-                       if (length < sizeof(struct ieee80211req_scan_result))
-                               return B_BAD_VALUE;
-
-                       if (user_memcpy(&ifRequest, arg, sizeof(ifRequest)) < 
B_OK)
-                               return B_BAD_ADDRESS;
-
-                       memset(&request, 0, sizeof(request));
-                       request.i_type = IEEE80211_IOC_SCAN_RESULTS;
-                       request.i_len = length;
-                       request.i_data = networkRequest->destination;
-
-                       // After return value of request.i_data is copied into 
user
-                       // space, already.
-                       if (ifp->if_ioctl(ifp, SIOCG80211, (caddr_t)&request) < 
B_OK)
-                               return B_BAD_ADDRESS;
-
-                       // Tell the user space how much data was copied
-                       networkRequest->mtu = request.i_len;
-                       if (user_memcpy(&((struct ifreq*)arg)->ifr_route.mtu,
-                               &networkRequest->mtu, 
sizeof(networkRequest->mtu)) < B_OK)
-                               return B_BAD_ADDRESS;
-
-                       return B_OK;
-               }
-
-               case BOSII_JOIN_NETWORK:
-               {
-                       struct ieee80211req request;
-                       struct ifreq ifRequest;
-                       struct route_entry* networkRequest = 
&ifRequest.ifr_route;
-                       struct ieee80211req_scan_result network;
-
-                       if_printf(ifp, "%s: BOSII_JOIN_NETWORK\n", __func__);
-
-                       if (length < sizeof(struct ifreq))
-                               return B_BAD_VALUE;
-
-                       if (user_memcpy(&ifRequest, arg, sizeof(ifRequest)) != 
B_OK
-                               || user_memcpy(&network, networkRequest->source,
-                                               
sizeof(ieee80211req_scan_result)) != B_OK)
-                               return B_BAD_ADDRESS;
-
-                       memset(&request, 0, sizeof(ieee80211req));
-
-                       request.i_type = IEEE80211_IOC_SSID;
-                       request.i_val = 0;
-                       request.i_len = network.isr_ssid_len;
-                       request.i_data = (uint8*)networkRequest->source
-                               + network.isr_ie_off;
-                       if (ifp->if_ioctl(ifp, SIOCS80211, (caddr_t)&request) < 
B_OK)
-                               return B_ERROR;
-
-                       // wait for network join
-
-                       return B_OK;
-               }
-
-               case BOSII_GET_ASSOCIATED_NETWORK:
-               {
-                       struct ieee80211req request;
-                       struct ifreq ifRequest;
-                       struct route_entry* networkRequest = 
&ifRequest.ifr_route;
-
-                       if_printf(ifp, "%s: BOSII_GET_ASSOCIATED_NETWORK\n", 
__func__);
-
-                       if (length < sizeof(struct ieee80211req_sta_req))
-                               return B_BAD_VALUE;
-
-                       if (user_memcpy(&ifRequest, arg, sizeof(ifRequest)) < 
B_OK)
-                               return B_BAD_ADDRESS;
-
-                       // Only want station information about associated 
network.
-                       memset(&request, 0, sizeof(request));
-                       request.i_type = IEEE80211_IOC_BSSID;
-                       request.i_len = IEEE80211_ADDR_LEN;
-                       request.i_data = ((struct 
ieee80211req_sta_req*)networkRequest->
-                                       destination)->is_u.macaddr;
-                       if (ifp->if_ioctl(ifp, SIOCG80211, (caddr_t)&request) < 
B_OK)
-                               return B_BAD_ADDRESS;
-
-                       request.i_type = IEEE80211_IOC_STA_INFO;
-                       request.i_len = length;
-                       request.i_data = networkRequest->destination;
-
-                       // After return value of request.i_data is copied into 
user
-                       // space, already.
-                       if (ifp->if_ioctl(ifp, SIOCG80211, (caddr_t)&request) < 
B_OK)
-                               return B_BAD_ADDRESS;
-
-                       // Tell the user space how much data was copied
-                       networkRequest->mtu = request.i_len;
-                       if (user_memcpy(&((struct ifreq*)arg)->ifr_route.mtu,
-                                       &networkRequest->mtu, 
sizeof(networkRequest->mtu)) != B_OK)
-                               return B_BAD_ADDRESS;
-
-                       return B_OK;
-               }
-
                case SIOCG80211:
                case SIOCS80211:
                {
-                       // Allowing FreeBSD based WLAN ioctls to pass, as those 
will become
-                       // the future Haiku WLAN ioctls anyway.
-
                        // FreeBSD drivers assume that the request structure 
has already
                        // been copied into kernel space
                        struct ieee80211req request;


Other related posts: