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 B0EAA1C68B6; Wed, 19 Feb 2025 08:38:16 +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=1739954296; cv=none; b=Y7uwBMyamSCeaPsIKNd3IMoBkGfgggBwVkTgnJdXbqEC7mNrjS/uarlvQbPScAYPCCQ4znqFx2WoLJP0TxU46zYr+51a5+SU54JgTwk9wg9/jPCgBs+noArfcMCPITKXGQsTM4+e93DgsZnc3zNGvo/Q5MOC1d11+rhsOdAmXbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739954296; c=relaxed/simple; bh=hk/K7Xy7+TFm7X+Cn6nnIxxhnI2tKh7frk+g37U2Q3I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=oE5MkctxSTRK9AkGKLU4AG22Jb+lJhoELxRWwHwfRURUSOeOkj+o/yLHLEL6dsk9iffm/HhNXm0HOOEkfOdThZYU5tpbPHw7pr2thBjxpu8BNE6He4rMPT1v89kVU9jSNPSWt3Or88X/p22/LBQnVzzCnDshUd/vdrOsfR95VsU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CdiEO0bX; 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="CdiEO0bX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9381CC4CEE6; Wed, 19 Feb 2025 08:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739954296; bh=hk/K7Xy7+TFm7X+Cn6nnIxxhnI2tKh7frk+g37U2Q3I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CdiEO0bXmEsZKXKRm0QcP4p39t9yOvQaGKeztiXyCnaLcA+iLGYNj3M7FDnz60HT0 IlZRSHn5bf8rt8snl1f97UsInPv0X+dtmdiwfqW/Son+bpG512eW8srjisHQ+NjyeA Lht9aAWWsN1fkZlJAXCyBovI6hMUp6xNPciTCEdnTUbXl631eqHtSVunWCVtcEPCFF c4/pGLrZTSqfoIZs62RSylT05bhAGNYWhluDhB3HmOeJqaHpuz5MRXYBs/Lh2554Yu W8M5soPpqrgv4BpgF2eAI22kg6QjPB2eHie8rS5eNWykXdgBjMe7qGYuVMs+jf5xK3 jHy8G32JIuT2Q== From: Andreas Hindborg To: "Asahi Lina" Cc: "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , "Benno Lossin" , "Alice Ryhl" , "Trevor Gross" , "Jann Horn" , "Matthew Wilcox" , "Paolo Bonzini" , "Danilo Krummrich" , "Wedson Almeida Filho" , "Valentin Obst" , "Andrew Morton" , , , "Abdiel Janulgue" , , , Subject: Re: [PATCH 1/6] rust: types: Add Ownable/Owned types In-Reply-To: <20250202-rust-page-v1-1-e3170d7fe55e@asahilina.net> (Asahi Lina's message of "Sun, 02 Feb 2025 22:05:43 +0900") References: <20250202-rust-page-v1-0-e3170d7fe55e@asahilina.net> <20250202-rust-page-v1-1-e3170d7fe55e@asahilina.net> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Wed, 19 Feb 2025 09:37:50 +0100 Message-ID: <87h64qe3dt.fsf@kernel.org> 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 "Asahi Lina" writes: > 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. > > Signed-off-by: Asahi Lina Over all looks good to me - I agree with the points already discussed. Could you put it in a separate module and file? `kernel::types::ownable` and then `pub use` in `types.rs`. `types.rs` is getting quite busy. Best regards, Andreas Hindborg