diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-04-06 08:34:31 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-05 06:46:17 -0400 |
commit | bb3cf33509009132cf8c7a7729f9d26c0c5fa961 (patch) | |
tree | 1e5a6a8bdf12e158a792b26b1d24b1743ce8a975 /fs/ntfs/attrib.c | |
parent | b0d2374d62faed034dd80e6524efb98a6341597c (diff) |
NTFS: Update attribute definition handling.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/attrib.c')
-rw-r--r-- | fs/ntfs/attrib.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 1b95f39234a3..23ca3bdfb89a 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -1138,28 +1138,21 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPE type, | |||
1138 | * Check whether the attribute of @type on the ntfs volume @vol is allowed to | 1138 | * Check whether the attribute of @type on the ntfs volume @vol is allowed to |
1139 | * be non-resident. This information is obtained from $AttrDef system file. | 1139 | * be non-resident. This information is obtained from $AttrDef system file. |
1140 | * | 1140 | * |
1141 | * Return 0 if the attribute is allowed to be non-resident, -EPERM if not, or | 1141 | * Return 0 if the attribute is allowed to be non-resident, -EPERM if not, and |
1142 | * -ENOENT if the attribute is not listed in $AttrDef. | 1142 | * -ENOENT if the attribute is not listed in $AttrDef. |
1143 | */ | 1143 | */ |
1144 | int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type) | 1144 | int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type) |
1145 | { | 1145 | { |
1146 | ATTR_DEF *ad; | 1146 | ATTR_DEF *ad; |
1147 | 1147 | ||
1148 | /* | ||
1149 | * $DATA and $EA are always allowed to be non-resident even if $AttrDef | ||
1150 | * does not specify this in the flags of the $DATA attribute definition | ||
1151 | * record. | ||
1152 | */ | ||
1153 | if (type == AT_DATA || type == AT_EA) | ||
1154 | return 0; | ||
1155 | /* Find the attribute definition record in $AttrDef. */ | 1148 | /* Find the attribute definition record in $AttrDef. */ |
1156 | ad = ntfs_attr_find_in_attrdef(vol, type); | 1149 | ad = ntfs_attr_find_in_attrdef(vol, type); |
1157 | if (unlikely(!ad)) | 1150 | if (unlikely(!ad)) |
1158 | return -ENOENT; | 1151 | return -ENOENT; |
1159 | /* Check the flags and return the result. */ | 1152 | /* Check the flags and return the result. */ |
1160 | if (ad->flags & CAN_BE_NON_RESIDENT) | 1153 | if (ad->flags & ATTR_DEF_RESIDENT) |
1161 | return 0; | 1154 | return -EPERM; |
1162 | return -EPERM; | 1155 | return 0; |
1163 | } | 1156 | } |
1164 | 1157 | ||
1165 | /** | 1158 | /** |
@@ -1182,9 +1175,9 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type) | |||
1182 | */ | 1175 | */ |
1183 | int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type) | 1176 | int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPE type) |
1184 | { | 1177 | { |
1185 | if (type != AT_INDEX_ALLOCATION && type != AT_EA) | 1178 | if (type == AT_INDEX_ALLOCATION || type == AT_EA) |
1186 | return 0; | 1179 | return -EPERM; |
1187 | return -EPERM; | 1180 | return 0; |
1188 | } | 1181 | } |
1189 | 1182 | ||
1190 | /** | 1183 | /** |