[PATCH v2 28/46] statfs: Use statfs64 if arch does not have the statfs syscall

Markos Chandras markos.chandras at gmail.com
Wed Dec 5 14:07:34 UTC 2012


On 4 December 2012 12:46, Vineet Gupta <Vineet.Gupta1 at synopsys.com> wrote:
> Also AFAIKR the last time we discussed, we'd agreed to try and remove
> any 64 to 32 translation layer. So my no-legacy-syscalls uClibc 0.9.30.3
> (still work in progress) doesn't have a kernel_stat64 struct at all.
> I'll get back to you with my tentative patches in this regard.

Hi Vineet,

There are indeed many ways to solve this problem. What I have at this
point is the following layout

/libc/sysdeps/linux/common-no-legacy/bits/statfs.h

which includes a statfs and a statfs64 structure where the statfs
structure matches the layout of statfs64 but with 32-bit members and
padding.

Similarly, I have

/libc/sysdeps/linux/common-no-legacy/bits/stat.h

again, this file includes a stat structure and a sta64 structure where
the stat structure matches the layout of stat64 but with 32-bit
members and
padding.

Finally, there is the kernel_stat{64} problem. Right now, every
architecture defines its own kernel_stat{64} structures. However, new
architectures share the same stat structure
(include/uapi/asm-generic/stat.h). Moreover, kernel_stat and/or
kernel_stat64 are used internally in uClibc so I created a separate
file in

libc/sysdeps/linux/common-no-legacy/bits/kernel_stat.h which just
includes <sys/stat.h> and does the following

#define kernel_stat stat
#define kernel_stat64 stat64

Personally, I see no reason to redefine kernel_stat{64} structure with
a layout similar to stat/stat64.

With these changes, no 32->64 translation is required.

Any thoughts?

-- 
Regards,
Markos


More information about the uClibc mailing list