1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
samba-mirror/source3/modules/vfs_offline.c
Ralph Boehme 6f3b421c4a s3/vfs: merge offline functionality into DOS attributes handling
The offline VFS functions predate the SMB_VFS_{GET|SET}_DOS_ATTRIBUTES()
functions, now that we have these, we can use them for the offline
attribute as well.

The primary reason for this is: performance. Merging both functions has
the benefit that in VFS modules that use same backing store bits for
both offline attribute and DOS attributes (like gpfs), we avoid calling
the backing store twice in dos_mode() and file_set_dosmode().

This commit modifies all existing users of the offline attribute to
adapt to the change, the next commit will then remove the obsolete
offline functions.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-10-11 11:01:10 +02:00

58 lines
1.8 KiB
C

/*
Unix SMB/CIFS implementation.
Samba VFS module for marking all files as offline.
(c) Uri Simchoni, 2015
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
static uint32_t offline_fs_capabilities(struct vfs_handle_struct *handle,
enum timestamp_set_resolution *p_ts_res)
{
return SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res) |
FILE_SUPPORTS_REMOTE_STORAGE;
}
static NTSTATUS offline_get_dos_attributes(struct vfs_handle_struct *handle,
struct smb_filename *smb_fname,
uint32_t *dosmode)
{
*dosmode |= FILE_ATTRIBUTE_OFFLINE;
return SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle, smb_fname, dosmode);
}
static NTSTATUS offline_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
{
*dosmode |= FILE_ATTRIBUTE_OFFLINE;
return SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle, fsp, dosmode);
}
static struct vfs_fn_pointers offline_fns = {
.fs_capabilities_fn = offline_fs_capabilities,
.get_dos_attributes_fn = offline_get_dos_attributes,
.fget_dos_attributes_fn = offline_fget_dos_attributes,
};
NTSTATUS vfs_offline_init(void);
NTSTATUS vfs_offline_init(void)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "offline",
&offline_fns);
}