2007-08-07 21:22:08

by Jose R. Santos

[permalink] [raw]
Subject: [PATCH][e2fsprogs] Move ext2fs_struct_generic_bitmap back into ext2fs.h

From: Jose R. Santos <[email protected]>

Move ext2fs_struct_generic_bitmap back into ext2fs.h

In Commit: f1f115a78f5ea599fc5f8815a741d43fedd5840d

The ext2fs_struct_generic_bitmap structure is remove from ext2fs.h and
put into gen_bitmap.c. This breaks big endian compiles since swapfs.c
uses this structure as well if EXT2_BIG_ENDIAN_BITMAPS is defined.

Since we have multiple users, this patch move
ext2fs_struct_generic_bitmap back into ext2fs.h in order to compile on
PowerPC or other big endian archs.

Signed-off-by: Jose R. Santos <[email protected]>
--

lib/ext2fs/ext2fs.h | 11 +++++++++++
lib/ext2fs/gen_bitmap.c | 11 -----------
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index d1cda2f..f34d2f9 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -100,6 +100,17 @@ typedef __u32 ext2_dirhash_t;

typedef struct struct_ext2_filsys *ext2_filsys;

+struct ext2fs_struct_generic_bitmap {
+ errcode_t magic;
+ ext2_filsys fs;
+ __u32 start, end;
+ __u32 real_end;
+ char * description;
+ char * bitmap;
+ errcode_t base_error_code;
+ __u32 reserved[7];
+};
+
#define EXT2FS_MARK_ERROR 0
#define EXT2FS_UNMARK_ERROR 1
#define EXT2FS_TEST_ERROR 2
diff --git a/lib/ext2fs/gen_bitmap.c b/lib/ext2fs/gen_bitmap.c
index 66172e5..3d01149 100644
--- a/lib/ext2fs/gen_bitmap.c
+++ b/lib/ext2fs/gen_bitmap.c
@@ -27,17 +27,6 @@
#include "ext2_fs.h"
#include "ext2fs.h"

-struct ext2fs_struct_generic_bitmap {
- errcode_t magic;
- ext2_filsys fs;
- __u32 start, end;
- __u32 real_end;
- char * description;
- char * bitmap;
- errcode_t base_error_code;
- __u32 reserved[7];
-};
-
/*
* Used by previously inlined function, so we have to export this and
* not change the function signature


2007-08-10 13:30:07

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH][e2fsprogs] Move ext2fs_struct_generic_bitmap back into ext2fs.h

On Tue, Aug 07, 2007 at 04:16:39PM -0500, Jose R. Santos wrote:
> From: Jose R. Santos <[email protected]>
>
> Move ext2fs_struct_generic_bitmap back into ext2fs.h
>
> In Commit: f1f115a78f5ea599fc5f8815a741d43fedd5840d
>
> The ext2fs_struct_generic_bitmap structure is remove from ext2fs.h and
> put into gen_bitmap.c. This breaks big endian compiles since swapfs.c
> uses this structure as well if EXT2_BIG_ENDIAN_BITMAPS is defined.

Actually, it's rw_bitmaps.c, and I don't want to do this because this
is part of the cleanups where I am trying to localize code that knows
about the in-memory encoding of bitmaps.

It turns out the need for this was only in the very first ports of
Linux to the Powerpc, and there haven't been kernels that would mount
big-endian superblocks since, oh, 1998 or so (in the 2.0 days).

So probably the better fix is one where we don't allow big-endian
filesystems any more. On all modern systems, we use little-endian
encoding of the superblock, and the bitmaps don't need byte-swapping.

- Ted

2007-08-12 16:58:36

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH][e2fsprogs] Move ext2fs_struct_generic_bitmap back into ext2fs.h

>It turns out the need for this was only in the very first ports of
>Linux to the Powerpc, and there haven't been kernels that would mount
>big-endian superblocks since, oh, 1998 or so (in the 2.0 days).
>
>So probably the better fix is one where we don't allow big-endian
>filesystems any more. On all modern systems, we use little-endian
>encoding of the superblock, and the bitmaps don't need byte-swapping.

Here's the set of patches to remove the support for the powerpc
big-endian filesystem variant.

- Ted

2007-08-12 16:58:36

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Remove e2fsck's swapfs test, since we've removed the functionality

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
tests/f_swapfs/debugfs.cmd | 5 --
tests/f_swapfs/expect | 133 --------------------------------------------
tests/f_swapfs/image | Bin 1048576 -> 0 bytes
tests/f_swapfs/image.gz | Bin 3777 -> 0 bytes
tests/f_swapfs/name | 1 -
tests/f_swapfs/script | 79 --------------------------
6 files changed, 0 insertions(+), 218 deletions(-)
delete mode 100644 tests/f_swapfs/debugfs.cmd
delete mode 100644 tests/f_swapfs/expect
delete mode 100644 tests/f_swapfs/image
delete mode 100644 tests/f_swapfs/image.gz
delete mode 100644 tests/f_swapfs/name
delete mode 100644 tests/f_swapfs/script

diff --git a/tests/f_swapfs/debugfs.cmd b/tests/f_swapfs/debugfs.cmd
deleted file mode 100644
index df583b2..0000000
--- a/tests/f_swapfs/debugfs.cmd
+++ /dev/null
@@ -1,5 +0,0 @@
-ls
-stat sym
-stat double-indirect-test
-cat fluff
-quit
diff --git a/tests/f_swapfs/expect b/tests/f_swapfs/expect
deleted file mode 100644
index ecbb990..0000000
--- a/tests/f_swapfs/expect
+++ /dev/null
@@ -1,133 +0,0 @@
-Swapfs test
-e2fsck -yf -N test_filesys
-Pass 1: Checking inodes, blocks, and sizes
-Pass 2: Checking directory structure
-Pass 3: Checking directory connectivity
-Pass 4: Checking reference counts
-Pass 5: Checking group summary information
-test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks
-Exit status is 0
-e2fsck -Sy -N test_filesys
-Pass 0: Doing byte-swap of filesystem
-Pass 1: Checking inodes, blocks, and sizes
-Pass 2: Checking directory structure
-Pass 3: Checking directory connectivity
-Pass 4: Checking reference counts
-Pass 5: Checking group summary information
-test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks
-Exit status is 0
-Running debugfs....
-debugfs: ls
- 2 (12) . 2 (12) .. 11 (20) lost+found 12 (16) fluff
- 13 (28) indirect-fluff-test 14 (28) double-indirect-test
- 15 (20) sym 16 (24) long-sym-test 17 (864) dir-test
-debugfs: stat sym
-Inode: 15 Type: symlink Mode: 0777 Flags: 0x0 Generation: 1
-User: 0 Group: 0 Size: 5
-File ACL: 0 Directory ACL: 0
-Links: 1 Blockcount: 0
-Fragment: Address: 0 Number: 0 Size: 0
-ctime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-atime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-mtime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-Fast_link_dest: fluff
-debugfs: stat double-indirect-test
-Inode: 14 Type: regular Mode: 0644 Flags: 0x0 Generation: 1
-User: 0 Group: 0 Size: 348960
-File ACL: 0 Directory ACL: 0
-Links: 1 Blockcount: 688
-Fragment: Address: 0 Number: 0 Size: 0
-ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-atime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-BLOCKS:
-(0-11):70-81, (IND):82, (12-267):83-338, (DIND):339, (IND):340, (268-340):341-413
-TOTAL: 344
-
-debugfs: cat fluff
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-
-debugfs: quit
-Exit status is 0
-e2fsck -yf -N test_filesys
-Pass 1: Checking inodes, blocks, and sizes
-Pass 2: Checking directory structure
-Pass 3: Checking directory connectivity
-Pass 4: Checking reference counts
-Pass 5: Checking group summary information
-test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks
-Exit status is 0
-e2fsck -sy -N test_filesys
-Pass 0: Doing byte-swap of filesystem
-Pass 1: Checking inodes, blocks, and sizes
-Pass 2: Checking directory structure
-Pass 3: Checking directory connectivity
-Pass 4: Checking reference counts
-Pass 5: Checking group summary information
-test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks
-Exit status is 0
-Running debugfs....
-debugfs: ls
- 2 (12) . 2 (12) .. 11 (20) lost+found 12 (16) fluff
- 13 (28) indirect-fluff-test 14 (28) double-indirect-test
- 15 (20) sym 16 (24) long-sym-test 17 (864) dir-test
-debugfs: stat sym
-Inode: 15 Type: symlink Mode: 0777 Flags: 0x0 Generation: 1
-User: 0 Group: 0 Size: 5
-File ACL: 0 Directory ACL: 0
-Links: 1 Blockcount: 0
-Fragment: Address: 0 Number: 0 Size: 0
-ctime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-atime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-mtime: 0x322737e2 -- Fri Aug 30 18:50:10 1996
-Fast_link_dest: fluff
-debugfs: stat double-indirect-test
-Inode: 14 Type: regular Mode: 0644 Flags: 0x0 Generation: 1
-User: 0 Group: 0 Size: 348960
-File ACL: 0 Directory ACL: 0
-Links: 1 Blockcount: 688
-Fragment: Address: 0 Number: 0 Size: 0
-ctime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-atime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-mtime: 0x322488cf -- Wed Aug 28 17:58:39 1996
-BLOCKS:
-(0-11):70-81, (IND):82, (12-267):83-338, (DIND):339, (IND):340, (268-340):341-413
-TOTAL: 344
-
-debugfs: cat fluff
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-yabba dabba doo. cocka doodle doo. yabba dabba doo. cocka doodle doo. yipyip
-
-debugfs: quit
-Exit status is 0
-e2fsck -yf -N test_filesys
-Pass 1: Checking inodes, blocks, and sizes
-Pass 2: Checking directory structure
-Pass 3: Checking directory connectivity
-Pass 4: Checking reference counts
-Pass 5: Checking group summary information
-test_filesys: 25/256 files (0.0% non-contiguous), 418/1024 blocks
-Exit status is 0
diff --git a/tests/f_swapfs/image b/tests/f_swapfs/image
deleted file mode 100644
index e7b24b94610a31eb8697f68748a34da75b5c071b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1048576
zcmeI*37Fh<eaG?tCZwea!9*fpOWSQ5Ma3)_4^%t=ZxluGK9D_0WXWK%K^HIZ2*g{w
z6%Sf_x7ObGU3*HUx4m22N-t^;[email protected]%tQmeeL6y-Rw2)EA#*Ve((Rz
zW}C([email protected]{!O#)l03gP(|%?5X*|!{[email protected]{p_31`NR$FKWzK##d$^E
ztNZ7?>hMn&T>6=hHec9!%Z(qu`QWMNo`25a-`iUW5cm=atk3PVPXHTo^xxXF|Ky1P
zfi)p;`%yd%Y!2?I(KSbL^FD+Cfjdv&u!r-VcQZZ{[email protected]$+z3IK~OY!`?
z+uFBsT>IL>r!t>zPxp4)O|q{0a{Jjm2440e0RjZ>ut4Yhb5^r+`+*C4)BU9FbI+**
zH*n9qe0t_ynR{pMlQ|=E-^`B8MCQ!QS(*D~MtZvTBkgxPZtKqN2N!p4zwSVLx*yoy
zmn~hG?f!XZp643vQ9YG=yw2^Pm#_c2+j`Tzh4#m6AGoy#<mCru9+Wvd^We-wG7rtP
zujf82^YF|gGLOuho9R6r{`[email protected]^`Gob_k;2=>[email protected]|1bP10%;PeT&paV>LFS2>
zCuJ_oJUR1}%te`}W}cR7))(h_`>DMBn{Hov`-a}yGqC;[email protected]`{(AC-u0;dbI9i!
z{0!aOzc#mfOTPZkx2OB|_QwpYe`6mU{[email protected]`n&z$)t&p`!Nu<9Zr}Fc?SJS9
zZ*%b7%iHgM{hM;zbG_+);2|F~F>&V1?!7w}X7?=&e%?`EKIC%^eo*)[email protected]`+0r)
zv(pPl_kUs7?VmEr?YH(%&Cl-Gy(bVy`hR5D?H`}[email protected]$RRN7_D}BJcKdm8
z`~5F`>Ho-){XGo3{VgNh{(NiCWjppQUU6i%-1%aL-Tvm0Zhzmx8FQ`uduF;oNARq?
z{X^HE_8Qbb{@Wiju>OpFIH%[email protected]^H*2-?hB`!FTd90RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB=DGP+(niLNnI><<)s=zr1du^M_5%wr1me>yTeMdP1|M*)Z^nU^h3XH76CnnDxZG
zZQIPszqIx)`P}RCyHp2%kL{NHw(ZR;{F2qJ>o0ANzazi=cj+th9|8nc64*3&{ICC9
z|M*|&[email protected]|*;nSvAwXc5fa8Cdkhc?9y#kK^)%$nrD<d#W!0|s!$lD35
zUIEAd>ixU*[email protected];w;[email protected]<n07juYlu!_5R)[email protected]^%8NSHSVVdjD>HWdw!^
zIR1wTc{_pCE8zHFy??j9G6IJaSe%@injD|${I}Jb7$2W*O<$hZv|2Osv+ZYj)[email protected]
zxckcdZ{sNM>hrCD%&&WAbN~Bt9v>SIce3y{0t8l-z^;Mye{Nv?&&%[email protected]@BO
zjq<MJqr8*P*TwIwhyFggo7Cz~>i**X;(Rq(-U%EZC5`o{+oOYvjQflGi}R`TX)gkt
z51bF251bF25BlFPsZ!K_(tdK>dTG71URp1$m)6TXo?`IQiv5B8f&D?fG&nvSAC3>l
zM{n!oeBgZGeBgZGe2|o?E;_p2RMJ>KtRL2o`qbh0aC|sE93S>qYj1y*A7(f&bAIMg
znMY?Hlkr4=z#0%Jqe)MeH1^B(%l6Cm%[email protected]*kF3f9Y##(HVJv|d^-t(Vrz{y!>V
zy|i8)1CNhi1DAMwi3Cc4!GDTpYI1M?-~Y?Y?NfE<RinJq3g>g5k6%}y^N$z}-l^PQ
zN}[email protected]@pFEjEbj!4kCMjurF%WjdbDwrt)2Ue`^!q#Z>z0|`-}UF`%AqwaeO#F
z93PGk*Vpp>uxb;b-%1+mhxNnyQJ*>-AC3>lhvUQk%KobVO>Fx~`$^v~s}}{whvUQX
z;[email protected]~*_^*PH57rQ_q+JwEb-0T*YUo_R**nVDy0
zo}GD4=DC^YWuBjTLFSUo3p1ByCNoo+>C8-KHZzyGEVC=KJM*H<<(c`+6`4JmR_4mg
zi!*yO`!Wle{h6yWFUh<#vzWO$^Rmp#Gq1?JGV`j;HJNKOug<(C^V-boG6yo(Wv<U0
z%)CDHhRho?Z_2zm^Onq8GjGe>ka>IN9hrA#-j#WG<~^DBX5N>1f9A%[email protected]
z%uShZ&U{PeBbjf_d|T$*GvAT<&dhgZzB}_hneWYfH1mC#k7d3;^8=Y5%=}R1hciEt
z`O(aeWqv&K6PcgP{8Z+rGe490+04&nem?UHnP1HOQs(2CU(WnW=2tVnmihI}Z)84^
zxjFNjnNMbJ$^2I4w==(!`Q6O#Wqv>N2boW0{xI`LnLp0_N#;*8f0p_4%wJ^wGV|%o
zUuFI}^Ea8#WNyv;ZRYPXf1mk>%s*ys%luR3vzdR+{7dFvGyj(PT;|_1|B?C6%ztJ6
zJM;O>|75<9`QOa{Wo~bpu{;~gf5z5j)@P2(Y{+~?<|{MDXTB=4F|#RiLS}R3#LQhX
zTQXZScg>uX*_OFm=H$#[email protected]&&wO>}Yci*0zBco9nXk``XTBlxjhS!CY|q>ybI;7_
znR{jKow-lujLdyAJ2DfQGc#vp?w8q_xqs#XnFnSblsP-|;LJlZ56zsDd06J*nMY(E
[email protected]%;PeT&paV>LFS2>CuJ_oJUR1}%te`}W}a3?j{YlYtY^pW
zdRG3Wxj&aQ?$7Se`bEF=F7-GcI3GA4I3GA4Ox1S+`$_vr-yd^)^iGn_2hIo12hIo1
z2iY|Fe)[email protected](Eup9Nw4Sb)2FHiv!|~zx=xv>x51bF251bF24_trt^P5w8`tqf7VgIgR
ze_(%Le_(%Le_(&[email protected]*&G+AY|E*pW93PGk$A{yiw`p=da6WK8a6WK8aDC17wc!_8
zt(VqI>!tP5dTG71URp1wm)!~M59|[email protected]|[email protected]|+?Ee#&8;_)gTuTn1!jt|F&<HPaM
z+d4TPI3GA4I3GA4czmbFcMiYQYQ3~xS}(1a)=TT9_0oE|{9BXu2lfZ{2lfZ{2lfZ{
z2lfZ{2b06^[email protected]@mwCyRd1RcAC3>lhvTCc70w6F2hIo12hIl`|LpP4`f~Y22Kxj1
z1N#H}1N#H}1N#H}1N(z3vnATNYlLq_c>IRPZ+QGhy>)VYI6fR7j*nhiI3GA4I3GA4
zI3IYtqsKcAztmv8v|d^-t(VqI>!tP5db#}4y#0awf&GE~f&GE~f&GE~f&IY<-?aC5
zM~`>(c*lCv<oIxWI6fR7y{[email protected](t2sVv|d^-t(Vrz
z<rn4c59|[email protected]|[email protected]|[email protected]|[email protected]$9S<lc$#6&}[email protected]*gxAp+dtbs+dtbs+dtbs
z+dtbs+doe&5sdPWmf1hsKifasKifasKifasKifasKifasKX(MCTh0g02hIo12hInb
z>jbWsxL)FViR&e<m$+WydWq{L`bZz?BYmWg^wIdt(myy>-4#53*W-8n`>b_3IzAj9
zjt|[email protected]%f%Ad$f%Ad$K`ymcQQ`YhC5`pN`eFU3PaTdA$A{[email protected]^uf93bZ4F6WP
z_0oE2y|i9hFRho>[email protected]~*dN#**dN#**dN#**dN#*`2DMXetNf`5AgE=em=nC
zH~f5npATr?2l`uM*GpV4alOR#64y&yFX=A|9?$CWtp0tKdQotEI6fR7j*s4^[email protected]#$f
z!1=)W!1*8%<[email protected]|MeQn5{z<O!Dv|d^-t(VqI|9<E22WeR^t(VqI>!tP5dTG71UM_!7
zv;Benf&GE~f&GE~f&GE~f&GD>ck%Nse%{5;yL7rhAL%1~q>uEGKGH|}NFV7VeWZ`{
zkv<yoP*[email protected]{$Fe0-gbjt|F&<HPaMyR_nb;C$eG;C$eGkV~!lQeW!J_I;rLPYc-}
z*dN#*)Juco!|~zxaD3Q5+dua=O&-5irj+&4dTG71URp1$m)6VS5ACyFS}(1a)=TT9
z_0oE2y<GlKc>4qU1N#H}1N#H}1N#H}1N#HNKiTh3_WP5ohcfB~y`UHLf?m)IdO<Jf
z1-+mb^nzaKK4fv1^MUh$^MUh$^FjF_ZjWy-X<T1(ea-bX*VkNMbA8SAHP_c%U(?fi
zT2Jd~JzYklo-S$hw4T<}dRkBGX+5o{^|YSW(|[email protected]>*+EY^>j(2r}ea+*3)`gPwQzt
zt*7<0p4QWPT2GhJsHaOBJ*}tpw4T<}dRkBGX+5o{^|YSW(|Wp$Mm=59=xIHzr}ea+
z*3)`gPwQztt*7<0p4QW4H0tS+Mo;T$J*}tpw4T<}dRkBGX+5o{^|YQYqft+nG<sT3
z>uEi$r}ea+*3)`gPwQztt*7;L8I5|nq|wuQT2Jd~J*}tpw4T<}dRkBGX+5o{%V^Zo
[email protected](|[email protected]>uEi$r}ea+*3)`gPwQztT}[email protected]||%p4QWPT2Jd~J*}tpw4T<}dRkBG
z=`tGibV;M9^|YSW(|[email protected]>uEi$r}ea+*3)`gPnXfCr%M_=t*7<0p4QWPT2Jd~J*}tp
zw4T<}db*58Jzdi1X+5o{^|YSW(|[email protected]>uEi$r}ea+*3)G)>gke3PwQztt*7<0p4QWP
zT2Jd~J*}[email protected]+5o{^|YSW(|[email protected]>uEi$r}cChje5GI(bIZbPwQzt
zt*7<0p4QWPT2Jd~J*}[email protected]!idRkBGX+5o{^|YSW(|[email protected]>uEh*Mx&lCY4o(7
z*3)`gPwQztt*7<0p4QWPT2JfgG8*-CNu#Irw4T<}dRkBGX+5o{^|YSW(|[email protected](i%F
zOBy|`r}ea+*3)`gPwQztt*7<0p4QWPx{O9WUDD`jJ*}tpw4T<}dRkBGX+5o{^|YSW
z(`7X3>[email protected]>uEi$r}ea+*3)`gPwQztt*7<0o-U([email protected]$T2Jd~J*}tpw4T<}dRkBG
zX+5o{^>i7Hdb*_1(|[email protected]>uEi$r}ea+*3)`gPwQztt*6Uq)YB!6p4QWPT2Jd~J*}tp
zw4T<}dRkBGX+2#=qn<8l^t7JV(|[email protected]>uEi$r}ea+*3)`gPwVM28ufHZqo?(>p4QWP
zT2Jd~J*}tpw4T<}dRkAH(Ws|O8a=J2^|YSW(|[email protected]>uEi$r}ea+*3){rj7B|O(&%YD
zt*7<0p4QWPT2Jd~J*}tpw4T<}Wi;yPl15MKX+5o{^|YSW(|[email protected]>uEi$r}ea+E~8OT
zmo$1>PwQztt*7<0p4QWPT2Jd~J*}tpbQz6$x}?$5dRkBGX+5o{^|YSW(|[email protected]>uEi$
zr^{&6(<P0b*3)`gPwQztt*7<0p4QWPT2Jd~JzYklo-S$hw4T<}dRkBGX+5o{^|YSW
z(|[email protected]>*+EY^>j(2r}ea+*3)`gPwQztt*7<0p4QWPT2GhJsHaOBJ*}tpw4T<}dRkBG
zX+5o{^|YSW(|Wp$Mm=59=xIHzr}ea+*3)`gPwQztt*7<0p4QW4H0tS+Mo;T$J*}tp
zw4T<}dRkBGX+5o{^|YQYqft+nG<sT3>uEi$r}ea+*3)`gPwQztt*7;L8I5|nq|wuQ
zT2JfgFGf!{&Dhf$PXq|8QGu~%<Q(wK%(F7j&O9gc+|2Vb&(FLdb4lifnM*[email protected]
zW+pS6naf<3*_GLyc~R!_%zWmG%$`gub7khmnZ22PnT5>$%vG6}WL}zC%v_y$S?1-L
zS7ct9c~$0`%(a<UXI_(eZRT~E1DWeG*Jlo9UY~hG=8c&*W!{{5OXjVaw`Fd~ygl=d
z%sVsh%[email protected]{VDb7STMYxIuc%U%NllY1w|^@YCB7y9Ch(HG7yO9Iobf4lze
z`nT)f<waiCze^hXQ~Oi<Q~Oi<Q;#R}cruSC^LR3kC)3k<T2JfgG8*-CNu#Irw4T<}
zdRkBGX+5o{^|YSW(|[email protected](i%FOBy|`r}ea+*3)`gPwQztt*7<0p4QWPx{O9WUDD`j
zJ*}tpw4T<}dRkBGX+5o{^|YSW(`7X3>[email protected]>uEi$r}ea+*3)`gPwQztt*7<0o-U(N
[email protected]$T2Jd~J*}tpw4T<}dRkBGX+5o{^>i7Hdb*_1(|[email protected]>uEi$r}ea+*3)`gPwQzt
zt*6Uq)YB!6p4QWPT2Jd~J*}tpw4T<}dRkBGX+2#=qn<8l^t7JV(|[email protected]>uEi$r}ea+
z*3)`gPwVM28ufHZqo?(>p4QWPT2Jd~J*}tpw4T<}dRkAH(Ws|O8a=J2^|YSW(|[email protected]
z>uEi$r}ea+*3){rj7B|O(&%YDt*7<0p4QWPT2Jd~J*}tpw4T<}Wi;yPl15MKX+5o{
z^|YSW(|[email protected]>uEi$r}ea+E~8OTmo$1>PwQztt*7<0p4QWPT2Jd~J*}tpbQz6$x}?$5
zdRkBGX+5o{^|YSW(|[email protected]>uEi$r^{&6(<P0b*3)`gPwQztt*7<0p4QWPT2Jd~JzYkl
zo-S$hw4T<}dRkBGX+5o{^|YSW(|[email protected]>*+EY^>j(2r}ea+*3)`gPwQztt*7<0p4QWP
zT2GhJsHaOBJ*}tpw4Pp#J>9JGr^zq((<=A%<q<f>1-3RPG-DH;|C8(T^16x6AMV<0
zX^x-Sy?4jL?7oG(`J`rBvnhX`[email protected]=M**4SKKQ%wQWA~mz-*~rt{D!&t{d04j
z&wX;<_oV(iExn=tc}{6gZ8p!h_FT4O-{KYh*EV_Wwr1meYu~~dbFKY*W|ltD-Pd2#
ztWT?TKCAx{[email protected]@oviG<@TlV&Z|awr*[email protected][email protected]#h+ffH0keS
ze5P|(E$*c5FL%oQW#dtwNqisy0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N
z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+
z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly
zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF
z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk
z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs
z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ
zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U
zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7
e2oNAZfB*pk1PBlyK!5-N0t5&UAV6Sk2>d?)UC1>6

diff --git a/tests/f_swapfs/image.gz b/tests/f_swapfs/image.gz
deleted file mode 100644
index 852231bd45d70b4c3bb64fffc0588960ef5d34b8..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 3777
zcmeH}TToN^8NksLwYx=kT7`BYVrvC4K)eLJAf&5<j%CRfMD7HXgd>nZ<+>0ct5ld8
z?vYy#32u=M_mp#%AZUmqE0}P}atZh+2yP>W#S>zn1Tc`)=}aH`;>`B7{2sq==9_PR
zPd|Iku3g3BbdT-0SmsrTZlQg#[email protected]~}jubisz3%z$ZPI>NTnFal>WHk?gU<aq0
zq&>[email protected]&ap0j)[email protected][email protected]~&N
z9+Kv6(B8)%H9Ob_?uB0q)p4AE=x5+}zVi_YSy2o3or1{Ik9_?K2;X>yj3rCuZ*VHs
zyXaMGMM1`O)8?K*[email protected]_Xi(7UP0kOV8nfC{gd^nL_PG}`zneXCE-JR^Hw$lY
ze`m~lC{|&Q8-JWNRYtPUwqKqj9w`2tPnsK<xiWLSrJ=QZ_DoLzj#}_W(Z}gFDXrDb
zi=7GXPGQ6_vg!a_!>m$5R^UQ;K)dXkomsHVx%PP*`^B;YrJ8k#o;[email protected]{LV6~aAV
zCF;Fq^_;[email protected];y+0Eo&JcUMyQz+=j;PKM*eB9ejE4*(BcIX#^[email protected]~
zME<Gz#B5z^q!Rad5$p#7K%LV$LPnag!u}z$iQ*6([email protected]~DOK
zX^>A?kk0_;?K;t3x)JvFPesNQFN3hz%e2rh^@w~N*&V+_zs9;?+DKh((<#_1dR=B|
[email protected]$_p&g=%GG>((*[email protected])?6<GMK$R~g3k4!G<C#JfI-6lK5
z#6=?Qp1Sy%Lby9?<B*r-jx(lDbB$|[email protected]>@aVvuhh(zew4*[email protected]{>~Cy&SF{K?n~qWU
z)FRSzb$SXV!6~)lq?LX}s?%$L#*Est7b&#QhQ6;gTYP}G=9UdRX&r|r(1_X|[email protected]=(y
z0RnD%_%Wm*XLMx5d%ep)f0b;Lw4UKJ>Dp(_$-FjE&YE#=3m)fAw2h9n5zcf&tK?$l
z`sv_);o7ug2%hUJvh{P;bIse$$_7o1`3vQhVRn?|u|c6ljrpr(`#+m-!|ccFdrq0R
zX~-`(cK&[email protected]&Zs%|b>mWW<M`35PX<Q^xtY|[email protected]$`e
zh+kg4edC<6{_FaM(eM4cNC63-4)QZa_L)D8^RueP!*}>-1QLP1*x>F8zWN|%;m7~N
zMdvxY?TOheOll$xSB<foUd=5v`ggs5DD=DaM&VE5BuNtM?Pphp=iw{x0(>dH8efj*
z<GFYkUx}~vRm9K=!C;G1{BS4|GRMAL(h=hr<49)$ti_W+cZ7trWTdF&#2Yzfh%!J?
zbfYJb6DW$HXfl$FE+fn6$H>Ph2jQSy;1H+>k1zyV!tP*ltO;Adc-R!yjlIM2us-Y?
z>@`+_O<-coz{p9vm<FW<rKO7xu(Az#m;fsTFme(~l+ExYE-aRz2;&[email protected]!(I0bVw(g
zfh9y1+i(-h1^[email protected]%XT(?Y4|I~1w!Nts8;3$XS+Tm8?y|zF%GCih)|@ghv!+6
z?ZP_BI&91|6k;&w1)WGDG%MRL>w&Y0#vDT~mJf;%dx$K{;d$~losAg=4%Uw8u}UC9
zA|a_P2lg!8bY&ekW*hRcVo-|+5i-P<nRuHnMwTJPP>[email protected]&ov`cEv~i|
zRtjpFgk)PPaki~4lwW`dbOO{&YmSLVlt?>xz*u1vGKLsg;y}X^whv4J0vbdY4Li_8
zGAb-_g{xY*t+20rVqiky{>%ZgjadmfFZL7P5MOdXq#~)DRcBSdgL%wqW;v73<T7Dq
zC9_srqOH>2)z)asv^;HvR-i4_R%^?([email protected]&+2_!4{-{w_Y;6dX=o`R5i}2DS|R
zpBWG&Po9taD9SSR`mnhd=|vAB2hlpD4vj{lQ8l7Qe*^_B$KYx=`cR0EJHg|(@k5kB
zihK$IA*?_-Wtbv+O~Z#k6Xkp!zk)AFg&-Of1JNN!L({})=o-j|W)ovWw}FyTAH)aE
[email protected][email protected]_V=m4o;1z3SX;0uO;3upyQpamP)?#YW4(LFh%V_ST{K-diHX;MPp
zXrP79Kouj!?=tC?W=c>Q&&hj)[email protected]&;zxE^jr|{s({(W_F(fh>1x|~EdPp8(~8^@K;
zC&Fi^s4IO+)(rd0k<kg|Xj$dte3$O|-^>)x#D<iKK~<j(VIQ;[email protected]^5()On
zv;^IJ&9whQT;h>C9Z9O2sj1#=BRR`2Ef?C}`8PBMESUWd6Dy^Ao2E%s9xFML`$AzS
hX1LJ(`|Tg7zOB`kf&bmWSrHpoSMc*478aja{0rPd(2D>7

diff --git a/tests/f_swapfs/name b/tests/f_swapfs/name
deleted file mode 100644
index b4520ba..0000000
--- a/tests/f_swapfs/name
+++ /dev/null
@@ -1 +0,0 @@
-checking the e2fsck swapfs functionality
diff --git a/tests/f_swapfs/script b/tests/f_swapfs/script
deleted file mode 100644
index 75f9fb4..0000000
--- a/tests/f_swapfs/script
+++ /dev/null
@@ -1,79 +0,0 @@
-if $FSCK -SV > /dev/null 2>&1 ; then
- IMAGE=$test_dir/image.gz
- VERIFY_FSCK_OPT=-yf
- SWAP_FSCK_OPT=-Sy
- NATIVE_FSCK_OPT=-sy
- OUT=$test_name.log
- EXP=$test_dir/expect
-
- gunzip < $IMAGE > $TMPFILE
-
- echo "Swapfs test" > $OUT
-
- echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
- $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '2d' $OUT.new >> $OUT
-
- echo e2fsck $SWAP_FSCK_OPT -N test_filesys > $OUT.new
- $FSCK $SWAP_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '2d' $OUT.new >> $OUT
-
- echo Running debugfs.... >> $OUT
- $DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE > $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '1d' $OUT.new >> $OUT
-
- echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
- $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '2d' $OUT.new >> $OUT
-
- echo e2fsck $NATIVE_FSCK_OPT -N test_filesys > $OUT.new
- $FSCK $NATIVE_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '2d' $OUT.new >> $OUT
-
- echo Running debugfs.... >> $OUT
- $DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE > $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '1d' $OUT.new >> $OUT
-
- echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
- $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
- status=$?
- echo Exit status is $status >> $OUT.new
- sed -e '2d' $OUT.new >> $OUT
- rm -f $OUT.new
-
- rm $TMPFILE
-
- #
- # Do the verification
- #
-
- rm -f $test_name.ok $test_name.failed
- cmp -s $OUT $EXP
- status=$?
-
- if [ "$status" = 0 ] ; then
- echo "ok"
- touch $test_name.ok
- else
- echo "failed"
- diff $DIFF_OPTS $EXP $OUT > $test_name.failed
- fi
-
- unset IMAGE VERIFY_FSCK_OPT SWAP_FSCK_OPT NATIVE_FSCK_OPT OUT EXP
-
-else
- rm -f $test_name.ok $test_name.failed
- echo "skipped"
-fi
--
1.5.3.rc4.67.gf9286

2007-08-12 16:58:36

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Clean up libext2fs by byte swapping iff WORDS_BIGENDIAN

We don't need byte swapping to be a run-time option; it can just be a
compile-time option instead.

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
lib/ext2fs/bmap.c | 28 ++++++-----------
lib/ext2fs/closefs.c | 77 ++++++++++++++++++++---------------------------
lib/ext2fs/dirblock.c | 40 +++++++------------------
lib/ext2fs/ext_attr.c | 24 ++++++---------
lib/ext2fs/ind_block.c | 20 +++++-------
lib/ext2fs/inode.c | 52 +++++++++++++------------------
lib/ext2fs/openfs.c | 23 +++++++-------
7 files changed, 105 insertions(+), 159 deletions(-)

diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index e840044..1dd562d 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -51,10 +51,8 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,

if (flags & BMAP_SET) {
b = *ret_blk;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
- b = ext2fs_swab32(b);
+#ifdef WORDS_BIGENDIAN
+ b = ext2fs_swab32(b);
#endif
((blk_t *) block_buf)[nr] = b;
return io_channel_write_blk(fs->io, ind, 1, block_buf);
@@ -62,10 +60,8 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,

b = ((blk_t *) block_buf)[nr];

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
- b = ext2fs_swab32(b);
+#ifdef WORDS_BIGENDIAN
+ b = ext2fs_swab32(b);
#endif

if (!b && (flags & BMAP_ALLOC)) {
@@ -75,13 +71,11 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags,
if (retval)
return retval;

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
- ((blk_t *) block_buf)[nr] = ext2fs_swab32(b);
- else
+#ifdef WORDS_BIGENDIAN
+ ((blk_t *) block_buf)[nr] = ext2fs_swab32(b);
+#else
+ ((blk_t *) block_buf)[nr] = b;
#endif
- ((blk_t *) block_buf)[nr] = b;

retval = io_channel_write_blk(fs->io, ind, 1, block_buf);
if (retval)
@@ -167,10 +161,8 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
if (block < EXT2_NDIR_BLOCKS) {
if (bmap_flags & BMAP_SET) {
b = *phys_blk;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
- b = ext2fs_swab32(b);
+#ifdef WORDS_BIGENDIAN
+ b = ext2fs_swab32(b);
#endif
inode_bmap(inode, block) = b;
inode_dirty++;
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 474e00e..c570256 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -191,12 +191,11 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group,

if (sgrp > ((1 << 16) - 1))
sgrp = (1 << 16) - 1;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES)
- super_shadow->s_block_group_nr = ext2fs_swab16(sgrp);
- else
+#ifdef WORDS_BIGENDIAN
+ super_shadow->s_block_group_nr = ext2fs_swab16(sgrp);
+#else
+ fs->super->s_block_group_nr = sgrp;
#endif
- fs->super->s_block_group_nr = sgrp;

return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE,
super_shadow);
@@ -220,29 +219,23 @@ errcode_t ext2fs_flush(ext2_filsys fs)

fs->super->s_wtime = fs->now ? fs->now : time(NULL);
fs->super->s_block_group_nr = 0;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- retval = EXT2_ET_NO_MEMORY;
- retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super_shadow);
- if (retval)
- goto errout;
- retval = ext2fs_get_mem((size_t)(fs->blocksize *
- fs->desc_blocks),
- &group_shadow);
- if (retval)
- goto errout;
- memset(group_shadow, 0, (size_t) fs->blocksize *
- fs->desc_blocks);
-
- /* swap the group descriptors */
- for (j=0, s=fs->group_desc, t=group_shadow;
- j < fs->group_desc_count; j++, t++, s++) {
- *t = *s;
- ext2fs_swap_group_desc(t);
- }
- } else {
- super_shadow = fs->super;
- group_shadow = fs->group_desc;
+#ifdef WORDS_BIGENDIAN
+ retval = EXT2_ET_NO_MEMORY;
+ retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super_shadow);
+ if (retval)
+ goto errout;
+ retval = ext2fs_get_mem((size_t)(fs->blocksize * fs->desc_blocks),
+ &group_shadow);
+ if (retval)
+ goto errout;
+ memset(group_shadow, 0, (size_t) fs->blocksize *
+ fs->desc_blocks);
+
+ /* swap the group descriptors */
+ for (j=0, s=fs->group_desc, t=group_shadow;
+ j < fs->group_desc_count; j++, t++, s++) {
+ *t = *s;
+ ext2fs_swap_group_desc(t);
}
#else
super_shadow = fs->super;
@@ -255,11 +248,9 @@ errcode_t ext2fs_flush(ext2_filsys fs)
* we write out the backup superblocks.)
*/
fs->super->s_state &= ~EXT2_VALID_FS;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- *super_shadow = *fs->super;
- ext2fs_swap_super(super_shadow);
- }
+#ifdef WORDS_BIGENDIAN
+ *super_shadow = *fs->super;
+ ext2fs_swap_super(super_shadow);
#endif

/*
@@ -333,11 +324,9 @@ write_primary_superblock_only:

fs->super->s_block_group_nr = 0;
fs->super->s_state = fs_state;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- *super_shadow = *fs->super;
- ext2fs_swap_super(super_shadow);
- }
+#ifdef WORDS_BIGENDIAN
+ *super_shadow = *fs->super;
+ ext2fs_swap_super(super_shadow);
#endif

retval = io_channel_flush(fs->io);
@@ -350,12 +339,12 @@ write_primary_superblock_only:
retval = io_channel_flush(fs->io);
errout:
fs->super->s_state = fs_state;
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- if (super_shadow)
- ext2fs_free_mem(&super_shadow);
- if (group_shadow)
- ext2fs_free_mem(&group_shadow);
- }
+#ifdef WORDS_BIGENDIAN
+ if (super_shadow)
+ ext2fs_free_mem(&super_shadow);
+ if (group_shadow)
+ ext2fs_free_mem(&group_shadow);
+#endif
return retval;
}

diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c
index ebfc72c..fb20fa0 100644
--- a/lib/ext2fs/dirblock.c
+++ b/lib/ext2fs/dirblock.c
@@ -25,26 +25,21 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
errcode_t retval;
char *p, *end;
struct ext2_dir_entry *dirent;
- unsigned int name_len, rec_len, do_swap;
+ unsigned int name_len, rec_len;


retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
return retval;
-#ifdef EXT2FS_ENABLE_SWAPFS
- do_swap = (fs->flags & (EXT2_FLAG_SWAP_BYTES|
- EXT2_FLAG_SWAP_BYTES_READ)) != 0;
-#endif
+
p = (char *) buf;
end = (char *) buf + fs->blocksize;
while (p < end-8) {
dirent = (struct ext2_dir_entry *) p;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (do_swap) {
- dirent->inode = ext2fs_swab32(dirent->inode);
- dirent->rec_len = ext2fs_swab16(dirent->rec_len);
- dirent->name_len = ext2fs_swab16(dirent->name_len);
- }
+#ifdef WORDS_BIGENDIAN
+ dirent->inode = ext2fs_swab32(dirent->inode);
+ dirent->rec_len = ext2fs_swab16(dirent->rec_len);
+ dirent->name_len = ext2fs_swab16(dirent->name_len);
#endif
name_len = dirent->name_len;
#ifdef WORDS_BIGENDIAN
@@ -73,22 +68,12 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
void *inbuf, int flags EXT2FS_ATTR((unused)))
{
-#ifdef EXT2FS_ENABLE_SWAPFS
- int do_swap = 0;
+#ifdef WORDS_BIGENDIAN
errcode_t retval;
char *p, *end;
char *buf = 0;
struct ext2_dir_entry *dirent;

- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
- do_swap = 1;
-
-#ifndef WORDS_BIGENDIAN
- if (!do_swap)
- return io_channel_write_blk(fs->io, block, 1, (char *) inbuf);
-#endif
-
retval = ext2fs_get_mem(fs->blocksize, &buf);
if (retval)
return retval;
@@ -103,15 +88,12 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
return (EXT2_ET_DIR_CORRUPTED);
}
p += dirent->rec_len;
- if (do_swap) {
- dirent->inode = ext2fs_swab32(dirent->inode);
- dirent->rec_len = ext2fs_swab16(dirent->rec_len);
- dirent->name_len = ext2fs_swab16(dirent->name_len);
- }
-#ifdef WORDS_BIGENDIAN
+ dirent->inode = ext2fs_swab32(dirent->inode);
+ dirent->rec_len = ext2fs_swab16(dirent->rec_len);
+ dirent->name_len = ext2fs_swab16(dirent->name_len);
+
if (flags & EXT2_DIRBLOCK_V2_STRUCT)
dirent->name_len = ext2fs_swab16(dirent->name_len);
-#endif
}
retval = io_channel_write_blk(fs->io, block, 1, buf);
ext2fs_free_mem(&buf);
diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c
index 08211c3..ee5fe16 100644
--- a/lib/ext2fs/ext_attr.c
+++ b/lib/ext2fs/ext_attr.c
@@ -30,10 +30,8 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf)
retval = io_channel_read_blk(fs->io, block, 1, buf);
if (retval)
return retval;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & (EXT2_FLAG_SWAP_BYTES|
- EXT2_FLAG_SWAP_BYTES_READ)) != 0)
- ext2fs_swap_ext_attr(buf, buf, fs->blocksize, 1);
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_ext_attr(buf, buf, fs->blocksize, 1);
#endif
return 0;
}
@@ -44,17 +42,15 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)
char *write_buf;
char *buf = NULL;

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
- retval = ext2fs_get_mem(fs->blocksize, &buf);
- if (retval)
- return retval;
- write_buf = buf;
- ext2fs_swap_ext_attr(buf, inbuf, fs->blocksize, 1);
- } else
+#ifdef WORDS_BIGENDIAN
+ retval = ext2fs_get_mem(fs->blocksize, &buf);
+ if (retval)
+ return retval;
+ write_buf = buf;
+ ext2fs_swap_ext_attr(buf, inbuf, fs->blocksize, 1);
+#else
+ write_buf = (char *) inbuf;
#endif
- write_buf = (char *) inbuf;
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
if (buf)
ext2fs_free_mem(&buf);
diff --git a/lib/ext2fs/ind_block.c b/lib/ext2fs/ind_block.c
index 3519048..9baa37f 100644
--- a/lib/ext2fs/ind_block.c
+++ b/lib/ext2fs/ind_block.c
@@ -34,12 +34,10 @@ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf)
if (retval)
return retval;
}
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_READ)) {
- block_nr = (blk_t *) buf;
- for (i = 0; i < limit; i++, block_nr++)
- *block_nr = ext2fs_swab32(*block_nr);
- }
+#ifdef WORDS_BIGENDIAN
+ block_nr = (blk_t *) buf;
+ for (i = 0; i < limit; i++, block_nr++)
+ *block_nr = ext2fs_swab32(*block_nr);
#endif
return 0;
}
@@ -53,12 +51,10 @@ errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf)
if (fs->flags & EXT2_FLAG_IMAGE_FILE)
return 0;

-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_WRITE)) {
- block_nr = (blk_t *) buf;
- for (i = 0; i < limit; i++, block_nr++)
- *block_nr = ext2fs_swab32(*block_nr);
- }
+#ifdef WORDS_BIGENDIAN
+ block_nr = (blk_t *) buf;
+ for (i = 0; i < limit; i++, block_nr++)
+ *block_nr = ext2fs_swab32(*block_nr);
#endif
return io_channel_write_blk(fs->io, blk, 1, buf);
}
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 49d012c..6f24b61 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -453,32 +453,28 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
scan->ptr += scan->inode_size - extra_bytes;
scan->bytes_left -= scan->inode_size - extra_bytes;

-#ifdef EXT2FS_ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
memset(inode, 0, bufsize);
- if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
- ext2fs_swap_inode_full(scan->fs,
- (struct ext2_inode_large *) inode,
- (struct ext2_inode_large *) scan->temp_buffer,
- 0, bufsize);
- else
+ ext2fs_swap_inode_full(scan->fs,
+ (struct ext2_inode_large *) inode,
+ (struct ext2_inode_large *) scan->temp_buffer,
+ 0, bufsize);
+#else
+ *inode = *((struct ext2_inode *) scan->temp_buffer);
#endif
- *inode = *((struct ext2_inode *) scan->temp_buffer);
if (scan->scan_flags & EXT2_SF_BAD_EXTRA_BYTES)
retval = EXT2_ET_BAD_BLOCK_IN_INODE_TABLE;
scan->scan_flags &= ~EXT2_SF_BAD_EXTRA_BYTES;
} else {
-#ifdef EXT2FS_ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
memset(inode, 0, bufsize);
- if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
- ext2fs_swap_inode_full(scan->fs,
+ ext2fs_swap_inode_full(scan->fs,
(struct ext2_inode_large *) inode,
(struct ext2_inode_large *) scan->ptr,
0, bufsize);
- else
+#else
+ memcpy(inode, scan->ptr, bufsize);
#endif
- memcpy(inode, scan->ptr, bufsize);
scan->ptr += scan->inode_size;
scan->bytes_left -= scan->inode_size;
if (scan->scan_flags & EXT2_SF_BAD_INODE_BLK)
@@ -583,12 +579,10 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
block_nr++;
}

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
- ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode,
- (struct ext2_inode_large *) inode,
- 0, bufsize);
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode,
+ (struct ext2_inode_large *) inode,
+ 0, bufsize);
#endif

/* Update the inode cache */
@@ -657,16 +651,14 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
w_inode = &temp_inode;
memset(w_inode, 0, length);

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
- ext2fs_swap_inode_full(fs, w_inode,
- (struct ext2_inode_large *) inode,
- 1, bufsize);
- else
+#ifdef WORDS_BIGENDIAN
+ ext2fs_swap_inode_full(fs, w_inode,
+ (struct ext2_inode_large *) inode,
+ 1, bufsize);
+#else
+ memcpy(w_inode, inode, bufsize);
#endif
- memcpy(w_inode, inode, bufsize);
-
+
group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
EXT2_INODE_SIZE(fs->super);
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 55cc077..f2790ad 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -178,12 +178,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
if (fs->orig_super)
memcpy(fs->orig_super, fs->super, SUPERBLOCK_SIZE);

-#ifdef EXT2FS_ENABLE_SWAPFS
- if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES)) {
- fs->flags |= EXT2_FLAG_SWAP_BYTES;
-
- ext2fs_swap_super(fs->super);
+#ifdef WORDS_BIGENDIAN
+ fs->flags |= EXT2_FLAG_SWAP_BYTES;
+ ext2fs_swap_super(fs->super);
+#else
+ if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
+ retval = EXT2_ET_UNIMPLEMENTED;
+ goto cleanup;
}
#endif

@@ -289,12 +290,10 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
retval = io_channel_read_blk(fs->io, blk, 1, dest);
if (retval)
goto cleanup;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- gdp = (struct ext2_group_desc *) dest;
- for (j=0; j < groups_per_block; j++)
- ext2fs_swap_group_desc(gdp++);
- }
+#ifdef WORDS_BIGENDIAN
+ gdp = (struct ext2_group_desc *) dest;
+ for (j=0; j < groups_per_block; j++)
+ ext2fs_swap_group_desc(gdp++);
#endif
dest += fs->blocksize;
}
--
1.5.3.rc4.67.gf9286

2007-08-12 16:58:39

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Clean up applications to not use EXT2FS_ENABLE_SWAPFS or EXT2_FLAG_SWAP_BYTES

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
debugfs/logdump.c | 2 +-
e2fsck/journal.c | 2 +-
e2fsck/util.c | 2 +-
misc/dumpe2fs.c | 7 -------
misc/e2image.c | 8 +++-----
5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 2bf67b5..724193e 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -350,7 +350,7 @@ static void dump_journal(char *cmdname, FILE *out_file,

jsb = (journal_superblock_t *) buf;
sb = (struct ext2_super_block *) (buf+1024);
-#ifdef ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
if (sb->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))
ext2fs_swap_super(sb);
#endif
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 756bbcb..eebd22f 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -385,7 +385,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
memcpy(&jsuper, start ? bh->b_data : bh->b_data + 1024,
sizeof(jsuper));
brelse(bh);
-#ifdef EXT2FS_ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
if (jsuper.s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))
ext2fs_swap_super(&jsuper);
#endif
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 59a08b9..ba7ef4a 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -481,7 +481,7 @@ blk_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name,
if (io_channel_read_blk(io, superblock,
-SUPERBLOCK_SIZE, buf))
continue;
-#ifdef EXT2FS_ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
if (sb->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC))
ext2fs_swap_super(sb);
#endif
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index b1dc607..d4d95bb 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -344,7 +344,6 @@ int main (int argc, char ** argv)
int force = 0;
int flags;
int header_only = 0;
- int big_endian;
int c;

#ifdef ENABLE_NLS
@@ -415,12 +414,6 @@ int main (int argc, char ** argv)
if (print_badblocks) {
list_bad_blocks(fs, 1);
} else {
- big_endian = ((fs->flags & EXT2_FLAG_SWAP_BYTES) != 0);
-#ifdef WORDS_BIGENDIAN
- big_endian = !big_endian;
-#endif
- if (big_endian)
- printf(_("Note: This is a byte-swapped filesystem\n"));
list_super (fs->super);
if (fs->super->s_feature_incompat &
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
diff --git a/misc/e2image.c b/misc/e2image.c
index dd13cea..1fbb267 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -346,9 +346,8 @@ static void scramble_dir_block(ext2_filsys fs, blk_t blk, char *buf)
for (p = buf; p < end-8; p += rec_len) {
dirent = (struct ext2_dir_entry_2 *) p;
rec_len = dirent->rec_len;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES)
- rec_len = ext2fs_swab16(rec_len);
+#ifdef WORDS_BIGENDIAN
+ rec_len = ext2fs_swab16(rec_len);
#endif
#if 0
printf("rec_len = %d, name_len = %d\n", rec_len, dirent->name_len);
@@ -359,8 +358,7 @@ static void scramble_dir_block(ext2_filsys fs, blk_t blk, char *buf)
"bad rec_len (%d)\n", (unsigned long) blk,
rec_len);
rec_len = end - p;
-#ifdef EXT2FS_ENABLE_SWAPFS
- if (fs->flags & EXT2_FLAG_SWAP_BYTES)
+#ifdef WORDS_BIGENDIAN
dirent->rec_len = ext2fs_swab16(rec_len);
#endif
continue;
--
1.5.3.rc4.67.gf9286

2007-08-12 16:58:45

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Remove configure --enable-swapfs and associated support #defines

This removes the last vestiges of support for the legacy PowerPC
big-endian filesystem format.

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
configure | 33 ++-------------------------------
configure.in | 20 --------------------
debian/rules | 6 ++----
lib/ext2fs/Makefile.in | 4 +---
lib/ext2fs/bitops.h | 32 +-------------------------------
lib/ext2fs/ext2fs.h | 9 ---------
lib/ext2fs/swapfs.c | 2 +-
7 files changed, 7 insertions(+), 99 deletions(-)

diff --git a/configure b/configure
index 5c8448a..ee087b4 100755
--- a/configure
+++ b/configure
@@ -684,7 +684,6 @@ CHECKER_CMT
LIB_EXT
STATIC_LIB_EXT
PROFILED_LIB_EXT
-SWAPFS_CMT
DEBUGFS_CMT
IMAGER_CMT
RESIZER_CMT
@@ -1368,7 +1367,6 @@ Optional Features:
--enable-jbd-debug enable journal debugging
--enable-blkid-debug enable blkid debugging
--enable-testio-debug enable the use of the test I/O manager for debugging
- --disable-swapfs disable support of legacy byte-swapped filesystems
--disable-debugfs disable support of debugfs program
--disable-imager disable support of e2image program
--disable-resizer disable support of e2resize program
@@ -3992,32 +3990,6 @@ else

fi

-# Check whether --enable-swapfs was given.
-if test "${enable_swapfs+set}" = set; then
- enableval=$enable_swapfs; if test "$enableval" = "no"
-then
- SWAPFS_CMT=#
- echo "Disabling swapfs support"
-else
- SWAPFS_CMT=
- cat >>confdefs.h <<\_ACEOF
-#define ENABLE_SWAPFS 1
-_ACEOF
-
- echo "Enabling swapfs support"
-fi
-
-else
- SWAPFS_CMT=
-echo "Enabling swapfs support by default"
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_SWAPFS 1
-_ACEOF
-
-
-fi
-
-
# Check whether --enable-debugfs was given.
if test "${enable_debugfs+set}" = set; then
enableval=$enable_debugfs; if test "$enableval" = "no"
@@ -15694,11 +15666,11 @@ CHECKER_CMT!$CHECKER_CMT$ac_delim
LIB_EXT!$LIB_EXT$ac_delim
STATIC_LIB_EXT!$STATIC_LIB_EXT$ac_delim
PROFILED_LIB_EXT!$PROFILED_LIB_EXT$ac_delim
-SWAPFS_CMT!$SWAPFS_CMT$ac_delim
DEBUGFS_CMT!$DEBUGFS_CMT$ac_delim
IMAGER_CMT!$IMAGER_CMT$ac_delim
RESIZER_CMT!$RESIZER_CMT$ac_delim
E2FSCK_TYPE!$E2FSCK_TYPE$ac_delim
+FSCK_PROG!$FSCK_PROG$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
@@ -15768,7 +15740,6 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
-FSCK_PROG!$FSCK_PROG$ac_delim
FSCK_MAN!$FSCK_MAN$ac_delim
E2INITRD_PROG!$E2INITRD_PROG$ac_delim
E2INITRD_MAN!$E2INITRD_MAN$ac_delim
@@ -15851,7 +15822,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF

- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.in b/configure.in
index 011df1a..e434454 100644
--- a/configure.in
+++ b/configure.in
@@ -361,26 +361,6 @@ fi
echo "Disabling testio debugging by default"
)
dnl
-dnl handle --enable-swapfs
-dnl
-AC_ARG_ENABLE([swapfs],
-[ --disable-swapfs disable support of legacy byte-swapped filesystems],
-if test "$enableval" = "no"
-then
- SWAPFS_CMT=#
- echo "Disabling swapfs support"
-else
- SWAPFS_CMT=
- AC_DEFINE(ENABLE_SWAPFS)
- echo "Enabling swapfs support"
-fi
-,
-SWAPFS_CMT=
-echo "Enabling swapfs support by default"
-AC_DEFINE(ENABLE_SWAPFS)
-)
-AC_SUBST(SWAPFS_CMT)
-dnl
dnl handle --enable-debugfs
dnl
AC_ARG_ENABLE([debugfs],
diff --git a/debian/rules b/debian/rules
index bb3f1d3..d8411f6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -92,13 +92,11 @@ STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression \
--enable-blkid-devmapper

BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
- --disable-nls --disable-swapfs --disable-imager \
+ --disable-nls --disable-imager \
--disable-debugfs --disable-e2initrd-helper

MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
- --disable-nls \
- --disable-swapfs --disable-imager \
- --disable-resizer # --disable-debugfs
+ --disable-nls --disable-imager --disable-resizer # --disable-debugfs

# we can't use those flags at configure time
MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in
index 70e18e7..03ce131 100644
--- a/lib/ext2fs/Makefile.in
+++ b/lib/ext2fs/Makefile.in
@@ -243,12 +243,10 @@ mkjournal: mkjournal.c $(STATIC_LIBEXT2FS)
@echo " LD [email protected]"
@$(CC) -o mkjournal $(srcdir)/mkjournal.c -DDEBUG $(STATIC_LIBEXT2FS) $(LIBCOM_ERR) $(ALL_CFLAGS)

-check:: tst_bitops tst_badblocks tst_iscan @[email protected] tst_byteswap \
- tst_types tst_icount tst_super_size
+check:: tst_bitops tst_badblocks tst_iscan tst_types tst_icount tst_super_size
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_bitops
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_badblocks
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_iscan
[email protected][email protected] LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_byteswap
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_types
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_icount
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_super_size
diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
index eed1a49..d83ce8e 100644
--- a/lib/ext2fs/bitops.h
+++ b/lib/ext2fs/bitops.h
@@ -274,36 +274,6 @@ _INLINE_ int ext2fs_find_next_bit_set (void * addr, int size, int offset)
}
#endif

-#ifdef EXT2FS_ENABLE_SWAPFS
-_INLINE_ __u32 ext2fs_swab32(__u32 val)
-{
-#ifdef EXT2FS_REQUIRE_486
- __asm__("bswap %0" : "=r" (val) : "0" (val));
-#else
- __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
- "rorl $16,%0\n\t" /* swap words */
- "xchgb %b0,%h0" /* swap higher bytes */
- :"=q" (val)
- : "0" (val));
-#endif
- return val;
-}
-
-_INLINE_ __u16 ext2fs_swab16(__u16 val)
-{
- __asm__("xchgb %b0,%h0" /* swap bytes */ \
- : "=q" (val) \
- : "0" (val)); \
- return val;
-}
-
-_INLINE_ __u64 ext2fs_swab64(__u64 val)
-{
- return (ext2fs_swab32(val >> 32) |
- (((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
-}
-#endif
-
#undef EXT2FS_ADDR

#endif /* i386 */
@@ -346,7 +316,7 @@ _INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
#endif /* __mc68000__ */


-#if !defined(_EXT2_HAVE_ASM_SWAB_) && defined(EXT2FS_ENABLE_SWAPFS)
+#if !defined(_EXT2_HAVE_ASM_SWAB_) && defined(WORDS_BIGENDIAN)

_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 20c63c0..83a9091 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -30,15 +30,6 @@ extern "C" {
#endif

/*
- * Build in support for byte-swapping filesystems if we the feature
- * has been configured or if we're being built on a CPU architecture
- * with a non-native byte order.
- */
-#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN)
-#define EXT2FS_ENABLE_SWAPFS
-#endif
-
-/*
* Where the master copy of the superblock is located, and how big
* superblocks are supposed to be. We define SUPERBLOCK_SIZE because
* the size of the superblock structure is not necessarily trustworthy
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 6576c59..bd0844d 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -20,7 +20,7 @@
#include "ext2fs.h"
#include <ext2fs/ext2_ext_attr.h>

-#ifdef EXT2FS_ENABLE_SWAPFS
+#ifdef WORDS_BIGENDIAN
void ext2fs_swap_super(struct ext2_super_block * sb)
{
int i;
--
1.5.3.rc4.67.gf9286

2007-08-12 16:58:44

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Remove PowerPC bitmap hackery since it's not been needed since Linux 2.1

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
lib/ext2fs/rw_bitmaps.c | 46 ----------------------------------------------
1 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 603b590..1897ec3 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -27,30 +27,6 @@
#include "ext2fs.h"
#include "e2image.h"

-#if defined(__powerpc__) && defined(EXT2FS_ENABLE_SWAPFS)
-/*
- * On the PowerPC, the big-endian variant of the ext2 filesystem
- * has its bitmaps stored as 32-bit words with bit 0 as the LSB
- * of each word. Thus a bitmap with only bit 0 set would be, as
- * a string of bytes, 00 00 00 01 00 ...
- * To cope with this, we byte-reverse each word of a bitmap if
- * we have a big-endian filesystem, that is, if we are *not*
- * byte-swapping other word-sized numbers.
- */
-#define EXT2_BIG_ENDIAN_BITMAPS
-#endif
-
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
-static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes)
-{
- __u32 *p = (__u32 *) bitmap;
- int n;
-
- for (n = nbytes / sizeof(__u32); n > 0; --n, ++p)
- *p = ext2fs_swab32(*p);
-}
-#endif
-
static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)
{
dgrp_t i;
@@ -112,12 +88,6 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)
}
blk = fs->group_desc[i].bg_block_bitmap;
if (blk) {
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
- if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)))
- ext2fs_swap_bitmap(fs, block_buf,
- block_nbytes);
-#endif
retval = io_channel_write_blk(fs->io, blk, 1,
block_buf);
if (retval)
@@ -141,12 +111,6 @@ static errcode_t write_bitmaps(ext2_filsys fs, int do_inode, int do_block)

blk = fs->group_desc[i].bg_inode_bitmap;
if (blk) {
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
- if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)))
- ext2fs_swap_bitmap(fs, inode_buf,
- inode_nbytes);
-#endif
retval = io_channel_write_blk(fs->io, blk, 1,
inode_buf);
if (retval)
@@ -278,11 +242,6 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
retval = EXT2_ET_BLOCK_BITMAP_READ;
goto cleanup;
}
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
- if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)))
- ext2fs_swap_bitmap(fs, block_bitmap, block_nbytes);
-#endif
} else
memset(block_bitmap, 0xff, block_nbytes);
cnt = block_nbytes << 3;
@@ -304,11 +263,6 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
retval = EXT2_ET_INODE_BITMAP_READ;
goto cleanup;
}
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
- if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
- (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)))
- ext2fs_swap_bitmap(fs, inode_bitmap, inode_nbytes);
-#endif
} else
memset(inode_bitmap, 0xff, inode_nbytes);
cnt = inode_nbytes << 3;
--
1.5.3.rc4.67.gf9286

2007-08-12 16:58:45

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Remove e2fsck's -s and -S options to byte-swap ancient PPC filesystems

The need for fixing byte-swapped filesystems is long-gone, and this is
getting in the way of cleaning up e2fsprogs's bitmaps code. So let's
get rid of it; modern kernels haven't been able to deal with a
byte-swapped filesystem in in about 9 years.

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
e2fsck/Makefile.in | 12 +--
e2fsck/e2fsck.8.in | 13 +---
e2fsck/e2fsck.h | 3 -
e2fsck/swapfs.c | 272 ----------------------------------------------------
e2fsck/unix.c | 47 +---------
5 files changed, 6 insertions(+), 341 deletions(-)
delete mode 100644 e2fsck/swapfs.c

diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in
index 95c4399..7750759 100644
--- a/e2fsck/Makefile.in
+++ b/e2fsck/Makefile.in
@@ -62,7 +62,7 @@ COMPILE_ET=$(top_builddir)/lib/et/compile_et --build-tree
#MCHECK= -DMCHECK

OBJS= dict.o unix.o e2fsck.o super.o pass1.o pass1b.o pass2.o pass3.o pass4.o \
- pass5.o journal.o swapfs.o badblocks.o util.o dirinfo.o dx_dirinfo.o \
+ pass5.o journal.o badblocks.o util.o dirinfo.o dx_dirinfo.o \
ehandler.o problem.o message.o recovery.o region.o revoke.o \
ea_refcount.o rehash.o profile.o prof_err.o $(MTRACE_OBJ)

@@ -71,7 +71,7 @@ PROFILED_OBJS= profiled/dict.o profiled/unix.o profiled/e2fsck.o \
profiled/pass2.o profiled/pass3.o profiled/pass4.o profiled/pass5.o \
profiled/journal.o profiled/badblocks.o profiled/util.o \
profiled/dirinfo.o profiled/dx_dirinfo.o profiled/ehandler.o \
- profiled/message.o profiled/problem.o profiled/swapfs.o \
+ profiled/message.o profiled/problem.o \
profiled/recovery.o profiled/region.o profiled/revoke.o \
profiled/ea_refcount.o profiled/rehash.o profiled/profile.o \
profiled/prof_err.o
@@ -96,7 +96,6 @@ SRCS= $(srcdir)/e2fsck.c \
$(srcdir)/ehandler.c \
$(srcdir)/problem.c \
$(srcdir)/message.c \
- $(srcdir)/swapfs.c \
$(srcdir)/ea_refcount.c \
$(srcdir)/rehash.c \
$(srcdir)/region.c \
@@ -382,13 +381,6 @@ message.o: $(srcdir)/message.c $(srcdir)/e2fsck.h \
$(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
$(top_srcdir)/lib/blkid/blkid.h $(top_builddir)/lib/blkid/blkid_types.h \
$(srcdir)/profile.h prof_err.h $(srcdir)/problem.h
-swapfs.o: $(srcdir)/swapfs.c $(top_srcdir)/lib/et/com_err.h \
- $(srcdir)/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
- $(top_builddir)/lib/ext2fs/ext2_types.h $(top_srcdir)/lib/ext2fs/ext2fs.h \
- $(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_srcdir)/lib/ext2fs/ext2_io.h \
- $(top_builddir)/lib/ext2fs/ext2_err.h $(top_srcdir)/lib/ext2fs/bitops.h \
- $(top_srcdir)/lib/blkid/blkid.h $(top_builddir)/lib/blkid/blkid_types.h \
- $(srcdir)/profile.h prof_err.h
ea_refcount.o: $(srcdir)/ea_refcount.c $(srcdir)/e2fsck.h \
$(top_srcdir)/lib/ext2fs/ext2_fs.h $(top_builddir)/lib/ext2fs/ext2_types.h \
$(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in
index c1e40c9..eb560bf 100644
--- a/e2fsck/e2fsck.8.in
+++ b/e2fsck/e2fsck.8.in
@@ -8,7 +8,7 @@ e2fsck \- check a Linux ext2/ext3 file system
.SH SYNOPSIS
.B e2fsck
[
-.B \-pacnyrdfkvstDFSV
+.B \-pacnyrdfkvtDFV
]
[
.B \-b
@@ -256,17 +256,6 @@ options.
.B \-r
This option does nothing at all; it is provided only for backwards
compatibility.
-.TP
-.B \-s
-This option will byte-swap the filesystem so that it is using the normalized,
-standard byte-order (which is i386 or little endian). If the filesystem is
-already in the standard byte-order,
-.B e2fsck
-will take no action.
-.TP
-.B \-S
-This option will byte-swap the filesystem, regardless of its current
-byte-order.
.TP
.B \-t
Print timing statistics for
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 1071847..99c0ae5 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -456,9 +456,6 @@ void e2fsck_rehash_directories(e2fsck_t ctx);
/* super.c */
void check_super_block(e2fsck_t ctx);

-/* swapfs.c */
-void swap_filesys(e2fsck_t ctx);
-
/* util.c */
extern void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
const char *description);
diff --git a/e2fsck/swapfs.c b/e2fsck/swapfs.c
deleted file mode 100644
index 81f3ca2..0000000
--- a/e2fsck/swapfs.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * swapfs.c --- byte-swap an ext2 filesystem
- *
- * Copyright 1996, 1997 by Theodore Ts'o
- *
- * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
- * %End-Header%
- *
- */
-
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#include <et/com_err.h>
-#include "e2fsck.h"
-
-#ifdef ENABLE_SWAPFS
-
-struct swap_block_struct {
- ext2_ino_t ino;
- int isdir;
- errcode_t errcode;
- char *dir_buf;
- struct ext2_inode *inode;
-};
-
-/*
- * This is a helper function for block_iterate. We mark all of the
- * indirect and direct blocks as changed, so that block_iterate will
- * write them out.
- */
-static int swap_block(ext2_filsys fs, blk_t *block_nr, int blockcnt,
- void *priv_data)
-{
- errcode_t retval;
-
- struct swap_block_struct *sb = (struct swap_block_struct *) priv_data;
-
- if (sb->isdir && (blockcnt >= 0) && *block_nr) {
- retval = ext2fs_read_dir_block(fs, *block_nr, sb->dir_buf);
- if (retval) {
- sb->errcode = retval;
- return BLOCK_ABORT;
- }
- retval = ext2fs_write_dir_block(fs, *block_nr, sb->dir_buf);
- if (retval) {
- sb->errcode = retval;
- return BLOCK_ABORT;
- }
- }
- if (blockcnt >= 0) {
- if (blockcnt < EXT2_NDIR_BLOCKS)
- return 0;
- return BLOCK_CHANGED;
- }
- if (blockcnt == BLOCK_COUNT_IND) {
- if (*block_nr == sb->inode->i_block[EXT2_IND_BLOCK])
- return 0;
- return BLOCK_CHANGED;
- }
- if (blockcnt == BLOCK_COUNT_DIND) {
- if (*block_nr == sb->inode->i_block[EXT2_DIND_BLOCK])
- return 0;
- return BLOCK_CHANGED;
- }
- if (blockcnt == BLOCK_COUNT_TIND) {
- if (*block_nr == sb->inode->i_block[EXT2_TIND_BLOCK])
- return 0;
- return BLOCK_CHANGED;
- }
- return BLOCK_CHANGED;
-}
-
-/*
- * This function is responsible for byte-swapping all of the indirect,
- * block pointers. It is also responsible for byte-swapping directories.
- */
-static void swap_inode_blocks(e2fsck_t ctx, ext2_ino_t ino, char *block_buf,
- struct ext2_inode *inode)
-{
- errcode_t retval;
- struct swap_block_struct sb;
-
- sb.ino = ino;
- sb.inode = inode;
- sb.dir_buf = block_buf + ctx->fs->blocksize*3;
- sb.errcode = 0;
- sb.isdir = 0;
- if (LINUX_S_ISDIR(inode->i_mode))
- sb.isdir = 1;
-
- retval = ext2fs_block_iterate(ctx->fs, ino, 0, block_buf,
- swap_block, &sb);
- if (retval) {
- com_err("swap_inode_blocks", retval,
- _("while calling ext2fs_block_iterate"));
- ctx->flags |= E2F_FLAG_ABORT;
- return;
- }
- if (sb.errcode) {
- com_err("swap_inode_blocks", sb.errcode,
- _("while calling iterator function"));
- ctx->flags |= E2F_FLAG_ABORT;
- return;
- }
-}
-
-static void swap_inodes(e2fsck_t ctx)
-{
- ext2_filsys fs = ctx->fs;
- dgrp_t group;
- unsigned int i;
- ext2_ino_t ino = 1;
- char *buf = NULL, *block_buf = NULL;
- errcode_t retval;
- struct ext2_inode * inode;
-
- e2fsck_use_inode_shortcuts(ctx, 1);
-
- retval = ext2fs_get_mem(fs->blocksize * fs->inode_blocks_per_group,
- &buf);
- if (retval) {
- com_err("swap_inodes", retval,
- _("while allocating inode buffer"));
- ctx->flags |= E2F_FLAG_ABORT;
- goto errout;
- }
- block_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize * 4,
- "block interate buffer");
- for (group = 0; group < fs->group_desc_count; group++) {
- retval = io_channel_read_blk(fs->io,
- fs->group_desc[group].bg_inode_table,
- fs->inode_blocks_per_group, buf);
- if (retval) {
- com_err("swap_inodes", retval,
- _("while reading inode table (group %d)"),
- group);
- ctx->flags |= E2F_FLAG_ABORT;
- goto errout;
- }
- inode = (struct ext2_inode *) buf;
- for (i=0; i < fs->super->s_inodes_per_group;
- i++, ino++, inode++) {
- ctx->stashed_ino = ino;
- ctx->stashed_inode = inode;
-
- if (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)
- ext2fs_swap_inode(fs, inode, inode, 0);
-
- /*
- * Skip deleted files.
- */
- if (inode->i_links_count == 0)
- continue;
-
- if (LINUX_S_ISDIR(inode->i_mode) ||
- ((inode->i_block[EXT2_IND_BLOCK] ||
- inode->i_block[EXT2_DIND_BLOCK] ||
- inode->i_block[EXT2_TIND_BLOCK]) &&
- ext2fs_inode_has_valid_blocks(inode)))
- swap_inode_blocks(ctx, ino, block_buf, inode);
-
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- goto errout;
-
- if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)
- ext2fs_swap_inode(fs, inode, inode, 1);
- }
- retval = io_channel_write_blk(fs->io,
- fs->group_desc[group].bg_inode_table,
- fs->inode_blocks_per_group, buf);
- if (retval) {
- com_err("swap_inodes", retval,
- _("while writing inode table (group %d)"),
- group);
- ctx->flags |= E2F_FLAG_ABORT;
- goto errout;
- }
- }
-errout:
- if (buf)
- ext2fs_free_mem(&buf);
- if (block_buf)
- ext2fs_free_mem(&block_buf);
- e2fsck_use_inode_shortcuts(ctx, 0);
- ext2fs_flush_icache(fs);
-}
-
-#if defined(__powerpc__) && defined(EXT2FS_ENABLE_SWAPFS)
-/*
- * On the PowerPC, the big-endian variant of the ext2 filesystem
- * has its bitmaps stored as 32-bit words with bit 0 as the LSB
- * of each word. Thus a bitmap with only bit 0 set would be, as
- * a string of bytes, 00 00 00 01 00 ...
- * To cope with this, we byte-reverse each word of a bitmap if
- * we have a big-endian filesystem, that is, if we are *not*
- * byte-swapping other word-sized numbers.
- */
-#define EXT2_BIG_ENDIAN_BITMAPS
-#endif
-
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
-static void ext2fs_swap_bitmap(ext2fs_generic_bitmap bmap)
-{
- __u32 *p = (__u32 *) bmap->bitmap;
- int n, nbytes = (bmap->end - bmap->start + 7) / 8;
-
- for (n = nbytes / sizeof(__u32); n > 0; --n, ++p)
- *p = ext2fs_swab32(*p);
-}
-#endif
-
-
-void swap_filesys(e2fsck_t ctx)
-{
- ext2_filsys fs = ctx->fs;
-#ifdef RESOURCE_TRACK
- struct resource_track rtrack;
-
- init_resource_track(&rtrack, ctx->fs->io);
-#endif
-
- if (!(ctx->options & E2F_OPT_PREEN))
- printf(_("Pass 0: Doing byte-swap of filesystem\n"));
-
-#ifdef MTRACE
- mtrace_print("Byte swap");
-#endif
-
- if (fs->super->s_mnt_count) {
- fprintf(stderr, _("%s: the filesystem must be freshly "
- "checked using fsck\n"
- "and not mounted before trying to "
- "byte-swap it.\n"), ctx->device_name);
- ctx->flags |= E2F_FLAG_ABORT;
- return;
- }
- if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
- fs->flags &= ~(EXT2_FLAG_SWAP_BYTES|
- EXT2_FLAG_SWAP_BYTES_WRITE);
- fs->flags |= EXT2_FLAG_SWAP_BYTES_READ;
- } else {
- fs->flags &= ~EXT2_FLAG_SWAP_BYTES_READ;
- fs->flags |= EXT2_FLAG_SWAP_BYTES_WRITE;
- }
- swap_inodes(ctx);
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- return;
- if (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)
- fs->flags |= EXT2_FLAG_SWAP_BYTES;
- fs->flags &= ~(EXT2_FLAG_SWAP_BYTES_READ|
- EXT2_FLAG_SWAP_BYTES_WRITE);
-
-#ifdef EXT2_BIG_ENDIAN_BITMAPS
- e2fsck_read_bitmaps(ctx);
- ext2fs_swap_bitmap(fs->inode_map);
- ext2fs_swap_bitmap(fs->block_map);
- fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY;
-#endif
- fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
- ext2fs_flush(fs);
- fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
-
-#ifdef RESOURCE_TRACK
- if (ctx->options & E2F_OPT_TIME2)
- print_resource_track(_("Byte swap"), &rtrack, fs->io);
-#endif
-}
-
-#endif
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index ad68c4b..3d91049 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -52,8 +52,6 @@ extern int optind;
#include "../version.h"

/* Command line options */
-static int swapfs;
-static int normalize_swapfs;
static int cflag; /* check disk */
static int show_version_only;
static int verbose;
@@ -71,7 +69,7 @@ int journal_enable_debug = -1;
static void usage(e2fsck_t ctx)
{
fprintf(stderr,
- _("Usage: %s [-panyrcdfvstDFSV] [-b superblock] [-B blocksize]\n"
+ _("Usage: %s [-panyrcdfvtDFV] [-b superblock] [-B blocksize]\n"
"\t\t[-I inode_buffer_blocks] [-P process_inode_size]\n"
"\t\t[-l|-L bad_blocks_file] [-C fd] [-j external_journal]\n"
"\t\t[-E extended-options] device\n"),
@@ -267,8 +265,7 @@ static void check_if_skip(e2fsck_t ctx)
if (!defer_check_on_battery)
batt = 0;

- if ((ctx->options & E2F_OPT_FORCE) || bad_blocks_file ||
- cflag || swapfs)
+ if ((ctx->options & E2F_OPT_FORCE) || bad_blocks_file || cflag)
return;

if ((fs->super->s_state & EXT2_ERROR_FS) ||
@@ -717,20 +714,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
case 'N':
ctx->device_name = optarg;
break;
-#ifdef ENABLE_SWAPFS
- case 's':
- normalize_swapfs = 1;
- case 'S':
- swapfs = 1;
- break;
-#else
- case 's':
- case 'S':
- fprintf(stderr, _("Byte-swapping filesystems "
- "not compiled in this version "
- "of e2fsck\n"));
- exit(1);
-#endif
case 'k':
keep_bad_blocks++;
break;
@@ -742,7 +725,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
if (optind != argc - 1)
usage(ctx);
if ((ctx->options & E2F_OPT_NO) && !bad_blocks_file &&
- !cflag && !swapfs && !(ctx->options & E2F_OPT_COMPRESS_DIRS))
+ !cflag && !(ctx->options & E2F_OPT_COMPRESS_DIRS))
ctx->options |= E2F_OPT_READONLY;
ctx->io_options = strchr(argv[optind], '?');
if (ctx->io_options)
@@ -777,15 +760,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
}
close(fd);
}
-#ifdef ENABLE_SWAPFS
- if (swapfs) {
- if (cflag || bad_blocks_file) {
- fprintf(stderr, _("Incompatible options not "
- "allowed when byte-swapping.\n"));
- exit(FSCK_USAGE);
- }
- }
-#endif
if (cflag && bad_blocks_file) {
fprintf(stderr, _("The -c and the -l/-L options may "
"not be both used at the same time.\n"));
@@ -1169,21 +1143,6 @@ restart:
read_bad_blocks_file(ctx, 0, !keep_bad_blocks); /* Test disk */
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
fatal_error(ctx, 0);
-#ifdef ENABLE_SWAPFS
- if (normalize_swapfs) {
- if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ==
- ext2fs_native_flag()) {
- fprintf(stderr, _("%s: Filesystem byte order "
- "already normalized.\n"), ctx->device_name);
- fatal_error(ctx, 0);
- }
- }
- if (swapfs) {
- swap_filesys(ctx);
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- fatal_error(ctx, 0);
- }
-#endif

/*
* Mark the system as valid, 'til proven otherwise
--
1.5.3.rc4.67.gf9286