summaryrefslogtreecommitdiff
path: root/libdiskfs/dir-readdir.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-06-14 19:09:13 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-06-14 19:09:13 +0000
commit9aac30815b19e42281cfd2b13d04be876bd94cc5 (patch)
tree14b42e37bcfd9001b1402fe0fbca6bcd500b9b0b /libdiskfs/dir-readdir.c
parent7d0ad5a2b662a290f24205cce5af21dcac557392 (diff)
entered into RCS
Diffstat (limited to 'libdiskfs/dir-readdir.c')
-rw-r--r--libdiskfs/dir-readdir.c26
1 files changed, 17 insertions, 9 deletions
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;
}