[PATCH] Add HSM offline and aio_force functions to vfs_full_audit

David Disseldorp ddiss at sgi.com
Wed Jun 18 00:45:56 GMT 2008


---
 source/modules/vfs_full_audit.c |   65 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/source/modules/vfs_full_audit.c b/source/modules/vfs_full_audit.c
index 3005de3..57bc769 100644
--- a/source/modules/vfs_full_audit.c
+++ b/source/modules/vfs_full_audit.c
@@ -308,6 +308,15 @@ static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct fi
 static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
 static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *ts);
+static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp);
+
+static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
+				      const char *path, SMB_STRUCT_STAT *sbuf);
+static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
+				      const char *path);
+static int smb_full_audit_recall_offline(struct vfs_handle_struct *handle,
+					 struct files_struct *fsp);
+
 
 /* VFS operations */
 
@@ -527,6 +536,16 @@ static vfs_op_tuple audit_op_tuples[] = {
 	 SMB_VFS_LAYER_LOGGER},
 	{SMB_VFS_OP(smb_full_audit_aio_suspend),SMB_VFS_OP_AIO_SUSPEND,
 	 SMB_VFS_LAYER_LOGGER},
+	{SMB_VFS_OP(smb_full_audit_aio_force),SMB_VFS_OP_AIO_FORCE,
+	 SMB_VFS_LAYER_LOGGER},
+
+	/* offline operations */
+	{SMB_VFS_OP(smb_full_audit_is_offline),SMB_VFS_OP_IS_OFFLINE,
+	 SMB_VFS_LAYER_LOGGER},
+	{SMB_VFS_OP(smb_full_audit_set_offline),SMB_VFS_OP_SET_OFFLINE,
+	 SMB_VFS_LAYER_LOGGER},
+	{SMB_VFS_OP(smb_full_audit_recall_offline),SMB_VFS_OP_RECALL_OFFLINE,
+	 SMB_VFS_LAYER_LOGGER},
 
 	/* Finish VFS operations definition */
 	
@@ -639,8 +658,9 @@ static struct {
 	{ SMB_VFS_OP_AIO_FSYNC,	"aio_fsync" },
 	{ SMB_VFS_OP_AIO_SUSPEND,"aio_suspend" },
 	{ SMB_VFS_OP_AIO_FORCE, "aio_force" },
-	{ SMB_VFS_OP_IS_OFFLINE, "aio_is_offline" },
-	{ SMB_VFS_OP_SET_OFFLINE, "aio_set_offline" },
+	{ SMB_VFS_OP_IS_OFFLINE, "is_offline" },
+	{ SMB_VFS_OP_SET_OFFLINE, "set_offline" },
+	{ SMB_VFS_OP_RECALL_OFFLINE, "recall_offline" },
 	{ SMB_VFS_OP_LAST, NULL }
 };	
 
@@ -2185,6 +2205,47 @@ static int smb_full_audit_aio_suspend(struct vfs_handle_struct *handle, struct f
 	return result;
 }
 
+static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+	bool result;
+
+	result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
+	do_log(SMB_VFS_OP_AIO_FORCE, (result == true), handle,
+		"%s", fsp->fsp_name);
+
+	return result;
+}
+
+static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
+				      const char *path, SMB_STRUCT_STAT *sbuf)
+{
+	bool result;
+
+	result = SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf);
+	do_log(SMB_VFS_OP_IS_OFFLINE, (result == true), handle, "%s", path);
+	return result;
+}
+
+static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
+				      const char *path)
+{
+	int result;
+
+	result = SMB_VFS_NEXT_SET_OFFLINE(handle, path);
+	do_log(SMB_VFS_OP_SET_OFFLINE, (result == 0), handle, "%s", path);
+	return result;
+}
+
+static int smb_full_audit_recall_offline(struct vfs_handle_struct *handle,
+					 struct files_struct *fsp)
+{
+	int result;
+
+	SMB_VFS_NEXT_RECALL_OFFLINE(handle, fsp);
+	do_log(SMB_VFS_OP_RECALL_OFFLINE, (result == 0), handle,
+		"%s", fsp->fsp_name);
+	return result;
+}
 
 NTSTATUS vfs_full_audit_init(void);
 NTSTATUS vfs_full_audit_init(void)
-- 
1.5.4.rc0



More information about the samba-technical mailing list