[PATCH] Add new RECALL_OFFLINE vfs function
David Disseldorp
ddiss at sgi.com
Fri Jun 13 08:19:08 GMT 2008
To be used for recalling files migrated to offline storage by a
Hierarchical Storage Management system.
---
examples/VFS/skel_transparent.c | 6 ++++--
source/include/vfs.h | 4 ++++
source/include/vfs_macros.h | 3 +++
source/modules/vfs_default.c | 16 +++++++++++++++-
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index ea8530d..c5d1a65 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -548,11 +548,12 @@ static int skel_set_offline(struct vfs_handle_struct *handle, const char *path)
return SMB_VFS_NEXT_SET_OFFLINE(handle, path);
}
-static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path)
+static int skel_recall_offline(struct vfs_handle_struct *handle, struct files_struct *fsp)
{
- return SMB_VFS_NEXT_IS_REMOTESTORAGE(handle, path);
+ return SMB_VFS_NEXT_RECALL_OFFLINE(handle, fsp);
}
+
/* VFS operations structure */
static vfs_op_tuple skel_op_tuples[] = {
@@ -674,6 +675,7 @@ static vfs_op_tuple skel_op_tuples[] = {
/* offline operations */
{SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(skel_recall_offline), SMB_VFS_OP_RECALL_OFFLINE, SMB_VFS_LAYER_TRANSPARENT},
{NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
};
diff --git a/source/include/vfs.h b/source/include/vfs.h
index 9b72f69..6500c58 100644
--- a/source/include/vfs.h
+++ b/source/include/vfs.h
@@ -108,6 +108,7 @@
/* Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox */
/* Changed to version 23 - remove set_nt_acl call. This can only be done via an
open handle. JRA. */
+/* Leave at 23 - not yet released. Add recall_offline for offline files */
#define SMB_VFS_INTERFACE_VERSION 23
@@ -266,6 +267,7 @@ typedef enum _vfs_op_type {
/* offline operations */
SMB_VFS_OP_IS_OFFLINE,
SMB_VFS_OP_SET_OFFLINE,
+ SMB_VFS_OP_RECALL_OFFLINE,
/* This should always be last enum value */
@@ -422,6 +424,7 @@ struct vfs_ops {
/* offline operations */
bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
+ int (*recall_offline)(struct vfs_handle_struct *handle, struct files_struct *fsp);
} ops;
struct vfs_handles_pointers {
@@ -548,6 +551,7 @@ struct vfs_ops {
/* offline operations */
struct vfs_handle_struct *is_offline;
struct vfs_handle_struct *set_offline;
+ struct vfs_handle_struct *recall_offline;
} handles;
};
diff --git a/source/include/vfs_macros.h b/source/include/vfs_macros.h
index 7b3aeaa..c5bf386 100644
--- a/source/include/vfs_macros.h
+++ b/source/include/vfs_macros.h
@@ -144,6 +144,7 @@
/* Offline operations */
#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf)))
#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path)))
+#define SMB_VFS_RECALL_OFFLINE(fsp) ((fsp)->conn->vfs.ops.recall_offline((fsp)->conn->vfs.handles.recall_offline,(fsp)))
/*******************************************************************
Don't access conn->vfs_opaque.ops directly!!!
@@ -269,6 +270,7 @@
/* Offline operations */
#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf)))
#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path)))
+#define SMB_VFS_OPAQUE_RECALL_OFFLINE(fsp) ((fsp)->conn->vfs_opaque.ops.recall_offline((fsp)->conn->vfs_opaque.handles.recall_offline,(fsp)))
/*******************************************************************
Don't access handle->vfs_next.ops.* directly!!!
@@ -395,5 +397,6 @@
/* Offline operations */
#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf)))
#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path)))
+#define SMB_VFS_NEXT_RECALL_OFFLINE(handle,fsp) ((handle)->vfs_next.ops.recall_offline((handle)->vfs_next.handles.recall_offline,(fsp)))
#endif /* _VFS_MACROS_H */
diff --git a/source/modules/vfs_default.c b/source/modules/vfs_default.c
index 6ee677e..c6c450c 100644
--- a/source/modules/vfs_default.c
+++ b/source/modules/vfs_default.c
@@ -1311,6 +1311,18 @@ static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *pat
return -1;
}
+static int vfswrap_recall_offline(struct vfs_handle_struct *handle, struct files_struct *fsp)
+{
+ /*
+ * We don't know how to recall an offline file by default, needs to be
+ * overriden in other vfs modules
+ */
+#if defined(ENOTSUP)
+ errno = ENOTSUP;
+#endif
+ return -1;
+}
+
static vfs_op_tuple vfs_default_ops[] = {
/* Disk operations */
@@ -1529,7 +1541,6 @@ static vfs_op_tuple vfs_default_ops[] = {
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_aio_suspend),SMB_VFS_OP_AIO_SUSPEND,
SMB_VFS_LAYER_OPAQUE},
-
{SMB_VFS_OP(vfswrap_aio_force), SMB_VFS_OP_AIO_FORCE,
SMB_VFS_LAYER_OPAQUE},
@@ -1537,6 +1548,9 @@ static vfs_op_tuple vfs_default_ops[] = {
SMB_VFS_LAYER_OPAQUE},
{SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE,
SMB_VFS_LAYER_OPAQUE},
+ {SMB_VFS_OP(vfswrap_recall_offline),SMB_VFS_OP_RECALL_OFFLINE,
+ SMB_VFS_LAYER_OPAQUE},
+
/* Finish VFS operations definition */
--
1.5.4.rc0
More information about the samba-technical
mailing list