Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
bb3cf335
Commit
bb3cf335
authored
Apr 06, 2005
by
Anton Altaparmakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NTFS: Update attribute definition handling.
Signed-off-by:
Anton Altaparmakov
<
aia21@cantab.net
>
parent
b0d2374d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
27 deletions
+40
-27
fs/ntfs/ChangeLog
fs/ntfs/ChangeLog
+1
-0
fs/ntfs/attrib.c
fs/ntfs/attrib.c
+7
-14
fs/ntfs/layout.h
fs/ntfs/layout.h
+30
-12
fs/ntfs/ntfs.h
fs/ntfs/ntfs.h
+2
-1
No files found.
fs/ntfs/ChangeLog
View file @
bb3cf335
...
@@ -110,6 +110,7 @@ ToDo/Notes:
...
@@ -110,6 +110,7 @@ ToDo/Notes:
only emit a warning when the checksum is incorrect rather than
only emit a warning when the checksum is incorrect rather than
refusing the mount. Thanks to Bernd Casimir for pointing this
refusing the mount. Thanks to Bernd Casimir for pointing this
problem out.
problem out.
- Update attribute definition handling.
2.1.22 - Many bug and race fixes and error handling improvements.
2.1.22 - Many bug and race fixes and error handling improvements.
...
...
fs/ntfs/attrib.c
View file @
bb3cf335
...
@@ -1138,28 +1138,21 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPE type,
...
@@ -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
* 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.
* 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.
* -ENOENT if the attribute is not listed in $AttrDef.
*/
*/
int
ntfs_attr_can_be_non_resident
(
const
ntfs_volume
*
vol
,
const
ATTR_TYPE
type
)
int
ntfs_attr_can_be_non_resident
(
const
ntfs_volume
*
vol
,
const
ATTR_TYPE
type
)
{
{
ATTR_DEF
*
ad
;
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. */
/* Find the attribute definition record in $AttrDef. */
ad
=
ntfs_attr_find_in_attrdef
(
vol
,
type
);
ad
=
ntfs_attr_find_in_attrdef
(
vol
,
type
);
if
(
unlikely
(
!
ad
))
if
(
unlikely
(
!
ad
))
return
-
ENOENT
;
return
-
ENOENT
;
/* Check the flags and return the result. */
/* Check the flags and return the result. */
if
(
ad
->
flags
&
CAN_BE_NON_RESIDENT
)
if
(
ad
->
flags
&
ATTR_DEF_RESIDENT
)
return
0
;
return
-
EPERM
;
return
-
EPERM
;
return
0
;
}
}
/**
/**
...
@@ -1182,9 +1175,9 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPE type)
...
@@ -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
)
int
ntfs_attr_can_be_resident
(
const
ntfs_volume
*
vol
,
const
ATTR_TYPE
type
)
{
{
if
(
type
!=
AT_INDEX_ALLOCATION
&&
type
!=
AT_EA
)
if
(
type
==
AT_INDEX_ALLOCATION
||
type
==
AT_EA
)
return
0
;
return
-
EPERM
;
return
-
EPERM
;
return
0
;
}
}
/**
/**
...
...
fs/ntfs/layout.h
View file @
bb3cf335
...
@@ -547,26 +547,44 @@ enum {
...
@@ -547,26 +547,44 @@ enum {
COLLATION_NTOFS_ULONG
=
const_cpu_to_le32
(
0x10
),
COLLATION_NTOFS_ULONG
=
const_cpu_to_le32
(
0x10
),
COLLATION_NTOFS_SID
=
const_cpu_to_le32
(
0x11
),
COLLATION_NTOFS_SID
=
const_cpu_to_le32
(
0x11
),
COLLATION_NTOFS_SECURITY_HASH
=
const_cpu_to_le32
(
0x12
),
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
;
typedef
le32
COLLATION_RULE
;
/*
/*
* The flags (32-bit) describing attribute properties in the attribute
* The flags (32-bit) describing attribute properties in the attribute
* definition structure. FIXME: This information is from Regis's information
* definition structure. FIXME: This information is based on Regis's
* and, according to him, it is not certain and probably incomplete.
* information and, according to him, it is not certain and probably
* The INDEXABLE flag is fairly certainly correct as only the file name
* incomplete. The INDEXABLE flag is fairly certainly correct as only the file
* attribute has this flag set and this is the only attribute indexed in NT4.
* name attribute has this flag set and this is the only attribute indexed in
* NT4.
*/
*/
enum
{
enum
{
INDEXABLE
=
const_cpu_to_le32
(
0x02
),
/* Attribute can be
ATTR_DEF_INDEXABLE
=
const_cpu_to_le32
(
0x02
),
/* Attribute can be
indexed. */
indexed. */
NEED_TO_REGENERATE
=
const_cpu_to_le32
(
0x40
),
/* Need to regenerate
ATTR_DEF_MULTIPLE
=
const_cpu_to_le32
(
0x04
),
/* Attribute type
during regeneration
can be present multiple times in the
phase. */
mft records of an inode. */
CAN_BE_NON_RESIDENT
=
const_cpu_to_le32
(
0x80
),
/* Attribute can be
ATTR_DEF_NOT_ZERO
=
const_cpu_to_le32
(
0x08
),
/* Attribute value
non-resident. */
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
;
typedef
le32
ATTR_DEF_FLAGS
;
...
...
fs/ntfs/ntfs.h
View file @
bb3cf335
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
* ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
* project.
* project.
*
*
* Copyright (c) 2001-200
4
Anton Altaparmakov
* Copyright (c) 2001-200
5
Anton Altaparmakov
* Copyright (C) 2002 Richard Russon
* Copyright (C) 2002 Richard Russon
*
*
* This program/include file is free software; you can redistribute it and/or
* This program/include file is free software; you can redistribute it and/or
...
@@ -41,6 +41,7 @@ typedef enum {
...
@@ -41,6 +41,7 @@ typedef enum {
NTFS_BLOCK_SIZE_BITS
=
9
,
NTFS_BLOCK_SIZE_BITS
=
9
,
NTFS_SB_MAGIC
=
0x5346544e
,
/* 'NTFS' */
NTFS_SB_MAGIC
=
0x5346544e
,
/* 'NTFS' */
NTFS_MAX_NAME_LEN
=
255
,
NTFS_MAX_NAME_LEN
=
255
,
NTFS_MAX_ATTR_NAME_LEN
=
255
,
}
NTFS_CONSTANTS
;
}
NTFS_CONSTANTS
;
/* Global variables. */
/* Global variables. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment