summaryrefslogtreecommitdiff
path: root/sys/ufs/ext2fs
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 19:19:10 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 19:19:10 +0000
commitf18acc3c55f821a92db9c79c9543a77f44614385 (patch)
tree84d06ac31173344def7160df45acb222adf933ff /sys/ufs/ext2fs
parent62394cd8a6d331826ba0a405415dc0cb58cd861b (diff)
UFS does't do inode numbers >2^32, so use a smaller type internally,
only using ino_t in the VFS layer APIs: vget, readdir, getattr. otto wrote the original diff for libsa to keep bootblock from overflowing ok deraadt@ kettenis@
Diffstat (limited to 'sys/ufs/ext2fs')
-rw-r--r--sys/ufs/ext2fs/ext2fs_alloc.c8
-rw-r--r--sys/ufs/ext2fs/ext2fs_dinode.h9
-rw-r--r--sys/ufs/ext2fs/ext2fs_extern.h6
-rw-r--r--sys/ufs/ext2fs/ext2fs_lookup.c4
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c6
5 files changed, 19 insertions, 14 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c
index a0937ec891f..508376cf9c0 100644
--- a/sys/ufs/ext2fs/ext2fs_alloc.c
+++ b/sys/ufs/ext2fs/ext2fs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_alloc.c,v 1.27 2011/09/18 23:20:28 bluhm Exp $ */
+/* $OpenBSD: ext2fs_alloc.c,v 1.28 2013/05/30 19:19:09 guenther Exp $ */
/* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */
/*
@@ -138,7 +138,7 @@ ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *cred,
struct vnode *pvp;
struct m_ext2fs *fs;
struct inode *ip;
- ino_t ino, ipref;
+ ufsino_t ino, ipref;
int cg, error;
*vpp = NULL;
@@ -152,7 +152,7 @@ ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *cred,
else
cg = ino_to_cg(fs, pip->i_number);
ipref = cg * fs->e2fs.e2fs_ipg + 1;
- ino = (ino_t)ext2fs_hashalloc(pip, cg, (long)ipref, mode, ext2fs_nodealloccg);
+ ino = (ufsino_t)ext2fs_hashalloc(pip, cg, (long)ipref, mode, ext2fs_nodealloccg);
if (ino == 0)
goto noinodes;
error = VFS_VGET(pvp->v_mount, ino, vpp);
@@ -506,7 +506,7 @@ ext2fs_blkfree(struct inode *ip, int32_t bno)
* The specified inode is placed back in the free map.
*/
int
-ext2fs_inode_free(struct inode *pip, ino_t ino, mode_t mode)
+ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode)
{
struct m_ext2fs *fs;
char *ibp;
diff --git a/sys/ufs/ext2fs/ext2fs_dinode.h b/sys/ufs/ext2fs/ext2fs_dinode.h
index fcfcf2b17c8..e39dfccdde8 100644
--- a/sys/ufs/ext2fs/ext2fs_dinode.h
+++ b/sys/ufs/ext2fs/ext2fs_dinode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_dinode.h,v 1.12 2010/02/16 08:24:13 otto Exp $ */
+/* $OpenBSD: ext2fs_dinode.h,v 1.13 2013/05/30 19:19:09 guenther Exp $ */
/* $NetBSD: ext2fs_dinode.h,v 1.6 2000/01/26 16:21:33 bouyer Exp $ */
/*
@@ -40,6 +40,7 @@
*/
#include <sys/stat.h>
+#include <ufs/ufs/dinode.h> /* for ufsino_t */
/*
* The root inode is the root of the file system. Inode 0 can't be used for
@@ -47,9 +48,9 @@
* the root inode is 2.
* Inode 3 to 10 are reserved in ext2fs.
*/
-#define EXT2_ROOTINO ((ino_t)2)
-#define EXT2_RESIZEINO ((ino_t)7)
-#define EXT2_FIRSTINO ((ino_t)11)
+#define EXT2_ROOTINO ((ufsino_t)2)
+#define EXT2_RESIZEINO ((ufsino_t)7)
+#define EXT2_FIRSTINO ((ufsino_t)11)
/*
* A dinode contains all the meta-data associated with a UFS file.
diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h
index b44b57b743b..2e114e2ac59 100644
--- a/sys/ufs/ext2fs/ext2fs_extern.h
+++ b/sys/ufs/ext2fs/ext2fs_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_extern.h,v 1.30 2013/03/28 03:29:44 guenther Exp $ */
+/* $OpenBSD: ext2fs_extern.h,v 1.31 2013/05/30 19:19:09 guenther Exp $ */
/* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */
/*-
@@ -66,7 +66,7 @@ int ext2fs_inode_alloc(struct inode *pip, mode_t mode, struct ucred *,
struct vnode **);
daddr64_t ext2fs_blkpref(struct inode *, int32_t, int, int32_t *);
void ext2fs_blkfree(struct inode *, int32_t);
-int ext2fs_inode_free(struct inode *pip, ino_t ino, mode_t mode);
+int ext2fs_inode_free(struct inode *pip, ufsino_t ino, mode_t mode);
/* ext2fs_balloc.c */
int ext2fs_buf_alloc(struct inode *, daddr64_t, int, struct ucred *,
@@ -92,7 +92,7 @@ int ext2fs_direnter(struct inode *, struct vnode *,
int ext2fs_dirremove(struct vnode *, struct componentname *);
int ext2fs_dirrewrite(struct inode *, struct inode *,
struct componentname *);
-int ext2fs_dirempty(struct inode *, ino_t, struct ucred *);
+int ext2fs_dirempty(struct inode *, ufsino_t, struct ucred *);
int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *);
/* ext2fs_subr.c */
diff --git a/sys/ufs/ext2fs/ext2fs_lookup.c b/sys/ufs/ext2fs/ext2fs_lookup.c
index 0b507359f37..79c3729fc72 100644
--- a/sys/ufs/ext2fs/ext2fs_lookup.c
+++ b/sys/ufs/ext2fs/ext2fs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_lookup.c,v 1.27 2010/11/18 21:18:10 miod Exp $ */
+/* $OpenBSD: ext2fs_lookup.c,v 1.28 2013/05/30 19:19:09 guenther Exp $ */
/* $NetBSD: ext2fs_lookup.c,v 1.16 2000/08/03 20:29:26 thorpej Exp $ */
/*
@@ -957,7 +957,7 @@ ext2fs_dirrewrite(struct inode *dp, struct inode *ip,
* NB: does not handle corrupted directories.
*/
int
-ext2fs_dirempty(struct inode *ip, ino_t parentino, struct ucred *cred)
+ext2fs_dirempty(struct inode *ip, ufsino_t parentino, struct ucred *cred)
{
off_t off;
struct ext2fs_dirtemplate dbuf;
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index 84f392769b7..991a34452da 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.66 2013/04/15 15:32:19 jsing Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.67 2013/05/30 19:19:09 guenther Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
@@ -810,6 +810,10 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
dev_t dev;
int error;
+ if (ino > (ufsino_t)-1)
+ panic("ext2fs_vget: alien ino_t %llu",
+ (unsigned long long)ino);
+
ump = VFSTOUFS(mp);
dev = ump->um_dev;