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 5272B13B2A4; Thu, 3 Oct 2024 08:33:52 +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=1727944432; cv=none; b=VKg9/WcP6T8DDUSR8A8enuaoH8E6506txps9fQ4+Jrrpn+dtFYpixkRdCLgZicNin9dRqOaOqqiRe8Ll/yMSuiPWKDmqphS0+W/Yv0/OqtgsfYULk+VOtXo3VS7QyK4hDvB5ovd0dUM0C6z8dXDpgpo+/uZjw83C2BHL65osdOY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727944432; c=relaxed/simple; bh=t9NCdJyZZVWNegvqtHbQXG06Vs/AZR9IoZ/MuxzH4j8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cZOP3JnAZtWeivhwhQif5g2hxCwRSMh975K3SMbHYBo3SOhsIrk4iHEIsXDBcwpbC9jMswplsoS/NA9nIjVjoAuEJmZWjTgV3F54lnV8fADMkl5nFHtjF2q0LNM6ePkTgrs1R2d6pYk8f3Vz295Yz8//zzOBWgI8Ougdfao9l2A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uMvqFrK5; 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="uMvqFrK5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD066C4CEC7; Thu, 3 Oct 2024 08:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727944431; bh=t9NCdJyZZVWNegvqtHbQXG06Vs/AZR9IoZ/MuxzH4j8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uMvqFrK5wTisMBMy2BU2/zMOBSpHxJKIS+iabq4XEt5oPI3RKYc4DngolQvSlOqyA WL71jQXEzXUxCSrAb2D+hpZ92qQ3StEFY/mv2sY+jtgktMzNBmX3gR636iUX0GC8c0 +p+oHYO8njVrY/GKLmfIeCSGdawJ05Xg87flRxa/ixkdvXNL/HPa3gs6A7JEP1h1oa rZJaRGb7PdghKiQ/T16iBpebEcuewl8CoX85AlNuH+AuJkcZNtSbSkeFwLQedyjVEn QkQVD3hGVPKgabMDKsQfhBNkHKitCCC/Ha30od3CtQGVF4AsT1RCS/+n+5S/xgkb2k fVzOEWWOnpg1w== Date: Thu, 3 Oct 2024 10:33:46 +0200 From: Christian Brauner To: Alice Ryhl Cc: Greg Kroah-Hartman , Arnd Bergmann , Miguel Ojeda , Alexander Viro , Jan Kara , Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Trevor Gross , rust-for-linux@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] rust: miscdevice: add base miscdevice abstraction Message-ID: <20241003-karotten-geist-0ac7914b4445@brauner> References: <20241001-b4-miscdevice-v2-0-330d760041fa@google.com> <20241001-b4-miscdevice-v2-2-330d760041fa@google.com> <20241002-ertrag-syntaktisch-6c18b81d6c90@brauner> 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; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Oct 02, 2024 at 04:24:58PM GMT, Alice Ryhl wrote: > On Wed, Oct 2, 2024 at 4:06 PM Christian Brauner wrote: > > > > On Tue, Oct 01, 2024 at 08:22:22AM GMT, Alice Ryhl wrote: > > > +unsafe extern "C" fn fops_open( > > > + inode: *mut bindings::inode, > > > + file: *mut bindings::file, > > > +) -> c_int { > > > + // SAFETY: The pointers are valid and for a file being opened. > > > + let ret = unsafe { bindings::generic_file_open(inode, file) }; > > > + if ret != 0 { > > > + return ret; > > > + } > > > > Do you have code where that function is used? Because this looks wrong > > or at least I don't understand from just a glance whether that > > generic_file_open() call makes sense. > > > > Illustrating how we get from opening /dev/binder to this call would > > help. > > Hmm. I wrote this by comparing with the ashmem open callback. Now that > you mention it you are right that Binder does not call > generic_file_open ... I have to admit that I don't know what > generic_file_open does. It's irrelevant for binder.