From 9aac30815b19e42281cfd2b13d04be876bd94cc5 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Tue, 14 Jun 1994 19:09:13 +0000 Subject: entered into RCS --- libdiskfs/dir-readdir.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'libdiskfs/dir-readdir.c') diff --git a/libdiskfs/dir-readdir.c b/libdiskfs/dir-readdir.c index d13d76a3..c4a6dd12 100644 --- a/libdiskfs/dir-readdir.c +++ b/libdiskfs/dir-readdir.c @@ -21,24 +21,32 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "priv.h" #include "fs_S.h" -#include "io_S.h" kern_return_t diskfs_S_dir_readdir (struct protid *cred, char **data, u_int *datacnt, - off_t offset, - off_t *nextoffset, - int amt) + int entry, + int nentries, + vm_size_t bufsiz, + int *amt) { error_t err; + struct node *np; - if (offset == -1) - return EINVAL; + if (!cred) + return EOPNOTSUPP; - err = diskfs_S_io_read (cred, data, datacnt, offset, amt); - if (!err) - *nextoffset = offset + *datacnt; + np = cred->po->np; + mutex_lock (&np->lock); + if ((np->dn_stat.st_mode & S_IFMT) != S_IFDIR) + { + mutex_unlock (&np->lock); + return ENOTDIR; + } + + err = diskfs_get_directs (np, entry, nentries, data, datacnt, bufsiz, amt); + mutex_unlock (&np->lock); return err; } -- cgit v1.2.3