git: b59ffedae8f3 - main - LinuxKPI: Add helper functions to store integers to linux/xarray.h

Vladimir Kondratyev wulf at FreeBSD.org
Wed Sep 29 20:27:40 UTC 2021


The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e

commit b59ffedae8f3707bf0079b4fd0cbf8190eed0c5e
Author:     Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2021-09-29 20:14:23 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-09-29 20:14:23 +0000

    LinuxKPI: Add helper functions to store integers to linux/xarray.h
    
    Required by drm-kmod.
    
    Reviewed by:    hselasky
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D32091
---
 sys/compat/linuxkpi/common/include/linux/xarray.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h
index afe66c1f2b5f..7427f6e4f9f9 100644
--- a/sys/compat/linuxkpi/common/include/linux/xarray.h
+++ b/sys/compat/linuxkpi/common/include/linux/xarray.h
@@ -97,4 +97,27 @@ xa_init(struct xarray *xa)
 	xa_init_flags(xa, 0);
 }
 
+static inline void *
+xa_mk_value(unsigned long v)
+{
+	unsigned long r = (v << 1) | 1;
+
+	return ((void *)r);
+}
+
+static inline bool
+xa_is_value(const void *e)
+{
+	unsigned long v = (unsigned long)e;
+
+	return (v & 1);
+}
+
+static inline unsigned long
+xa_to_value(const void *e)
+{
+	unsigned long v = (unsigned long)e;
+
+	return (v >> 1);
+}
 #endif		/* _LINUX_XARRAY_H_ */


More information about the dev-commits-src-all mailing list