Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6073115iob; Tue, 10 May 2022 09:43:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPTRpIF/RY8Ui1a06qVOCauFo+MllNubPU80NOVuTbluIe4cj1dnW9aPWMazYh7d4ryI63 X-Received: by 2002:a05:6a00:2403:b0:4fd:e84a:4563 with SMTP id z3-20020a056a00240300b004fde84a4563mr21575750pfh.60.1652201007813; Tue, 10 May 2022 09:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652201007; cv=none; d=google.com; s=arc-20160816; b=Evxffl5wYR2ViNECwc1FaV6wZ14+3ZMCtF/MWePTz3rpChJKMuysAUaIz0k9/vOyKr dm37zH8jjLJlrgEEcau23hgz5VI72LnPiHOwDb+XHWYetZ8x5QPkX0iIV5w0Zm4YGo/3 GVNPvD2w8VWvqPNlZWJQ9fkqyi3F4prz5RU5o4d/UYAnRvKaKE0pqYRdlk63EiIzKPij YEqswl3W/zP8sYPdXhJaaWOFbvhbD2FH4mEgKVUkS0mu9hFy7C+mnL2itfNqFoBOUr8S gbaSpms5OphnlY2LmSexVHdnucuUjxWjP+wI6MMTnrDl5sOP52x0o0apAYuqThzgQdt+ pbIA== 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=KAQGt/RronM2MwKu2wT61Gar8OOVM6I6Ip3NAsTYhRo=; b=ZkU/XdxH0LYR9BspYC/ekE2QWn7CXdvhkRMroML7RAesNwhwftPLvB0VFXxESXjOoU w6DlxeCFYljCCLbcFSZL2riSWshlNb0GtvU8FAeJUK1o085838Dx2KVJhDrzJ3slPZrv MVHbxh/5EM1GUGxgUXfxRvDipGfprYZ8pURkQjZQDH54wKbjxXgNMARQLDJ9myn7VMSA JfN8azKI23karmViDL7MtFvymDMSWj4sYCsvwqG+QQMZ9JzdwE/bmSuVGHACAOHzp/dS ZwcSziNJFk2kcDry57+iivzmBOjub4h277/92serNBk5HnmNFtP30PvAVJXHvh1Ds9JE u8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E0J6XMFQ; 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 x190-20020a6386c7000000b003a9fb8f68b5si3155592pgd.213.2022.05.10.09.43.12; Tue, 10 May 2022 09:43:27 -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=E0J6XMFQ; 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 S241524AbiEJMjY (ORCPT + 99 others); Tue, 10 May 2022 08:39:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241110AbiEJMjV (ORCPT ); Tue, 10 May 2022 08:39:21 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD12A2A9CE7 for ; Tue, 10 May 2022 05:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652186122; 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=KAQGt/RronM2MwKu2wT61Gar8OOVM6I6Ip3NAsTYhRo=; b=E0J6XMFQEObfdm7tbLVsEWV2bkGrhA+CRQcZ7k7QOQ8A75tsXvwu5PWp1LvWH4KnOvheMw aTppLTLbA4nAX1DgYaOu/vrWC+SpZiNKRUW4mnv2FlkVKwrhQ61VHAe7ZgmjaZ6gw0e2Iw gwMe7Cv/tBQa6coDuQJ7VVSL4+yvQCU= 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-587-g2GRWnOBOiO81XZFgG9qpA-1; Tue, 10 May 2022 08:35:17 -0400 X-MC-Unique: g2GRWnOBOiO81XZFgG9qpA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2139E803D45; Tue, 10 May 2022 12:35:17 +0000 (UTC) Received: from ws.net.home (unknown [10.36.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89779400E115; Tue, 10 May 2022 12:35:14 +0000 (UTC) Date: Tue, 10 May 2022 14:35:12 +0200 From: Karel Zak To: Christian Brauner Cc: Miklos Szeredi , linux-fsdevel@vger.kernel.org, Dave Chinner , 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: <20220510123512.h6jjqgowex6gnjh5@ws.net.home> References: <20220509124815.vb7d2xj5idhb2wq6@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509124815.vb7d2xj5idhb2wq6@wittgenstein> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 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 Mon, May 09, 2022 at 02:48:15PM +0200, Christian Brauner wrote: > One comment about this. We really need to have this interface support > giving us mount options like "relatime" back in numeric form (I assume > this will be possible.). It is royally annoying having to maintain a > mapping table in userspace just to do: > > relatime -> MS_RELATIME/MOUNT_ATTR_RELATIME > ro -> MS_RDONLY/MOUNT_ATTR_RDONLY > > A library shouldn't be required to use this interface. Conservative > low-level software that keeps its shared library dependencies minimal > will need to be able to use that interface without having to go to an > external library that transforms text-based output to binary form (Which > I'm very sure will need to happen if we go with a text-based > interface.). Sounds like David's fsinfo() :-) We need an interface where the kernel returns a consistent mount table entry (more syscalls to get more key=value could be a way how to get inconsistent data). IMHO all the attempts to make a trivial interface will be unsuccessful because the mount table is complex (tree) and mixes strings, paths, and flags. We will always end with a complex interface or complex strings (like the last xatts attempt). There is no 3rd path to go ... The best would be simplified fsinfo() where userspace defines a request (wanted "keys"), and the kernel fills a buffer with data separated by some header metadata struct. In this case, the kernel can return strings and structs with binary data. 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; } ... my two cents :-) Karel -- Karel Zak http://karelzak.blogspot.com