1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Updated VFS examples to use ftruncate() and lock() functions.

This commit is contained in:
Tim Potter 0001-01-01 00:00:00 +00:00
parent 2e0a39204a
commit def0da145a
2 changed files with 141 additions and 126 deletions

View File

@ -1,5 +1,5 @@
/*
* Auditing VFS module for samba. Log select file operations to syslog
* Auditing VFS module for samba. Log selected file operations to syslog
* facility.
*
* Copyright (C) Tim Potter, 1999-2000
@ -17,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: audit.c,v 1.2 2000/02/04 05:08:16 tpot Exp $
*/
#include "config.h"
@ -93,7 +91,9 @@ struct vfs_ops audit_ops = {
NULL, /* lstat */
audit_unlink,
NULL, /* chmod */
NULL /* utime */
NULL, /* utime */
NULL, /* ftruncate */
NULL /* lock */
};
/* VFS initialisation function. Return initialised vfs_ops structure
@ -110,7 +110,8 @@ struct vfs_ops *vfs_init(void)
int audit_connect(struct vfs_connection_struct *conn, char *svc, char *user)
{
syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n", svc, user);
syslog(SYSLOG_PRIORITY, "connect to service %s by user %s\n",
svc, user);
return default_vfs_ops.connect(conn, svc, user);
}

View File

@ -1,5 +1,6 @@
/*
* Skeleton VFS module.
* Skeleton VFS module. Implements passthrough operation of all VFS
* calls to disk functions.
*
* Copyright (C) Tim Potter, 1999-2000
*
@ -16,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: skel.c,v 1.3 2000/04/05 22:42:26 tpot Exp $
*/
#include "config.h"
@ -64,6 +63,8 @@ int skel_lstat(char *path, SMB_STRUCT_STAT *sbuf);
int skel_unlink(char *path);
int skel_chmod(char *path, mode_t mode);
int skel_utime(char *path, struct utimbuf *times);
int skel_ftruncate(int fd, SMB_OFF_T offset);
BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
/* VFS operations structure */
@ -97,7 +98,9 @@ struct vfs_ops skel_ops = {
skel_lstat,
skel_unlink,
skel_chmod,
skel_utime
skel_utime,
skel_ftruncate,
skel_lock
};
/* VFS initialisation - return vfs_ops function pointer structure */
@ -124,7 +127,8 @@ void skel_disconnect(void)
SMB_BIG_UINT skel_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize,
SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
{
return default_vfs_ops.disk_free(path, small_query, bsize, dfree, dsize);
return default_vfs_ops.disk_free(path, small_query, bsize,
dfree, dsize);
}
DIR *skel_opendir(char *fname)
@ -184,7 +188,7 @@ int skel_rename(char *old, char *new)
int skel_fsync(int fd)
{
default_vfs_ops.fsync(fd);
return default_vfs_ops.fsync(fd);
}
int skel_stat(char *fname, SMB_STRUCT_STAT *sbuf)
@ -216,3 +220,13 @@ int skel_utime(char *path, struct utimbuf *times)
{
return default_vfs_ops.utime(path, times);
}
int skel_ftruncate(int fd, SMB_OFF_T offset)
{
return default_vfs_ops.ftruncate(fd, offset);
}
BOOL skel_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
{
return default_vfs_ops.lock(fd, op, offset, count, type);
}