diff -urN e2fsprogs-1.25.orig/e2fsck/ChangeLog e2fsprogs-1.25/e2fsck/ChangeLog --- e2fsprogs-1.25.orig/e2fsck/ChangeLog Thu Sep 20 15:48:02 2001 +++ e2fsprogs-1.25/e2fsck/ChangeLog Thu Oct 18 15:36:31 2001 @@ -1,3 +1,9 @@ +2001-10-18 Sam Vilain + + * pass1.c (e2fsck_pass1): Added support for immutable linkage + invert; it is only an error for special files to have the + normal immutable flag set. + 2001-09-20 Theodore Tso * Release of E2fsprogs 1.25 diff -urN e2fsprogs-1.25.orig/e2fsck/pass1.c e2fsprogs-1.25/e2fsck/pass1.c --- e2fsprogs-1.25.orig/e2fsck/pass1.c Thu Sep 20 02:24:11 2001 +++ e2fsprogs-1.25/e2fsck/pass1.c Thu Oct 18 13:37:58 2001 @@ -143,7 +143,7 @@ * you can't set or clear immutable flags for devices.) Once * the kernel has been fixed we can change this... */ - if (inode->i_flags & (EXT2_IMMUTABLE_FL | EXT2_APPEND_FL)) { + if (inode->i_flags & (EXT2_IMMUTABLE_FILE_FL | EXT2_APPEND_FL)) { for (i=4; i < EXT2_N_BLOCKS; i++) if (inode->i_block[i]) return 0; @@ -175,8 +175,8 @@ int i; if ((inode->i_size_high || inode->i_size == 0) || - (inode->i_flags & (EXT2_IMMUTABLE_FL | EXT2_APPEND_FL | - EXT2_INDEX_FL))) + (inode->i_flags & (EXT2_IMMUTABLE_FILE_FL | + EXT2_APPEND_FL | EXT2_INDEX_FL))) return 0; if (inode->i_blocks) { @@ -206,13 +206,15 @@ */ static void check_immutable(e2fsck_t ctx, struct problem_context *pctx) { - if (!(pctx->inode->i_flags & (EXT2_IMMUTABLE_FL | EXT2_APPEND_FL))) + if (!(pctx->inode->i_flags & (EXT2_IMMUTABLE_FILE_FL | + EXT2_APPEND_FL))) return; if (!fix_problem(ctx, PR_1_SET_IMMUTABLE, pctx)) return; - pctx->inode->i_flags &= ~((EXT2_IMMUTABLE_FL | EXT2_APPEND_FL)); + pctx->inode->i_flags &= ~((EXT2_IMMUTABLE_FILE_FL | + EXT2_APPEND_FL)); e2fsck_write_inode(ctx, pctx->ino, pctx->inode, "pass1"); } diff -urN e2fsprogs-1.25.orig/lib/e2p/ChangeLog e2fsprogs-1.25/lib/e2p/ChangeLog --- e2fsprogs-1.25.orig/lib/e2p/ChangeLog Thu Sep 20 15:48:02 2001 +++ e2fsprogs-1.25/lib/e2p/ChangeLog Thu Oct 18 15:37:33 2001 @@ -1,3 +1,7 @@ +2001-10-18 Sam Vilain + + * pf.c: Added support for Immutable Linkage Invert attribute + 2001-09-20 Theodore Tso * Release of E2fsprogs 1.25 diff -urN e2fsprogs-1.25.orig/lib/e2p/pf.c e2fsprogs-1.25/lib/e2p/pf.c --- e2fsprogs-1.25.orig/lib/e2p/pf.c Thu Sep 20 02:24:12 2001 +++ e2fsprogs-1.25/lib/e2p/pf.c Thu Oct 18 15:37:14 2001 @@ -28,7 +28,8 @@ { EXT2_SECRM_FL, "s", "Secure_Deletion" }, { EXT2_UNRM_FL, "u" , "Undelete" }, { EXT2_SYNC_FL, "S", "Synchronous_Updates" }, - { EXT2_IMMUTABLE_FL, "i", "Immutable" }, + { EXT2_IMMUTABLE_FILE_FL, "i", "Immutable" }, + { EXT2_IMMUTABLE_LINK_FL, "I", "Immutable Linkage Invert" }, { EXT2_APPEND_FL, "a", "Append_Only" }, { EXT2_NODUMP_FL, "d", "No_Dump" }, { EXT2_NOATIME_FL, "A", "No_Atime" }, diff -urN e2fsprogs-1.25.orig/lib/ext2fs/ChangeLog e2fsprogs-1.25/lib/ext2fs/ChangeLog --- e2fsprogs-1.25.orig/lib/ext2fs/ChangeLog Thu Sep 20 15:48:02 2001 +++ e2fsprogs-1.25/lib/ext2fs/ChangeLog Thu Oct 18 15:40:31 2001 @@ -1,3 +1,8 @@ +2001-10-18 Sam Vilain + + * ext2_fs.h, mkjournal.c: Added support for Immutable Linkage + Invert flag. + 2001-09-20 Theodore Tso * Release of E2fsprogs 1.25 diff -urN e2fsprogs-1.25.orig/lib/ext2fs/ext2_fs.h e2fsprogs-1.25/lib/ext2fs/ext2_fs.h --- e2fsprogs-1.25.orig/lib/ext2fs/ext2_fs.h Thu Sep 20 02:24:13 2001 +++ e2fsprogs-1.25/lib/ext2fs/ext2_fs.h Thu Oct 18 13:27:52 2001 @@ -176,7 +176,7 @@ #define EXT2_UNRM_FL 0x00000002 /* Undelete */ #define EXT2_COMPR_FL 0x00000004 /* Compress file */ #define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ -#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ +#define EXT2_IMMUTABLE_FILE_FL 0x00000010 /* Immutable file */ #define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ #define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ #define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ @@ -190,9 +190,10 @@ #define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */ #define EXT2_IMAGIC_FL 0x00002000 #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ +#define EXT2_IMMUTABLE_LINK_FL 0x00008000 /* Immutable link toggle */ #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ -#define EXT2_FL_USER_VISIBLE 0x00005FFF /* User visible flags */ +#define EXT2_FL_USER_VISIBLE 0x0000DFFF /* User visible flags */ #define EXT2_FL_USER_MODIFIABLE 0x000000FF /* User modifiable flags */ /* diff -urN e2fsprogs-1.25.orig/lib/ext2fs/mkjournal.c e2fsprogs-1.25/lib/ext2fs/mkjournal.c --- e2fsprogs-1.25.orig/lib/ext2fs/mkjournal.c Thu Sep 20 02:24:14 2001 +++ e2fsprogs-1.25/lib/ext2fs/mkjournal.c Thu Oct 18 14:01:22 2001 @@ -342,7 +342,7 @@ retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE); #else #if HAVE_EXT2_IOCTLS - f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;; + f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FILE_FL; retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f); #endif #endif diff -urN e2fsprogs-1.25.orig/misc/ChangeLog e2fsprogs-1.25/misc/ChangeLog --- e2fsprogs-1.25.orig/misc/ChangeLog Thu Sep 20 15:48:03 2001 +++ e2fsprogs-1.25/misc/ChangeLog Thu Oct 18 15:45:09 2001 @@ -1,3 +1,9 @@ +2001-10-18 Sam Vilain + + * chattr.c (chattr): Added support for new Immutable Linkage + Invert flag + * chattr.1.in (chattr(1)): Added explanation of new flag + 2001-09-20 Theodore Tso * Release of E2fsprogs 1.25 diff -urN e2fsprogs-1.25.orig/misc/chattr.1.in e2fsprogs-1.25/misc/chattr.1.in --- e2fsprogs-1.25.orig/misc/chattr.1.in Thu Sep 20 02:24:15 2001 +++ e2fsprogs-1.25/misc/chattr.1.in Thu Oct 18 15:31:51 2001 @@ -19,16 +19,16 @@ .B chattr changes the file attributes on a Linux second extended file system. .PP -The format of a symbolic mode is +-=[ASacdisu]. +The format of a symbolic mode is +-=[ASacdiIsu]. .PP The operator `+' causes the selected attributes to be added to the existing attributes of the files; `-' causes them to be removed; and `=' causes them to be the only attributes that the files have. .PP -The letters `ASacdijsu' select the new attributes for the files: -don't update atime (A), synchronous updates (S), append only (a), -compressed (c), no dump (d), immutable (i), data journalling (j), -secure deletion (s), and undeletable (u). +The letters `ASacdiIjsu' select the new attributes for the files: +don't update atime (A), synchronous updates (S), append only (a), +compressed (c), no dump (d), immutable (i), immutable linkage invert +(I), data journalling (j), secure deletion (s), and undeletable (u). .SH OPTIONS .TP .B \-R @@ -57,9 +57,28 @@ .BR dump (8) program is run. .PP -A file with the `i' attribute cannot be modified: it cannot be deleted or -renamed, no link can be created to this file and no data can be written -to the file. Only the superuser can set or clear this attribute. +A file with the `i' attribute cannot be modified: it cannot be deleted +or renamed, no hard link can be created to this file and no data can +be written to the file. Only the superuser can set or clear this +attribute. +.PP +The `I' attribute set the invert immutable linkage flag. This refers +to whether or not a file may be deleted, renamed or new hard links +made to it. Normally, a file's linkage is immutable only if the +immutable flag is set. By setting this flag, you can make a file take +on or lose this characteristic of immutability. +.PP +That is, a file with the `I' attribute as well as the `i' attribute +cannot be modified, however it can be deleted, renamed, and new hard +links can be created to the file. It may not be otherwise written to, +or have its permissions, owner or other file attributes changed. Only +the superuser can set or clear this attribute. +.PP +A file with the `I' attribute set, but without the `i' attribute set +can be modified (subject to other permissions), however its linkage +may not be changed. That is, it may not be deleted, renamed, or have +new links created to it. Only the superuser can set or clear this +attribute. .PP A file with the `j' attribute has all of its data written to the ext3 journal before being written to the file itself, if the filesystem is diff -urN e2fsprogs-1.25.orig/misc/chattr.c e2fsprogs-1.25/misc/chattr.c --- e2fsprogs-1.25.orig/misc/chattr.c Thu Sep 20 02:24:15 2001 +++ e2fsprogs-1.25/misc/chattr.c Thu Oct 18 14:06:08 2001 @@ -78,7 +78,7 @@ exit (errcode); } -#define usage() fatal_error(_("usage: %s [-RV] [-+=AacdijsSu] [-v version] files...\n"), \ +#define usage() fatal_error(_("usage: %s [-RV] [-+=AacdiIjsSu] [-v version] files...\n"), \ 1) struct flags_char { @@ -92,7 +92,8 @@ { EXT2_APPEND_FL, 'a' }, { EXT2_COMPR_FL, 'c' }, { EXT2_NODUMP_FL, 'd' }, - { EXT2_IMMUTABLE_FL, 'i' }, + { EXT2_IMMUTABLE_FILE_FL, 'i' }, + { EXT2_IMMUTABLE_LINK_FL, 'I' }, { EXT3_JOURNAL_DATA_FL, 'j' }, { EXT2_SECRM_FL, 's' }, { EXT2_UNRM_FL, 'u' }, diff -urN e2fsprogs-1.25.orig/misc/tune2fs.c e2fsprogs-1.25/misc/tune2fs.c --- e2fsprogs-1.25.orig/misc/tune2fs.c Thu Sep 20 14:47:54 2001 +++ e2fsprogs-1.25/misc/tune2fs.c Thu Oct 18 13:30:40 2001 @@ -232,7 +232,7 @@ ext2fs_mark_bb_dirty(fs); fs->flags &= ~EXT2_FLAG_SUPER_ONLY; } else - inode.i_flags &= ~EXT2_IMMUTABLE_FL; + inode.i_flags &= ~(EXT2_IMMUTABLE_FILE_FL|EXT2_IMMUTABLE_LINK_FL); retval = ext2fs_write_inode(fs, ino, &inode); if (retval) { com_err(program_name, retval,