12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>NAME</strong>I (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> <strong>NAME</strong>I (9)};/∗∗ Arguments to lookup.∗/u_long cn_nameiop; /∗ namei operation ∗/u_long cn_flags; /∗ flags to namei ∗/kauth_cred_t cn_cred; /∗ credentials ∗//∗∗ Shared between lookup and commit routines.∗/char ∗cn_pnbuf; /∗ pathname buffer ∗/const char ∗cn_nameptr; /∗ pointer to looked up name ∗/long cn_namelen; /∗ length of looked up component ∗/u_long cn_hash; /∗ hash value of looked up name ∗/long cn_consume; /∗ chars to consume in lookup() ∗/} ni_cnd;The namei interface accesses vnode operations by passing arguments in the partially initialisedcomponentname structure ni_cnd. This structure describes the subset of information from the nameidatastructure that is passed through to the vnode operations. See vnodeops(9) for more information. Thedetails of the componentname structure are not absolutely necessary since the members are initialised by thehelper macro NDINIT(). It is useful to know the operations and flags as specified in vnodeops(9).The namei interface overloads ni_cnd.cn_flags with some additional flags. These flags should be specific tothe namei interface and ignored by vnode operations. However, due to the historic close relationshipbetween the namei interface and the vnode operations, these flags are sometimes used (and set) by vnodeoperations, particularly VOP_LOOKUP(). The additional flags are:NOCROSSMOUNTdo not cross mount pointsRDONLY lookup with read-only semanticsHASBUF caller has allocated pathname buffer ni_cnd.cn_pnbufSAVE<strong>NAME</strong> save pathname bufferSAVESTART save starting directoryISDOTDOT current pathname component is ..MAKEENTRY add entry to the name cacheISLASTCN this is last component of pathnameISSYMLINK symlink needs interpretationISWHITEOUT found whiteoutDOWHITEOUT do whiteoutsREQUIREDIR must be a directoryCREATEDIR trailing slashes are okPARAMASK mask of parameter descriptorsIf the caller of namei() sets the SAVE<strong>NAME</strong> flag, then it must free the buffer. If VOP_LOOKUP() sets theflag, then the buffer must be freed by either the commit routine or the VOP_ABORT() routine. The SAVES-TART flag is set only by the callers of namei(). It implies SAVE<strong>NAME</strong> plus the addition of saving the parentdirectory that contains the name in ni_startdir. Itallows repeated calls to lookup() for the name beingsought. The caller is responsible for releasing the buffer and for invoking vrele() on ni_startdir.All access to the namei interface must be in process context. Pathname lookups cannot be done in interruptcontext.<strong>NetBSD</strong> 3.0 December 28, 2007 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!