Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1379835ybx; Thu, 7 Nov 2019 11:07:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxtKgZG6eGUIwr4frEKoLzGn9pCYqFwWb0iCv3z1zh307wBVKkzXFhSD0sKy4r+J4QjMAAp X-Received: by 2002:a50:9269:: with SMTP id j38mr5358306eda.5.1573153640079; Thu, 07 Nov 2019 11:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573153640; cv=none; d=google.com; s=arc-20160816; b=p5JYPVApnNc46VXBjSJTHulFy/uJDsAt/2DjTImw+ZKV6BZI9tl7l5pXov9JF8lqyZ 7L7gaqQ/Td+o9mQ+j0Mfm4h//7iQytR/LRArBAI2zRx4q8TJ2BNHSq3WxQKDOrcGBILC 2XSxKS3sdjXRZQ0KlGL7kBO52fUuigTmlvDKvbMaaFdDO6M+8ACI9ewq8VELuQnuQKKU qEfYxndjdtAtoNN8cbyvrV3UnRDqAIgOspCjoyYfb7vjsmbsZutnYsGiTy+oqoocBYOs RCcKlab/yoB1O75fxaRamZvHB713ktr9is3yLZ+AuWyYPN4ttpsmUH5473ak2TG6KsFb yTjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=1tP3qei8TukRnX2z63LYs/96qY+PDpX7maQ10Dl2dyQ=; b=FFiUetj4shsO2Pgq5lM3ZN4+4UtWu00hNOWDq5/PU+bADLjec8ULk7YoNxAH2H9Gr+ 8KEHFYRSsI59aFbRKNgxi8xNSYpGMwShLHuMe6LQLy8biWsjVsJyp8vdTXP3T6ZJjK4S we2H4RGOOdEGBEvqPPE4Ah9GvGcx7yjqAOXgm+UIfjz8iBOUAbC+09BlyaeS4j2TMOG7 nb2U/NEnYLt/QpfSdGPO15IGNVONf2zpnZ8k//mlJM51ZWUZKttKbFG//BnBn5CIeYsg ZXkfsLQx0977/EeRmLAaX6MhSJciAbQ9k6LE8Omt/k+ibCtCBC6rnBnGTi8al2MGjHWM IU1g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ly28si2077198ejb.177.2019.11.07.11.06.55; Thu, 07 Nov 2019 11:07:20 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730126AbfKGTE7 (ORCPT + 99 others); Thu, 7 Nov 2019 14:04:59 -0500 Received: from ms.lwn.net ([45.79.88.28]:39040 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727296AbfKGTE6 (ORCPT ); Thu, 7 Nov 2019 14:04:58 -0500 Received: from lwn.net (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id E11736EC; Thu, 7 Nov 2019 19:04:56 +0000 (UTC) Date: Thu, 7 Nov 2019 12:04:55 -0700 From: Jonathan Corbet To: Jaskaran Singh Cc: linux-kernel@vger.kernel.org, mchehab+samsung@kernel.org, christian@brauner.io, neilb@suse.com, willy@infradead.org, tobin@kernel.org, stefanha@redhat.com, hofrat@osadl.org, gregkh@linuxfoundation.org, jeffrey.t.kirsher@intel.com, linux-doc@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH][RESEND] docs: filesystems: sysfs: convert sysfs.txt to reST Message-ID: <20191107120455.29a4c155@lwn.net> In-Reply-To: <20191105071846.GA28727@localhost.localdomain> References: <20191105071846.GA28727@localhost.localdomain> Organization: LWN.net MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Nov 2019 12:48:46 +0530 Jaskaran Singh wrote: > This patch converts sysfs.txt to sysfs.rst, and adds a corresponding > entry in index.rst. > > Most of the whitespacing and indentation is kept similar to the > original document. > > Changes to the original document include: > > - Adding an authors statement in the header. > - Replacing the underscores in the title with asterisks. This is so > that the "The" in the title appears in italics in HTML. > - Replacing the tilde (~) headings with equal signs, for reST section > headings. > - List out the helper macros with backquotes and corresponding description > on the next line. > - Placing C code and shell code in reST code blocks, with an indentation > of an 8 length tab. > > Signed-off-by: Jaskaran Singh Thanks for working to improve the documentation. There are some problems here, none of which are your creation, but I would sure like to resolve them while working with this document. The first of these is that Documentation/filesystems is really the wrong place for this file - it's covering the internal API for subsystems that want to create entries in sysfs. IMO, it belongs in either the driver-API manual or the core-API manual - probably the latter. > Documentation/filesystems/index.rst | 1 + > .../filesystems/{sysfs.txt => sysfs.rst} | 323 ++++++++++-------- > 2 files changed, 189 insertions(+), 135 deletions(-) > rename Documentation/filesystems/{sysfs.txt => sysfs.rst} (60%) > > diff --git a/Documentation/filesystems/index.rst b/Documentation/filesystems/index.rst > index 2c3a9f761205..18b5ea780b9b 100644 > --- a/Documentation/filesystems/index.rst > +++ b/Documentation/filesystems/index.rst > @@ -46,4 +46,5 @@ Documentation for filesystem implementations. > .. toctree:: > :maxdepth: 2 > > + sysfs > virtiofs > diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.rst > similarity index 60% > rename from Documentation/filesystems/sysfs.txt > rename to Documentation/filesystems/sysfs.rst > index ddf15b1b0d5a..de0de5869323 100644 > --- a/Documentation/filesystems/sysfs.txt > +++ b/Documentation/filesystems/sysfs.rst > @@ -1,15 +1,18 @@ > +====================================================== > +sysfs - *The* filesystem for exporting kernel objects. > +====================================================== > > -sysfs - _The_ filesystem for exporting kernel objects. Nits: We can really just drop emphasis like that, it doesn't really help anybody. Also the period can go on section headers. > +Authors: > > -Patrick Mochel > -Mike Murphy > +- Patrick Mochel > +- Mike Murphy I would be absolutely amazed if either of those email addresses works at this point. I'd take them out. > -Revised: 16 August 2011 > -Original: 10 January 2003 > +| Revised: 16 August 2011 > +| Original: 10 January 2003 Dates like that are a red flag. See below. > What it is: > -~~~~~~~~~~~ > +=========== > > sysfs is a ram-based filesystem initially based on ramfs. It provides > a means to export kernel data structures, their attributes, and the > @@ -21,16 +24,18 @@ interface. > > > Using sysfs > -~~~~~~~~~~~ > +=========== > > sysfs is always compiled in if CONFIG_SYSFS is defined. You can access > it by doing: > > - mount -t sysfs sysfs /sys > +.. code-block:: sh > + > + mount -t sysfs sysfs /sys In the spirit of minimal markup, I'd do the above as: it by doing:: mount -t sysfs sysfs /sys But then I know that others are much more fond of .. code-block and syntax highlighting than I am. > Directory Creation > -~~~~~~~~~~~~~~~~~~ > +================== > > For every kobject that is registered with the system, a directory is > created for it in sysfs. That directory is created as a subdirectory > @@ -48,7 +53,7 @@ only modified directly by the function sysfs_schedule_callback(). > > > Attributes > -~~~~~~~~~~ > +========== > > Attributes can be exported for kobjects in the form of regular files in > the filesystem. Sysfs forwards file I/O operations to methods defined > @@ -67,15 +72,16 @@ you publicly humiliated and your code rewritten without notice. > > An attribute definition is simply: > > -struct attribute { > - char * name; > - struct module *owner; > - umode_t mode; > -}; > +.. code-block:: c > > + struct attribute { > + char * name; > + struct module *owner; > + umode_t mode; > + }; Here is where we go pretty far off the rails. If you go looking in include/linux/sysfs.h, the actual definition of this structure is: struct attribute { const char *name; umode_t mode; #ifdef CONFIG_DEBUG_LOCK_ALLOC bool ignore_lockdep:1; struct lock_class_key *key; struct lock_class_key skey; #endif }; Most notably, the owner field went away quite some time ago. Documentation like this is not really useful to anybody; once a reader realizes it doesn't describe current reality, they will justifiably disregard it. This isn't your fault, of course, but converting something like this to RST gives the illusion that it has been updated, when that is very much not the case. At a bare minimum, an effort like this needs to put a big flashing warning at the top of the file. But it would be soooooo much better to actually update the content as well. The best way to do that would be to annotate the source with proper kerneldoc comments, then pull them into the documentation rather than repeating the information here. Is there any chance you might be up for taking on a task like this? Thanks, jon