-/* $OpenBSD: cd9660.c,v 1.2 1996/12/12 08:19:25 mickey Exp $ */
+/* $OpenBSD: cd9660.c,v 1.3 1997/02/16 14:39:38 mickey Exp $ */
/* $NetBSD: cd9660.c,v 1.1 1996/09/30 16:01:19 ws Exp $ */
/*
/* First find the volume descriptor */
buf = alloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
+ dp = (struct iso_directory_record *)buf;
vd = buf;
for (bno = 16;; bno++) {
twiddle();
/* Now bno has the start of the directory that supposedly contains the file */
bno--;
- dsize = 1; /* Something stupid, but > 0 XXX */
+ dsize = 1; /* Something stupid, but > 0 XXX */
for (psize = 0; psize < dsize;) {
if (!(psize % ISO_DEFAULT_BLOCK_SIZE)) {
bno++;
sb->st_size = fp->size;
return 0;
}
+
+/*
+ * Not implemented.
+ */
+#ifndef NO_READDIR
+int
+cd9660_readdir(f, name)
+ struct open_file *f;
+ char *name;
+{
+ return (EROFS);
+}
+#endif
+
+/* $OpenBSD: cd9660.h,v 1.2 1997/02/16 14:39:39 mickey Exp $ */
/* $NetBSD: cd9660.h,v 1.1 1996/09/30 16:01:20 ws Exp $ */
/*
size_t size, size_t *resid));
off_t cd9660_seek __P((struct open_file *f, off_t offset, int where));
int cd9660_stat __P((struct open_file *f, struct stat *sb));
+int cd9660_readdir __P((struct open_file *f, char *name));
-/* $OpenBSD: nfs.c,v 1.6 1996/12/08 15:15:52 niklas Exp $ */
+/* $OpenBSD: nfs.c,v 1.7 1997/02/16 14:39:39 mickey Exp $ */
/* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */
/*-
#include "nfsv2.h"
#include "stand.h"
+#include "saerrno.h"
#include "net.h"
#include "netif.h"
#include "nfs.h"
return (0);
}
+
+/*
+ * Not implemented.
+ */
+#ifndef NO_READDIR
+int
+nfs_readdir(f, name)
+ struct open_file *f;
+ char *name;
+{
+ return (EROFS);
+}
+#endif
-/* $OpenBSD: nullfs.c,v 1.2 1996/09/23 14:19:00 mickey Exp $ */
+/* $OpenBSD: nullfs.c,v 1.3 1997/02/16 14:39:38 mickey Exp $ */
/* $NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $ */
/*-
/*
* Null filesystem
*/
-int null_open (char *path, struct open_file *f)
+int
+null_open (char *path, struct open_file *f)
{
- errno = EIO;
- return -1;
+ return EIO;
}
-int null_close(struct open_file *f)
+int
+null_close(struct open_file *f)
{
return 0;
}
-ssize_t null_read (struct open_file *f, void *buf, size_t size, size_t *resid)
+int
+null_read (struct open_file *f, void *buf, size_t size, size_t *resid)
{
- errno = EIO;
- return -1;
+ return EIO;
}
-ssize_t null_write (struct open_file *f, void *buf, size_t size, size_t *resid)
+int
+null_write (struct open_file *f, void *buf, size_t size, size_t *resid)
{
- errno = EIO;
- return -1;
+ return EIO;
}
-off_t null_seek (struct open_file *f, off_t offset, int where)
+off_t
+null_seek (struct open_file *f, off_t offset, int where)
{
errno = EIO;
return -1;
}
-int null_stat (struct open_file *f, struct stat *sb)
+int
+null_stat (struct open_file *f, struct stat *sb)
{
- errno = EIO;
- return -1;
+ return EIO;
+}
+
+#ifndef NO_READDIR
+int
+null_readdir (struct open_file *f, char *name)
+{
+ return EIO;
}
+#endif
-/* $OpenBSD: ufs.c,v 1.8 1996/12/08 15:15:58 niklas Exp $ */
+/* $OpenBSD: ufs.c,v 1.9 1997/02/16 14:39:37 mickey Exp $ */
/* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */
/*-
return (0);
}
+#ifndef NO_READDIR
+int
+ufs_readdir(f, name)
+ struct open_file *f;
+ char *name;
+{
+ register struct file *fp = (struct file *)f->f_fsdata;
+ char *buf;
+ size_t buf_size;
+ register struct direct *dp, *edp;
+ int rc, namlen;
+
+ if (name == NULL)
+ fp->f_seekp = 0;
+ else {
+ /* end of dir */
+ if (fp->f_seekp >= fp->f_di.di_size) {
+ *name = '\0';
+ return 0;
+ }
+
+ do {
+ if ((rc = buf_read_file(f, &buf, &buf_size)) != 0)
+ return rc;
+
+ dp = (struct direct *)buf;
+ edp = (struct direct *)(buf + buf_size);
+ while (dp < edp && dp->d_ino == (ino_t)0)
+ dp = (struct direct *)((char *)dp + dp->d_reclen);
+ fp->f_seekp += buf_size -
+ ((u_int8_t *)edp - (u_int8_t *)dp);
+ } while (dp >= edp);
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+ if (fp->f_fs->fs_maxsymlinklen <= 0)
+ namlen = dp->d_type;
+ else
+#endif
+ namlen = dp->d_namlen;
+ strncpy(name, dp->d_name, namlen + 1);
+
+ fp->f_seekp += dp->d_reclen;
+ }
+
+ return 0;
+}
+#endif
+
#ifdef COMPAT_UFS
/*
* Sanity checks for old file systems.