aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2013-02-05 03:08:56 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2013-02-05 03:08:56 +0000
commit666116e4a3afaea9b4272650440a5095faf2ae5a (patch)
tree598ffb20251011b130400db756e39657b8623350
parentfdc100e4c21cc5fbe5da121809c190f16321adb2 (diff)
downloadsrc-666116e4a3afaea9b4272650440a5095faf2ae5a.tar.gz
src-666116e4a3afaea9b4272650440a5095faf2ae5a.zip
ext2fs: Use nitems().
Submitted by: Christoph Mallon MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=246348
-rw-r--r--sys/fs/ext2fs/ext2_lookup.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c
index 9aadb6a47d3b..edd57049db4a 100644
--- a/sys/fs/ext2fs/ext2_lookup.c
+++ b/sys/fs/ext2fs/ext2_lookup.c
@@ -88,9 +88,8 @@ static u_char ext2_ft_to_dt[] = {
DT_SOCK, /* EXT2_FT_SOCK */
DT_LNK, /* EXT2_FT_SYMLINK */
};
-#define FTTODT(ft) \
- ((ft) > sizeof(ext2_ft_to_dt) / sizeof(ext2_ft_to_dt[0]) ? \
- DT_UNKNOWN : ext2_ft_to_dt[(ft)])
+#define FTTODT(ft) \
+ ((ft) > nitems(ext2_ft_to_dt) ? DT_UNKNOWN : ext2_ft_to_dt[(ft)])
static u_char dt_to_ext2_ft[] = {
EXT2_FT_UNKNOWN, /* DT_UNKNOWN */
@@ -109,9 +108,8 @@ static u_char dt_to_ext2_ft[] = {
EXT2_FT_UNKNOWN, /* unused */
EXT2_FT_UNKNOWN, /* DT_WHT */
};
-#define DTTOFT(dt) \
- ((dt) > sizeof(dt_to_ext2_ft) / sizeof(dt_to_ext2_ft[0]) ? \
- EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
+#define DTTOFT(dt) \
+ ((dt) > nitems(dt_to_ext2_ft) ? EXT2_FT_UNKNOWN : dt_to_ext2_ft[(dt)])
static int ext2_dirbadentry(struct vnode *dp, struct ext2fs_direct_2 *de,
int entryoffsetinblock);