mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
net/netlink: Fix cosmetic issues, mostly typo fixes.
This commit is contained in:
+11
-9
@@ -66,7 +66,7 @@
|
|||||||
* until it is gotten by the client. This structure holds that buffered
|
* until it is gotten by the client. This structure holds that buffered
|
||||||
* data.
|
* data.
|
||||||
*
|
*
|
||||||
* REVISIT: There really should be a timestamp on this so that we can
|
* REVISIT: There really should be a time stamp on this so that we can
|
||||||
* someday weed out un-claimed responses.
|
* someday weed out un-claimed responses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -74,6 +74,8 @@ struct netlink_response_s
|
|||||||
{
|
{
|
||||||
sq_entry_t flink;
|
sq_entry_t flink;
|
||||||
FAR struct nlmsghdr msg;
|
FAR struct nlmsghdr msg;
|
||||||
|
|
||||||
|
/* Message-specific data may follow */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SIZEOF_NETLINK_RESPONSE_S(n) (sizeof(struct netlink_response_s) + (n) - 1)
|
#define SIZEOF_NETLINK_RESPONSE_S(n) (sizeof(struct netlink_response_s) + (n) - 1)
|
||||||
@@ -86,14 +88,14 @@ struct netlink_conn_s
|
|||||||
|
|
||||||
dq_entry_t node; /* Supports a doubly linked list */
|
dq_entry_t node; /* Supports a doubly linked list */
|
||||||
|
|
||||||
/* This is a list of Netlink connection callbacks. Each callback
|
/* This is a list of NetLink connection callbacks. Each callback
|
||||||
* represents a thread that is stalled, waiting for a device-specific
|
* represents a thread that is stalled, waiting for a device-specific
|
||||||
* event.
|
* event.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FAR struct devif_callback_s *list; /* Netlink callbacks */
|
FAR struct devif_callback_s *list; /* NetLink callbacks */
|
||||||
|
|
||||||
/* Netlink-specific content follows */
|
/* NetLink-specific content follows */
|
||||||
|
|
||||||
uint32_t pid; /* Port ID (if bound) */
|
uint32_t pid; /* Port ID (if bound) */
|
||||||
uint32_t groups; /* Multicast groups mask (if bound) */
|
uint32_t groups; /* Multicast groups mask (if bound) */
|
||||||
@@ -140,7 +142,7 @@ void netlink_initialize(void);
|
|||||||
* Name: netlink_alloc()
|
* Name: netlink_alloc()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a new, uninitialized netlink connection structure. This is
|
* Allocate a new, uninitialized NetLink connection structure. This is
|
||||||
* normally something done by the implementation of the socket() API
|
* normally something done by the implementation of the socket() API
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -151,7 +153,7 @@ FAR struct netlink_conn_s *netlink_alloc(void);
|
|||||||
* Name: netlink_free()
|
* Name: netlink_free()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Free a netlink connection structure that is no longer in use. This should
|
* Free a NetLink connection structure that is no longer in use. This should
|
||||||
* be done by the implementation of close().
|
* be done by the implementation of close().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -162,10 +164,10 @@ void netlink_free(FAR struct netlink_conn_s *conn);
|
|||||||
* Name: netlink_nextconn()
|
* Name: netlink_nextconn()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Traverse the list of allocated netlink connections
|
* Traverse the list of allocated NetLink connections
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from netlink device logic.
|
* This function is called from NetLink device logic.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -176,7 +178,7 @@ FAR struct netlink_conn_s *netlink_nextconn(FAR struct netlink_conn_s *conn);
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Find a connection structure that is the appropriate connection for the
|
* Find a connection structure that is the appropriate connection for the
|
||||||
* provided netlink address
|
* provided NetLink address
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/netlink/netlink_conn.c
|
* net/netlink/netlink_conn.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -61,16 +61,16 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The array containing all netlink connections. */
|
/* The array containing all NetLink connections. */
|
||||||
|
|
||||||
static struct netlink_conn_s g_netlink_connections[CONFIG_NETLINK_CONNS];
|
static struct netlink_conn_s g_netlink_connections[CONFIG_NETLINK_CONNS];
|
||||||
|
|
||||||
/* A list of all free netlink connections */
|
/* A list of all free NetLink connections */
|
||||||
|
|
||||||
static dq_queue_t g_free_netlink_connections;
|
static dq_queue_t g_free_netlink_connections;
|
||||||
static sem_t g_free_sem;
|
static sem_t g_free_sem;
|
||||||
|
|
||||||
/* A list of all allocated netlink connections */
|
/* A list of all allocated NetLink connections */
|
||||||
|
|
||||||
static dq_queue_t g_active_netlink_connections;
|
static dq_queue_t g_active_netlink_connections;
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ void netlink_initialize(void)
|
|||||||
* Name: netlink_alloc()
|
* Name: netlink_alloc()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Allocate a new, uninitialized netlink connection structure. This is
|
* Allocate a new, uninitialized NetLink connection structure. This is
|
||||||
* normally something done by the implementation of the socket() API
|
* normally something done by the implementation of the socket() API
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -177,7 +177,7 @@ FAR struct netlink_conn_s *netlink_alloc(void)
|
|||||||
* Name: netlink_free()
|
* Name: netlink_free()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Free a netlink connection structure that is no longer in use. This should
|
* Free a NetLink connection structure that is no longer in use. This should
|
||||||
* be done by the implementation of close().
|
* be done by the implementation of close().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -217,10 +217,10 @@ void netlink_free(FAR struct netlink_conn_s *conn)
|
|||||||
* Name: netlink_nextconn()
|
* Name: netlink_nextconn()
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Traverse the list of allocated netlink connections
|
* Traverse the list of allocated NetLink connections
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function is called from netlink device logic.
|
* This function is called from NetLink device logic.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ FAR struct netlink_conn_s *netlink_nextconn(FAR struct netlink_conn_s *conn)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Find a connection structure that is the appropriate connection for the
|
* Find a connection structure that is the appropriate connection for the
|
||||||
* provided netlink address
|
* provided NetLink address
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -71,19 +71,15 @@
|
|||||||
|
|
||||||
/* RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH
|
/* RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH
|
||||||
* Add, remove or receive information about a neighbor table entry (e.g.,
|
* Add, remove or receive information about a neighbor table entry (e.g.,
|
||||||
* an ARP entry). The message contains an ndmsg structure.
|
* an ARP entry). The message contains an 'ndmsg' structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct nlroute_sendto_request_s
|
struct nlroute_sendto_request_s
|
||||||
{
|
{
|
||||||
struct nlmsghdr hdr;
|
struct nlmsghdr hdr;
|
||||||
struct ndmsg msg;
|
struct ndmsg msg;
|
||||||
uint8_t data[1];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SIZEOF_NLROUTE_SENDTO_REQUEST_S(n) \
|
|
||||||
(sizeof(struct nlroute_sendto_request_s) + (n) - 1)
|
|
||||||
|
|
||||||
struct nlroute_recvfrom_response_s
|
struct nlroute_recvfrom_response_s
|
||||||
{
|
{
|
||||||
struct nlmsghdr hdr;
|
struct nlmsghdr hdr;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/netlink/netlink_sockif.c
|
* net/netlink/netlink_sockif.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2018-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -123,7 +123,7 @@ const struct sock_intf_s g_netlink_sockif =
|
|||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock - A pointer to a user allocated socket structure to be
|
* psock - A pointer to a user allocated socket structure to be
|
||||||
* initialized.
|
* initialized.
|
||||||
* protocol - Netlink socket protocol (see sys/socket.h)
|
* protocol - NetLink socket protocol (see sys/socket.h)
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) is returned on success. Otherwise, a negated errno value is
|
* Zero (OK) is returned on success. Otherwise, a negated errno value is
|
||||||
@@ -155,7 +155,7 @@ static int netlink_setup(FAR struct socket *psock, int protocol)
|
|||||||
|
|
||||||
if (domain == PF_NETLINK && (type == SOCK_RAW || type == SOCK_DGRAM))
|
if (domain == PF_NETLINK && (type == SOCK_RAW || type == SOCK_DGRAM))
|
||||||
{
|
{
|
||||||
/* Allocate the netlink socket connection structure and save it in the
|
/* Allocate the NetLink socket connection structure and save it in the
|
||||||
* new socket instance.
|
* new socket instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ static void netlink_addref(FAR struct socket *psock)
|
|||||||
* space (address family) but has no name assigned.
|
* space (address family) but has no name assigned.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* conn netlink socket connection structure
|
* conn NetLink socket connection structure
|
||||||
* addr Socket local address
|
* addr Socket local address
|
||||||
* addrlen Length of 'addr'
|
* addrlen Length of 'addr'
|
||||||
*
|
*
|
||||||
@@ -300,7 +300,7 @@ static int netlink_bind(FAR struct socket *psock,
|
|||||||
* the object pointed to by address is unspecified.
|
* the object pointed to by address is unspecified.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* conn netlink socket connection structure
|
* conn NetLink socket connection structure
|
||||||
* addr sockaddr structure to receive data [out]
|
* addr sockaddr structure to receive data [out]
|
||||||
* addrlen Length of sockaddr structure [in/out]
|
* addrlen Length of sockaddr structure [in/out]
|
||||||
*
|
*
|
||||||
@@ -460,12 +460,13 @@ static int netlink_connect(FAR struct socket *psock,
|
|||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock Reference to the listening socket structure
|
* psock Reference to the listening socket structure
|
||||||
* addr Receives the address of the connecting client
|
* addr Receives the address of the connecting client
|
||||||
* addrlen Input: allocated size of 'addr', Return: returned size of 'addr'
|
* addrlen Input: Allocated size of 'addr'
|
||||||
|
* Return: Actual size returned size of 'addr'
|
||||||
* newsock Location to return the accepted socket information.
|
* newsock Location to return the accepted socket information.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Returns 0 (OK) on success. On failure, it returns a negated errno
|
* Returns 0 (OK) on success. On failure, it returns a negated errno
|
||||||
* value. See accept() for a desrciption of the approriate error value.
|
* value. See accept() for a description of the appropriate error value.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* The network is locked.
|
* The network is locked.
|
||||||
@@ -489,7 +490,7 @@ static int netlink_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
|
|||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock - An instance of the internal socket structure.
|
* psock - An instance of the internal socket structure.
|
||||||
* fds - The structure describing the events to be monitored.
|
* fds - The structure describing the events to be monitored.
|
||||||
* setup - true: Setup up the poll; false: Teardown the poll
|
* setup - true: Setup up the poll; false: Tear down the poll
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* 0: Success; Negated errno on failure
|
* 0: Success; Negated errno on failure
|
||||||
@@ -628,7 +629,7 @@ static ssize_t netlink_sendto(FAR struct socket *psock, FAR const void *buf,
|
|||||||
* data on a socket whether or not it is connection-oriented.
|
* data on a socket whether or not it is connection-oriented.
|
||||||
*
|
*
|
||||||
* If from is not NULL, and the underlying protocol provides the source
|
* If from is not NULL, and the underlying protocol provides the source
|
||||||
* address, this source address is filled in. The argument fromlen
|
* address, this source address is filled in. The argument 'fromlen'
|
||||||
* initialized to the size of the buffer associated with from, and modified
|
* initialized to the size of the buffer associated with from, and modified
|
||||||
* on return to indicate the actual size of the address stored there.
|
* on return to indicate the actual size of the address stored there.
|
||||||
*
|
*
|
||||||
@@ -657,7 +658,7 @@ static ssize_t netlink_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
|
|
||||||
conn = (FAR struct netlink_conn_s *)psock->s_conn;
|
conn = (FAR struct netlink_conn_s *)psock->s_conn;
|
||||||
|
|
||||||
/* Get a reference to the netlink message */
|
/* Get a reference to the NetLink message */
|
||||||
|
|
||||||
nlmsg = (FAR struct nlmsghdr *)buf;
|
nlmsg = (FAR struct nlmsghdr *)buf;
|
||||||
|
|
||||||
@@ -687,7 +688,7 @@ static ssize_t netlink_recvfrom(FAR struct socket *psock, FAR void *buf,
|
|||||||
* Name: netlink_close
|
* Name: netlink_close
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the close operation on an NETLINK socket instance
|
* Performs the close operation on a NetLink socket instance
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* psock Socket instance
|
* psock Socket instance
|
||||||
|
|||||||
Reference in New Issue
Block a user