summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 20:11:07 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-05-30 20:11:07 +0000
commit2e1b58094824239044177fdc74b2fb8f472739df (patch)
tree84f2c998d2fc3a8499f2d6ef14f5ef6f5e916386 /sys
parentcfa5e211adf2818d68a6b03e7f3258286919470d (diff)
More of the same: ntfs doesn't do inode numbers >2^32, so use a smaller type
internally, only using ino_t in the VFS layer APIs: vget, readdir, getattr
Diffstat (limited to 'sys')
-rw-r--r--sys/ntfs/ntfs.h8
-rw-r--r--sys/ntfs/ntfs_ihash.c4
-rw-r--r--sys/ntfs/ntfs_ihash.h6
-rw-r--r--sys/ntfs/ntfs_inode.h10
-rw-r--r--sys/ntfs/ntfs_subr.c4
-rw-r--r--sys/ntfs/ntfs_subr.h4
-rw-r--r--sys/ntfs/ntfs_vfsops.c6
-rw-r--r--sys/ntfs/ntfs_vfsops.h4
8 files changed, 27 insertions, 19 deletions
diff --git a/sys/ntfs/ntfs.h b/sys/ntfs/ntfs.h
index 2eeb705ba34..65f380d6979 100644
--- a/sys/ntfs/ntfs.h
+++ b/sys/ntfs/ntfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs.h,v 1.14 2013/01/25 22:25:14 brad Exp $ */
+/* $OpenBSD: ntfs.h,v 1.15 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs.h,v 1.5 2003/04/24 07:50:19 christos Exp $ */
/*-
@@ -46,6 +46,12 @@ typedef u_int16_t wchar;
#define NTFS_UPCASEINO 10
#define NTFS_MAXFILENAME 255
+/*
+ * UFS directories use 32bit inode numbers internally, regardless
+ * of what the system on top of it uses.
+ */
+typedef u_int32_t ntfsino_t;
+
struct fixuphdr {
u_int32_t fh_magic;
u_int16_t fh_foff;
diff --git a/sys/ntfs/ntfs_ihash.c b/sys/ntfs/ntfs_ihash.c
index 955a559eba7..9ee4374442f 100644
--- a/sys/ntfs/ntfs_ihash.c
+++ b/sys/ntfs/ntfs_ihash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_ihash.c,v 1.12 2013/01/14 02:41:03 jsing Exp $ */
+/* $OpenBSD: ntfs_ihash.c,v 1.13 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_ihash.c,v 1.1 2002/12/23 17:38:32 jdolecek Exp $ */
/*
@@ -69,7 +69,7 @@ ntfs_nthashinit(void)
* to it. If it is in core, return it, even if it is locked.
*/
struct ntnode *
-ntfs_nthashlookup(dev_t dev, ino_t inum)
+ntfs_nthashlookup(dev_t dev, ntfsino_t inum)
{
struct ntnode *ip;
struct nthashhead *ipp;
diff --git a/sys/ntfs/ntfs_ihash.h b/sys/ntfs/ntfs_ihash.h
index a72835709ab..e99e73aee48 100644
--- a/sys/ntfs/ntfs_ihash.h
+++ b/sys/ntfs/ntfs_ihash.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_ihash.h,v 1.4 2009/03/25 20:39:47 oga Exp $ */
+/* $OpenBSD: ntfs_ihash.h,v 1.5 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_ihash.h,v 1.1 2002/12/23 17:38:32 jdolecek Exp $ */
/*-
@@ -33,7 +33,7 @@ extern struct rwlock ntfs_hashlock;
void ntfs_nthashinit(void);
void ntfs_nthashreinit(void);
void ntfs_nthashdone(void);
-struct ntnode *ntfs_nthashlookup(dev_t, ino_t);
-struct ntnode *ntfs_nthashget(dev_t, ino_t);
+struct ntnode *ntfs_nthashlookup(dev_t, ntfsino_t);
+struct ntnode *ntfs_nthashget(dev_t, ntfsino_t);
void ntfs_nthashins(struct ntnode *);
void ntfs_nthashrem(struct ntnode *);
diff --git a/sys/ntfs/ntfs_inode.h b/sys/ntfs/ntfs_inode.h
index 7e255985e7a..9dbc6faba90 100644
--- a/sys/ntfs/ntfs_inode.h
+++ b/sys/ntfs/ntfs_inode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_inode.h,v 1.6 2013/01/18 05:09:21 jsing Exp $ */
+/* $OpenBSD: ntfs_inode.h,v 1.7 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_inode.h,v 1.1 2002/12/23 17:38:33 jdolecek Exp $ */
/*-
@@ -44,7 +44,7 @@ struct ntnode {
struct ntnode **i_prev;
struct ntfsmount *i_mp;
- ino_t i_number;
+ ntfsino_t i_number;
u_int32_t i_flag;
/* locking */
@@ -55,7 +55,7 @@ struct ntnode {
LIST_HEAD(,ntvattr) i_valist;
long i_nlink; /* MFR */
- ino_t i_mainrec; /* MFR */
+ u_int64_t i_mainrec; /* MFR */
u_int32_t i_frflag; /* MFR */
};
@@ -69,7 +69,7 @@ struct fnode {
u_long f_flag;
ntfs_times_t f_times; /* $NAME/dirinfo */
- ino_t f_pnumber; /* $NAME/dirinfo */
+ u_int32_t f_pnumber; /* $NAME/dirinfo */
u_int32_t f_fflag; /* $NAME/dirinfo */
u_int64_t f_size; /* defattr/dirinfo: */
u_int64_t f_allocated; /* defattr/dirinfo */
@@ -90,7 +90,7 @@ struct fnode {
struct ntfid {
u_int16_t ntfid_len; /* Length of structure. */
u_int16_t ntfid_pad; /* Force 32-bit alignment. */
- ino_t ntfid_ino; /* File number (ino). */
+ ntfsino_t ntfid_ino; /* File number (ino). */
u_int8_t ntfid_attr; /* Attribute identifier */
#ifdef notyet
int32_t ntfid_gen; /* Generation number. */
diff --git a/sys/ntfs/ntfs_subr.c b/sys/ntfs/ntfs_subr.c
index c214d3a6814..92a67cc667a 100644
--- a/sys/ntfs/ntfs_subr.c
+++ b/sys/ntfs/ntfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_subr.c,v 1.30 2013/01/18 05:09:21 jsing Exp $ */
+/* $OpenBSD: ntfs_subr.c,v 1.31 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_subr.c,v 1.4 2003/04/10 21:37:32 jdolecek Exp $ */
/*-
@@ -388,7 +388,7 @@ ntfs_ntget(struct ntnode *ip, struct proc *p)
* ntnode returned locked
*/
int
-ntfs_ntlookup(struct ntfsmount *ntmp, ino_t ino, struct ntnode **ipp,
+ntfs_ntlookup(struct ntfsmount *ntmp, ntfsino_t ino, struct ntnode **ipp,
struct proc *p)
{
struct ntnode *ip;
diff --git a/sys/ntfs/ntfs_subr.h b/sys/ntfs/ntfs_subr.h
index 2a5fc111cae..4285ec24720 100644
--- a/sys/ntfs/ntfs_subr.h
+++ b/sys/ntfs/ntfs_subr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_subr.h,v 1.6 2010/09/04 21:35:58 tedu Exp $ */
+/* $OpenBSD: ntfs_subr.h,v 1.7 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_subr.h,v 1.1 2002/12/23 17:38:33 jdolecek Exp $ */
/*-
@@ -98,7 +98,7 @@ int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode **)
void ntfs_frele(struct fnode *);
int ntfs_ntreaddir(struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **, struct proc *);
int ntfs_ntlookupfile(struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **, struct proc *);
-int ntfs_ntlookup(struct ntfsmount *, ino_t, struct ntnode **, struct proc *);
+int ntfs_ntlookup(struct ntfsmount *, ntfsino_t, struct ntnode **, struct proc *);
int ntfs_ntget(struct ntnode *, struct proc *);
void ntfs_ntput(struct ntnode *, struct proc *);
int ntfs_toupper_use(struct mount *, struct ntfsmount *, struct proc *);
diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c
index 120a400fe12..a1b959e12f5 100644
--- a/sys/ntfs/ntfs_vfsops.c
+++ b/sys/ntfs/ntfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_vfsops.c,v 1.34 2013/04/15 15:32:19 jsing Exp $ */
+/* $OpenBSD: ntfs_vfsops.c,v 1.35 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */
/*-
@@ -680,7 +680,7 @@ ntfs_vptofh(struct vnode *vp, struct fid *fhp)
}
int
-ntfs_vgetex(struct mount *mp, ino_t ino, u_int32_t attrtype, char *attrname,
+ntfs_vgetex(struct mount *mp, ntfsino_t ino, u_int32_t attrtype, char *attrname,
u_long lkflags, u_long flags, struct proc *p, struct vnode **vpp)
{
int error;
@@ -794,6 +794,8 @@ ntfs_vgetex(struct mount *mp, ino_t ino, u_int32_t attrtype, char *attrname,
int
ntfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
{
+ if (ino > (ntfsino_t)-1)
+ panic("ntfs_vget: alien ino_t %llu", (unsigned long long)ino);
return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL,
LK_EXCLUSIVE | LK_RETRY, 0, curproc, vpp); /* XXX */
}
diff --git a/sys/ntfs/ntfs_vfsops.h b/sys/ntfs/ntfs_vfsops.h
index 5ef85403fbf..0e8f46a4cb1 100644
--- a/sys/ntfs/ntfs_vfsops.h
+++ b/sys/ntfs/ntfs_vfsops.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntfs_vfsops.h,v 1.2 2003/05/20 03:23:12 mickey Exp $ */
+/* $OpenBSD: ntfs_vfsops.h,v 1.3 2013/05/30 20:11:06 guenther Exp $ */
/* $NetBSD: ntfs_vfsops.h,v 1.1 2002/12/23 17:38:34 jdolecek Exp $ */
/*-
@@ -35,6 +35,6 @@
/* fnode */
#define VG_EXT 0x0004 /* This is not main record */
-int ntfs_vgetex(struct mount *, ino_t, u_int32_t, char *, u_long, u_long,
+int ntfs_vgetex(struct mount *, ntfsino_t, u_int32_t, char *, u_long, u_long,
struct proc *, struct vnode **);
int ntfs_calccfree(struct ntfsmount *, cn_t *);