From: Riku Voipio <riku.voipio@iki.fi>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
Cc: qemu-devel@nongnu.org, laurent@vivier.eu,
peter.maydell@linaro.org, petar.jovanovic@imgtec.com,
miodrag.dinic@imgtec.com, aleksandar.rikalo@imgtec.com,
aleksandar.markovic@imgtec.com
Subject: Re: [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall
Date: Fri, 21 Oct 2016 17:04:38 +0000 [thread overview]
Message-ID: <20161021170438.GA5306@kos.to> (raw)
In-Reply-To: <20160922165712.79809-6-aleksandar.markovic@rt-rk.com>
On Thu, Sep 22, 2016 at 06:56:54PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements Qemu user mode ustat() syscall support.
>
> Syscall ustat() returns information about a mounted filesystem.
>
> Its declaration is:
>
> int ustat(dev_t dev, struct ustat *ubuf);
>
> Its Linux kernel implementation is at fs/compat.c, line 334.
>
> The Qemu implementation proposed in this patch is similar to the
> Qemu implementations of statfs(), fstatfs() and other related syscalls.
> It is based on invocation of host's ustat(), and its key part is in the
> correspondent case segment of the main switch statement of the function
> do_syscall(), in file linux-user/syscalls.c. All necessary conversions
> of data structures from target to host and from host to target are
> covered. Support for target_ustat is included. Sufficient support for
> "-strace" option for this syscall is already present, and this patch
> does not change it.
>
> This patch also fixes failures of LTP tests ustat01, and ustat02, if
> executed on Qemu-emulated systems.
Had to drop this patch from my series. Not all platforms implement
ustat anymore. As Peter suggested, it is probably better implement ustat
with calling statvfs or statfs.
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/syscall.c | 23 +++++++++++++++++++++--
> linux-user/syscall_defs.h | 6 ++++++
> 2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 563796a..d28f3e6 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -48,6 +48,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
> #include <sys/shm.h>
> #include <sys/sem.h>
> #include <sys/statfs.h>
> +#include <ustat.h>
> #include <utime.h>
> #include <sys/sysinfo.h>
> #include <sys/signalfd.h>
> @@ -8226,9 +8227,27 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> ret = get_errno(chroot(p));
> unlock_user(p, arg1, 0);
> break;
> -#ifdef TARGET_NR_ustat
> +#if defined(TARGET_NR_ustat)
> case TARGET_NR_ustat:
> - goto unimplemented;
> + {
> + struct ustat ust;
> +
> + ret = get_errno(ustat(arg1, &ust));
> + if (!is_error(ret)) {
> + struct target_ustat *target_ust;
> +
> + if (!lock_user_struct(VERIFY_WRITE, target_ust, arg2, 0)) {
> + goto efault;
> + }
> + __put_user(ust.f_tfree, &target_ust->f_tfree);
> + __put_user(ust.f_tinode, &target_ust->f_tinode);
> + memcpy(target_ust->f_fname, ust.f_fname, 6);
> + memcpy(target_ust->f_fpack, ust.f_fpack, 6);
> + unlock_user_struct(target_ust, arg2, 1);
> + }
> + }
> + break;
> +
> #endif
> #ifdef TARGET_NR_dup2
> case TARGET_NR_dup2:
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index e47a61a..2c183d1 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2164,6 +2164,12 @@ struct target_statfs64 {
> };
> #endif
>
> +struct target_ustat {
> + abi_ulong f_tfree;
> + abi_int f_tinode;
> + char f_fname[6];
> + char f_fpack[6];
> +};
>
> #define TARGET_F_DUPFD 0 /* dup */
> #define TARGET_F_GETFD 1 /* get close_on_exec */
> --
> 2.9.3
>
next prev parent reply other threads:[~2016-10-21 17:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
2016-10-07 13:03 ` Riku Voipio
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
2016-10-07 13:06 ` Riku Voipio
2016-10-07 14:48 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
2016-10-21 17:04 ` Riku Voipio [this message]
2016-10-21 18:01 ` [Qemu-devel] ?==?utf-8?q? " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
2016-09-23 8:43 ` Aleksandar Markovic
2016-09-23 9:03 ` Laurent Vivier
2016-09-24 10:19 ` Riku Voipio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161021170438.GA5306@kos.to \
--to=riku.voipio@iki.fi \
--cc=aleksandar.markovic@imgtec.com \
--cc=aleksandar.markovic@rt-rk.com \
--cc=aleksandar.rikalo@imgtec.com \
--cc=laurent@vivier.eu \
--cc=miodrag.dinic@imgtec.com \
--cc=petar.jovanovic@imgtec.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.