Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp838772imi; Fri, 22 Jul 2022 10:32:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uxSWWrdg71UGkN0pLw9ZczQAVWUZSkHePqcb7dayaz/oEYKLeSAs5r4GcMU8/oODAHTdCb X-Received: by 2002:aa7:8c55:0:b0:52b:7233:f7b1 with SMTP id e21-20020aa78c55000000b0052b7233f7b1mr893672pfd.33.1658511142940; Fri, 22 Jul 2022 10:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658511142; cv=none; d=google.com; s=arc-20160816; b=1BZrHVgfaUTlOCU28yV4NXVkwPmjKJHxKOnyDEd3NC3IYZSGmL/qwkRKLAKA0gDtFs AQmqcdCbZmVTvWpn1lkbNBxlfmfcnFhTJYdkJcVBuFvfiP+RJphHwkmqkg2vI+2bE8vr +OuX4ndkW8ykDTskTuzdNGLnw6is5ryWBDfSXhIZkOFfmr7aLX+mr2CyCXPfa9WrUhXF Iw7pC/Tx7VEOF9Ah47jTFBHl4kP2+KlhOADy8R2Z6/q9cMFGARBScDf3Var79uRwWvKX xqWQSye7U7YoY5UUnOccEU+fwlJCFEDf2e3RmUrkIXuqTq2ZJB/TXbT+//4q3iYKVqSt /Dlw== 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=FgV82IA2sA2egdG4x8Bd0hjOch5e32AZ5dzrTQd57e8=; b=fWXmDtxoakEwV/pQxbtVwj7tHkjTJfJiK1lveuI9+1yDWPpcEfHjj8/wF4VT1AK6Ht xBWIh5/ybvULF1C6qR9jWWpJ4INxZmJVE7J4md2bnnNWelvGD79dhxJv1mXiomH7DUgD VjtWKjaV3aUXKDLAvmEUTqT4hj805ZcCRddp6tJ12DPy5fN7wzK+Bwhh0X5XHSIALc5+ bEPeSVvBMiT5HoKjeeWPtXF9ssa0wdceZzD15yP1oRvYVy0+8Ofe3HJLH76BKrCOMfnr Pwayxiv/rySl0HeVFGxch8j5E3eFiiTZmxAqCwcJXuGvslWI+1dks8e3t8moXeD+cc9g qK2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fvyZylqk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iq21-20020a17090afb5500b001e0b16a6bb9si5355629pjb.159.2022.07.22.10.32.01; Fri, 22 Jul 2022 10:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@kernel.org header.s=k20201202 header.b=fvyZylqk; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232767AbiGVRbf (ORCPT + 99 others); Fri, 22 Jul 2022 13:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbiGVRbe (ORCPT ); Fri, 22 Jul 2022 13:31:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6D3A87C3F; Fri, 22 Jul 2022 10:31:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62884B829B4; Fri, 22 Jul 2022 17:31:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D7B3C341C6; Fri, 22 Jul 2022 17:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658511090; bh=a3AdWTwkRu806AtqPGZZoXgqI77wgso2z+u/CTFUOCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fvyZylqkFe8Oa7eFQ7syg12R+1sK6D4uh+32flmCf29y3KlC3MZO6X75XRccGkybE 4yMzXNC1+jqIIS5h/hrABGvcd/zNQPa6YLo4nSVX7PVYfqplyeFs0MmsFRTuT5rl/y 71n3BQ1JcW33FSYt/wBDKzGjYn5L/lFQ4d04AhxQnGRLLrMGKkxZWZD+vFnI2UZqwP INcGr1GlaNkL2CPmeCXYzVAFQhkkEdEevFd595HlsQJgWsdcGNTUyGd8f0vXyWFuKN B1/jiorWasDepPg5vXlI52CT6ptqim8awK354nJ9WqLn+PL8d517lQtu3bqq+Bxj4M cVb1+tLRtJ2Gg== Date: Fri, 22 Jul 2022 10:31:29 -0700 From: "Darrick J. Wong" To: Jeremy Bongio Cc: Ted Tso , linux-ext4@vger.kernel.org, linux-man@vger.kernel.org Subject: Re: [PATCH v3] Add manpage for get/set fsuuid ioctl for ext4 filesystem. Message-ID: References: <20220722063732.466621-1-bongiojp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220722063732.466621-1-bongiojp@gmail.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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-ext4@vger.kernel.org On Thu, Jul 21, 2022 at 11:37:32PM -0700, Jeremy Bongio wrote: > Signed-off-by: Jeremy Bongio > --- > > Changes in v3: > > Removed LIBRARY section since this ioctl won't be wrapped by a system library. > > Code now uses 4-space indent. > > Updated for semantic new lines. Please call out if I still break this rule. > > Reworded based on Darrick's suggestions. > > Unrecognized fsu_flags now results in EOPNOTSUPP error. > > Added definitions of EXT4_IOC_GETFSUUID/EXT4_IOC_SETFSUUID which are not > contained in a library. > > man2/ioctl_fsuuid.2 | 113 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 113 insertions(+) > create mode 100644 man2/ioctl_fsuuid.2 > > diff --git a/man2/ioctl_fsuuid.2 b/man2/ioctl_fsuuid.2 > new file mode 100644 > index 000000000..c9e2789b9 > --- /dev/null > +++ b/man2/ioctl_fsuuid.2 > @@ -0,0 +1,113 @@ > +.\" Copyright (c) 2022 Google, Inc., written by Jeremy Bongio > +.\" > +.\" SPDX-License-Identifier: Linux-man-pages-copyleft > +.TH IOCTL_FSUUID 2 2022-07-20 "Linux" "Linux Programmer's Manual" > +.SH NAME > +ioctl_fsuuid \- get or set an ext4 filesystem uuid > +.SH SYNOPSIS > +.nf > +.B #include > +.BR "#include " " /* Definition of " _IOR " and " _IOW " */" > +.PP > +.BI "#define EXT4_IOC_GETFSUUID _IOR('f', 44, struct fsuuid)" > +.BI "#define EXT4_IOC_SETFSUUID _IOW('f', 44, struct fsuuid)" > +.BI "int ioctl(int " fd ", EXT4_IOC_GETFSUUID, struct " fsuuid ");" > +.BI "int ioctl(int " fd ", EXT4_IOC_SETFSUUID, struct " fsuuid ");" > +.fi > +.SH DESCRIPTION > +If an ext4 filesystem supports uuid manipulation, these > +.BR ioctl (2) > +operations can be used to get or set the uuid for the ext4 filesystem on which > +.I fd > +resides. > +.PP > +The argument to these operations should be a pointer to a > +.IR "struct fsuuid" ":" > +.PP > +.in +4n > +.EX > +struct fsuuid { > + __u32 fsu_len; /* Number of bytes in a uuid */ > + __u32 fsu_flags; /* Mapping flags */ > + __u8 fsu_uuid[]; /* Byte array for uuid */ > +}; > +.EE > +.PP > +The > +.I fsu_flags > +field must be set to 0. > +.PP > +If > +.BR EXT4_IOC_GETFSUUID > +is called with > +.I fsu_len > +set to 0, > +.I fsu_len > +will be set to the number of bytes in an ext4 filesystem uuid > +and the return code will be EINVAL. > +.PP > +If > +.BR EXT4_IOC_GETFSUUID > +is called with > +.I fsu_len > +matching the length of the ext4 filesystem uuid, > +then that uuid will be written to > +.I fsu_uuid[] > +and the return value will be zero. > +If > +.I fsu_len > +does not match, the return value will be > +.B EINVAL. > +.PP > +If > +.BR EXT4_IOC_SETFSUUID > +is called with > +.I fsu_len > +matching the length of the ext4 filesystem uuid, > +then the filesystem uuid will be set to the contents of > +.I fsu_uuid[] > +and the return value will reflect the outcome of the update operation. > +If Nit: trailing space. > +.I fsu_len > +does not match, the return value will be > +.B EINVAL. > +.PP > +The > +.BR FS_IOC_SETFSUUID > +operation requires privilege > +.RB ( CAP_SYS_ADMIN ). > +If the filesystem is busy, an > +.BR EXT4_IOC_SETFSUUID > +operation will wait until it can apply the uuid changes. > +This may take a long time. > +.PP > +.SH RETURN VALUE > +On success zero is returned. > +On error, \-1 is returned, and > +.I errno > +is set to indicate the error. > +.SH ERRORS > +Possible errors include (but are not limited to) the following: > +.TP > +.B EFAULT > +Could not copy to/from userspace. > +.TP > +.B EINVAL > +.I fsu_len > +did not match the filesystem uuid length. > +.TP > +.B ENOTTY > +The filesystem does not support the ioctl. > +.TP > +.B EOPNOTSUPP > +The filesystem does not support changing the uuid through this ioctl. > +This may be due to incompatible filesystem feature flags or > +.I fsu_flags > +has bits set that are not recognized. Hm, I think I miscommunicated last time. fsu_flags bits that are not recognized by the implementation should return EINVAL. fsu_flag bits that *are* recognized but impossible to service should return EOPNOTSUPP. .TP .B EINVAL .I fsu_len did not match the filesystem uuid length, or .I fsu_flags had bits set that the implementation does not understand. .TP .B EOPNOTSUPP The filesystem does not support changing the uuid through this ioctl. This may be due to incompatible filesystem feature flags or .I fsu_flags had bits set that make the operation impossible. FWIW I agree with the manpages maintainer that this should have a section with example code. I don't know if he requires the example code be embedded in the manpage, or if it would be sufficient to point readers at a real implementation (e.g. uuid_ioctl.c in fstests, or the relevant helper functions in tune2fs.c in e2fsprogs). --D > +.TP > +.B EPERM > +The calling process does not have sufficient permissions to set the uuid. > +.SH CONFORMING TO > +This API is Linux-specific. > +.SH SEE ALSO > +.BR ioctl (2) > -- > 2.37.1.359.gd136c6c3e2-goog >