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.

VNODEOPS (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> VNODEOPS (9)VOP_MKDIR(dvp , vpp , cnp , vap)Make anew directory in a given directory. The argument dvp is the locked vnode of the directoryto create the new directory in and cnp is the pathname component of the new directory. Theargument vap specifies the attributes that the new directory should be created with. If the file issuccessfully created, the address of the resulting locked vnode is returned in vpp and zero isreturned.This function is called after VOP_LOOKUP() when a directory is being created. Normally,VOP_LOOKUP() will have set the SAVE<strong>NAME</strong> flag in cnp->cn_flags to keep the memorypointed to by cnp->cn_pnbuf valid. If an error is detected when creating the directory, this memoryis released. If the directory is created successfully it will be released unless the SAVESTARTflags in specified in cnp->cn_flags.VOP_RMDIR(dvp , vp , cnp)Remove a directory in a given directory. The argument dvp is the locked vnode of the directoryto remove the directory from and vp is the locked vnode of the directory to remove. The argumentcnp is the pathname component of the directory. Zero is returned on success, otherwise anerror code is returned. Both dvp and vp should be locked on entry and will be released andunlocked on return.VOP_SYMLINK(dvp , vpp , cnp , vap , target)Create a symbolic link in a given directory. The argument dvp is the locked vnode of the directoryto create the symbolic link in and cnp is the pathname component of the symbolic link. Theargument vap specifies the attributes that the symbolic link should be created with and targetspecifies the pathname of the target of the symbolic link. If the symbolic link is successfully created,the address of the resulting locked vnode is returned in vpp and zero is returned.This function is called after VOP_LOOKUP() when a symbolic link is being created. Normally,VOP_LOOKUP() will have set the SAVE<strong>NAME</strong> flag in cnp->cn_flags to keep the memorypointed to by cnp->cn_pnbuf valid. If an error is detected when creating the symbolic link, thismemory is released. If the symbolic link is created successfully it will be released unless theSAVESTART flags in specified in cnp->cn_flags.VOP_READDIR(vp , uio , cred , eofflag , cookies , ncookies)Read directory entry. The argument vp is the vnode of the directory to read the contents of anduio is the destination location to read the contents into. The argument cred is the caller’s credentials.The argument eofflag is the pointer to a flag which is set by VOP_READDIR() toindicate an end-of-file condition. If eofflag is NULL, the end-of-file condition is not returned.The arguments cookies and ncookies specify the addresses for the list and number of directoryseek cookies generated for NFS. Both cookies and ncookies should be NULL if theyaren’t required to be returned by VOP_READDIR(). The directory contents are read into structdirent structures and uio->uio_offset is set to the offset of the next unread directory entry.This offset may be used in a following invocation to continue a sequential read of the directorycontents. If the operation is successful zero is returned, otherwise an appropriate error code isreturned.The directory should be locked on entry and will remain locked on return.In case ncookies and cookies are supplied, one cookie should be returned per directoryentry. The value of the cookie for each directory entry should be the offset within the directorywhere the on-disk version of the following directory entry starts. That is, for each directory entryi, the corresponding cookie should refer to the offset of directory entry i + 1.Note that the cookies array must be allocated by the callee using the M_TEMP malloc type ascallers of VOP_READDIR() must be able to free the allocation.<strong>NetBSD</strong> 3.0 January 19, 2008 10

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

Saved successfully!

Ooh no, something went wrong!