diff mbox series

[V2] xfsprogs: move stubbed-out kernel functions out of xfs_shared.h

Message ID 7fe17d89-749d-7114-1f4f-294aba1e3f1d@redhat.com (mailing list archive)
State Deferred, archived
Headers show
Series [V2] xfsprogs: move stubbed-out kernel functions out of xfs_shared.h | expand

Commit Message

Eric Sandeen Nov. 4, 2021, 2:59 a.m. UTC
Move kernel stubs out of libxfs/xfs_shared.h, which is kernel
libxfs code and should not have userspace shims in it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: fix spdx and copyright

Comments

Darrick J. Wong Nov. 4, 2021, 3:14 a.m. UTC | #1
On Wed, Nov 03, 2021 at 09:59:57PM -0500, Eric Sandeen wrote:
> Move kernel stubs out of libxfs/xfs_shared.h, which is kernel
> libxfs code and should not have userspace shims in it.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> V2: fix spdx and copyright
> 
> diff --git a/include/libxfs.h b/include/libxfs.h
> index 24424d0e..64b44af8 100644
> --- a/include/libxfs.h
> +++ b/include/libxfs.h
> @@ -11,6 +11,7 @@
>  #include "platform_defs.h"
>  #include "xfs.h"
> +#include "stubs.h"
>  #include "list.h"
>  #include "hlist.h"
>  #include "cache.h"
> diff --git a/include/stubs.h b/include/stubs.h
> new file mode 100644
> index 00000000..d80e8de0
> --- /dev/null
> +++ b/include/stubs.h
> @@ -0,0 +1,29 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2021 Red Hat, Inc.
> + * All Rights Reserved.
> + */
> +#ifndef STUBS_H
> +#define STUBS_H
> +
> +/* Stub out unimplemented and unneeded kernel functions */
> +struct rb_root {
> +};
> +
> +#define RB_ROOT 		(struct rb_root) { }

Please to remove  ^ this unnecessary space.

> +
> +typedef struct wait_queue_head {
> +} wait_queue_head_t;
> +
> +#define init_waitqueue_head(wqh)	do { } while(0)
> +
> +struct rhashtable {
> +};
> +
> +struct delayed_work {
> +};
> +
> +#define INIT_DELAYED_WORK(work, func)	do { } while(0)
> +#define cancel_delayed_work_sync(work)	do { } while(0)
> +
> +#endif

This probably ought to be '#endif /* STUBS_H */' just to keep it clear
which #ifdef it goes with.

With those two things fixed,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
> index 15bae1ff..32271c66 100644
> --- a/libxfs/libxfs_priv.h
> +++ b/libxfs/libxfs_priv.h
> @@ -41,6 +41,7 @@
>  #include "platform_defs.h"
>  #include "xfs.h"
> +#include "stubs.h"
>  #include "list.h"
>  #include "hlist.h"
>  #include "cache.h"
> diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h
> index bafee48c..25c4cab5 100644
> --- a/libxfs/xfs_shared.h
> +++ b/libxfs/xfs_shared.h
> @@ -180,24 +180,4 @@ struct xfs_ino_geometry {
>  };
> -/* Faked up kernel bits */
> -struct rb_root {
> -};
> -
> -#define RB_ROOT 		(struct rb_root) { }
> -
> -typedef struct wait_queue_head {
> -} wait_queue_head_t;
> -
> -#define init_waitqueue_head(wqh)	do { } while(0)
> -
> -struct rhashtable {
> -};
> -
> -struct delayed_work {
> -};
> -
> -#define INIT_DELAYED_WORK(work, func)	do { } while(0)
> -#define cancel_delayed_work_sync(work)	do { } while(0)
> -
>  #endif /* __XFS_SHARED_H__ */
>
Eric Sandeen Nov. 4, 2021, 3:33 a.m. UTC | #2
On 11/3/21 10:14 PM, Darrick J. Wong wrote:
> On Wed, Nov 03, 2021 at 09:59:57PM -0500, Eric Sandeen wrote:
>> Move kernel stubs out of libxfs/xfs_shared.h, which is kernel
>> libxfs code and should not have userspace shims in it.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> V2: fix spdx and copyright
>>
>> diff --git a/include/libxfs.h b/include/libxfs.h
>> index 24424d0e..64b44af8 100644
>> --- a/include/libxfs.h
>> +++ b/include/libxfs.h
>> @@ -11,6 +11,7 @@
>>   #include "platform_defs.h"
>>   #include "xfs.h"
>> +#include "stubs.h"
>>   #include "list.h"
>>   #include "hlist.h"
>>   #include "cache.h"
>> diff --git a/include/stubs.h b/include/stubs.h
>> new file mode 100644
>> index 00000000..d80e8de0
>> --- /dev/null
>> +++ b/include/stubs.h
>> @@ -0,0 +1,29 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/*
>> + * Copyright (c) 2021 Red Hat, Inc.
>> + * All Rights Reserved.
>> + */
>> +#ifndef STUBS_H
>> +#define STUBS_H
>> +
>> +/* Stub out unimplemented and unneeded kernel functions */
>> +struct rb_root {
>> +};
>> +
>> +#define RB_ROOT 		(struct rb_root) { }
> 
> Please to remove  ^ this unnecessary space.
> 
>> +
>> +typedef struct wait_queue_head {
>> +} wait_queue_head_t;
>> +
>> +#define init_waitqueue_head(wqh)	do { } while(0)
>> +
>> +struct rhashtable {
>> +};
>> +
>> +struct delayed_work {
>> +};
>> +
>> +#define INIT_DELAYED_WORK(work, func)	do { } while(0)
>> +#define cancel_delayed_work_sync(work)	do { } while(0)
>> +
>> +#endif
> 
> This probably ought to be '#endif /* STUBS_H */' just to keep it clear
> which #ifdef it goes with.

Yup I spotted and added that already. I'm so rusty.

> With those two things fixed,
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>

Thanks,
-Eric
diff mbox series

Patch

diff --git a/include/libxfs.h b/include/libxfs.h
index 24424d0e..64b44af8 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -11,6 +11,7 @@ 
  #include "platform_defs.h"
  #include "xfs.h"
  
+#include "stubs.h"
  #include "list.h"
  #include "hlist.h"
  #include "cache.h"
diff --git a/include/stubs.h b/include/stubs.h
new file mode 100644
index 00000000..d80e8de0
--- /dev/null
+++ b/include/stubs.h
@@ -0,0 +1,29 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2021 Red Hat, Inc.
+ * All Rights Reserved.
+ */
+#ifndef STUBS_H
+#define STUBS_H
+
+/* Stub out unimplemented and unneeded kernel functions */
+struct rb_root {
+};
+
+#define RB_ROOT 		(struct rb_root) { }
+
+typedef struct wait_queue_head {
+} wait_queue_head_t;
+
+#define init_waitqueue_head(wqh)	do { } while(0)
+
+struct rhashtable {
+};
+
+struct delayed_work {
+};
+
+#define INIT_DELAYED_WORK(work, func)	do { } while(0)
+#define cancel_delayed_work_sync(work)	do { } while(0)
+
+#endif
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 15bae1ff..32271c66 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -41,6 +41,7 @@ 
  #include "platform_defs.h"
  #include "xfs.h"
  
+#include "stubs.h"
  #include "list.h"
  #include "hlist.h"
  #include "cache.h"
diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h
index bafee48c..25c4cab5 100644
--- a/libxfs/xfs_shared.h
+++ b/libxfs/xfs_shared.h
@@ -180,24 +180,4 @@  struct xfs_ino_geometry {
  
  };
  
-/* Faked up kernel bits */
-struct rb_root {
-};
-
-#define RB_ROOT 		(struct rb_root) { }
-
-typedef struct wait_queue_head {
-} wait_queue_head_t;
-
-#define init_waitqueue_head(wqh)	do { } while(0)
-
-struct rhashtable {
-};
-
-struct delayed_work {
-};
-
-#define INIT_DELAYED_WORK(work, func)	do { } while(0)
-#define cancel_delayed_work_sync(work)	do { } while(0)
-
  #endif /* __XFS_SHARED_H__ */