From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F396C194A53 for ; Sun, 16 Feb 2025 16:12:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.67.36.66 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739722368; cv=none; b=Kr0YHzcH7ANjlO04Qp5W5wEJC/csIS9TRl0AYQSLJOk4iMjUyGnueDb1vYueHPUuUP3Km2qIy6gY4tmnUMA+OhJ2H0/lxQNerzyUt/AMbXg6zzb2KR8+l4fk/lrXaIjcP2dj2y+HHF9cAEOdwkCHIZeFHlYZsT3smKAFreIO+MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739722368; c=relaxed/simple; bh=723XmAli1Pr4klnTxzebdDpR93Vg/3V7DVZwDO2NZ1Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=lem60VyhaFkLSbk9mRUGWc+3zEKZe2ttmlp+6HgH7qLU3aYsHoYx1kHIKK+oFLRon1YCbIjkqsUxhjuHGIEN2h2JZoA6v16Lwk61hJGqgWo0D7n0e/dLk1AaZoAGI/5WPOnvoi0uDe5di8u2s6ap4BqEh7LF72PpUKGqZi5TAj4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=posteo.net; spf=pass smtp.mailfrom=posteo.net; dkim=pass (2048-bit key) header.d=posteo.net header.i=@posteo.net header.b=PlHTgw5T; arc=none smtp.client-ip=185.67.36.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=posteo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=posteo.net header.i=@posteo.net header.b="PlHTgw5T" Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 58043240103 for ; Sun, 16 Feb 2025 17:12:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1739722364; bh=723XmAli1Pr4klnTxzebdDpR93Vg/3V7DVZwDO2NZ1Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=PlHTgw5TK4JZbwxe1lIKjtI0c9nZ5fEPypUgrfkJl07xkXaOUs4Ug86RsVzQ8ftXM m/J2UmS9yACzkYa/cM1hbKaq4+CBYbNMyJDjarmiiFVjbe1Ny0kZKDbHIVGv0YDenU ZAgViUjFT83abrfNSK8EEAhElpvz9Lk8yD92IRhKMLKPbP++a34tXs7xOZPpba8DkX hqpIZAP3I4EzS6Nn7E2N9uW6k99kTJbePYSbFOJGF3jghMyeSPM1CiE34Mwz3fiMqR FXzyq6L8jYpVlCPnqG8I2KYcLlo4wNxdMy7xlgvnW1GS1wdI4T9ny2iN2T/g9lp07L QrsDh4TI7BNKA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YwrRF0Cbnz6ty5; Sun, 16 Feb 2025 17:12:40 +0100 (CET) From: Charalampos Mitrodimas To: Andreas Hindborg Cc: Danilo Krummrich , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Trevor Gross , Joel Becker , Christoph Hellwig , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Fiona Behrens , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] rust: configfs: introduce rust support for configfs In-Reply-To: <20250207-configfs-v2-2-f7a60b24d38e@kernel.org> References: <20250207-configfs-v2-0-f7a60b24d38e@kernel.org> <20250207-configfs-v2-2-f7a60b24d38e@kernel.org> Date: Sun, 16 Feb 2025 16:12:40 +0000 Message-ID: Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Andreas Hindborg writes: > diff --git a/samples/rust/rust_configfs.rs b/samples/rust/rust_configfs.rs > new file mode 100644 > index 0000000000000..fe896e66efb41 > --- /dev/null > +++ b/samples/rust/rust_configfs.rs > @@ -0,0 +1,186 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +//! Rust configfs sample. > + > +use kernel::alloc::flags; > +use kernel::c_str; [...snip...] > +impl Configuration { > + fn new() -> impl PinInit { > + try_pin_init!(Self { > + message: c_str!("Hello World\n"), > + bar <- new_mutex!((KBox::new([0;4096], flags::GFP_KERNEL)?,0)), > + }) > + } > +} > + > +impl kernel::InPlaceModule for RustConfigfs { > + fn init(_module: &'static ThisModule) -> impl PinInit { > + pr_info!("Rust configfs sample (init)\n"); > + > + let item_type = configfs_attrs! { > + container: configfs::Subsystem, > + data: Configuration, > + child: Child, > + attributes: [ > + message: 0, > + bar: 1, > + ], > + }; > + > + try_pin_init!(Self { > + config <- configfs::Subsystem::new( > + kernel::c_str!("rust_configfs"), item_type, Configuration::new() Hi Andreas, One more nit I found, "kernel::c_str" is already imported in the sample. So this can be changed to "c_str!("rust_configfs")". C. Mitrodimas > + ), > + }) > + } > +} > +