From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 6BE9D5A026D for ; Wed, 5 Apr 2023 13:58:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680695928; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tj3BiWvUUSpIZszdz/93O+0uScpbhDbWK5y87hxmGuA=; b=Bfu54MOa0H3jegnwWPInb4XLhLU8xr3oPojxnhsgK0JIEcfEoS0e4FyKti9m2TsYs79AV8 c4e+dvzSjr6qglOQsB3Ltgt+bpS2q9qn9AL9M/ejHaF0RRlKWYtKpNgMOLCNAq8QlBd7/4 lZTKxQNWKzyFe5VMYP28MIXdsfp613k= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-671-3m8WqAPkOA6UxdaWbk52Hg-1; Wed, 05 Apr 2023 07:58:47 -0400 X-MC-Unique: 3m8WqAPkOA6UxdaWbk52Hg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C195F3C0F673; Wed, 5 Apr 2023 11:58:46 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D409C35999; Wed, 5 Apr 2023 11:58:45 +0000 (UTC) Date: Wed, 5 Apr 2023 13:58:44 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 08/14] nstool: Helpers to iterate through namespace types Message-ID: <20230405135844.26b4e08d@elisabeth> In-Reply-To: <20230404014638.3225556-9-david@gibson.dropbear.id.au> References: <20230404014638.3225556-1-david@gibson.dropbear.id.au> <20230404014638.3225556-9-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: H5QMBZHJ24CZVBWKT7TZOLK3543LZ3BV X-Message-ID-Hash: H5QMBZHJ24CZVBWKT7TZOLK3543LZ3BV X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 4 Apr 2023 11:46:32 +1000 David Gibson wrote: > Will make things a bit less verbose in future. > > Signed-off-by: David Gibson > --- > test/nstool.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) > > diff --git a/test/nstool.c b/test/nstool.c > index e995f3e..5681ce8 100644 > --- a/test/nstool.c > +++ b/test/nstool.c > @@ -46,6 +46,14 @@ const struct ns_type nstypes[] = { > { CLONE_NEWUTS, "uts" }, > }; > > +#define for_each_nst(_nst, _flags) \ > + for ((_nst) = &nstypes[0]; \ > + ((_nst) - nstypes) < ARRAY_SIZE(nstypes); \ > + (_nst)++) \ > + if ((_flags) & (_nst)->flag) > + > +#define for_every_nst(_nst) for_each_nst(_nst, 0x7fffffff) Strictly speaking this should be 0x7fffff00 (minus CSIGNAL). -- Stefano