]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NTFS: Update attribute definition handling.
authorAnton Altaparmakov <aia21@cantab.net>
Wed, 6 Apr 2005 12:34:31 +0000 (13:34 +0100)
committerAnton Altaparmakov <aia21@cantab.net>
Thu, 5 May 2005 10:46:17 +0000 (11:46 +0100)
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
fs/ntfs/ChangeLog
fs/ntfs/attrib.c
fs/ntfs/layout.h
fs/ntfs/ntfs.h

index 8ff6ea778fbd9eb1724c3a3c4a61b1b59ab8385e..52f868a9662b567cea3c7c84bee8dc7bcfd9e886 100644 (file)
@@ -110,6 +110,7 @@ ToDo/Notes:
          only emit a warning when the checksum is incorrect rather than
          refusing the mount.  Thanks to Bernd Casimir for pointing this
          problem out.
+       - Update attribute definition handling.
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 
index 1b95f39234a3b5b972bbdcbc56e4c5fd898a06e8..23ca3bdfb89a0bcf761913cce2221e00e0d51ff5 100644 (file)
@@ -1138,28 +1138,21 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPE type,
  * Check whether the attribute of @type on the ntfs volume @vol is allowed to
  * be non-resident.  This information is obtained from $AttrDef system file.
  *
- * Return 0 if the attribute is allowed to be non-resident, -EPERM if not, or
+ * Return 0 if the attribute is allowed to be non-resident, -EPERM if not, and
  * -ENOENT if the attribute is not listed in $AttrDef.
  */
 int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type)
 {
        ATTR_DEF *ad;
 
-       /*
-        * $DATA and $EA are always allowed to be non-resident even if $AttrDef
-        * does not specify this in the flags of the $DATA attribute definition
-        * record.
-        */
-       if (type == AT_DATA || type == AT_EA)
-               return 0;
        /* Find the attribute definition record in $AttrDef. */
        ad = ntfs_attr_find_in_attrdef(vol, type);
        if (unlikely(!ad))
                return -ENOENT;
        /* Check the flags and return the result. */
-       if (ad->flags & CAN_BE_NON_RESIDENT)
-               return 0;
-       return -EPERM;
+       if (ad->flags & ATTR_DEF_RESIDENT)
+               return -EPERM;
+       return 0;
 }
 
 /**
@@ -1182,9 +1175,9 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type)
  */
 int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type)
 {
-       if (type != AT_INDEX_ALLOCATION && type != AT_EA)
-               return 0;
-       return -EPERM;
+       if (type == AT_INDEX_ALLOCATION || type == AT_EA)
+               return -EPERM;
+       return 0;
 }
 
 /**
index 8d1f1326612fb50e9a7c24b9a37d22a8b8d9f0a9..458cb541d4dda98f5830c7ad00394c4d94fdcfd5 100644 (file)
@@ -547,26 +547,44 @@ enum {
        COLLATION_NTOFS_ULONG           = const_cpu_to_le32(0x10),
        COLLATION_NTOFS_SID             = const_cpu_to_le32(0x11),
        COLLATION_NTOFS_SECURITY_HASH   = const_cpu_to_le32(0x12),
-       COLLATION_NTOFS_ULONGS          = const_cpu_to_le32(0x13)
+       COLLATION_NTOFS_ULONGS          = const_cpu_to_le32(0x13),
 };
 
 typedef le32 COLLATION_RULE;
 
 /*
  * The flags (32-bit) describing attribute properties in the attribute
- * definition structure.  FIXME: This information is from Regis's information
- * and, according to him, it is not certain and probably incomplete.
- * The INDEXABLE flag is fairly certainly correct as only the file name
- * attribute has this flag set and this is the only attribute indexed in NT4.
+ * definition structure.  FIXME: This information is based on Regis's
+ * information and, according to him, it is not certain and probably
+ * incomplete.  The INDEXABLE flag is fairly certainly correct as only the file
+ * name attribute has this flag set and this is the only attribute indexed in
+ * NT4.
  */
 enum {
-       INDEXABLE           = const_cpu_to_le32(0x02), /* Attribute can be
-                                                         indexed. */
-       NEED_TO_REGENERATE  = const_cpu_to_le32(0x40), /* Need to regenerate
-                                                         during regeneration
-                                                         phase. */
-       CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be
-                                                         non-resident. */
+       ATTR_DEF_INDEXABLE      = const_cpu_to_le32(0x02), /* Attribute can be
+                                       indexed. */
+       ATTR_DEF_MULTIPLE       = const_cpu_to_le32(0x04), /* Attribute type
+                                       can be present multiple times in the
+                                       mft records of an inode. */
+       ATTR_DEF_NOT_ZERO       = const_cpu_to_le32(0x08), /* Attribute value
+                                       must contain at least one non-zero
+                                       byte. */
+       ATTR_DEF_INDEXED_UNIQUE = const_cpu_to_le32(0x10), /* Attribute must be
+                                       indexed and the attribute value must be
+                                       unique for the attribute type in all of
+                                       the mft records of an inode. */
+       ATTR_DEF_NAMED_UNIQUE   = const_cpu_to_le32(0x20), /* Attribute must be
+                                       named and the name must be unique for
+                                       the attribute type in all of the mft
+                                       records of an inode. */
+       ATTR_DEF_RESIDENT       = const_cpu_to_le32(0x40), /* Attribute must be
+                                       resident. */
+       ATTR_DEF_ALWAYS_LOG     = const_cpu_to_le32(0x80), /* Always log
+                                       modifications to this attribute,
+                                       regardless of whether it is resident or
+                                       non-resident.  Without this, only log
+                                       modifications if the attribute is
+                                       resident. */
 };
 
 typedef le32 ATTR_DEF_FLAGS;
index a0bf706797bb28c507927eff0871738afe4093df..e85f6e928b1ef91fc251bdd427c1a67e363cdbd4 100644 (file)
@@ -2,7 +2,7 @@
  * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
  *         project.
  *
- * Copyright (c) 2001-2004 Anton Altaparmakov
+ * Copyright (c) 2001-2005 Anton Altaparmakov
  * Copyright (C) 2002 Richard Russon
  *
  * This program/include file is free software; you can redistribute it and/or
@@ -41,6 +41,7 @@ typedef enum {
        NTFS_BLOCK_SIZE_BITS    = 9,
        NTFS_SB_MAGIC           = 0x5346544e,   /* 'NTFS' */
        NTFS_MAX_NAME_LEN       = 255,
+       NTFS_MAX_ATTR_NAME_LEN  = 255,
 } NTFS_CONSTANTS;
 
 /* Global variables. */