Bug 8822 - VFS module init function name has to be manually changed depending on build environment
VFS module init function name has to be manually changed depending on build e...
Product: Samba 3.6
Classification: Unclassified
Component: Build environment
All All
: P5 enhancement
: ---
Assigned To: Karolin Seeger
Samba QA Contact
: 8907 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2012-03-21 17:36 UTC by clawsoon
Modified: 2012-05-08 14:21 UTC (History)
1 user (show)

See Also:

Patchfile for Makefile.in for out-of-tree modules (371 bytes, patch)
2012-03-24 19:09 UTC, Richard Sharpe
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description clawsoon 2012-03-21 17:36:54 UTC
When a VFS module is built outside the source tree, the init function name has to be manually changed to samba_init_module or init_samba_module depending on which Samba version is being built against.

It'd be nice to have build functionality available that'd allow the same module source file to be compiled inside or outside the tree without manually changing the init function name.

Comment 1 Richard Sharpe 2012-03-23 04:13:49 UTC
Hmmm, please reassign this to me. I couldn't figure out how to do it.
Comment 2 Richard Sharpe 2012-03-23 04:15:38 UTC
This will do it, I believe:

diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in
index bbb66be..55e2c04 100644
--- a/examples/VFS/Makefile.in
+++ b/examples/VFS/Makefile.in
@@ -45,7 +45,7 @@ skel_transparent.@SHLIBEXT@: skel_transparent.@OBJEXT@
        @echo "Compiling $<"
-       @$(CC) $(FLAGS) -c $<
+       @$(CC) $(FLAGS) -c $< -D$(basename $@)_init=samba_init_module
 install: default
Comment 3 Richard Sharpe 2012-03-24 19:07:16 UTC
Something like the above was pushed to master as 1080483319d4eb7a8cdee767fc41f7258e0e2537

However, a small change is required for the 3.6.x and 3.5.x code bases which declare things as:

   #define vfs_acl_tdb_init init_samba_module 

Here is the required patch for 3.5.x and 3.6.x:

diff --git a/examples/VFS/Makefile.in b/examples/VFS/Makefile.in
index 8fe414a..98d259f 100644
--- a/examples/VFS/Makefile.in
+++ b/examples/VFS/Makefile.in
@@ -36,7 +36,7 @@ default: $(patsubst %.c,%.$(SHLIBEXT),$(wildcard *.c))
 %.$(OBJEXT): %.c
        @echo "Compiling $<"
-       @$(CC) $(FLAGS) -c $<
+       @$(CC) $(FLAGS) -c $< -D$*_init=init_samba_module
 install: default

Can I get someone to approve including this patch in the next 3.6.x and 3.5.x releases because it makes life easier for those who write out-of-tree modules.

It also overcomes my objection to the gratuitous change to the vfs module init function in Master compared to the other branches, because we hide the difference in the infrastructure.
Comment 4 Richard Sharpe 2012-03-24 19:09:09 UTC
Created attachment 7403 [details]
Patchfile for Makefile.in for out-of-tree modules
Comment 5 Richard Sharpe 2012-03-25 23:12:32 UTC
Can I get someone to review the change so we can line them up to be pushed to 3.6.next and 3.5.next please?
Comment 6 Jeremy Allison 2012-03-29 00:01:38 UTC
Comment on attachment 7403 [details]
Patchfile for Makefile.in for out-of-tree modules

Looks good to me for 3.6.x and 3.5.x.
Comment 7 Jeremy Allison 2012-03-29 00:02:03 UTC
Re-assigning to Karolin for inclusion in 3.5.next and 3.6.next.
Comment 8 Karolin Seeger 2012-05-08 12:57:34 UTC
Pushed to v3-5-test and v3-6-test.
Closing out bug report.

Comment 9 Richard Sharpe 2012-05-08 14:21:42 UTC
*** Bug 8907 has been marked as a duplicate of this bug. ***