Problems creating a new VFS module

Sergio Lopes slopes at iportalmais.pt
Thu Oct 7 09:21:06 MDT 2010


Hi,

I'm trying to develop a new VFS module for Samba, but am encountering
some difficulties and also i don't know much of samba programming so i
need some help from you, if possible.

The VFS module I want to develop will present a hierarchy of directories
and files. This hierarchy does not exist in the filesystem, its
structure is stored in a database. The files / directories shown in the
share will therefore be defined by the contents of the
database(something like a database FS).

After some reading in the samba documentation, I found that the new
module should implement OPAQUE functions, so as a starting point and i
wanted to compile and configure a share working with the module
skel_opaque that comes in the VFS examples from samba source code:

- I have a server with version 3.4.3-26 of samba installed . Then i
downloaded the source code of this release.

- Within the directory samba-3.4.3/source3 ran the command ". /configure"

- Within the directory samba-3.4.3/examples/VFS ran the commands ".
/autogen.sh", ". /configure" and ". /make"
(
I got these warnings when compiling the file skel_opaque.c:

skel_opaque.c: In function ‘skel_opendir’:
skel_opaque.c:85: warning: return makes pointer from integer without a cast
skel_opaque.c: In function ‘skel_readdir’:
skel_opaque.c:92: warning: return makes pointer from integer without a cast
skel_opaque.c: In function ‘skel_getwd’:
skel_opaque.c:233: warning: return makes pointer from integer without a cast
skel_opaque.c: In function ‘skel_realpath’:
skel_opaque.c:279: warning: return makes pointer from integer without a cast
)

- Then i copied the generated file "skel_opaque.so" to "/usr/lib/samba/vfs/"

- Then i configured a share with this new module:

[vfs_module_test]

comment = vfs module test
path = / home1/
vfs objects = skel_opaque
read only = Yes
guest ok = Yes
public = Yesi
writable = no

- Restarted samba

When i try to access the share "vfs_module_test" I get the following
error in "/var/log/syslog":

Oct 7 15:31:32 machine smbd [22357]: Error Trying to resolve symbol
'init_samba_module' in /usr/lib/samba/vfs/skel_opaque.so:
/usr/lib/samba/vfs/ skel_opaque.so: undefined symbol : init_samba_module
Oct 7 15:31:32 machine smbd [22357]: [7/10/2009 15:31:32, 0] smbd/vfs.c:
175 (vfs_init_custom)
Oct 7 15:31:32 machine smbd [22357]: Can not find a vfs module [skel_opaque]
Oct 7 15:31:32 machine smbd [22357]: [7/10/2009 15:31:32, 0] smbd/vfs.c:
322 (smbd_vfs_init)
Oct 7 15:31:32 machine smbd [22357]: smbd_vfs_init: vfs_init_custom
failed for skel_opaque

What am I doing wrong? Do i have to compile the whole samba code again
in order to get a new vfs module working? Or it is enough to compile
only the new module?

Also I would like to know if anyone knows of any VFS module that does
something similar to what I want to do. This would be a great help.

Thanks in advance.

Best regards,
Sergio Lopes



More information about the samba-technical mailing list