[PATCH 03/13] riscv: compat: Add basic compat date type implementation

Guo Ren guoren at kernel.org
Sun Dec 26 07:33:36 PST 2021


On Wed, Dec 22, 2021 at 8:47 PM Arnd Bergmann <arnd at arndb.de> wrote:
>
> On Wed, Dec 22, 2021 at 1:03 PM Guo Ren <guoren at kernel.org> wrote:
> > On Wed, Dec 22, 2021 at 1:13 AM Arnd Bergmann <arnd at arndb.de> wrote:
> > > On Tue, Dec 21, 2021 at 5:35 PM <guoren at kernel.org> wrote:
> > >
> > > > +struct compat_stat {
> > > > +       compat_ulong_t  st_dev;
> > > > +       compat_ulong_t  st_ino;
> > > > +       compat_uint_t   st_mode;
> > > > +       compat_uint_t   st_nlink;
> > >
> > > You should not need a compat_stat, because native rv32 does not have a
> > > stat() syscall.
> > We need it:
> >
> > $ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
> > EXTRA_CFLAGS+=-g O=../build-riscv/ Image -j > /dev/null
> > /home/guoren/source/kernel/riscv-linux/fs/stat.c: In function 'cp_compat_stat':
> > /home/guoren/source/kernel/riscv-linux/fs/stat.c:645:21: error:
> > storage size of 'tmp' isn't known
> >   645 |  struct compat_stat tmp;
>
> I think that's just a bug in fs/stat.c. Every other architecture so
> far needed it,
> just not riscv, so we should add an appropriate #ifdef here. I would replace
> #ifdef CONFIG_COMPAT around these with __ARCH_WANT_COMPAT_STAT
> and then change all other compat architectures to define that depending
> on the configuration.
Agree, but I would keep compat_stat in the next version. You could add
__ARCH_WANT_COMPAT_STAT next.

>
>         Arnd



-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/



More information about the linux-riscv mailing list