Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/pipe: stop duplicating union pipe_index declaration

Now that we build with -fms-extensions, union pipe_index can be
included as an anonymous member in struct pipe_inode_info, avoiding
the duplication.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Link: https://patch.msgid.link/20251023082142.2104456-1-linux@rasmusvillemoes.dk
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Rasmus Villemoes and committed by
Christian Brauner
854e8df2 aa70b9cf

+7 -16
+7 -16
include/linux/pipe_fs_i.h
··· 44 44 typedef unsigned short pipe_index_t; 45 45 #endif 46 46 47 - /* 48 - * We have to declare this outside 'struct pipe_inode_info', 49 - * but then we can't use 'union pipe_index' for an anonymous 50 - * union, so we end up having to duplicate this declaration 51 - * below. Annoying. 47 + /** 48 + * struct pipe_index - pipe indeces 49 + * @head: The point of buffer production 50 + * @tail: The point of buffer consumption 51 + * @head_tail: unsigned long union of @head and @tail 52 52 */ 53 53 union pipe_index { 54 54 unsigned long head_tail; ··· 63 63 * @mutex: mutex protecting the whole thing 64 64 * @rd_wait: reader wait point in case of empty pipe 65 65 * @wr_wait: writer wait point in case of full pipe 66 - * @head: The point of buffer production 67 - * @tail: The point of buffer consumption 68 - * @head_tail: unsigned long union of @head and @tail 66 + * @pipe_index: the pipe indeces 69 67 * @note_loss: The next read() should insert a data-lost message 70 68 * @max_usage: The maximum number of slots that may be used in the ring 71 69 * @ring_size: total number of buffers (should be a power of 2) ··· 85 87 struct mutex mutex; 86 88 wait_queue_head_t rd_wait, wr_wait; 87 89 88 - /* This has to match the 'union pipe_index' above */ 89 - union { 90 - unsigned long head_tail; 91 - struct { 92 - pipe_index_t head; 93 - pipe_index_t tail; 94 - }; 95 - }; 90 + union pipe_index; 96 91 97 92 unsigned int max_usage; 98 93 unsigned int ring_size;