Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6829689iob; Wed, 11 May 2022 06:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyiapiTKcuq1kg5BNLlcYY6vnY5uhLHM8ER8JzJCGDkoFbUCkkrRKvmtWoIUGx2++0zk4P X-Received: by 2002:aa7:c318:0:b0:426:4aae:de6d with SMTP id l24-20020aa7c318000000b004264aaede6dmr28738928edq.208.1652275233771; Wed, 11 May 2022 06:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652275233; cv=none; d=google.com; s=arc-20160816; b=drk1ZILA7r48Ze4uE0oMhOO0xSf20rHtIDM84tOucraxoEFKuTclIWKxIXDd/5WOXZ 4CL+VRWAAXp37VwDSWGRGOC3FJeqk1+nHyn7xpBxAkh+b7rqTmkji3EYE84RORI7tIci cCbeGNJUf58+DbSOGGD5s9Te0B67m6tVyNOjBaTvwVsH4zixTkIYvJoxKyg1L4Qh1P/E xFaYKa0qDNbrkPurkHIoDC8d3g34L2uwmnnKAtoc0O7ta63GSis47dAkH3/U0AsSKxjQ 6WYPVIWN85trFw3GETRWY5wM8CFWgsS3nNtJswYdsyIJFyTtuGEudRB+I+JRq9Dfge8p 2zuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+Zc2Huyl9u354IxnbxBuQkxC8HSnVrj0E9v/FWkHr5U=; b=pLCIqmaWoVQlzUa3xtOeoiLrJLpetEelrvh7hxulhe0wkq79CCbvAVZbuF3h75eFJ0 U6T7kUhBLS8SM2iycttEYZMSimSjz/b779sKqsWxx/mREwS7cR/KXD0YOO7hkIaULwEN 4NODCFBklIx2a//7go7vcW7sqnL/XPCfzvKoKsmS9X1HpmkV/ddfrhI7MXs9cTrVqurb Sl7CebqndADJ1milA8Mr/6ACj5H0vWa7jS73i5VdDCtRXxAff9E+XXXA+0WP4Vsa1EC5 wQv7Lg9Uxk84nFa3YNYRGBSEiLk5z98hXFFMekEVtolS/MvwX62RsGqKI1m0r3jLknj3 DRWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z6BqGIMC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r4-20020a056402034400b00425ab11333csi2168636edw.428.2022.05.11.06.20.06; Wed, 11 May 2022 06:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z6BqGIMC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232483AbiEKI65 (ORCPT + 99 others); Wed, 11 May 2022 04:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbiEKI6t (ORCPT ); Wed, 11 May 2022 04:58:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8F28312460B for ; Wed, 11 May 2022 01:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652259526; 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: in-reply-to:in-reply-to:references:references; bh=+Zc2Huyl9u354IxnbxBuQkxC8HSnVrj0E9v/FWkHr5U=; b=Z6BqGIMCt6mVRD8AH8LAs6u3HckBOZe7sn2MDJiFkf+qpw0df3sdljgkDVsmTQP7VCt1R4 XXAGBh2kSR7mbG5aNwmc+N3yeGTDQyFt93PCV8fj3nxhtD4kn9YXJUrqios91h+vAKe6x4 1wfhxdvF8Jh/IUzu6kScESfhojTXhWc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-koZ8mR_ePsmDMcgIYEqBfg-1; Wed, 11 May 2022 04:58:43 -0400 X-MC-Unique: koZ8mR_ePsmDMcgIYEqBfg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AFE50185A7B2; Wed, 11 May 2022 08:58:42 +0000 (UTC) Received: from ws.net.home (unknown [10.36.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 117071121314; Wed, 11 May 2022 08:58:39 +0000 (UTC) Date: Wed, 11 May 2022 10:58:37 +0200 From: Karel Zak To: Dave Chinner Cc: Christian Brauner , Miklos Szeredi , linux-fsdevel@vger.kernel.org, Theodore Ts'o , Greg KH , linux-kernel@vger.kernel.org, Linux API , linux-man , LSM , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , James Bottomley Subject: Re: [RFC PATCH] getting misc stats/attributes via xattr API Message-ID: <20220511085837.xkxo5c5fevtgaekz@ws.net.home> References: <20220509124815.vb7d2xj5idhb2wq6@wittgenstein> <20220510123512.h6jjqgowex6gnjh5@ws.net.home> <20220510232552.GD2306852@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220510232552.GD2306852@dread.disaster.area> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 11, 2022 at 09:25:52AM +1000, Dave Chinner wrote: > > I'd love something like: > > > > ssize_t sz; > > fsinfo_query query[] = { > > { .request = FSINFO_MOUNT_PATH }, > > { .request = FSINFO_PROPAGATION }, > > { .request = FSINFO_CHILDREN_IDS }, > > }; > > > > sz = fsinfo(dfd, "", AT_EMPTY_PATH, > > &query, ARRAY_SIZE(query), > > buf, sizeof(buf)); > > > > for (p = buf; p < buf + sz; ) { > > { > > fsinfo_entry *e = (struct fsinfo_entry) p; > > char *data = p + sizeof(struct fsinfo_entry); > > > > switch(e->request) { > > case FSINFO_MOUNT_PATH: > > printf("mountpoint %s\n", data); > > break; > > case FSINFO_PROPAGATION: > > printf("propagation %x\n", (uintptr_t) data); > > break; > > case FSINFO_CHILDREN_IDS: > > fsinfo_child *x = (fsinfo_child *) data; > > for (i = 0; i < e->count; i++) { > > printf("child: %d\n", x[i].mnt_id); > > } > > break; > > ... > > } > > > > p += sizeof(struct fsinfo_entry) + e->len; > > } > > That's pretty much what a multi-xattr get operation looks like. > It's a bit more more intricate in the setup of the request/return > buffer, but otherwise the structure of the code is the same. > > I just don't see why we need special purpose interfaces like this > for key/value information when small tweaks to the existing > generic key/value interfaces can provide exactly the same > functionality.... I don't say we need a new interface ;-) I'd be happy with whatever as long as: * minimal strings parsing (wish than a requirement) * one syscall returns multiple key/value * can address mount table entries by ID * can ask for list of children (submounts) * extensible if this will be possible with xattr (listxattr2(), or so) when great. Karel -- Karel Zak http://karelzak.blogspot.com