driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] staging: exfat: fix multiple definition error of `rename_file'
@ 2019-12-04 23:45 Brendan Higgins
  2019-12-05 17:50 ` David Gow
  0 siblings, 1 reply; 3+ messages in thread
From: Brendan Higgins @ 2019-12-04 23:45 UTC (permalink / raw)
  To: valdis.kletnieks
  Cc: devel, Greg Kroah-Hartman, Brendan Higgins, linux-kernel,
	davidgow, linux-fsdevel

`rename_file' was exported but not properly namespaced causing a
multiple definition error because `rename_file' is already defined in
fs/hostfs/hostfs_user.c:

ld: drivers/staging/exfat/exfat_core.o: in function `rename_file':
drivers/staging/exfat/exfat_core.c:2327: multiple definition of
`rename_file'; fs/hostfs/hostfs_user.o:fs/hostfs/hostfs_user.c:350:
first defined here
make: *** [Makefile:1077: vmlinux] Error 1

This error can be reproduced on ARCH=um by selecting:

CONFIG_EXFAT_FS=y
CONFIG_HOSTFS=y

Add a namespace prefix exfat_* to fix this error.

Reported-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/exfat/exfat.h       | 4 ++--
 drivers/staging/exfat/exfat_core.c  | 4 ++--
 drivers/staging/exfat/exfat_super.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index 2aac1e000977e..51c665a924b76 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -805,8 +805,8 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
 s32 create_file(struct inode *inode, struct chain_t *p_dir,
 		struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid);
 void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry);
-s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
-		struct uni_name_t *p_uniname, struct file_id_t *fid);
+s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
+		      struct uni_name_t *p_uniname, struct file_id_t *fid);
 s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
 	      struct chain_t *p_newdir, struct uni_name_t *p_uniname,
 	      struct file_id_t *fid);
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index d2d3447083c7b..7017e22b0f7a8 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -2322,8 +2322,8 @@ void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry)
 	fs_func->delete_dir_entry(sb, p_dir, entry, 0, num_entries);
 }
 
-s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
-		struct uni_name_t *p_uniname, struct file_id_t *fid)
+s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
+		      struct uni_name_t *p_uniname, struct file_id_t *fid)
 {
 	s32 ret, newentry = -1, num_old_entries, num_new_entries;
 	sector_t sector_old, sector_new;
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 6e481908c59f6..9f91853b189b0 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -1262,8 +1262,8 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
 	fs_set_vol_flags(sb, VOL_DIRTY);
 
 	if (olddir.dir == newdir.dir)
-		ret = rename_file(new_parent_inode, &olddir, dentry, &uni_name,
-				  fid);
+		ret = exfat_rename_file(new_parent_inode, &olddir, dentry,
+					&uni_name, fid);
 	else
 		ret = move_file(new_parent_inode, &olddir, dentry, &newdir,
 				&uni_name, fid);
-- 
2.24.0.393.g34dc348eaf-goog

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v1] staging: exfat: fix multiple definition error of `rename_file'
  2019-12-04 23:45 [PATCH v1] staging: exfat: fix multiple definition error of `rename_file' Brendan Higgins
@ 2019-12-05 17:50 ` David Gow
  2019-12-05 18:31   ` Brendan Higgins
  0 siblings, 1 reply; 3+ messages in thread
From: David Gow @ 2019-12-05 17:50 UTC (permalink / raw)
  To: Brendan Higgins
  Cc: linux-fsdevel, devel, valdis.kletnieks,
	Linux Kernel Mailing List, Greg Kroah-Hartman

On Wed, Dec 4, 2019 at 3:46 PM Brendan Higgins
<brendanhiggins@google.com> wrote:
>
> `rename_file' was exported but not properly namespaced causing a
> multiple definition error because `rename_file' is already defined in
> fs/hostfs/hostfs_user.c:
>
> ld: drivers/staging/exfat/exfat_core.o: in function `rename_file':
> drivers/staging/exfat/exfat_core.c:2327: multiple definition of
> `rename_file'; fs/hostfs/hostfs_user.o:fs/hostfs/hostfs_user.c:350:
> first defined here
> make: *** [Makefile:1077: vmlinux] Error 1
>
> This error can be reproduced on ARCH=um by selecting:
>
> CONFIG_EXFAT_FS=y
> CONFIG_HOSTFS=y
>
> Add a namespace prefix exfat_* to fix this error.
>
> Reported-by: Brendan Higgins <brendanhiggins@google.com>
> Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Tested-by: David Gow <davidgow@google.com>
Reviewed-by: David Gow <davidgow@google.com>

This works for me: I was able to reproduce the compile error without
this patch, and successfully compile a UML kernel and mount an exfat
fs after applying it.

> ---
>  drivers/staging/exfat/exfat.h       | 4 ++--
>  drivers/staging/exfat/exfat_core.c  | 4 ++--
>  drivers/staging/exfat/exfat_super.c | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
> index 2aac1e000977e..51c665a924b76 100644
> --- a/drivers/staging/exfat/exfat.h
> +++ b/drivers/staging/exfat/exfat.h
> @@ -805,8 +805,8 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
>  s32 create_file(struct inode *inode, struct chain_t *p_dir,
>                 struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid);
>  void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry);
> -s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
> -               struct uni_name_t *p_uniname, struct file_id_t *fid);
> +s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
> +                     struct uni_name_t *p_uniname, struct file_id_t *fid);
>  s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
>               struct chain_t *p_newdir, struct uni_name_t *p_uniname,
>               struct file_id_t *fid);

It seems a bit ugly to add the exfat_ prefix to just rename_file,
rather than all of the above functions (e.g., create_dir, remove_file,
etc). It doesn't look like any of the others are causing any issues
though (while, for example, there is another remove_file in
drivers/infiniband/hw/qib/qib_fs.c, it's static, so shouldn't be a
problem).


-- David
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v1] staging: exfat: fix multiple definition error of `rename_file'
  2019-12-05 17:50 ` David Gow
@ 2019-12-05 18:31   ` Brendan Higgins
  0 siblings, 0 replies; 3+ messages in thread
From: Brendan Higgins @ 2019-12-05 18:31 UTC (permalink / raw)
  To: David Gow
  Cc: linux-fsdevel, devel, valdis.kletnieks,
	Linux Kernel Mailing List, Greg Kroah-Hartman

On Thu, Dec 5, 2019 at 9:51 AM David Gow <davidgow@google.com> wrote:
>
> On Wed, Dec 4, 2019 at 3:46 PM Brendan Higgins
> <brendanhiggins@google.com> wrote:
> >
> > `rename_file' was exported but not properly namespaced causing a
> > multiple definition error because `rename_file' is already defined in
> > fs/hostfs/hostfs_user.c:
> >
> > ld: drivers/staging/exfat/exfat_core.o: in function `rename_file':
> > drivers/staging/exfat/exfat_core.c:2327: multiple definition of
> > `rename_file'; fs/hostfs/hostfs_user.o:fs/hostfs/hostfs_user.c:350:
> > first defined here
> > make: *** [Makefile:1077: vmlinux] Error 1
> >
> > This error can be reproduced on ARCH=um by selecting:
> >
> > CONFIG_EXFAT_FS=y
> > CONFIG_HOSTFS=y
> >
> > Add a namespace prefix exfat_* to fix this error.
> >
> > Reported-by: Brendan Higgins <brendanhiggins@google.com>
> > Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
> > Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Tested-by: David Gow <davidgow@google.com>
> Reviewed-by: David Gow <davidgow@google.com>
>
> This works for me: I was able to reproduce the compile error without
> this patch, and successfully compile a UML kernel and mount an exfat
> fs after applying it.
>
> > ---
> >  drivers/staging/exfat/exfat.h       | 4 ++--
> >  drivers/staging/exfat/exfat_core.c  | 4 ++--
> >  drivers/staging/exfat/exfat_super.c | 4 ++--
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
> > index 2aac1e000977e..51c665a924b76 100644
> > --- a/drivers/staging/exfat/exfat.h
> > +++ b/drivers/staging/exfat/exfat.h
> > @@ -805,8 +805,8 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
> >  s32 create_file(struct inode *inode, struct chain_t *p_dir,
> >                 struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid);
> >  void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry);
> > -s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
> > -               struct uni_name_t *p_uniname, struct file_id_t *fid);
> > +s32 exfat_rename_file(struct inode *inode, struct chain_t *p_dir, s32 old_entry,
> > +                     struct uni_name_t *p_uniname, struct file_id_t *fid);
> >  s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
> >               struct chain_t *p_newdir, struct uni_name_t *p_uniname,
> >               struct file_id_t *fid);
>
> It seems a bit ugly to add the exfat_ prefix to just rename_file,
> rather than all of the above functions (e.g., create_dir, remove_file,
> etc). It doesn't look like any of the others are causing any issues
> though (while, for example, there is another remove_file in
> drivers/infiniband/hw/qib/qib_fs.c, it's static, so shouldn't be a
> problem).

Agreed; however, given that this is a fix, I didn't want to overreach
in the scope of this change since I want to make sure it gets accepted
in 5.5 and it probably won't make it in the merge window. I also
figured that, since this is in staging, this might be one of the
things that needs to happen before being promoted out of staging.

Nevertheless, I don't mind going through and adding the namespace
prefix to the other non-static functions if that's what Valdis and
Greg want.

Thanks!
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2019-12-05 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 23:45 [PATCH v1] staging: exfat: fix multiple definition error of `rename_file' Brendan Higgins
2019-12-05 17:50 ` David Gow
2019-12-05 18:31   ` Brendan Higgins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).