diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h index 4d9701ef870..0142085159b 100644 --- a/net/netlink/netlink.h +++ b/net/netlink/netlink.h @@ -66,7 +66,7 @@ * until it is gotten by the client. This structure holds that buffered * 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. */ @@ -74,6 +74,8 @@ struct netlink_response_s { sq_entry_t flink; FAR struct nlmsghdr msg; + + /* Message-specific data may follow */ }; #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 */ - /* 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 * 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 groups; /* Multicast groups mask (if bound) */ @@ -140,7 +142,7 @@ void netlink_initialize(void); * Name: netlink_alloc() * * 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 * ****************************************************************************/ @@ -151,7 +153,7 @@ FAR struct netlink_conn_s *netlink_alloc(void); * Name: netlink_free() * * 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(). * ****************************************************************************/ @@ -162,10 +164,10 @@ void netlink_free(FAR struct netlink_conn_s *conn); * Name: netlink_nextconn() * * Description: - * Traverse the list of allocated netlink connections + * Traverse the list of allocated NetLink connections * * 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: * Find a connection structure that is the appropriate connection for the - * provided netlink address + * provided NetLink address * ****************************************************************************/ diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c index 1e9aae169f1..cfc53359f09 100644 --- a/net/netlink/netlink_conn.c +++ b/net/netlink/netlink_conn.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -61,16 +61,16 @@ * 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]; -/* A list of all free netlink connections */ +/* A list of all free NetLink connections */ static dq_queue_t g_free_netlink_connections; 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; @@ -145,7 +145,7 @@ void netlink_initialize(void) * Name: netlink_alloc() * * 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 * ****************************************************************************/ @@ -177,7 +177,7 @@ FAR struct netlink_conn_s *netlink_alloc(void) * Name: netlink_free() * * 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(). * ****************************************************************************/ @@ -217,10 +217,10 @@ void netlink_free(FAR struct netlink_conn_s *conn) * Name: netlink_nextconn() * * Description: - * Traverse the list of allocated netlink connections + * Traverse the list of allocated NetLink connections * * 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: * Find a connection structure that is the appropriate connection for the - * provided netlink address + * provided NetLink address * * Assumptions: * diff --git a/net/netlink/netlink_route.c b/net/netlink/netlink_route.c index 630d9293baf..79bf2b13af2 100644 --- a/net/netlink/netlink_route.c +++ b/net/netlink/netlink_route.c @@ -71,19 +71,15 @@ /* RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH * 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 nlmsghdr hdr; 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 nlmsghdr hdr; diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index 92383734881..e3bd7304227 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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: * psock - A pointer to a user allocated socket structure to be * initialized. - * protocol - Netlink socket protocol (see sys/socket.h) + * protocol - NetLink socket protocol (see sys/socket.h) * * Returned Value: * 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)) { - /* 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. */ @@ -243,7 +243,7 @@ static void netlink_addref(FAR struct socket *psock) * space (address family) but has no name assigned. * * Input Parameters: - * conn netlink socket connection structure + * conn NetLink socket connection structure * addr Socket local address * addrlen Length of 'addr' * @@ -300,7 +300,7 @@ static int netlink_bind(FAR struct socket *psock, * the object pointed to by address is unspecified. * * Input Parameters: - * conn netlink socket connection structure + * conn NetLink socket connection structure * addr sockaddr structure to receive data [out] * addrlen Length of sockaddr structure [in/out] * @@ -460,12 +460,13 @@ static int netlink_connect(FAR struct socket *psock, * Input Parameters: * psock Reference to the listening socket structure * 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. * * Returned Value: * 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: * The network is locked. @@ -489,7 +490,7 @@ static int netlink_accept(FAR struct socket *psock, FAR struct sockaddr *addr, * Input Parameters: * psock - An instance of the internal socket structure. * 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: * 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. * * 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 * 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; - /* Get a reference to the netlink message */ + /* Get a reference to the NetLink message */ nlmsg = (FAR struct nlmsghdr *)buf; @@ -687,7 +688,7 @@ static ssize_t netlink_recvfrom(FAR struct socket *psock, FAR void *buf, * Name: netlink_close * * Description: - * Performs the close operation on an NETLINK socket instance + * Performs the close operation on a NetLink socket instance * * Input Parameters: * psock Socket instance