mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 10:04:00 +08:00
Added a summary of inodes found by ntfscluster
Output the number of inodes found.
This commit is contained in:
parent
9636ac058f
commit
e5ea399ee6
@ -2,6 +2,7 @@
|
||||
* cluster - Part of the Linux-NTFS project.
|
||||
*
|
||||
* Copyright (c) 2002-2003 Richard Russon
|
||||
* Copyright (c) 2014 Jean-Pierre Andre
|
||||
*
|
||||
* This function will locate the owner of any given sector or cluster range.
|
||||
*
|
||||
@ -46,6 +47,8 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
|
||||
int result = -1;
|
||||
struct mft_search_ctx *m_ctx = NULL;
|
||||
ntfs_attr_search_ctx *a_ctx = NULL;
|
||||
s64 count;
|
||||
BOOL found;
|
||||
ATTR_RECORD *rec;
|
||||
runlist *runs;
|
||||
|
||||
@ -54,6 +57,7 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
|
||||
|
||||
m_ctx = mft_get_search_ctx(vol);
|
||||
m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD;
|
||||
count = 0;
|
||||
|
||||
while (mft_next_record(m_ctx) == 0) {
|
||||
|
||||
@ -65,6 +69,7 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
|
||||
|
||||
a_ctx = ntfs_attr_get_search_ctx(m_ctx->inode, NULL);
|
||||
|
||||
found = FALSE;
|
||||
while ((rec = find_attribute(AT_UNUSED, a_ctx))) {
|
||||
|
||||
if (!rec->non_resident) {
|
||||
@ -103,13 +108,20 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void
|
||||
|
||||
if ((*cb) (m_ctx->inode, a_ctx->attr, runs+j, data))
|
||||
return 1;
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ntfs_attr_put_search_ctx(a_ctx);
|
||||
a_ctx = NULL;
|
||||
if (found)
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count > 1)
|
||||
ntfs_log_info("* %lld inodes found\n",(long long)count);
|
||||
else
|
||||
ntfs_log_info("* %s inode found\n", (count ? "one" : "no"));
|
||||
result = 0;
|
||||
done:
|
||||
ntfs_attr_put_search_ctx(a_ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user