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 974555A026F for ; Thu, 2 Nov 2023 19:07:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698948450; 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=oX9hgQ5iWvx710EZdzpGFJwoJhhYD9mdIj/87fsF2RU=; b=cNuuj6m4E169GQZpJbCyRq3mYoLUwPMQlYfHqRln5+TGhQv3xwX5GRdCs/X+Gf2UhvF7oP ZPM5mfWFTesGESOw3F1LUzBJuQVvBGFGvBax5SJxVxqX2loRW0fiIRxI6wH4xil47X4HFp wgV056Uv1BAlQKLZMQVjqudfy/Q7uYU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-niA4uvPoPYKlS-8Z8S6O9w-1; Thu, 02 Nov 2023 14:07:28 -0400 X-MC-Unique: niA4uvPoPYKlS-8Z8S6O9w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B86E836F36; Thu, 2 Nov 2023 18:07:28 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5711A502D; Thu, 2 Nov 2023 18:07:27 +0000 (UTC) Date: Thu, 2 Nov 2023 19:07:25 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 4/9] util: Add open_in_ns() helper Message-ID: <20231102190725.1c797252@elisabeth> In-Reply-To: <20231005034445.2015303-5-david@gibson.dropbear.id.au> References: <20231005034445.2015303-1-david@gibson.dropbear.id.au> <20231005034445.2015303-5-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: Q64NNCDA6IIUPURUVP63THSLB2OYY7KN X-Message-ID-Hash: Q64NNCDA6IIUPURUVP63THSLB2OYY7KN 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 Thu, 5 Oct 2023 14:44:40 +1100 David Gibson wrote: > Most of our helpers which need to enter the pasta network namespace are > quite specialised. Add one which is rather general - it just open()s a > given file in the namespace context and returns the fd back to the main > namespace. This will have some future uses. > > Signed-off-by: David Gibson > --- > util.c | 39 +++++++++++++++++++++++++++++++++++++++ > util.h | 1 + > 2 files changed, 40 insertions(+) > > diff --git a/util.c b/util.c > index a8f3b35..92ad375 100644 > --- a/util.c > +++ b/util.c > @@ -364,6 +364,45 @@ bool ns_is_init(void) > return ret; > } > > +struct open_in_ns_args { It would be nice to have the usual kerneldoc-style comment to this (at a first reading: are "flags" the flags for open(2) or something specialised for internal use?). > + const struct ctx *c; > + int fd; > + int err; > + const char *path; > + int flags; > +}; > + > +static int do_open_in_ns(void *arg) Same for this one. The rest of the series makes sense and looks good to me. -- Stefano