Page MenuHomeFreeBSD

linux: implement statx(2)
ClosedPublic

Authored by trasz on May 26 2021, 12:11 PM.

Details

Summary

PR: 252106
Submitted By: pitwuu at gmail.com

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

trasz edited the summary of this revision. (Show Details)
emaste added inline comments.
sys/compat/linux/linux.h
216

Looks like Linux does not have (dropped?) _DIR, just `STATX_ATTR_AUTOMOUNT`

236

this is stx_attributes_mask

245
uint64_t stx_mnt_id
uint64_t spare
uint64_t spare[12]
sys/compat/linux/linux_stats.c
203

for what it's worth memset(&x, 0, sizeof(x)) is slightly more common in kernel now than bzero(&x, sizeof(x))

(Note to self: fails tinderbox, probably depends on https://reviews.freebsd.org/D30193)

sys/compat/linux/linux.h
216

Thanks! Somehow it didn't occur to me to compare the struct layout.

sys/compat/linux/linux_stats.c
203

for what it's worth memset(&x, 0, sizeof(x)) is slightly more common in kernel now than bzero(&x, sizeof(x))

In this file it's mostly bzero(), though. I think we should leave it as it is, for consistency.

Update the struct layout and defines.

Another attempt to fix build.

dchagin added inline comments.
sys/compat/linux/linux_stats.c
775

small optimisatio: may be mask alredy known flags? to see which is bit is unsupported?

sys/compat/linux/linux_stats.c
775

indeed a minor point, but the message reads as if it implies the printed flags are all unsupported so I think it makes sense to either mask the known flags or make the message something like "statx flags 0x%x includes unsupported flags"

sys/compat/linux/linux_stats.c
775

I like the idea of masking off the recognized flags, leaving just the unrecognized ones. However, I'd prefer to do it in a followup commit, as we have at least a dozen places which do that, and I think it's better to fix them together.

I like the idea of masking off the recognized flags ... in a followup commit

Sounds good to me

sys/compat/linux/linux_stats.c
775

agree, Im asking as glibc-2.32 statx test fails, unsupported flags are: 0x2000 and 0x4000

sys/compat/linux/linux_stats.c
775

For reference, those are AT_STATX_FORCE_SYNC (0x2000) and AT_STATX_DONT_SYNC (0x4000).

AT_STATX_FORCE_SYNC
       Force the attributes to be synchronized with the server.
       This may require that a network filesystem perform a data
       writeback to get the timestamps correct.

AT_STATX_DONT_SYNC
       Don't synchronize anything, but rather just take whatever
       the system has cached if possible.  This may mean that the
       information returned is approximate, but, on a network
       filesystem, it may not involve a round trip to the server
       - even if no lease is held.
This revision is now accepted and ready to land.Jun 2 2021, 3:54 PM
This revision now requires review to proceed.Jun 7 2021, 11:04 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 8 2021, 9:10 AM
Closed by commit R10:2362ad457a01: linux: implement statx(2) (authored by pitwuu_gmail.com, committed by trasz). · Explain Why
This revision was automatically updated to reflect the committed changes.