From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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 D872237F741 for ; Fri, 3 Jul 2026 11:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783078046; cv=none; b=ahDq4JEwABjUCHhpwAXEkDzmODdkxuTBDq7rogbThbb8vD7bQKdm5CRkTx5uZNVwPaCSE7Coexv3cun5Y9Rz5IHPnxTqxnpf7SbBj9BGlyxbW/1ycY7eskGZen3pnfN2jpucyCQeYrqvTFxZoQqQQSKqHEW9KCwqsxozny6SUpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783078046; c=relaxed/simple; bh=fczmlqtZfq0vprAPUG95kYdtXs/J4w2VAcRNtvMWn5s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WOs34ttI2xAL+9LgunmDQ+uDE46jFbZPITnwfcq4n0PsLbBkSAtvXNpRZscXLEJ3Rt2N2/h0tGqsKx3M1GnOFdLBygKkn/jXAIK7F2gDZVOUrsFPZytnGGXxYeOIYthxb9uvjkYsr4kgBFK1/rA5bIhVsbjvmh2Aj3FccdlwEyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=F44VM6wX; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=YWZ3+5JV; arc=none smtp.client-ip=202.12.124.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="F44VM6wX"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YWZ3+5JV" Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4DD2B7A012E; Fri, 3 Jul 2026 07:27:21 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Fri, 03 Jul 2026 07:27:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1783078041; x=1783164441; bh=AgqafCS1Gl izvk6UlTjdtbmkZ5M6f5HP8kIpahQsVPI=; b=F44VM6wXFogZMIa144PPernWlu flvW/9yzQW6b0Bt5s8gJrOuO1DfsF3R25Sby6jWfTKoYiEzZdE5zkU2baf2l7VUW YbhvlVytnBCDP734M69K0SmYAo57UnT7UHGGdKCtHo0yGuJkGHPW+DX2QX2ddXgh NAZsZq4EHg5UNJ43XQs42O3CiGwPPQaN4QQJkGBMwsz0P2GXJ7HqcmyrDqDv0cp3 IxWQXwynhcPnmqpgZRgskuXzPZwE5taYExAJzM8021/waQQwSc4/7iAH/0N12zU1 rDLcEc9VdsSBpqpRrkRYyeWwlV9/8E3a4sE6ed4eyo9Zm9bWi3fAVKnZhQjw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1783078041; x=1783164441; bh=AgqafCS1Glizvk6Ul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nfQ0rRYf6Ylc6G8VStDdNu8CPKA X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Jul 2026 07:27:20 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id b6e9401a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 3 Jul 2026 11:27:18 +0000 (UTC) Date: Fri, 3 Jul 2026 13:27:15 +0200 From: Patrick Steinhardt To: Jeff King Cc: Junio C Hamano , git@vger.kernel.org Subject: Re: [PATCH 1/9] csum-file: drop discard_hashfile() Message-ID: References: <20260702075234.GA1548258@coredump.intra.peff.net> <20260702075744.GA2029434@coredump.intra.peff.net> <20260702210601.GA2051171@coredump.intra.peff.net> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260702210601.GA2051171@coredump.intra.peff.net> On Thu, Jul 02, 2026 at 05:06:01PM -0400, Jeff King wrote: > On Thu, Jul 02, 2026 at 11:19:04AM -0700, Junio C Hamano wrote: > > > Jeff King writes: > > > > > So now we have two functions, discard_hashfile() and free_hashfile(), > > > and we only need one. Which one do we want to keep? > > > > > > The only difference between them is that the discard variant also closes > > > the descriptors held in the struct. Let's look at the three callers: > > > ... > > > Note that I said "descriptors" plural above. Those callers all care > > > about the "fd" member of the struct. But discard_hashfile() also closes > > > check_fd. That is only used if the struct is initialized with > > > hashfd_check(), and neither of its two callers call either discard or > > > free (they always "finalize" instead). So closing it is irrelevant for > > > the current callers. > > > > > > I think we're better off sticking with the simpler free_hashfile() > > > interface, and the handful of callers can decide how to handle the > > > descriptors themselves. > > > > Sonds good. > > > > Our resident naming czar (already Cc'ed) may have preference about > > the names and word order, though ;-) > > Heh, yes, it should be hashfile_free() but that would require changing > the whole interface. We could do that on top, which might also be a good > time to do s/free/discard/ without worrying about a subtle behavior > change. Heh :P I think this being called a "free" function makes perfect sense, because ultimately that's all we do here. So the semantics align with other free functions. We could of course fix the ordering while at it, but I don't want to tack that onto this series. It already makes the codebase a better place, so I'm happy enough. Patrick