Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5102834imm; Tue, 31 Jul 2018 05:40:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqmvoUXugb/HMks8JQKy7jWUj80oS7HOhDBpOFV9vibFDmrwcMGHBwuKMmt3qV+etH3kk+ X-Received: by 2002:a65:550d:: with SMTP id f13-v6mr20680277pgr.340.1533040821422; Tue, 31 Jul 2018 05:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533040821; cv=none; d=google.com; s=arc-20160816; b=fFVqSZjtgQsr7fjIZu3S6nEZtpiQNrGh0YUcUpYaj4+46RgZdg1pWtS4+CBf0DjLja ZIhJZG7Dezg7vLQs+xex4KN8dbc6y0krJmZdYNhtrL71+Uej3XK//CA8rB80L7uqwwfK wNlAFKIAdkEH+Fc18kgXnXV81Jg27uZgvfq1oavZjbr924oU4IPFiAyvLDzZuvao9iVw xHqdmmVXVM/JBfxdDLsmzvP6jPJYfbFiAEEe++Hu3VU+n4fj4xnGFlrpjpqCzWPaWc1P ytdNTtvJGIkZg67uFATerKbb/DAmnI+4RdyjsUMea08B+KzwC0nlGAN9tyd2qj/6D/jN 0g6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :arc-authentication-results; bh=z6WCQAk2vBn8NTmcJb9yLN/XlTuRME/zD5T59s93w34=; b=qiD/QW6LgiCSFwc6xIL/2gYmsznkXEGxZca62YMBpZAUbqhbDovOaonAgEtweOTwSX Kyd2aPtm3GMBiL74hLajt+QMSJqYFwLH/em48/i7G54ydUv8b/1nArlU3w8576OwKB1K GzMu/HiWx1MYsUqMr0+/O6uuh+sFiBii220ra5XbVDDodlLjvQO9BGsujaCvNtw19yLu 8LRodEWbEJ0Ib/HJdLut6bCcD2jRG/Bs2XQJce2rdJvAhz7dB+nrXH1B/n1OHNibBj4h O0h6muXJ2xagUlgwuC9jY+AiM3mOp863Kfq8am2IkPIY5ZvsEoTzx64GyTWQyUQPwUNF /ZxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7-v6si12071117plt.4.2018.07.31.05.40.06; Tue, 31 Jul 2018 05:40:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732205AbeGaOT1 (ORCPT + 99 others); Tue, 31 Jul 2018 10:19:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58058 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732084AbeGaOT1 (ORCPT ); Tue, 31 Jul 2018 10:19:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BFE240241C0; Tue, 31 Jul 2018 12:39:18 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-116.rdu2.redhat.com [10.10.120.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id 474EE7C5E; Tue, 31 Jul 2018 12:39:17 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20180731041642.GH30522@ZenIV.linux.org.uk> References: <20180731041642.GH30522@ZenIV.linux.org.uk> <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> <153271291017.9458.7827028432894772673.stgit@warthog.procyon.org.uk> To: Al Viro Cc: dhowells@redhat.com, linux-api@vger.kernel.org, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 34/38] vfs: syscall: Add fsinfo() to query filesystem information [ver #10] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1599.1533040756.1@warthog.procyon.org.uk> Date: Tue, 31 Jul 2018 13:39:16 +0100 Message-ID: <1600.1533040756@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 12:39:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 31 Jul 2018 12:39:18 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Al Viro wrote: > Umm... What's so special about cell/volume/domain/realm? Nothing particularly. But they're something various network filesystems might find useful. cell for AFS, domain for CIFS, realm for things that use kerberos. volume_id/uuid/name would be usable by ext4 too, for example. > And what do we do when a random filesystem gets added - should its > parameters go into catch-all pile (attr_parameter), FSINFO_ATTR_PARAMETER is a way to enumerate the configuration parameters passed to mount, as an alternative to parsing /proc/mounts. So, for example, afs has: enum afs_param { Opt_autocell, Opt_dyn, Opt_source, nr__afs_params }; static const struct fs_parameter_spec afs_param_specs[nr__afs_params] = { [Opt_autocell] = { fs_param_takes_no_value }, [Opt_dyn] = { fs_param_takes_no_value }, [Opt_source] = { fs_param_is_string }, }; static const struct constant_table afs_param_keys[] = { { "autocell", Opt_autocell }, { "dyn", Opt_dyn }, { "source", Opt_source }, }; My thought is that calling fsinfo(..., "/some/afs/file", ¶ms, ...) with: struct fsinfo_params params = { .request = FSINFO_ATTR_PARAMETER, .Nth = , }; would get you back, for example: Nth Result ======= ========================================== 0 "autocell" (or "" if not set) 1 "dyn" (or "" if not set) 2 "source=%#grand.central.org:root.cell." 3+ -ENODATA (ie. there are no more) where Nth corresponds to the parameter specified by FSINFO_ATTR_PARAM_DESCRIPTION and Nth. Now for some filesystems, cgroups-v1 for example, there are parameters beyond the list (the subsystem name) and these can be listed after the predefined parameters, eg.: Nth Result ======= ========================================== 0 "all" or "" 1 "clone_children" or "" 2 "cpuset_v2_mode" or "" 3 "name" or "" 4 "none" or "" 5 "noprefix" or "" 6 "release_agent" or "" 7 "xattr" or "" 8 "" or "" 9 "" or "" 10 "" or "" ... -ENODATA > or should they get classes of their own? Yes. > For Cthulhu sake, who's going to maintain that enum in face of > random out-of-tree filesystems, each wanting a class or two its own? They don't get their own numbers unless they're in-tree. Full stop. We have the same issue with system calls and not-yet-upstream new syscalls. Note that, as I have the code now, the "type" of return value for each attribute must also be declared to the fsinfo() core, and the fsinfo core does the copy to/from userspace. > We'd tried that with device numbers; ask hpa how well has that > worked and how much did he love the whole experience... What would you do instead? I would prefer to avoid using text strings as keys because then I need a big lookup table, and possibly this gets devolved to each filesystem to handle - which ends up even more of a mess because then there's nothing to hold consistency. David