Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6009729ybi; Wed, 29 May 2019 01:10:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwy5JjFIYRMHB2XPqExfSFvI7lQvoqgc6UJRkNPrw4wih9hmxiMg6k5yzsUdg+KEKTJbgsc X-Received: by 2002:a17:90a:b398:: with SMTP id e24mr10064824pjr.83.1559117428880; Wed, 29 May 2019 01:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559117428; cv=none; d=google.com; s=arc-20160816; b=hQtoc9WV1CV2ek5wDK2ZDOuLGj5cJY994F5Fq8zDpmrXBSikJQ4I2FLiFk23qwgWym vMEQdG5x4rwfcWXbwfxA1UkfZ2UwCbryBrX/jx/5CIJJEmQRg4aINDohZjxjPjxJAMce s2zUhtN52vQvroCpOuHgYcswNxqYmTij+HEWwWoVbB/sOiUBzL7PmarYBI7oO4csF4Rm Jb4BVuhvqkg9yBZn70tS8nKQC1gl4efUXAaE3/AQwUQSjTLC1PX9/DKLsegPjw0uZyNN ycuYGVFcYV8JTLbXN/849o7tRDk531eONo7BDgglwfo+LIOuW/+1r/Id9stzzjNuH95K xy5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=RxXvclxvtLO6JmXKyzZz4TtfqD6qqSQQNDFUnK5EdOE=; b=sEkVmlu/1ZTJNWqNlbUzCuBBgJ9+yB7ryzggN1x/ygkRhT7Ny5J4fw6CjSy2673GrZ 3fpValZc+/rACZ3KyUkQ3fOYgpy5l+5GIML42yDbOVxKvLI25ejt2zVvBct4SjNABEGv /1JvZ9Df43iyYCfS/PMwI9NJM3KmPg7j6xHMpX5Lwn9UE4poCpvw9AaNm9516I0WzZQ0 swBktHq2C9bhTw5YYz47ysqnqrgw526woeIbT4r7WewFnNnf7SANlfsf2BxbMcbY9i+W 90H4OYbDLFHOp3iQsrYtwPjZ3APywmq94whdiAFUsbRjlokj0M3vXvnWwu5gP//v5mwB +tKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=dIAHLOYY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p188si25593188pfp.112.2019.05.29.01.10.13; Wed, 29 May 2019 01:10:28 -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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=dIAHLOYY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbfE2IJK (ORCPT + 99 others); Wed, 29 May 2019 04:09:10 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:32902 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725917AbfE2IJK (ORCPT ); Wed, 29 May 2019 04:09:10 -0400 Received: by mail-io1-f65.google.com with SMTP id u13so1077555iop.0 for ; Wed, 29 May 2019 01:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RxXvclxvtLO6JmXKyzZz4TtfqD6qqSQQNDFUnK5EdOE=; b=dIAHLOYYCq5oAsIPqSqwXo7BO2qeHR7SZftiNljkQHJUJv80V0MatrM6Q3SkC/BoXo 2yM1PXXNJy2qg2EtCGlpBmJsNHMoswxau4JRWvZ9Vi+wqjT0Vy1KAUu496HRxp8Z2wTT UipyxohvDO1db0DYXvIDnvgfESM3mBn8LbT8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RxXvclxvtLO6JmXKyzZz4TtfqD6qqSQQNDFUnK5EdOE=; b=Bznz38ychQxSS8QPaEHeVormPAOnkUPc1pb4YOISFST2c00NEjGp3xmOTsaYVYxZ47 2G0DRAwBgKegFrkplPb+IM5LUDpJyjzXu3+pJbZwR1075FVQen4ozIw1Li4hP0Tv56iZ aOSvEsbb0Nw7u1w1YTHREwwDizR47gtDspUs+Iuef5nWBzKMfUlD1dVAm+UtlXSzJdgR PjOocSfmVn3cwiIgs6aiscWNlRPa2Qr+9TjvkpePjRId884F+K+ffXCTn3kypQHKD1nq GnJXo4VIqhzTG1EdMBAzV8W/WmZy7b2kiSl89ahxU9/39XBjVOmT2s+YjfPsuaSsPgx3 b2DQ== X-Gm-Message-State: APjAAAVAkEMp3UQdvr/wi+70yBz8wwiVMBOnNxkXwfCBa55oBczL9b8K IxRuCIsqTNTICi+qu1j9yqlGAGj1/ZNI1AswyG08rw== X-Received: by 2002:a05:6602:2252:: with SMTP id o18mr5265330ioo.63.1559117349466; Wed, 29 May 2019 01:09:09 -0700 (PDT) MIME-Version: 1.0 References: <155905626142.1662.18430571708534506785.stgit@warthog.procyon.org.uk> <155905629702.1662.7233272785972036117.stgit@warthog.procyon.org.uk> In-Reply-To: <155905629702.1662.7233272785972036117.stgit@warthog.procyon.org.uk> From: Miklos Szeredi Date: Wed, 29 May 2019 10:08:58 +0200 Message-ID: Subject: Re: [PATCH 04/25] vfs: Implement parameter value retrieval with fsinfo() [ver #13] To: David Howells Cc: Al Viro , Ian Kent , Linux API , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Miklos Szeredi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 28, 2019 at 5:11 PM David Howells wrote: > > Implement parameter value retrieval with fsinfo() - akin to parsing > /proc/mounts. > > This allows all the parameters to be retrieved in one go with: > > struct fsinfo_params params = { > .request = FSINFO_ATTR_PARAMETER, > }; Ah, here it is. > > Each parameter comes as a pair of blobs with a length tacked on the front > rather than using separators, since any printable character that could be > used as a separator can be found in some value somewhere (including comma). > In fact, cifs allows the separator to be set using the "sep=" option in > parameter parsing. > > The length on the front of each blob is 1-3 bytes long. Each byte has a > flag in bit 7 that's set if there are more bytes and clear on the last > byte; bits 0-6 should be shifted and OR'd into the length count. The bytes > are most-significant first. > > For example, 0x83 0xf5 0x06 is the length (0x03<<14 | 0x75<<7 | 0x06). Sounds way too complicated. What about fixed 4byte sizes? Or using the nul charater as separator (and binary blobs be damned)? [...] > +static void fsinfo_insert_sb_flag_parameters(struct path *path, > + struct fsinfo_kparams *params) > +{ > + int s_flags = READ_ONCE(path->dentry->d_sb->s_flags); > + > + if (s_flags & SB_DIRSYNC) > + fsinfo_note_param(params, "dirsync", NULL); > + if (s_flags & SB_LAZYTIME) > + fsinfo_note_param(params, "lazytime", NULL); > + if (s_flags & SB_MANDLOCK) > + fsinfo_note_param(params, "mand", NULL); > + if (s_flags & SB_POSIXACL) > + fsinfo_note_param(params, "posixacl", NULL); > + if (s_flags & SB_RDONLY) > + fsinfo_note_param(params, "ro", NULL); > + if (s_flags & SB_SYNCHRONOUS) > + fsinfo_note_param(params, "sync", NULL); Again, don't blindly transform s_flags into options, because some of them may have been internally manipulated by the filesystem. You could do a helper for filesystems that does the the common ones (ro/sync/dirsync) but all of that *should* go through the filesystem. Same goes for vfs_parse_sb_flag() btw. It should be moved into each filesystem's ->parse_param() and not be a mandatory thing. Thanks, Miklos