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
bad71405
Commit
bad71405
authored
Sep 22, 2004
by
Richard Russon
Browse files
Options
Browse Files
Download
Plain Diff
Merge
ssh://linux-ntfs@bkbits.net/ntfs-2.6-devel
into flatcap.org:/home/flatcap/backup/bk/ntfs-2.6-devel
parents
55748633
c801720c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
337 additions
and
185 deletions
+337
-185
fs/ntfs/ChangeLog
fs/ntfs/ChangeLog
+16
-0
fs/ntfs/aops.c
fs/ntfs/aops.c
+9
-12
fs/ntfs/attrib.c
fs/ntfs/attrib.c
+163
-90
fs/ntfs/attrib.h
fs/ntfs/attrib.h
+1
-5
fs/ntfs/dir.c
fs/ntfs/dir.c
+21
-12
fs/ntfs/index.c
fs/ntfs/index.c
+11
-9
fs/ntfs/inode.c
fs/ntfs/inode.c
+97
-43
fs/ntfs/namei.c
fs/ntfs/namei.c
+15
-9
fs/ntfs/super.c
fs/ntfs/super.c
+4
-5
No files found.
fs/ntfs/ChangeLog
View file @
bad71405
...
@@ -38,6 +38,22 @@ ToDo/Notes:
...
@@ -38,6 +38,22 @@ ToDo/Notes:
- Rename {{re,}init,get,put}_attr_search_ctx() to
- Rename {{re,}init,get,put}_attr_search_ctx() to
ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type
ntfs_attr_{{re,}init,get,put}_search_ctx() as well as the type
attr_search_context to ntfs_attr_search_ctx.
attr_search_context to ntfs_attr_search_ctx.
- Force use of ntfs_attr_find() in ntfs_attr_lookup() when searching
for the attribute list attribute itself.
- Fix endianness bug in ntfs_external_attr_find().
- Change ntfs_{external_,}attr_find() to return 0 on success, -ENOENT
if the attribute is not found, and -EIO on real error. In the case
of -ENOENT, the search context is updated to describe the attribute
before which the attribute being searched for would need to be
inserted if such an action were to be desired and in the case of
ntfs_external_attr_find() the search context is also updated to
indicate the attribute list entry before which the attribute list
entry of the attribute being searched for would need to be inserted
if such an action were to be desired. Also make ntfs_find_attr()
static and remove its prototype from attrib.h as it is not used
anywhere other than attrib.c. Update ntfs_attr_lookup() and all
callers of ntfs_{external,}attr_{find,lookup}() for the new return
values.
2.1.17 - Fix bugs in mount time error code paths and other updates.
2.1.17 - Fix bugs in mount time error code paths and other updates.
...
...
fs/ntfs/aops.c
View file @
bad71405
...
@@ -402,11 +402,10 @@ int ntfs_readpage(struct file *file, struct page *page)
...
@@ -402,11 +402,10 @@ int ntfs_readpage(struct file *file, struct page *page)
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
unm_err_out
;
goto
unm_err_out
;
}
}
if
(
unlikely
(
!
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
err
=
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
;
err
=
-
ENOENT
;
if
(
unlikely
(
err
))
goto
put_unm_err_out
;
goto
put_unm_err_out
;
}
/* Starting position of the page within the attribute value. */
/* Starting position of the page within the attribute value. */
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
...
@@ -1122,11 +1121,10 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
...
@@ -1122,11 +1121,10 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_out
;
goto
err_out
;
}
}
if
(
unlikely
(
!
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
err
=
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
;
err
=
-
ENOENT
;
if
(
unlikely
(
err
))
goto
err_out
;
goto
err_out
;
}
/* Starting position of the page within the attribute value. */
/* Starting position of the page within the attribute value. */
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
...
@@ -1896,11 +1894,10 @@ static int ntfs_commit_write(struct file *file, struct page *page,
...
@@ -1896,11 +1894,10 @@ static int ntfs_commit_write(struct file *file, struct page *page,
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_out
;
goto
err_out
;
}
}
if
(
unlikely
(
!
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
err
=
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)
;
err
=
-
ENOENT
;
if
(
unlikely
(
err
))
goto
err_out
;
goto
err_out
;
}
/* Starting position of the page within the attribute value. */
/* Starting position of the page within the attribute value. */
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
attr_pos
=
page
->
index
<<
PAGE_CACHE_SHIFT
;
...
...
fs/ntfs/attrib.c
View file @
bad71405
...
@@ -962,16 +962,14 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
...
@@ -962,16 +962,14 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
if
(
IS_ERR
(
mrec
))
if
(
IS_ERR
(
mrec
))
return
PTR_ERR
(
mrec
);
return
PTR_ERR
(
mrec
);
ctx
=
ntfs_attr_get_search_ctx
(
base_ni
,
mrec
);
ctx
=
ntfs_attr_get_search_ctx
(
base_ni
,
mrec
);
if
(
!
ctx
)
{
if
(
unlikely
(
!
ctx
)
)
{
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_out
;
goto
err_out
;
}
}
if
(
!
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
err
=
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
vcn
,
NULL
,
0
,
ctx
))
{
CASE_SENSITIVE
,
vcn
,
NULL
,
0
,
ctx
);
ntfs_attr_put_search_ctx
(
ctx
);
if
(
unlikely
(
err
))
err
=
-
ENOENT
;
goto
put_err_out
;
goto
err_out
;
}
down_write
(
&
ni
->
runlist
.
lock
);
down_write
(
&
ni
->
runlist
.
lock
);
/* Make sure someone else didn't do the work while we were sleeping. */
/* Make sure someone else didn't do the work while we were sleeping. */
...
@@ -987,6 +985,7 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
...
@@ -987,6 +985,7 @@ int ntfs_map_runlist(ntfs_inode *ni, VCN vcn)
}
}
up_write
(
&
ni
->
runlist
.
lock
);
up_write
(
&
ni
->
runlist
.
lock
);
put_err_out:
ntfs_attr_put_search_ctx
(
ctx
);
ntfs_attr_put_search_ctx
(
ctx
);
err_out:
err_out:
unmap_mft_record
(
base_ni
);
unmap_mft_record
(
base_ni
);
...
@@ -1162,10 +1161,17 @@ runlist_element *ntfs_find_vcn(ntfs_inode *ni, const VCN vcn,
...
@@ -1162,10 +1161,17 @@ runlist_element *ntfs_find_vcn(ntfs_inode *ni, const VCN vcn,
*
*
* ntfs_attr_find() takes a search context @ctx as parameter and searches the
* ntfs_attr_find() takes a search context @ctx as parameter and searches the
* mft record specified by @ctx->mrec, beginning at @ctx->attr, for an
* mft record specified by @ctx->mrec, beginning at @ctx->attr, for an
* attribute of @type, optionally @name and @val. If found, ntfs_attr_find()
* attribute of @type, optionally @name and @val.
* returns TRUE and @ctx->attr will point to the found attribute. If not
*
* found, ntfs_attr_find() returns FALSE and @ctx->attr is undefined (i.e. do
* If the attribute is found, ntfs_attr_find() returns 0 and @ctx->attr will
* not rely on it not changing).
* point to the found attribute.
*
* If the attribute is not found, ntfs_attr_find() returns -ENOENT and
* @ctx->attr will point to the attribute before which the attribute being
* searched for would need to be inserted if such an action were to be desired.
*
* On actual error, ntfs_attr_find() returns -EIO. In this case @ctx->attr is
* undefined and in particular do not rely on it not changing.
*
*
* If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it
* If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it
* is FALSE, the search begins after @ctx->attr.
* is FALSE, the search begins after @ctx->attr.
...
@@ -1197,7 +1203,7 @@ runlist_element *ntfs_find_vcn(ntfs_inode *ni, const VCN vcn,
...
@@ -1197,7 +1203,7 @@ runlist_element *ntfs_find_vcn(ntfs_inode *ni, const VCN vcn,
* Warning: Never use @val when looking for attribute types which can be
* Warning: Never use @val when looking for attribute types which can be
* non-resident as this most likely will result in a crash!
* non-resident as this most likely will result in a crash!
*/
*/
BOOL
ntfs_attr_find
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
static
int
ntfs_attr_find
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
)
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
)
{
{
...
@@ -1230,21 +1236,21 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
...
@@ -1230,21 +1236,21 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
le32_to_cpu
(
ctx
->
mrec
->
bytes_allocated
))
le32_to_cpu
(
ctx
->
mrec
->
bytes_allocated
))
break
;
break
;
ctx
->
attr
=
a
;
ctx
->
attr
=
a
;
/* We catch $END with this more general check, too... */
if
(
unlikely
(
le32_to_cpu
(
a
->
type
)
>
le32_to_cpu
(
type
)
||
if
(
le32_to_cpu
(
a
->
type
)
>
le32_to_cpu
(
type
))
a
->
type
==
AT_END
))
return
FALSE
;
return
-
ENOENT
;
if
(
unlikely
(
!
a
->
length
))
if
(
unlikely
(
!
a
->
length
))
break
;
break
;
if
(
a
->
type
!=
type
)
if
(
a
->
type
!=
type
)
continue
;
continue
;
/*
/*
* If @name is present, compare the two names. If @name is
* If @name is present, compare the two names.
If @name is
* missing, assume we want an unnamed attribute.
* missing, assume we want an unnamed attribute.
*/
*/
if
(
!
name
)
{
if
(
!
name
)
{
/* The search failed if the found attribute is named. */
/* The search failed if the found attribute is named. */
if
(
a
->
name_length
)
if
(
a
->
name_length
)
return
FALSE
;
return
-
ENOENT
;
}
else
if
(
!
ntfs_are_names_equal
(
name
,
name_len
,
}
else
if
(
!
ntfs_are_names_equal
(
name
,
name_len
,
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
ic
,
upcase
,
upcase_len
))
{
a
->
name_length
,
ic
,
upcase
,
upcase_len
))
{
...
@@ -1252,7 +1258,7 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
...
@@ -1252,7 +1258,7 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
rc
=
ntfs_collate_names
(
name
,
name_len
,
rc
=
ntfs_collate_names
(
name
,
name_len
,
(
ntfschar
*
)((
u8
*
)
a
+
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
1
,
IGNORE_CASE
,
a
->
name_length
,
1
,
IGNORE_CASE
,
upcase
,
upcase_len
);
upcase
,
upcase_len
);
/*
/*
...
@@ -1260,56 +1266,55 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
...
@@ -1260,56 +1266,55 @@ BOOL ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
* matching attribute.
* matching attribute.
*/
*/
if
(
rc
==
-
1
)
if
(
rc
==
-
1
)
return
FALSE
;
return
-
ENOENT
;
/* If the strings are not equal, continue search. */
/* If the strings are not equal, continue search. */
if
(
rc
)
if
(
rc
)
continue
;
continue
;
rc
=
ntfs_collate_names
(
name
,
name_len
,
rc
=
ntfs_collate_names
(
name
,
name_len
,
(
ntfschar
*
)((
u8
*
)
a
+
(
ntfschar
*
)((
u8
*
)
a
+
le16_to_cpu
(
a
->
name_offset
)),
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
1
,
CASE_SENSITIVE
,
a
->
name_length
,
1
,
CASE_SENSITIVE
,
upcase
,
upcase_len
);
upcase
,
upcase_len
);
if
(
rc
==
-
1
)
if
(
rc
==
-
1
)
return
FALSE
;
return
-
ENOENT
;
if
(
rc
)
if
(
rc
)
continue
;
continue
;
}
}
/*
/*
* The names match or @name not present and attribute is
* The names match or @name not present and attribute is
* unnamed. If no @val specified, we have found the attribute
* unnamed.
If no @val specified, we have found the attribute
* and are done.
* and are done.
*/
*/
if
(
!
val
)
if
(
!
val
)
return
TRUE
;
return
0
;
/* @val is present; compare values. */
/* @val is present; compare values. */
else
{
else
{
u32
vl
;
register
int
rc
;
register
int
rc
;
vl
=
le32_to_cpu
(
a
->
data
.
resident
.
value_length
);
if
(
vl
>
val_len
)
vl
=
val_len
;
rc
=
memcmp
(
val
,
(
u8
*
)
a
+
le16_to_cpu
(
rc
=
memcmp
(
val
,
(
u8
*
)
a
+
le16_to_cpu
(
a
->
data
.
resident
.
value_offset
),
vl
);
a
->
data
.
resident
.
value_offset
),
min_t
(
u32
,
val_len
,
le32_to_cpu
(
a
->
data
.
resident
.
value_length
)));
/*
/*
* If @val collates before the current attribute's
* If @val collates before the current attribute's
* value, there is no matching attribute.
* value, there is no matching attribute.
*/
*/
if
(
!
rc
)
{
if
(
!
rc
)
{
register
u32
avl
;
register
u32
avl
;
avl
=
le32_to_cpu
(
avl
=
le32_to_cpu
(
a
->
data
.
resident
.
value_length
);
a
->
data
.
resident
.
value_length
);
if
(
val_len
==
avl
)
if
(
val_len
==
avl
)
return
TRUE
;
return
0
;
if
(
val_len
<
avl
)
if
(
val_len
<
avl
)
return
FALSE
;
return
-
ENOENT
;
}
else
if
(
rc
<
0
)
}
else
if
(
rc
<
0
)
return
FALSE
;
return
-
ENOENT
;
}
}
}
}
ntfs_error
(
NULL
,
"Inode is corrupt. Run chkdsk."
);
ntfs_error
(
NULL
,
"Inode is corrupt. Run chkdsk."
);
return
FALSE
;
NVolSetErrors
(
vol
);
return
-
EIO
;
}
}
/**
/**
...
@@ -1448,15 +1453,29 @@ int load_attribute_list(ntfs_volume *vol, runlist *runlist, u8 *al_start,
...
@@ -1448,15 +1453,29 @@ int load_attribute_list(ntfs_volume *vol, runlist *runlist, u8 *al_start,
* ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any
* ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any
* mapped inodes, etc).
* mapped inodes, etc).
*
*
* Return TRUE if the search was successful and FALSE if not. When TRUE,
* If the attribute is found, ntfs_external_attr_find() returns 0 and
* @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When
* @ctx->attr will point to the found attribute. @ctx->mrec will point to the
* FALSE, @ctx->attr is the attribute which collates just after the attribute
* mft record in which @ctx->attr is located and @ctx->al_entry will point to
* being searched for in the base ntfs inode, i.e. if one wants to add the
* the attribute list entry for the attribute.
* attribute to the mft record this is the correct place to insert it into
*
* and if there is not enough space, the attribute should be placed in an
* If the attribute is not found, ntfs_external_attr_find() returns -ENOENT and
* extent mft record.
* @ctx->attr will point to the attribute in the base mft record before which
* the attribute being searched for would need to be inserted if such an action
* were to be desired. @ctx->mrec will point to the mft record in which
* @ctx->attr is located and @ctx->al_entry will point to the attribute list
* entry of the attribute before which the attribute being searched for would
* need to be inserted if such an action were to be desired.
*
* Thus to insert the not found attribute, one wants to add the attribute to
* @ctx->mrec (the base mft record) and if there is not enough space, the
* attribute should be placed in a newly allocated extent mft record. The
* attribute list entry for the inserted attribute should be inserted in the
* attribute list attribute at @ctx->al_entry.
*
* On actual error, ntfs_external_attr_find() returns -EIO. In this case
* @ctx->attr is undefined and in particular do not rely on it not changing.
*/
*/
static
BOOL
ntfs_external_attr_find
(
const
ATTR_TYPES
type
,
static
int
ntfs_external_attr_find
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
)
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
)
...
@@ -1468,6 +1487,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1468,6 +1487,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
ATTR_RECORD
*
a
;
ATTR_RECORD
*
a
;
ntfschar
*
al_name
;
ntfschar
*
al_name
;
u32
al_name_len
;
u32
al_name_len
;
int
err
=
0
;
static
const
char
*
es
=
" Unmount and run chkdsk."
;
ni
=
ctx
->
ntfs_ino
;
ni
=
ctx
->
ntfs_ino
;
base_ni
=
ctx
->
base_ntfs_ino
;
base_ni
=
ctx
->
base_ntfs_ino
;
...
@@ -1479,6 +1500,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1479,6 +1500,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
}
}
if
(
ni
==
base_ni
)
if
(
ni
==
base_ni
)
ctx
->
base_attr
=
ctx
->
attr
;
ctx
->
base_attr
=
ctx
->
attr
;
if
(
type
==
AT_END
)
goto
not_found
;
vol
=
base_ni
->
vol
;
vol
=
base_ni
->
vol
;
al_start
=
base_ni
->
attr_list
;
al_start
=
base_ni
->
attr_list
;
al_end
=
al_start
+
base_ni
->
attr_list_size
;
al_end
=
al_start
+
base_ni
->
attr_list_size
;
...
@@ -1515,7 +1538,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1515,7 +1538,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
if
(
type
!=
al_entry
->
type
)
if
(
type
!=
al_entry
->
type
)
continue
;
continue
;
/*
/*
* If @name is present, compare the two names. If @name is
* If @name is present, compare the two names.
If @name is
* missing, assume we want an unnamed attribute.
* missing, assume we want an unnamed attribute.
*/
*/
al_name_len
=
al_entry
->
name_length
;
al_name_len
=
al_entry
->
name_length
;
...
@@ -1557,8 +1580,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1557,8 +1580,8 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
}
}
/*
/*
* The names match or @name not present and attribute is
* The names match or @name not present and attribute is
* unnamed.
Now check @lowest_vcn.
Continue search if the
* unnamed.
Now check @lowest_vcn.
Continue search if the
* next attribute list entry still fits @lowest_vcn. Otherwise
* next attribute list entry still fits @lowest_vcn.
Otherwise
* we have reached the right one or the search has failed.
* we have reached the right one or the search has failed.
*/
*/
if
(
lowest_vcn
&&
(
u8
*
)
next_al_entry
>=
al_start
&&
if
(
lowest_vcn
&&
(
u8
*
)
next_al_entry
>=
al_start
&&
...
@@ -1566,7 +1589,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1566,7 +1589,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
(
u8
*
)
next_al_entry
+
le16_to_cpu
(
(
u8
*
)
next_al_entry
+
le16_to_cpu
(
next_al_entry
->
length
)
<=
al_end
&&
next_al_entry
->
length
)
<=
al_end
&&
sle64_to_cpu
(
next_al_entry
->
lowest_vcn
)
<=
sle64_to_cpu
(
next_al_entry
->
lowest_vcn
)
<=
sle64_to_cpu
(
lowest_vcn
)
&&
lowest_vcn
&&
next_al_entry
->
type
==
al_entry
->
type
&&
next_al_entry
->
type
==
al_entry
->
type
&&
next_al_entry
->
name_length
==
al_name_len
&&
next_al_entry
->
name_length
==
al_name_len
&&
ntfs_are_names_equal
((
ntfschar
*
)((
u8
*
)
ntfs_are_names_equal
((
ntfschar
*
)((
u8
*
)
...
@@ -1579,7 +1602,10 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1579,7 +1602,10 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
if
(
MREF_LE
(
al_entry
->
mft_reference
)
==
ni
->
mft_no
)
{
if
(
MREF_LE
(
al_entry
->
mft_reference
)
==
ni
->
mft_no
)
{
if
(
MSEQNO_LE
(
al_entry
->
mft_reference
)
!=
ni
->
seq_no
)
{
if
(
MSEQNO_LE
(
al_entry
->
mft_reference
)
!=
ni
->
seq_no
)
{
ntfs_error
(
vol
->
sb
,
"Found stale mft "
ntfs_error
(
vol
->
sb
,
"Found stale mft "
"reference in attribute list!"
);
"reference in attribute list "
"of base inode 0x%lx.%s"
,
base_ni
->
mft_no
,
es
);
err
=
-
EIO
;
break
;
break
;
}
}
}
else
{
/* Mft references do not match. */
}
else
{
/* Mft references do not match. */
...
@@ -1597,10 +1623,16 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1597,10 +1623,16 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
al_entry
->
mft_reference
,
&
ni
);
al_entry
->
mft_reference
,
&
ni
);
ctx
->
ntfs_ino
=
ni
;
ctx
->
ntfs_ino
=
ni
;
if
(
IS_ERR
(
ctx
->
mrec
))
{
if
(
IS_ERR
(
ctx
->
mrec
))
{
ntfs_error
(
vol
->
sb
,
"Failed to map mft "
ntfs_error
(
vol
->
sb
,
"Failed to map "
"record, error code "
"extent mft record "
"%ld."
,
"0x%lx of base inode "
-
PTR_ERR
(
ctx
->
mrec
));
"0x%lx.%s"
,
MREF_LE
(
al_entry
->
mft_reference
),
base_ni
->
mft_no
,
es
);
err
=
PTR_ERR
(
ctx
->
mrec
);
if
(
err
==
-
ENOENT
)
err
=
-
EIO
;
break
;
break
;
}
}
}
}
...
@@ -1613,7 +1645,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1613,7 +1645,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
* current al_entry.
* current al_entry.
*/
*/
/*
/*
* We could call into ntfs_attr_ind() to find the right
* We could call into ntfs_attr_
f
ind() to find the right
* attribute in this mft record but this would be less
* attribute in this mft record but this would be less
* efficient and not quite accurate as ntfs_attr_find() ignores
* efficient and not quite accurate as ntfs_attr_find() ignores
* the attribute instance numbers for example which become
* the attribute instance numbers for example which become
...
@@ -1637,18 +1669,18 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1637,18 +1669,18 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
break
;
break
;
if
(
al_entry
->
instance
!=
a
->
instance
)
if
(
al_entry
->
instance
!=
a
->
instance
)
goto
do_next_attr
;
goto
do_next_attr
;
/*
* If the type and/or the name are mismatched between the
* attribute list entry and the attribute record, there is
* corruption so we break and return error EIO.
*/
if
(
al_entry
->
type
!=
a
->
type
)
if
(
al_entry
->
type
!=
a
->
type
)
continue
;
break
;
if
(
name
)
{
if
(
!
ntfs_are_names_equal
((
ntfschar
*
)((
u8
*
)
a
+
if
(
a
->
name_length
!=
al_name_len
)
le16_to_cpu
(
a
->
name_offset
)),
a
->
name_length
,
continue
;
al_name
,
al_name_len
,
CASE_SENSITIVE
,
if
(
!
ntfs_are_names_equal
((
ntfschar
*
)((
u8
*
)
a
+
vol
->
upcase
,
vol
->
upcase_len
))
le16_to_cpu
(
a
->
name_offset
)),
break
;
a
->
name_length
,
al_name
,
al_name_len
,
CASE_SENSITIVE
,
vol
->
upcase
,
vol
->
upcase_len
))
continue
;
}
ctx
->
attr
=
a
;
ctx
->
attr
=
a
;
/*
/*
* If no @val specified or @val specified and it matches, we
* If no @val specified or @val specified and it matches, we
...
@@ -1660,42 +1692,72 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1660,42 +1692,72 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
le16_to_cpu
(
a
->
data
.
resident
.
value_offset
),
le16_to_cpu
(
a
->
data
.
resident
.
value_offset
),
val
,
val_len
)))
{
val
,
val_len
)))
{
ntfs_debug
(
"Done, found."
);
ntfs_debug
(
"Done, found."
);
return
TRUE
;
return
0
;
}
}
do_next_attr:
do_next_attr:
/* Proceed to the next attribute in the current mft record. */
/* Proceed to the next attribute in the current mft record. */
a
=
(
ATTR_RECORD
*
)((
u8
*
)
a
+
le32_to_cpu
(
a
->
length
));
a
=
(
ATTR_RECORD
*
)((
u8
*
)
a
+
le32_to_cpu
(
a
->
length
));
goto
do_next_attr_loop
;
goto
do_next_attr_loop
;
}
}
ntfs_error
(
base_ni
->
vol
->
sb
,
"Inode contains corrupt attribute list "
if
(
!
err
)
{
"attribute."
);
ntfs_error
(
vol
->
sb
,
"Base inode 0x%lx contains corrupt "
"attribute list attribute.%s"
,
base_ni
->
mft_no
,
es
);
err
=
-
EIO
;
}
if
(
ni
!=
base_ni
)
{
if
(
ni
!=
base_ni
)
{
unmap_extent_mft_record
(
ni
);
unmap_extent_mft_record
(
ni
);
ctx
->
ntfs_ino
=
base_ni
;
ctx
->
ntfs_ino
=
base_ni
;
ctx
->
mrec
=
ctx
->
base_mrec
;
ctx
->
mrec
=
ctx
->
base_mrec
;
ctx
->
attr
=
ctx
->
base_attr
;
ctx
->
attr
=
ctx
->
base_attr
;
}
}
if
(
err
!=
-
ENOMEM
)
NVolSetErrors
(
vol
);
return
err
;
not_found:
/*
/*
* FIXME: We absolutely have to return ERROR status instead of just
* If we were looking for AT_END, we reset the search context @ctx and
* false or we will blow up or even worse cause corruption when we add
* use ntfs_attr_find() to seek to the end of the base mft record.
* write support and we reach this code path!
*/
*/
printk
(
KERN_CRIT
"NTFS: FIXME: Hit unfinished error code path!!!
\n
"
);
if
(
type
==
AT_END
)
{
return
FALSE
;
ntfs_attr_reinit_search_ctx
(
ctx
);
not_found:
return
ntfs_attr_find
(
AT_END
,
name
,
name_len
,
ic
,
val
,
val_len
,
ctx
);
}
/*
/*
* Seek to the end of the base mft record, i.e. when we return false,
* The attribute was not found. Before we return, we want to ensure
* ctx->mrec and ctx->attr indicate where the attribute should be
* @ctx->mrec and @ctx->attr indicate the position at which the
* inserted into the attribute record.
* attribute should be inserted in the base mft record. Since we also
* And of course ctx->al_entry points to the end of the attribute
* want to preserve @ctx->al_entry we cannot reinitialize the search
* list inside NTFS_I(ctx->base_vfs_ino)->attr_list.
* context using ntfs_attr_reinit_search_ctx() as this would set
*
* @ctx->al_entry to NULL. Thus we do the necessary bits manually (see
* FIXME: Do we really want to do this here? Think about it... (AIA)
* ntfs_attr_init_search_ctx() below). Note, we _only_ preserve
* @ctx->al_entry as the remaining fields (base_*) are identical to
* their non base_ counterparts and we cannot set @ctx->base_attr
* correctly yet as we do not know what @ctx->attr will be set to by
* the call to ntfs_attr_find() below.
*/
*/
ntfs_attr_reinit_search_ctx
(
ctx
);
ctx
->
mrec
=
ctx
->
base_mrec
;
ntfs_attr_find
(
type
,
name
,
name_len
,
ic
,
val
,
val_len
,
ctx
);
ctx
->
attr
=
(
ATTR_RECORD
*
)((
u8
*
)
ctx
->
mrec
+
le16_to_cpu
(
ctx
->
mrec
->
attrs_offset
));
ctx
->
is_first
=
TRUE
;
ctx
->
ntfs_ino
=
ctx
->
base_ntfs_ino
;
ctx
->
base_ntfs_ino
=
NULL
;
ctx
->
base_mrec
=
NULL
;
ctx
->
base_attr
=
NULL
;
/*
* In case there are multiple matches in the base mft record, need to
* keep enumerating until we get an attribute not found response (or
* another error), otherwise we would keep returning the same attribute
* over and over again and all programs using us for enumeration would
* lock up in a tight loop.
*/
do
{
err
=
ntfs_attr_find
(
type
,
name
,
name_len
,
ic
,
val
,
val_len
,
ctx
);
}
while
(
!
err
);
ntfs_debug
(
"Done, not found."
);
ntfs_debug
(
"Done, not found."
);
return
FALSE
;
return
err
;
}
}
/**
/**
...
@@ -1709,7 +1771,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1709,7 +1771,7 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
* @val_len: attribute value length
* @val_len: attribute value length
* @ctx: search context with mft record and attribute to search from
* @ctx: search context with mft record and attribute to search from
*
*
* Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must
* Find an attribute in an ntfs inode.
On first search @ctx->ntfs_ino must
* be the base mft record and @ctx must have been obtained from a call to
* be the base mft record and @ctx must have been obtained from a call to
* ntfs_attr_get_search_ctx().
* ntfs_attr_get_search_ctx().
*
*
...
@@ -1720,13 +1782,24 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
...
@@ -1720,13 +1782,24 @@ static BOOL ntfs_external_attr_find(const ATTR_TYPES type,
* ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any
* ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any
* mapped inodes, etc).
* mapped inodes, etc).
*
*
* Return TRUE if the search was successful and FALSE if not. When TRUE,
* Return 0 if the search was successful and -errno if not.
* @ctx->attr is the found attribute and it is in mft record @ctx->mrec. When
*
* FALSE, @ctx->attr is the attribute which collates just after the attribute
* When 0, @ctx->attr is the found attribute and it is in mft record
* being searched for, i.e. if one wants to add the attribute to the mft
* @ctx->mrec. If an attribute list attribute is present, @ctx->al_entry is
* record this is the correct place to insert it into.
* the attribute list entry of the found attribute.
*
* When -ENOENT, @ctx->attr is the attribute which collates just after the
* attribute being searched for, i.e. if one wants to add the attribute to the
* mft record this is the correct place to insert it into. If an attribute
* list attribute is present, @ctx->al_entry is the attribute list entry which
* collates just after the attribute list entry of the attribute being searched
* for, i.e. if one wants to add the attribute to the mft record this is the
* correct place to insert its attribute list entry into.
*
* When -errno != -ENOENT, an error occured during the lookup. @ctx->attr is
* then undefined and in particular you should not rely on it not changing.
*/
*/
BOOL
ntfs_attr_lookup
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
int
ntfs_attr_lookup
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
)
ntfs_attr_search_ctx
*
ctx
)
...
@@ -1740,7 +1813,7 @@ BOOL ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name,
...
@@ -1740,7 +1813,7 @@ BOOL ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name,
base_ni
=
ctx
->
ntfs_ino
;
base_ni
=
ctx
->
ntfs_ino
;
/* Sanity check, just for debugging really. */
/* Sanity check, just for debugging really. */
BUG_ON
(
!
base_ni
);
BUG_ON
(
!
base_ni
);
if
(
!
NInoAttrList
(
base_ni
))
if
(
!
NInoAttrList
(
base_ni
)
||
type
==
AT_ATTRIBUTE_LIST
)
return
ntfs_attr_find
(
type
,
name
,
name_len
,
ic
,
val
,
val_len
,
return
ntfs_attr_find
(
type
,
name
,
name_len
,
ic
,
val
,
val_len
,
ctx
);
ctx
);
return
ntfs_external_attr_find
(
type
,
name
,
name_len
,
ic
,
lowest_vcn
,
return
ntfs_external_attr_find
(
type
,
name
,
name_len
,
ic
,
lowest_vcn
,
...
...
fs/ntfs/attrib.h
View file @
bad71405
...
@@ -81,11 +81,7 @@ extern LCN ntfs_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
...
@@ -81,11 +81,7 @@ extern LCN ntfs_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
extern
runlist_element
*
ntfs_find_vcn
(
ntfs_inode
*
ni
,
const
VCN
vcn
,
extern
runlist_element
*
ntfs_find_vcn
(
ntfs_inode
*
ni
,
const
VCN
vcn
,
const
BOOL
need_write
);
const
BOOL
need_write
);
extern
BOOL
ntfs_attr_find
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
int
ntfs_attr_lookup
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
);
BOOL
ntfs_attr_lookup
(
const
ATTR_TYPES
type
,
const
ntfschar
*
name
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
u32
name_len
,
const
IGNORE_CASE_BOOL
ic
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
const
VCN
lowest_vcn
,
const
u8
*
val
,
const
u32
val_len
,
ntfs_attr_search_ctx
*
ctx
);
ntfs_attr_search_ctx
*
ctx
);
...
...
fs/ntfs/dir.c
View file @
bad71405
...
@@ -106,11 +106,15 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
...
@@ -106,11 +106,15 @@ MFT_REF ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
goto
err_out
;
goto
err_out
;
}
}
/* Find the index root attribute in the mft record. */
/* Find the index root attribute in the mft record. */
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
NULL
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
))
{
0
,
ctx
);
ntfs_error
(
sb
,
"Index root attribute missing in directory "
if
(
unlikely
(
err
))
{
"inode 0x%lx."
,
dir_ni
->
mft_no
);
if
(
err
==
-
ENOENT
)
{
err
=
-
EIO
;
ntfs_error
(
sb
,
"Index root attribute missing in "
"directory inode 0x%lx."
,
dir_ni
->
mft_no
);
err
=
-
EIO
;
}
goto
err_out
;
goto
err_out
;
}
}
/* Get to the index root value (it's been verified in read_inode). */
/* Get to the index root value (it's been verified in read_inode). */
...
@@ -655,11 +659,15 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
...
@@ -655,11 +659,15 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
goto err_out;
goto err_out;
}
}
/* Find the index root attribute in the mft record. */
/* Find the index root attribute in the mft record. */
if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL,
err = ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL,
0, ctx)) {
0, ctx);
ntfs_error(sb, "Index root attribute missing in directory "
if (unlikely(err)) {
"inode 0x%lx.", dir_ni->mft_no);
if (err == -ENOENT) {
err = -EIO;
ntfs_error(sb, "Index root attribute missing in "
"directory inode 0x%lx.",
dir_ni->mft_no);
err = -EIO;
}
goto err_out;
goto err_out;
}
}
/* Get to the index root value (it's been verified in read_inode). */
/* Get to the index root value (it's been verified in read_inode). */
...
@@ -1183,8 +1191,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -1183,8 +1191,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* Get the offset into the index root attribute. */
/* Get the offset into the index root attribute. */
ir_pos
=
(
s64
)
fpos
;
ir_pos
=
(
s64
)
fpos
;
/* Find the index root attribute in the mft record. */
/* Find the index root attribute in the mft record. */
if
(
unlikely
(
!
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
NULL
,
0
,
ctx
)))
{
0
,
ctx
);
if
(
unlikely
(
err
))
{
ntfs_error
(
sb
,
"Index root attribute missing in directory "
ntfs_error
(
sb
,
"Index root attribute missing in directory "
"inode 0x%lx."
,
vdir
->
i_ino
);
"inode 0x%lx."
,
vdir
->
i_ino
);
goto
err_out
;
goto
err_out
;
...
...
fs/ntfs/index.c
View file @
bad71405
...
@@ -125,6 +125,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx)
...
@@ -125,6 +125,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx)
int
ntfs_index_lookup
(
const
void
*
key
,
const
int
key_len
,
int
ntfs_index_lookup
(
const
void
*
key
,
const
int
key_len
,
ntfs_index_context
*
ictx
)
ntfs_index_context
*
ictx
)
{
{
VCN
vcn
,
old_vcn
;
ntfs_inode
*
idx_ni
=
ictx
->
idx_ni
;
ntfs_inode
*
idx_ni
=
ictx
->
idx_ni
;
ntfs_volume
*
vol
=
idx_ni
->
vol
;
ntfs_volume
*
vol
=
idx_ni
->
vol
;
struct
super_block
*
sb
=
vol
->
sb
;
struct
super_block
*
sb
=
vol
->
sb
;
...
@@ -133,13 +134,11 @@ int ntfs_index_lookup(const void *key, const int key_len,
...
@@ -133,13 +134,11 @@ int ntfs_index_lookup(const void *key, const int key_len,
INDEX_ROOT
*
ir
;
INDEX_ROOT
*
ir
;
INDEX_ENTRY
*
ie
;
INDEX_ENTRY
*
ie
;
INDEX_ALLOCATION
*
ia
;
INDEX_ALLOCATION
*
ia
;
u8
*
index_end
;
u8
*
index_end
,
*
kaddr
;
ntfs_attr_search_ctx
*
actx
;
ntfs_attr_search_ctx
*
actx
;
int
rc
,
err
=
0
;
VCN
vcn
,
old_vcn
;
struct
address_space
*
ia_mapping
;
struct
address_space
*
ia_mapping
;
struct
page
*
page
;
struct
page
*
page
;
u8
*
kaddr
;
int
rc
,
err
=
0
;
ntfs_debug
(
"Entering."
);
ntfs_debug
(
"Entering."
);
BUG_ON
(
!
NInoAttr
(
idx_ni
));
BUG_ON
(
!
NInoAttr
(
idx_ni
));
...
@@ -168,11 +167,14 @@ int ntfs_index_lookup(const void *key, const int key_len,
...
@@ -168,11 +167,14 @@ int ntfs_index_lookup(const void *key, const int key_len,
goto
err_out
;
goto
err_out
;
}
}
/* Find the index root attribute in the mft record. */
/* Find the index root attribute in the mft record. */
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
idx_ni
->
name
,
idx_ni
->
name_len
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
idx_ni
->
name
,
idx_ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
actx
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
actx
);
ntfs_error
(
sb
,
"Index root attribute missing in inode 0x%lx."
,
if
(
unlikely
(
err
))
{
idx_ni
->
mft_no
);
if
(
err
==
-
ENOENT
)
{
err
=
-
EIO
;
ntfs_error
(
sb
,
"Index root attribute missing in inode "
"0x%lx."
,
idx_ni
->
mft_no
);
err
=
-
EIO
;
}
goto
err_out
;
goto
err_out
;
}
}
/* Get to the index root value (it has been verified in read_inode). */
/* Get to the index root value (it has been verified in read_inode). */
...
...
fs/ntfs/inode.c
View file @
bad71405
...
@@ -428,11 +428,11 @@ inline ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
...
@@ -428,11 +428,11 @@ inline ntfs_inode *ntfs_new_extent_inode(struct super_block *sb,
* Return values:
* Return values:
* 1: file is in $Extend directory
* 1: file is in $Extend directory
* 0: file is not in $Extend directory
* 0: file is not in $Extend directory
*
-EIO: file is corrupt
*
-errno: failed to determine if the file is in the $Extend directory
*/
*/
static
int
ntfs_is_extended_system_file
(
ntfs_attr_search_ctx
*
ctx
)
static
int
ntfs_is_extended_system_file
(
ntfs_attr_search_ctx
*
ctx
)
{
{
int
nr_links
;
int
nr_links
,
err
;
/* Restart search. */
/* Restart search. */
ntfs_attr_reinit_search_ctx
(
ctx
);
ntfs_attr_reinit_search_ctx
(
ctx
);
...
@@ -441,7 +441,8 @@ static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
...
@@ -441,7 +441,8 @@ static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
nr_links
=
le16_to_cpu
(
ctx
->
mrec
->
link_count
);
nr_links
=
le16_to_cpu
(
ctx
->
mrec
->
link_count
);
/* Loop through all hard links. */
/* Loop through all hard links. */
while
(
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
while
(
!
(
err
=
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
)))
{
FILE_NAME_ATTR
*
file_name_attr
;
FILE_NAME_ATTR
*
file_name_attr
;
ATTR_RECORD
*
attr
=
ctx
->
attr
;
ATTR_RECORD
*
attr
=
ctx
->
attr
;
u8
*
p
,
*
p2
;
u8
*
p
,
*
p2
;
...
@@ -484,7 +485,9 @@ static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
...
@@ -484,7 +485,9 @@ static int ntfs_is_extended_system_file(ntfs_attr_search_ctx *ctx)
if
(
MREF_LE
(
file_name_attr
->
parent_directory
)
==
FILE_Extend
)
if
(
MREF_LE
(
file_name_attr
->
parent_directory
)
==
FILE_Extend
)
return
1
;
/* YES, it's an extended system file. */
return
1
;
/* YES, it's an extended system file. */
}
}
if
(
nr_links
)
{
if
(
unlikely
(
err
!=
-
ENOENT
))
return
err
;
if
(
unlikely
(
nr_links
))
{
ntfs_error
(
ctx
->
ntfs_ino
->
vol
->
sb
,
"Inode hard link count "
ntfs_error
(
ctx
->
ntfs_ino
->
vol
->
sb
,
"Inode hard link count "
"doesn't match number of name attributes. You "
"doesn't match number of name attributes. You "
"should run chkdsk."
);
"should run chkdsk."
);
...
@@ -608,14 +611,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
...
@@ -608,14 +611,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
* in fact fail if the standard information is in an extent record, but
* in fact fail if the standard information is in an extent record, but
* I don't think this actually ever happens.
* I don't think this actually ever happens.
*/
*/
if
(
!
ntfs_attr_lookup
(
AT_STANDARD_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
err
=
ntfs_attr_lookup
(
AT_STANDARD_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
ctx
);
/*
if
(
unlikely
(
err
))
{
* TODO: We should be performing a hot fix here (if the recover
if
(
err
==
-
ENOENT
)
{
* mount option is set) by creating a new attribute.
/*
*/
* TODO: We should be performing a hot fix here (if the
ntfs_error
(
vi
->
i_sb
,
"$STANDARD_INFORMATION attribute is "
* recover mount option is set) by creating a new
"missing."
);
* attribute.
*/
ntfs_error
(
vi
->
i_sb
,
"$STANDARD_INFORMATION attribute "
"is missing."
);
}
goto
unm_err_out
;
goto
unm_err_out
;
}
}
/* Get the standard information attribute value. */
/* Get the standard information attribute value. */
...
@@ -647,7 +654,14 @@ static int ntfs_read_locked_inode(struct inode *vi)
...
@@ -647,7 +654,14 @@ static int ntfs_read_locked_inode(struct inode *vi)
/* Find the attribute list attribute if present. */
/* Find the attribute list attribute if present. */
ntfs_attr_reinit_search_ctx
(
ctx
);
ntfs_attr_reinit_search_ctx
(
ctx
);
if
(
ntfs_attr_lookup
(
AT_ATTRIBUTE_LIST
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
err
=
ntfs_attr_lookup
(
AT_ATTRIBUTE_LIST
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
);
if
(
err
)
{
if
(
unlikely
(
err
!=
-
ENOENT
))
{
ntfs_error
(
vi
->
i_sb
,
"Failed to lookup attribute list "
"attribute. You should run chkdsk."
);
goto
unm_err_out
;
}
}
else
/* if (!err) */
{
if
(
vi
->
i_ino
==
FILE_MFT
)
if
(
vi
->
i_ino
==
FILE_MFT
)
goto
skip_attr_list_load
;
goto
skip_attr_list_load
;
ntfs_debug
(
"Attribute list found in inode 0x%lx."
,
vi
->
i_ino
);
ntfs_debug
(
"Attribute list found in inode 0x%lx."
,
vi
->
i_ino
);
...
@@ -734,12 +748,16 @@ static int ntfs_read_locked_inode(struct inode *vi)
...
@@ -734,12 +748,16 @@ static int ntfs_read_locked_inode(struct inode *vi)
/* It is a directory, find index root attribute. */
/* It is a directory, find index root attribute. */
ntfs_attr_reinit_search_ctx
(
ctx
);
ntfs_attr_reinit_search_ctx
(
ctx
);
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
NULL
,
0
,
ctx
))
{
0
,
NULL
,
0
,
ctx
);
// FIXME: File is corrupt! Hot-fix with empty index
if
(
unlikely
(
err
))
{
// root attribute if recovery option is set.
if
(
err
==
-
ENOENT
)
{
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ROOT attribute is "
// FIXME: File is corrupt! Hot-fix with empty
"missing."
);
// index root attribute if recovery option is
// set.
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ROOT attribute "
"is missing."
);
}
goto
unm_err_out
;
goto
unm_err_out
;
}
}
/* Set up the state. */
/* Set up the state. */
...
@@ -850,11 +868,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
...
@@ -850,11 +868,18 @@ static int ntfs_read_locked_inode(struct inode *vi)
NInoSetIndexAllocPresent
(
ni
);
NInoSetIndexAllocPresent
(
ni
);
/* Find index allocation attribute. */
/* Find index allocation attribute. */
ntfs_attr_reinit_search_ctx
(
ctx
);
ntfs_attr_reinit_search_ctx
(
ctx
);
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ALLOCATION
,
I30
,
4
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ALLOCATION
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ALLOCATION attribute "
if
(
unlikely
(
err
))
{
"is not present but $INDEX_ROOT "
if
(
err
==
-
ENOENT
)
"indicated it is."
);
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ALLOCATION "
"attribute is not present but "
"$INDEX_ROOT indicated it "
"is."
);
else
ntfs_error
(
vi
->
i_sb
,
"Failed to lookup "
"$INDEX_ALLOCATION "
"attribute."
);
goto
unm_err_out
;
goto
unm_err_out
;
}
}
if
(
!
ctx
->
attr
->
non_resident
)
{
if
(
!
ctx
->
attr
->
non_resident
)
{
...
@@ -946,9 +971,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
...
@@ -946,9 +971,15 @@ static int ntfs_read_locked_inode(struct inode *vi)
ni
->
name_len
=
0
;
ni
->
name_len
=
0
;
/* Find first extent of the unnamed data attribute. */
/* Find first extent of the unnamed data attribute. */
if
(
!
ntfs_attr_lookup
(
AT_DATA
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
err
=
ntfs_attr_lookup
(
AT_DATA
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
);
if
(
unlikely
(
err
))
{
vi
->
i_size
=
ni
->
initialized_size
=
vi
->
i_size
=
ni
->
initialized_size
=
ni
->
allocated_size
=
0LL
;
ni
->
allocated_size
=
0
;
if
(
err
!=
-
ENOENT
)
{
ntfs_error
(
vi
->
i_sb
,
"Failed to lookup $DATA "
"attribute."
);
goto
unm_err_out
;
}
/*
/*
* FILE_Secure does not have an unnamed $DATA
* FILE_Secure does not have an unnamed $DATA
* attribute, so we special case it here.
* attribute, so we special case it here.
...
@@ -1169,8 +1200,9 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
...
@@ -1169,8 +1200,9 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
}
}
/* Find the attribute. */
/* Find the attribute. */
if
(
!
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
err
=
ntfs_attr_lookup
(
ni
->
type
,
ni
->
name
,
ni
->
name_len
,
0
,
NULL
,
0
,
ctx
))
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
if
(
unlikely
(
err
))
goto
unm_err_out
;
goto
unm_err_out
;
if
(
!
ctx
->
attr
->
non_resident
)
{
if
(
!
ctx
->
attr
->
non_resident
)
{
...
@@ -1425,9 +1457,12 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
...
@@ -1425,9 +1457,12 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
goto
unm_err_out
;
goto
unm_err_out
;
}
}
/* Find the index root attribute. */
/* Find the index root attribute. */
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
ni
->
name
,
ni
->
name_len
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ROOT attribute is missing."
);
if
(
unlikely
(
err
))
{
if
(
err
==
-
ENOENT
)
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ROOT attribute is "
"missing."
);
goto
unm_err_out
;
goto
unm_err_out
;
}
}
/* Set up the state. */
/* Set up the state. */
...
@@ -1506,10 +1541,16 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
...
@@ -1506,10 +1541,16 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
NInoSetIndexAllocPresent
(
ni
);
NInoSetIndexAllocPresent
(
ni
);
/* Find index allocation attribute. */
/* Find index allocation attribute. */
ntfs_attr_reinit_search_ctx
(
ctx
);
ntfs_attr_reinit_search_ctx
(
ctx
);
if
(
!
ntfs_attr_lookup
(
AT_INDEX_ALLOCATION
,
ni
->
name
,
ni
->
name_len
,
err
=
ntfs_attr_lookup
(
AT_INDEX_ALLOCATION
,
ni
->
name
,
ni
->
name_len
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ALLOCATION attribute is not "
if
(
unlikely
(
err
))
{
"present but $INDEX_ROOT indicated it is."
);
if
(
err
==
-
ENOENT
)
ntfs_error
(
vi
->
i_sb
,
"$INDEX_ALLOCATION attribute is "
"not present but $INDEX_ROOT "
"indicated it is."
);
else
ntfs_error
(
vi
->
i_sb
,
"Failed to lookup "
"$INDEX_ALLOCATION attribute."
);
goto
unm_err_out
;
goto
unm_err_out
;
}
}
if
(
!
ctx
->
attr
->
non_resident
)
{
if
(
!
ctx
->
attr
->
non_resident
)
{
...
@@ -1726,7 +1767,14 @@ int ntfs_read_inode_mount(struct inode *vi)
...
@@ -1726,7 +1767,14 @@ int ntfs_read_inode_mount(struct inode *vi)
}
}
/* Find the attribute list attribute if present. */
/* Find the attribute list attribute if present. */
if
(
ntfs_attr_lookup
(
AT_ATTRIBUTE_LIST
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
err
=
ntfs_attr_lookup
(
AT_ATTRIBUTE_LIST
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
);
if
(
err
)
{
if
(
unlikely
(
err
!=
-
ENOENT
))
{
ntfs_error
(
sb
,
"Failed to lookup attribute list "
"attribute. You should run chkdsk."
);
goto
put_err_out
;
}
}
else
/* if (!err) */
{
ATTR_LIST_ENTRY
*
al_entry
,
*
next_al_entry
;
ATTR_LIST_ENTRY
*
al_entry
,
*
next_al_entry
;
u8
*
al_end
;
u8
*
al_end
;
...
@@ -1860,7 +1908,8 @@ int ntfs_read_inode_mount(struct inode *vi)
...
@@ -1860,7 +1908,8 @@ int ntfs_read_inode_mount(struct inode *vi)
/* Now load all attribute extents. */
/* Now load all attribute extents. */
attr
=
NULL
;
attr
=
NULL
;
next_vcn
=
last_vcn
=
highest_vcn
=
0
;
next_vcn
=
last_vcn
=
highest_vcn
=
0
;
while
(
ntfs_attr_lookup
(
AT_DATA
,
NULL
,
0
,
0
,
next_vcn
,
NULL
,
0
,
ctx
))
{
while
(
!
(
err
=
ntfs_attr_lookup
(
AT_DATA
,
NULL
,
0
,
0
,
next_vcn
,
NULL
,
0
,
ctx
)))
{
runlist_element
*
nrl
;
runlist_element
*
nrl
;
/* Cache the current attribute. */
/* Cache the current attribute. */
...
@@ -1991,15 +2040,20 @@ int ntfs_read_inode_mount(struct inode *vi)
...
@@ -1991,15 +2040,20 @@ int ntfs_read_inode_mount(struct inode *vi)
goto
put_err_out
;
goto
put_err_out
;
}
}
}
}
if
(
err
!=
-
ENOENT
)
{
ntfs_error
(
sb
,
"Failed to lookup $MFT/$DATA attribute extent. "
"$MFT is corrupt. Run chkdsk."
);
goto
put_err_out
;
}
if
(
!
attr
)
{
if
(
!
attr
)
{
ntfs_error
(
sb
,
"$MFT/$DATA attribute not found. $MFT is "
ntfs_error
(
sb
,
"$MFT/$DATA attribute not found. $MFT is "
"corrupt. Run chkdsk."
);
"corrupt. Run chkdsk."
);
goto
put_err_out
;
goto
put_err_out
;
}
}
if
(
highest_vcn
&&
highest_vcn
!=
last_vcn
-
1
)
{
if
(
highest_vcn
&&
highest_vcn
!=
last_vcn
-
1
)
{
ntfs_error
(
sb
,
"Failed to load the complete runlist "
ntfs_error
(
sb
,
"Failed to load the complete runlist
for
"
"
for $MFT/$DATA. Driver bug or
"
"
$MFT/$DATA. Driver bug or corrupt $MFT.
"
"
corrupt $MFT.
Run chkdsk."
);
"Run chkdsk."
);
ntfs_debug
(
"highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx"
,
ntfs_debug
(
"highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx"
,
(
unsigned
long
long
)
highest_vcn
,
(
unsigned
long
long
)
highest_vcn
,
(
unsigned
long
long
)
last_vcn
-
1
);
(
unsigned
long
long
)
last_vcn
-
1
);
...
@@ -2347,10 +2401,10 @@ int ntfs_write_inode(struct inode *vi, int sync)
...
@@ -2347,10 +2401,10 @@ int ntfs_write_inode(struct inode *vi, int sync)
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
unm_err_out
;
goto
unm_err_out
;
}
}
if
(
unlikely
(
!
ntfs_attr_lookup
(
AT_STANDARD_INFORMATION
,
NULL
,
0
,
err
=
ntfs_attr_lookup
(
AT_STANDARD_INFORMATION
,
NULL
,
0
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
)))
{
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
if
(
unlikely
(
err
))
{
ntfs_attr_put_search_ctx
(
ctx
);
ntfs_attr_put_search_ctx
(
ctx
);
err
=
-
ENOENT
;
goto
unm_err_out
;
goto
unm_err_out
;
}
}
si
=
(
STANDARD_INFORMATION
*
)((
u8
*
)
ctx
->
attr
+
si
=
(
STANDARD_INFORMATION
*
)((
u8
*
)
ctx
->
attr
+
...
...
fs/ntfs/namei.c
View file @
bad71405
...
@@ -197,7 +197,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
...
@@ -197,7 +197,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
goto
err_out
;
goto
err_out
;
}
}
ctx
=
ntfs_attr_get_search_ctx
(
ni
,
m
);
ctx
=
ntfs_attr_get_search_ctx
(
ni
,
m
);
if
(
!
ctx
)
{
if
(
unlikely
(
!
ctx
)
)
{
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_out
;
goto
err_out
;
}
}
...
@@ -205,12 +205,14 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
...
@@ -205,12 +205,14 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
ATTR_RECORD
*
a
;
ATTR_RECORD
*
a
;
u32
val_len
;
u32
val_len
;
if
(
!
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
0
,
0
,
err
=
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
))
{
NULL
,
0
,
ctx
);
if
(
unlikely
(
err
))
{
ntfs_error
(
vol
->
sb
,
"Inode corrupt: No WIN32 "
ntfs_error
(
vol
->
sb
,
"Inode corrupt: No WIN32 "
"namespace counterpart to DOS "
"namespace counterpart to DOS "
"file name. Run chkdsk."
);
"file name. Run chkdsk."
);
err
=
-
EIO
;
if
(
err
==
-
ENOENT
)
err
=
-
EIO
;
goto
err_out
;
goto
err_out
;
}
}
/* Consistency checks. */
/* Consistency checks. */
...
@@ -372,6 +374,7 @@ struct dentry *ntfs_get_parent(struct dentry *child_dent)
...
@@ -372,6 +374,7 @@ struct dentry *ntfs_get_parent(struct dentry *child_dent)
struct
inode
*
parent_vi
;
struct
inode
*
parent_vi
;
struct
dentry
*
parent_dent
;
struct
dentry
*
parent_dent
;
unsigned
long
parent_ino
;
unsigned
long
parent_ino
;
int
err
;
ntfs_debug
(
"Entering for inode 0x%lx."
,
vi
->
i_ino
);
ntfs_debug
(
"Entering for inode 0x%lx."
,
vi
->
i_ino
);
/* Get the mft record of the inode belonging to the child dentry. */
/* Get the mft record of the inode belonging to the child dentry. */
...
@@ -385,13 +388,16 @@ struct dentry *ntfs_get_parent(struct dentry *child_dent)
...
@@ -385,13 +388,16 @@ struct dentry *ntfs_get_parent(struct dentry *child_dent)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
}
}
try_next:
try_next:
if
(
unlikely
(
!
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
CASE_SENSITIVE
,
err
=
ntfs_attr_lookup
(
AT_FILE_NAME
,
NULL
,
0
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
NULL
,
0
,
ctx
)))
{
0
,
ctx
);
if
(
unlikely
(
err
))
{
ntfs_attr_put_search_ctx
(
ctx
);
ntfs_attr_put_search_ctx
(
ctx
);
unmap_mft_record
(
ni
);
unmap_mft_record
(
ni
);
ntfs_error
(
vi
->
i_sb
,
"Inode 0x%lx does not have a file name "
if
(
err
==
-
ENOENT
)
"attribute. Run chkdsk."
,
vi
->
i_ino
);
ntfs_error
(
vi
->
i_sb
,
"Inode 0x%lx does not have a "
return
ERR_PTR
(
-
ENOENT
);
"file name attribute. Run chkdsk."
,
vi
->
i_ino
);
return
ERR_PTR
(
err
);
}
}
attr
=
ctx
->
attr
;
attr
=
ctx
->
attr
;
if
(
unlikely
(
attr
->
non_resident
))
if
(
unlikely
(
attr
->
non_resident
))
...
...
fs/ntfs/super.c
View file @
bad71405
...
@@ -336,11 +336,10 @@ static int ntfs_write_volume_flags(ntfs_volume *vol, const VOLUME_FLAGS flags)
...
@@ -336,11 +336,10 @@ static int ntfs_write_volume_flags(ntfs_volume *vol, const VOLUME_FLAGS flags)
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
put_unm_err_out
;
goto
put_unm_err_out
;
}
}
if
(
!
ntfs_attr_lookup
(
AT_VOLUME_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
err
=
ntfs_attr_lookup
(
AT_VOLUME_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
)
)
{
ctx
)
;
err
=
-
EIO
;
if
(
err
)
goto
put_unm_err_out
;
goto
put_unm_err_out
;
}
vi
=
(
VOLUME_INFORMATION
*
)((
u8
*
)
ctx
->
attr
+
vi
=
(
VOLUME_INFORMATION
*
)((
u8
*
)
ctx
->
attr
+
le16_to_cpu
(
ctx
->
attr
->
data
.
resident
.
value_offset
));
le16_to_cpu
(
ctx
->
attr
->
data
.
resident
.
value_offset
));
vol
->
vol_flags
=
vi
->
flags
=
flags
;
vol
->
vol_flags
=
vi
->
flags
=
flags
;
...
@@ -1433,7 +1432,7 @@ static BOOL load_system_files(ntfs_volume *vol)
...
@@ -1433,7 +1432,7 @@ static BOOL load_system_files(ntfs_volume *vol)
ntfs_error
(
sb
,
"Failed to get attribute search context."
);
ntfs_error
(
sb
,
"Failed to get attribute search context."
);
goto
get_ctx_vol_failed
;
goto
get_ctx_vol_failed
;
}
}
if
(
!
ntfs_attr_lookup
(
AT_VOLUME_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
if
(
ntfs_attr_lookup
(
AT_VOLUME_INFORMATION
,
NULL
,
0
,
0
,
0
,
NULL
,
0
,
ctx
)
||
ctx
->
attr
->
non_resident
||
ctx
->
attr
->
flags
)
{
ctx
)
||
ctx
->
attr
->
non_resident
||
ctx
->
attr
->
flags
)
{
err_put_vol:
err_put_vol:
ntfs_attr_put_search_ctx
(
ctx
);
ntfs_attr_put_search_ctx
(
ctx
);
...
...
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