public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove duplicate definitions in xfsprogs
@ 2024-03-14 21:56 Matthew Wilcox
  2024-03-17 21:09 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2024-03-14 21:56 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

This is userspace.  I have no idea what I'm doing.

Building on current Debian testing gives:

/usr/bin/ld: ../libxlog/.libs/libxlog.a(util.o):xfsprogs/libxlog/util.c:25: multiple definition of `x'; init.o:xfsprogs/db/init.c:42: first defined here

and

/usr/bin/ld: ../libxfs/.libs/libxfs.a(init.o):xfsprogs/libxfs/init.c:39: multiple definition of `progname'; xfs_mdrestore.o:xfsprogs/mdrestore/xfs_mdrestore.c:22: first defined here

It seems to me that xfsprogs was relying on the linker to merge
duplicate definitions, and now the linker is declining to do so?

Feel free to split this up into individual patches, or whatever
seems best ...

diff --git a/db/init.c b/db/init.c
index b108a06cfe..42757e44c6 100644
--- a/db/init.c
+++ b/db/init.c
@@ -39,7 +39,6 @@ int			force;
 struct xfs_mount	xmount;
 struct xfs_mount	*mp;
 struct xlog		xlog;
-libxfs_init_t		x;
 xfs_agnumber_t		cur_agno = NULLAGNUMBER;
 
 static void
diff --git a/logprint/logprint.c b/logprint/logprint.c
index 37b8cb9116..a14ba185a5 100644
--- a/logprint/logprint.c
+++ b/logprint/logprint.c
@@ -36,7 +36,6 @@ int	print_buffer;
 int	print_overwrite;
 int     print_no_data;
 int     print_no_print;
-int     print_exit = 1; /* -e is now default. specify -c to override */
 int	print_operation = OP_PRINT;
 
 void
@@ -146,6 +145,7 @@ main(int argc, char **argv)
 	memset(&mount, 0, sizeof(mount));
 
 	progname = basename(argv[0]);
+	print_exit = 1; /* -e is now default. specify -c to override */
 	while ((c = getopt(argc, argv, "bC:cdefl:iqnors:tDVv")) != EOF) {
 		switch (c) {
 			case 'D':
diff --git a/mdrestore/xfs_mdrestore.c b/mdrestore/xfs_mdrestore.c
index c9d4b0c149..90383f6744 100644
--- a/mdrestore/xfs_mdrestore.c
+++ b/mdrestore/xfs_mdrestore.c
@@ -19,7 +19,6 @@
 #include "libxfs.h"
 #include "xfs_metadump.h"
 
-char 		*progname;
 int		show_progress = 0;
 int		show_info = 0;
 int		progress_since_warning = 0;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove duplicate definitions in xfsprogs
  2024-03-14 21:56 [PATCH] Remove duplicate definitions in xfsprogs Matthew Wilcox
@ 2024-03-17 21:09 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2024-03-17 21:09 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Darrick J. Wong, linux-xfs

On Thu, Mar 14, 2024 at 09:56:40PM +0000, Matthew Wilcox wrote:
> This is userspace.  I have no idea what I'm doing.

Heh.

> diff --git a/db/init.c b/db/init.c
> index b108a06cfe..42757e44c6 100644
> --- a/db/init.c
> +++ b/db/init.c
> @@ -39,7 +39,6 @@ int			force;
>  struct xfs_mount	xmount;
>  struct xfs_mount	*mp;
>  struct xlog		xlog;
> -libxfs_init_t		x;

I did rework the libxfs_init structure (and remove this typedef)
in xfsprogs for-next, which I think should have also fixed the
duplicated declaration for "x".

The other fixups look ok to me.  The global variables in libraries
aren't exactly a nice pattern, but I think we'll have to live with
them for now.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-17 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14 21:56 [PATCH] Remove duplicate definitions in xfsprogs Matthew Wilcox
2024-03-17 21:09 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox