From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 A218F1D5CFE for ; Fri, 17 Apr 2026 02:17:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776392247; cv=none; b=IAxfyJDlJKUy+tRsdMBKdrbcCTN+JNPe1xTrLdmwuclS+6PUh5BnxY/YbAMo3tlHKt8ZuQfc7NBEW5HSzbsilge7e/PZwoN5V7q8LgPMWxN/wjKuFn2XLfT0om892iwMVGY4R2WpCwAWhij7xyZ8D53PjkBFAENI7pv+1ouxmkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776392247; c=relaxed/simple; bh=rivnrE2zdXiTe6uA9F655U7A63sKNhxL2j1BO99/KNM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ufS9fgNDJsJxoVv0OLhp87UxrQTK7Rczg9tOFstC3/pzH3GWhQ8F1y8uTjsuaRpy1KNu22u0fOzfqz5pjYMhrdE1QIpGfSskQea/OnX3LWlUocvUiL+BlfaRizol0xA0G12Ktk/SLe5pleA3kMNNM/gyG3c2hvX9jhfA7+8vGTI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ePuf2bAf; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ePuf2bAf" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776392242; 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=OpE0Ez+CfIoCGnUqity0iKPTIYaJICOJp37vNEf2Pwk=; b=ePuf2bAfPWmOfImJwnTQrq5T9bUWrri+n7NIsp9KYnA7oO4nDzM/fUB3u3FeYxVV4Yj8rb rfunkJ4LPwc2adnexxRrsZfpZc7edlQSEbIYcXfKfuVNYxFuMjtjok63FVo/rbLN3G+OLv RsoxMO0TywgV/aDVUFRtorhw0NJoElM= Date: Fri, 17 Apr 2026 10:16:57 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 4/4] rust: xarray: Add Guard::find() helper To: Matthew Wilcox Cc: Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Lorenzo Stoakes , "Liam R. Howlett" , Tamir Duberstein , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?UTF-8?Q?Onur_=C3=96zkan?= References: <20260417-tyr-ioctls-deps-v1-0-41c6e9bb061c@linux.dev> <20260417-tyr-ioctls-deps-v1-4-41c6e9bb061c@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvin Sun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 4/17/26 09:18, Matthew Wilcox wrote: > On Fri, Apr 17, 2026 at 09:05:54AM +0800, Alvin Sun wrote: >> Add a helper to find the first present entry in the XArray. > Why would you expose a function which does striclty less than the > underlying C implementation, rather than exposing all the functionality > that xa_find does? > >> Returns the index of the first present entry, or None if the array >> is empty. > Why not return the value found, like xa_find() does? Hi Matthew, Thanks for the feedback! I had considered both returning a tuple (key, &value) and an Entry struct, but only returned the key since that's all Tyr currently needs. I'll look at other Rust code to see which approach fits better, then implement it properly in v2. Best regards, Alvin > > This is all very troubling. I don't think Rust should depart from > what C has without good reason. >