Remove redundant parameter fd from SMB_VFS_FCHMOD().
authorMichael Adam <obnox@samba.org>
Mon, 7 Jan 2008 12:44:37 +0000 (13:44 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 7 Jan 2008 14:59:02 +0000 (15:59 +0100)
Michael

12 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source/include/vfs.h
source/include/vfs_macros.h
source/modules/vfs_audit.c
source/modules/vfs_default.c
source/modules/vfs_extd_audit.c
source/modules/vfs_full_audit.c
source/modules/vfs_gpfs.c
source/smbd/dosmode.c
source/smbd/open.c
source/torture/cmd_vfs.c

index 361cf207d3d5c9ac85123f2b2ac5218dc8d9e131..ac3ee6bd23cd1961ab0e6aef022371fb28dc5808 100644 (file)
@@ -201,9 +201,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return vfswrap_chmod(NULL,  path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return vfswrap_fchmod(NULL, fsp, fd, mode);
+       return vfswrap_fchmod(NULL, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
index 72ca6f2056c038af691ec39a9e846f0a086db8a7..0cae379445487107edf10da35feef6f86cb38a74 100644 (file)
@@ -194,9 +194,9 @@ static int skel_chmod(vfs_handle_struct *handle,  const char *path, mode_t mode)
        return SMB_VFS_NEXT_CHMOD(handle, path, mode);
 }
 
-static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
-       return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
 static int skel_chown(vfs_handle_struct *handle,  const char *path, uid_t uid, gid_t gid)
index f4422e4fa96910ffd2023f77cf1724e91368593a..95e863b690445b0c4f4dd143241783e1c849c00c 100644 (file)
@@ -84,6 +84,7 @@
 /* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */
 /* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */
 /* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */
+/* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */
 
 
 #define SMB_VFS_INTERFACE_VERSION 22
@@ -288,7 +289,7 @@ struct vfs_ops {
                int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
                int (*unlink)(struct vfs_handle_struct *handle, const char *path);
                int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
-               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, mode_t mode);
+               int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
                int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
                int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
                int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
index 693d464f1085e5b0275dd434933c09df7f5823ee..74fb802f395246df563ad5579cc43506f3f47ded 100644 (file)
@@ -62,7 +62,7 @@
 #define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
 #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
-#define SMB_VFS_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid)))
 #define SMB_VFS_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (fd), (uid), (gid)))
 #define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
 #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
-#define SMB_VFS_OPAQUE_FCHMOD(fsp, fd, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid)))
 #define SMB_VFS_OPAQUE_FCHOWN(fsp, fd, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (fd), (uid), (gid)))
 #define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid)))
 #define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
 #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
 #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))
-#define SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (fd), (mode)))
+#define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode)))
 #define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid)))
 #define SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (fd), (uid), (gid)))
 #define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid)))
index 91993a47d72119b1382f318c153469e63b0bd6e1..27e7f998ab052b15545a3d62da458e9fb3fae082 100644 (file)
@@ -39,7 +39,7 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
 
 /* VFS operations */
@@ -268,11 +268,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index dd3f4ba2cdeca3b4ae725543684260c2d9823aa1..d296b5bd5b8512837a6c4aaaed5ef9a30150ca6a 100644 (file)
@@ -549,7 +549,7 @@ static int vfswrap_chmod(vfs_handle_struct *handle,  const char *path, mode_t mo
        return result;
 }
 
-static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
 
@@ -563,7 +563,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
 
        {
                int saved_errno = errno; /* We might get ENOSYS */
-               if ((result = SMB_VFS_FCHMOD_ACL(fsp, fd, mode)) == 0) {
+               if ((result = SMB_VFS_FCHMOD_ACL(fsp, fsp->fh->fd, mode)) == 0) {
                        END_PROFILE(syscall_fchmod);
                        return result;
                }
@@ -572,7 +572,7 @@ static int vfswrap_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
        }
 
 #if defined(HAVE_FCHMOD)
-       result = fchmod(fd, mode);
+       result = fchmod(fsp->fh->fd, mode);
 #else
        result = -1;
        errno = ENOSYS;
index 552c64016ea6445de62181f6ac5bdf119855b73a..f9b03731e7097c2b87cd8338d6ea9cd9db3181f6 100644 (file)
@@ -42,7 +42,7 @@ static int audit_rename(vfs_handle_struct *handle, const char *oldname, const ch
 static int audit_unlink(vfs_handle_struct *handle, const char *path);
 static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode);
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode);
 static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode);
 
 /* VFS operations */
@@ -310,11 +310,11 @@ static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t m
        return result;
 }
 
-static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n",
               fsp->fsp_name, mode,
index 7464bf80b305f563359754e123aa6c72f69987a8..fee65ba53f1dfbd48708194de0da4859795aa7cf 100644 (file)
@@ -144,7 +144,7 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle,
                        const char *path);
 static int smb_full_audit_chmod(vfs_handle_struct *handle,
                       const char *path, mode_t mode);
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode);
 static int smb_full_audit_chown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
@@ -1264,12 +1264,12 @@ static int smb_full_audit_chmod(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
                        mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+       result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 
        do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
               "%s|%o", fsp->fsp_name, mode);
index 500a6ee7722672697789d35c0122992656e025bd..832dcbfcad9e372071d2bdea67cd5b8a0d609fc8 100644 (file)
@@ -642,7 +642,7 @@ static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mo
                 return SMB_VFS_NEXT_CHMOD(handle, path, mode);
 }
 
-static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
+static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode)
 {
                 SMB_STRUCT_STAT st;
                 if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) {
@@ -652,7 +652,7 @@ static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd,
                 if ((st.st_mode & ~S_IFMT) == mode) {
                                 return 0;
                 }
-                return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
+                return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
 }
 
 /* VFS operations structure */
index a96f80ee0eb15fe5c7e37401ea5f549c25a0870a..d3813f9b41b0af24c85733dd7c2f1713f666b114 100644 (file)
@@ -538,7 +538,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
                if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
                        return -1;
                become_root();
-               ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode);
+               ret = SMB_VFS_FCHMOD(fsp, unixmode);
                unbecome_root();
                close_file_fchmod(fsp);
                if (!newfile) {
index d870374835659e8b581d52524e1af8dd29e7298e..c7b053d5313ad818b5b7d501613b03d9c4796a5a 100644 (file)
@@ -1915,7 +1915,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                }
 
                if ((ret == -1) &&
-                   (SMB_VFS_FCHMOD(fsp, fsp->fh->fd, new_unx_mode) == -1))
+                   (SMB_VFS_FCHMOD(fsp, new_unx_mode) == -1))
                        DEBUG(5, ("open_file_ntcreate: failed to reset "
                                  "attributes of file %s to 0%o\n",
                                  fname, (unsigned int)new_unx_mode));
index 7c8d070e067434ac9dc132af221b23263ec5295e..1a042ba3b077b220c0edf4b10bf7e1343e150c53 100644 (file)
@@ -706,7 +706,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       if (SMB_VFS_FCHMOD(vfs->files[fd], fd, mode) == -1) {
+       if (SMB_VFS_FCHMOD(vfs->files[fd], mode) == -1) {
                printf("fchmod: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }