mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3:vfs_gpfs: make "gpfs:winattr" a per share option
metze Signed-off-by: Christian Ambach <ambi@samba.org>
This commit is contained in:
parent
2e95d8048b
commit
89a4f66826
@ -26,7 +26,6 @@
|
||||
#include "vfs_gpfs.h"
|
||||
|
||||
static bool gpfs_getrealfilename;
|
||||
static bool gpfs_winattr;
|
||||
static bool gpfs_do_ftruncate;
|
||||
|
||||
static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
|
||||
@ -159,7 +158,7 @@ int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
|
||||
int get_gpfs_winattrs(char *pathname,struct gpfs_winattr *attrs)
|
||||
{
|
||||
|
||||
if ((!gpfs_winattr) || (gpfs_get_winattrs_path_fn == NULL)) {
|
||||
if (gpfs_get_winattrs_path_fn == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
@ -170,7 +169,7 @@ int get_gpfs_winattrs(char *pathname,struct gpfs_winattr *attrs)
|
||||
int smbd_fget_gpfs_winattrs(int fd, struct gpfs_winattr *attrs)
|
||||
{
|
||||
|
||||
if ((!gpfs_winattr) || (gpfs_get_winattrs_fn == NULL)) {
|
||||
if (gpfs_get_winattrs_fn == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
@ -180,7 +179,7 @@ int smbd_fget_gpfs_winattrs(int fd, struct gpfs_winattr *attrs)
|
||||
|
||||
int set_gpfs_winattrs(char *pathname,int flags,struct gpfs_winattr *attrs)
|
||||
{
|
||||
if ((!gpfs_winattr) || (gpfs_set_winattrs_path_fn == NULL)) {
|
||||
if (gpfs_set_winattrs_path_fn == NULL) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
@ -266,7 +265,6 @@ void init_gpfs(void)
|
||||
|
||||
gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
|
||||
True);
|
||||
gpfs_winattr = lp_parm_bool(-1, "gpfs", "winattr", False);
|
||||
gpfs_do_ftruncate = lp_parm_bool(-1, "gpfs", "ftruncate", True);
|
||||
|
||||
return;
|
||||
|
@ -39,6 +39,7 @@ struct gpfs_config_data {
|
||||
bool leases;
|
||||
bool hsm;
|
||||
bool syncio;
|
||||
bool winattr;
|
||||
};
|
||||
|
||||
|
||||
@ -946,6 +947,16 @@ static int gpfs_set_xattr(struct vfs_handle_struct *handle, const char *path,
|
||||
unsigned int dosmode=0;
|
||||
struct gpfs_winattr attrs;
|
||||
int ret = 0;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
if (!config->winattr) {
|
||||
DEBUG(10, ("gpfs_set_xattr:name is %s -> next\n",name));
|
||||
return SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags);
|
||||
}
|
||||
|
||||
DEBUG(10, ("gpfs_set_xattr: %s \n",path));
|
||||
|
||||
@ -1022,6 +1033,16 @@ static ssize_t gpfs_get_xattr(struct vfs_handle_struct *handle, const char *pat
|
||||
unsigned int dosmode = 0;
|
||||
struct gpfs_winattr attrs;
|
||||
int ret = 0;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
if (!config->winattr) {
|
||||
DEBUG(10, ("gpfs_get_xattr:name is %s -> next\n",name));
|
||||
return SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size);
|
||||
}
|
||||
|
||||
DEBUG(10, ("gpfs_get_xattr: %s \n",path));
|
||||
|
||||
@ -1075,11 +1096,21 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
|
||||
char *fname = NULL;
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!config->winattr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), smb_fname, &fname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
@ -1100,6 +1131,11 @@ static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
|
||||
{
|
||||
struct gpfs_winattr attrs;
|
||||
int ret;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
|
||||
if (ret == -1) {
|
||||
@ -1108,6 +1144,10 @@ static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
|
||||
if ((fsp->fh == NULL) || (fsp->fh->fd == -1)) {
|
||||
return 0;
|
||||
}
|
||||
if (!config->winattr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = smbd_fget_gpfs_winattrs(fsp->fh->fd, &attrs);
|
||||
if (ret == 0) {
|
||||
sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
|
||||
@ -1123,11 +1163,20 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
|
||||
char *path = NULL;
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
|
||||
if (ret == -1) {
|
||||
return -1;
|
||||
}
|
||||
if (!config->winattr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), smb_fname, &path);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
@ -1152,6 +1201,11 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
|
||||
int ret;
|
||||
char *path = NULL;
|
||||
NTSTATUS status;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
ret = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
|
||||
if(ret == -1){
|
||||
@ -1164,6 +1218,10 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!config->winattr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), smb_fname, &path);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
errno = map_errno_from_nt_status(status);
|
||||
@ -1203,6 +1261,15 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
|
||||
struct gpfs_winattr attrs;
|
||||
char *path = NULL;
|
||||
NTSTATUS status;
|
||||
struct gpfs_config_data *config;
|
||||
|
||||
SMB_VFS_HANDLE_GET_DATA(handle, config,
|
||||
struct gpfs_config_data,
|
||||
return -1);
|
||||
|
||||
if (!config->winattr) {
|
||||
return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
|
||||
}
|
||||
|
||||
status = get_full_smb_filename(talloc_tos(), fname, &path);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -1280,6 +1347,9 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
|
||||
config->syncio = lp_parm_bool(SNUM(handle->conn), "gpfs",
|
||||
"syncio", false);
|
||||
|
||||
config->winattr = lp_parm_bool(SNUM(handle->conn), "gpfs",
|
||||
"winattr", false);
|
||||
|
||||
SMB_VFS_HANDLE_SET_DATA(handle, config,
|
||||
NULL, struct gpfs_config_data,
|
||||
return -1);
|
||||
|
Loading…
Reference in New Issue
Block a user