aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2006-02-24 05:48:14 -0500
committerAnton Altaparmakov <aia21@cantab.net>2006-02-24 05:48:14 -0500
commit1cf3109ffb26a6ea572fd02436bd10458b4b2187 (patch)
tree446f6e1c2160565f8dd1bf4da0e211c00fcce284 /fs
parent78af34f03d33d2ba179c9d35685860170b94a285 (diff)
NTFS: Do more detailed reporting of why we cannot mount read-write by
special casing the VOLUME_MODIFIED_BY_CHKDSK flag. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ntfs/ChangeLog2
-rw-r--r--fs/ntfs/Makefile2
-rw-r--r--fs/ntfs/super.c34
-rw-r--r--fs/ntfs/upcase.c10
-rw-r--r--fs/ntfs/volume.h28
5 files changed, 47 insertions, 29 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index e66b4ac2fade..9d8ffa89e2c2 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -29,6 +29,8 @@ ToDo/Notes:
29 kmem_cache_t. (Pekka Enberg) 29 kmem_cache_t. (Pekka Enberg)
30 - Implement support for sector sizes above 512 bytes (up to the maximum 30 - Implement support for sector sizes above 512 bytes (up to the maximum
31 supported by NTFS which is 4096 bytes). 31 supported by NTFS which is 4096 bytes).
32 - Do more detailed reporting of why we cannot mount read-write by
33 special casing the VOLUME_MODIFIED_BY_CHKDSK flag.
32 - Miscellaneous updates to layout.h. 34 - Miscellaneous updates to layout.h.
33 - Cope with attribute list attribute having invalid flags. Windows 35 - Cope with attribute list attribute having invalid flags. Windows
34 copes with this and even chkdsk does not detect or fix this so we 36 copes with this and even chkdsk does not detect or fix this so we
diff --git a/fs/ntfs/Makefile b/fs/ntfs/Makefile
index d0d45d1c853a..d95fac7fdeb6 100644
--- a/fs/ntfs/Makefile
+++ b/fs/ntfs/Makefile
@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
6 index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ 6 index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \
7 unistr.o upcase.o 7 unistr.o upcase.o
8 8
9EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.25\" 9EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.26\"
10 10
11ifeq ($(CONFIG_NTFS_DEBUG),y) 11ifeq ($(CONFIG_NTFS_DEBUG),y)
12EXTRA_CFLAGS += -DDEBUG 12EXTRA_CFLAGS += -DDEBUG
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 489f7049146b..368a8ec10668 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -472,9 +472,16 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)
472 ntfs_error(sb, "Volume is dirty and read-only%s", es); 472 ntfs_error(sb, "Volume is dirty and read-only%s", es);
473 return -EROFS; 473 return -EROFS;
474 } 474 }
475 if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
476 ntfs_error(sb, "Volume has been modified by chkdsk "
477 "and is read-only%s", es);
478 return -EROFS;
479 }
475 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { 480 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
476 ntfs_error(sb, "Volume has unsupported flags set and " 481 ntfs_error(sb, "Volume has unsupported flags set "
477 "is read-only%s", es); 482 "(0x%x) and is read-only%s",
483 (unsigned)le16_to_cpu(vol->vol_flags),
484 es);
478 return -EROFS; 485 return -EROFS;
479 } 486 }
480 if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { 487 if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) {
@@ -1845,11 +1852,24 @@ get_ctx_vol_failed:
1845 /* Make sure that no unsupported volume flags are set. */ 1852 /* Make sure that no unsupported volume flags are set. */
1846 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { 1853 if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) {
1847 static const char *es1a = "Volume is dirty"; 1854 static const char *es1a = "Volume is dirty";
1848 static const char *es1b = "Volume has unsupported flags set"; 1855 static const char *es1b = "Volume has been modified by chkdsk";
1849 static const char *es2 = ". Run chkdsk and mount in Windows."; 1856 static const char *es1c = "Volume has unsupported flags set";
1850 const char *es1; 1857 static const char *es2a = ". Run chkdsk and mount in Windows.";
1851 1858 static const char *es2b = ". Mount in Windows.";
1852 es1 = vol->vol_flags & VOLUME_IS_DIRTY ? es1a : es1b; 1859 const char *es1, *es2;
1860
1861 es2 = es2a;
1862 if (vol->vol_flags & VOLUME_IS_DIRTY)
1863 es1 = es1a;
1864 else if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) {
1865 es1 = es1b;
1866 es2 = es2b;
1867 } else {
1868 es1 = es1c;
1869 ntfs_warning(sb, "Unsupported volume flags 0x%x "
1870 "encountered.",
1871 (unsigned)le16_to_cpu(vol->vol_flags));
1872 }
1853 /* If a read-write mount, convert it to a read-only mount. */ 1873 /* If a read-write mount, convert it to a read-only mount. */
1854 if (!(sb->s_flags & MS_RDONLY)) { 1874 if (!(sb->s_flags & MS_RDONLY)) {
1855 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO | 1875 if (!(vol->on_errors & (ON_ERRORS_REMOUNT_RO |
diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c
index 879cdf1d5bd3..9101807dc81a 100644
--- a/fs/ntfs/upcase.c
+++ b/fs/ntfs/upcase.c
@@ -3,10 +3,7 @@
3 * Part of the Linux-NTFS project. 3 * Part of the Linux-NTFS project.
4 * 4 *
5 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org> 5 * Copyright (c) 2001 Richard Russon <ntfs@flatcap.org>
6 * Copyright (c) 2001-2004 Anton Altaparmakov 6 * Copyright (c) 2001-2006 Anton Altaparmakov
7 *
8 * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov.
9 * Modified for kernel inclusion 10 September 2001 by Anton Altparmakov.
10 * 7 *
11 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free 9 * under the terms of the GNU General Public License as published by the Free
@@ -75,12 +72,13 @@ ntfschar *generate_default_upcase(void)
75 if (!uc) 72 if (!uc)
76 return uc; 73 return uc;
77 memset(uc, 0, default_upcase_len * sizeof(ntfschar)); 74 memset(uc, 0, default_upcase_len * sizeof(ntfschar));
75 /* Generate the little endian Unicode upcase table used by ntfs. */
78 for (i = 0; i < default_upcase_len; i++) 76 for (i = 0; i < default_upcase_len; i++)
79 uc[i] = cpu_to_le16(i); 77 uc[i] = cpu_to_le16(i);
80 for (r = 0; uc_run_table[r][0]; r++) 78 for (r = 0; uc_run_table[r][0]; r++)
81 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) 79 for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++)
82 uc[i] = cpu_to_le16((le16_to_cpu(uc[i]) + 80 uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) +
83 uc_run_table[r][2])); 81 uc_run_table[r][2]);
84 for (r = 0; uc_dup_table[r][0]; r++) 82 for (r = 0; uc_dup_table[r][0]; r++)
85 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) 83 for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2)
86 uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); 84 uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1);
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h
index 375cd20a9f61..406ab55dfb32 100644
--- a/fs/ntfs/volume.h
+++ b/fs/ntfs/volume.h
@@ -2,7 +2,7 @@
2 * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part 2 * volume.h - Defines for volume structures in NTFS Linux kernel driver. Part
3 * of the Linux-NTFS project. 3 * of the Linux-NTFS project.
4 * 4 *
5 * Copyright (c) 2001-2005 Anton Altaparmakov 5 * Copyright (c) 2001-2006 Anton Altaparmakov
6 * Copyright (c) 2002 Richard Russon 6 * Copyright (c) 2002 Richard Russon
7 * 7 *
8 * This program/include file is free software; you can redistribute it and/or 8 * This program/include file is free software; you can redistribute it and/or
@@ -41,10 +41,8 @@ typedef struct {
41 * structure has stabilized... (AIA) 41 * structure has stabilized... (AIA)
42 */ 42 */
43 /* Device specifics. */ 43 /* Device specifics. */
44 struct super_block *sb; /* Pointer back to the super_block, 44 struct super_block *sb; /* Pointer back to the super_block. */
45 so we don't have to get the offset 45 LCN nr_blocks; /* Number of sb->s_blocksize bytes
46 every time. */
47 LCN nr_blocks; /* Number of NTFS_BLOCK_SIZE bytes
48 sized blocks on the device. */ 46 sized blocks on the device. */
49 /* Configuration provided by user at mount time. */ 47 /* Configuration provided by user at mount time. */
50 unsigned long flags; /* Miscellaneous flags, see below. */ 48 unsigned long flags; /* Miscellaneous flags, see below. */
@@ -141,8 +139,8 @@ typedef enum {
141 NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */ 139 NV_ShowSystemFiles, /* 1: Return system files in ntfs_readdir(). */
142 NV_CaseSensitive, /* 1: Treat file names as case sensitive and 140 NV_CaseSensitive, /* 1: Treat file names as case sensitive and
143 create filenames in the POSIX namespace. 141 create filenames in the POSIX namespace.
144 Otherwise be case insensitive and create 142 Otherwise be case insensitive but still
145 file names in WIN32 namespace. */ 143 create file names in POSIX namespace. */
146 NV_LogFileEmpty, /* 1: $LogFile journal is empty. */ 144 NV_LogFileEmpty, /* 1: $LogFile journal is empty. */
147 NV_QuotaOutOfDate, /* 1: $Quota is out of date. */ 145 NV_QuotaOutOfDate, /* 1: $Quota is out of date. */
148 NV_UsnJrnlStamped, /* 1: $UsnJrnl has been stamped. */ 146 NV_UsnJrnlStamped, /* 1: $UsnJrnl has been stamped. */
@@ -153,7 +151,7 @@ typedef enum {
153 * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo() 151 * Macro tricks to expand the NVolFoo(), NVolSetFoo(), and NVolClearFoo()
154 * functions. 152 * functions.
155 */ 153 */
156#define NVOL_FNS(flag) \ 154#define DEFINE_NVOL_BIT_OPS(flag) \
157static inline int NVol##flag(ntfs_volume *vol) \ 155static inline int NVol##flag(ntfs_volume *vol) \
158{ \ 156{ \
159 return test_bit(NV_##flag, &(vol)->flags); \ 157 return test_bit(NV_##flag, &(vol)->flags); \
@@ -168,12 +166,12 @@ static inline void NVolClear##flag(ntfs_volume *vol) \
168} 166}
169 167
170/* Emit the ntfs volume bitops functions. */ 168/* Emit the ntfs volume bitops functions. */
171NVOL_FNS(Errors) 169DEFINE_NVOL_BIT_OPS(Errors)
172NVOL_FNS(ShowSystemFiles) 170DEFINE_NVOL_BIT_OPS(ShowSystemFiles)
173NVOL_FNS(CaseSensitive) 171DEFINE_NVOL_BIT_OPS(CaseSensitive)
174NVOL_FNS(LogFileEmpty) 172DEFINE_NVOL_BIT_OPS(LogFileEmpty)
175NVOL_FNS(QuotaOutOfDate) 173DEFINE_NVOL_BIT_OPS(QuotaOutOfDate)
176NVOL_FNS(UsnJrnlStamped) 174DEFINE_NVOL_BIT_OPS(UsnJrnlStamped)
177NVOL_FNS(SparseEnabled) 175DEFINE_NVOL_BIT_OPS(SparseEnabled)
178 176
179#endif /* _LINUX_NTFS_VOLUME_H */ 177#endif /* _LINUX_NTFS_VOLUME_H */