aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2023-04-28 08:54:59 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2023-06-29 08:15:29 +0000
commit815a433165a0406a88e70931db6a40e2e1e74c2e (patch)
tree564023020c3c3496c658861457c5574bf3c94073
parentc43f5eb2f4c7cbfde1873c9d0ece23e719ae312e (diff)
downloadsrc-815a433165a0406a88e70931db6a40e2e1e74c2e.tar.gz
src-815a433165a0406a88e70931db6a40e2e1e74c2e.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. (cherry picked from commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6)
-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)
{