From: Mark Huang Date: Tue, 23 Nov 2004 14:56:03 +0000 (+0000) Subject: PL3118 and PL3131 fix: use the correct ext2 attribute bits if possible; X-Git-Tag: after-util-vserver-0_30_208-revert~198 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=39cd718a7adcad4e4931ea5f68222719cba3a535;p=util-vserver.git PL3118 and PL3131 fix: use the correct ext2 attribute bits if possible; immulink changed from bit 15 to bit 27 in 2.6.x. --- diff --git a/src/vbuild.cc b/src/vbuild.cc index ed27809..dcaaa9f 100644 --- a/src/vbuild.cc +++ b/src/vbuild.cc @@ -51,7 +51,7 @@ struct EXCLDIR{ static vector excldirs; -static int ext2flags = EXT2_IMMUTABLE_FILE_FL | EXT2_IMMUTABLE_LINK_FL; +static int ext2flags = EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL; static struct { int nblink; int nbcopy; @@ -228,9 +228,9 @@ int main (int argc, char *argv[]) }else if (strcmp(arg,"--noflags")==0){ ext2flags = 0; }else if (strcmp(arg,"--immutable")==0){ - ext2flags |= EXT2_IMMUTABLE_FILE_FL; + ext2flags |= EXT2_IMMUTABLE_FL; }else if (strcmp(arg,"--immutable-mayunlink")==0){ - ext2flags |= EXT2_IMMUTABLE_LINK_FL; + ext2flags |= EXT2_IUNLINK_FL; }else if (strcmp(arg,"--excldir")==0){ i++; excldirs.push_back (EXCLDIR(argv[i])); diff --git a/src/vunify.cc b/src/vunify.cc index 2b0cac9..8065f5e 100644 --- a/src/vunify.cc +++ b/src/vunify.cc @@ -43,7 +43,7 @@ using namespace std; static bool undo = false; -static int ext2flags = EXT2_IMMUTABLE_FILE_FL | EXT2_IMMUTABLE_LINK_FL; +static int ext2flags = EXT2_IMMUTABLE_FL | EXT2_IUNLINK_FL; struct EXCLDIR{ string prefix; int len; @@ -338,9 +338,9 @@ int main (int argc, char *argv[]) }else if (strcmp(arg,"--noflags")==0){ ext2flags = 0; }else if (strcmp(arg,"--immutable")==0){ - ext2flags |= EXT2_IMMUTABLE_FILE_FL; + ext2flags |= EXT2_IMMUTABLE_FL; }else if (strcmp(arg,"--immutable-mayunlink")==0){ - ext2flags |= EXT2_IMMUTABLE_LINK_FL; + ext2flags |= EXT2_IUNLINK_FL; }else if (strcmp(arg,"--excldir")==0){ i++; //excldirs[excldirs.size()] = EXCLDIR(argv[i]); diff --git a/src/vutil.h b/src/vutil.h index c567267..153076d 100644 --- a/src/vutil.h +++ b/src/vutil.h @@ -36,9 +36,17 @@ extern int debug; extern bool testmode; // Patch to help compile this utility on unpatched kernel source -#ifndef EXT2_IMMUTABLE_FILE_FL - #define EXT2_IMMUTABLE_FILE_FL 0x00000010 - #define EXT2_IMMUTABLE_LINK_FL 0x00008000 +#ifndef EXT2_IMMUTABLE_FL +#define EXT2_IMMUTABLE_FL 0x00000010 +#endif + +#ifndef EXT2_IUNLINK_FL +/* Set both bits for backward compatibility */ +#define EXT2_IUNLINK_FL 0x08008000 +#endif + +#ifndef EXT2_BARRIER_FL +#define EXT2_BARRIER_FL 0x04000000 #endif