[PATCH 03/61] libfrog: create header file for mocked-up kernel data structures
From: "Darrick J. Wong" <djwong@kernel.org>
Date: 2021-09-15 23:06:52
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Darrick J. Wong <djwong@kernel.org> Create a mockups.h for mocked-up versions of kernel data structures to ease porting of libxfs code. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- include/libxfs.h | 1 + libfrog/Makefile | 1 + libfrog/mockups.h | 19 +++++++++++++++++++ libxfs/libxfs_priv.h | 4 +--- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 libfrog/mockups.h
diff --git a/include/libxfs.h b/include/libxfs.h
index 36ae86cc..c297152f 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h@@ -17,6 +17,7 @@ #include "bitops.h" #include "kmem.h" #include "libfrog/radix-tree.h" +#include "libfrog/mockups.h" #include "atomic.h" #include "xfs_types.h"
diff --git a/libfrog/Makefile b/libfrog/Makefile
index 01107082..5381d9b5 100644
--- a/libfrog/Makefile
+++ b/libfrog/Makefile@@ -41,6 +41,7 @@ crc32defs.h \ crc32table.h \ fsgeom.h \ logging.h \ +mockups.h \ paths.h \ projects.h \ ptvar.h \
diff --git a/libfrog/mockups.h b/libfrog/mockups.h
new file mode 100644
index 00000000..f00a9e41
--- /dev/null
+++ b/libfrog/mockups.h@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2000-2005 Silicon Graphics, Inc. + * All Rights Reserved. + */ +#ifndef __LIBFROG_MOCKUPS_H__ +#define __LIBFROG_MOCKUPS_H__ + +/* Mockups of kernel data structures. */ + +typedef struct spinlock { +} spinlock_t; + +#define spin_lock_init(lock) ((void) 0) + +#define spin_lock(a) ((void) 0) +#define spin_unlock(a) ((void) 0) + +#endif /* __LIBFROG_MOCKUPS_H__ */
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 7181a858..727f6be8 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h@@ -47,6 +47,7 @@ #include "bitops.h" #include "kmem.h" #include "libfrog/radix-tree.h" +#include "libfrog/mockups.h" #include "atomic.h" #include "xfs_types.h"
@@ -205,9 +206,6 @@ enum ce { CE_DEBUG, CE_CONT, CE_NOTE, CE_WARN, CE_ALERT, CE_PANIC }; #endif /* miscellaneous kernel routines not in user space */ -#define spin_lock_init(a) ((void) 0) -#define spin_lock(a) ((void) 0) -#define spin_unlock(a) ((void) 0) #define likely(x) (x) #define unlikely(x) (x) #define rcu_read_lock() ((void) 0)