On 9/15/21 7:46 PM, Dave Chinner wrote:
On Wed, Sep 15, 2021 at 04:06:51PM -0700, Darrick J. Wong wrote:
From: Darrick J. Wong <djwong@xxxxxxxxxx>
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@xxxxxxxxxx>
---
include/libxfs.h | 1 +
libfrog/Makefile | 1 +
libfrog/mockups.h | 19 +++++++++++++++++++
libxfs/libxfs_priv.h | 4 +---
4 files changed, 22 insertions(+), 3 deletions(-)
I don't really like moving this stuff to libfrog. The whole point of
libxfs/libxfs_priv.h is to define the kernel wrapper stuff that
libxfs needs to compile and should never be seen by anything outside
libxfs/...
I had the same reaction to seeing these in libfrog/ TBH.
IIRC adding this all to libxfs_priv.h caused me problems, though I don't
remember exactly why. I had more luck creating a new header file in
include/mockups.h, and then I had to include /that/ in both libxfs.h
and libxfs_priv.h. I don't remember how I ended up like that... but
without the libxfs.h include, I ended up with:
In file included from ../include/libxfs.h:73:0,
from topology.c:7:
../libxfs/xfs_ag.h:75:2: error: unknown type name 'spinlock_t'
spinlock_t pag_state_lock;
^
I do think that more functionally-named, separate header files might
be good, rather than just "dump more stuff in libxfs_priv.h" because
it's getting to be quite the junk drawer. ;)
But I see Dave may have a grander plan than that ;)
-Eric
Indeed, we -cannot- use spinlocks in userspace code, so I really
don't see why we'd want to make them more widely visible to the
userspace xfsprogs code...
Cheers,
Dave.