aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2023-04-28 08:54:59 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2023-04-28 08:54:59 +0000
commite9204c5c2c5c471ad2182ec6358a46be74c9ebb6 (patch)
tree2c2c808b68b4b178f96890c7afec1c9c20c55d76
parent6072eea0c375fc3ab0cf5bb494c75d1beac7b8ba (diff)
downloadsrc-e9204c5c2c5c471ad2182ec6358a46be74c9ebb6.tar.gz
src-e9204c5c2c5c471ad2182ec6358a46be74c9ebb6.zip
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.
-rw-r--r--sys/compat/linux/linux_stats.c67
1 files 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)
{