summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-12-22 14:36:55 +0100
committerChristian Ambach <ambi@samba.org>2012-02-10 17:54:10 +0100
commit89a4f66826a2e614bd782dcaff72ea3650229142 (patch)
treedf2cd28016dcc8c9878a08b295008a9ddc6d00d6
parent2e95d8048b9e9c7025ddada7ede15494e6016ba9 (diff)
downloadsamba-89a4f66826a2e614bd782dcaff72ea3650229142.tar.gz
samba-89a4f66826a2e614bd782dcaff72ea3650229142.tar.bz2
samba-89a4f66826a2e614bd782dcaff72ea3650229142.zip
s3:vfs_gpfs: make "gpfs:winattr" a per share option
metze Signed-off-by: Christian Ambach <ambi@samba.org>
-rw-r--r--source3/modules/gpfs.c8
-rw-r--r--source3/modules/vfs_gpfs.c70
2 files changed, 73 insertions, 5 deletions
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index d73b94b75f..b31d9b0d53 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -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;
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 3dec6abfb2..0f084f8578 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -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);