Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2023 08:57:09 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e9204c5c2c5c - main - linux(4): Move statx_copyout() close to linux_statx()
Message-ID:  <202304280857.33S8v9aF017926@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dchagin:

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

commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-04-28 08:54:59 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-04-28 08:54:59 +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.
---
 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)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304280857.33S8v9aF017926>