Two different vfs_init() functions in vfs.c and audit.c

Michael H Buselli busellim at pprd.abbott.com
Tue Jul 24 21:03:22 GMT 2001


Hello,

I'm using Samba 2.2.1a on Solaris 2.7 compiled with Sun's compiler
version 5.0.  It works great, except for what I mention below.

In vfs.c exists the following function:

    BOOL vfs_init (connection_struct *conn);

The prototype for this vfs_init() is in proto.h.

When writing a VFS shared object file, that .so file must contain a
vfs_init() function for samba to call to initialize stuff.  That
function needs the following prototype:

    struct vfs_ops *vfs_init (int *vfs_version);

However, the samba header files give the first prototype and my compiler
is complaining loudly about the fact that the prototype given in a
header file does not mesh with the actual function, and it bombs out
because they are incompatible, even though the code would work anyway if
the compiler would just compile the code.  I temporarily modified
proto.h to remove the offending prototype, compiled audit.so again, and
it compiles and functions perfectly.

Could we either rename one of the vfs_init() functions here or do
something else so that the compilers don't confuse themselves on this?
Or am I supposed to be doing something else that I'm not doing such as
using different compile time flags or including additional -D(something)
flags?  The audit.so compile line looks like this:

    cc -I../../source -I../../source/include -I../../source/ubiqx \
    -I../../source/smbwrapper -O -D_LARGEFILE_SOURCE \
    -D_FILE_OFFSET_BITS=64 -o audit.so audit.c -G

Also, the audit.c example in examples/VFS doesn't work as given.  I had
to add a line to set vfs_version before returning, as below.  The other
VFS examples seem to be okay in this regard.

======= start diff
*** audit.c.old	Mon Nov  6 14:01:05 2000
--- audit.c	Tue Jul 24 15:53:03 2001
***************
*** 107,114 ****
  /* VFS initialisation function.  Return initialised vfs_ops structure
     back to SAMBA. */
  
! struct vfs_ops *vfs_init(void)
  {
  	openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY);
  	syslog(SYSLOG_PRIORITY, "VFS_INIT: &audit_ops: 0x%8.8x\n", 
  	       &audit_ops);
--- 107,115 ----
  /* VFS initialisation function.  Return initialised vfs_ops structure
     back to SAMBA. */
  
! struct vfs_ops *vfs_init (int *vfs_version)
  {
+ 	*vfs_version = SMB_VFS_INTERFACE_VERSION;
  	openlog("smbd_audit", LOG_PID, SYSLOG_FACILITY);
  	syslog(SYSLOG_PRIORITY, "VFS_INIT: &audit_ops: 0x%8.8x\n", 
  	       &audit_ops);
======= end diff

--
Michael H. Buselli
Senior Network Systems Specialist            Abbott Laboratories
Email: busellim at pprd.abbott.com              D472/AP9A-L20
Phone: 847-935-4624                          100 Abbott Park Road
Fax: 847-935-0142                            Abbott Park, IL  60064-3500




More information about the samba-technical mailing list