The branch, master has been updated
       via  4afda9e s3: Pass the aio_force operation through vfs_gpfs
       via  6405e34 s3: Ask GPFS for the IS_OFFLINE operation
       via  73ce3e1 s3: Announce HSM in the gpfs module
       via  cf7dac6 s3: Pass smb_filename through the set_offline vfs op
       via  c9d1e16 s3: Pass smb_filename through the is_offline vfs op
       via  48f6b4d s3: Fix operation names in vfs_full_audit.c
       via  dee53e0 s3: Print all flags in "smbclient allinfo"
      from  a5aecdf s4:torture/rap/rap.c - remove unused variable "i"

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4afda9ebf49f2dc63b98c38132ce636ecf92e938
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 06:55:28 2011 -0700

    s3: Pass the aio_force operation through vfs_gpfs
    
    Autobuild-User: Volker Lendecke <[email protected]>
    Autobuild-Date: Wed Mar  2 19:24:27 CET 2011 on sn-devel-104

commit 6405e341b9fac7f0adead9a65f86c8082c5059ae
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 06:50:19 2011 -0700

    s3: Ask GPFS for the IS_OFFLINE operation

commit 73ce3e156e52fdc42e8e16114ed2f436878ced05
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 07:18:46 2011 -0700

    s3: Announce HSM in the gpfs module

commit cf7dac6fbccca6667e5ed20b199e80701b8a6bd4
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 06:43:52 2011 -0700

    s3: Pass smb_filename through the set_offline vfs op

commit c9d1e16c2c6ab5ffebbab4bd82a4cda0bb860046
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 06:37:34 2011 -0700

    s3: Pass smb_filename through the is_offline vfs op

commit 48f6b4d6fc08fa0621734c1c677ef7ef92891754
Author: Volker Lendecke <[email protected]>
Date:   Fri Feb 25 06:28:30 2011 -0700

    s3: Fix operation names in vfs_full_audit.c

commit dee53e04ba1b0da27aa94c84842edf00d8da901e
Author: Volker Lendecke <[email protected]>
Date:   Wed Mar 2 09:55:31 2011 -0700

    s3: Print all flags in "smbclient allinfo"

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages-3/vfs_gpfs.8.xml      |   21 +++++++++++
 source3/client/client.c                 |   26 +++++++++++++-
 source3/include/vfs.h                   |   12 ++++--
 source3/include/vfs_macros.h            |   18 +++++-----
 source3/modules/vfs_default.c           |   18 ++++++++--
 source3/modules/vfs_full_audit.c        |   29 ++++++++++++++-
 source3/modules/vfs_gpfs.c              |   61 +++++++++++++++++++++++++++++++
 source3/modules/vfs_onefs_shadow_copy.c |    7 +++-
 source3/modules/vfs_tsmsm.c             |   24 +++++++++++--
 source3/smbd/dosmode.c                  |    4 +-
 source3/smbd/vfs.c                      |    9 +++--
 11 files changed, 199 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/vfs_gpfs.8.xml 
b/docs-xml/manpages-3/vfs_gpfs.8.xml
index 3372a95..5f89ffa 100644
--- a/docs-xml/manpages-3/vfs_gpfs.8.xml
+++ b/docs-xml/manpages-3/vfs_gpfs.8.xml
@@ -104,6 +104,27 @@
                </listitem>
 
                </varlistentry>
+
+               <varlistentry>
+
+               <term>gpfs:hsm = [ yes | no ]</term>
+               <listitem>
+               <para>
+               Enable/Disable announcing if this FS has HSM enabled.
+               </para>
+
+               <itemizedlist>
+               <listitem><para>
+               <command>no(default)</command> - Do not announce HSM.
+               </para></listitem>
+               <listitem><para>
+               <command>no</command> - Announce HSM.
+               </para></listitem>
+               </itemizedlist>
+               </listitem>
+
+               </varlistentry>
+
                <varlistentry>
 
                <term>gpfs:getrealfilename = [ yes | no ]</term>
diff --git a/source3/client/client.c b/source3/client/client.c
index c7dfaa1..e979f74 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1605,6 +1605,30 @@ static char *attr_str(TALLOC_CTX *mem_ctx, uint16_t mode)
        int i = 0;
 
        if (!(mode & FILE_ATTRIBUTE_NORMAL)) {
+               if (mode & FILE_ATTRIBUTE_ENCRYPTED) {
+                       attrs[i++] = 'E';
+               }
+               if (mode & FILE_ATTRIBUTE_NONINDEXED) {
+                       attrs[i++] = 'N';
+               }
+               if (mode & FILE_ATTRIBUTE_OFFLINE) {
+                       attrs[i++] = 'O';
+               }
+               if (mode & FILE_ATTRIBUTE_COMPRESSED) {
+                       attrs[i++] = 'C';
+               }
+               if (mode & FILE_ATTRIBUTE_REPARSE_POINT) {
+                       attrs[i++] = 'r';
+               }
+               if (mode & FILE_ATTRIBUTE_SPARSE) {
+                       attrs[i++] = 's';
+               }
+               if (mode & FILE_ATTRIBUTE_TEMPORARY) {
+                       attrs[i++] = 'T';
+               }
+               if (mode & FILE_ATTRIBUTE_NORMAL) {
+                       attrs[i++] = 'N';
+               }
                if (mode & FILE_ATTRIBUTE_READONLY) {
                        attrs[i++] = 'R';
                }
@@ -1672,7 +1696,7 @@ static int do_allinfo(const char *name)
        unix_timespec_to_nt_time(&tmp, c_time);
        d_printf("change_time:    %s\n", nt_time_string(talloc_tos(), tmp));
 
-       d_printf("attributes: %s\n", attr_str(talloc_tos(), mode));
+       d_printf("attributes: %s (%x)\n", attr_str(talloc_tos(), mode), mode);
 
        status = cli_qpathinfo_streams(cli, name, talloc_tos(), &num_streams,
                                       &streams);
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 7e5b87a..64820af 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -401,8 +401,11 @@ struct vfs_fn_pointers {
        bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct 
*fsp);
 
        /* 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);
+       bool (*is_offline)(struct vfs_handle_struct *handle,
+                          const struct smb_filename *fname,
+                          SMB_STRUCT_STAT *sbuf);
+       int (*set_offline)(struct vfs_handle_struct *handle,
+                          const struct smb_filename *fname);
 };
 
 /*
@@ -815,8 +818,9 @@ int smb_vfs_call_aio_suspend(struct vfs_handle_struct 
*handle,
 bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
                            struct files_struct *fsp);
 bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
-                            const char *path, SMB_STRUCT_STAT *sbuf);
+                            const struct smb_filename *fname,
+                            SMB_STRUCT_STAT *sbuf);
 int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
-                            const char *path);
+                            const struct smb_filename *fname);
 
 #endif /* _VFS_H */
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 7c26529..d04be9b 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -602,14 +602,14 @@
 #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) \
        smb_vfs_call_aio_force((handle)->next,(fsp))
 
-#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) \
-       smb_vfs_call_is_offline((conn)->vfs_handles,(path),(sbuf))
-#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) \
-       smb_vfs_call_is_offline((handle)->next,(path),(sbuf))
-
-#define SMB_VFS_SET_OFFLINE(conn,path) \
-       smb_vfs_call_set_offline((conn)->vfs_handles,(path))
-#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) \
-       smb_vfs_call_set_offline((handle)->next, (path))
+#define SMB_VFS_IS_OFFLINE(conn,fname,sbuf) \
+       smb_vfs_call_is_offline((conn)->vfs_handles,(fname),(sbuf))
+#define SMB_VFS_NEXT_IS_OFFLINE(handle,fname,sbuf) \
+       smb_vfs_call_is_offline((handle)->next,(fname),(sbuf))
+
+#define SMB_VFS_SET_OFFLINE(conn,fname) \
+       smb_vfs_call_set_offline((conn)->vfs_handles,(fname))
+#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
+       smb_vfs_call_set_offline((handle)->next, (fname))
 
 #endif /* _VFS_MACROS_H */
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5448db8..b7e70a6 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1607,9 +1607,14 @@ static bool vfswrap_aio_force(struct vfs_handle_struct 
*handle, struct files_str
        return false;
 }
 
-static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char 
*path, SMB_STRUCT_STAT *sbuf)
+static bool vfswrap_is_offline(struct vfs_handle_struct *handle,
+                              const struct smb_filename *fname,
+                              SMB_STRUCT_STAT *sbuf)
 {
-       if (ISDOT(path) || ISDOTDOT(path)) {
+       NTSTATUS status;
+       char *path;
+
+        if (ISDOT(fname->base_name) || ISDOTDOT(fname->base_name)) {
                return false;
        }
 
@@ -1620,10 +1625,17 @@ static bool vfswrap_is_offline(struct vfs_handle_struct 
*handle, const char *pat
                return false;
        }
 
+        status = get_full_smb_filename(talloc_tos(), fname, &path);
+        if (!NT_STATUS_IS_OK(status)) {
+                errno = map_errno_from_nt_status(status);
+                return false;
+        }
+
        return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0;
 }
 
-static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char 
*path)
+static int vfswrap_set_offline(struct vfs_handle_struct *handle,
+                              const struct smb_filename *fname)
 {
        /* We don't know how to set offline bit by default, needs to be 
overriden in the vfs modules */
 #if defined(ENOTSUP)
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 0ff05f4..303ffae 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -334,8 +334,8 @@ 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_LAST, NULL }
 };
 
@@ -2203,6 +2203,29 @@ static bool smb_full_audit_aio_force(struct 
vfs_handle_struct *handle,
        return result;
 }
 
+static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
+                                     const struct smb_filename *fname,
+                                     SMB_STRUCT_STAT *sbuf)
+{
+       bool result;
+
+       result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
+       do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s",
+              smb_fname_str_do_log(fname));
+       return result;
+}
+
+static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
+                                     const struct smb_filename *fname)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
+       do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
+              smb_fname_str_do_log(fname));
+       return result;
+}
+
 static struct vfs_fn_pointers vfs_full_audit_fns = {
 
        /* Disk operations */
@@ -2320,6 +2343,8 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .aio_fsync = smb_full_audit_aio_fsync,
        .aio_suspend = smb_full_audit_aio_suspend,
        .aio_force = smb_full_audit_aio_force,
+       .is_offline = smb_full_audit_is_offline,
+       .set_offline = smb_full_audit_set_offline,
 };
 
 NTSTATUS vfs_full_audit_init(void)
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index d36cdbe..e9257e6 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -34,6 +34,7 @@
 struct gpfs_config_data {
        bool sharemodes;
        bool leases;
+       bool hsm;
 };
 
 
@@ -1189,6 +1190,42 @@ static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, 
files_struct *fsp,
        return result;
 }
 
+static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
+                               const struct smb_filename *fname,
+                               SMB_STRUCT_STAT *sbuf)
+{
+       struct gpfs_winattr attrs;
+       char *path = NULL;
+       NTSTATUS status;
+       int ret;
+
+       status = get_full_smb_filename(talloc_tos(), fname, &path);
+       if (!NT_STATUS_IS_OK(status)) {
+               errno = map_errno_from_nt_status(status);
+               return -1;
+       }
+       ret = get_gpfs_winattrs(path, &attrs);
+
+       if (ret == -1) {
+               TALLOC_FREE(path);
+               return false;
+       }
+       if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) {
+               DEBUG(10, ("%s is offline\n", path));
+               TALLOC_FREE(path);
+               return true;
+       }
+       DEBUG(10, ("%s is online\n", path));
+       TALLOC_FREE(path);
+       return SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
+}
+
+static bool vfs_gpfs_aio_force(struct vfs_handle_struct *handle,
+                              struct files_struct *fsp)
+{
+       return vfs_gpfs_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
+}
+
 int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
                        const char *user)
 {
@@ -1211,6 +1248,9 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, 
const char *service,
        config->leases = lp_parm_bool(SNUM(handle->conn), "gpfs",
                                        "leases", true);
 
+       config->hsm = lp_parm_bool(SNUM(handle->conn), "gpfs",
+                                  "hsm", false);
+
        SMB_VFS_HANDLE_SET_DATA(handle, config,
                                NULL, struct syncops_config_data,
                                return -1);
@@ -1218,9 +1258,28 @@ int vfs_gpfs_connect(struct vfs_handle_struct *handle, 
const char *service,
        return 0;
 }
 
+static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle,
+                                     enum timestamp_set_resolution *p_ts_res)
+{
+       struct gpfs_config_data *config;
+       uint32_t next;
+
+       next = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
+
+       SMB_VFS_HANDLE_GET_DATA(handle, config,
+                               struct gpfs_config_data,
+                               return next);
+
+       if (config->hsm) {
+               next |= FILE_SUPPORTS_REMOTE_STORAGE;
+       }
+       return next;
+}
+
 
 static struct vfs_fn_pointers vfs_gpfs_fns = {
        .connect_fn = vfs_gpfs_connect,
+       .fs_capabilities = vfs_gpfs_capabilities,
        .kernel_flock = vfs_gpfs_kernel_flock,
         .linux_setlease = vfs_gpfs_setlease,
         .get_real_filename = vfs_gpfs_get_real_filename,
@@ -1241,6 +1300,8 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
         .fstat = vfs_gpfs_fstat,
         .lstat = vfs_gpfs_lstat,
        .ntimes = vfs_gpfs_ntimes,
+       .is_offline = vfs_gpfs_is_offline,
+       .aio_force = vfs_gpfs_aio_force,
        .ftruncate = vfs_gpfs_ftruncate
 };
 
diff --git a/source3/modules/vfs_onefs_shadow_copy.c 
b/source3/modules/vfs_onefs_shadow_copy.c
index bcc40f0..9011f6d 100644
--- a/source3/modules/vfs_onefs_shadow_copy.c
+++ b/source3/modules/vfs_onefs_shadow_copy.c
@@ -634,8 +634,10 @@ onefs_shadow_copy_lsetxattr(vfs_handle_struct *handle, 
const char *path,
 
 static bool
 onefs_shadow_copy_is_offline(struct vfs_handle_struct *handle,
-                            const char *path, SMB_STRUCT_STAT *sbuf)
+                            const struct smb_fname *fname,
+                            SMB_STRUCT_STAT *sbuf)
 {
+#error Isilon, please convert "char *path" to "struct smb_fname *fname"
        SHADOW_NEXT(IS_OFFLINE,
                    (handle, cpath ?: path, sbuf),
                    bool);
@@ -643,8 +645,9 @@ onefs_shadow_copy_is_offline(struct vfs_handle_struct 
*handle,
 
 static int
 onefs_shadow_copy_set_offline(struct vfs_handle_struct *handle,
-                             const char *path)
+                              const struct smb_filename *fname)
 {
+#error Isilon, please convert "char *path" to "struct smb_fname *fname"
        SHADOW_NEXT(SET_OFFLINE,
                    (handle, cpath ?: path),
                    int);
diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c
index 95c83de..6383891 100644
--- a/source3/modules/vfs_tsmsm.c
+++ b/source3/modules/vfs_tsmsm.c
@@ -146,8 +146,9 @@ static int tsmsm_connect(struct vfs_handle_struct *handle,
 }
 
 static bool tsmsm_is_offline(struct vfs_handle_struct *handle, 
-                           const char *path,
-                           SMB_STRUCT_STAT *stbuf) {
+                            const struct smb_filename *fname,
+                            SMB_STRUCT_STAT *stbuf)
+{
        struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
        const dm_sessid_t *dmsession_id;
        void *dmhandle = NULL;
@@ -158,6 +159,14 @@ static bool tsmsm_is_offline(struct vfs_handle_struct 
*handle,
        bool offline;
        char *buf = NULL;
        size_t buflen;
+       NTSTATUS status;
+       char *path;
+
+        status = get_full_smb_filename(talloc_tos(), fname, &path);
+        if (!NT_STATUS_IS_OK(status)) {
+                errno = map_errno_from_nt_status(status);
+                return false;
+        }
 
         /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available,
           then assume it is not offline (it may not be 100%, as it could be 
sparse) */
@@ -340,10 +349,13 @@ static ssize_t tsmsm_pwrite(struct vfs_handle_struct 
*handle, struct files_struc
 }
 
 static int tsmsm_set_offline(struct vfs_handle_struct *handle, 
-                            const char *path) {
+                             const struct smb_filename *fname)
+{
        struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data;
        int result = 0;
        char *command;
+       NTSTATUS status;
+       char *path;
 
        if (tsmd->hsmscript == NULL) {
                /* no script enabled */
@@ -351,6 +363,12 @@ static int tsmsm_set_offline(struct vfs_handle_struct 
*handle,
                return 0;
        }
 
+        status = get_full_smb_filename(talloc_tos(), fname, &path);
+        if (!NT_STATUS_IS_OK(status)) {
+                errno = map_errno_from_nt_status(status);
+                return false;
+        }
+
        /* Now, call the script */
        command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, 
path);
        if(!command) {
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index c0bf168..325a3c6 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -648,7 +648,7 @@ uint32 dos_mode(connection_struct *conn, struct 
smb_filename *smb_fname)
                }
        }
 
-       offline = SMB_VFS_IS_OFFLINE(conn, smb_fname->base_name, 
&smb_fname->st);
+       offline = SMB_VFS_IS_OFFLINE(conn, smb_fname, &smb_fname->st);
        if (S_ISREG(smb_fname->st.st_ex_mode) && offline) {
                result |= FILE_ATTRIBUTE_OFFLINE;
        }
@@ -719,7 +719,7 @@ int file_set_dosmode(connection_struct *conn, struct 
smb_filename *smb_fname,
 
        if (dosmode & FILE_ATTRIBUTE_OFFLINE) {
                if (!(old_mode & FILE_ATTRIBUTE_OFFLINE)) {
-                       lret = SMB_VFS_SET_OFFLINE(conn, smb_fname->base_name);
+                       lret = SMB_VFS_SET_OFFLINE(conn, smb_fname);
                        if (lret == -1) {
                                DEBUG(0, ("set_dos_mode: client has asked to "
                                          "set FILE_ATTRIBUTE_OFFLINE to "
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 40aaf6b..41d3650 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -2006,15 +2006,16 @@ bool smb_vfs_call_aio_force(struct vfs_handle_struct 
*handle,
 }
 
 bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
-                            const char *path, SMB_STRUCT_STAT *sbuf)
+                            const struct smb_filename *fname,
+                            SMB_STRUCT_STAT *sbuf)
 {
        VFS_FIND(is_offline);
-       return handle->fns->is_offline(handle, path, sbuf);
+       return handle->fns->is_offline(handle, fname, sbuf);
 }
 
 int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
-                            const char *path)
+                             const struct smb_filename *fname)
 {
        VFS_FIND(set_offline);
-       return handle->fns->set_offline(handle, path);
+       return handle->fns->set_offline(handle, fname);
 }


-- 
Samba Shared Repository

Reply via email to