summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-06-16 10:32:47 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2026-06-16 10:32:47 +0300
commitba9c792c824fff732df85119011d399d9b6d9155 (patch)
treea6de1eda726e4e9156366b6fd960b81d09297aa3 /include
parent9b40ba14edcdf70240af8114092a76f75f070774 (diff)
parentc7c76f9232bd34835d821f14abdc5fafc17bc938 (diff)
downloadlinux-ba9c792c824fff732df85119011d399d9b6d9155.tar.xz
Merge tag 'for-7.2/block-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull block updates from Jens Axboe: - NVMe pull request via Keith: - Per-controller admin and IO timeout sysfs attributes, and letting the block layer set request timeouts (Maurizio, Maximilian) - Multipath passthrough iostats, and PCI P2PDMA enablement for multipath devices (Keith, Kiran) - A new diag sysfs attribute group exporting per-controller counters (retries, multipath failover, error counters, requeue and failure counts, reset and reconnect events) (Nilay) - FDP configuration validation and bounds check fixes (liuxixin) - Various nvmet fixes, including a pre-auth out-of-bounds read in the Discovery Get Log Page handler, auth payload bounds validation, and tcp error-path leak fixes (Bryam, Tianchu, Geliang) - nvme-tcp lockdep and workqueue fixes (Shin'ichiro, Kuniyuki, Eric) - Assorted other fixes and cleanups (John, Yao, Chao, Mateusz, Achkinazi, Wentao) - MD pull request via Yu Kuai: - raid1/raid10 fixes for a deadlock in the read error recovery path, error-path detection and bio accounting with cloned bios, and an nr_pending leak in the REQ_ATOMIC bad-block error path (Abd-Alrhman) - PCI P2PDMA propagation from member devices to the RAID device (Kiran) - dm-raid bio requeue fix, and various smaller fixes and cleanups (Benjamin, Chen, Li, Thorsten) - Enable Clang lock context analysis for the block layer, with the accompanying annotations across queue limits, the blk_holder_ops callbacks, crypto, cgroup, iocost, kyber and mq-deadline (Bart) - Block status code infrastructure work: a tagged status table, a str_to_blk_op() helper, a bio_endio_status() helper, and on top of that a new configurable block-layer error injection facility (Christoph) - DRBD netlink rework, replacing the genl_magic machinery with explicit netlink serialization and moving the DRBD UAPI headers to include/uapi/linux/ (Christoph Böhmwalder) - bvec improvements: a bvec_folio() helper and making the bvec_iter helpers proper inline functions (Willy, Christoph) - ublk cleanups and a canceling-flag fix for the disk-not-allocated case (Caleb, Ming) - Partition handling fixes: bound the AIX pp_count scan, fix an of_node refcount leak, and replace __get_free_page() with kmalloc() (Bryam, Wentao, Mike) - Convert numa_node to int in blk_mq_hw_ctx and ->init_request, and add WQ_PERCPU to the block workqueue users (Mateusz, Marco) - Block statistics and tracing: propagate in-flight to the whole disk on partition IO, export passthrough stats, and a new block_rq_tag_wait tracepoint (Tang, Keith, Aaron) - A round of removals, unexports and cleanups across bio, direct-io and the bvec helpers (Christoph) - Various driver fixes (mtip32xx use-after-free, rbd snap_count validation and strscpy conversion, nbd socket lockdep reclassify, virtio-blk zone report clamp, floppy) and a batch of MAINTAINERS email/list updates (Coly, Li, Yu, Christoph Böhmwalder) - Other little fixes and cleanups all over * tag 'for-7.2/block-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (117 commits) MAINTAINERS: Update Coly Li's email address block: check bio split for unaligned bvec nbd: Reclassify sockets to avoid lockdep circular dependency block: add configurable error injection block: add a str_to_blk_op helper block: add a "tag" for block status codes block: add a macro to initialize the status table floppy: Drop unused pnp driver data block: propagate in_flight to whole disk on partition I/O virtio-blk: clamp zone report to the report buffer capacity block: optimize I/O merge hot path with unlikely() hints drivers/block/rbd: Use strscpy() to copy strings into arrays partitions: aix: bound the pp_count scan to the ppe array block: Enable lock context analysis block/mq-deadline: Make the lock context annotations compatible with Clang block/Kyber: Make the lock context annotations compatible with Clang block/blk-mq-debugfs: Improve lock context annotations block/blk-iocost: Inline iocg_lock() and iocg_unlock() block/blk-iocost: Split ioc_rqos_throttle() block/crypto: Annotate the crypto functions ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/bio.h32
-rw-r--r--include/linux/blk-mq.h53
-rw-r--r--include/linux/blkdev.h28
-rw-r--r--include/linux/bvec.h112
-rw-r--r--include/linux/drbd_config.h16
-rw-r--r--include/linux/drbd_genl.h536
-rw-r--r--include/linux/drbd_genl_api.h56
-rw-r--r--include/linux/genl_magic_func.h413
-rw-r--r--include/linux/genl_magic_struct.h272
-rw-r--r--include/trace/events/block.h59
-rw-r--r--include/uapi/linux/drbd.h (renamed from include/linux/drbd.h)73
-rw-r--r--include/uapi/linux/drbd_genl.h359
-rw-r--r--include/uapi/linux/drbd_limits.h (renamed from include/linux/drbd_limits.h)10
13 files changed, 636 insertions, 1383 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 8300d5565e36..8f33f717b14f 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -283,7 +283,7 @@ static inline void bio_first_folio(struct folio_iter *fi, struct bio *bio,
return;
}
- fi->folio = page_folio(bvec->bv_page);
+ fi->folio = bvec_folio(bvec);
fi->offset = bvec->bv_offset +
PAGE_SIZE * folio_page_idx(fi->folio, bvec->bv_page);
fi->_seg_count = bvec->bv_len;
@@ -347,7 +347,6 @@ enum {
};
extern int bioset_init(struct bio_set *, unsigned int, unsigned int, int flags);
extern void bioset_exit(struct bio_set *);
-extern int biovec_init_pool(mempool_t *pool, int pool_entries);
struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
blk_opf_t opf, gfp_t gfp, struct bio_set *bs);
@@ -371,17 +370,27 @@ void submit_bio(struct bio *bio);
extern void bio_endio(struct bio *);
-static inline void bio_io_error(struct bio *bio)
+/**
+ * bio_endio_status - end I/O on a bio with a specific status
+ * @bio: bio
+ * @status: status to set
+ *
+ * Set @bio->bi_status to @status and call bio_endio().
+ **/
+static inline void bio_endio_status(struct bio *bio, blk_status_t status)
{
- bio->bi_status = BLK_STS_IOERR;
+ bio->bi_status = status;
bio_endio(bio);
}
+static inline void bio_io_error(struct bio *bio)
+{
+ bio_endio_status(bio, BLK_STS_IOERR);
+}
+
static inline void bio_wouldblock_error(struct bio *bio)
{
- bio_set_flag(bio, BIO_QUIET);
- bio->bi_status = BLK_STS_AGAIN;
- bio_endio(bio);
+ bio_endio_status(bio, BLK_STS_AGAIN);
}
/*
@@ -479,17 +488,10 @@ int bio_iov_iter_bounce(struct bio *bio, struct iov_iter *iter, size_t maxlen,
size_t minsize);
void bio_iov_iter_unbounce(struct bio *bio, bool is_error, bool mark_dirty);
-extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter,
- struct bio *src, struct bvec_iter *src_iter);
extern void bio_copy_data(struct bio *dst, struct bio *src);
extern void bio_free_pages(struct bio *bio);
+void zero_fill_bio(struct bio *bio);
void guard_bio_eod(struct bio *bio);
-void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter);
-
-static inline void zero_fill_bio(struct bio *bio)
-{
- zero_fill_bio_iter(bio, bio->bi_iter);
-}
static inline void bio_release_pages(struct bio *bio, bool mark_dirty)
{
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 18a2388ba581..af878597afb8 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -428,7 +428,7 @@ struct blk_mq_hw_ctx {
struct blk_mq_tags *sched_tags;
/** @numa_node: NUMA node the storage adapter has been connected to. */
- unsigned int numa_node;
+ int numa_node;
/** @queue_num: Index of this hardware queue. */
unsigned int queue_num;
@@ -653,7 +653,7 @@ struct blk_mq_ops {
* flush request.
*/
int (*init_request)(struct blk_mq_tag_set *set, struct request *,
- unsigned int, unsigned int);
+ unsigned int, int);
/**
* @exit_request: Ditto for exit/teardown.
*/
@@ -1104,6 +1104,7 @@ struct req_iterator {
/*
* blk_rq_pos() : the current sector
* blk_rq_bytes() : bytes left in the entire request
+ * blk_rq_has_data() : whether the request carries data
* blk_rq_cur_bytes() : bytes left in the current segment
* blk_rq_sectors() : sectors left in the entire request
* blk_rq_cur_sectors() : sectors left in the current segment
@@ -1119,6 +1120,14 @@ static inline unsigned int blk_rq_bytes(const struct request *rq)
return rq->__data_len;
}
+static inline bool blk_rq_has_data(const struct request *rq)
+{
+ return blk_rq_bytes(rq) &&
+ req_op(rq) != REQ_OP_DISCARD &&
+ req_op(rq) != REQ_OP_SECURE_ERASE &&
+ req_op(rq) != REQ_OP_WRITE_ZEROES;
+}
+
static inline int blk_rq_cur_bytes(const struct request *rq)
{
if (!rq->bio)
@@ -1243,4 +1252,44 @@ static inline int blk_rq_map_sg(struct request *rq, struct scatterlist *sglist)
}
void blk_dump_rq_flags(struct request *, char *);
+/**
+ * blk_rq_passthrough_stats - check if this request should account stats
+ * @rq: request to check
+ * @q: the queue accumulating the stats
+ *
+ * Note, @q does not necessarily need to be the request_queue that provides
+ * @rq.
+ *
+ * Return: true if stats should be accounted.
+ */
+static inline bool blk_rq_passthrough_stats(struct request *rq,
+ struct request_queue *q)
+{
+ struct bio *bio = rq->bio;
+
+ if (!blk_queue_passthrough_stat(q))
+ return false;
+
+ /* Requests without a bio do not transfer data. */
+ if (!bio)
+ return false;
+
+ /*
+ * Stats are accumulated in the bdev, so must have one attached to a
+ * bio to track stats. Most drivers do not set the bdev for passthrough
+ * requests, but nvme is one that will set it.
+ */
+ if (!bio->bi_bdev)
+ return false;
+
+ /*
+ * We don't know what a passthrough command does, but we know the
+ * payload size and data direction. Ensuring the size is aligned to the
+ * block size filters out most commands with payloads that don't
+ * represent sector access.
+ */
+ if (blk_rq_bytes(rq) & (bdev_logical_block_size(bio->bi_bdev) - 1))
+ return false;
+ return true;
+}
#endif /* BLK_MQ_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 890128cdea1c..5070851cf924 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -176,6 +176,7 @@ struct gendisk {
#define GD_SUPPRESS_PART_SCAN 5
#define GD_OWNS_QUEUE 6
#define GD_ZONE_APPEND_USED 7
+#define GD_ERROR_INJECT 8
struct mutex open_mutex; /* open/close mutex */
unsigned open_partitions; /* number of open partitions */
@@ -227,6 +228,11 @@ struct gendisk {
*/
struct blk_independent_access_ranges *ia_ranges;
+#ifdef CONFIG_BLK_ERROR_INJECTION
+ struct mutex error_injection_lock;
+ struct list_head error_injection_list;
+#endif
+
struct mutex rqos_state_mutex; /* rqos state change mutex */
};
@@ -1040,7 +1046,6 @@ extern const char *blk_op_str(enum req_op op);
int blk_status_to_errno(blk_status_t status);
blk_status_t errno_to_blk_status(int errno);
-const char *blk_status_to_str(blk_status_t status);
/* only poll the hardware once, don't continue until a completion was found */
#define BLK_POLL_ONESHOT (1 << 0)
@@ -1093,15 +1098,17 @@ static inline unsigned int blk_boundary_sectors_left(sector_t offset,
*/
static inline struct queue_limits
queue_limits_start_update(struct request_queue *q)
+ __acquires(&q->limits_lock)
{
mutex_lock(&q->limits_lock);
return q->limits;
}
int queue_limits_commit_update_frozen(struct request_queue *q,
- struct queue_limits *lim);
+ struct queue_limits *lim) __releases(&q->limits_lock);
int queue_limits_commit_update(struct request_queue *q,
- struct queue_limits *lim);
-int queue_limits_set(struct request_queue *q, struct queue_limits *lim);
+ struct queue_limits *lim) __releases(&q->limits_lock);
+int queue_limits_set(struct request_queue *q, struct queue_limits *lim)
+ __must_not_hold(&q->limits_lock);
int blk_validate_limits(struct queue_limits *lim);
/**
@@ -1113,6 +1120,7 @@ int blk_validate_limits(struct queue_limits *lim);
* starting update.
*/
static inline void queue_limits_cancel_update(struct request_queue *q)
+ __releases(&q->limits_lock)
{
mutex_unlock(&q->limits_lock);
}
@@ -1744,22 +1752,26 @@ void blkdev_show(struct seq_file *seqf, off_t offset);
#endif
struct blk_holder_ops {
- void (*mark_dead)(struct block_device *bdev, bool surprise);
+ void (*mark_dead)(struct block_device *bdev, bool surprise)
+ __releases(&bdev->bd_holder_lock);
/*
* Sync the file system mounted on the block device.
*/
- void (*sync)(struct block_device *bdev);
+ void (*sync)(struct block_device *bdev)
+ __releases(&bdev->bd_holder_lock);
/*
* Freeze the file system mounted on the block device.
*/
- int (*freeze)(struct block_device *bdev);
+ int (*freeze)(struct block_device *bdev)
+ __releases(&bdev->bd_holder_lock);
/*
* Thaw the file system mounted on the block device.
*/
- int (*thaw)(struct block_device *bdev);
+ int (*thaw)(struct block_device *bdev)
+ __releases(&bdev->bd_holder_lock);
};
/*
diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index d36dd476feda..92837e2743f1 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -74,6 +74,21 @@ static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr,
bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr));
}
+/**
+ * bvec_folio - Return the first folio referenced by this bvec
+ * @bv: bvec to access
+ *
+ * A bvec can contain non-folio memory, so this should only be called by
+ * the creator of the bvec; drivers have no business looking at the owner
+ * of the memory. It may not even be the right interface for the caller
+ * to use as a bvec can span multiple folios. You may be better off using
+ * something like bio_for_each_folio_all() which iterates over all folios.
+ */
+static inline struct folio *bvec_folio(const struct bio_vec *bv)
+{
+ return page_folio(bv->bv_page);
+}
+
struct bvec_iter {
/*
* Current device address in 512 byte sectors. Only updated by the bio
@@ -104,51 +119,78 @@ struct bvec_iter_all {
unsigned done;
};
-/*
- * various member access, note that bio_data should of course not be used
- * on highmem page vectors
- */
-#define __bvec_iter_bvec(bvec, iter) (&(bvec)[(iter).bi_idx])
+static __always_inline const struct bio_vec *
+__bvec_iter_bvec(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return bvecs + iter.bi_idx;
+}
/* multi-page (mp_bvec) helpers */
-#define mp_bvec_iter_page(bvec, iter) \
- (__bvec_iter_bvec((bvec), (iter))->bv_page)
+static __always_inline struct page *
+mp_bvec_iter_page(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return __bvec_iter_bvec(bvecs, iter)->bv_page;
+}
-#define mp_bvec_iter_len(bvec, iter) \
- min((iter).bi_size, \
- __bvec_iter_bvec((bvec), (iter))->bv_len - (iter).bi_bvec_done)
+static __always_inline unsigned int
+mp_bvec_iter_len(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return min(__bvec_iter_bvec(bvecs, iter)->bv_len - iter.bi_bvec_done,
+ iter.bi_size);
+}
-#define mp_bvec_iter_offset(bvec, iter) \
- (__bvec_iter_bvec((bvec), (iter))->bv_offset + (iter).bi_bvec_done)
+static __always_inline unsigned int
+mp_bvec_iter_offset(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return __bvec_iter_bvec(bvecs, iter)->bv_offset + iter.bi_bvec_done;
+}
-#define mp_bvec_iter_page_idx(bvec, iter) \
- (mp_bvec_iter_offset((bvec), (iter)) / PAGE_SIZE)
+static __always_inline unsigned int
+mp_bvec_iter_page_idx(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return mp_bvec_iter_offset(bvecs, iter) / PAGE_SIZE;
+}
-#define mp_bvec_iter_bvec(bvec, iter) \
-((struct bio_vec) { \
- .bv_page = mp_bvec_iter_page((bvec), (iter)), \
- .bv_len = mp_bvec_iter_len((bvec), (iter)), \
- .bv_offset = mp_bvec_iter_offset((bvec), (iter)), \
-})
+static __always_inline struct bio_vec
+mp_bvec_iter_bvec(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return (struct bio_vec) {
+ .bv_page = mp_bvec_iter_page(bvecs, iter),
+ .bv_len = mp_bvec_iter_len(bvecs, iter),
+ .bv_offset = mp_bvec_iter_offset(bvecs, iter),
+ };
+}
/* For building single-page bvec in flight */
- #define bvec_iter_offset(bvec, iter) \
- (mp_bvec_iter_offset((bvec), (iter)) % PAGE_SIZE)
+static __always_inline unsigned int
+bvec_iter_offset(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return mp_bvec_iter_offset(bvecs, iter) % PAGE_SIZE;
+}
-#define bvec_iter_len(bvec, iter) \
- min_t(unsigned, mp_bvec_iter_len((bvec), (iter)), \
- PAGE_SIZE - bvec_iter_offset((bvec), (iter)))
+static __always_inline unsigned int
+bvec_iter_len(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return min(mp_bvec_iter_len(bvecs, iter),
+ PAGE_SIZE - bvec_iter_offset(bvecs, iter));
+}
-#define bvec_iter_page(bvec, iter) \
- (mp_bvec_iter_page((bvec), (iter)) + \
- mp_bvec_iter_page_idx((bvec), (iter)))
+static __always_inline struct page *
+bvec_iter_page(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return mp_bvec_iter_page(bvecs, iter) +
+ mp_bvec_iter_page_idx(bvecs, iter);
+}
-#define bvec_iter_bvec(bvec, iter) \
-((struct bio_vec) { \
- .bv_page = bvec_iter_page((bvec), (iter)), \
- .bv_len = bvec_iter_len((bvec), (iter)), \
- .bv_offset = bvec_iter_offset((bvec), (iter)), \
-})
+static __always_inline struct bio_vec
+bvec_iter_bvec(const struct bio_vec *bvecs, const struct bvec_iter iter)
+{
+ return (struct bio_vec) {
+ .bv_page = bvec_iter_page(bvecs, iter),
+ .bv_len = bvec_iter_len(bvecs, iter),
+ .bv_offset = bvec_iter_offset(bvecs, iter),
+ };
+}
static inline bool bvec_iter_advance(const struct bio_vec *bv,
struct bvec_iter *iter, unsigned bytes)
@@ -247,6 +289,7 @@ static inline void *bvec_kmap_local(struct bio_vec *bvec)
/**
* memcpy_from_bvec - copy data from a bvec
+ * @to: Kernel virtual address to copy to.
* @bvec: bvec to copy from
*
* Must be called on single-page bvecs only.
@@ -259,6 +302,7 @@ static inline void memcpy_from_bvec(char *to, struct bio_vec *bvec)
/**
* memcpy_to_bvec - copy data to a bvec
* @bvec: bvec to copy to
+ * @from: Kernel virtual address to copy from.
*
* Must be called on single-page bvecs only.
*/
diff --git a/include/linux/drbd_config.h b/include/linux/drbd_config.h
deleted file mode 100644
index d215365c6bb1..000000000000
--- a/include/linux/drbd_config.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * drbd_config.h
- * DRBD's compile time configuration.
- */
-
-#ifndef DRBD_CONFIG_H
-#define DRBD_CONFIG_H
-
-extern const char *drbd_buildtag(void);
-
-#define REL_VERSION "8.4.11"
-#define PRO_VERSION_MIN 86
-#define PRO_VERSION_MAX 101
-
-#endif
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
deleted file mode 100644
index f53c534aba0c..000000000000
--- a/include/linux/drbd_genl.h
+++ /dev/null
@@ -1,536 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * General overview:
- * full generic netlink message:
- * |nlmsghdr|genlmsghdr|<payload>
- *
- * payload:
- * |optional fixed size family header|<sequence of netlink attributes>
- *
- * sequence of netlink attributes:
- * I chose to have all "top level" attributes NLA_NESTED,
- * corresponding to some real struct.
- * So we have a sequence of |tla, len|<nested nla sequence>
- *
- * nested nla sequence:
- * may be empty, or contain a sequence of netlink attributes
- * representing the struct fields.
- *
- * The tag number of any field (regardless of containing struct)
- * will be available as T_ ## field_name,
- * so you cannot have the same field name in two differnt structs.
- *
- * The tag numbers themselves are per struct, though,
- * so should always begin at 1 (not 0, that is the special "NLA_UNSPEC" type,
- * which we won't use here).
- * The tag numbers are used as index in the respective nla_policy array.
- *
- * GENL_struct(tag_name, tag_number, struct name, struct fields) - struct and policy
- * genl_magic_struct.h
- * generates the struct declaration,
- * generates an entry in the tla enum,
- * genl_magic_func.h
- * generates an entry in the static tla policy
- * with .type = NLA_NESTED
- * generates the static <struct_name>_nl_policy definition,
- * and static conversion functions
- *
- * genl_magic_func.h
- *
- * GENL_mc_group(group)
- * genl_magic_struct.h
- * does nothing
- * genl_magic_func.h
- * defines and registers the mcast group,
- * and provides a send helper
- *
- * GENL_notification(op_name, op_num, mcast_group, tla list)
- * These are notifications to userspace.
- *
- * genl_magic_struct.h
- * generates an entry in the genl_ops enum,
- * genl_magic_func.h
- * does nothing
- *
- * mcast group: the name of the mcast group this notification should be
- * expected on
- * tla list: the list of expected top level attributes,
- * for documentation and sanity checking.
- *
- * GENL_op(op_name, op_num, flags and handler, tla list) - "genl operations"
- * These are requests from userspace.
- *
- * _op and _notification share the same "number space",
- * op_nr will be assigned to "genlmsghdr->cmd"
- *
- * genl_magic_struct.h
- * generates an entry in the genl_ops enum,
- * genl_magic_func.h
- * generates an entry in the static genl_ops array,
- * and static register/unregister functions to
- * genl_register_family().
- *
- * flags and handler:
- * GENL_op_init( .doit = x, .dumpit = y, .flags = something)
- * GENL_doit(x) => .dumpit = NULL, .flags = GENL_ADMIN_PERM
- * tla list: the list of expected top level attributes,
- * for documentation and sanity checking.
- */
-
-/*
- * STRUCTS
- */
-
-/* this is sent kernel -> userland on various error conditions, and contains
- * informational textual info, which is supposedly human readable.
- * The computer relevant return code is in the drbd_genlmsghdr.
- */
-GENL_struct(DRBD_NLA_CFG_REPLY, 1, drbd_cfg_reply,
- /* "arbitrary" size strings, nla_policy.len = 0 */
- __str_field(1, 0, info_text, 0)
-)
-
-/* Configuration requests typically need a context to operate on.
- * Possible keys are device minor (fits in the drbd_genlmsghdr),
- * the replication link (aka connection) name,
- * and/or the replication group (aka resource) name,
- * and the volume id within the resource. */
-GENL_struct(DRBD_NLA_CFG_CONTEXT, 2, drbd_cfg_context,
- __u32_field(1, 0, ctx_volume)
- __str_field(2, 0, ctx_resource_name, 128)
- __bin_field(3, 0, ctx_my_addr, 128)
- __bin_field(4, 0, ctx_peer_addr, 128)
-)
-
-GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
- __str_field(1, DRBD_F_REQUIRED | DRBD_F_INVARIANT, backing_dev, 128)
- __str_field(2, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev, 128)
- __s32_field(3, DRBD_F_REQUIRED | DRBD_F_INVARIANT, meta_dev_idx)
-
- /* use the resize command to try and change the disk_size */
- __u64_field(4, DRBD_F_INVARIANT, disk_size)
- /* we could change the max_bio_bvecs,
- * but it won't propagate through the stack */
- __u32_field(5, DRBD_F_INVARIANT, max_bio_bvecs)
-
- __u32_field_def(6, 0, on_io_error, DRBD_ON_IO_ERROR_DEF)
- __u32_field_def(7, 0, fencing, DRBD_FENCING_DEF)
-
- __u32_field_def(8, 0, resync_rate, DRBD_RESYNC_RATE_DEF)
- __s32_field_def(9, 0, resync_after, DRBD_MINOR_NUMBER_DEF)
- __u32_field_def(10, 0, al_extents, DRBD_AL_EXTENTS_DEF)
- __u32_field_def(11, 0, c_plan_ahead, DRBD_C_PLAN_AHEAD_DEF)
- __u32_field_def(12, 0, c_delay_target, DRBD_C_DELAY_TARGET_DEF)
- __u32_field_def(13, 0, c_fill_target, DRBD_C_FILL_TARGET_DEF)
- __u32_field_def(14, 0, c_max_rate, DRBD_C_MAX_RATE_DEF)
- __u32_field_def(15, 0, c_min_rate, DRBD_C_MIN_RATE_DEF)
- __u32_field_def(20, 0, disk_timeout, DRBD_DISK_TIMEOUT_DEF)
- __u32_field_def(21, 0 /* OPTIONAL */, read_balancing, DRBD_READ_BALANCING_DEF)
- __u32_field_def(25, 0 /* OPTIONAL */, rs_discard_granularity, DRBD_RS_DISCARD_GRANULARITY_DEF)
-
- __flg_field_def(16, 0, disk_barrier, DRBD_DISK_BARRIER_DEF)
- __flg_field_def(17, 0, disk_flushes, DRBD_DISK_FLUSHES_DEF)
- __flg_field_def(18, 0, disk_drain, DRBD_DISK_DRAIN_DEF)
- __flg_field_def(19, 0, md_flushes, DRBD_MD_FLUSHES_DEF)
- __flg_field_def(23, 0 /* OPTIONAL */, al_updates, DRBD_AL_UPDATES_DEF)
- __flg_field_def(24, 0 /* OPTIONAL */, discard_zeroes_if_aligned, DRBD_DISCARD_ZEROES_IF_ALIGNED_DEF)
- __flg_field_def(26, 0 /* OPTIONAL */, disable_write_same, DRBD_DISABLE_WRITE_SAME_DEF)
-)
-
-GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
- __str_field_def(1, 0, cpu_mask, DRBD_CPU_MASK_SIZE)
- __u32_field_def(2, 0, on_no_data, DRBD_ON_NO_DATA_DEF)
-)
-
-GENL_struct(DRBD_NLA_NET_CONF, 5, net_conf,
- __str_field_def(1, DRBD_F_SENSITIVE,
- shared_secret, SHARED_SECRET_MAX)
- __str_field_def(2, 0, cram_hmac_alg, SHARED_SECRET_MAX)
- __str_field_def(3, 0, integrity_alg, SHARED_SECRET_MAX)
- __str_field_def(4, 0, verify_alg, SHARED_SECRET_MAX)
- __str_field_def(5, 0, csums_alg, SHARED_SECRET_MAX)
- __u32_field_def(6, 0, wire_protocol, DRBD_PROTOCOL_DEF)
- __u32_field_def(7, 0, connect_int, DRBD_CONNECT_INT_DEF)
- __u32_field_def(8, 0, timeout, DRBD_TIMEOUT_DEF)
- __u32_field_def(9, 0, ping_int, DRBD_PING_INT_DEF)
- __u32_field_def(10, 0, ping_timeo, DRBD_PING_TIMEO_DEF)
- __u32_field_def(11, 0, sndbuf_size, DRBD_SNDBUF_SIZE_DEF)
- __u32_field_def(12, 0, rcvbuf_size, DRBD_RCVBUF_SIZE_DEF)
- __u32_field_def(13, 0, ko_count, DRBD_KO_COUNT_DEF)
- __u32_field_def(14, 0, max_buffers, DRBD_MAX_BUFFERS_DEF)
- __u32_field_def(15, 0, max_epoch_size, DRBD_MAX_EPOCH_SIZE_DEF)
- __u32_field_def(16, 0, unplug_watermark, DRBD_UNPLUG_WATERMARK_DEF)
- __u32_field_def(17, 0, after_sb_0p, DRBD_AFTER_SB_0P_DEF)
- __u32_field_def(18, 0, after_sb_1p, DRBD_AFTER_SB_1P_DEF)
- __u32_field_def(19, 0, after_sb_2p, DRBD_AFTER_SB_2P_DEF)
- __u32_field_def(20, 0, rr_conflict, DRBD_RR_CONFLICT_DEF)
- __u32_field_def(21, 0, on_congestion, DRBD_ON_CONGESTION_DEF)
- __u32_field_def(22, 0, cong_fill, DRBD_CONG_FILL_DEF)
- __u32_field_def(23, 0, cong_extents, DRBD_CONG_EXTENTS_DEF)
- __flg_field_def(24, 0, two_primaries, DRBD_ALLOW_TWO_PRIMARIES_DEF)
- __flg_field(25, DRBD_F_INVARIANT, discard_my_data)
- __flg_field_def(26, 0, tcp_cork, DRBD_TCP_CORK_DEF)
- __flg_field_def(27, 0, always_asbp, DRBD_ALWAYS_ASBP_DEF)
- __flg_field(28, DRBD_F_INVARIANT, tentative)
- __flg_field_def(29, 0, use_rle, DRBD_USE_RLE_DEF)
- /* 9: __u32_field_def(30, 0, fencing_policy, DRBD_FENCING_DEF) */
- /* 9: __str_field_def(31, 0, name, SHARED_SECRET_MAX) */
- /* 9: __u32_field(32, DRBD_F_REQUIRED | DRBD_F_INVARIANT, peer_node_id) */
- __flg_field_def(33, 0 /* OPTIONAL */, csums_after_crash_only, DRBD_CSUMS_AFTER_CRASH_ONLY_DEF)
- __u32_field_def(34, 0 /* OPTIONAL */, sock_check_timeo, DRBD_SOCKET_CHECK_TIMEO_DEF)
-)
-
-GENL_struct(DRBD_NLA_SET_ROLE_PARMS, 6, set_role_parms,
- __flg_field(1, 0, assume_uptodate)
-)
-
-GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
- __u64_field(1, 0, resize_size)
- __flg_field(2, 0, resize_force)
- __flg_field(3, 0, no_resync)
- __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF)
- __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF)
-)
-
-GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
- /* the reason of the broadcast,
- * if this is an event triggered broadcast. */
- __u32_field(1, 0, sib_reason)
- __u32_field(2, DRBD_F_REQUIRED, current_state)
- __u64_field(3, 0, capacity)
- __u64_field(4, 0, ed_uuid)
-
- /* These are for broadcast from after state change work.
- * prev_state and new_state are from the moment the state change took
- * place, new_state is not neccessarily the same as current_state,
- * there may have been more state changes since. Which will be
- * broadcasted soon, in their respective after state change work. */
- __u32_field(5, 0, prev_state)
- __u32_field(6, 0, new_state)
-
- /* if we have a local disk: */
- __bin_field(7, 0, uuids, (UI_SIZE*sizeof(__u64)))
- __u32_field(8, 0, disk_flags)
- __u64_field(9, 0, bits_total)
- __u64_field(10, 0, bits_oos)
- /* and in case resync or online verify is active */
- __u64_field(11, 0, bits_rs_total)
- __u64_field(12, 0, bits_rs_failed)
-
- /* for pre and post notifications of helper execution */
- __str_field(13, 0, helper, 32)
- __u32_field(14, 0, helper_exit_code)
-
- __u64_field(15, 0, send_cnt)
- __u64_field(16, 0, recv_cnt)
- __u64_field(17, 0, read_cnt)
- __u64_field(18, 0, writ_cnt)
- __u64_field(19, 0, al_writ_cnt)
- __u64_field(20, 0, bm_writ_cnt)
- __u32_field(21, 0, ap_bio_cnt)
- __u32_field(22, 0, ap_pending_cnt)
- __u32_field(23, 0, rs_pending_cnt)
-)
-
-GENL_struct(DRBD_NLA_START_OV_PARMS, 9, start_ov_parms,
- __u64_field(1, 0, ov_start_sector)
- __u64_field(2, 0, ov_stop_sector)
-)
-
-GENL_struct(DRBD_NLA_NEW_C_UUID_PARMS, 10, new_c_uuid_parms,
- __flg_field(1, 0, clear_bm)
-)
-
-GENL_struct(DRBD_NLA_TIMEOUT_PARMS, 11, timeout_parms,
- __u32_field(1, DRBD_F_REQUIRED, timeout_type)
-)
-
-GENL_struct(DRBD_NLA_DISCONNECT_PARMS, 12, disconnect_parms,
- __flg_field(1, 0, force_disconnect)
-)
-
-GENL_struct(DRBD_NLA_DETACH_PARMS, 13, detach_parms,
- __flg_field(1, 0, force_detach)
-)
-
-GENL_struct(DRBD_NLA_RESOURCE_INFO, 15, resource_info,
- __u32_field(1, 0, res_role)
- __flg_field(2, 0, res_susp)
- __flg_field(3, 0, res_susp_nod)
- __flg_field(4, 0, res_susp_fen)
- /* __flg_field(5, 0, res_weak) */
-)
-
-GENL_struct(DRBD_NLA_DEVICE_INFO, 16, device_info,
- __u32_field(1, 0, dev_disk_state)
-)
-
-GENL_struct(DRBD_NLA_CONNECTION_INFO, 17, connection_info,
- __u32_field(1, 0, conn_connection_state)
- __u32_field(2, 0, conn_role)
-)
-
-GENL_struct(DRBD_NLA_PEER_DEVICE_INFO, 18, peer_device_info,
- __u32_field(1, 0, peer_repl_state)
- __u32_field(2, 0, peer_disk_state)
- __u32_field(3, 0, peer_resync_susp_user)
- __u32_field(4, 0, peer_resync_susp_peer)
- __u32_field(5, 0, peer_resync_susp_dependency)
-)
-
-GENL_struct(DRBD_NLA_RESOURCE_STATISTICS, 19, resource_statistics,
- __u32_field(1, 0, res_stat_write_ordering)
-)
-
-GENL_struct(DRBD_NLA_DEVICE_STATISTICS, 20, device_statistics,
- __u64_field(1, 0, dev_size) /* (sectors) */
- __u64_field(2, 0, dev_read) /* (sectors) */
- __u64_field(3, 0, dev_write) /* (sectors) */
- __u64_field(4, 0, dev_al_writes) /* activity log writes (count) */
- __u64_field(5, 0, dev_bm_writes) /* bitmap writes (count) */
- __u32_field(6, 0, dev_upper_pending) /* application requests in progress */
- __u32_field(7, 0, dev_lower_pending) /* backing device requests in progress */
- __flg_field(8, 0, dev_upper_blocked)
- __flg_field(9, 0, dev_lower_blocked)
- __flg_field(10, 0, dev_al_suspended) /* activity log suspended */
- __u64_field(11, 0, dev_exposed_data_uuid)
- __u64_field(12, 0, dev_current_uuid)
- __u32_field(13, 0, dev_disk_flags)
- __bin_field(14, 0, history_uuids, HISTORY_UUIDS * sizeof(__u64))
-)
-
-GENL_struct(DRBD_NLA_CONNECTION_STATISTICS, 21, connection_statistics,
- __flg_field(1, 0, conn_congested)
-)
-
-GENL_struct(DRBD_NLA_PEER_DEVICE_STATISTICS, 22, peer_device_statistics,
- __u64_field(1, 0, peer_dev_received) /* sectors */
- __u64_field(2, 0, peer_dev_sent) /* sectors */
- __u32_field(3, 0, peer_dev_pending) /* number of requests */
- __u32_field(4, 0, peer_dev_unacked) /* number of requests */
- __u64_field(5, 0, peer_dev_out_of_sync) /* sectors */
- __u64_field(6, 0, peer_dev_resync_failed) /* sectors */
- __u64_field(7, 0, peer_dev_bitmap_uuid)
- __u32_field(9, 0, peer_dev_flags)
-)
-
-GENL_struct(DRBD_NLA_NOTIFICATION_HEADER, 23, drbd_notification_header,
- __u32_field(1, 0, nh_type)
-)
-
-GENL_struct(DRBD_NLA_HELPER, 24, drbd_helper_info,
- __str_field(1, 0, helper_name, 32)
- __u32_field(2, 0, helper_status)
-)
-
-/*
- * Notifications and commands (genlmsghdr->cmd)
- */
-GENL_mc_group(events)
-
- /* kernel -> userspace announcement of changes */
-GENL_notification(
- DRBD_EVENT, 1, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_STATE_INFO, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, 0)
- GENL_tla_expected(DRBD_NLA_DISK_CONF, 0)
- GENL_tla_expected(DRBD_NLA_SYNCER_CONF, 0)
-)
-
- /* query kernel for specific or all info */
-GENL_op(
- DRBD_ADM_GET_STATUS, 2,
- GENL_op_init(
- .doit = drbd_adm_get_status,
- .dumpit = drbd_adm_get_status_all,
- /* anyone may ask for the status,
- * it is broadcasted anyways */
- ),
- /* To select the object .doit.
- * Or a subset of objects in .dumpit. */
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0)
-)
-
- /* add DRBD minor devices as volumes to resources */
-GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_new_minor),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_del_minor),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-
- /* add or delete resources */
-GENL_op(DRBD_ADM_NEW_RESOURCE, 7, GENL_doit(drbd_adm_new_resource),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_DEL_RESOURCE, 8, GENL_doit(drbd_adm_del_resource),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-
-GENL_op(DRBD_ADM_RESOURCE_OPTS, 9,
- GENL_doit(drbd_adm_resource_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESOURCE_OPTS, 0)
-)
-
-GENL_op(
- DRBD_ADM_CONNECT, 10,
- GENL_doit(drbd_adm_connect),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
-)
-
-GENL_op(
- DRBD_ADM_CHG_NET_OPTS, 29,
- GENL_doit(drbd_adm_net_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NET_CONF, DRBD_F_REQUIRED)
-)
-
-GENL_op(DRBD_ADM_DISCONNECT, 11, GENL_doit(drbd_adm_disconnect),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-
-GENL_op(DRBD_ADM_ATTACH, 12,
- GENL_doit(drbd_adm_attach),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DISK_CONF, DRBD_F_REQUIRED)
-)
-
-GENL_op(DRBD_ADM_CHG_DISK_OPTS, 28,
- GENL_doit(drbd_adm_disk_opts),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DISK_OPTS, DRBD_F_REQUIRED)
-)
-
-GENL_op(
- DRBD_ADM_RESIZE, 13,
- GENL_doit(drbd_adm_resize),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESIZE_PARMS, 0)
-)
-
-GENL_op(
- DRBD_ADM_PRIMARY, 14,
- GENL_doit(drbd_adm_set_role),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
-)
-
-GENL_op(
- DRBD_ADM_SECONDARY, 15,
- GENL_doit(drbd_adm_set_role),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_SET_ROLE_PARMS, DRBD_F_REQUIRED)
-)
-
-GENL_op(
- DRBD_ADM_NEW_C_UUID, 16,
- GENL_doit(drbd_adm_new_c_uuid),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NEW_C_UUID_PARMS, 0)
-)
-
-GENL_op(
- DRBD_ADM_START_OV, 17,
- GENL_doit(drbd_adm_start_ov),
- GENL_tla_expected(DRBD_NLA_START_OV_PARMS, 0)
-)
-
-GENL_op(DRBD_ADM_DETACH, 18, GENL_doit(drbd_adm_detach),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DETACH_PARMS, 0))
-
-GENL_op(DRBD_ADM_INVALIDATE, 19, GENL_doit(drbd_adm_invalidate),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_INVAL_PEER, 20, GENL_doit(drbd_adm_invalidate_peer),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_PAUSE_SYNC, 21, GENL_doit(drbd_adm_pause_sync),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_RESUME_SYNC, 22, GENL_doit(drbd_adm_resume_sync),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_SUSPEND_IO, 23, GENL_doit(drbd_adm_suspend_io),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_RESUME_IO, 24, GENL_doit(drbd_adm_resume_io),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_OUTDATE, 25, GENL_doit(drbd_adm_outdate),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_GET_TIMEOUT_TYPE, 26, GENL_doit(drbd_adm_get_timeout_type),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-GENL_op(DRBD_ADM_DOWN, 27, GENL_doit(drbd_adm_down),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
-
-GENL_op(DRBD_ADM_GET_RESOURCES, 30,
- GENL_op_init(
- .dumpit = drbd_adm_dump_resources,
- ),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0)
- GENL_tla_expected(DRBD_NLA_RESOURCE_INFO, 0)
- GENL_tla_expected(DRBD_NLA_RESOURCE_STATISTICS, 0))
-
-GENL_op(DRBD_ADM_GET_DEVICES, 31,
- GENL_op_init(
- .dumpit = drbd_adm_dump_devices,
- .done = drbd_adm_dump_devices_done,
- ),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0)
- GENL_tla_expected(DRBD_NLA_DEVICE_INFO, 0)
- GENL_tla_expected(DRBD_NLA_DEVICE_STATISTICS, 0))
-
-GENL_op(DRBD_ADM_GET_CONNECTIONS, 32,
- GENL_op_init(
- .dumpit = drbd_adm_dump_connections,
- .done = drbd_adm_dump_connections_done,
- ),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0)
- GENL_tla_expected(DRBD_NLA_CONNECTION_INFO, 0)
- GENL_tla_expected(DRBD_NLA_CONNECTION_STATISTICS, 0))
-
-GENL_op(DRBD_ADM_GET_PEER_DEVICES, 33,
- GENL_op_init(
- .dumpit = drbd_adm_dump_peer_devices,
- .done = drbd_adm_dump_peer_devices_done,
- ),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0)
- GENL_tla_expected(DRBD_NLA_PEER_DEVICE_INFO, 0)
- GENL_tla_expected(DRBD_NLA_PEER_DEVICE_STATISTICS, 0))
-
-GENL_notification(
- DRBD_RESOURCE_STATE, 34, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NOTIFICATION_HEADER, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESOURCE_INFO, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_RESOURCE_STATISTICS, DRBD_F_REQUIRED))
-
-GENL_notification(
- DRBD_DEVICE_STATE, 35, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NOTIFICATION_HEADER, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DEVICE_INFO, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_DEVICE_STATISTICS, DRBD_F_REQUIRED))
-
-GENL_notification(
- DRBD_CONNECTION_STATE, 36, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NOTIFICATION_HEADER, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_CONNECTION_INFO, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_CONNECTION_STATISTICS, DRBD_F_REQUIRED))
-
-GENL_notification(
- DRBD_PEER_DEVICE_STATE, 37, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_NOTIFICATION_HEADER, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_PEER_DEVICE_INFO, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_PEER_DEVICE_STATISTICS, DRBD_F_REQUIRED))
-
-GENL_op(
- DRBD_ADM_GET_INITIAL_STATE, 38,
- GENL_op_init(
- .dumpit = drbd_adm_get_initial_state,
- ),
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, 0))
-
-GENL_notification(
- DRBD_HELPER, 40, events,
- GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)
- GENL_tla_expected(DRBD_NLA_HELPER, DRBD_F_REQUIRED))
-
-GENL_notification(
- DRBD_INITIAL_STATE_DONE, 41, events,
- GENL_tla_expected(DRBD_NLA_NOTIFICATION_HEADER, DRBD_F_REQUIRED))
diff --git a/include/linux/drbd_genl_api.h b/include/linux/drbd_genl_api.h
deleted file mode 100644
index 70682c058027..000000000000
--- a/include/linux/drbd_genl_api.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef DRBD_GENL_STRUCT_H
-#define DRBD_GENL_STRUCT_H
-
-/**
- * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests
- * @minor:
- * For admin requests (user -> kernel): which minor device to operate on.
- * For (unicast) replies or informational (broadcast) messages
- * (kernel -> user): which minor device the information is about.
- * If we do not operate on minors, but on connections or resources,
- * the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT
- * is used instead.
- * @flags: possible operation modifiers (relevant only for user->kernel):
- * DRBD_GENL_F_SET_DEFAULTS
- * @volume:
- * When creating a new minor (adding it to a resource), the resource needs
- * to know which volume number within the resource this is supposed to be.
- * The volume number corresponds to the same volume number on the remote side,
- * whereas the minor number on the remote side may be different
- * (union with flags).
- * @ret_code: kernel->userland unicast cfg reply return code (union with flags);
- */
-struct drbd_genlmsghdr {
- __u32 minor;
- union {
- __u32 flags;
- __s32 ret_code;
- };
-};
-
-/* To be used in drbd_genlmsghdr.flags */
-enum {
- DRBD_GENL_F_SET_DEFAULTS = 1,
-};
-
-enum drbd_state_info_bcast_reason {
- SIB_GET_STATUS_REPLY = 1,
- SIB_STATE_CHANGE = 2,
- SIB_HELPER_PRE = 3,
- SIB_HELPER_POST = 4,
- SIB_SYNC_PROGRESS = 5,
-};
-
-/* hack around predefined gcc/cpp "linux=1",
- * we cannot possibly include <1/drbd_genl.h> */
-#undef linux
-
-#include <linux/drbd.h>
-#define GENL_MAGIC_VERSION 1
-#define GENL_MAGIC_FAMILY drbd
-#define GENL_MAGIC_FAMILY_HDRSZ sizeof(struct drbd_genlmsghdr)
-#define GENL_MAGIC_INCLUDE_FILE <linux/drbd_genl.h>
-#include <linux/genl_magic_struct.h>
-
-#endif
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h
deleted file mode 100644
index a7d36c9ea924..000000000000
--- a/include/linux/genl_magic_func.h
+++ /dev/null
@@ -1,413 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef GENL_MAGIC_FUNC_H
-#define GENL_MAGIC_FUNC_H
-
-#include <linux/args.h>
-#include <linux/build_bug.h>
-#include <linux/genl_magic_struct.h>
-
-/*
- * Magic: declare tla policy {{{1
- * Magic: declare nested policies
- * {{{2
- */
-#undef GENL_mc_group
-#define GENL_mc_group(group)
-
-#undef GENL_notification
-#define GENL_notification(op_name, op_num, mcast_group, tla_list)
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list)
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
- [tag_name] = { .type = NLA_NESTED },
-
-static struct nla_policy CONCATENATE(GENL_MAGIC_FAMILY, _tla_nl_policy)[] = {
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-static struct nla_policy s_name ## _nl_policy[] __read_mostly = \
-{ s_fields };
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \
- __put, __is_signed) \
- [attr_nr] = { .type = nla_type },
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \
- __get, __put, __is_signed) \
- [attr_nr] = { .type = nla_type, \
- .len = maxlen - (nla_type == NLA_NUL_STRING) },
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-#ifndef __KERNEL__
-#ifndef pr_info
-#define pr_info(args...) fprintf(stderr, args);
-#endif
-#endif
-
-#ifdef GENL_MAGIC_DEBUG
-static void dprint_field(const char *dir, int nla_type,
- const char *name, void *valp)
-{
- __u64 val = valp ? *(__u32 *)valp : 1;
- switch (nla_type) {
- case NLA_U8: val = (__u8)val;
- case NLA_U16: val = (__u16)val;
- case NLA_U32: val = (__u32)val;
- pr_info("%s attr %s: %d 0x%08x\n", dir,
- name, (int)val, (unsigned)val);
- break;
- case NLA_U64:
- val = *(__u64*)valp;
- pr_info("%s attr %s: %lld 0x%08llx\n", dir,
- name, (long long)val, (unsigned long long)val);
- break;
- case NLA_FLAG:
- if (val)
- pr_info("%s attr %s: set\n", dir, name);
- break;
- }
-}
-
-static void dprint_array(const char *dir, int nla_type,
- const char *name, const char *val, unsigned len)
-{
- switch (nla_type) {
- case NLA_NUL_STRING:
- if (len && val[len-1] == '\0')
- len--;
- pr_info("%s attr %s: [len:%u] '%s'\n", dir, name, len, val);
- break;
- default:
- /* we can always show 4 byte,
- * thats what nlattr are aligned to. */
- pr_info("%s attr %s: [len:%u] %02x%02x%02x%02x ...\n",
- dir, name, len, val[0], val[1], val[2], val[3]);
- }
-}
-
-#define DPRINT_TLA(a, op, b) pr_info("%s %s %s\n", a, op, b);
-
-/* Name is a member field name of the struct s.
- * If s is NULL (only parsing, no copy requested in *_from_attrs()),
- * nla is supposed to point to the attribute containing the information
- * corresponding to that struct member. */
-#define DPRINT_FIELD(dir, nla_type, name, s, nla) \
- do { \
- if (s) \
- dprint_field(dir, nla_type, #name, &s->name); \
- else if (nla) \
- dprint_field(dir, nla_type, #name, \
- (nla_type == NLA_FLAG) ? NULL \
- : nla_data(nla)); \
- } while (0)
-
-#define DPRINT_ARRAY(dir, nla_type, name, s, nla) \
- do { \
- if (s) \
- dprint_array(dir, nla_type, #name, \
- s->name, s->name ## _len); \
- else if (nla) \
- dprint_array(dir, nla_type, #name, \
- nla_data(nla), nla_len(nla)); \
- } while (0)
-#else
-#define DPRINT_TLA(a, op, b) do {} while (0)
-#define DPRINT_FIELD(dir, nla_type, name, s, nla) do {} while (0)
-#define DPRINT_ARRAY(dir, nla_type, name, s, nla) do {} while (0)
-#endif
-
-/*
- * Magic: provide conversion functions {{{1
- * populate struct from attribute table:
- * {{{2
- */
-
-/* processing of generic netlink messages is serialized.
- * use one static buffer for parsing of nested attributes */
-static struct nlattr *nested_attr_tb[128];
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-/* *_from_attrs functions are static, but potentially unused */ \
-static int __ ## s_name ## _from_attrs(struct s_name *s, \
- struct genl_info *info, bool exclude_invariants) \
-{ \
- const int maxtype = ARRAY_SIZE(s_name ## _nl_policy)-1; \
- struct nlattr *tla = info->attrs[tag_number]; \
- struct nlattr **ntb = nested_attr_tb; \
- struct nlattr *nla; \
- int err; \
- BUILD_BUG_ON(ARRAY_SIZE(s_name ## _nl_policy) > ARRAY_SIZE(nested_attr_tb)); \
- if (!tla) \
- return -ENOMSG; \
- DPRINT_TLA(#s_name, "<=-", #tag_name); \
- err = nla_parse_nested_deprecated(ntb, maxtype, tla, \
- s_name ## _nl_policy, NULL); \
- if (err) \
- return err; \
- \
- s_fields \
- return 0; \
-} __attribute__((unused)) \
-static int s_name ## _from_attrs(struct s_name *s, \
- struct genl_info *info) \
-{ \
- return __ ## s_name ## _from_attrs(s, info, false); \
-} __attribute__((unused)) \
-static int s_name ## _from_attrs_for_change(struct s_name *s, \
- struct genl_info *info) \
-{ \
- return __ ## s_name ## _from_attrs(s, info, true); \
-} __attribute__((unused)) \
-
-#define __assign(attr_nr, attr_flag, name, nla_type, type, assignment...) \
- nla = ntb[attr_nr]; \
- if (nla) { \
- if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
- pr_info("<< must not change invariant attr: %s\n", #name); \
- return -EEXIST; \
- } \
- assignment; \
- } else if (exclude_invariants && !!((attr_flag) & DRBD_F_INVARIANT)) { \
- /* attribute missing from payload, */ \
- /* which was expected */ \
- } else if ((attr_flag) & DRBD_F_REQUIRED) { \
- pr_info("<< missing attr: %s\n", #name); \
- return -ENOMSG; \
- }
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- __is_signed) \
- __assign(attr_nr, attr_flag, name, nla_type, type, \
- if (s) \
- s->name = __get(nla); \
- DPRINT_FIELD("<<", nla_type, name, s, nla))
-
-/* validate_nla() already checked nla_len <= maxlen appropriately. */
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, __is_signed) \
- __assign(attr_nr, attr_flag, name, nla_type, type, \
- if (s) \
- s->name ## _len = \
- __get(s->name, nla, maxlen); \
- DPRINT_ARRAY("<<", nla_type, name, s, nla))
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields)
-
-/*
- * Magic: define op number to op name mapping {{{1
- * {{{2
- */
-static const char *CONCATENATE(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd)
-{
- switch (cmd) {
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list) \
- case op_num: return #op_name;
-#include GENL_MAGIC_INCLUDE_FILE
- default:
- return "unknown";
- }
-}
-
-#ifdef __KERNEL__
-#include <linux/stringify.h>
-/*
- * Magic: define genl_ops {{{1
- * {{{2
- */
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list) \
-{ \
- handler \
- .cmd = op_name, \
-},
-
-#define ZZZ_genl_ops CONCATENATE(GENL_MAGIC_FAMILY, _genl_ops)
-static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list)
-
-/*
- * Define the genl_family, multicast groups, {{{1
- * and provide register/unregister functions.
- * {{{2
- */
-#define ZZZ_genl_family CONCATENATE(GENL_MAGIC_FAMILY, _genl_family)
-static struct genl_family ZZZ_genl_family;
-/*
- * Magic: define multicast groups
- * Magic: define multicast group registration helper
- */
-#define ZZZ_genl_mcgrps CONCATENATE(GENL_MAGIC_FAMILY, _genl_mcgrps)
-static const struct genl_multicast_group ZZZ_genl_mcgrps[] = {
-#undef GENL_mc_group
-#define GENL_mc_group(group) { .name = #group, },
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-enum CONCATENATE(GENL_MAGIC_FAMILY, group_ids) {
-#undef GENL_mc_group
-#define GENL_mc_group(group) CONCATENATE(GENL_MAGIC_FAMILY, _group_ ## group),
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-#undef GENL_mc_group
-#define GENL_mc_group(group) \
-static int CONCATENATE(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \
- struct sk_buff *skb, gfp_t flags) \
-{ \
- unsigned int group_id = \
- CONCATENATE(GENL_MAGIC_FAMILY, _group_ ## group); \
- return genlmsg_multicast(&ZZZ_genl_family, skb, 0, \
- group_id, flags); \
-}
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-#undef GENL_mc_group
-#define GENL_mc_group(group)
-
-static struct genl_family ZZZ_genl_family __ro_after_init = {
- .name = __stringify(GENL_MAGIC_FAMILY),
- .version = GENL_MAGIC_VERSION,
-#ifdef GENL_MAGIC_FAMILY_HDRSZ
- .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
-#endif
- .maxattr = ARRAY_SIZE(CONCATENATE(GENL_MAGIC_FAMILY, _tla_nl_policy))-1,
- .policy = CONCATENATE(GENL_MAGIC_FAMILY, _tla_nl_policy),
-#ifdef GENL_MAGIC_FAMILY_PRE_DOIT
- .pre_doit = GENL_MAGIC_FAMILY_PRE_DOIT,
- .post_doit = GENL_MAGIC_FAMILY_POST_DOIT,
-#endif
- .ops = ZZZ_genl_ops,
- .n_ops = ARRAY_SIZE(ZZZ_genl_ops),
- .mcgrps = ZZZ_genl_mcgrps,
- .resv_start_op = 42, /* drbd is currently the only user */
- .n_mcgrps = ARRAY_SIZE(ZZZ_genl_mcgrps),
- .module = THIS_MODULE,
-};
-
-int CONCATENATE(GENL_MAGIC_FAMILY, _genl_register)(void)
-{
- return genl_register_family(&ZZZ_genl_family);
-}
-
-void CONCATENATE(GENL_MAGIC_FAMILY, _genl_unregister)(void)
-{
- genl_unregister_family(&ZZZ_genl_family);
-}
-
-/*
- * Magic: provide conversion functions {{{1
- * populate skb from struct.
- * {{{2
- */
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list)
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-static int s_name ## _to_skb(struct sk_buff *skb, struct s_name *s, \
- const bool exclude_sensitive) \
-{ \
- struct nlattr *tla = nla_nest_start(skb, tag_number); \
- if (!tla) \
- goto nla_put_failure; \
- DPRINT_TLA(#s_name, "-=>", #tag_name); \
- s_fields \
- nla_nest_end(skb, tla); \
- return 0; \
- \
-nla_put_failure: \
- if (tla) \
- nla_nest_cancel(skb, tla); \
- return -EMSGSIZE; \
-} \
-static inline int s_name ## _to_priv_skb(struct sk_buff *skb, \
- struct s_name *s) \
-{ \
- return s_name ## _to_skb(skb, s, 0); \
-} \
-static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \
- struct s_name *s) \
-{ \
- return s_name ## _to_skb(skb, s, 1); \
-}
-
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- __is_signed) \
- if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
- DPRINT_FIELD(">>", nla_type, name, s, NULL); \
- if (__put(skb, attr_nr, s->name)) \
- goto nla_put_failure; \
- }
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, __is_signed) \
- if (!exclude_sensitive || !((attr_flag) & DRBD_F_SENSITIVE)) { \
- DPRINT_ARRAY(">>",nla_type, name, s, NULL); \
- if (__put(skb, attr_nr, min_t(int, maxlen, \
- s->name ## _len + (nla_type == NLA_NUL_STRING)),\
- s->name)) \
- goto nla_put_failure; \
- }
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-
-/* Functions for initializing structs to default values. */
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- __is_signed)
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, __is_signed)
-#undef __u32_field_def
-#define __u32_field_def(attr_nr, attr_flag, name, default) \
- x->name = default;
-#undef __s32_field_def
-#define __s32_field_def(attr_nr, attr_flag, name, default) \
- x->name = default;
-#undef __flg_field_def
-#define __flg_field_def(attr_nr, attr_flag, name, default) \
- x->name = default;
-#undef __str_field_def
-#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
- memset(x->name, 0, sizeof(x->name)); \
- x->name ## _len = 0;
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-static void set_ ## s_name ## _defaults(struct s_name *x) __attribute__((unused)); \
-static void set_ ## s_name ## _defaults(struct s_name *x) { \
-s_fields \
-}
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-#endif /* __KERNEL__ */
-
-/* }}}1 */
-#endif /* GENL_MAGIC_FUNC_H */
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
deleted file mode 100644
index 2200cedd160a..000000000000
--- a/include/linux/genl_magic_struct.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef GENL_MAGIC_STRUCT_H
-#define GENL_MAGIC_STRUCT_H
-
-#ifndef GENL_MAGIC_FAMILY
-# error "you need to define GENL_MAGIC_FAMILY before inclusion"
-#endif
-
-#ifndef GENL_MAGIC_VERSION
-# error "you need to define GENL_MAGIC_VERSION before inclusion"
-#endif
-
-#ifndef GENL_MAGIC_INCLUDE_FILE
-# error "you need to define GENL_MAGIC_INCLUDE_FILE before inclusion"
-#endif
-
-#include <linux/args.h>
-#include <linux/types.h>
-#include <net/genetlink.h>
-
-extern int CONCATENATE(GENL_MAGIC_FAMILY, _genl_register)(void);
-extern void CONCATENATE(GENL_MAGIC_FAMILY, _genl_unregister)(void);
-
-/*
- * Extension of genl attribute validation policies {{{2
- */
-
-/*
- * Flags specific to drbd and not visible at the netlink layer, used in
- * <struct>_from_attrs and <struct>_to_skb:
- *
- * @DRBD_F_REQUIRED: Attribute is required; a request without this attribute is
- * invalid.
- *
- * @DRBD_F_SENSITIVE: Attribute includes sensitive information and must not be
- * included in unpriviledged get requests or broadcasts.
- *
- * @DRBD_F_INVARIANT: Attribute is set when an object is initially created, but
- * cannot subsequently be changed.
- */
-#define DRBD_F_REQUIRED (1 << 0)
-#define DRBD_F_SENSITIVE (1 << 1)
-#define DRBD_F_INVARIANT (1 << 2)
-
-
-/* }}}1
- * MAGIC
- * multi-include macro expansion magic starts here
- */
-
-/* MAGIC helpers {{{2 */
-
-static inline int nla_put_u64_0pad(struct sk_buff *skb, int attrtype, u64 value)
-{
- return nla_put_64bit(skb, attrtype, sizeof(u64), &value, 0);
-}
-
-/* possible field types */
-#define __flg_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U8, char, \
- nla_get_u8, nla_put_u8, false)
-#define __u8_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \
- nla_get_u8, nla_put_u8, false)
-#define __u16_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U16, __u16, \
- nla_get_u16, nla_put_u16, false)
-#define __u32_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U32, __u32, \
- nla_get_u32, nla_put_u32, false)
-#define __s32_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U32, __s32, \
- nla_get_u32, nla_put_u32, true)
-#define __u64_field(attr_nr, attr_flag, name) \
- __field(attr_nr, attr_flag, name, NLA_U64, __u64, \
- nla_get_u64, nla_put_u64_0pad, false)
-#define __str_field(attr_nr, attr_flag, name, maxlen) \
- __array(attr_nr, attr_flag, name, NLA_NUL_STRING, char, maxlen, \
- nla_strscpy, nla_put, false)
-#define __bin_field(attr_nr, attr_flag, name, maxlen) \
- __array(attr_nr, attr_flag, name, NLA_BINARY, char, maxlen, \
- nla_memcpy, nla_put, false)
-
-/* fields with default values */
-#define __flg_field_def(attr_nr, attr_flag, name, default) \
- __flg_field(attr_nr, attr_flag, name)
-#define __u32_field_def(attr_nr, attr_flag, name, default) \
- __u32_field(attr_nr, attr_flag, name)
-#define __s32_field_def(attr_nr, attr_flag, name, default) \
- __s32_field(attr_nr, attr_flag, name)
-#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
- __str_field(attr_nr, attr_flag, name, maxlen)
-
-#define GENL_op_init(args...) args
-#define GENL_doit(handler) \
- .doit = handler, \
- .flags = GENL_ADMIN_PERM,
-#define GENL_dumpit(handler) \
- .dumpit = handler, \
- .flags = GENL_ADMIN_PERM,
-
-/* }}}1
- * Magic: define the enum symbols for genl_ops
- * Magic: define the enum symbols for top level attributes
- * Magic: define the enum symbols for nested attributes
- * {{{2
- */
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields)
-
-#undef GENL_mc_group
-#define GENL_mc_group(group)
-
-#undef GENL_notification
-#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
- op_name = op_num,
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, tla_list) \
- op_name = op_num,
-
-enum {
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-#undef GENL_notification
-#define GENL_notification(op_name, op_num, mcast_group, tla_list)
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, attr_list)
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
- tag_name = tag_number,
-
-enum {
-#include GENL_MAGIC_INCLUDE_FILE
-};
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-enum { \
- s_fields \
-};
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, \
- __get, __put, __is_signed) \
- T_ ## name = (__u16)(attr_nr),
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, \
- maxlen, __get, __put, __is_signed) \
- T_ ## name = (__u16)(attr_nr),
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-/* }}}1
- * Magic: compile time assert unique numbers for operations
- * Magic: -"- unique numbers for top level attributes
- * Magic: -"- unique numbers for nested attributes
- * {{{2
- */
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields)
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, attr_list) \
- case op_name:
-
-#undef GENL_notification
-#define GENL_notification(op_name, op_num, mcast_group, tla_list) \
- case op_name:
-
-static inline void ct_assert_unique_operations(void)
-{
- switch (0) {
-#include GENL_MAGIC_INCLUDE_FILE
- case 0:
- ;
- }
-}
-
-#undef GENL_op
-#define GENL_op(op_name, op_num, handler, attr_list)
-
-#undef GENL_notification
-#define GENL_notification(op_name, op_num, mcast_group, tla_list)
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
- case tag_number:
-
-static inline void ct_assert_unique_top_level_attributes(void)
-{
- switch (0) {
-#include GENL_MAGIC_INCLUDE_FILE
- case 0:
- ;
- }
-}
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
-{ \
- switch (0) { \
- s_fields \
- case 0: \
- ; \
- } \
-}
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- __is_signed) \
- case attr_nr:
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, __is_signed) \
- case attr_nr:
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-/* }}}1
- * Magic: declare structs
- * struct <name> {
- * fields
- * };
- * {{{2
- */
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-struct s_name { s_fields };
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- __is_signed) \
- type name;
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, __is_signed) \
- type name[maxlen]; \
- __u32 name ## _len;
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-#undef GENL_struct
-#define GENL_struct(tag_name, tag_number, s_name, s_fields) \
-enum { \
- s_fields \
-};
-
-#undef __field
-#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \
- is_signed) \
- F_ ## name ## _IS_SIGNED = is_signed,
-
-#undef __array
-#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \
- __get, __put, is_signed) \
- F_ ## name ## _IS_SIGNED = is_signed,
-
-#include GENL_MAGIC_INCLUDE_FILE
-
-/* }}}1 */
-#endif /* GENL_MAGIC_STRUCT_H */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 6aa79e2d799c..9c97a16850b9 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -227,6 +227,65 @@ DECLARE_EVENT_CLASS(block_rq,
);
/**
+ * block_rq_tag_wait - triggered when a request is starved of a tag
+ * @q: request queue of the target device
+ * @hctx: hardware context of the request experiencing starvation
+ * @is_sched_tag: indicates whether the starved pool is the software scheduler
+ * @alloc_flags: allocation flags dictating the specific tag pool
+ *
+ * Called immediately before the submitting context is forced to block due
+ * to the exhaustion of available tags (i.e., physical hardware driver
+ * tags, software scheduler tags, or reserved tags). This trace point
+ * indicates that the context will be placed into an uninterruptible state
+ * via sbitmap_prepare_to_wait(). If a tag is not acquired in the final
+ * lockless retry, the context will yield the CPU via io_schedule() until
+ * an active request completes and relinquishes its assigned tag.
+ */
+TRACE_EVENT(block_rq_tag_wait,
+
+ TP_PROTO(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
+ bool is_sched_tag, unsigned int alloc_flags),
+
+ TP_ARGS(q, hctx, is_sched_tag, alloc_flags),
+
+ TP_STRUCT__entry(
+ __field( dev_t, dev )
+ __field( u32, hctx_id )
+ __field( u32, nr_tags )
+ __field( bool, is_sched_tag )
+ __field( bool, is_reserved )
+ ),
+
+ TP_fast_assign(
+ __entry->dev = q->disk ? disk_devt(q->disk) : 0;
+ __entry->hctx_id = hctx->queue_num;
+ __entry->is_sched_tag = is_sched_tag;
+ __entry->is_reserved = alloc_flags & BLK_MQ_REQ_RESERVED;
+
+ if (__entry->is_reserved) {
+ __entry->nr_tags = is_sched_tag ?
+ hctx->sched_tags->nr_reserved_tags :
+ hctx->tags->nr_reserved_tags;
+ } else {
+ if (is_sched_tag)
+ __entry->nr_tags = hctx->sched_tags->nr_tags -
+ hctx->sched_tags->nr_reserved_tags;
+ else
+ __entry->nr_tags = hctx->tags->nr_tags -
+ hctx->tags->nr_reserved_tags;
+ }
+
+ ),
+
+ TP_printk("%d,%d hctx=%u starved on %s%s tags (depth=%u)",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->hctx_id,
+ __entry->is_sched_tag ? "scheduler" : "hardware",
+ __entry->is_reserved ? " reserved" : "",
+ __entry->nr_tags)
+);
+
+/**
* block_rq_insert - insert block operation request into queue
* @rq: block IO operation request
*
diff --git a/include/linux/drbd.h b/include/uapi/linux/drbd.h
index 5468a2399d48..cf1ec3eb872f 100644
--- a/include/linux/drbd.h
+++ b/include/uapi/linux/drbd.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
/*
drbd.h
Kernel module for 2.6.x Kernels
@@ -11,32 +11,10 @@
*/
-#ifndef DRBD_H
-#define DRBD_H
-#include <asm/types.h>
-
-#ifdef __KERNEL__
+#ifndef _UAPI_LINUX_DRBD_H
+#define _UAPI_LINUX_DRBD_H
#include <linux/types.h>
#include <asm/byteorder.h>
-#else
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <limits.h>
-
-/* Although the Linux source code makes a difference between
- generic endianness and the bitfields' endianness, there is no
- architecture as of Linux-2.6.24-rc4 where the bitfields' endianness
- does not match the generic endianness. */
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define __LITTLE_ENDIAN_BITFIELD
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define __BIG_ENDIAN_BITFIELD
-#else
-# error "sorry, weird endianness on this box"
-#endif
-
-#endif
enum drbd_io_error_p {
EP_PASS_ON, /* FIXME should the better be named "Ignore"? */
@@ -333,6 +311,9 @@ enum drbd_uuid_index {
#define HISTORY_UUIDS MAX_PEERS
+#define DRBD_NL_UUIDS_SIZE (UI_SIZE * sizeof(__u64))
+#define DRBD_NL_HISTORY_UUIDS_SIZE (HISTORY_UUIDS * sizeof(__u64))
+
enum drbd_timeout_flag {
UT_DEFAULT = 0,
UT_DEGRADED = 1,
@@ -389,4 +370,44 @@ enum write_ordering_e {
#define DRBD_CPU_MASK_SIZE 32
-#endif
+/**
+ * struct drbd_genlmsghdr - DRBD specific header used in NETLINK_GENERIC requests
+ * @minor:
+ * For admin requests (user -> kernel): which minor device to operate on.
+ * For (unicast) replies or informational (broadcast) messages
+ * (kernel -> user): which minor device the information is about.
+ * If we do not operate on minors, but on connections or resources,
+ * the minor value shall be (~0), and the attribute DRBD_NLA_CFG_CONTEXT
+ * is used instead.
+ * @flags: possible operation modifiers (relevant only for user->kernel):
+ * DRBD_GENL_F_SET_DEFAULTS
+ * @volume:
+ * When creating a new minor (adding it to a resource), the resource needs
+ * to know which volume number within the resource this is supposed to be.
+ * The volume number corresponds to the same volume number on the remote side,
+ * whereas the minor number on the remote side may be different
+ * (union with flags).
+ * @ret_code: kernel->userland unicast cfg reply return code (union with flags);
+ */
+struct drbd_genlmsghdr {
+ __u32 minor;
+ union {
+ __u32 flags;
+ __s32 ret_code;
+ };
+};
+
+/* To be used in drbd_genlmsghdr.flags */
+enum {
+ DRBD_GENL_F_SET_DEFAULTS = 1,
+};
+
+enum drbd_state_info_bcast_reason {
+ SIB_GET_STATUS_REPLY = 1,
+ SIB_STATE_CHANGE = 2,
+ SIB_HELPER_PRE = 3,
+ SIB_HELPER_POST = 4,
+ SIB_SYNC_PROGRESS = 5,
+};
+
+#endif /* _UAPI_LINUX_DRBD_H */
diff --git a/include/uapi/linux/drbd_genl.h b/include/uapi/linux/drbd_genl.h
new file mode 100644
index 000000000000..8b25f08d8a90
--- /dev/null
+++ b/include/uapi/linux/drbd_genl.h
@@ -0,0 +1,359 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
+
+#ifndef _UAPI_LINUX_DRBD_GENL_H
+#define _UAPI_LINUX_DRBD_GENL_H
+
+#define DRBD_FAMILY_NAME "drbd"
+#define DRBD_FAMILY_VERSION 1
+
+enum {
+ DRBD_NLA_CFG_REPLY = 1,
+ DRBD_NLA_CFG_CONTEXT,
+ DRBD_NLA_DISK_CONF,
+ DRBD_NLA_RESOURCE_OPTS,
+ DRBD_NLA_NET_CONF,
+ DRBD_NLA_SET_ROLE_PARMS,
+ DRBD_NLA_RESIZE_PARMS,
+ DRBD_NLA_STATE_INFO,
+ DRBD_NLA_START_OV_PARMS,
+ DRBD_NLA_NEW_C_UUID_PARMS,
+ DRBD_NLA_TIMEOUT_PARMS,
+ DRBD_NLA_DISCONNECT_PARMS,
+ DRBD_NLA_DETACH_PARMS,
+ DRBD_NLA_RESOURCE_INFO = 15,
+ DRBD_NLA_DEVICE_INFO,
+ DRBD_NLA_CONNECTION_INFO,
+ DRBD_NLA_PEER_DEVICE_INFO,
+ DRBD_NLA_RESOURCE_STATISTICS,
+ DRBD_NLA_DEVICE_STATISTICS,
+ DRBD_NLA_CONNECTION_STATISTICS,
+ DRBD_NLA_PEER_DEVICE_STATISTICS,
+ DRBD_NLA_NOTIFICATION_HEADER,
+ DRBD_NLA_HELPER,
+
+ __DRBD_NLA_MAX,
+ DRBD_NLA_MAX = (__DRBD_NLA_MAX - 1)
+};
+
+enum {
+ DRBD_A_DRBD_CFG_REPLY_INFO_TEXT = 1,
+
+ __DRBD_A_DRBD_CFG_REPLY_MAX,
+ DRBD_A_DRBD_CFG_REPLY_MAX = (__DRBD_A_DRBD_CFG_REPLY_MAX - 1)
+};
+
+enum {
+ DRBD_A_DRBD_CFG_CONTEXT_CTX_VOLUME = 1,
+ DRBD_A_DRBD_CFG_CONTEXT_CTX_RESOURCE_NAME,
+ DRBD_A_DRBD_CFG_CONTEXT_CTX_MY_ADDR,
+ DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR,
+
+ __DRBD_A_DRBD_CFG_CONTEXT_MAX,
+ DRBD_A_DRBD_CFG_CONTEXT_MAX = (__DRBD_A_DRBD_CFG_CONTEXT_MAX - 1)
+};
+
+enum {
+ DRBD_A_DISK_CONF_BACKING_DEV = 1,
+ DRBD_A_DISK_CONF_META_DEV,
+ DRBD_A_DISK_CONF_META_DEV_IDX,
+ DRBD_A_DISK_CONF_DISK_SIZE,
+ DRBD_A_DISK_CONF_MAX_BIO_BVECS,
+ DRBD_A_DISK_CONF_ON_IO_ERROR,
+ DRBD_A_DISK_CONF_FENCING,
+ DRBD_A_DISK_CONF_RESYNC_RATE,
+ DRBD_A_DISK_CONF_RESYNC_AFTER,
+ DRBD_A_DISK_CONF_AL_EXTENTS,
+ DRBD_A_DISK_CONF_C_PLAN_AHEAD,
+ DRBD_A_DISK_CONF_C_DELAY_TARGET,
+ DRBD_A_DISK_CONF_C_FILL_TARGET,
+ DRBD_A_DISK_CONF_C_MAX_RATE,
+ DRBD_A_DISK_CONF_C_MIN_RATE,
+ DRBD_A_DISK_CONF_DISK_BARRIER,
+ DRBD_A_DISK_CONF_DISK_FLUSHES,
+ DRBD_A_DISK_CONF_DISK_DRAIN,
+ DRBD_A_DISK_CONF_MD_FLUSHES,
+ DRBD_A_DISK_CONF_DISK_TIMEOUT,
+ DRBD_A_DISK_CONF_READ_BALANCING,
+ DRBD_A_DISK_CONF_AL_UPDATES = 23,
+ DRBD_A_DISK_CONF_DISCARD_ZEROES_IF_ALIGNED,
+ DRBD_A_DISK_CONF_RS_DISCARD_GRANULARITY,
+ DRBD_A_DISK_CONF_DISABLE_WRITE_SAME,
+
+ __DRBD_A_DISK_CONF_MAX,
+ DRBD_A_DISK_CONF_MAX = (__DRBD_A_DISK_CONF_MAX - 1)
+};
+
+enum {
+ DRBD_A_RES_OPTS_CPU_MASK = 1,
+ DRBD_A_RES_OPTS_ON_NO_DATA,
+
+ __DRBD_A_RES_OPTS_MAX,
+ DRBD_A_RES_OPTS_MAX = (__DRBD_A_RES_OPTS_MAX - 1)
+};
+
+enum {
+ DRBD_A_NET_CONF_SHARED_SECRET = 1,
+ DRBD_A_NET_CONF_CRAM_HMAC_ALG,
+ DRBD_A_NET_CONF_INTEGRITY_ALG,
+ DRBD_A_NET_CONF_VERIFY_ALG,
+ DRBD_A_NET_CONF_CSUMS_ALG,
+ DRBD_A_NET_CONF_WIRE_PROTOCOL,
+ DRBD_A_NET_CONF_CONNECT_INT,
+ DRBD_A_NET_CONF_TIMEOUT,
+ DRBD_A_NET_CONF_PING_INT,
+ DRBD_A_NET_CONF_PING_TIMEO,
+ DRBD_A_NET_CONF_SNDBUF_SIZE,
+ DRBD_A_NET_CONF_RCVBUF_SIZE,
+ DRBD_A_NET_CONF_KO_COUNT,
+ DRBD_A_NET_CONF_MAX_BUFFERS,
+ DRBD_A_NET_CONF_MAX_EPOCH_SIZE,
+ DRBD_A_NET_CONF_UNPLUG_WATERMARK,
+ DRBD_A_NET_CONF_AFTER_SB_0P,
+ DRBD_A_NET_CONF_AFTER_SB_1P,
+ DRBD_A_NET_CONF_AFTER_SB_2P,
+ DRBD_A_NET_CONF_RR_CONFLICT,
+ DRBD_A_NET_CONF_ON_CONGESTION,
+ DRBD_A_NET_CONF_CONG_FILL,
+ DRBD_A_NET_CONF_CONG_EXTENTS,
+ DRBD_A_NET_CONF_TWO_PRIMARIES,
+ DRBD_A_NET_CONF_DISCARD_MY_DATA,
+ DRBD_A_NET_CONF_TCP_CORK,
+ DRBD_A_NET_CONF_ALWAYS_ASBP,
+ DRBD_A_NET_CONF_TENTATIVE,
+ DRBD_A_NET_CONF_USE_RLE,
+ DRBD_A_NET_CONF_CSUMS_AFTER_CRASH_ONLY = 33,
+ DRBD_A_NET_CONF_SOCK_CHECK_TIMEO,
+
+ __DRBD_A_NET_CONF_MAX,
+ DRBD_A_NET_CONF_MAX = (__DRBD_A_NET_CONF_MAX - 1)
+};
+
+enum {
+ DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE = 1,
+
+ __DRBD_A_SET_ROLE_PARMS_MAX,
+ DRBD_A_SET_ROLE_PARMS_MAX = (__DRBD_A_SET_ROLE_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_RESIZE_PARMS_RESIZE_SIZE = 1,
+ DRBD_A_RESIZE_PARMS_RESIZE_FORCE,
+ DRBD_A_RESIZE_PARMS_NO_RESYNC,
+ DRBD_A_RESIZE_PARMS_AL_STRIPES,
+ DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE,
+
+ __DRBD_A_RESIZE_PARMS_MAX,
+ DRBD_A_RESIZE_PARMS_MAX = (__DRBD_A_RESIZE_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_STATE_INFO_SIB_REASON = 1,
+ DRBD_A_STATE_INFO_CURRENT_STATE,
+ DRBD_A_STATE_INFO_CAPACITY,
+ DRBD_A_STATE_INFO_ED_UUID,
+ DRBD_A_STATE_INFO_PREV_STATE,
+ DRBD_A_STATE_INFO_NEW_STATE,
+ DRBD_A_STATE_INFO_UUIDS,
+ DRBD_A_STATE_INFO_DISK_FLAGS,
+ DRBD_A_STATE_INFO_BITS_TOTAL,
+ DRBD_A_STATE_INFO_BITS_OOS,
+ DRBD_A_STATE_INFO_BITS_RS_TOTAL,
+ DRBD_A_STATE_INFO_BITS_RS_FAILED,
+ DRBD_A_STATE_INFO_HELPER,
+ DRBD_A_STATE_INFO_HELPER_EXIT_CODE,
+ DRBD_A_STATE_INFO_SEND_CNT,
+ DRBD_A_STATE_INFO_RECV_CNT,
+ DRBD_A_STATE_INFO_READ_CNT,
+ DRBD_A_STATE_INFO_WRIT_CNT,
+ DRBD_A_STATE_INFO_AL_WRIT_CNT,
+ DRBD_A_STATE_INFO_BM_WRIT_CNT,
+ DRBD_A_STATE_INFO_AP_BIO_CNT,
+ DRBD_A_STATE_INFO_AP_PENDING_CNT,
+ DRBD_A_STATE_INFO_RS_PENDING_CNT,
+
+ __DRBD_A_STATE_INFO_MAX,
+ DRBD_A_STATE_INFO_MAX = (__DRBD_A_STATE_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_A_START_OV_PARMS_OV_START_SECTOR = 1,
+ DRBD_A_START_OV_PARMS_OV_STOP_SECTOR,
+
+ __DRBD_A_START_OV_PARMS_MAX,
+ DRBD_A_START_OV_PARMS_MAX = (__DRBD_A_START_OV_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM = 1,
+
+ __DRBD_A_NEW_C_UUID_PARMS_MAX,
+ DRBD_A_NEW_C_UUID_PARMS_MAX = (__DRBD_A_NEW_C_UUID_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_TIMEOUT_PARMS_TIMEOUT_TYPE = 1,
+
+ __DRBD_A_TIMEOUT_PARMS_MAX,
+ DRBD_A_TIMEOUT_PARMS_MAX = (__DRBD_A_TIMEOUT_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT = 1,
+
+ __DRBD_A_DISCONNECT_PARMS_MAX,
+ DRBD_A_DISCONNECT_PARMS_MAX = (__DRBD_A_DISCONNECT_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_DETACH_PARMS_FORCE_DETACH = 1,
+
+ __DRBD_A_DETACH_PARMS_MAX,
+ DRBD_A_DETACH_PARMS_MAX = (__DRBD_A_DETACH_PARMS_MAX - 1)
+};
+
+enum {
+ DRBD_A_RESOURCE_INFO_RES_ROLE = 1,
+ DRBD_A_RESOURCE_INFO_RES_SUSP,
+ DRBD_A_RESOURCE_INFO_RES_SUSP_NOD,
+ DRBD_A_RESOURCE_INFO_RES_SUSP_FEN,
+
+ __DRBD_A_RESOURCE_INFO_MAX,
+ DRBD_A_RESOURCE_INFO_MAX = (__DRBD_A_RESOURCE_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_A_DEVICE_INFO_DEV_DISK_STATE = 1,
+
+ __DRBD_A_DEVICE_INFO_MAX,
+ DRBD_A_DEVICE_INFO_MAX = (__DRBD_A_DEVICE_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_A_CONNECTION_INFO_CONN_CONNECTION_STATE = 1,
+ DRBD_A_CONNECTION_INFO_CONN_ROLE,
+
+ __DRBD_A_CONNECTION_INFO_MAX,
+ DRBD_A_CONNECTION_INFO_MAX = (__DRBD_A_CONNECTION_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_A_PEER_DEVICE_INFO_PEER_REPL_STATE = 1,
+ DRBD_A_PEER_DEVICE_INFO_PEER_DISK_STATE,
+ DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_USER,
+ DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_PEER,
+ DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY,
+
+ __DRBD_A_PEER_DEVICE_INFO_MAX,
+ DRBD_A_PEER_DEVICE_INFO_MAX = (__DRBD_A_PEER_DEVICE_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING = 1,
+
+ __DRBD_A_RESOURCE_STATISTICS_MAX,
+ DRBD_A_RESOURCE_STATISTICS_MAX = (__DRBD_A_RESOURCE_STATISTICS_MAX - 1)
+};
+
+enum {
+ DRBD_A_DEVICE_STATISTICS_DEV_SIZE = 1,
+ DRBD_A_DEVICE_STATISTICS_DEV_READ,
+ DRBD_A_DEVICE_STATISTICS_DEV_WRITE,
+ DRBD_A_DEVICE_STATISTICS_DEV_AL_WRITES,
+ DRBD_A_DEVICE_STATISTICS_DEV_BM_WRITES,
+ DRBD_A_DEVICE_STATISTICS_DEV_UPPER_PENDING,
+ DRBD_A_DEVICE_STATISTICS_DEV_LOWER_PENDING,
+ DRBD_A_DEVICE_STATISTICS_DEV_UPPER_BLOCKED,
+ DRBD_A_DEVICE_STATISTICS_DEV_LOWER_BLOCKED,
+ DRBD_A_DEVICE_STATISTICS_DEV_AL_SUSPENDED,
+ DRBD_A_DEVICE_STATISTICS_DEV_EXPOSED_DATA_UUID,
+ DRBD_A_DEVICE_STATISTICS_DEV_CURRENT_UUID,
+ DRBD_A_DEVICE_STATISTICS_DEV_DISK_FLAGS,
+ DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS,
+
+ __DRBD_A_DEVICE_STATISTICS_MAX,
+ DRBD_A_DEVICE_STATISTICS_MAX = (__DRBD_A_DEVICE_STATISTICS_MAX - 1)
+};
+
+enum {
+ DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED = 1,
+
+ __DRBD_A_CONNECTION_STATISTICS_MAX,
+ DRBD_A_CONNECTION_STATISTICS_MAX = (__DRBD_A_CONNECTION_STATISTICS_MAX - 1)
+};
+
+enum {
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_RECEIVED = 1,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_SENT,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_PENDING,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_UNACKED,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_OUT_OF_SYNC,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_RESYNC_FAILED,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_BITMAP_UUID,
+ DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS = 9,
+
+ __DRBD_A_PEER_DEVICE_STATISTICS_MAX,
+ DRBD_A_PEER_DEVICE_STATISTICS_MAX = (__DRBD_A_PEER_DEVICE_STATISTICS_MAX - 1)
+};
+
+enum {
+ DRBD_A_DRBD_NOTIFICATION_HEADER_NH_TYPE = 1,
+
+ __DRBD_A_DRBD_NOTIFICATION_HEADER_MAX,
+ DRBD_A_DRBD_NOTIFICATION_HEADER_MAX = (__DRBD_A_DRBD_NOTIFICATION_HEADER_MAX - 1)
+};
+
+enum {
+ DRBD_A_DRBD_HELPER_INFO_HELPER_NAME = 1,
+ DRBD_A_DRBD_HELPER_INFO_HELPER_STATUS,
+
+ __DRBD_A_DRBD_HELPER_INFO_MAX,
+ DRBD_A_DRBD_HELPER_INFO_MAX = (__DRBD_A_DRBD_HELPER_INFO_MAX - 1)
+};
+
+enum {
+ DRBD_ADM_EVENT = 1,
+ DRBD_ADM_GET_STATUS,
+ DRBD_ADM_NEW_MINOR = 5,
+ DRBD_ADM_DEL_MINOR,
+ DRBD_ADM_NEW_RESOURCE,
+ DRBD_ADM_DEL_RESOURCE,
+ DRBD_ADM_RESOURCE_OPTS,
+ DRBD_ADM_CONNECT,
+ DRBD_ADM_DISCONNECT,
+ DRBD_ADM_ATTACH,
+ DRBD_ADM_RESIZE,
+ DRBD_ADM_PRIMARY,
+ DRBD_ADM_SECONDARY,
+ DRBD_ADM_NEW_C_UUID,
+ DRBD_ADM_START_OV,
+ DRBD_ADM_DETACH,
+ DRBD_ADM_INVALIDATE,
+ DRBD_ADM_INVAL_PEER,
+ DRBD_ADM_PAUSE_SYNC,
+ DRBD_ADM_RESUME_SYNC,
+ DRBD_ADM_SUSPEND_IO,
+ DRBD_ADM_RESUME_IO,
+ DRBD_ADM_OUTDATE,
+ DRBD_ADM_GET_TIMEOUT_TYPE,
+ DRBD_ADM_DOWN,
+ DRBD_ADM_CHG_DISK_OPTS,
+ DRBD_ADM_CHG_NET_OPTS,
+ DRBD_ADM_GET_RESOURCES,
+ DRBD_ADM_GET_DEVICES,
+ DRBD_ADM_GET_CONNECTIONS,
+ DRBD_ADM_GET_PEER_DEVICES,
+ DRBD_ADM_RESOURCE_STATE,
+ DRBD_ADM_DEVICE_STATE,
+ DRBD_ADM_CONNECTION_STATE,
+ DRBD_ADM_PEER_DEVICE_STATE,
+ DRBD_ADM_GET_INITIAL_STATE,
+ DRBD_ADM_HELPER = 40,
+ DRBD_ADM_INITIAL_STATE_DONE,
+
+ __DRBD_ADM_MAX,
+ DRBD_ADM_MAX = (__DRBD_ADM_MAX - 1)
+};
+
+#define DRBD_MCGRP_EVENTS "events"
+
+#endif /* _UAPI_LINUX_DRBD_GENL_H */
diff --git a/include/linux/drbd_limits.h b/include/uapi/linux/drbd_limits.h
index 5b042fb427e9..acefe84bc602 100644
--- a/include/linux/drbd_limits.h
+++ b/include/uapi/linux/drbd_limits.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
drbd_limits.h
This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
@@ -11,10 +11,10 @@
* feedback about nonsense settings for certain configurable values.
*/
-#ifndef DRBD_LIMITS_H
-#define DRBD_LIMITS_H 1
+#ifndef _UAPI_LINUX_DRBD_LIMITS_H
+#define _UAPI_LINUX_DRBD_LIMITS_H
-#define DEBUG_RANGE_CHECK 0
+#include <linux/drbd.h>
#define DRBD_MINOR_COUNT_MIN 1U
#define DRBD_MINOR_COUNT_MAX 255U
@@ -248,4 +248,4 @@
#define DRBD_RS_DISCARD_GRANULARITY_DEF 0U /* disabled by default */
#define DRBD_RS_DISCARD_GRANULARITY_SCALE '1' /* bytes */
-#endif
+#endif /* _UAPI_LINUX_DRBD_LIMITS_H */