diff options
| author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2025-09-07 08:37:27 +0000 |
|---|---|---|
| committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2026-01-05 19:32:49 +0000 |
| commit | 55bd09ae0fc437c9eb135952ac278540b7388add (patch) | |
| tree | 5afedf443fff7c2c7aec37831ff97113b29b0bb7 | |
| parent | b5f7a0b0fd8953c00b154d96b79ba0208c2e1aca (diff) | |
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/kfifo.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/kfifo.h b/sys/compat/linuxkpi/common/include/linux/kfifo.h index d2f570781661..fbe16e22683e 100644 --- a/sys/compat/linuxkpi/common/include/linux/kfifo.h +++ b/sys/compat/linuxkpi/common/include/linux/kfifo.h @@ -33,8 +33,26 @@ #include <linux/slab.h> #include <linux/gfp.h> -#define INIT_KFIFO(x) 0 -#define DECLARE_KFIFO(x, y, z) +/* + * INIT_KFIFO() is used to initialize the structure declared with + * DECLARE_KFIFO(). It doesn't work with DECLARE_KFIFO_PTR(). + */ +#define INIT_KFIFO(_kf) \ + ({ \ + (_kf).total = nitems((_kf).head); \ + (_kf).count = 0; \ + (_kf).first = 0; \ + (_kf).last = 0; \ + }) + +#define DECLARE_KFIFO(_name, _type, _size) \ + struct kfifo_ ## _name { \ + size_t total; \ + size_t count; \ + size_t first; \ + size_t last; \ + _type head[_size]; \ + } _name #define DECLARE_KFIFO_PTR(_name, _type) \ struct kfifo_ ## _name { \ |
