Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
VOP_READDIR(9)		   Kernel Developer's Manual		VOP_READDIR(9)

NAME
       VOP_READDIR -- read contents of a directory

SYNOPSIS
       #include	<sys/param.h>
       #include	<sys/dirent.h>
       #include	<sys/vnode.h>

       int
       VOP_READDIR(struct  vnode  *vp,	struct	uio  *uio, struct ucred	*cred,
	   int *eofflag, int *ncookies,	uint64_t **cookies);

DESCRIPTION
       Read directory entries.

       vp	 The vnode of the directory.

       uio	 Where to read the directory contents.

       cred	 The caller's credentials.

       eofflag	 Return	end of file status (NULL if not	wanted).

       ncookies	 Number	of directory cookies generated for NFS	(NULL  if  not
		 wanted).

       cookies	 Directory  seek  cookies  generated  for  NFS	(NULL  if  not
		 wanted).
       The directory contents are read into struct dirent structures.  If  the
       on-disc	data  structures  differ  from this then they should be	trans-
       lated.

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 eofflag,
       ncookies	and cookies are	given.	The value of *eofflag should be	set to
       TRUE if the end of the directory	is reached while reading.  The	direc-
       tory  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 ver-
       sion of the appropriate directory entry starts.	Memory for the cookies
       should be allocated using:

	       ...;
	       *ncookies = number of entries read;
	       *cookies	= malloc(*ncookies * sizeof(**cookies),	M_TEMP,	M_WAITOK);

ERRORS
       [EINVAL]		  An attempt was made to read from an  illegal	offset
			  in the directory.

       [EIO]		  A read error occurred	while reading the directory.

       [EINTEGRITY]	  Corrupted data was detected while reading the	direc-
			  tory.

SEE ALSO
       vnode(9)

AUTHORS
       This manual page	was written by Doug Rabson.

FreeBSD	14.3		       December	13, 2021		VOP_READDIR(9)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=VOP_READDIR&sektion=9&manpath=FreeBSD+14.3-RELEASE+and+Ports>

home | help