From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D772C28B2B for ; Tue, 16 Aug 2022 16:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234098AbiHPQc1 (ORCPT ); Tue, 16 Aug 2022 12:32:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236528AbiHPQcO (ORCPT ); Tue, 16 Aug 2022 12:32:14 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F67804B4 for ; Tue, 16 Aug 2022 09:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=33mlf84VeN3RMXDr4wbd7gccNqGp6bNVLWgscw/BVOo=; b=dT67gmR2osXhxvwGgRunD4uD/j ajLvsB4JYa0Ges0V+HMVA/fSd/Bj5Ediu1mErf3TpiScaZNya0eFX77M53ir3WoTLDxB7NusKfBxT CnsKosxYvpizuGGmHZokuYCz7mb4IMa5AO6e1CZB/us2/Evz3Q0Tkhn724wj76nWWPZ77kh32zbyT IDSlr2YxWZNLRxBp1zouTbXvnmP4ZygTniTLT/T4CZcXsh9jc88RTG+hpawHy6QTl63wTIgMJeW0M TJw7VlJpSb8i0ib3p9NbbiEZxg+cGtyukl75ZIe9Wthyjz7+LZqxMbNr+g2WHDY6Of7/sr0Nn6LjL bXn0ms3g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.95 #2 (Red Hat Linux)) id 1oNzU8-00577O-SC; Tue, 16 Aug 2022 16:32:08 +0000 Date: Tue, 16 Aug 2022 17:32:08 +0100 From: Al Viro To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds Subject: Re: [RFC][PATCH] Change calling conventions for filldir_t Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, Aug 16, 2022 at 05:24:16PM +0100, Matthew Wilcox wrote: > > The former tended to use 0/-E... conventions - -E on failure. > > The latter tended to use 0/1, 1 being "stop, we are done". > > The callers treated anything non-zero as "stop", ignoring which > > non-zero value did they get. > > > > "true means stop" would be more natural for the second group; "true > > means keep going" - for the first one. I tried both variants and > > the things like > > if allocation failed > > something = -ENOMEM; > > return true; > > just looked unnatural and asking for trouble. > > I like it the way you have it. My only suggestion is: > > +++ b/include/linux/fs.h > @@ -2039,6 +2039,7 @@ extern bool may_open_dev(const struct path *path); > * the kernel specify what kind of dirent layout it wants to have. > * This allows the kernel to read directories into kernel space or > * to have different dirent layouts depending on the binary type. > + * Return 'true' to keep going and 'false' if there are no more entries. > */ > struct dir_context; > typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64, OK... FWIW, an additional argument is that ->iterate() instances are not calling those directly - they are calling dir_emit(), which returns true for "keep going" and false for "stop". This makes the calling conventions for callbacks match that...