Received: from eggs.gnu.org ([2001:4830:134:3::10]:59182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxe8U-0002Br-Vy for qemu-devel@nongnu.org; Fri, 21 Oct 2016 14:01:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxe8R-00016Z-A2 for qemu-devel@nongnu.org; Fri, 21 Oct 2016 14:01:43 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:54286 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxe8Q-0000s7-VT for qemu-devel@nongnu.org; Fri, 21 Oct 2016 14:01:39 -0400 in-reply-to: <20161021170438.GA5306@kos.to> from: "Aleksandar Markovic" message-id: <4017-580a5800-5-6f7e6200@15470175> date: Fri, 21 Oct 2016 20:01:11 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] =?utf-8?b?Pz09P3V0Zi04P3E/IFtQQVRDSCB2NyAwNS8xMF0g?= =?utf-8?q?linux-user=3A_Add_support_for_ustat=28=29_syscall?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Riku Voipio Cc: laurent@vivier.eu, peter.maydell@linaro.org, petar.jovanovic@imgtec.com, miodrag.dinic@imgtec.com, aleksandar.rikalo@imgtec.com, aleksandar.markovic@imgtec.com, qemu-devel@nongnu.org Sure, thanks for all other efforts that you put regarding my patches. I may post another version in some time. There is no rush wrt 2.8 as fa= r as I am concerned. -------- Original Message -------- Subject: Re: [PATCH v7 05/10] linux-user: Add support for ustat() sysca= ll Date: Friday, October 21, 2016 19:04 CEST From: Riku Voipio To: Aleksandar Markovic CC: qemu-devel@nongnu.org, laurent@vivier.eu, peter.maydell@linaro.org,= petar.jovanovic@imgtec.com, miodrag.dinic@imgtec.com, aleksandar.rikal= o@imgtec.com, aleksandar.markovic@imgtec.com References: <20160922165712.79809-1-aleksandar.markovic@rt-rk.com> <201= 60922165712.79809-6-aleksandar.markovic@rt-rk.com> =C2=A0On Thu, Sep 22, 2016 at 06:56:54PM +0200, Aleksandar Markovic wro= te: > From: Aleksandar Markovic > > This patch implements Qemu user mode ustat() syscall support. > > Syscall ustat() returns information about a mounted filesystem. > > Its declaration is: > > int ustat(dev=5Ft 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 syscall= s. > It is based on invocation of host's ustat(), and its key part is in t= he > correspondent case segment of the main switch statement of the functi= on > do=5Fsyscall(), in file linux-user/syscalls.c. All necessary conversi= ons > of data structures from target to host and from host to target are > covered. Support for target=5Fustat is included. Sufficient support f= or > "-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 usta= t with calling statvfs or statfs. > Signed-off-by: Aleksandar Markovic > --- > linux-user/syscall.c | 23 +++++++++++++++++++++-- > linux-user/syscall=5Fdefs.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 =5F=5Fclone2(int (*fn)(void *), void *child=5Fs= tack=5Fbase, > #include > #include > #include > +#include > #include > #include > #include > @@ -8226,9 +8227,27 @@ abi=5Flong do=5Fsyscall(void *cpu=5Fenv, int n= um, abi=5Flong arg1, > ret =3D get=5Ferrno(chroot(p)); > unlock=5Fuser(p, arg1, 0); > break; > -#ifdef TARGET=5FNR=5Fustat > +#if defined(TARGET=5FNR=5Fustat) > case TARGET=5FNR=5Fustat: > - goto unimplemented; > + { > + struct ustat ust; > + > + ret =3D get=5Ferrno(ustat(arg1, &ust)); > + if (!is=5Ferror(ret)) { > + struct target=5Fustat *target=5Fust; > + > + if (!lock=5Fuser=5Fstruct(VERIFY=5FWRITE, target=5Fust, arg2, 0)) {= > + goto efault; > + } > + =5F=5Fput=5Fuser(ust.f=5Ftfree, &target=5Fust->f=5Ftfree); > + =5F=5Fput=5Fuser(ust.f=5Ftinode, &target=5Fust->f=5Ftinode); > + memcpy(target=5Fust->f=5Ffname, ust.f=5Ffname, 6); > + memcpy(target=5Fust->f=5Ffpack, ust.f=5Ffpack, 6); > + unlock=5Fuser=5Fstruct(target=5Fust, arg2, 1); > + } > + } > + break; > + > #endif > #ifdef TARGET=5FNR=5Fdup2 > case TARGET=5FNR=5Fdup2: > diff --git a/linux-user/syscall=5Fdefs.h b/linux-user/syscall=5Fdefs.= h > index e47a61a..2c183d1 100644 > --- a/linux-user/syscall=5Fdefs.h > +++ b/linux-user/syscall=5Fdefs.h > @@ -2164,6 +2164,12 @@ struct target=5Fstatfs64 { > }; > #endif > > +struct target=5Fustat { > + abi=5Fulong f=5Ftfree; > + abi=5Fint f=5Ftinode; > + char f=5Ffname[6]; > + char f=5Ffpack[6]; > +}; > > #define TARGET=5FF=5FDUPFD 0 /* dup */ > #define TARGET=5FF=5FGETFD 1 /* get close=5Fon=5Fexec */ > -- > 2.9.3 > =C2=A0