http://linux-ntfs.bkbits.net/ntfs-2.6
aia21@cantab.net|ChangeSet|20040511205726|22244 aia21

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/11 17:38:24+01:00 aia21@cantab.net 
#   NTFS: 2.1.10 - Force read-only (re)mounting of volumes with unsupported flags.
# 
# fs/ntfs/super.c
#   2004/05/11 17:38:17+01:00 aia21@cantab.net +34 -1
#   Force read-only (re)mounting if any of the following bits are set in
#   the volume information flags:
#   	VOLUME_IS_DIRTY, VOLUME_RESIZE_LOG_FILE,
#   	VOLUME_UPGRADE_ON_MOUNT, VOLUME_DELETE_USN_UNDERWAY,
#   	VOLUME_REPAIR_OBJECT_ID, VOLUME_MODIFIED_BY_CHKDSK
#   To make this easier we define VOLUME_MUST_MOUNT_RO_MASK with all the
#   above bits set so the test is made easy.
# 
# fs/ntfs/Makefile
#   2004/05/11 17:38:16+01:00 aia21@cantab.net +1 -1
#   Update for 2.1.10 release.
# 
# fs/ntfs/mft.h
#   2004/05/11 15:19:37+01:00 aia21@cantab.net +0 -2
#   Remove obsolete declaration of format_mft_record2().
# 
# fs/ntfs/layout.h
#   2004/05/11 15:19:37+01:00 aia21@cantab.net +25 -22
#   - Add VOLUME_MUST_MOUNT_RO_MASK bit mask to VOLUME_FLAGS enum.
#   - Also, missed a few trailing tabs in the whitespace cleanup patch.
# 
# fs/ntfs/ChangeLog
#   2004/05/11 15:19:37+01:00 aia21@cantab.net +15 -1
#   Update for 2.1.10 release.
# 
# Documentation/filesystems/ntfs.txt
#   2004/05/11 15:19:37+01:00 aia21@cantab.net +3 -0
#   Update for 2.1.10 release.
# 
# ChangeSet
#   2004/05/11 09:50:41+01:00 aia21@cantab.net 
#   Merge cantab.net:/home/src/bklinux-2.6
#   into cantab.net:/home/src/ntfs-2.6
# 
# fs/ntfs/ntfs.h
#   2004/05/11 09:50:36+01:00 aia21@cantab.net +0 -0
#   Auto merged
# 
# ChangeSet
#   2004/05/10 23:53:05+01:00 aia21@cantab.net 
#   NTFS: Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/logfile.c
#   2004/05/10 23:52:19+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/time.h
#   2004/05/10 23:52:17+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/volume.h
#   2004/05/10 23:52:16+01:00 aia21@cantab.net +2 -2
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/unistr.c
#   2004/05/10 23:52:14+01:00 aia21@cantab.net +10 -12
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/types.h
#   2004/05/10 23:52:12+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/sysctl.h
#   2004/05/10 23:52:10+01:00 aia21@cantab.net +6 -7
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/sysctl.c
#   2004/05/10 23:52:09+01:00 aia21@cantab.net +6 -7
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/ntfs.h
#   2004/05/10 23:52:07+01:00 aia21@cantab.net +2 -3
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/namei.c
#   2004/05/10 23:52:05+01:00 aia21@cantab.net +4 -4
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/mst.c
#   2004/05/10 23:52:04+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/mft.h
#   2004/05/10 23:52:02+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/mft.c
#   2004/05/10 23:52:00+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/malloc.h
#   2004/05/10 23:51:59+01:00 aia21@cantab.net +1 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/layout.h
#   2004/05/10 23:51:57+01:00 aia21@cantab.net +0 -1
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/file.c
#   2004/05/10 23:51:56+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/endian.h
#   2004/05/10 23:51:54+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/dir.h
#   2004/05/10 23:51:52+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/debug.h
#   2004/05/10 23:51:48+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/debug.c
#   2004/05/10 23:51:44+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/attrib.h
#   2004/05/10 23:51:19+01:00 aia21@cantab.net +4 -5
#   Cleanup whitespace (trailing space removal, etc).
# 
# fs/ntfs/Makefile
#   2004/05/10 23:51:09+01:00 aia21@cantab.net +1 -1
#   Update
# 
# fs/ntfs/ChangeLog
#   2004/05/10 23:50:55+01:00 aia21@cantab.net +4 -1
#   Update
# 
diff -Nru a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt
--- a/Documentation/filesystems/ntfs.txt	Wed May 12 20:30:38 2004
+++ b/Documentation/filesystems/ntfs.txt	Wed May 12 20:30:38 2004
@@ -273,6 +273,9 @@
 
 Note, a technical ChangeLog aimed at kernel hackers is in fs/ntfs/ChangeLog.
 
+2.1.10:
+	- Force read-only (re)mounting of volumes with unsupported volume
+	  flags and various cleanups.
 2.1.9:
 	- Fix two bugs in handling of corner cases in the decompression engine.
 2.1.8:
diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/ChangeLog	Wed May 12 20:30:38 2004
@@ -19,6 +19,24 @@
 	  sufficient for synchronisation here. We then just need to make sure
 	  ntfs_readpage/writepage/truncate interoperate properly with us.
 
+2.1.10 - Force read-only (re)mounting of volumes with unsupported volume flags.
+
+	- Finish off the white space cleanups (remove trailing spaces, etc).
+	- Clean up ntfs_fill_super() and ntfs_read_inode_mount() by removing
+	  the kludges around the first iget().  Instead of (re)setting ->s_op
+	  we have the $MFT inode set up by explicit new_inode() / set ->i_ino /
+	  insert_inode_hash() / call ntfs_read_inode_mount() directly.  This
+	  kills the need for second super_operations and allows to return error
+	  from ntfs_read_inode_mount() without resorting to ugly "poisoning"
+	  tricks.  (Al Viro)
+	- Force read-only (re)mounting if any of the following bits are set in
+	  the volume information flags:
+	  	VOLUME_IS_DIRTY, VOLUME_RESIZE_LOG_FILE,
+		VOLUME_UPGRADE_ON_MOUNT, VOLUME_DELETE_USN_UNDERWAY,
+		VOLUME_REPAIR_OBJECT_ID, VOLUME_MODIFIED_BY_CHKDSK
+	  To make this easier we define VOLUME_MUST_MOUNT_RO_MASK with all the
+	  above bits set so the test is made easy.
+
 2.1.9 - Fix two bugs in decompression engine.
 
 	- Fix a bug where we would not always detect that we have reached the
@@ -880,4 +898,3 @@
 	working nicely, too. Proof of inode metadata in the page cache and non-
 	resident file unnamed stream data in the page cache concepts is thus
 	complete.
-
diff -Nru a/fs/ntfs/Makefile b/fs/ntfs/Makefile
--- a/fs/ntfs/Makefile	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/Makefile	Wed May 12 20:30:38 2004
@@ -5,7 +5,7 @@
 ntfs-objs := aops.o attrib.o compress.o debug.o dir.o file.o inode.o logfile.o \
 	     mft.o mst.o namei.o super.o sysctl.o unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.9\"
+EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.10\"
 
 ifeq ($(CONFIG_NTFS_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
diff -Nru a/fs/ntfs/attrib.h b/fs/ntfs/attrib.h
--- a/fs/ntfs/attrib.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/attrib.h	Wed May 12 20:30:38 2004
@@ -2,7 +2,7 @@
  * attrib.h - Defines for attribute handling in NTFS Linux kernel driver.
  *	      Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2003 Anton Altaparmakov
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
@@ -10,13 +10,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -103,4 +103,3 @@
 extern void put_attr_search_ctx(attr_search_context *ctx);
 
 #endif /* _LINUX_NTFS_ATTRIB_H */
-
diff -Nru a/fs/ntfs/debug.c b/fs/ntfs/debug.c
--- a/fs/ntfs/debug.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/debug.c	Wed May 12 20:30:38 2004
@@ -1,20 +1,20 @@
 /*
  * debug.c - NTFS kernel debug support. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -172,4 +172,3 @@
 }
 
 #endif
-
diff -Nru a/fs/ntfs/debug.h b/fs/ntfs/debug.h
--- a/fs/ntfs/debug.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/debug.h	Wed May 12 20:30:38 2004
@@ -1,20 +1,20 @@
 /*
  * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001,2002 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -69,4 +69,3 @@
 #define ntfs_error(sb, f, a...)		__ntfs_error(__FUNCTION__, sb, f, ##a)
 
 #endif /* _LINUX_NTFS_DEBUG_H */
-
diff -Nru a/fs/ntfs/dir.h b/fs/ntfs/dir.h
--- a/fs/ntfs/dir.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/dir.h	Wed May 12 20:30:38 2004
@@ -2,20 +2,20 @@
  * dir.h - Defines for directory handling in NTFS Linux kernel driver. Part of
  *	   the Linux-NTFS project.
  *
- * Copyright (c) 2002 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -44,4 +44,3 @@
 		const uchar_t *uname, const int uname_len, ntfs_name **res);
 
 #endif /* _LINUX_NTFS_FS_DIR_H */
-
diff -Nru a/fs/ntfs/endian.h b/fs/ntfs/endian.h
--- a/fs/ntfs/endian.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/endian.h	Wed May 12 20:30:38 2004
@@ -2,20 +2,20 @@
  * endian.h - Defines for endianness handling in NTFS Linux kernel driver.
  *	      Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -45,4 +45,3 @@
 #define cpu_to_sle64p(x)	((s64)__cpu_to_le64(*(s64*)(x)))
 
 #endif /* _LINUX_NTFS_ENDIAN_H */
-
diff -Nru a/fs/ntfs/file.c b/fs/ntfs/file.c
--- a/fs/ntfs/file.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/file.c	Wed May 12 20:30:38 2004
@@ -1,20 +1,20 @@
 /*
  * file.c - NTFS kernel file operations. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -73,4 +73,3 @@
 struct file_operations ntfs_empty_file_ops = {};
 
 struct inode_operations ntfs_empty_inode_ops = {};
-
diff -Nru a/fs/ntfs/layout.h b/fs/ntfs/layout.h
--- a/fs/ntfs/layout.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/layout.h	Wed May 12 20:30:38 2004
@@ -1090,7 +1090,7 @@
 	SECURITY_NULL_RID		  = 0,	/* S-1-0 */
 	SECURITY_WORLD_RID		  = 0,	/* S-1-1 */
 	SECURITY_LOCAL_RID		  = 0,	/* S-1-2 */
-	
+
 	SECURITY_CREATOR_OWNER_RID	  = 0,	/* S-1-3 */
 	SECURITY_CREATOR_GROUP_RID	  = 1,	/* S-1-3 */
 
@@ -1110,10 +1110,10 @@
 	SECURITY_AUTHENTICATED_USER_RID	  = 0xb,
 	SECURITY_RESTRICTED_CODE_RID	  = 0xc,
 	SECURITY_TERMINAL_SERVER_RID	  = 0xd,
-	
+
 	SECURITY_LOGON_IDS_RID		  = 5,
 	SECURITY_LOGON_IDS_RID_COUNT	  = 3,
-	
+
 	SECURITY_LOCAL_SYSTEM_RID	  = 0x12,
 
 	SECURITY_NT_NON_UNIQUE		  = 0x15,
@@ -1123,12 +1123,12 @@
 	/*
 	 * Well-known domain relative sub-authority values (RIDs).
 	 */
-	
+
 	/* Users. */
 	DOMAIN_USER_RID_ADMIN		  = 0x1f4,
 	DOMAIN_USER_RID_GUEST		  = 0x1f5,
 	DOMAIN_USER_RID_KRBTGT		  = 0x1f6,
-	
+
 	/* Groups. */
 	DOMAIN_GROUP_RID_ADMINS		  = 0x200,
 	DOMAIN_GROUP_RID_USERS		  = 0x201,
@@ -1145,12 +1145,12 @@
 	DOMAIN_ALIAS_RID_USERS		  = 0x221,
 	DOMAIN_ALIAS_RID_GUESTS		  = 0x222,
 	DOMAIN_ALIAS_RID_POWER_USERS	  = 0x223,
-	
+
 	DOMAIN_ALIAS_RID_ACCOUNT_OPS	  = 0x224,
 	DOMAIN_ALIAS_RID_SYSTEM_OPS	  = 0x225,
 	DOMAIN_ALIAS_RID_PRINT_OPS	  = 0x226,
 	DOMAIN_ALIAS_RID_BACKUP_OPS	  = 0x227,
-	
+
 	DOMAIN_ALIAS_RID_REPLICATOR	  = 0x228,
 	DOMAIN_ALIAS_RID_RAS_SERVERS	  = 0x229,
 	DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a,
@@ -1258,7 +1258,7 @@
 
 	ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4,
 	ACCESS_MAX_MS_V3_ACE_TYPE	= 4,
-	
+
 	/* The following are Win2k only. */
 	ACCESS_MIN_MS_OBJECT_ACE_TYPE	= 5,
 	ACCESS_ALLOWED_OBJECT_ACE_TYPE	= 5,
@@ -1325,33 +1325,33 @@
 	 */
 
 	/* Specific rights for files and directories are as follows: */
-	
+
 	/* Right to read data from the file. (FILE) */
 	FILE_READ_DATA			= const_cpu_to_le32(0x00000001),
 	/* Right to list contents of a directory. (DIRECTORY) */
 	FILE_LIST_DIRECTORY		= const_cpu_to_le32(0x00000001),
-	
+
 	/* Right to write data to the file. (FILE) */
 	FILE_WRITE_DATA			= const_cpu_to_le32(0x00000002),
 	/* Right to create a file in the directory. (DIRECTORY) */
 	FILE_ADD_FILE			= const_cpu_to_le32(0x00000002),
-	
+
 	/* Right to append data to the file. (FILE) */
 	FILE_APPEND_DATA		= const_cpu_to_le32(0x00000004),
 	/* Right to create a subdirectory. (DIRECTORY) */
 	FILE_ADD_SUBDIRECTORY		= const_cpu_to_le32(0x00000004),
-	
+
 	/* Right to read extended attributes. (FILE/DIRECTORY) */
 	FILE_READ_EA			= const_cpu_to_le32(0x00000008),
-	
+
 	/* Right to write extended attributes. (FILE/DIRECTORY) */
 	FILE_WRITE_EA			= const_cpu_to_le32(0x00000010),
-	
+
 	/* Right to execute a file. (FILE) */
 	FILE_EXECUTE			= const_cpu_to_le32(0x00000020),
 	/* Right to traverse the directory. (DIRECTORY) */
 	FILE_TRAVERSE			= const_cpu_to_le32(0x00000020),
-	
+
 	/*
 	 * Right to delete a directory and all the files it contains (its
 	 * children), even if the files are read-only. (DIRECTORY)
@@ -1360,10 +1360,10 @@
 
 	/* Right to read file attributes. (FILE/DIRECTORY) */
 	FILE_READ_ATTRIBUTES		= const_cpu_to_le32(0x00000080),
-	
+
 	/* Right to change file attributes. (FILE/DIRECTORY) */
 	FILE_WRITE_ATTRIBUTES		= const_cpu_to_le32(0x00000100),
-	
+
 	/*
 	 * The standard rights (bits 16 to 23). Are independent of the type of
 	 * object being secured.
@@ -1396,15 +1396,15 @@
 	 * The following STANDARD_RIGHTS_* are combinations of the above for
 	 * convenience and are defined by the Win32 API.
 	 */
-	
+
 	/* These are currently defined to READ_CONTROL. */
 	STANDARD_RIGHTS_READ		= const_cpu_to_le32(0x00020000),
 	STANDARD_RIGHTS_WRITE		= const_cpu_to_le32(0x00020000),
 	STANDARD_RIGHTS_EXECUTE		= const_cpu_to_le32(0x00020000),
-	
+
 	/* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */
 	STANDARD_RIGHTS_REQUIRED	= const_cpu_to_le32(0x000f0000),
-	
+
 	/*
 	 * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and
 	 * SYNCHRONIZE access.
@@ -1790,6 +1790,9 @@
 	VOLUME_REPAIR_OBJECT_ID		= const_cpu_to_le16(0x0020),
 	VOLUME_MODIFIED_BY_CHKDSK	= const_cpu_to_le16(0x8000),
 	VOLUME_FLAGS_MASK		= const_cpu_to_le16(0x803f),
+
+	/* To make our life easier when checking if we must mount read-only. */
+	VOLUME_MUST_MOUNT_RO_MASK	= const_cpu_to_le16(0x8037),
 } __attribute__ ((__packed__)) VOLUME_FLAGS;
 
 /*
@@ -1973,7 +1976,7 @@
 
 	QUOTA_FLAG_USER_MASK		= const_cpu_to_le32(0x00000007),
 		/* Bit mask for user quota flags. */
-	
+
 	/* These flags are only present in the quota defaults index entry,
 	   i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */
 	QUOTA_FLAG_TRACKING_ENABLED	= const_cpu_to_le32(0x00000010),
@@ -2177,7 +2180,7 @@
 	IO_REPARSE_TAG_IS_ALIAS		= const_cpu_to_le32(0x20000000),
 	IO_REPARSE_TAG_IS_HIGH_LATENCY	= const_cpu_to_le32(0x40000000),
 	IO_REPARSE_TAG_IS_MICROSOFT	= const_cpu_to_le32(0x80000000),
-	
+
 	IO_REPARSE_TAG_RESERVED_ZERO	= const_cpu_to_le32(0x00000000),
 	IO_REPARSE_TAG_RESERVED_ONE	= const_cpu_to_le32(0x00000001),
 	IO_REPARSE_TAG_RESERVED_RANGE	= const_cpu_to_le32(0x00000001),
@@ -2280,4 +2283,3 @@
 } __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR;
 
 #endif /* _LINUX_NTFS_LAYOUT_H */
-
diff -Nru a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
--- a/fs/ntfs/logfile.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/logfile.c	Wed May 12 20:30:38 2004
@@ -1,7 +1,7 @@
 /*
  * logfile.c - NTFS kernel journal handling. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2002-2004 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/malloc.h b/fs/ntfs/malloc.h
--- a/fs/ntfs/malloc.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/malloc.h	Wed May 12 20:30:38 2004
@@ -1,7 +1,7 @@
 /*
  * malloc.h - NTFS kernel memory handling. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/mft.c b/fs/ntfs/mft.c
--- a/fs/ntfs/mft.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/mft.c	Wed May 12 20:30:38 2004
@@ -1,7 +1,7 @@
 /**
  * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2003 Anton Altaparmakov
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
@@ -9,13 +9,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -429,4 +429,3 @@
 		ntfs_clear_extent_inode(ni);
 	return m;
 }
-
diff -Nru a/fs/ntfs/mft.h b/fs/ntfs/mft.h
--- a/fs/ntfs/mft.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/mft.h	Wed May 12 20:30:38 2004
@@ -2,7 +2,7 @@
  * mft.h - Defines for mft record handling in NTFS Linux kernel driver.
  *	   Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -28,8 +28,6 @@
 #include "inode.h"
 
 extern int format_mft_record(ntfs_inode *ni, MFT_RECORD *m);
-//extern int format_mft_record2(struct super_block *vfs_sb,
-//		const unsigned long inum, MFT_RECORD *m);
 
 extern MFT_RECORD *map_mft_record(ntfs_inode *ni);
 extern void unmap_mft_record(ntfs_inode *ni);
diff -Nru a/fs/ntfs/mst.c b/fs/ntfs/mst.c
--- a/fs/ntfs/mst.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/mst.c	Wed May 12 20:30:38 2004
@@ -2,7 +2,7 @@
  * mst.c - NTFS multi sector transfer protection handling code. Part of the
  *	   Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/namei.c b/fs/ntfs/namei.c
--- a/fs/ntfs/namei.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/namei.c	Wed May 12 20:30:38 2004
@@ -1,6 +1,6 @@
 /*
  * namei.c - NTFS kernel directory inode operations. Part of the Linux-NTFS
- * 	     project.
+ *	     project.
  *
  * Copyright (c) 2001-2004 Anton Altaparmakov
  *
@@ -9,13 +9,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
diff -Nru a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
--- a/fs/ntfs/ntfs.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/ntfs.h	Wed May 12 20:30:38 2004
@@ -2,8 +2,8 @@
  * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
  *	    project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
- * Copyright (C) 2002 Richard Russon.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
+ * Copyright (C) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
@@ -202,4 +202,3 @@
 extern uchar_t *generate_default_upcase(void);
 
 #endif /* _LINUX_NTFS_H */
-
diff -Nru a/fs/ntfs/super.c b/fs/ntfs/super.c
--- a/fs/ntfs/super.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/super.c	Wed May 12 20:30:38 2004
@@ -314,7 +314,9 @@
 #else /* ! NTFS_RW */
 	/*
 	 * For the read-write compiled driver, if we are remounting read-write,
-	 * make sure there aren't any volume errors and empty the lofgile.
+	 * make sure there are no volume errors and that no unsupported volume
+	 * flags are set.  Also, empty the logfile journal as it would become
+	 * stale as soon as something is written to the volume.
 	 */
 	if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
 		static const char *es = ".  Cannot remount read-write.";
@@ -324,6 +326,11 @@
 					es);
 			return -EROFS;
 		}
+		if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
+			ntfs_error(sb, "Volume has unsupported flags set and "
+					"is read-only%s", es);
+			return -EROFS;
+		}
 		if (!ntfs_empty_logfile(vol->logfile_ino)) {
 			ntfs_error(sb, "Failed to empty journal $LogFile%s",
 					es);
@@ -1133,6 +1140,31 @@
 	printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver,
 			vol->minor_ver);
 #ifdef NTFS_RW
+	/* Make sure that no unsupported volume flags are set. */
+	if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
+		static const char *es1 = "Volume has unsupported flags set ";
+		static const char *es2 = ".  Run chkdsk and mount in Windows.";
+
+		/* If a read-write mount, convert it to a read-only mount. */
+		if (!(sb->s_flags & MS_RDONLY)) {
+			if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
+					ON_ERRORS_CONTINUE))) {
+				ntfs_error(sb, "%s and neither on_errors="
+						"continue nor on_errors="
+						"remount-ro was specified%s",
+						es1, es2);
+				goto iput_vol_err_out;
+			}
+			sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME;
+			ntfs_error(sb, "%s.  Mounting read-only%s", es1, es2);
+		} else
+			ntfs_warning(sb, "%s.  Will not be able to remount "
+					"read-write%s", es1, es2);
+		/*
+		 * Do not set NVolErrors() because ntfs_remount() re-checks the
+		 * flags which we need to do in case any flags have changed.
+		 */
+	}
 	/*
 	 * Get the inode for the logfile, check it and determine if the volume
 	 * was shutdown cleanly.
@@ -1240,6 +1272,7 @@
 #ifdef NTFS_RW
 	if (vol->logfile_ino)
 		iput(vol->logfile_ino);
+iput_vol_err_out:
 #endif /* NTFS_RW */
 	iput(vol->vol_ino);
 iput_lcnbmp_err_out:
diff -Nru a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
--- a/fs/ntfs/sysctl.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/sysctl.c	Wed May 12 20:30:38 2004
@@ -1,22 +1,22 @@
 /*
  * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
  *	      the Linux-NTFS project. Adapted from the old NTFS driver,
- *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne.
+ *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne
  *
- * Copyright (c) 2002 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -37,7 +37,7 @@
 
 /* Definition of the ntfs sysctl. */
 static ctl_table ntfs_sysctls[] = {
-	{ FS_NTFS, "ntfs-debug", 		/* Binary and text IDs. */
+	{ FS_NTFS, "ntfs-debug",		/* Binary and text IDs. */
 	  &debug_msgs,sizeof(debug_msgs),	/* Data pointer and size. */
 	  0644,	NULL, &proc_dointvec },		/* Mode, child, proc handler. */
 	{ 0 }
@@ -83,4 +83,3 @@
 
 #endif /* CONFIG_SYSCTL */
 #endif /* DEBUG */
-
diff -Nru a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
--- a/fs/ntfs/sysctl.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/sysctl.h	Wed May 12 20:30:38 2004
@@ -1,22 +1,22 @@
 /*
  * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of
  *	      the Linux-NTFS project. Adapted from the old NTFS driver,
- *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne.
- * 
- * Copyright (c) 2002 Anton Altaparmakov.
+ *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne
+ *
+ * Copyright (c) 2002-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -40,4 +40,3 @@
 
 #endif /* DEBUG && CONFIG_SYSCTL */
 #endif /* _LINUX_NTFS_SYSCTL_H */
-
diff -Nru a/fs/ntfs/time.h b/fs/ntfs/time.h
--- a/fs/ntfs/time.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/time.h	Wed May 12 20:30:38 2004
@@ -1,7 +1,7 @@
 /*
  * time.h - NTFS time conversion functions.  Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/types.h b/fs/ntfs/types.h
--- a/fs/ntfs/types.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/types.h	Wed May 12 20:30:38 2004
@@ -2,7 +2,7 @@
  * types.h - Defines for NTFS Linux kernel driver specific types.
  *	     Part of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
diff -Nru a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
--- a/fs/ntfs/unistr.c	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/unistr.c	Wed May 12 20:30:38 2004
@@ -8,13 +8,13 @@
  * by the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * This program/include file is distributed in the hope that it will be 
- * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
+ * This program/include file is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program (in the main directory of the Linux-NTFS 
+ * along with this program (in the main directory of the Linux-NTFS
  * distribution in the file COPYING); if not, write to the Free Software
  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
@@ -62,9 +62,8 @@
  * the @upcase table is used to performa a case insensitive comparison.
  */
 BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len,
-		     const uchar_t *s2, size_t s2_len,
-		     const IGNORE_CASE_BOOL ic,
-		     const uchar_t *upcase, const u32 upcase_size)
+		const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic,
+		const uchar_t *upcase, const u32 upcase_size)
 {
 	if (s1_len != s2_len)
 		return FALSE;
@@ -78,12 +77,12 @@
  * @name1:	first Unicode name to compare
  * @name2:	second Unicode name to compare
  * @err_val:	if @name1 contains an invalid character return this value
- * @ic:         either CASE_SENSITIVE or IGNORE_CASE
+ * @ic:		either CASE_SENSITIVE or IGNORE_CASE
  * @upcase:	upcase table (ignored if @ic is CASE_SENSITIVE)
  * @upcase_len:	upcase table size (ignored if @ic is CASE_SENSITIVE)
  *
  * ntfs_collate_names collates two Unicode names and returns:
- * 
+ *
  *  -1 if the first name collates before the second one,
  *   0 if the names match,
  *   1 if the second name collates before the first one, or
@@ -138,7 +137,7 @@
  * Compare the first @n characters of the Unicode strings @s1 and @s2,
  * The strings in little endian format and appropriate le16_to_cpu()
  * conversion is performed on non-little endian machines.
- * 
+ *
  * The function returns an integer less than, equal to, or greater than zero
  * if @s1 (or the first @n Unicode characters thereof) is found, respectively,
  * to be less than, to match, or be greater than @s2.
@@ -172,7 +171,7 @@
  * Compare the first @n characters of the Unicode strings @s1 and @s2,
  * ignoring case. The strings in little endian format and appropriate
  * le16_to_cpu() conversion is performed on non-little endian machines.
- * 
+ *
  * Each character is uppercased using the @upcase table before the comparison.
  *
  * The function returns an integer less than, equal to, or greater than zero
@@ -180,7 +179,7 @@
  * to be less than, to match, or be greater than @s2.
  */
 int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n,
-		     const uchar_t *upcase, const u32 upcase_size)
+		const uchar_t *upcase, const u32 upcase_size)
 {
 	uchar_t c1, c2;
 	size_t i;
@@ -381,4 +380,3 @@
 	ntfs_error(vol->sb, "Failed to allocate name!");
 	return -ENOMEM;
 }
-
diff -Nru a/fs/ntfs/volume.h b/fs/ntfs/volume.h
--- a/fs/ntfs/volume.h	Wed May 12 20:30:38 2004
+++ b/fs/ntfs/volume.h	Wed May 12 20:30:38 2004
@@ -2,8 +2,8 @@
  * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
  *	      of the Linux-NTFS project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov.
- * Copyright (c) 2002 Richard Russon.
+ * Copyright (c) 2001-2004 Anton Altaparmakov
+ * Copyright (c) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published