On Thu, Nov 30, 2023 at 01:45:25PM +0100, Stefano Brivio wrote: > On Thu, 30 Nov 2023 13:02:20 +1100 > David Gibson wrote: > > > Future debugging will want to identify a specific passt interface. We make > > a distinction in these helpers between the name of the *type* of pif, and > > name of the pif itself. For the time being these are always the same > > thing, since we have at most instance of each type of pif. However, that > > might change in future. > > > > Signed-off-by: David Gibson > > --- > > Makefile | 3 ++- > > pif.c | 21 +++++++++++++++++++++ > > pif.h | 19 +++++++++++++++++++ > > 3 files changed, 42 insertions(+), 1 deletion(-) > > create mode 100644 pif.c > > > > diff --git a/Makefile b/Makefile > > index d14b029..af4fa87 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -46,7 +46,8 @@ FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) > > > > PASST_SRCS = arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c flow.c icmp.c \ > > igmp.c isolation.c lineread.c log.c mld.c ndp.c netlink.c packet.c \ > > - passt.c pasta.c pcap.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c util.c > > + passt.c pasta.c pcap.c pif.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c \ > > + util.c > > QRAP_SRCS = qrap.c > > SRCS = $(PASST_SRCS) $(QRAP_SRCS) > > > > diff --git a/pif.c b/pif.c > > new file mode 100644 > > index 0000000..ebf01cc > > --- /dev/null > > +++ b/pif.c > > @@ -0,0 +1,21 @@ > > +/* SPDX-License-Identifier: GPL-2.0-or-later > > + * Copyright Red Hat > > + * Author: David Gibson > > + * > > + * Passt/pasta interface types and IDs > > + */ > > + > > +#include > > +#include > > + > > +#include "util.h" > > +#include "pif.h" > > + > > +const char *pif_type_str[] = { > > + [PIF_NONE] = "", > > + [PIF_HOST] = "HOST", > > + [PIF_TAP] = "TAP", > > + [PIF_SPLICE] = "SPLICE", > > Nit, not worth respinning in my opinion: those are just English > nouns, not acronyms, so they could simply be printed as "host", "tap", > and "splice". I'd been thinking of pif names in caps to make them stand out from other things, but it doesn't really matter that much. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson