diff mbox series

[4/7] libxfs: hoist listxattr from xfs_repair

Message ID 172230940631.1543753.17382323806715632348.stgit@frogsfrogsfrogs (mailing list archive)
State Superseded, archived
Headers show
Series [1/7] libfrog: support editing filesystem property sets | expand

Commit Message

Darrick J. Wong July 30, 2024, 3:20 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Hoist the listxattr code from xfs_repair so that we can use it in
xfs_db.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/Makefile    |    2 ++
 libxfs/listxattr.c |    2 +-
 libxfs/listxattr.h |    6 +++---
 repair/Makefile    |    2 --
 repair/pptr.c      |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
 rename repair/listxattr.c => libxfs/listxattr.c (99%)
 rename repair/listxattr.h => libxfs/listxattr.h (81%)

Comments

Christoph Hellwig July 30, 2024, 9:38 p.m. UTC | #1
On Mon, Jul 29, 2024 at 08:20:45PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Hoist the listxattr code from xfs_repair so that we can use it in
> xfs_db.

I guess there isn't much of a point in sharing with the kernel listattr
code?

But maybe that is for later, for now this trivial move looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong July 31, 2024, 5:55 p.m. UTC | #2
On Tue, Jul 30, 2024 at 02:38:08PM -0700, Christoph Hellwig wrote:
> On Mon, Jul 29, 2024 at 08:20:45PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Hoist the listxattr code from xfs_repair so that we can use it in
> > xfs_db.
> 
> I guess there isn't much of a point in sharing with the kernel listattr
> code?
> 
> But maybe that is for later, for now this trivial move looks good:

I think we could do it.  The major difference between the two is the
prefix we use for the dabno "have I seen this block before?" bitmap
functions.  But that and the scrub/listxattr.c code would both have to
be lifted to libxfs, and as long as we're doing that we might as well
clean up the userspace bitmap implementation.

(IOWs that's a somewhat lengthy cleanup for userspace either for after
we get the rt modernization stuff merged or if we get really bored
sitting in meetings.)

> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thank you!

--D
diff mbox series

Patch

diff --git a/libxfs/Makefile b/libxfs/Makefile
index 4e8f9a135818..2f2791cae587 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -23,6 +23,7 @@  HFILES = \
 	defer_item.h \
 	libxfs_io.h \
 	libxfs_api_defs.h \
+	listxattr.h \
 	init.h \
 	libxfs_priv.h \
 	linux-err.h \
@@ -69,6 +70,7 @@  CFILES = buf_mem.c \
 	defer_item.c \
 	init.c \
 	kmem.c \
+	listxattr.c \
 	logitem.c \
 	rdwr.c \
 	topology.c \
diff --git a/repair/listxattr.c b/libxfs/listxattr.c
similarity index 99%
rename from repair/listxattr.c
rename to libxfs/listxattr.c
index 2af77b7b2195..bedaca678439 100644
--- a/repair/listxattr.c
+++ b/libxfs/listxattr.c
@@ -6,7 +6,7 @@ 
 #include "libxfs.h"
 #include "libxlog.h"
 #include "libfrog/bitmap.h"
-#include "repair/listxattr.h"
+#include "listxattr.h"
 
 /* Call a function for every entry in a shortform xattr structure. */
 STATIC int
diff --git a/repair/listxattr.h b/libxfs/listxattr.h
similarity index 81%
rename from repair/listxattr.h
rename to libxfs/listxattr.h
index 2d26fce0f323..cddd96af7c0c 100644
--- a/repair/listxattr.h
+++ b/libxfs/listxattr.h
@@ -3,8 +3,8 @@ 
  * Copyright (c) 2022-2024 Oracle.  All Rights Reserved.
  * Author: Darrick J. Wong <djwong@kernel.org>
  */
-#ifndef __REPAIR_LISTXATTR_H__
-#define __REPAIR_LISTXATTR_H__
+#ifndef __LIBXFS_LISTXATTR_H__
+#define __LIBXFS_LISTXATTR_H__
 
 typedef int (*xattr_walk_fn)(struct xfs_inode *ip, unsigned int attr_flags,
 		const unsigned char *name, unsigned int namelen,
@@ -12,4 +12,4 @@  typedef int (*xattr_walk_fn)(struct xfs_inode *ip, unsigned int attr_flags,
 
 int xattr_walk(struct xfs_inode *ip, xattr_walk_fn attr_fn, void *priv);
 
-#endif /* __REPAIR_LISTXATTR_H__ */
+#endif /* __LIBXFS_LISTXATTR_H__ */
diff --git a/repair/Makefile b/repair/Makefile
index e7445d53e918..a36a95e353a5 100644
--- a/repair/Makefile
+++ b/repair/Makefile
@@ -24,7 +24,6 @@  HFILES = \
 	err_protos.h \
 	globals.h \
 	incore.h \
-	listxattr.h \
 	pptr.h \
 	prefetch.h \
 	progress.h \
@@ -59,7 +58,6 @@  CFILES = \
 	incore_ext.c \
 	incore_ino.c \
 	init.c \
-	listxattr.c \
 	phase1.c \
 	phase2.c \
 	phase3.c \
diff --git a/repair/pptr.c b/repair/pptr.c
index 8ec6a51d2c3d..cc66e637217f 100644
--- a/repair/pptr.c
+++ b/repair/pptr.c
@@ -11,7 +11,7 @@ 
 #include "repair/globals.h"
 #include "repair/err_protos.h"
 #include "repair/slab.h"
-#include "repair/listxattr.h"
+#include "libxfs/listxattr.h"
 #include "repair/threads.h"
 #include "repair/incore.h"
 #include "repair/pptr.h"