Remove redundant parameter fd from SMB_VFS_CLOSE().
authorMichael Adam <obnox@samba.org>
Fri, 11 Jan 2008 13:19:28 +0000 (14:19 +0100)
committerMichael Adam <obnox@samba.org>
Sun, 20 Apr 2008 22:22:42 +0000 (00:22 +0200)
Now all those redundant fd's have vanished from the VFS API.

Michael
(This used to be commit 14294535512a7f191c5008e622b6708e417854ae)

13 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_audit.c
source3/modules/vfs_commit.c
source3/modules/vfs_default.c
source3/modules/vfs_extd_audit.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_streams_xattr.c
source3/modules/vfs_syncops.c
source3/smbd/open.c
source3/torture/cmd_vfs.c

index 4a6e6be42fd04b1c40ebd52a42cbf4a162af35e6..eb49f35c0428b61179ebd5f262a1fb99be99062e 100644 (file)
@@ -125,9 +125,9 @@ static int skel_open(vfs_handle_struct *handle,  const char *fname, files_struct
        return vfswrap_open(NULL,  fname, flags, mode);
 }
 
-static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_close(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return vfswrap_close(NULL, fsp, fd);
+       return vfswrap_close(NULL, fsp);
 }
 
 static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
index f4cb9b15ba2e048dfa7523e6c54ba707e1f03fc7..7102d4d4db123108c9d44ee74fbfab69c7efb0fc 100644 (file)
@@ -119,9 +119,9 @@ static int skel_open(vfs_handle_struct *handle,  const char *fname, files_struct
        return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
 }
 
-static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int skel_close(vfs_handle_struct *handle, files_struct *fsp)
 {
-       return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
 static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n)
index ca176aabb2b2f257d19ae384b970f09078db36d3..c8397164bc3e7cd47515b3ac26288b49cc35ff20 100644 (file)
 /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */
 /* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */
 /* Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl */
+/* Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox */
 
 #define SMB_VFS_INTERFACE_VERSION 22
 
@@ -301,7 +302,7 @@ struct vfs_ops {
                /* File operations */
 
                int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
-               int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd);
+               int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
                ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
                ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset);
                ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
index 1e64bd5ac3ef7ca8586c242322dc47b89c502857..f0a9809ecc6740088a6b179166c6b78019016a12 100644 (file)
@@ -48,7 +48,7 @@
 
 /* File operations */
 #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd)))
+#define SMB_VFS_CLOSE(fsp) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp)))
 #define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.read((fsp)->conn->vfs.handles.read, (fsp), (data), (n)))
 #define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_WRITE(fsp, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (data), (n)))
 
 /* File operations */
 #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd)))
+#define SMB_VFS_OPAQUE_CLOSE(fsp) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp)))
 #define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.read((fsp)->conn->vfs_opaque.handles.read, (fsp), (data), (n)))
 #define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_OPAQUE_WRITE(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (data), (n)))
 
 /* File operations */
 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode)))
-#define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd)))
+#define SMB_VFS_NEXT_CLOSE(handle, fsp) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp)))
 #define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.read((handle)->vfs_next.handles.read, (fsp), (data), (n)))
 #define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off)))
 #define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (data), (n)))
index cfb4ddf590775e3a333c680661201059199c5c58..4000580c428b93bf2535e40e2b2830410c9176ae 100644 (file)
@@ -34,7 +34,7 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam
 static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_rmdir(vfs_handle_struct *handle, const char *path);
 static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
-static int audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int audit_close(vfs_handle_struct *handle, files_struct *fsp);
 static int audit_rename(vfs_handle_struct *handle, const char *oldname, const char *newname);
 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);
@@ -202,14 +202,14 @@ static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct
        return result;
 }
 
-static int audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int audit_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
 
-       result = SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       result = SMB_VFS_NEXT_CLOSE(handle, fsp);
 
        syslog(audit_syslog_priority(handle), "close fd %d %s%s\n",
-              fd,
+              fsp->fh->fd,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : "");
 
index ac391cf00780f8461dc1bf7541063f3ef48166f1..1cef6d02433b1e6d5754fed896c1057a8a7d0a67 100644 (file)
@@ -265,12 +265,11 @@ static ssize_t commit_pwrite(
 
 static int commit_close(
         vfs_handle_struct * handle,
-        files_struct *      fsp,
-        int                 fd)
+        files_struct *      fsp)
 {
         /* Commit errors not checked, close() will find them again */
         commit_all(handle, fsp);
-        return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+        return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
 static int commit_ftruncate(
index a03f4dcef9ddad3f2c7540b8aa4f92eb47982b86..de801a20414263e1f01b66a6a49ba70552153cb2 100644 (file)
@@ -208,7 +208,7 @@ static int vfswrap_open(vfs_handle_struct *handle,  const char *fname,
        return result;
 }
 
-static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
 
index 926ec362596c1e030d253dcc1fb0f6f825f5c8ea..7516cba1d3f81e4eafce10cbe63f3b36eb6a6052 100644 (file)
@@ -37,7 +37,7 @@ static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fnam
 static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode);
 static int audit_rmdir(vfs_handle_struct *handle, const char *path);
 static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode);
-static int audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int audit_close(vfs_handle_struct *handle, files_struct *fsp);
 static int audit_rename(vfs_handle_struct *handle, const char *oldname, const char *newname);
 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);
@@ -224,18 +224,18 @@ static int audit_open(vfs_handle_struct *handle, const char *fname, files_struct
        return result;
 }
 
-static int audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int audit_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
        
-       result = SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       result = SMB_VFS_NEXT_CLOSE(handle, fsp);
 
        syslog(audit_syslog_priority(handle), "close fd %d %s%s\n",
-              fd,
+              fsp->fh->fd,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : "");
        DEBUG(2, ("vfs_extd_audit: close fd %d %s %s\n",
-              fd,
+              fsp->fh->fd,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : ""));
 
index 19218cc47d12a2edb69b40ea953d6bddd8cafe7e..2f8098de9b60aaceeb2105ec3ffa08b84cac4112 100644 (file)
@@ -111,7 +111,7 @@ static int smb_full_audit_closedir(vfs_handle_struct *handle,
                          SMB_STRUCT_DIR *dirp);
 static int smb_full_audit_open(vfs_handle_struct *handle,
                      const char *fname, files_struct *fsp, int flags, mode_t mode);
-static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp);
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
                          void *data, size_t n);
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
@@ -1083,11 +1083,11 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
        
-       result = SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       result = SMB_VFS_NEXT_CLOSE(handle, fsp);
 
        do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s", fsp->fsp_name);
 
index 766e7d10ab15acf45d8ffdbaa2fa72098dcd7e04..b74c4f7902e75382e5f61b022e2b5d8e1a4c6a5c 100644 (file)
@@ -345,7 +345,7 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
                 * BUGBUGBUG -- we would need to call fd_close_posix here, but
                 * we don't have a full fsp yet
                 */
-               SMB_VFS_CLOSE(fsp, hostfd);
+               SMB_VFS_CLOSE(fsp);
        }
 
        TALLOC_FREE(frame);
index 3aa89b40a68af1f78e87d3c2a23809c226108505..d3f786840053eee7b8ecc30103b13afa87f9df8c 100644 (file)
@@ -165,14 +165,14 @@ static int syncops_rmdir(vfs_handle_struct *handle,  const char *fname)
 }
 
 /* close needs to be handled specially */
-static int syncops_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int syncops_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        if (fsp->can_write && sync_onclose) {
                /* ideally we'd only do this if we have written some
                 data, but there is no flag for that in fsp yet. */
-               fsync(fd);
+               fsync(fsp->fh->fd);
        }
-       return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
 
index 7a13b3ae381a989853299bbc4f2a9c0f3b08cb16..0d1dd31cd60fc7f3659a93c44b4e31137ccda3fd 100644 (file)
@@ -81,7 +81,7 @@ NTSTATUS fd_close(files_struct *fsp)
                return NT_STATUS_OK; /* Shared handle. Only close last reference. */
        }
 
-       ret = SMB_VFS_CLOSE(fsp, fsp->fh->fd);
+       ret = SMB_VFS_CLOSE(fsp);
        fsp->fh->fd = -1;
        if (ret == -1) {
                return map_nt_error_from_unix(errno);
index 9359b585995cd009b01252469e5f5b40c166e93e..28400887ef720f4331a7f738ea419e4b7826cfa0 100644 (file)
@@ -355,7 +355,7 @@ static NTSTATUS cmd_close(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
                return NT_STATUS_OK;
        }
 
-       ret = SMB_VFS_CLOSE(vfs->files[fd], fd);
+       ret = SMB_VFS_CLOSE(vfs->files[fd]);
        if (ret == -1 )
                printf("close: error=%d (%s)\n", errno, strerror(errno));
        else