Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Feb 2021 16:27:11 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Lutz Donnerhacke <donner@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: bb67e52db143 - main - netgraph/ng_bridge: Make simple internal functions read-only
Message-ID:  <CAGudoHHwbpubWJ=pNcjgkn4ND_v3Hfp%2BuLN0rGF1VrvQcSFJaQ@mail.gmail.com>
In-Reply-To: <202102071440.117Eep3U033223@gitrepo.freebsd.org>
References:  <202102071440.117Eep3U033223@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
One of your commits mass breaks LINT kernels:

arm LINT kernel failed, check _.arm.LINT for details
riscv LINT kernel failed, check _.riscv.LINT for details
arm64 LINT kernel failed, check _.arm64.LINT for details
i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details
i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details
i386 LINT kernel failed, check _.i386.LINT for details
i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details
powerpc LINT64 kernel failed, check _.powerpc.LINT64 for details
powerpc LINT kernel failed, check _.powerpc.LINT for details
amd64 LINT kernel failed, check _.amd64.LINT for details
amd64 LINT-NOIP kernel failed, check _.amd64.LINT-NOIP for details
amd64 LINT-NOINET kernel failed, check _.amd64.LINT-NOINET for details
amd64 LINT-NOINET6 kernel failed, check _.amd64.LINT-NOINET6 for details

/usr/src/sys/netgraph/ng_base.c:841:28: error: passing 'node_cp' (aka
'const struct ng_node *') to parameter of type 'node_p' (aka 'stru
ct ng_node *') discards qualifiers
[-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        return (node ? NG_NODE_ID(node) : 0);
                                  ^~~~
/usr/src/sys/netgraph/netgraph.h:580:39: note: expanded from macro 'NG_NODE_ID'
#define NG_NODE_ID(node)                _ng_node_id(node, _NN_)
                                                    ^~~~
/usr/src/sys/netgraph/netgraph.h:485:20: note: passing argument to
parameter 'node' here
_ng_node_id(node_p node, char *file, int line)


On 2/7/21, Lutz Donnerhacke <donner@freebsd.org> wrote:
> The branch main has been updated by donner:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=bb67e52db143b699bdac1830717930b26a7b5766
>
> commit bb67e52db143b699bdac1830717930b26a7b5766
> Author:     Lutz Donnerhacke <donner@FreeBSD.org>
> AuthorDate: 2021-01-13 22:18:55 +0000
> Commit:     Lutz Donnerhacke <donner@FreeBSD.org>
> CommitDate: 2021-02-07 14:39:57 +0000
>
>     netgraph/ng_bridge: Make simple internal functions read-only
>
>     The data path in netgraph is designed to work on an read only state of
>     the whole netgraph network.  Currently this is achived by convetion,
>     there is no technical enforcment.  This patch is part of a series to
>     make ng_brigde multithreaded, which is done by rewrite the data path
>     to const handling.
>
>     Reviewed By:    kp
>     MFC after:      2 weeks
>     Differential Revision: https://reviews.freebsd.org/D28141
> ---
>  sys/netgraph/netgraph.h  |  5 ++++-
>  sys/netgraph/ng_base.c   |  2 +-
>  sys/netgraph/ng_bridge.c | 10 ++++++----
>  3 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h
> index 7535472dc631..5040471c5ce0 100644
> --- a/sys/netgraph/netgraph.h
> +++ b/sys/netgraph/netgraph.h
> @@ -87,6 +87,9 @@ struct ng_item ;
>  typedef	struct ng_item *item_p;
>  typedef struct ng_node *node_p;
>  typedef struct ng_hook *hook_p;
> +typedef	struct ng_item const *item_cp;
> +typedef struct ng_node const *node_cp;
> +typedef struct ng_hook const *hook_cp;
>
>  /* node method definitions */
>  typedef	int	ng_constructor_t(node_p node);
> @@ -1139,7 +1142,7 @@ int	ng_make_node_common(struct ng_type *typep, node_p
> *nodep);
>  int	ng_name_node(node_p node, const char *name);
>  node_p	ng_name2noderef(node_p node, const char *name);
>  int	ng_newtype(struct ng_type *tp);
> -ng_ID_t ng_node2ID(node_p node);
> +ng_ID_t ng_node2ID(node_cp node);
>  item_p	ng_package_data(struct mbuf *m, int flags);
>  item_p	ng_package_msg(struct ng_mesg *msg, int flags);
>  item_p	ng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg);
> diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
> index dadf86eb8dde..6ab39421b255 100644
> --- a/sys/netgraph/ng_base.c
> +++ b/sys/netgraph/ng_base.c
> @@ -836,7 +836,7 @@ ng_ID2noderef(ng_ID_t ID)
>  }
>
>  ng_ID_t
> -ng_node2ID(node_p node)
> +ng_node2ID(node_cp node)
>  {
>  	return (node ? NG_NODE_ID(node) : 0);
>  }
> diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c
> index 4898a55f1463..d5b3b520a497 100644
> --- a/sys/netgraph/ng_bridge.c
> +++ b/sys/netgraph/ng_bridge.c
> @@ -115,6 +115,7 @@ struct ng_bridge_link {
>  					sendUnknown : 1;/* send unknown macs out */
>  	struct ng_bridge_link_kernel_stats stats;	/* link stats */
>  };
> +typedef struct ng_bridge_link const *link_cp;	/* read only access */
>
>  /* Per-node private data */
>  struct ng_bridge_private {
> @@ -130,6 +131,7 @@ struct ng_bridge_private {
>  	struct callout		timer;		/* one second periodic timer */
>  };
>  typedef struct ng_bridge_private *priv_p;
> +typedef struct ng_bridge_private const *priv_cp;	/* read only access */
>
>  /* Information about a host, stored in a hash table entry */
>  struct ng_bridge_hent {
> @@ -149,12 +151,12 @@ static ng_rcvdata_t	ng_bridge_rcvdata;
>  static ng_disconnect_t	ng_bridge_disconnect;
>
>  /* Other internal functions */
> -static struct	ng_bridge_host *ng_bridge_get(priv_p priv, const u_char
> *addr);
> +static struct	ng_bridge_host *ng_bridge_get(priv_cp priv, const u_char
> *addr);
>  static int	ng_bridge_put(priv_p priv, const u_char *addr, link_p link);
>  static void	ng_bridge_rehash(priv_p priv);
>  static void	ng_bridge_remove_hosts(priv_p priv, link_p link);
>  static void	ng_bridge_timeout(node_p node, hook_p hook, void *arg1, int
> arg2);
> -static const	char *ng_bridge_nodename(node_p node);
> +static const	char *ng_bridge_nodename(node_cp node);
>
>  /* Ethernet broadcast */
>  static const u_char ng_bridge_bcast_addr[ETHER_ADDR_LEN] =
> @@ -920,7 +922,7 @@ ng_bridge_disconnect(hook_p hook)
>   * Find a host entry in the table.
>   */
>  static struct ng_bridge_host *
> -ng_bridge_get(priv_p priv, const u_char *addr)
> +ng_bridge_get(priv_cp priv, const u_char *addr)
>  {
>  	const int bucket = HASH(addr, priv->hashMask);
>  	struct ng_bridge_hent *hent;
> @@ -1131,7 +1133,7 @@ ng_bridge_timeout(node_p node, hook_p hook, void
> *arg1, int arg2)
>   * Return node's "name", even if it doesn't have one.
>   */
>  static const char *
> -ng_bridge_nodename(node_p node)
> +ng_bridge_nodename(node_cp node)
>  {
>  	static char name[NG_NODESIZ];
>
>


-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHHwbpubWJ=pNcjgkn4ND_v3Hfp%2BuLN0rGF1VrvQcSFJaQ>