git: 815a433165a0 - stable/13 - linux(4): Move statx_copyout() close to linux_statx()

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Thu, 29 Jun 2023 08:20:15 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=815a433165a0406a88e70931db6a40e2e1e74c2e

commit 815a433165a0406a88e70931db6a40e2e1e74c2e
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-04-28 08:54:59 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-06-29 08:15:29 +0000

    linux(4): Move statx_copyout() close to linux_statx()
    
    Just for future changes of the conditional Linuxulator build. We need
    a small refactoring of the MI code to help porting Linuxulator to other
    platforms.
    
    (cherry picked from commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6)
---
 sys/compat/linux/linux_stats.c | 67 +++++++++++++++++++++---------------------
 1 file changed, 34 insertions(+), 33 deletions(-)

diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 219f4a602eb4..04589c33547b 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -165,39 +165,6 @@ newstat_copyout(struct stat *buf, void *ubuf)
 	return (copyout(&tbuf, ubuf, sizeof(tbuf)));
 }
 
-static int
-statx_copyout(struct stat *buf, void *ubuf)
-{
-	struct l_statx tbuf;
-
-	bzero(&tbuf, sizeof(tbuf));
-	tbuf.stx_mask = STATX_ALL;
-	tbuf.stx_blksize = buf->st_blksize;
-	tbuf.stx_attributes = 0;
-	tbuf.stx_nlink = buf->st_nlink;
-	tbuf.stx_uid = buf->st_uid;
-	tbuf.stx_gid = buf->st_gid;
-	tbuf.stx_mode = buf->st_mode;
-	tbuf.stx_ino = buf->st_ino;
-	tbuf.stx_size = buf->st_size;
-	tbuf.stx_blocks = buf->st_blocks;
-
-	tbuf.stx_atime.tv_sec = buf->st_atim.tv_sec;
-	tbuf.stx_atime.tv_nsec = buf->st_atim.tv_nsec;
-	tbuf.stx_btime.tv_sec = buf->st_birthtim.tv_sec;
-	tbuf.stx_btime.tv_nsec = buf->st_birthtim.tv_nsec;
-	tbuf.stx_ctime.tv_sec = buf->st_ctim.tv_sec;
-	tbuf.stx_ctime.tv_nsec = buf->st_ctim.tv_nsec;
-	tbuf.stx_mtime.tv_sec = buf->st_mtim.tv_sec;
-	tbuf.stx_mtime.tv_nsec = buf->st_mtim.tv_nsec;
-
-	tbuf.stx_rdev_major = buf->st_rdev >> 8;
-	tbuf.stx_rdev_minor = buf->st_rdev & 0xff;
-	tbuf.stx_dev_major = buf->st_dev >> 8;
-	tbuf.stx_dev_minor = buf->st_dev & 0xff;
-
-	return (copyout(&tbuf, ubuf, sizeof(tbuf)));
-}
 
 #ifdef LINUX_LEGACY_SYSCALLS
 int
@@ -753,6 +720,40 @@ linux_syncfs(struct thread *td, struct linux_syncfs_args *args)
 	return (error);
 }
 
+static int
+statx_copyout(struct stat *buf, void *ubuf)
+{
+	struct l_statx tbuf;
+
+	bzero(&tbuf, sizeof(tbuf));
+	tbuf.stx_mask = STATX_ALL;
+	tbuf.stx_blksize = buf->st_blksize;
+	tbuf.stx_attributes = 0;
+	tbuf.stx_nlink = buf->st_nlink;
+	tbuf.stx_uid = buf->st_uid;
+	tbuf.stx_gid = buf->st_gid;
+	tbuf.stx_mode = buf->st_mode;
+	tbuf.stx_ino = buf->st_ino;
+	tbuf.stx_size = buf->st_size;
+	tbuf.stx_blocks = buf->st_blocks;
+
+	tbuf.stx_atime.tv_sec = buf->st_atim.tv_sec;
+	tbuf.stx_atime.tv_nsec = buf->st_atim.tv_nsec;
+	tbuf.stx_btime.tv_sec = buf->st_birthtim.tv_sec;
+	tbuf.stx_btime.tv_nsec = buf->st_birthtim.tv_nsec;
+	tbuf.stx_ctime.tv_sec = buf->st_ctim.tv_sec;
+	tbuf.stx_ctime.tv_nsec = buf->st_ctim.tv_nsec;
+	tbuf.stx_mtime.tv_sec = buf->st_mtim.tv_sec;
+	tbuf.stx_mtime.tv_nsec = buf->st_mtim.tv_nsec;
+
+	tbuf.stx_rdev_major = buf->st_rdev >> 8;
+	tbuf.stx_rdev_minor = buf->st_rdev & 0xff;
+	tbuf.stx_dev_major = buf->st_dev >> 8;
+	tbuf.stx_dev_minor = buf->st_dev & 0xff;
+
+	return (copyout(&tbuf, ubuf, sizeof(tbuf)));
+}
+
 int
 linux_statx(struct thread *td, struct linux_statx_args *args)
 {