[Midnightbsd-cvs] src [8678] trunk/sys/fs/ext2fs: ext2fs: make some inode fields match spec

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 25 17:59:48 EDT 2016


Revision: 8678
          http://svnweb.midnightbsd.org/src/?rev=8678
Author:   laffer1
Date:     2016-09-25 17:59:48 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
ext2fs: make some inode fields match spec

Modified Paths:
--------------
    trunk/sys/fs/ext2fs/ext2_alloc.c
    trunk/sys/fs/ext2fs/ext2_balloc.c
    trunk/sys/fs/ext2fs/ext2_inode.c
    trunk/sys/fs/ext2fs/inode.h

Modified: trunk/sys/fs/ext2fs/ext2_alloc.c
===================================================================
--- trunk/sys/fs/ext2fs/ext2_alloc.c	2016-09-25 21:59:16 UTC (rev 8677)
+++ trunk/sys/fs/ext2fs/ext2_alloc.c	2016-09-25 21:59:48 UTC (rev 8678)
@@ -169,7 +169,7 @@
 	struct inode *ip;
 	struct vnode *vp;
 	struct buf *sbp, *ebp;
-	int32_t *bap, *sbap, *ebap = 0;
+	uint32_t *bap, *sbap, *ebap = 0;
 	struct ext2mount *ump;
 	struct cluster_save *buflist;
 	struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp;

Modified: trunk/sys/fs/ext2fs/ext2_balloc.c
===================================================================
--- trunk/sys/fs/ext2fs/ext2_balloc.c	2016-09-25 21:59:16 UTC (rev 8677)
+++ trunk/sys/fs/ext2fs/ext2_balloc.c	2016-09-25 21:59:48 UTC (rev 8678)
@@ -69,7 +69,7 @@
 	struct buf *bp, *nbp;
 	struct vnode *vp = ITOV(ip);
 	struct indir indirs[NIADDR + 2];
-	int32_t newb, *bap, pref;
+	uint32_t newb, *bap, pref;
 	int osize, nsize, num, i, error;
 
 	*bpp = NULL;

Modified: trunk/sys/fs/ext2fs/ext2_inode.c
===================================================================
--- trunk/sys/fs/ext2fs/ext2_inode.c	2016-09-25 21:59:16 UTC (rev 8677)
+++ trunk/sys/fs/ext2fs/ext2_inode.c	2016-09-25 21:59:48 UTC (rev 8678)
@@ -119,7 +119,7 @@
 	int32_t lastblock;
 	struct inode *oip;
 	int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
-	int32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
+	uint32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
 	struct bufobj *bo;
 	struct m_ext2fs *fs;
 	struct buf *bp;
@@ -341,8 +341,9 @@
 	 * Put back the real size.
 	 */
 	oip->i_size = length;
-	oip->i_blocks -= blocksreleased;
-	if (oip->i_blocks < 0)			/* sanity */
+	if (oip->i_blocks >= blocksreleased)
+		oip->i_blocks -= blocksreleased;
+	else				/* sanity */
 		oip->i_blocks = 0;
 	oip->i_flag |= IN_CHANGE;
 	vnode_pager_setsize(ovp, length);

Modified: trunk/sys/fs/ext2fs/inode.h
===================================================================
--- trunk/sys/fs/ext2fs/inode.h	2016-09-25 21:59:16 UTC (rev 8677)
+++ trunk/sys/fs/ext2fs/inode.h	2016-09-25 21:59:48 UTC (rev 8678)
@@ -90,11 +90,11 @@
 	int32_t		i_atimensec;	/* Last access time. */
 	int32_t		i_ctimensec;	/* Last inode change time. */
 	int32_t		i_birthnsec;	/* Inode creation time. */
-	int32_t		i_db[NDADDR];	/* Direct disk blocks. */
-	int32_t		i_ib[NIADDR];	/* Indirect disk blocks. */
+	uint32_t	i_db[NDADDR];	/* Direct disk blocks. */
+	uint32_t	i_ib[NIADDR];	/* Indirect disk blocks. */
 	uint32_t	i_flags;	/* Status flags (chflags). */
-	int32_t		i_blocks;	/* Blocks actually held. */
-	int32_t		i_gen;		/* Generation number. */
+	uint32_t	i_blocks;	/* Blocks actually held. */
+	uint32_t	i_gen;		/* Generation number. */
 	uint32_t	i_uid;		/* File owner. */
 	uint32_t	i_gid;		/* File group. */
 };
@@ -163,7 +163,7 @@
 	uint16_t ufid_len;	/* Length of structure. */
 	uint16_t ufid_pad;	/* Force 32-bit alignment. */
 	ino_t	 ufid_ino;	/* File number (ino). */
-	int32_t	 ufid_gen;	/* Generation number. */
+	uint32_t ufid_gen;	/* Generation number. */
 };
 #endif /* _KERNEL */
 



More information about the Midnightbsd-cvs mailing list