Changeset View
Standalone View
sys/kern/vfs_subr.c
Show First 20 Lines • Show All 3,951 Lines • ▼ Show 20 Lines | vn_printf(struct vnode *vp, const char *fmt, ...) | ||||
buf[0] = '\0'; | buf[0] = '\0'; | ||||
buf[1] = '\0'; | buf[1] = '\0'; | ||||
if (holdcnt & VHOLD_NO_SMR) | if (holdcnt & VHOLD_NO_SMR) | ||||
strlcat(buf, "|VHOLD_NO_SMR", sizeof(buf)); | strlcat(buf, "|VHOLD_NO_SMR", sizeof(buf)); | ||||
printf(" hold count flags (%s)\n", buf + 1); | printf(" hold count flags (%s)\n", buf + 1); | ||||
buf[0] = '\0'; | buf[0] = '\0'; | ||||
buf[1] = '\0'; | buf[1] = '\0'; | ||||
if (vp->v_irflag & VIRF_DOOMED) | if (vp->v_irflag & VIRF_DOOMED) | ||||
cem: We do have %b in printf(9) :-) | |||||
strlcat(buf, "|VIRF_DOOMED", sizeof(buf)); | strlcat(buf, "|VIRF_DOOMED", sizeof(buf)); | ||||
if (vp->v_irflag & VIRF_PGREAD) | if (vp->v_irflag & VIRF_PGREAD) | ||||
strlcat(buf, "|VIRF_PGREAD", sizeof(buf)); | strlcat(buf, "|VIRF_PGREAD", sizeof(buf)); | ||||
flags = vp->v_irflag & ~(VIRF_DOOMED | VIRF_PGREAD); | if (vp->v_irflag & VIRF_ISDISK) | ||||
strlcat(buf, "|VIRF_ISDISK", sizeof(buf)); | |||||
flags = vp->v_irflag & ~(VIRF_DOOMED | VIRF_PGREAD | VIRF_ISDISK); | |||||
if (flags != 0) { | if (flags != 0) { | ||||
snprintf(buf2, sizeof(buf2), "|VIRF(0x%lx)", flags); | snprintf(buf2, sizeof(buf2), "|VIRF(0x%lx)", flags); | ||||
strlcat(buf, buf2, sizeof(buf)); | strlcat(buf, buf2, sizeof(buf)); | ||||
} | } | ||||
if (vp->v_vflag & VV_ROOT) | if (vp->v_vflag & VV_ROOT) | ||||
strlcat(buf, "|VV_ROOT", sizeof(buf)); | strlcat(buf, "|VV_ROOT", sizeof(buf)); | ||||
if (vp->v_vflag & VV_ISTTY) | if (vp->v_vflag & VV_ISTTY) | ||||
strlcat(buf, "|VV_ISTTY", sizeof(buf)); | strlcat(buf, "|VV_ISTTY", sizeof(buf)); | ||||
▲ Show 20 Lines • Show All 1,020 Lines • ▼ Show 20 Lines | vn_isdisk_error(struct vnode *vp, int *errp) | ||||
else if (vp->v_rdev->si_devsw == NULL) | else if (vp->v_rdev->si_devsw == NULL) | ||||
error = ENXIO; | error = ENXIO; | ||||
else if (!(vp->v_rdev->si_devsw->d_flags & D_DISK)) | else if (!(vp->v_rdev->si_devsw->d_flags & D_DISK)) | ||||
error = ENOTBLK; | error = ENOTBLK; | ||||
dev_unlock(); | dev_unlock(); | ||||
out: | out: | ||||
*errp = error; | *errp = error; | ||||
return (error == 0); | return (error == 0); | ||||
} | |||||
bool | |||||
vn_isdisk(struct vnode *vp) | |||||
kibUnsubmitted Not Done Inline ActionsIs this diff against FreeBSD ? kib: Is this diff against FreeBSD ? | |||||
cemUnsubmitted Not Done Inline Actionscem: https://svnweb.freebsd.org/changeset/base/364372 I guess | |||||
kibUnsubmitted Not Done Inline ActionsI do not like it quite. I think that old name vn_is_disk() should retain the current semantic, then you can add e.g. macro VP_IS_DISK() or VN_IS_DISK() which checks VIRF_DISK, an convert specific consumers. kib: I do not like it quite. I think that old name vn_is_disk() should retain the current semantic… | |||||
mjgAuthorUnsubmitted Done Inline ActionsNote the above commit does not change anything in terms of semantics so there is no rush. I don't think capitalized name is a solution either. Perhaps something denoting that the return value can only be trusted to the extent that the vnode was pointing to an actual disk would work, but I don't have a good name for it. If anything, I had a name the other way: vn_isdisk is the possibly stale state while vn_isdisk_exact performs all the checks. mjg: Note the above commit does not change anything in terms of semantics so there is no rush.
I… | |||||
kibUnsubmitted Not Done Inline ActionsThen why did you committed the _error() churn ? Capitalizing the name is in line with it being a macro. But if you want to look at the semantic aspect, current vn_isdisk really takes a lot of efforts to check current state of cdevsw, which is the reason for it taking the dev_mtx. So might be vn_isdisk() could be the fine name for cheap vnode flag checker indeed, while current vn_isdisk(_error) be something like vn_iscdevdisk or vn_cdev_disk(). kib: Then why did you committed the _error() churn ?
Capitalizing the name is in line with it being… | |||||
mjgAuthorUnsubmitted Done Inline ActionsMaybe I did not express myself properly. I only protest vn_isdisk vs VN_IS_DISK as it would be quite unclear which is which and why this way and not the other. I figred vn_isdisk_error is a good enough name, but if that's a problem here is another one: vn_isdisk_exact. I have no opinion about vn_cdev_disk or vn_iscdevdisk and I'm happy to update the patch with any of them. mjg: Maybe I did not express myself properly. I only protest vn_isdisk vs VN_IS_DISK as it would be… | |||||
kibUnsubmitted Not Done Inline ActionsI think I expressed my opinion clear before. I believe that vn_isdisk_error() is bad name, something with cdev or cdevsw in the name is much better. I would not need to look into the implementation to remember that it references cdev. Then VIRF-function can be added, and convertion happens piece-by-piece. I remember that I reviewed some chunks, but already forgot which. kib: I think I expressed my opinion clear before. I believe that vn_isdisk_error() is bad name… | |||||
{ | |||||
int error; | |||||
return (vn_isdisk_error(vp, &error)); | |||||
} | } | ||||
/* | /* | ||||
* VOP_FPLOOKUP_VEXEC routines are subject to special circumstances, see | * VOP_FPLOOKUP_VEXEC routines are subject to special circumstances, see | ||||
* the comment above cache_fplookup for details. | * the comment above cache_fplookup for details. | ||||
* | * | ||||
* We never deny as priv_check_cred calls are not yet supported, see vaccess. | * We never deny as priv_check_cred calls are not yet supported, see vaccess. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1,663 Lines • Show Last 20 Lines |
We do have %b in printf(9) :-)