1fab63cc4SDoug Rabson.\" -*- nroff -*- 2fab63cc4SDoug Rabson.\" 3fab63cc4SDoug Rabson.\" Copyright (c) 1996 Doug Rabson 4fab63cc4SDoug Rabson.\" 5fab63cc4SDoug Rabson.\" All rights reserved. 6fab63cc4SDoug Rabson.\" 7fab63cc4SDoug Rabson.\" This program is free software. 8fab63cc4SDoug Rabson.\" 9fab63cc4SDoug Rabson.\" Redistribution and use in source and binary forms, with or without 10fab63cc4SDoug Rabson.\" modification, are permitted provided that the following conditions 11fab63cc4SDoug Rabson.\" are met: 12fab63cc4SDoug Rabson.\" 1. Redistributions of source code must retain the above copyright 13fab63cc4SDoug Rabson.\" notice, this list of conditions and the following disclaimer. 14fab63cc4SDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright 15fab63cc4SDoug Rabson.\" notice, this list of conditions and the following disclaimer in the 16fab63cc4SDoug Rabson.\" documentation and/or other materials provided with the distribution. 17fab63cc4SDoug Rabson.\" 18fab63cc4SDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 19fab63cc4SDoug Rabson.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20fab63cc4SDoug Rabson.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21fab63cc4SDoug Rabson.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 22fab63cc4SDoug Rabson.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23fab63cc4SDoug Rabson.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24fab63cc4SDoug Rabson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25fab63cc4SDoug Rabson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26fab63cc4SDoug Rabson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27fab63cc4SDoug Rabson.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28fab63cc4SDoug Rabson.\" 29*b214fcceSAlan Somers.Dd December 13, 2021 30fab63cc4SDoug Rabson.Dt VOP_READDIR 9 31aa12cea2SUlrich Spörlein.Os 32fab63cc4SDoug Rabson.Sh NAME 33fab63cc4SDoug Rabson.Nm VOP_READDIR 34fab63cc4SDoug Rabson.Nd read contents of a directory 35fab63cc4SDoug Rabson.Sh SYNOPSIS 3632eef9aeSRuslan Ermilov.In sys/param.h 3732eef9aeSRuslan Ermilov.In sys/dirent.h 3832eef9aeSRuslan Ermilov.In sys/vnode.h 39fab63cc4SDoug Rabson.Ft int 40*b214fcceSAlan Somers.Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" "struct ucred *cred" "int *eofflag" "int *ncookies" "uint64_t **cookies" 41fab63cc4SDoug Rabson.Sh DESCRIPTION 42fab63cc4SDoug RabsonRead directory entries. 43fab63cc4SDoug Rabson.Bl -tag -width ncookies 440640e9e0SHiten Pandya.It Fa vp 450a57ea7dSRuslan ErmilovThe vnode of the directory. 460640e9e0SHiten Pandya.It Fa uio 470a57ea7dSRuslan ErmilovWhere to read the directory contents. 480640e9e0SHiten Pandya.It Fa cred 490a57ea7dSRuslan ErmilovThe caller's credentials. 500640e9e0SHiten Pandya.It Fa eofflag 510a57ea7dSRuslan ErmilovReturn end of file status 520a57ea7dSRuslan Ermilov.Dv ( NULL 530a57ea7dSRuslan Ermilovif not wanted). 540640e9e0SHiten Pandya.It Fa ncookies 550a57ea7dSRuslan ErmilovNumber of directory cookies generated for NFS 560a57ea7dSRuslan Ermilov.Dv ( NULL 570a57ea7dSRuslan Ermilovif not wanted). 580640e9e0SHiten Pandya.It Fa cookies 590a57ea7dSRuslan ErmilovDirectory seek cookies generated for NFS 600a57ea7dSRuslan Ermilov.Dv ( NULL 610a57ea7dSRuslan Ermilovif not wanted). 62fab63cc4SDoug Rabson.El 63fab63cc4SDoug RabsonThe directory contents are read into 640640e9e0SHiten Pandya.Vt struct dirent 65c1c03d49SHiten Pandyastructures. 66c1c03d49SHiten PandyaIf the on-disc data structures differ from this then they 67fab63cc4SDoug Rabsonshould be translated. 68fab63cc4SDoug Rabson.Sh LOCKS 69fab63cc4SDoug RabsonThe directory should be locked on entry and will still be locked on exit. 70fab63cc4SDoug Rabson.Sh RETURN VALUES 71fab63cc4SDoug RabsonZero is returned on success, otherwise an error code is returned. 72fab63cc4SDoug Rabson.Pp 73fab63cc4SDoug RabsonIf this is called from the NFS server, the extra arguments 74fab63cc4SDoug Rabson.Fa eofflag , 75fab63cc4SDoug Rabson.Fa ncookies 76fab63cc4SDoug Rabsonand 77fab63cc4SDoug Rabson.Fa cookies 78fab63cc4SDoug Rabsonare given. 79fab63cc4SDoug RabsonThe value of 80fab63cc4SDoug Rabson.Fa *eofflag 81fab63cc4SDoug Rabsonshould be set to TRUE if the end of the directory is reached while 82fab63cc4SDoug Rabsonreading. 83fab63cc4SDoug RabsonThe directory seek cookies are returned to the NFS client and may be used 84fab63cc4SDoug Rabsonlater to restart a directory read part way through the directory. 85c1c03d49SHiten PandyaThere should be one cookie returned per directory entry. 86c1c03d49SHiten PandyaThe value of 87fab63cc4SDoug Rabsonthe cookie should be the offset within the directory where the on-disc 88fab63cc4SDoug Rabsonversion of the appropriate directory entry starts. 89fab63cc4SDoug RabsonMemory for the cookies should be allocated using: 90fab63cc4SDoug Rabson.Bd -literal 91fab63cc4SDoug Rabson ...; 92fab63cc4SDoug Rabson *ncookies = number of entries read; 93*b214fcceSAlan Somers *cookies = malloc(*ncookies * sizeof(**cookies), M_TEMP, M_WAITOK); 94fab63cc4SDoug Rabson.Ed 95fab63cc4SDoug Rabson.Sh ERRORS 96eaa8b244SMike Pritchard.Bl -tag -width Er 97fab63cc4SDoug Rabson.It Bq Er EINVAL 9881f8d226SDon LewisAn attempt was made to read from an illegal offset in the directory. 99fab63cc4SDoug Rabson.It Bq Er EIO 100cc258457SDon LewisA read error occurred while reading the directory. 101e42b0964SJohn Baldwin.It Bq Er EINTEGRITY 102e42b0964SJohn BaldwinCorrupted data was detected while reading the directory. 103fab63cc4SDoug Rabson.El 104fab63cc4SDoug Rabson.Sh SEE ALSO 105fab63cc4SDoug Rabson.Xr vnode 9 106fab63cc4SDoug Rabson.Sh AUTHORS 107571dba6eSHiten PandyaThis manual page was written by 108aaf1f16eSPhilippe Charnier.An Doug Rabson . 109