Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp7044907ybf; Fri, 6 Mar 2020 09:17:32 -0800 (PST) X-Google-Smtp-Source: ADFU+vtdSrCiIMgD0Ns8wZib+3hjDIhySQq56s/YNjddXKloYcDUaVYowd6ONc02eNMFhnsBkpdb X-Received: by 2002:a05:6830:114f:: with SMTP id x15mr3386065otq.306.1583515052565; Fri, 06 Mar 2020 09:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583515052; cv=none; d=google.com; s=arc-20160816; b=i7fhF6b0rPkqgnmolcKd/RNbQD5A0IZwxxUUNf/z21mqgwPCRvLyAvroLDZ9LdirlM Tu09kUj+8ylNAjGxg8J4pBbnk5Hx8YiOaCN3PQqTPWvVr2aCP6c2p8IyOetArdJu5Khy sVFGd00Sbm8SSLeArldVCpxP05GzX3FchN5TRUCwX41cnDWXxJH4aFQe9zRH4vk8BkcP EurKF5ccfu1/lSTqZuDAKsIrY1ploWcEGy858fMxXkUyx+3JMs1pqpNw85QyJ2bF7bGq pg92i7XOd62gya6d0ydILeCiu/PTWrZKYPUxbviPDEmkx5lBcm+QLJib88N38T0Qe6Jj JKFA== 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 :message-id:date:subject:cc:to:from; bh=Lx97bLjzQvVpkv8WV8fm7d1GfqBnI1Sjgalu8zj45GI=; b=YbfrkJkHlo1++cCYvYB3zfHc4KkN837HQWrrOVTanYxCkfA1SEDBMefFfmi9/T5Aed UGtOBadtf7FYh2gadYn/hHhKguaKr1VPxV2Z6QMXJe4vBLkxHzgqU8HhedkUCZJIIPBV tvwOhK+vOceG8vfGXNFwhJ7K7umjopzWVdq3lmPNj/r1M0aY/c8ZNkSLCHbn9/Oy3bph jkQTmIuB2n2J+IY0jO3vfRb93G+7/Pxo2B3qXA8tydB9IJKPuBLm6XEWNOvfG72kQU0k wklpOcT6Li07rHO7/W0kfjM3iXFbw9aNqu0PfSTKoERe8/OjNG11t79Evwgj3Qzuii2S 53Tg== 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 q2si1877372otm.54.2020.03.06.09.17.19; Fri, 06 Mar 2020 09:17:32 -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 S1726533AbgCFRQv (ORCPT + 99 others); Fri, 6 Mar 2020 12:16:51 -0500 Received: from 2.mo173.mail-out.ovh.net ([178.33.251.49]:42992 "EHLO 2.mo173.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbgCFRQv (ORCPT ); Fri, 6 Mar 2020 12:16:51 -0500 Received: from player168.ha.ovh.net (unknown [10.108.57.18]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 51AFC134567 for ; Fri, 6 Mar 2020 18:16:48 +0100 (CET) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player168.ha.ovh.net (Postfix) with ESMTPSA id 107B7101F59BD; Fri, 6 Mar 2020 17:16:42 +0000 (UTC) From: Stephen Kitt To: Jens Axboe , Jan Kara Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH] Document genhd capability flags Date: Fri, 6 Mar 2020 18:16:21 +0100 Message-Id: <20200306171621.24134-1-steve@sk2.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 9619688804342385933 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrudduvddguddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepufhtvghphhgvnhcumfhithhtuceoshhtvghvvgesshhkvddrohhrgheqnecukfhppedtrddtrddtrddtpdekvddrieehrddvhedrvddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhduieekrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel documentation includes a brief section about genhd capabilities, but it turns out that the only documented capability (GENHD_FL_MEDIA_CHANGE_NOTIFY) isn't used any more. This patch removes that flag, and documents the rest, based on my understanding of the current uses of these flags in the kernel. The documentation is kept in the header file, alongside the declarations, in the hope that it will be kept up-to-date in future; the kernel documentation is changed to include the documentation generated from the header file. Because the ultimate goal is to provide some end-user documentation (or end-administrator documentation), the comments are perhaps more user-oriented than might be expected. Signed-off-by: Stephen Kitt --- Documentation/block/capability.rst | 16 +++------ include/linux/genhd.h | 52 ++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/Documentation/block/capability.rst b/Documentation/block/capability.rst index 2cf258d64bbe..26b9eccc48eb 100644 --- a/Documentation/block/capability.rst +++ b/Documentation/block/capability.rst @@ -2,17 +2,9 @@ Generic Block Device Capability =============================== -This file documents the sysfs file block//capability +This file documents the sysfs file ``block//capability``. -capability is a hex word indicating which capabilities a specific disk -supports. For more information on bits not listed here, see -include/linux/genhd.h +``capability`` is a hex word indicating which capabilities a specific +disk supports: -GENHD_FL_MEDIA_CHANGE_NOTIFY ----------------------------- - -Value: 4 - -When this bit is set, the disk supports Asynchronous Notification -of media change events. These events will be broadcast to user -space via kernel uevent. +.. kernel-doc:: include/linux/genhd.h diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6fbe58538ad6..d56aa4ccd34f 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -133,13 +133,59 @@ struct hd_struct { struct rcu_work rcu_work; }; +/** + * DOC: genhd capability flags + * + * ``GENHD_FL_REMOVABLE`` (1): indicates that the block device gives + * access to removable media. + * When set, the device remains present even when media is not + * inserted. + * Must not be set for devices which are removed entirely when the + * media is removed. + * + * ``GENHD_FL_CD`` (8): the block device is a CD-ROM-style device. + * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl. + * + * ``GENHD_FL_UP`` (16): indicates that the block device is "up", with + * a similar meaning to network interfaces. + * + * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (32): don't include partition + * information in ``/proc/partitions`` or in the output of + * printk_all_partitions(). + * Used for the null block device and some MMC devices. + * + * ``GENHD_FL_EXT_DEVT`` (64): the driver supports extended dynamic + * ``dev_t``, i.e. it wants extended device numbers + * (``BLOCK_EXT_MAJOR``). + * This affects the maximum number of partitions. + * + * ``GENHD_FL_NATIVE_CAPACITY`` (128): based on information in the + * partition table, the device's capacity has been extended to its + * native capacity; i.e. the device has hidden capacity used by one + * of the partitions (this is a flag used so that native capacity is + * only ever unlocked once). + * + * ``GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE`` (256): event polling is + * blocked whenever a writer holds an exclusive lock. + * + * ``GENHD_FL_NO_PART_SCAN`` (512): partition scanning is disabled. + * Used for loop devices in their default settings and some MMC + * devices. + * + * ``GENHD_FL_HIDDEN`` (1024): the block device is hidden; it doesn't + * produce events, doesn't appear in sysfs, and doesn't have an + * associated ``bdev``. + * Implies ``GENHD_FL_SUPPRESS_PARTITION_INFO`` and + * ``GENHD_FL_NO_PART_SCAN``. + * Used for multipath devices. + */ #define GENHD_FL_REMOVABLE 1 -/* 2 is unused */ -#define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 +/* 2 is unused (used to be GENHD_FL_DRIVERFS) */ +/* 4 is unused (used to be GENHD_FL_MEDIA_CHANGE_NOTIFY) */ #define GENHD_FL_CD 8 #define GENHD_FL_UP 16 #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 -#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ +#define GENHD_FL_EXT_DEVT 64 #define GENHD_FL_NATIVE_CAPACITY 128 #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 #define GENHD_FL_NO_PART_SCAN 512 base-commit: aeb542a1b5c507ea117d21c3e3e012ba16f065ac -- 2.20.1