forked from Minki/linux
block: remove genhd.h
There is no good reason to keep genhd.h separate from the main blkdev.h header that includes it. So fold the contents of genhd.h into blkdev.h and remove genhd.h entirely. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20220124093913.742411-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
e7243285c0
commit
322cbb50de
@ -7,4 +7,4 @@ This file documents the sysfs file ``block/<disk>/capability``.
|
||||
``capability`` is a bitfield, printed in hexadecimal, indicating which
|
||||
capabilities a specific block device supports:
|
||||
|
||||
.. kernel-doc:: include/linux/genhd.h
|
||||
.. kernel-doc:: include/linux/blkdev.h
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/bcd.h>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/init.h>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/ctype.h>
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
#include <linux/export.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include "blk.h"
|
||||
|
||||
struct disk_events {
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
struct bd_holder_disk {
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/genhd.h>
|
||||
#include "../blk.h"
|
||||
|
||||
/*
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <linux/major.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/blktrace_api.h>
|
||||
#include <linux/raid/detect.h>
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/string.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/fs.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <uapi/linux/sed-opal.h>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/mutex.h>
|
||||
#include "base.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/netdevice.h>
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/shmem_fs.h>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <linux/ioctl.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/export.h>
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/kthread.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <linux/major.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/dynamic_debug.h>
|
||||
#include <net/tcp.h>
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/compat.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/bio.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/rwsem.h>
|
||||
#include <linux/ata.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/genhd.h>
|
||||
|
||||
/* Offset of Subsystem Device ID in pci confoguration space */
|
||||
#define PCI_SUBSYSTEM_DEVICEID 0x2E
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/device.h>
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/backing-dev.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
@ -330,7 +330,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/nodemask.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/blk-crypto-profile.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
@ -6,7 +6,6 @@
|
||||
* Based on Sharp's NAND driver sharp_sl.c
|
||||
*/
|
||||
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/nd.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/ndctl.h>
|
||||
#include <linux/fs.h>
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fs.h>
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/ndctl.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <linux/memremap.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fs.h>
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/log2.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/list.h>
|
||||
#include <asm/eadm.h>
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <asm/debug.h>
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/proc_fs.h>
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/pagemap.h>
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/idr.h>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#ifndef _SR_H
|
||||
#define _SR_H
|
||||
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/file.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/scatterlist.h>
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <linux/blk_types.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/module.h>
|
||||
|
@ -78,7 +78,6 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
|
1
fs/dax.c
1
fs/dax.c
@ -11,7 +11,6 @@
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/dax.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/memcontrol.h>
|
||||
#include <linux/mm.h>
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfs2_ondisk.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
#include "gfs2.h"
|
||||
#include "incore.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/nls.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "hfsplus_fs.h"
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/xattr.h>
|
||||
#include <linux/falloc.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/fsnotify.h>
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/slab.h>
|
||||
|
@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
#include "blocklayout.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
#include <linux/exportfs.h>
|
||||
#include <linux/iomap.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pr.h>
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Portions Copyright (C) 1992 Drew Eckhardt
|
||||
*/
|
||||
#ifndef _LINUX_BLKDEV_H
|
||||
#define _LINUX_BLKDEV_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/blk_types.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/llist.h>
|
||||
#include <linux/minmax.h>
|
||||
@ -12,11 +16,15 @@
|
||||
#include <linux/wait.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/percpu-refcount.h>
|
||||
#include <linux/blkzoned.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sbitmap.h>
|
||||
#include <linux/srcu.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <linux/xarray.h>
|
||||
|
||||
struct module;
|
||||
struct request_queue;
|
||||
@ -33,6 +41,10 @@ struct blk_queue_stats;
|
||||
struct blk_stat_callback;
|
||||
struct blk_crypto_profile;
|
||||
|
||||
extern const struct device_type disk_type;
|
||||
extern struct device_type part_type;
|
||||
extern struct class block_class;
|
||||
|
||||
/* Must be consistent with blk_mq_poll_stats_bkt() */
|
||||
#define BLK_MQ_POLL_STATS_BKTS 16
|
||||
|
||||
@ -45,6 +57,144 @@ struct blk_crypto_profile;
|
||||
*/
|
||||
#define BLKCG_MAX_POLS 6
|
||||
|
||||
#define DISK_MAX_PARTS 256
|
||||
#define DISK_NAME_LEN 32
|
||||
|
||||
#define PARTITION_META_INFO_VOLNAMELTH 64
|
||||
/*
|
||||
* Enough for the string representation of any kind of UUID plus NULL.
|
||||
* EFI UUID is 36 characters. MSDOS UUID is 11 characters.
|
||||
*/
|
||||
#define PARTITION_META_INFO_UUIDLTH (UUID_STRING_LEN + 1)
|
||||
|
||||
struct partition_meta_info {
|
||||
char uuid[PARTITION_META_INFO_UUIDLTH];
|
||||
u8 volname[PARTITION_META_INFO_VOLNAMELTH];
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC: genhd capability flags
|
||||
*
|
||||
* ``GENHD_FL_REMOVABLE``: indicates that the block device gives access to
|
||||
* removable media. When set, the device remains present even when media is not
|
||||
* inserted. Shall not be set for devices which are removed entirely when the
|
||||
* media is removed.
|
||||
*
|
||||
* ``GENHD_FL_HIDDEN``: the block device is hidden; it doesn't produce events,
|
||||
* doesn't appear in sysfs, and can't be opened from userspace or using
|
||||
* blkdev_get*. Used for the underlying components of multipath devices.
|
||||
*
|
||||
* ``GENHD_FL_NO_PART``: partition support is disabled. The kernel will not
|
||||
* scan for partitions from add_disk, and users can't add partitions manually.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
GENHD_FL_REMOVABLE = 1 << 0,
|
||||
GENHD_FL_HIDDEN = 1 << 1,
|
||||
GENHD_FL_NO_PART = 1 << 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
|
||||
DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
|
||||
};
|
||||
|
||||
enum {
|
||||
/* Poll even if events_poll_msecs is unset */
|
||||
DISK_EVENT_FLAG_POLL = 1 << 0,
|
||||
/* Forward events to udev */
|
||||
DISK_EVENT_FLAG_UEVENT = 1 << 1,
|
||||
/* Block event polling when open for exclusive write */
|
||||
DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE = 1 << 2,
|
||||
};
|
||||
|
||||
struct disk_events;
|
||||
struct badblocks;
|
||||
|
||||
struct blk_integrity {
|
||||
const struct blk_integrity_profile *profile;
|
||||
unsigned char flags;
|
||||
unsigned char tuple_size;
|
||||
unsigned char interval_exp;
|
||||
unsigned char tag_size;
|
||||
};
|
||||
|
||||
struct gendisk {
|
||||
/*
|
||||
* major/first_minor/minors should not be set by any new driver, the
|
||||
* block core will take care of allocating them automatically.
|
||||
*/
|
||||
int major;
|
||||
int first_minor;
|
||||
int minors;
|
||||
|
||||
char disk_name[DISK_NAME_LEN]; /* name of major driver */
|
||||
|
||||
unsigned short events; /* supported events */
|
||||
unsigned short event_flags; /* flags related to event processing */
|
||||
|
||||
struct xarray part_tbl;
|
||||
struct block_device *part0;
|
||||
|
||||
const struct block_device_operations *fops;
|
||||
struct request_queue *queue;
|
||||
void *private_data;
|
||||
|
||||
int flags;
|
||||
unsigned long state;
|
||||
#define GD_NEED_PART_SCAN 0
|
||||
#define GD_READ_ONLY 1
|
||||
#define GD_DEAD 2
|
||||
#define GD_NATIVE_CAPACITY 3
|
||||
|
||||
struct mutex open_mutex; /* open/close mutex */
|
||||
unsigned open_partitions; /* number of open partitions */
|
||||
|
||||
struct backing_dev_info *bdi;
|
||||
struct kobject *slave_dir;
|
||||
#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
|
||||
struct list_head slave_bdevs;
|
||||
#endif
|
||||
struct timer_rand_state *random;
|
||||
atomic_t sync_io; /* RAID */
|
||||
struct disk_events *ev;
|
||||
#ifdef CONFIG_BLK_DEV_INTEGRITY
|
||||
struct kobject integrity_kobj;
|
||||
#endif /* CONFIG_BLK_DEV_INTEGRITY */
|
||||
#if IS_ENABLED(CONFIG_CDROM)
|
||||
struct cdrom_device_info *cdi;
|
||||
#endif
|
||||
int node_id;
|
||||
struct badblocks *bb;
|
||||
struct lockdep_map lockdep_map;
|
||||
u64 diskseq;
|
||||
};
|
||||
|
||||
static inline bool disk_live(struct gendisk *disk)
|
||||
{
|
||||
return !inode_unhashed(disk->part0->bd_inode);
|
||||
}
|
||||
|
||||
/*
|
||||
* The gendisk is refcounted by the part0 block_device, and the bd_device
|
||||
* therein is also used for device model presentation in sysfs.
|
||||
*/
|
||||
#define dev_to_disk(device) \
|
||||
(dev_to_bdev(device)->bd_disk)
|
||||
#define disk_to_dev(disk) \
|
||||
(&((disk)->part0->bd_device))
|
||||
|
||||
#if IS_REACHABLE(CONFIG_CDROM)
|
||||
#define disk_to_cdi(disk) ((disk)->cdi)
|
||||
#else
|
||||
#define disk_to_cdi(disk) NULL
|
||||
#endif
|
||||
|
||||
static inline dev_t disk_devt(struct gendisk *disk)
|
||||
{
|
||||
return MKDEV(disk->major, disk->first_minor);
|
||||
}
|
||||
|
||||
static inline int blk_validate_block_size(unsigned long bsize)
|
||||
{
|
||||
if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
|
||||
@ -596,6 +746,118 @@ static inline unsigned int blk_queue_depth(struct request_queue *q)
|
||||
#define for_each_bio(_bio) \
|
||||
for (; _bio; _bio = _bio->bi_next)
|
||||
|
||||
int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
const struct attribute_group **groups);
|
||||
static inline int __must_check add_disk(struct gendisk *disk)
|
||||
{
|
||||
return device_add_disk(NULL, disk, NULL);
|
||||
}
|
||||
void del_gendisk(struct gendisk *gp);
|
||||
void invalidate_disk(struct gendisk *disk);
|
||||
void set_disk_ro(struct gendisk *disk, bool read_only);
|
||||
void disk_uevent(struct gendisk *disk, enum kobject_action action);
|
||||
|
||||
static inline int get_disk_ro(struct gendisk *disk)
|
||||
{
|
||||
return disk->part0->bd_read_only ||
|
||||
test_bit(GD_READ_ONLY, &disk->state);
|
||||
}
|
||||
|
||||
static inline int bdev_read_only(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
|
||||
}
|
||||
|
||||
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
||||
bool disk_force_media_change(struct gendisk *disk, unsigned int events);
|
||||
|
||||
void add_disk_randomness(struct gendisk *disk) __latent_entropy;
|
||||
void rand_initialize_disk(struct gendisk *disk);
|
||||
|
||||
static inline sector_t get_start_sect(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_start_sect;
|
||||
}
|
||||
|
||||
static inline sector_t bdev_nr_sectors(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_nr_sectors;
|
||||
}
|
||||
|
||||
static inline loff_t bdev_nr_bytes(struct block_device *bdev)
|
||||
{
|
||||
return (loff_t)bdev_nr_sectors(bdev) << SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
static inline sector_t get_capacity(struct gendisk *disk)
|
||||
{
|
||||
return bdev_nr_sectors(disk->part0);
|
||||
}
|
||||
|
||||
static inline u64 sb_bdev_nr_blocks(struct super_block *sb)
|
||||
{
|
||||
return bdev_nr_sectors(sb->s_bdev) >>
|
||||
(sb->s_blocksize_bits - SECTOR_SHIFT);
|
||||
}
|
||||
|
||||
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
|
||||
|
||||
struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
|
||||
struct lock_class_key *lkclass);
|
||||
void put_disk(struct gendisk *disk);
|
||||
struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass);
|
||||
|
||||
/**
|
||||
* blk_alloc_disk - allocate a gendisk structure
|
||||
* @node_id: numa node to allocate on
|
||||
*
|
||||
* Allocate and pre-initialize a gendisk structure for use with BIO based
|
||||
* drivers.
|
||||
*
|
||||
* Context: can sleep
|
||||
*/
|
||||
#define blk_alloc_disk(node_id) \
|
||||
({ \
|
||||
static struct lock_class_key __key; \
|
||||
\
|
||||
__blk_alloc_disk(node_id, &__key); \
|
||||
})
|
||||
void blk_cleanup_disk(struct gendisk *disk);
|
||||
|
||||
int __register_blkdev(unsigned int major, const char *name,
|
||||
void (*probe)(dev_t devt));
|
||||
#define register_blkdev(major, name) \
|
||||
__register_blkdev(major, name, NULL)
|
||||
void unregister_blkdev(unsigned int major, const char *name);
|
||||
|
||||
bool bdev_check_media_change(struct block_device *bdev);
|
||||
int __invalidate_device(struct block_device *bdev, bool kill_dirty);
|
||||
void set_capacity(struct gendisk *disk, sector_t size);
|
||||
|
||||
#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
|
||||
int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
|
||||
void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk);
|
||||
int bd_register_pending_holders(struct gendisk *disk);
|
||||
#else
|
||||
static inline int bd_link_disk_holder(struct block_device *bdev,
|
||||
struct gendisk *disk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void bd_unlink_disk_holder(struct block_device *bdev,
|
||||
struct gendisk *disk)
|
||||
{
|
||||
}
|
||||
static inline int bd_register_pending_holders(struct gendisk *disk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BLOCK_HOLDER_DEPRECATED */
|
||||
|
||||
dev_t part_devt(struct gendisk *disk, u8 partno);
|
||||
void inc_diskseq(struct gendisk *disk);
|
||||
dev_t blk_lookup_devt(const char *name, int partno);
|
||||
void blk_request_module(dev_t devt);
|
||||
|
||||
extern int blk_register_queue(struct gendisk *disk);
|
||||
extern void blk_unregister_queue(struct gendisk *disk);
|
||||
@ -1311,6 +1573,7 @@ void invalidate_bdev(struct block_device *bdev);
|
||||
int sync_blockdev(struct block_device *bdev);
|
||||
int sync_blockdev_nowait(struct block_device *bdev);
|
||||
void sync_bdevs(bool wait);
|
||||
void printk_all_partitions(void);
|
||||
#else
|
||||
static inline void invalidate_bdev(struct block_device *bdev)
|
||||
{
|
||||
@ -1326,7 +1589,11 @@ static inline int sync_blockdev_nowait(struct block_device *bdev)
|
||||
static inline void sync_bdevs(bool wait)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
static inline void printk_all_partitions(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
int fsync_bdev(struct block_device *bdev);
|
||||
|
||||
int freeze_bdev(struct block_device *bdev);
|
||||
|
@ -1,287 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_GENHD_H
|
||||
#define _LINUX_GENHD_H
|
||||
|
||||
/*
|
||||
* genhd.h Copyright (C) 1992 Drew Eckhardt
|
||||
* Generic hard disk header file by
|
||||
* Drew Eckhardt
|
||||
*
|
||||
* <drew@colorado.edu>
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <linux/blk_types.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/xarray.h>
|
||||
|
||||
extern const struct device_type disk_type;
|
||||
extern struct device_type part_type;
|
||||
extern struct class block_class;
|
||||
|
||||
#define DISK_MAX_PARTS 256
|
||||
#define DISK_NAME_LEN 32
|
||||
|
||||
#define PARTITION_META_INFO_VOLNAMELTH 64
|
||||
/*
|
||||
* Enough for the string representation of any kind of UUID plus NULL.
|
||||
* EFI UUID is 36 characters. MSDOS UUID is 11 characters.
|
||||
*/
|
||||
#define PARTITION_META_INFO_UUIDLTH (UUID_STRING_LEN + 1)
|
||||
|
||||
struct partition_meta_info {
|
||||
char uuid[PARTITION_META_INFO_UUIDLTH];
|
||||
u8 volname[PARTITION_META_INFO_VOLNAMELTH];
|
||||
};
|
||||
|
||||
/**
|
||||
* DOC: genhd capability flags
|
||||
*
|
||||
* ``GENHD_FL_REMOVABLE``: indicates that the block device gives access to
|
||||
* removable media. When set, the device remains present even when media is not
|
||||
* inserted. Shall not be set for devices which are removed entirely when the
|
||||
* media is removed.
|
||||
*
|
||||
* ``GENHD_FL_HIDDEN``: the block device is hidden; it doesn't produce events,
|
||||
* doesn't appear in sysfs, and can't be opened from userspace or using
|
||||
* blkdev_get*. Used for the underlying components of multipath devices.
|
||||
*
|
||||
* ``GENHD_FL_NO_PART``: partition support is disabled. The kernel will not
|
||||
* scan for partitions from add_disk, and users can't add partitions manually.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
GENHD_FL_REMOVABLE = 1 << 0,
|
||||
GENHD_FL_HIDDEN = 1 << 1,
|
||||
GENHD_FL_NO_PART = 1 << 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
|
||||
DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
|
||||
};
|
||||
|
||||
enum {
|
||||
/* Poll even if events_poll_msecs is unset */
|
||||
DISK_EVENT_FLAG_POLL = 1 << 0,
|
||||
/* Forward events to udev */
|
||||
DISK_EVENT_FLAG_UEVENT = 1 << 1,
|
||||
/* Block event polling when open for exclusive write */
|
||||
DISK_EVENT_FLAG_BLOCK_ON_EXCL_WRITE = 1 << 2,
|
||||
};
|
||||
|
||||
struct disk_events;
|
||||
struct badblocks;
|
||||
|
||||
struct blk_integrity {
|
||||
const struct blk_integrity_profile *profile;
|
||||
unsigned char flags;
|
||||
unsigned char tuple_size;
|
||||
unsigned char interval_exp;
|
||||
unsigned char tag_size;
|
||||
};
|
||||
|
||||
struct gendisk {
|
||||
/*
|
||||
* major/first_minor/minors should not be set by any new driver, the
|
||||
* block core will take care of allocating them automatically.
|
||||
*/
|
||||
int major;
|
||||
int first_minor;
|
||||
int minors;
|
||||
|
||||
char disk_name[DISK_NAME_LEN]; /* name of major driver */
|
||||
|
||||
unsigned short events; /* supported events */
|
||||
unsigned short event_flags; /* flags related to event processing */
|
||||
|
||||
struct xarray part_tbl;
|
||||
struct block_device *part0;
|
||||
|
||||
const struct block_device_operations *fops;
|
||||
struct request_queue *queue;
|
||||
void *private_data;
|
||||
|
||||
int flags;
|
||||
unsigned long state;
|
||||
#define GD_NEED_PART_SCAN 0
|
||||
#define GD_READ_ONLY 1
|
||||
#define GD_DEAD 2
|
||||
#define GD_NATIVE_CAPACITY 3
|
||||
|
||||
struct mutex open_mutex; /* open/close mutex */
|
||||
unsigned open_partitions; /* number of open partitions */
|
||||
|
||||
struct backing_dev_info *bdi;
|
||||
struct kobject *slave_dir;
|
||||
#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
|
||||
struct list_head slave_bdevs;
|
||||
#endif
|
||||
struct timer_rand_state *random;
|
||||
atomic_t sync_io; /* RAID */
|
||||
struct disk_events *ev;
|
||||
#ifdef CONFIG_BLK_DEV_INTEGRITY
|
||||
struct kobject integrity_kobj;
|
||||
#endif /* CONFIG_BLK_DEV_INTEGRITY */
|
||||
#if IS_ENABLED(CONFIG_CDROM)
|
||||
struct cdrom_device_info *cdi;
|
||||
#endif
|
||||
int node_id;
|
||||
struct badblocks *bb;
|
||||
struct lockdep_map lockdep_map;
|
||||
u64 diskseq;
|
||||
};
|
||||
|
||||
static inline bool disk_live(struct gendisk *disk)
|
||||
{
|
||||
return !inode_unhashed(disk->part0->bd_inode);
|
||||
}
|
||||
|
||||
/*
|
||||
* The gendisk is refcounted by the part0 block_device, and the bd_device
|
||||
* therein is also used for device model presentation in sysfs.
|
||||
*/
|
||||
#define dev_to_disk(device) \
|
||||
(dev_to_bdev(device)->bd_disk)
|
||||
#define disk_to_dev(disk) \
|
||||
(&((disk)->part0->bd_device))
|
||||
|
||||
#if IS_REACHABLE(CONFIG_CDROM)
|
||||
#define disk_to_cdi(disk) ((disk)->cdi)
|
||||
#else
|
||||
#define disk_to_cdi(disk) NULL
|
||||
#endif
|
||||
|
||||
static inline dev_t disk_devt(struct gendisk *disk)
|
||||
{
|
||||
return MKDEV(disk->major, disk->first_minor);
|
||||
}
|
||||
|
||||
void disk_uevent(struct gendisk *disk, enum kobject_action action);
|
||||
|
||||
/* block/genhd.c */
|
||||
int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
|
||||
const struct attribute_group **groups);
|
||||
static inline int __must_check add_disk(struct gendisk *disk)
|
||||
{
|
||||
return device_add_disk(NULL, disk, NULL);
|
||||
}
|
||||
extern void del_gendisk(struct gendisk *gp);
|
||||
|
||||
void invalidate_disk(struct gendisk *disk);
|
||||
|
||||
void set_disk_ro(struct gendisk *disk, bool read_only);
|
||||
|
||||
static inline int get_disk_ro(struct gendisk *disk)
|
||||
{
|
||||
return disk->part0->bd_read_only ||
|
||||
test_bit(GD_READ_ONLY, &disk->state);
|
||||
}
|
||||
|
||||
static inline int bdev_read_only(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
|
||||
}
|
||||
|
||||
bool set_capacity_and_notify(struct gendisk *disk, sector_t size);
|
||||
bool disk_force_media_change(struct gendisk *disk, unsigned int events);
|
||||
|
||||
/* drivers/char/random.c */
|
||||
extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
|
||||
extern void rand_initialize_disk(struct gendisk *disk);
|
||||
|
||||
static inline sector_t get_start_sect(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_start_sect;
|
||||
}
|
||||
|
||||
static inline sector_t bdev_nr_sectors(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_nr_sectors;
|
||||
}
|
||||
|
||||
static inline loff_t bdev_nr_bytes(struct block_device *bdev)
|
||||
{
|
||||
return (loff_t)bdev_nr_sectors(bdev) << SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
static inline sector_t get_capacity(struct gendisk *disk)
|
||||
{
|
||||
return bdev_nr_sectors(disk->part0);
|
||||
}
|
||||
|
||||
static inline u64 sb_bdev_nr_blocks(struct super_block *sb)
|
||||
{
|
||||
return bdev_nr_sectors(sb->s_bdev) >>
|
||||
(sb->s_blocksize_bits - SECTOR_SHIFT);
|
||||
}
|
||||
|
||||
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
|
||||
|
||||
struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
|
||||
struct lock_class_key *lkclass);
|
||||
extern void put_disk(struct gendisk *disk);
|
||||
struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass);
|
||||
|
||||
/**
|
||||
* blk_alloc_disk - allocate a gendisk structure
|
||||
* @node_id: numa node to allocate on
|
||||
*
|
||||
* Allocate and pre-initialize a gendisk structure for use with BIO based
|
||||
* drivers.
|
||||
*
|
||||
* Context: can sleep
|
||||
*/
|
||||
#define blk_alloc_disk(node_id) \
|
||||
({ \
|
||||
static struct lock_class_key __key; \
|
||||
\
|
||||
__blk_alloc_disk(node_id, &__key); \
|
||||
})
|
||||
void blk_cleanup_disk(struct gendisk *disk);
|
||||
|
||||
int __register_blkdev(unsigned int major, const char *name,
|
||||
void (*probe)(dev_t devt));
|
||||
#define register_blkdev(major, name) \
|
||||
__register_blkdev(major, name, NULL)
|
||||
void unregister_blkdev(unsigned int major, const char *name);
|
||||
|
||||
bool bdev_check_media_change(struct block_device *bdev);
|
||||
int __invalidate_device(struct block_device *bdev, bool kill_dirty);
|
||||
void set_capacity(struct gendisk *disk, sector_t size);
|
||||
|
||||
#ifdef CONFIG_BLOCK_HOLDER_DEPRECATED
|
||||
int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
|
||||
void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk);
|
||||
int bd_register_pending_holders(struct gendisk *disk);
|
||||
#else
|
||||
static inline int bd_link_disk_holder(struct block_device *bdev,
|
||||
struct gendisk *disk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void bd_unlink_disk_holder(struct block_device *bdev,
|
||||
struct gendisk *disk)
|
||||
{
|
||||
}
|
||||
static inline int bd_register_pending_holders(struct gendisk *disk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BLOCK_HOLDER_DEPRECATED */
|
||||
|
||||
dev_t part_devt(struct gendisk *disk, u8 partno);
|
||||
void inc_diskseq(struct gendisk *disk);
|
||||
dev_t blk_lookup_devt(const char *name, int partno);
|
||||
void blk_request_module(dev_t devt);
|
||||
#ifdef CONFIG_BLOCK
|
||||
void printk_all_partitions(void);
|
||||
#else /* CONFIG_BLOCK */
|
||||
static inline void printk_all_partitions(void)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
#endif /* _LINUX_GENHD_H */
|
@ -2,7 +2,7 @@
|
||||
#ifndef _LINUX_PART_STAT_H
|
||||
#define _LINUX_PART_STAT_H
|
||||
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <asm/local.h>
|
||||
|
||||
struct disk_stats {
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <linux/root_dev.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/init.h>
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/syscore_ops.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/secretmem.h>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/file.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/blkdev.h>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <linux/parser.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/rculist.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/ima.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user