]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
platform_defs.h: fix __counted_by_ptr annotation
authorDarrick J. Wong <djwong@kernel.org>
Thu, 7 May 2026 22:11:27 +0000 (15:11 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 13 May 2026 10:30:43 +0000 (12:30 +0200)
The kernel userspace headers for Linux 7.0 provide the __counted_by_ptr
macro, so we shouldn't define it separately on those platforms:

  In file included from radix-tree.c:11:
  ../include/platform_defs.h:334:9: error: "__counted_by_ptr" redefined [-Werror]
    334 | #define __counted_by_ptr(member)
        |         ^~~~~~~~~~~~~~~~
  In file included from /usr/include/linux/posix_types.h:5,
                   from /usr/include/linux/types.h:9,
                   from /usr/include/linux/sched/types.h:5,
                   from /usr/include/x86_64-linux-gnu/bits/sched.h:63,
                   from /usr/include/sched.h:43,
                   from /usr/include/pthread.h:22,
                   from ../include/platform_defs.h:19:
  /usr/include/linux/stddef.h:73:9: note: this is the location of the previous definition
     73 | #define __counted_by_ptr(m)
        |         ^~~~~~~~~~~~~~~~

Do the customary ifndef wrapper thing.

Cc: linux-xfs@vger.kernel.org # v7.0.0
Fixes: df91bc3bdc9b81 ("xfs: annotate struct xfs_attr_list_context with __counted_by_ptr")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
include/platform_defs.h

index 5a829db66e0899259ef44c48b2f857748a04297c..5d1bfb1baf94db4fdf21d3b29aa641b53f10f8eb 100644 (file)
@@ -331,6 +331,8 @@ struct kvec {
 #endif
 
 /* xfs_attr.h */
+#ifndef __counted_by_ptr
 #define __counted_by_ptr(member)
+#endif
 
 #endif /* __XFS_PLATFORM_DEFS_H__ */