summaryrefslogtreecommitdiff
path: root/sys/isofs/cd9660
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 17:35:02 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 17:35:02 +0000
commit296a80d1ada7fc32000122b7bcbdcacf115d8c9f (patch)
tree1e40bb57a2c9f15cadada6f5ee64e421474c19ee /sys/isofs/cd9660
parent0edbe965a3d0f38e2719da8037b9e26a8f92b500 (diff)
CD filesystems don't do inode numbers >2^32, so use a smaller type internally,
only using ino_t in the VFS layer APIs: vget, readdir, getattr. ok matthew@
Diffstat (limited to 'sys/isofs/cd9660')
-rw-r--r--sys/isofs/cd9660/cd9660_extern.h14
-rw-r--r--sys/isofs/cd9660/cd9660_lookup.c4
-rw-r--r--sys/isofs/cd9660/cd9660_node.c10
-rw-r--r--sys/isofs/cd9660/cd9660_node.h17
-rw-r--r--sys/isofs/cd9660/cd9660_rrip.c4
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c10
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c12
-rw-r--r--sys/isofs/cd9660/iso.h4
-rw-r--r--sys/isofs/cd9660/iso_rrip.h6
9 files changed, 44 insertions, 37 deletions
diff --git a/sys/isofs/cd9660/cd9660_extern.h b/sys/isofs/cd9660/cd9660_extern.h
index 6f92600f12b..952c7b1f643 100644
--- a/sys/isofs/cd9660/cd9660_extern.h
+++ b/sys/isofs/cd9660/cd9660_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_extern.h,v 1.11 2010/12/21 20:14:43 thib Exp $ */
+/* $OpenBSD: cd9660_extern.h,v 1.12 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_extern.h,v 1.1 1997/01/24 00:24:53 cgd Exp $ */
/*-
@@ -105,7 +105,11 @@ extern struct vops cd9660_specvops;
extern struct vops cd9660_fifovops;
#endif
-int isochar(const u_char *, const u_char *, int, u_char *);
-int isofncmp(const u_char *, int, const u_char *, int, int);
-void isofntrans(u_char *, int, u_char *, u_short *, int, int, int);
-ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
+int isochar(const u_char *, const u_char *, int, u_char *);
+int isofncmp(const u_char *, int, const u_char *, int, int);
+void isofntrans(u_char *, int, u_char *, u_short *, int, int, int);
+cdino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
+#ifdef ISODEVMAP
+struct iso_dnode *iso_dmap(dev_t, cdino_t, int);
+void iso_dunmap(dev_t);
+#endif
diff --git a/sys/isofs/cd9660/cd9660_lookup.c b/sys/isofs/cd9660/cd9660_lookup.c
index fc4ce856721..af407a65825 100644
--- a/sys/isofs/cd9660/cd9660_lookup.c
+++ b/sys/isofs/cd9660/cd9660_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_lookup.c,v 1.18 2011/07/04 04:30:41 tedu Exp $ */
+/* $OpenBSD: cd9660_lookup.c,v 1.19 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_lookup.c,v 1.18 1997/05/08 16:19:59 mycroft Exp $ */
/*-
@@ -111,7 +111,7 @@ cd9660_lookup(v)
u_long bmask; /* block offset mask */
int lockparent; /* 1 => lockparent flag is set */
int error;
- ino_t ino = 0;
+ cdino_t ino = 0;
int reclen;
u_short namelen;
char *altname;
diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c
index 6184ca617df..75bbe6d69f5 100644
--- a/sys/isofs/cd9660/cd9660_node.c
+++ b/sys/isofs/cd9660/cd9660_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_node.c,v 1.21 2010/04/23 19:40:28 oga Exp $ */
+/* $OpenBSD: cd9660_node.c,v 1.22 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_node.c,v 1.17 1997/05/05 07:13:57 mycroft Exp $ */
/*-
@@ -93,7 +93,7 @@ cd9660_init(vfsp)
struct iso_dnode *
iso_dmap(device, inum, create)
dev_t device;
- ino_t inum;
+ cdino_t inum;
int create;
{
register struct iso_dnode **dpp, *dp, *dq;
@@ -149,7 +149,7 @@ iso_dunmap(device)
struct vnode *
cd9660_ihashget(dev, inum)
dev_t dev;
- ino_t inum;
+ cdino_t inum;
{
struct proc *p = curproc; /* XXX */
struct iso_node *ip;
@@ -482,12 +482,12 @@ cd9660_tstamp_conv17(pi,pu)
return (cd9660_tstamp_conv7(buf,pu));
}
-ino_t
+cdino_t
isodirino(isodir, imp)
struct iso_directory_record *isodir;
struct iso_mnt *imp;
{
- ino_t ino;
+ cdino_t ino;
ino = (isonum_733(isodir->extent) +
isonum_711(isodir->ext_attr_length)) << imp->im_bshift;
diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h
index ee4bca7d144..2a0a9e44f4c 100644
--- a/sys/isofs/cd9660/cd9660_node.h
+++ b/sys/isofs/cd9660/cd9660_node.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_node.h,v 1.17 2004/10/04 23:37:37 millert Exp $ */
+/* $OpenBSD: cd9660_node.h,v 1.18 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_node.h,v 1.15 1997/04/11 21:52:01 kleink Exp $ */
/*-
@@ -59,7 +59,7 @@ typedef struct {
struct iso_dnode {
struct iso_dnode *d_next, **d_prev; /* hash chain */
dev_t i_dev; /* device where dnode resides */
- ino_t i_number; /* the identity of the inode */
+ cdino_t i_number; /* the identity of the inode */
dev_t d_dev; /* device # for translation */
};
#endif
@@ -70,14 +70,14 @@ struct iso_node {
struct vnode *i_devvp; /* vnode for block I/O */
u_int i_flag; /* see below */
dev_t i_dev; /* device where inode resides */
- ino_t i_number; /* the identity of the inode */
+ cdino_t i_number; /* the identity of the inode */
/* we use the actual starting block of the file */
struct iso_mnt *i_mnt; /* filesystem associated with this inode */
struct lockf *i_lockf; /* head of byte-level lock list */
doff_t i_endoff; /* end of useful stuff in directory */
doff_t i_diroff; /* offset in dir, where we found last entry */
doff_t i_offset; /* offset of free space in directory */
- ino_t i_ino; /* inode number of found directory */
+ cdino_t i_ino; /* inode number of found directory */
struct lock i_lock; /* node lock */
doff_t iso_extent; /* extent of file */
@@ -136,15 +136,10 @@ void cd9660_defattr(struct iso_directory_record *, struct iso_node *,
struct buf *);
void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *,
struct buf *);
-struct vnode *cd9660_ihashget(dev_t, ino_t);
+struct vnode *cd9660_ihashget(dev_t, cdino_t);
int cd9660_ihashins(struct iso_node *);
void cd9660_ihashrem(struct iso_node *);
int cd9660_tstamp_conv7(u_char *, struct timespec *);
int cd9660_tstamp_conv17(u_char *, struct timespec *);
-int cd9660_vget_internal(struct mount *, ino_t, struct vnode **, int,
+int cd9660_vget_internal(struct mount *, cdino_t, struct vnode **, int,
struct iso_directory_record *);
-ino_t isodirino(struct iso_directory_record *, struct iso_mnt *);
-#ifdef ISODEVMAP
-struct iso_dnode *iso_dmap(dev_t, ino_t, int);
-void iso_dunmap(dev_t);
-#endif
diff --git a/sys/isofs/cd9660/cd9660_rrip.c b/sys/isofs/cd9660/cd9660_rrip.c
index fdf2a18b54e..75240e24d34 100644
--- a/sys/isofs/cd9660/cd9660_rrip.c
+++ b/sys/isofs/cd9660/cd9660_rrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_rrip.c,v 1.10 2011/07/04 04:30:41 tedu Exp $ */
+/* $OpenBSD: cd9660_rrip.c,v 1.11 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_rrip.c,v 1.17 1997/01/24 00:27:32 cgd Exp $ */
/*-
@@ -675,7 +675,7 @@ cd9660_rrip_getname(isodir, outbuf, outlen, inump, imp)
struct iso_directory_record *isodir;
char *outbuf;
u_short *outlen;
- ino_t *inump;
+ cdino_t *inump;
struct iso_mnt *imp;
{
ISO_RRIP_ANALYZE analyze;
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index cb212070262..8b6f0e25bd6 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_vfsops.c,v 1.62 2013/04/15 15:32:19 jsing Exp $ */
+/* $OpenBSD: cd9660_vfsops.c,v 1.63 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */
/*-
@@ -614,7 +614,7 @@ cd9660_root(mp, vpp)
struct iso_mnt *imp = VFSTOISOFS(mp);
struct iso_directory_record *dp =
(struct iso_directory_record *)imp->root;
- ino_t ino = isodirino(dp, imp);
+ cdino_t ino = isodirino(dp, imp);
/*
* With RRIP we must use the `.' entry of the root directory.
@@ -736,6 +736,10 @@ cd9660_vget(mp, ino, vpp)
struct vnode **vpp;
{
+ if (ino > (cdino_t)-1)
+ panic("cd9660_vget: alien ino_t %llu",
+ (unsigned long long)ino);
+
/*
* XXXX
* It would be nice if we didn't always set the `relocated' flag
@@ -754,7 +758,7 @@ cd9660_vget(mp, ino, vpp)
int
cd9660_vget_internal(mp, ino, vpp, relocated, isodir)
struct mount *mp;
- ino_t ino;
+ cdino_t ino;
struct vnode **vpp;
int relocated;
struct iso_directory_record *isodir;
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 90351762669..1234eeffb53 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_vnops.c,v 1.59 2013/03/28 03:29:44 guenther Exp $ */
+/* $OpenBSD: cd9660_vnops.c,v 1.60 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */
/*-
@@ -493,6 +493,7 @@ cd9660_readdir(void *v)
u_short namelen;
int ncookies = 0;
u_long *cookies = NULL;
+ cdino_t ino;
dp = VTOI(vdp);
imp = dp->i_mnt;
@@ -579,22 +580,23 @@ cd9660_readdir(void *v)
}
if (isonum_711(ep->flags)&2)
- idp->current.d_fileno = isodirino(ep, imp);
+ ino = isodirino(ep, imp);
else
- idp->current.d_fileno = dbtob(bp->b_blkno) +
- entryoffsetinblock;
+ ino = dbtob(bp->b_blkno) + entryoffsetinblock;
idp->curroff += reclen;
switch (imp->iso_ftype) {
case ISO_FTYPE_RRIP:
cd9660_rrip_getname(ep,idp->current.d_name, &namelen,
- &idp->current.d_fileno,imp);
+ &ino, imp);
+ idp->current.d_fileno = ino;
idp->current.d_namlen = (u_char)namelen;
if (idp->current.d_namlen)
error = iso_uiodir(idp,&idp->current,idp->curroff);
break;
default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
+ idp->current.d_fileno = ino;
strlcpy(idp->current.d_name,"..",
sizeof idp->current.d_name);
if (idp->current.d_namlen == 1 && ep->name[0] == 0) {
diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h
index 2753905c9a7..81c844815a7 100644
--- a/sys/isofs/cd9660/iso.h
+++ b/sys/isofs/cd9660/iso.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso.h,v 1.14 2005/09/28 20:53:54 miod Exp $ */
+/* $OpenBSD: iso.h,v 1.15 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: iso.h,v 1.20 1997/07/07 22:45:34 cgd Exp $ */
/*-
@@ -43,6 +43,8 @@
* structures.
*/
+typedef uint32_t cdino_t;
+
#define ISODCL(from, to) (to - from + 1)
struct iso_volume_descriptor {
diff --git a/sys/isofs/cd9660/iso_rrip.h b/sys/isofs/cd9660/iso_rrip.h
index 108eb69f5b4..b1f25c02ac8 100644
--- a/sys/isofs/cd9660/iso_rrip.h
+++ b/sys/isofs/cd9660/iso_rrip.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso_rrip.h,v 1.5 2007/06/06 17:15:13 deraadt Exp $ */
+/* $OpenBSD: iso_rrip.h,v 1.6 2013/05/30 17:35:01 guenther Exp $ */
/* $NetBSD: iso_rrip.h,v 1.3 1994/06/29 06:32:02 cgd Exp $ */
/*-
@@ -63,7 +63,7 @@ typedef struct {
off_t iso_ce_off; /* offset of continuation area */
int iso_ce_len; /* length of continuation area */
struct iso_mnt *imp; /* mount structure */
- ino_t *inump; /* inode number pointer */
+ cdino_t *inump; /* inode number pointer */
char *outbuf; /* name/symbolic link output area */
u_short *outlen; /* length of above */
u_short maxlen; /* maximum length of above */
@@ -74,7 +74,7 @@ int cd9660_rrip_analyze(struct iso_directory_record *isodir,
struct iso_node *inop, struct iso_mnt *imp);
int cd9660_rrip_getname(struct iso_directory_record *isodir,
char *outbuf, u_short *outlen,
- ino_t *inump, struct iso_mnt *imp);
+ cdino_t *inump, struct iso_mnt *imp);
int cd9660_rrip_getsymname(struct iso_directory_record *isodir,
char *outbuf, u_short *outlen,
struct iso_mnt *imp);