RFC: New VOP to translate vnode to its component name

Dag-Erling Smørgrav des at des.no
Mon Dec 8 02:20:25 PST 2008


Joe Marcus Clarke <marcus at FreeBSD.org> writes:
> Here is a patch to HEAD, along with a man page, for VOP_CNP.  VOP_CNP
> translates a vnode to its component name.  It is currently called from
> vn_fullpath1() to traverse a vnode hierarchy when cache lookups for
> those vnodes fail.  I have currently implemented VOP_CNP for devfs and
> pseudofs.  Kostik has thoroughly reviewed the devfs implementation.  I
> only recently did the pseudofs implementation at his request.

I would prefer pidbuf[PFS_NAMLEN] to pidbuf[11], and you can avoid two
strlen()s by storing the return value from snprintf().  Also, defining
pidbuf at the start of the block instead of the start of the function is
a style(9) violation.  Other than that, the pseudofs part of the patch
has my approval.

BTW, snprintf(buf, buflen, "%d", i) is so common in the kernel that we
should consider adding some sort of itoa(9) to avoid the overhead of
snprintf(9).

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-arch mailing list