Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ext2fs Use proper macro, some KNF, fix typo.



details:   https://anonhg.NetBSD.org/src/rev/400892c79d62
branches:  trunk
changeset: 747367:400892c79d62
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 12 14:59:59 2009 +0000

description:
Use proper macro, some KNF, fix typo.

diffstat:

 sys/ufs/ext2fs/ext2fs_dir.h |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r a43fca67db1a -r 400892c79d62 sys/ufs/ext2fs/ext2fs_dir.h
--- a/sys/ufs/ext2fs/ext2fs_dir.h       Sat Sep 12 13:57:10 2009 +0000
+++ b/sys/ufs/ext2fs/ext2fs_dir.h       Sat Sep 12 14:59:59 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_dir.h,v 1.16 2009/09/12 11:27:39 tsutsui Exp $  */
+/*     $NetBSD: ext2fs_dir.h,v 1.17 2009/09/12 14:59:59 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -78,7 +78,7 @@
  * quantity to keep down the cost of doing lookup on a 32-bit machine.
  */
 #define        doff_t                  int32_t
-#define        EXT2FS_MAXDIRSIZE       (0x7fffffff)
+#define        EXT2FS_MAXDIRSIZE       INT32_MAX
 
 /*
  * A directory consists of some number of blocks of e2fs_bsize bytes.
@@ -117,7 +117,7 @@
        char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */
 };
 
-/* Ext2 directory file types (not the same as FFS. Sigh. */
+/* Ext2 directory file types (not the same as FFS. Sigh.) */
 #define EXT2_FT_UNKNOWN         0
 #define EXT2_FT_REG_FILE        1
 #define EXT2_FT_DIR             2
@@ -135,7 +135,8 @@
 static __inline uint8_t
 inot2ext2dt(uint16_t type)
 {
-       switch(type) {
+
+       switch (type) {
        case E2IFTODT(EXT2_IFIFO):
                return EXT2_FT_FIFO;
        case E2IFTODT(EXT2_IFCHR):
@@ -162,7 +163,7 @@
  * without the d_name field, plus enough space for the name without a
  * terminating null byte, rounded up to a 4 byte boundary.
  */
-#define EXT2FS_DIRSIZ(len)     (( 8 + len + 3) & ~3)
+#define EXT2FS_DIRSIZ(len)     roundup2(8 + len, 4)
 
 /*
  * Template for manipulating directories.  Should use struct direct's,



Home | Main Index | Thread Index | Old Index