aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-10-19 07:21:19 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-10-19 07:21:19 -0400
commit7d0ffdb279105d9a87b447758ce4a634496abfd1 (patch)
tree66bd4d6307a81ae65a01acace5fd8ae6f5a30032
parente087a412b45543a87497f0a213dbd5d55099f267 (diff)
NTFS: $EA attributes can be both resident non-resident.
Minor tidying. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
-rw-r--r--fs/ntfs/ChangeLog1
-rw-r--r--fs/ntfs/aops.c5
-rw-r--r--fs/ntfs/attrib.c2
-rw-r--r--fs/ntfs/file.c14
-rw-r--r--fs/ntfs/layout.h27
5 files changed, 35 insertions, 14 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 03015c7b236c..bc6ec16ad1f8 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -75,6 +75,7 @@ ToDo/Notes:
75 for highly fragmented files, i.e. ones whose data attribute is split 75 for highly fragmented files, i.e. ones whose data attribute is split
76 across multiple extents. When such a case is encountered, 76 across multiple extents. When such a case is encountered,
77 EOPNOTSUPP is returned. 77 EOPNOTSUPP is returned.
78 - $EA attributes can be both resident non-resident.
78 79
792.1.24 - Lots of bug fixes and support more clean journal states. 802.1.24 - Lots of bug fixes and support more clean journal states.
80 81
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 8f23c60030c0..1c0a4315876a 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -1391,8 +1391,7 @@ retry_writepage:
1391 if (NInoEncrypted(ni)) { 1391 if (NInoEncrypted(ni)) {
1392 unlock_page(page); 1392 unlock_page(page);
1393 BUG_ON(ni->type != AT_DATA); 1393 BUG_ON(ni->type != AT_DATA);
1394 ntfs_debug("Denying write access to encrypted " 1394 ntfs_debug("Denying write access to encrypted file.");
1395 "file.");
1396 return -EACCES; 1395 return -EACCES;
1397 } 1396 }
1398 /* Compressed data streams are handled in compress.c. */ 1397 /* Compressed data streams are handled in compress.c. */
@@ -1508,8 +1507,8 @@ retry_writepage:
1508 /* Zero out of bounds area in the page cache page. */ 1507 /* Zero out of bounds area in the page cache page. */
1509 memset(kaddr + attr_len, 0, PAGE_CACHE_SIZE - attr_len); 1508 memset(kaddr + attr_len, 0, PAGE_CACHE_SIZE - attr_len);
1510 kunmap_atomic(kaddr, KM_USER0); 1509 kunmap_atomic(kaddr, KM_USER0);
1511 flush_dcache_mft_record_page(ctx->ntfs_ino);
1512 flush_dcache_page(page); 1510 flush_dcache_page(page);
1511 flush_dcache_mft_record_page(ctx->ntfs_ino);
1513 /* We are done with the page. */ 1512 /* We are done with the page. */
1514 end_page_writeback(page); 1513 end_page_writeback(page);
1515 /* Finally, mark the mft record dirty, so it gets written back. */ 1514 /* Finally, mark the mft record dirty, so it gets written back. */
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 338e47144fc9..df2e2091f936 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -1411,7 +1411,7 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type)
1411 */ 1411 */
1412int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type) 1412int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type)
1413{ 1413{
1414 if (type == AT_INDEX_ALLOCATION || type == AT_EA) 1414 if (type == AT_INDEX_ALLOCATION)
1415 return -EPERM; 1415 return -EPERM;
1416 return 0; 1416 return 0;
1417} 1417}
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index cf2a0e2330df..5fb341a16b52 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -1857,10 +1857,24 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
1857 if (ni->type != AT_INDEX_ALLOCATION) { 1857 if (ni->type != AT_INDEX_ALLOCATION) {
1858 /* If file is encrypted, deny access, just like NT4. */ 1858 /* If file is encrypted, deny access, just like NT4. */
1859 if (NInoEncrypted(ni)) { 1859 if (NInoEncrypted(ni)) {
1860 /*
1861 * Reminder for later: Encrypted files are _always_
1862 * non-resident so that the content can always be
1863 * encrypted.
1864 */
1860 ntfs_debug("Denying write access to encrypted file."); 1865 ntfs_debug("Denying write access to encrypted file.");
1861 return -EACCES; 1866 return -EACCES;
1862 } 1867 }
1863 if (NInoCompressed(ni)) { 1868 if (NInoCompressed(ni)) {
1869 /* Only unnamed $DATA attribute can be compressed. */
1870 BUG_ON(ni->type != AT_DATA);
1871 BUG_ON(ni->name_len);
1872 /*
1873 * Reminder for later: If resident, the data is not
1874 * actually compressed. Only on the switch to non-
1875 * resident does compression kick in. This is in
1876 * contrast to encrypted files (see above).
1877 */
1864 ntfs_error(vi->i_sb, "Writing to compressed files is " 1878 ntfs_error(vi->i_sb, "Writing to compressed files is "
1865 "not implemented yet. Sorry."); 1879 "not implemented yet. Sorry.");
1866 return -EOPNOTSUPP; 1880 return -EOPNOTSUPP;
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h
index 5c248d404f05..71b25dab8199 100644
--- a/fs/ntfs/layout.h
+++ b/fs/ntfs/layout.h
@@ -1021,10 +1021,17 @@ enum {
1021 FILE_NAME_POSIX = 0x00, 1021 FILE_NAME_POSIX = 0x00,
1022 /* This is the largest namespace. It is case sensitive and allows all 1022 /* This is the largest namespace. It is case sensitive and allows all
1023 Unicode characters except for: '\0' and '/'. Beware that in 1023 Unicode characters except for: '\0' and '/'. Beware that in
1024 WinNT/2k files which eg have the same name except for their case 1024 WinNT/2k/2003 by default files which eg have the same name except
1025 will not be distinguished by the standard utilities and thus a "del 1025 for their case will not be distinguished by the standard utilities
1026 filename" will delete both "filename" and "fileName" without 1026 and thus a "del filename" will delete both "filename" and "fileName"
1027 warning. */ 1027 without warning. However if for example Services For Unix (SFU) are
1028 installed and the case sensitive option was enabled at installation
1029 time, then you can create/access/delete such files.
1030 Note that even SFU places restrictions on the filenames beyond the
1031 '\0' and '/' and in particular the following set of characters is
1032 not allowed: '"', '/', '<', '>', '\'. All other characters,
1033 including the ones no allowed in WIN32 namespace are allowed.
1034 Tested with SFU 3.5 (this is now free) running on Windows XP. */
1028 FILE_NAME_WIN32 = 0x01, 1035 FILE_NAME_WIN32 = 0x01,
1029 /* The standard WinNT/2k NTFS long filenames. Case insensitive. All 1036 /* The standard WinNT/2k NTFS long filenames. Case insensitive. All
1030 Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\', 1037 Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\',
@@ -2375,20 +2382,20 @@ typedef u8 EA_FLAGS;
2375/* 2382/*
2376 * Attribute: Extended attribute (EA) (0xe0). 2383 * Attribute: Extended attribute (EA) (0xe0).
2377 * 2384 *
2378 * NOTE: Always non-resident. (Is this true?) 2385 * NOTE: Can be resident or non-resident.
2379 * 2386 *
2380 * Like the attribute list and the index buffer list, the EA attribute value is 2387 * Like the attribute list and the index buffer list, the EA attribute value is
2381 * a sequence of EA_ATTR variable length records. 2388 * a sequence of EA_ATTR variable length records.
2382 *
2383 * FIXME: It appears weird that the EA name is not unicode. Is it true?
2384 */ 2389 */
2385typedef struct { 2390typedef struct {
2386 le32 next_entry_offset; /* Offset to the next EA_ATTR. */ 2391 le32 next_entry_offset; /* Offset to the next EA_ATTR. */
2387 EA_FLAGS flags; /* Flags describing the EA. */ 2392 EA_FLAGS flags; /* Flags describing the EA. */
2388 u8 ea_name_length; /* Length of the name of the EA in bytes. */ 2393 u8 ea_name_length; /* Length of the name of the EA in bytes
2394 excluding the '\0' byte terminator. */
2389 le16 ea_value_length; /* Byte size of the EA's value. */ 2395 le16 ea_value_length; /* Byte size of the EA's value. */
2390 u8 ea_name[0]; /* Name of the EA. */ 2396 u8 ea_name[0]; /* Name of the EA. Note this is ASCII, not
2391 u8 ea_value[0]; /* The value of the EA. Immediately follows 2397 Unicode and it is zero terminated. */
2398 u8 ea_value[0]; /* The value of the EA. Immediately follows
2392 the name. */ 2399 the name. */
2393} __attribute__ ((__packed__)) EA_ATTR; 2400} __attribute__ ((__packed__)) EA_ATTR;
2394 2401