VOP_READDIR (9)
Leading comments
Copyright (c) 1996 Doug Rabson All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in...
NAME
VOP_READDIR - read contents of a directorySYNOPSIS
In sys/param.h In sys/dirent.h In sys/vnode.h Ft int Fn VOP_READDIR struct vnode *vp struct uio *uio struct ucred *cred int *eofflag int *ncookies u_long **cookiesDESCRIPTION
Read directory entries.- Fa vp
- The vnode of the directory.
- Fa uio
- Where to read the directory contents.
- Fa cred
- The caller's credentials.
- Fa eofflag
- Return end of file status ( NULL if not wanted).
- Fa ncookies
- Number of directory cookies generated for NFS ( NULL if not wanted).
- Fa cookies
- Directory seek cookies generated for NFS ( NULL if not wanted).
The directory contents are read into Vt struct dirent structures. If the on-disc data structures differ from this then they should be translated.
LOCKS
The directory should be locked on entry and will still be locked on exit.RETURN VALUES
Zero is returned on success, otherwise an error code is returned.If this is called from the NFS server, the extra arguments Fa eofflag , Fa ncookies and Fa cookies are given. The value of Fa *eofflag should be set to TRUE if the end of the directory is reached while reading. The directory seek cookies are returned to the NFS client and may be used later to restart a directory read part way through the directory. There should be one cookie returned per directory entry. The value of the cookie should be the offset within the directory where the on-disc version of the appropriate directory entry starts. Memory for the cookies should be allocated using:
...; *ncookies = number of entries read; *cookies = malloc(*ncookies * sizeof(u_long), M_TEMP, M_WAITOK);
ERRORS
- Bq Er EINVAL
- An attempt was made to read from an illegal offset in the directory.
- Bq Er EIO
- A read error occurred while reading the directory.