From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 078BA3655E9; Thu, 30 Oct 2025 15:42:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761838923; cv=none; b=t/PpsyWqZJPUv//NrDxeBOLpLimX9cs9WqPRHi7ARX/Yfw4ttszIYaoUgUMMN9wl+1gAlpi37wM4i5PyT/dgIu5M2saRYfn5jvaFNbkCHgeTnwd2e3CjjRgesl5TpuwZzaXlcRQbM09L45eyWohLgGJu78bohqBZACAS3ELqogs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761838923; c=relaxed/simple; bh=eozvD8BiZTEUnA7DiffXKpGEYQxiDYuYcu96Z+MljZ4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iH2zDWuOYRyfX+PI7+xg9JhamaMTyHxRrgDXs/ThnWI4UODgbl51vZc48U2ShllQDHA+mrre4xT1L5j5K1+Edkj+pC5tPXQOm3trYg+otgDkhFFzWqdyp52ueR9ou0EtVc+RvbZY/WtkERdDIFbvyyPpXLUoqZD5nZ4nojdUlLI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=opFa9EB3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="opFa9EB3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CDADC4CEFF; Thu, 30 Oct 2025 15:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761838922; bh=eozvD8BiZTEUnA7DiffXKpGEYQxiDYuYcu96Z+MljZ4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=opFa9EB3kf2HPWuKsWqldnW6T3nRIaodWxyQMElc5H5C/9w0CUkQx5fuiN+zz+GDJ 6oU6ojYp29KVqKQ4o9JOq7bm/wN1u8BZxnVIDxPxl05iQHAGd4LPaGxeNG6szm3zgz knzQfaNarq69pObXhbLlN0bNLGU4RiYlci4gRndRcaVWrJJIp3Ub09ZftRKnRxqy2S D/arenc3myE6nF65cBHYFGlOyukq9Muh69qOeXS/UhyE9C3/0Jbr87BAQSJQV1LcgU 2upr3k26lQtCXLCncsqm68XhP56t4O/0eNmEeAcnf27HNCUHEYbVCs9ub6ax7se+IC KZ9Baf7ZU9OUg== Message-ID: Date: Thu, 30 Oct 2025 16:41:54 +0100 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 1/4] rust: types: Add Ownable/Owned types To: Oliver Mangold Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Benno Lossin , Greg Kroah-Hartman , Dave Ertman , Ira Weiny , Leon Romanovsky , "Rafael J. Wysocki" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Alexander Viro , Christian Brauner , Jan Kara , Lorenzo Stoakes , "Liam R. Howlett" , Viresh Kumar , Nishanth Menon , Stephen Boyd , Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Asahi Lina , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-pci@vger.kernel.org References: <20251001-unique-ref-v12-0-fa5c31f0c0c4@pm.me> <20251001-unique-ref-v12-1-fa5c31f0c0c4@pm.me> From: Danilo Krummrich Content-Language: en-US In-Reply-To: <20251001-unique-ref-v12-1-fa5c31f0c0c4@pm.me> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/1/25 11:03 AM, Oliver Mangold wrote: > From: Asahi Lina > > By analogy to `AlwaysRefCounted` and `ARef`, an `Ownable` type is a > (typically C FFI) type that *may* be owned by Rust, but need not be. Unlike > `AlwaysRefCounted`, this mechanism expects the reference to be unique > within Rust, and does not allow cloning. > > Conceptually, this is similar to a `KBox`, except that it delegates > resource management to the `T` instead of using a generic allocator. > > [ om: > - Split code into separate file and `pub use` it from types.rs. > - Make from_raw() and into_raw() public. > - Remove OwnableMut, and make DerefMut dependent on Unpin instead. > - Usage example/doctest for Ownable/Owned. > - Fixes to documentation and commit message. > ] > > Link: https://lore.kernel.org/all/20250202-rust-page-v1-1-e3170d7fe55e@asahilina.net/ > Signed-off-by: Asahi Lina > Co-developed-by: Oliver Mangold > Signed-off-by: Oliver Mangold > Reviewed-by: Boqun Feng I think this patch was originally sent by Abdiel and Boqun [1]; we should probably take this into account. :) [1] https://lore.kernel.org/rust-for-linux/20241022224832.1505432-2-abdiel.janulgue@gmail.com/