Get rid of calling Linux stat translation hook and specific to Linux
handling of non-node dirfd from kern_statat.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 45960 Build 42848: arc lint + arc unit
Event Timeline
Thnak you, but it looks like I was a little hasty, there are still a few problems here.
- Conversion of st_rdev , which is not hard to do without this hook.
- Conversion of st_dev. The point is that the standard file descriptors are not reopened for emulated process at exec or at chroot time (jails?) and they points to the devfs mounted to the /dev instead of /path/to/chroot/dev or compat.linux.emul_path/dev.
So st_dev (filled from f_fsid) returned by fstat() and stat() are differs.
I'm stiil ponders how to fix that.
unfortunatelly it is not possible to convert native struct stat
without a hook, propose to replace it by sysent method
Given the translate_vnhook_major_minor problem looks like what you really want is a dedicated Linux stat func.
This patch is just a bunch of churn which improves one bit (fewer args) at the expense of more memory accesses, which is questionable at best.
Hmm, usually we try to avoid of dedicated linux implementation, however I fully agree with you here. @kib, what are you think? Leave kern_statat() as is (with seven arguments), replace by sysent hook or replace by dedicated linuxulator method?
The more I look at it the more I'm confident this is the wrong way of going about it.
int linux_driver_get_major_minor(const char *node, int *major, int *minor) { [snip] sz = sizeof("pts/") - 1; if (strncmp(node, "pts/", sz) == 0 && node[sz] != '\0') {
and others of the sort.
I think devfs should have dedicated handlers for these to fill it up as needed, even possibly with a sysent func like sv_devfs_stat. Then by the time the buffer leaves VOP_STAT it is all sorted out.
Yeah, you are right, adding hook to devfs_getattr() solves all of current conversion problems. Till 14.0 I want to fix this crap ))
Block and character special nodes can exist on non-devfs type fs, and block nodes cannot exist on devfs. Moving the hook into devfs vop_stat limits the useful functionality.
Dedicated,
note that I have yet another linuxism for statat,
fd = open();
fstatat(fd, "", &st, 0) return ENOENT in Linux
sys/compat/linux/linux_stats.c | ||
---|---|---|
69 | Is flag in FreeBSD flags namespace, or does it contain Linux AT_ flags? |
sys/compat/linux/linux_stats.c | ||
---|---|---|
69 | flag is converted to the FreeBSD namespace by callers, I'd prefer to leave linux_kern_statat() close to the FreeBSD |
sys/compat/freebsd32/freebsd32_misc.c | ||
---|---|---|
2260 | If the line fits, I suggest unwrap this and most of the other kern_statat() instances. |