diff --git a/ChangeLog b/ChangeLog index c2caa5d9..cf161dd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -158,6 +158,7 @@ xx/xx/2005 - 2.0.0-WIP FileNameDirty to indicate that FILE_NAME attributes need update. At least after attribute resize we leave absolutely consist volume. (Yura) + - Update attribute definition handling. (Anton, Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index f8d9f0f9..f8652e06 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -539,19 +539,37 @@ typedef enum { /* * 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. */ typedef 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. */ } ATTR_DEF_FLAGS; /* diff --git a/libntfs/attrib.c b/libntfs/attrib.c index cf963d6e..c22a15de 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2358,21 +2358,16 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) { ATTR_DEF *ad; - /* - * $DATA is 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) - return 0; /* Find the attribute definition record in $AttrDef. */ ad = ntfs_attr_find_in_attrdef(vol, type); if (!ad) return -1; /* Check the flags and return the result. */ - if (ad->flags & CAN_BE_NON_RESIDENT) - return 0; - errno = EPERM; - return -1; + if (ad->flags & ATTR_DEF_RESIDENT) { + errno = EPERM; + return -1; + } + return 0; } /**