s3: VFS: default: Move vfswrap_fgetxattr() before the async versions.
authorJeremy Allison <jra@samba.org>
Wed, 14 Jul 2021 18:17:49 +0000 (11:17 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 15 Jul 2021 05:02:30 +0000 (05:02 +0000)
We want to re-use this and don't want to have to add forward
declarations.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14758

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_default.c

index 102938e332ef804fa46900203b09b5907859e646..e9bd247155643b7ac699aa4dbbacc10473c11de0 100644 (file)
@@ -3425,6 +3425,36 @@ static int vfswrap_sys_acl_delete_def_fd(vfs_handle_struct *handle,
  Extended attribute operations.
 *****************************************************************/
 
+static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle,
+                                struct files_struct *fsp,
+                                const char *name,
+                                void *value,
+                                size_t size)
+{
+       int fd = fsp_get_pathref_fd(fsp);
+
+       if (!fsp->fsp_flags.is_pathref) {
+               return fgetxattr(fd, name, value, size);
+       }
+
+       if (fsp->fsp_flags.have_proc_fds) {
+               const char *p = NULL;
+               char buf[PATH_MAX];
+
+               p = sys_proc_fd_path(fd, buf, sizeof(buf));
+               if (p == NULL) {
+                       return -1;
+               }
+
+               return getxattr(p, name, value, size);
+       }
+
+       /*
+        * This is no longer a handle based call.
+        */
+       return getxattr(fsp->fsp_name->base_name, name, value, size);
+}
+
 struct vfswrap_getxattrat_state {
        struct tevent_context *ev;
        files_struct *dir_fsp;
@@ -3742,36 +3772,6 @@ static ssize_t vfswrap_getxattrat_recv(struct tevent_req *req,
        return xattr_size;
 }
 
-static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle,
-                                struct files_struct *fsp,
-                                const char *name,
-                                void *value,
-                                size_t size)
-{
-       int fd = fsp_get_pathref_fd(fsp);
-
-       if (!fsp->fsp_flags.is_pathref) {
-               return fgetxattr(fd, name, value, size);
-       }
-
-       if (fsp->fsp_flags.have_proc_fds) {
-               const char *p = NULL;
-               char buf[PATH_MAX];
-
-               p = sys_proc_fd_path(fd, buf, sizeof(buf));
-               if (p == NULL) {
-                       return -1;
-               }
-
-               return getxattr(p, name, value, size);
-       }
-
-       /*
-        * This is no longer a handle based call.
-        */
-       return getxattr(fsp->fsp_name->base_name, name, value, size);
-}
-
 static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
 {
        int fd = fsp_get_pathref_fd(fsp);