Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ext2fs switch code to use the EXT2_HAS_{COMPAT|ROCOM...
details: https://anonhg.NetBSD.org/src/rev/2143b1c0b07f
branches: trunk
changeset: 347106:2143b1c0b07f
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sun Aug 14 11:44:54 2016 +0000
description:
switch code to use the EXT2_HAS_{COMPAT|ROCOMPAT|INCOMPAT}_FEATURE() macros instead of open coding the checks
diffstat:
sys/ufs/ext2fs/ext2fs_inode.c | 12 ++++++------
sys/ufs/ext2fs/ext2fs_lookup.c | 10 ++++------
sys/ufs/ext2fs/ext2fs_vfsops.c | 10 ++++------
sys/ufs/ext2fs/ext2fs_vnops.c | 12 +++++-------
4 files changed, 19 insertions(+), 25 deletions(-)
diffs (161 lines):
diff -r 6b5d48b67123 -r 2143b1c0b07f sys/ufs/ext2fs/ext2fs_inode.c
--- a/sys/ufs/ext2fs/ext2fs_inode.c Sun Aug 14 11:42:50 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_inode.c Sun Aug 14 11:44:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_inode.c,v 1.85 2016/08/13 07:40:10 christos Exp $ */
+/* $NetBSD: ext2fs_inode.c,v 1.86 2016/08/14 11:44:54 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.85 2016/08/13 07:40:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.86 2016/08/14 11:44:54 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -121,8 +121,8 @@
/* Linux automagically upgrades to REV1 here! */
return EFBIG;
}
- if (!(fs->e2fs.e2fs_features_rocompat
- & EXT2F_ROCOMPAT_LARGEFILE)) {
+ if (!EXT2F_HAS_ROCOMPAT_FEATURE(fs,
+ EXT2F_ROCOMPAT_LARGEFILE)) {
fs->e2fs.e2fs_features_rocompat |=
EXT2F_ROCOMPAT_LARGEFILE;
fs->e2fs_fmod = 1;
@@ -142,7 +142,7 @@
uint64_t nblock = ip->i_e2fs_nblock;
struct m_ext2fs * const fs = ip->i_e2fs;
- if (fs->e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_HUGE_FILE) {
+ if (EXT2F_HAS_ROCOMPAT_FEATURE(fs, EXT2F_ROCOMPAT_HUGE_FILE)) {
nblock |= (uint64_t)ip->i_e2fs_nblock_high << 32;
if ((ip->i_e2fs_flags & EXT2_HUGE_FILE)) {
@@ -164,7 +164,7 @@
return 0;
}
- if (!ISSET(fs->e2fs.e2fs_features_rocompat, EXT2F_ROCOMPAT_HUGE_FILE))
+ if (!EXT2F_HAS_ROCOMPAT_FEATURE(fs, EXT2F_ROCOMPAT_HUGE_FILE))
return EFBIG;
if (nblock <= 0xffffffffffffULL) {
diff -r 6b5d48b67123 -r 2143b1c0b07f sys/ufs/ext2fs/ext2fs_lookup.c
--- a/sys/ufs/ext2fs/ext2fs_lookup.c Sun Aug 14 11:42:50 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_lookup.c Sun Aug 14 11:44:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_lookup.c,v 1.84 2016/08/13 07:40:10 christos Exp $ */
+/* $NetBSD: ext2fs_lookup.c,v 1.85 2016/08/14 11:44:54 jdolecek Exp $ */
/*
* Modified for NetBSD 1.2E
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.84 2016/08/13 07:40:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.85 2016/08/14 11:44:54 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -884,8 +884,7 @@
newdir.e2d_ino = h2fs32(ip->i_number);
newdir.e2d_namlen = cnp->cn_namelen;
- if (ip->i_e2fs->e2fs.e2fs_rev > E2FS_REV0 &&
- (ip->i_e2fs->e2fs.e2fs_features_incompat & EXT2F_INCOMPAT_FTYPE)) {
+ if (EXT2F_HAS_INCOMPAT_FEATURE(ip->i_e2fs, EXT2F_INCOMPAT_FTYPE)) {
newdir.e2d_type = inot2ext2dt(IFTODT(ip->i_e2fs_mode));
} else {
newdir.e2d_type = 0;
@@ -1099,8 +1098,7 @@
if (error != 0)
return error;
ep->e2d_ino = h2fs32(ip->i_number);
- if (ip->i_e2fs->e2fs.e2fs_rev > E2FS_REV0 &&
- (ip->i_e2fs->e2fs.e2fs_features_incompat & EXT2F_INCOMPAT_FTYPE)) {
+ if (EXT2F_HAS_INCOMPAT_FEATURE(dp->i_e2fs, EXT2F_INCOMPAT_FTYPE)) {
ep->e2d_type = inot2ext2dt(IFTODT(ip->i_e2fs_mode));
} else {
ep->e2d_type = 0;
diff -r 6b5d48b67123 -r 2143b1c0b07f sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c Sun Aug 14 11:42:50 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c Sun Aug 14 11:44:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vfsops.c,v 1.198 2016/08/13 07:40:10 christos Exp $ */
+/* $NetBSD: ext2fs_vfsops.c,v 1.199 2016/08/14 11:44:54 jdolecek Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.198 2016/08/13 07:40:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.199 2016/08/14 11:44:54 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -834,8 +834,7 @@
fs->e2fs_itpg;
overhead = fs->e2fs.e2fs_first_dblock +
fs->e2fs_ncg * overhead_per_group;
- if (fs->e2fs.e2fs_rev > E2FS_REV0 &&
- fs->e2fs.e2fs_features_rocompat & EXT2F_ROCOMPAT_SPARSESUPER) {
+ if (EXT2F_HAS_ROCOMPAT_FEATURE(fs, EXT2F_ROCOMPAT_SPARSESUPER)) {
for (i = 0, ngroups = 0; i < fs->e2fs_ncg; i++) {
if (cg_has_sb(i))
ngroups++;
@@ -844,8 +843,7 @@
ngroups = fs->e2fs_ncg;
}
ngdb = fs->e2fs_ngdb;
- if (fs->e2fs.e2fs_rev > E2FS_REV0 &&
- fs->e2fs.e2fs_features_compat & EXT2F_COMPAT_RESIZE)
+ if (EXT2F_HAS_COMPAT_FEATURE(fs, EXT2F_COMPAT_RESIZE))
ngdb += fs->e2fs.e2fs_reserved_ngdb;
overhead += ngroups * (1 /* superblock */ + ngdb);
diff -r 6b5d48b67123 -r 2143b1c0b07f sys/ufs/ext2fs/ext2fs_vnops.c
--- a/sys/ufs/ext2fs/ext2fs_vnops.c Sun Aug 14 11:42:50 2016 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c Sun Aug 14 11:44:54 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ext2fs_vnops.c,v 1.122 2016/08/13 07:40:10 christos Exp $ */
+/* $NetBSD: ext2fs_vnops.c,v 1.123 2016/08/14 11:44:54 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.122 2016/08/13 07:40:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.123 2016/08/14 11:44:54 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -724,16 +724,14 @@
dirtemplate.dot_ino = h2fs32(ip->i_number);
dirtemplate.dot_reclen = h2fs16(12);
dirtemplate.dot_namlen = 1;
- if (ip->i_e2fs->e2fs.e2fs_rev > E2FS_REV0 &&
- (ip->i_e2fs->e2fs.e2fs_features_incompat & EXT2F_INCOMPAT_FTYPE)) {
+ if (EXT2F_HAS_INCOMPAT_FEATURE(dp->i_e2fs, EXT2F_INCOMPAT_FTYPE)) {
dirtemplate.dot_type = EXT2_FT_DIR;
}
dirtemplate.dot_name[0] = '.';
dirtemplate.dotdot_ino = h2fs32(dp->i_number);
- dirtemplate.dotdot_reclen = h2fs16(VTOI(dvp)->i_e2fs->e2fs_bsize - 12);
+ dirtemplate.dotdot_reclen = h2fs16(VTOI(dvp)->i_e2fs->e2fs_bsize - 12);
dirtemplate.dotdot_namlen = 2;
- if (ip->i_e2fs->e2fs.e2fs_rev > E2FS_REV0 &&
- (ip->i_e2fs->e2fs.e2fs_features_incompat & EXT2F_INCOMPAT_FTYPE)) {
+ if (EXT2F_HAS_INCOMPAT_FEATURE(dp->i_e2fs, EXT2F_INCOMPAT_FTYPE)) {
dirtemplate.dotdot_type = EXT2_FT_DIR;
}
dirtemplate.dotdot_name[0] = dirtemplate.dotdot_name[1] = '.';
Home |
Main Index |
Thread Index |
Old Index