Changes by: flatcap
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17432/ntfsprogs
Modified Files:
Makefile.am attrdef.c mkntfs.c ntfscat.c ntfsclone.c ntfscmp.c
ntfscp.c ntfsdump_logfile.c ntfsfix.c ntfsinfo.c ntfslabel.c
ntfsmount.c ntfsmove.h ntfsresize.c ntfsrm.c ntfstruncate.c
ntfsundelete.c ntfsundelete.h sd.c upcase.c utils.c utils.h
Log Message:
implement logging in libntfs
fix whitespace
fix build problems
tidy source code
and more...
Index: Makefile.am
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/Makefile.am,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -p -r1.54 -r1.55
--- Makefile.am 16 Oct 2005 23:33:04 -0000 1.54
+++ Makefile.am 21 Oct 2005 18:05:14 -0000 1.55
@@ -48,7 +48,7 @@ ntfsfix_SOURCES = ntfsfix.c utils.c uti
ntfsfix_LDADD = $(AM_LIBS)
ntfsfix_LDFLAGS = $(AM_LFLAGS)
-mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h
+mkntfs_SOURCES = attrdef.c attrdef.h upcase.c upcase.h boot.c boot.h sd.c sd.h mkntfs.c utils.c utils.h
mkntfs_LDADD = $(AM_LIBS)
mkntfs_LDFLAGS = $(AM_LFLAGS)
Index: attrdef.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/attrdef.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- attrdef.c 19 Oct 2005 22:04:46 -0000 1.3
+++ attrdef.c 21 Oct 2005 18:05:14 -0000 1.4
@@ -203,7 +203,8 @@ const unsigned char attrdef_ntfs3x_array
, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00
+, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
, 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x41, 0x00, 0x4C, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x43, 0x00, 0x41, 0x00, 0x54, 0x00
, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -245,3 +246,4 @@ const unsigned char attrdef_ntfs3x_array
, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
+
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/mkntfs.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -p -r1.75 -r1.76
--- mkntfs.c 20 Oct 2005 13:49:56 -0000 1.75
+++ mkntfs.c 21 Oct 2005 18:05:14 -0000 1.76
@@ -140,6 +140,10 @@
#include "runlist.h"
#include "utils.h"
#include "ntfstime.h"
+#include "sd.h"
+#include "upcase.h"
+#include "boot.h"
+#include "attrdef.h"
#include "version.h"
#ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS
@@ -148,15 +152,6 @@ You need to run ./configure without the
[...1673 lines suppressed...]
+ err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME,
+ COLLATION_FILE_NAME, opts.index_block_size);
if (err < 0)
- err_exit("Couldn't create 'System Volume Information'"
+ err_exit("Couldn't create 'System Volume Information'"
": %s\n", strerror(-err));
- }
+ }
}
/**
@@ -4955,7 +4926,7 @@ int main(int argc, char **argv)
err_exit("Could not allocate memory for internal buffer.\n");
init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar));
/* Initialize opts to zero / required values. */
- init_options();
+ init_options();
/* Parse command line options. */
parse_options(argc, argv);
/* Open the partition. */
Index: ntfscat.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfscat.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -p -r1.19 -r1.20
--- ntfscat.c 7 Oct 2005 14:10:57 -0000 1.19
+++ ntfscat.c 21 Oct 2005 18:05:14 -0000 1.20
@@ -243,7 +243,7 @@ static int parse_options (int argc, char
opts.quiet = 0;
} else {
if (opts.device == NULL) {
- Eprintf ("You must specify a device.\n");
+ Eprintf ("You must specify a device.\n");
err++;
} else if (opts.file == NULL && opts.inode == -1) {
Index: ntfsclone.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsclone.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -p -r1.57 -r1.58
--- ntfsclone.c 15 Oct 2005 21:44:17 -0000 1.57
+++ ntfsclone.c 21 Oct 2005 18:05:14 -0000 1.58
@@ -162,10 +162,10 @@ struct {
#define PERR_PREFIX ERR_PREFIX "(%d): "
#define NERR_PREFIX ERR_PREFIX ": "
-#define LAST_METADATA_INODE 11
+#define LAST_METADATA_INODE 11
-#define NTFS_MAX_CLUSTER_SIZE 65536
-#define NTFS_SECTOR_SIZE 512
+#define NTFS_MAX_CLUSTER_SIZE 65536
+#define NTFS_SECTOR_SIZE 512
#define rounded_up_division(a, b) (((a) + (b - 1)) / (b))
@@ -383,7 +383,7 @@ static void parse_options(int argc, char
msg_out = stdout;
- /* FIXME: this is a workaround for loosing debug info if stdout != stderr
+ /* FIXME: this is a workaround for losing debug info if stdout != stderr
and for the uncontrollable verbose messages in libntfs. Ughhh. */
if (opt.std_out)
msg_out = stderr;
@@ -699,7 +699,7 @@ static void restore_image(void)
#define WIPE_TIMESTAMPS(atype, attr) \
do { \
atype *ats; \
- ats = (atype *)((char*)(attr) + (attr)->value_offset); \
+ ats = (atype *)((char*)(attr) + (attr)->value_offset); \
\
ats->creation_time = 0; \
ats->last_data_change_time = 0; \
@@ -708,7 +708,7 @@ do { \
\
wiped_timestamp_data += 32; \
\
-} while(0)
+} while (0)
static void wipe_timestamps(ntfs_walk_clusters_ctx *image)
{
@@ -1004,8 +1004,7 @@ static int walk_clusters(ntfs_volume *vo
}
}
- if (ni->mrec)
- free(ni->mrec);
+ free(ni->mrec);
free(ni);
if (deleted_inode)
@@ -1248,9 +1247,9 @@ static void set_filesize(s64 filesize)
if (fstatfs(fd_out, &opt.stfs) == -1)
Printf("WARNING: Couldn't get filesystem type: "
"%s\n", strerror(errno));
- else
+ else
fs_type = opt.stfs.f_type;
-
+
if (fs_type == 0x52654973)
Printf("WARNING: You're using ReiserFS, it has very poor "
"performance creating\nlarge sparse files. The next "
Index: ntfscmp.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfscmp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- ntfscmp.c 15 Oct 2005 21:48:37 -0000 1.10
+++ ntfscmp.c 21 Oct 2005 18:05:14 -0000 1.11
@@ -176,7 +176,7 @@ static void parse_options(int argc, char
{ "debug", no_argument, NULL, 'd' },
#endif
{ "help", no_argument, NULL, 'h' },
- { "no-progress-bar", no_argument, NULL, 'P' },
+ { "no-progress-bar", no_argument, NULL, 'P' },
{ "verbose", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
@@ -193,7 +193,7 @@ static void parse_options(int argc, char
opt.vol1 = argv[optind - 1];
} else if (!opt.vol2) {
opt.vol2 = argv[optind - 1];
- } else {
+ } else {
err_printf("Too many arguments!\n");
usage();
}
@@ -284,7 +284,7 @@ static u64 inumber(ntfs_inode *ni)
{
if (ni->nr_extents >= 0)
return ni->mft_no;
-
+
return ni->base_ni->mft_no;
}
@@ -312,7 +312,7 @@ static inline s64 get_nr_mft_records(ntf
#define NTFSCMP_EXTENSION_RECORD 4
#define NTFSCMP_INODE_CLOSE_ERROR 5
-const char *ntfscmp_errs[] = {
+const char *ntfscmp_errs[] = {
"OK",
"INODE_OPEN_ERROR",
"INODE_OPEN_IO_ERROR",
@@ -325,7 +325,7 @@ const char *ntfscmp_errs[] = {
static const char *err2string(int err)
{
- return ntfscmp_errs[err];
+ return ntfscmp_errs[err];
}
static const char *pret2str(void *p)
@@ -352,7 +352,7 @@ static int inode_open(ntfs_volume *vol,
if (inode_close(*ni) != 0)
return NTFSCMP_INODE_CLOSE_ERROR;
-
+
return NTFSCMP_EXTENSION_RECORD;
}
@@ -363,7 +363,7 @@ static ntfs_inode *base_inode(ntfs_attr_
{
if (ctx->base_ntfs_ino)
return ctx->base_ntfs_ino;
-
+
return ctx->ntfs_ino;
}
@@ -401,7 +401,7 @@ static void free_name(char **name)
static char *get_attr_name(u64 mft_no,
ATTR_TYPES atype,
- const ntfschar *uname,
+ const ntfschar *uname,
const int uname_len)
{
char *name = NULL;
@@ -417,7 +417,7 @@ static char *get_attr_name(u64 mft_no,
print_attribute_type(atype);
puts("");
exit(1);
-
+
} else if (name_len > 0)
return name;
@@ -495,9 +495,9 @@ static void cmp_attribute_data(ntfs_attr
printf("len = %lld, pos = %lld\n", na1->data_size, pos);
exit(1);
}
-
+
if (count1 == 0) {
-
+
if (pos + count1 == na1->data_size)
return; /* we are ready */
@@ -506,7 +506,7 @@ static void cmp_attribute_data(ntfs_attr
printf("%lld != %lld\n", pos + count1, na1->data_size);
exit(1);
}
-
+
if (memcmp(buf1, buf2, count1)) {
print_na(na1);
printf("content");
@@ -515,15 +515,15 @@ static void cmp_attribute_data(ntfs_attr
return;
}
}
-
+
err_printf("%s read overrun: ", __FUNCTION__);
print_na(na1);
- err_printf("(len = %lld, pos = %lld, count = %lld)\n",
+ err_printf("(len = %lld, pos = %lld, count = %lld)\n",
na1->data_size, pos, count1);
exit(1);
}
-static void cmp_attribute(ntfs_attr_search_ctx *ctx1,
+static void cmp_attribute(ntfs_attr_search_ctx *ctx1,
ntfs_attr_search_ctx *ctx2)
{
ATTR_RECORD *a1 = ctx1->attr;
@@ -532,7 +532,7 @@ static void cmp_attribute(ntfs_attr_sear
na1 = ntfs_attr_open(base_inode(ctx1), a1->type, GET_ATTR_NAME(a1));
na2 = ntfs_attr_open(base_inode(ctx2), a2->type, GET_ATTR_NAME(a2));
-
+
if ((!na1 && na2) || (na1 && !na2)) {
print_ctx(ctx1);
printf("open: %s != %s\n", pret2str(na1), pret2str(na2));
@@ -579,7 +579,7 @@ static int new_name(ntfs_attr_search_ctx
{
int ret = 0;
char *name = get_attr_name_ctx(ctx);
-
+
if (prev_name && name) {
if (strcmp(prev_name, name) != 0)
ret = 1;
@@ -597,13 +597,13 @@ static int new_attribute(ntfs_attr_searc
{
if (!prev_atype && !prev_name)
return 1;
-
+
if (!ctx->attr->non_resident)
return 1;
if (prev_atype != ctx->attr->type)
return 1;
-
+
if (new_name(ctx, prev_name))
return 1;
@@ -613,11 +613,11 @@ static int new_attribute(ntfs_attr_searc
printf("record %llu lowest_vcn %lld: SKIPPED\n",
ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn);
}
-
+
return 0;
}
-
-static void set_prev(char **prev_name, ATTR_TYPES *prev_atype,
+
+static void set_prev(char **prev_name, ATTR_TYPES *prev_atype,
char *name, ATTR_TYPES atype)
{
free_name(prev_name);
@@ -632,8 +632,8 @@ static void set_prev(char **prev_name, A
static void set_cmp_attr(ntfs_attr_search_ctx *ctx, ATTR_TYPES *atype, char **name)
{
- *atype = ctx->attr->type;
-
+ *atype = ctx->attr->type;
+
free_name(name);
*name = get_attr_name_ctx(ctx);
}
@@ -642,15 +642,15 @@ static int next_attr(ntfs_attr_search_ct
int *err)
{
int ret;
-
+
ret = ntfs_attrs_walk(ctx);
*err = errno;
- if (ret) {
+ if (ret) {
*atype = AT_END;
free_name(name);
} else
set_cmp_attr(ctx, atype, name);
-
+
return ret;
}
@@ -662,12 +662,12 @@ static int cmp_attributes(ntfs_inode *ni
char *prev_name = NULL, *name1 = NULL, *name2 = NULL;
ATTR_TYPES old_atype1, prev_atype = 0, atype1, atype2;
ntfs_attr_search_ctx *ctx1, *ctx2;
-
+
if (!(ctx1 = attr_get_search_ctx(ni1)))
return -1;
if (!(ctx2 = attr_get_search_ctx(ni2)))
goto out;
-
+
set_cmp_attr(ctx1, &atype1, &name1);
set_cmp_attr(ctx2, &atype2, &name2);
@@ -681,7 +681,7 @@ static int cmp_attributes(ntfs_inode *ni
ret2 = next_attr(ctx2, &atype2, &name2, &errno2);
print_attributes(ni1, atype1, atype2, name1, name2);
-
+
if (ret1 && ret2) {
if (errno1 != errno2) {
print_inode_ni(ni1);
@@ -697,14 +697,14 @@ static int cmp_attributes(ntfs_inode *ni
printf("presence: EXISTS != MISSING\n");
set_prev(&prev_name, &prev_atype, name1, atype1);
}
-
+
} else if (ret1 || atype1 > atype2) {
if (new_attribute(ctx2, prev_atype, prev_name)) {
print_ctx(ctx2);
printf("presence: MISSING != EXISTS \n");
set_prev(&prev_name, &prev_atype, name2, atype2);
}
-
+
} else /* atype1 == atype2 */ {
if (new_attribute(ctx1, prev_atype, prev_name)) {
cmp_attribute(ctx1, ctx2);
@@ -759,7 +759,7 @@ static int cmp_inodes(ntfs_volume *vol1,
if (ret1 != ret2) {
print_inode(inode);
- printf("open: %s != %s\n",
+ printf("open: %s != %s\n",
err2string(ret1), err2string(ret2));
goto close_inodes;
}
Index: ntfscp.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfscp.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- ntfscp.c 7 Oct 2005 14:10:57 -0000 1.28
+++ ntfscp.c 21 Oct 2005 18:05:14 -0000 1.29
@@ -222,7 +222,7 @@ static int parse_options (int argc, char
opts.quiet = 0;
} else {
if (!opts.device) {
- Eprintf("You must specify a device.\n");
+ Eprintf("You must specify a device.\n");
err++;
} else if (!opts.src_file) {
Eprintf("You must specify a source file.\n");
Index: ntfsdump_logfile.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsdump_logfile.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -p -r1.31 -r1.32
--- ntfsdump_logfile.c 12 Oct 2005 11:52:41 -0000 1.31
+++ ntfsdump_logfile.c 21 Oct 2005 18:05:14 -0000 1.32
@@ -153,8 +153,7 @@ static void log_err_exit(u8 *buf, const
{
va_list ap;
- if (buf)
- free(buf);
+ free(buf);
fprintf(stderr, "ERROR: ");
va_start(ap, fmt);
Index: ntfsfix.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsfix.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -p -r1.23 -r1.24
--- ntfsfix.c 15 Oct 2005 23:13:50 -0000 1.23
+++ ntfsfix.c 21 Oct 2005 18:05:14 -0000 1.24
@@ -228,8 +228,7 @@ static int OLD_ntfs_volume_set_flags(ntf
err_out:
ntfs_attr_put_search_ctx(ctx);
err_exit:
- if (m)
- free(m);
+ free(m);
return ret;
}
@@ -509,10 +508,8 @@ mount_ok:
/* Set return code to 0. */
i = 0;
final_exit:
- if (m)
- free(m);
- if (m2)
- free(m2);
+ free(m);
+ free(m2);
if (vol && ntfs_umount(vol, 0))
ntfs_umount(vol, 1);
return i;
Index: ntfsinfo.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsinfo.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -p -r1.80 -r1.81
--- ntfsinfo.c 15 Oct 2005 23:51:13 -0000 1.80
+++ ntfsinfo.c 21 Oct 2005 18:05:14 -0000 1.81
@@ -625,7 +625,7 @@ static void ntfs_dump_attr_list(ATTR_REC
}
printf("\tDumping attribute list:");
entry = (ATTR_LIST_ENTRY *) value;
- for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *)
+ for (;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *)
((u8 *) entry + le16_to_cpu(entry->length))) {
printf("\n");
printf("\t\tAttribute type:\t0x%x\n",
@@ -832,8 +832,7 @@ static void ntfs_dump_acl(const char *pr
/* get a SID string */
sid = ntfs_sid_to_mbs(&ace->sid, NULL, 0);
printf("%s\t\t SID: %s\n",prefix,sid);
- if (sid)
- free(sid);
+ free(sid);
/* proceed to next ACE */
ace = (ACCESS_ALLOWED_ACE *)(((char *)ace) + le32_to_cpu(ace->size));
@@ -1098,7 +1097,7 @@ static int ntfs_dump_index_entries(INDEX
int numb_entries = 1;
char *name = NULL;
- while(1) {
+ while (1) {
if (!opts.verbose) {
if (entry->flags & INDEX_ENTRY_END)
break;
@@ -1121,7 +1120,7 @@ static int ntfs_dump_index_entries(INDEX
if (entry->flags & INDEX_ENTRY_END)
break;
- switch(type) {
+ switch (type) {
case(AT_FILE_NAME):
Vprintf("\t\tFILE record number:\t %llu\n",
MREF_LE(entry->indexed_file));
@@ -1351,7 +1350,7 @@ static void ntfs_dump_index_allocation(A
tmp_alloc = allocation;
bit = 0;
- while((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) {
+ while ((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) {
if (*byte & (1 << bit)) {
if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc,
indx_record_size)) {
@@ -1493,7 +1492,7 @@ static void ntfs_dump_attr_reparse_point
static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr)
{
EA_INFORMATION *ea_info;
-
+
ea_info = (EA_INFORMATION*)((u8*)attr +
le16_to_cpu(attr->value_offset));
printf("Dumping attribute $EA_INFORMATION (0xD0)\n");
@@ -1519,7 +1518,7 @@ static void ntfs_dump_attr_ea(ATTR_RECOR
if (attr->non_resident) {
runlist *rl;
- data_size = sle64_to_cpu(attr->data_size);
+ data_size = sle64_to_cpu(attr->data_size);
printf("\tIs resident? \t\t No\n");
printf("\tData size:\t\t %lld\n", data_size);
if (!opts.verbose)
@@ -1578,8 +1577,7 @@ static void ntfs_dump_attr_ea(ATTR_RECOR
if ((u8*)ea - buf >= data_size)
break;
}
- if (buf)
- free(buf);
+ free(buf);
}
/**
Index: ntfslabel.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfslabel.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -p -r1.16 -r1.17
--- ntfslabel.c 7 Oct 2005 14:10:57 -0000 1.16
+++ ntfslabel.c 21 Oct 2005 18:05:14 -0000 1.17
@@ -354,8 +354,7 @@ static int change_label(ntfs_volume *vol
}
result = 0;
err_out:
- if (new_label)
- free(new_label);
+ free(new_label);
return result;
}
Index: ntfsmount.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsmount.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -p -r1.42 -r1.43
--- ntfsmount.c 20 Oct 2005 15:38:21 -0000 1.42
+++ ntfsmount.c 21 Oct 2005 18:05:14 -0000 1.43
@@ -119,7 +119,7 @@ static long ntfs_fuse_get_nr_free_mft_re
u8 *buf;
long nr_free = 0;
s64 br, total = 0;
-
+
if (!(ctx->state & NF_FreeMFTOutdate))
return ctx->free_mft;
buf = malloc(vol->cluster_size);
@@ -494,7 +494,7 @@ static int ntfs_fuse_write(const char *o
total += res;
}
res = total;
-exit:
+exit:
ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate);
if (na)
ntfs_attr_close(na);
@@ -587,8 +587,7 @@ static int ntfs_fuse_create(const char *
else
res = -errno;
exit:
- if (uname)
- free(uname);
+ free(uname);
if (dir_ni)
ntfs_inode_close(dir_ni);
free(path);
@@ -693,8 +692,7 @@ static int ntfs_fuse_link(const char *ol
exit:
if (ni)
ntfs_inode_close(ni);
- if (uname)
- free(uname);
+ free(uname);
if (dir_ni)
ntfs_inode_close(dir_ni);
free(path);
@@ -742,8 +740,7 @@ static int ntfs_fuse_rm(const char *org_
exit:
if (ni)
ntfs_inode_close(ni);
- if (uname)
- free(uname);
+ free(uname);
if (dir_ni)
ntfs_inode_close(dir_ni);
free(path);
@@ -1015,8 +1012,7 @@ static int ntfs_fuse_getxattr(const char
exit:
if (na)
ntfs_attr_close(na);
- if (lename)
- free(lename);
+ free(lename);
if (ntfs_inode_close(ni))
perror("Failed to close inode");
return res;
@@ -1070,8 +1066,7 @@ static int ntfs_fuse_setxattr(const char
exit:
if (na)
ntfs_attr_close(na);
- if (lename)
- free(lename);
+ free(lename);
if (ntfs_inode_close(ni))
perror("Failed to close inode");
return res;
@@ -1111,8 +1106,7 @@ static int ntfs_fuse_removexattr(const c
exit:
if (na)
ntfs_attr_close(na);
- if (lename)
- free(lename);
+ free(lename);
if (ntfs_inode_close(ni))
perror("Failed to close inode");
return res;
@@ -1140,7 +1134,7 @@ static struct fuse_operations ntfs_fuse_
.utime = ntfs_fuse_utime,
#ifdef HAVE_SETXATTR
.getxattr = ntfs_fuse_getxattr,
-#if 0
+#if 0
.setxattr = ntfs_fuse_setxattr,
.removexattr = ntfs_fuse_removexattr,
.listxattr = ntfs_fuse_listxattr,
@@ -1487,8 +1481,7 @@ int main(int argc, char *argv[])
parsed_options = parse_mount_options((opts.options) ?
opts.options : "");
if (!parsed_options) {
- if (opts.device)
- free(opts.device);
+ free(opts.device);
ntfs_fuse_destroy();
return 3;
}
Index: ntfsmove.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsmove.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- ntfsmove.h 20 Aug 2004 12:01:17 -0000 1.4
+++ ntfsmove.h 21 Oct 2005 18:05:14 -0000 1.5
@@ -39,7 +39,7 @@ struct options {
int verbose; /* Extra output */
int noaction; /* Do not write to disk */
int nodirty; /* Do not mark volume dirty */
- u8 padding[4]; /* Unused: alignment to 64 bit. */
+ u8 padding[4]; /* Unused: alignment to 64 bit. */
};
#endif /* _NTFSMOVE_H_ */
Index: ntfsresize.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsresize.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -p -r1.100 -r1.101
--- ntfsresize.c 16 Oct 2005 18:50:56 -0000 1.100
+++ ntfsresize.c 21 Oct 2005 18:05:14 -0000 1.101
@@ -204,7 +204,7 @@ s64 max_free_cluster_range = 0;
#define DIRTY_INODE (1)
#define DIRTY_ATTRIB (2)
-#define NTFS_MAX_CLUSTER_SIZE (65536)
+#define NTFS_MAX_CLUSTER_SIZE (65536)
GEN_PRINTF(Eprintf, stderr, NULL, FALSE)
GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE)
@@ -694,7 +694,7 @@ static void collect_resize_constraints(n
exit(1);
return;
}
-
+
if (inode == FILE_Bitmap) {
llcn = &resize->last_lcn;
if (atype == AT_DATA && NInoAttrList(resize->ni))
@@ -765,7 +765,7 @@ static void collect_relocation_info(ntfs
if (inode == FILE_Bitmap && resize->ctx->attr->type == AT_DATA)
return;
-
+
start = lcn;
len = lcn_length;
@@ -1636,11 +1636,11 @@ static int is_mftdata(ntfs_resize_t *res
if (resize->mref == 0)
return 1;
-
+
if ( MREF(resize->mrec->base_mft_record) == 0 &&
MSEQNO(resize->mrec->base_mft_record) != 0)
return 1;
-
+
return 0;
}
@@ -1648,30 +1648,30 @@ static int handle_mftdata(ntfs_resize_t
{
ATTR_RECORD *attr = resize->ctx->attr;
VCN highest_vcn, lowest_vcn;
-
+
if (do_mftdata) {
-
+
if (!is_mftdata(resize))
return 0;
-
+
highest_vcn = sle64_to_cpu(attr->highest_vcn);
lowest_vcn = sle64_to_cpu(attr->lowest_vcn);
-
+
if (resize->mft_highest_vcn != highest_vcn)
return 0;
-
+
if (lowest_vcn == 0)
resize->mft_highest_vcn = lowest_vcn;
else
resize->mft_highest_vcn = lowest_vcn - 1;
} else if (is_mftdata(resize)) {
-
+
highest_vcn = sle64_to_cpu(attr->highest_vcn);
-
+
if (resize->mft_highest_vcn < highest_vcn)
resize->mft_highest_vcn = highest_vcn;
-
+
return 0;
}
@@ -1688,10 +1688,10 @@ static void relocate_attributes(ntfs_res
while (!ntfs_attrs_walk(resize->ctx)) {
if (resize->ctx->attr->type == AT_END)
break;
-
+
if (handle_mftdata(resize, do_mftdata) == 0)
continue;
-
+
ret = has_bad_sectors(resize, 0);
if (ret == -1)
exit(1);
@@ -1752,10 +1752,10 @@ static void relocate_inodes(ntfs_resize_
nr_mft_records = resize->vol->mft_na->initialized_size >>
resize->vol->mft_record_size_bits;
- for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++)
+ for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++)
relocate_inode(resize, mref, 0);
- while(1) {
+ while (1) {
highest_vcn = resize->mft_highest_vcn;
mref = nr_mft_records;
do {
@@ -1769,8 +1769,7 @@ static void relocate_inodes(ntfs_resize_
"Please report!\n", highest_vcn);
}
done:
- if (resize->mrec)
- free(resize->mrec);
+ free(resize->mrec);
}
static void print_hint(ntfs_volume *vol, const char *s, struct llcn_t llcn)
@@ -1800,12 +1799,12 @@ static void advise_on_resize(ntfs_resize
if (opt.verbose) {
printf("Estimating smallest shrunken size supported ...\n");
printf("File feature Last used at By inode\n");
- print_hint(vol, "$MFT", resize->last_mft);
+ print_hint(vol, "$MFT", resize->last_mft);
print_hint(vol, "Multi-Record", resize->last_multi_mft);
- print_hint(vol, "$MFTMirr", resize->last_mftmir);
- print_hint(vol, "Compressed", resize->last_compressed);
- print_hint(vol, "Sparse", resize->last_sparse);
- print_hint(vol, "Ordinary", resize->last_lcn);
+ print_hint(vol, "$MFTMirr", resize->last_mftmir);
+ print_hint(vol, "Compressed", resize->last_compressed);
+ print_hint(vol, "Sparse", resize->last_sparse);
+ print_hint(vol, "Ordinary", resize->last_lcn);
}
print_advise(vol, resize->last_unsupp);
@@ -1849,16 +1848,16 @@ static void rl_truncate(runlist **rl, co
{
int len;
VCN vcn;
-
+
len = rl_items(*rl) - 1;
if (len <= 0)
err_exit("rl_truncate: bad runlist length: %d\n", len);
vcn = (*rl)[len].vcn;
-
+
if (vcn < last_vcn)
rl_expand(rl, last_vcn);
-
+
else if (vcn > last_vcn)
if (ntfs_rl_truncate(rl, last_vcn) == -1)
perr_exit("ntfs_rl_truncate");
@@ -1898,7 +1897,7 @@ static void truncate_badclust_bad_attr(n
if (!(rl_bad = ntfs_mapping_pairs_decompress(vol, a, NULL)))
perr_exit("ntfs_mapping_pairs_decompress");
-
+
rl_truncate(&rl_bad, nr_clusters);
a->highest_vcn = cpu_to_le64(nr_clusters - 1LL);
@@ -1945,7 +1944,7 @@ static void realloc_lcn_bitmap(ntfs_resi
if (!(tmp = realloc(resize->lcn_bitmap.bm, bm_bsize)))
perr_exit("realloc");
-
+
resize->lcn_bitmap.bm = tmp;
resize->lcn_bitmap.size = bm_bsize;
bitmap_file_data_fixup(resize->new_volume_size, &resize->lcn_bitmap);
@@ -2037,41 +2036,41 @@ static int check_bad_sectors(ntfs_volume
ntfs_attr_search_ctx *ctx;
runlist *rl;
s64 i, badclusters = 0;
-
+
Vprintf("Checking for bad sectors ...\n");
lookup_data_attr(vol, FILE_BadClus, "$Bad", &ctx);
-
+
if (NInoAttrList(ctx->ntfs_ino))
err_exit("Hopelessly many bad sectors! Please report to "
"lin...@li...\n");
-
+
if (!ctx->attr->non_resident)
err_exit("Resident attribute in $BadClust! Please report to "
"lin...@li...\n");
if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL)))
perr_exit("Decompressing $BadClust:$Bad mapping pairs failed");
-
+
for (i = 0; rl[i].length; i++) {
/* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */
if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED)
continue;
-
+
badclusters += rl[i].length;
- Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn,
+ Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn,
rl[i].lcn + rl[i].length - 1);
}
if (badclusters) {
printf("%sThis software has detected that the disk has at least"
- " %lld bad sector%s.\n",
+ " %lld bad sector%s.\n",
!opt.badsectors ? NERR_PREFIX : "WARNING: ",
badclusters, badclusters - 1 ? "s" : "");
if (!opt.badsectors) {
printf("%s", bad_sectors_warning_msg);
exit(1);
- } else
+ } else
printf("WARNING: Bad sectors can cause reliability "
"problems and massive data loss!!!\n");
}
@@ -2263,7 +2262,7 @@ static ntfs_volume *mount_volume(void)
printf("%s", corrupt_volume_msg);
else if (err == EPERM)
printf("%s", hibernated_volume_msg);
- else if (err == EOPNOTSUPP)
+ else if (err == EOPNOTSUPP)
printf("%s", unclean_journal_msg);
exit(1);
}
@@ -2384,7 +2383,7 @@ static void check_cluster_allocation(ntf
printf("%s", corrupt_volume_msg);
exit(1);
}
-
+
compare_bitmaps(vol, &fsck->lcn_bitmap);
}
@@ -2444,7 +2443,7 @@ int main(int argc, char **argv)
printf("Nothing to do: NTFS volume size is already OK.\n");
exit(0);
}
-
+
memset(&resize, 0, sizeof(resize));
resize.vol = vol;
resize.new_volume_size = new_size;
@@ -2453,13 +2452,13 @@ int main(int argc, char **argv)
resize.shrink = 1;
if (opt.show_progress)
resize.progress.flags |= NTFS_PROGBAR;
- /*
+ /*
* Checking and __reporting__ of bad sectors must be done before cluster
* allocation check because chkdsk doesn't fix $Bitmap's w/ bad sectors
* thus users would (were) quite confused why chkdsk doesn't work.
- */
+ */
resize.badclusters = check_bad_sectors(vol);
-
+
check_cluster_allocation(vol, &fsck);
print_disk_usage(vol, fsck.inuse);
@@ -2472,7 +2471,7 @@ int main(int argc, char **argv)
check_resize_constraints(&resize);
if (opt.info) {
- advise_on_resize(&resize);
+ advise_on_resize(&resize);
exit(0);
}
Index: ntfsrm.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsrm.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -p -r1.66 -r1.67
--- ntfsrm.c 16 Oct 2005 23:33:04 -0000 1.66
+++ ntfsrm.c 21 Oct 2005 18:05:14 -0000 1.67
@@ -264,7 +264,7 @@ static int utils_array_insert (void *ptr
return -1;
src = (u8*) ptr + (before * esize);
- dst = src + (count * esize);
+ dst = src + (count * esize);
len = (asize - before) * esize;
// XXX what about realloc?
@@ -291,7 +291,7 @@ static int utils_array_remove (void *ptr
return -1;
dst = (u8*) ptr + (first * esize);
- src = dst + (count * esize);
+ src = dst + (count * esize);
len = (asize - first) * esize;
memmove (dst, src, len);
Index: ntfstruncate.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfstruncate.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -r1.29 -r1.30
--- ntfstruncate.c 12 Oct 2005 11:52:42 -0000 1.29
+++ ntfstruncate.c 21 Oct 2005 18:05:14 -0000 1.30
@@ -64,10 +64,9 @@
#include "layout.h"
#include "volume.h"
#include "utils.h"
+#include "attrdef.h"
#include "version.h"
-extern const unsigned char attrdef_ntfs12_array[2400];
-
const char *EXEC_NAME = "ntfstruncate";
/* Need these global so ntfstruncate_exit can access them. */
Index: ntfsundelete.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsundelete.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- ntfsundelete.c 7 Oct 2005 14:10:57 -0000 1.48
+++ ntfsundelete.c 21 Oct 2005 18:05:14 -0000 1.49
@@ -105,10 +105,6 @@ GEN_PRINTF (Eprintf, stderr, NULL,
GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE)
GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE)
-static int undelete_file (ntfs_volume *vol, long long inode);
-
-#define _(S) gettext(S)
-
/**
* parse_inode_arg - parses the inode expression
*
@@ -1572,130 +1568,6 @@ static int set_date (const char *pathnam
}
/**
- * scan_disk - Search an NTFS volume for files that could be undeleted
- * @vol: An ntfs volume obtained from ntfs_mount
- *
- * Read through all the MFT entries looking for deleted files. For each one
- * determine how much of the data lies in unused disk space.
- *
- * The list can be filtered by name, size and date, using command line options.
- *
- * Return: -1 Error, something went wrong
- * n Success, the number of recoverable files
- */
-static int scan_disk (ntfs_volume *vol)
-{
- s64 nr_mft_records;
- const int BUFSIZE = 8192;
- char *buffer = NULL;
- int results = 0;
- ntfs_attr *attr;
- long long size;
- long long bmpsize;
- int i, j, k, b;
- int percent;
- struct ufile *file;
- regex_t re;
-
- if (!vol)
- return -1;
-
- attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0);
- if (!attr) {
- Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno));
- return -1;
- }
- bmpsize = attr->initialized_size;
-
- buffer = malloc (BUFSIZE);
- if (!buffer) {
- Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n");
- results = -1;
- goto out;
- }
-
- if (opts.match) {
- int flags = REG_NOSUB;
-
- if (!opts.match_case)
- flags |= REG_ICASE;
- if (regcomp (&re, opts.match, flags)) {
- Eprintf ("ERROR: Couldn't create a regex.\n");
- goto out;
- }
- }
-
- nr_mft_records = vol->mft_na->initialized_size >>
- vol->mft_record_size_bits;
-
- Qprintf ("Inode Flags %%age Date Size Filename\n");
- Qprintf ("---------------------------------------------------------------\n");
- for (i = 0; i < bmpsize; i += BUFSIZE) {
- long long read_count = min ((bmpsize - i), BUFSIZE);
- size = ntfs_attr_pread (attr, i, read_count, buffer);
- if (size < 0)
- break;
-
- for (j = 0; j < size; j++) {
- b = buffer[j];
- for (k = 0; k < 8; k++, b>>=1) {
- if (((i+j)*8+k) >= nr_mft_records)
- goto done;
- if (b & 1)
- continue;
- file = read_record (vol, (i+j)*8+k);
- if (!file) {
- Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k);
- continue;
- }
-
- if ((opts.since > 0) && (file->date <= opts.since))
- goto skip;
- if (opts.match && !name_match (&re, file))
- goto skip;
- if (opts.size_begin && (opts.size_begin > file->max_size))
- goto skip;
- if (opts.size_end && (opts.size_end < file->max_size))
- goto skip;
-
- percent = calc_percentage (file, vol);
- if ((opts.percent == -1) || (percent >= opts.percent)) {
- if (opts.verbose)
- dump_record (file);
- else
- list_record (file);
-
- /* Was -u specified with no inode
- so undelete file by regex */
- if (opts.mode == MODE_UNDELETE) {
- if (!undelete_file (vol, file->inode))
- Vprintf ("ERROR: Failed to undelete "
- "inode %lli\n!",
- file->inode);
- printf ("\n");
- }
- }
- if (((opts.percent == -1) && (percent > 0)) ||
- ((opts.percent > 0) && (percent >= opts.percent))) {
- results++;
- }
-skip:
- free_file (file);
- }
- }
- }
-done:
- Qprintf ("\nFiles with potentially recoverable content: %d\n", results);
-out:
- if (opts.match)
- regfree (&re);
- free (buffer);
- if (attr)
- ntfs_attr_close (attr);
- return results;
-}
-
-/**
* undelete_file - Recover a deleted file from an NTFS volume
* @vol: An ntfs volume obtained from ntfs_mount
* @inode: MFT Record number to be recovered
@@ -1941,6 +1813,130 @@ free:
}
/**
+ * scan_disk - Search an NTFS volume for files that could be undeleted
+ * @vol: An ntfs volume obtained from ntfs_mount
+ *
+ * Read through all the MFT entries looking for deleted files. For each one
+ * determine how much of the data lies in unused disk space.
+ *
+ * The list can be filtered by name, size and date, using command line options.
+ *
+ * Return: -1 Error, something went wrong
+ * n Success, the number of recoverable files
+ */
+static int scan_disk (ntfs_volume *vol)
+{
+ s64 nr_mft_records;
+ const int BUFSIZE = 8192;
+ char *buffer = NULL;
+ int results = 0;
+ ntfs_attr *attr;
+ long long size;
+ long long bmpsize;
+ int i, j, k, b;
+ int percent;
+ struct ufile *file;
+ regex_t re;
+
+ if (!vol)
+ return -1;
+
+ attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0);
+ if (!attr) {
+ Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno));
+ return -1;
+ }
+ bmpsize = attr->initialized_size;
+
+ buffer = malloc (BUFSIZE);
+ if (!buffer) {
+ Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n");
+ results = -1;
+ goto out;
+ }
+
+ if (opts.match) {
+ int flags = REG_NOSUB;
+
+ if (!opts.match_case)
+ flags |= REG_ICASE;
+ if (regcomp (&re, opts.match, flags)) {
+ Eprintf ("ERROR: Couldn't create a regex.\n");
+ goto out;
+ }
+ }
+
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+
+ Qprintf ("Inode Flags %%age Date Size Filename\n");
+ Qprintf ("---------------------------------------------------------------\n");
+ for (i = 0; i < bmpsize; i += BUFSIZE) {
+ long long read_count = min ((bmpsize - i), BUFSIZE);
+ size = ntfs_attr_pread (attr, i, read_count, buffer);
+ if (size < 0)
+ break;
+
+ for (j = 0; j < size; j++) {
+ b = buffer[j];
+ for (k = 0; k < 8; k++, b>>=1) {
+ if (((i+j)*8+k) >= nr_mft_records)
+ goto done;
+ if (b & 1)
+ continue;
+ file = read_record (vol, (i+j)*8+k);
+ if (!file) {
+ Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k);
+ continue;
+ }
+
+ if ((opts.since > 0) && (file->date <= opts.since))
+ goto skip;
+ if (opts.match && !name_match (&re, file))
+ goto skip;
+ if (opts.size_begin && (opts.size_begin > file->max_size))
+ goto skip;
+ if (opts.size_end && (opts.size_end < file->max_size))
+ goto skip;
+
+ percent = calc_percentage (file, vol);
+ if ((opts.percent == -1) || (percent >= opts.percent)) {
+ if (opts.verbose)
+ dump_record (file);
+ else
+ list_record (file);
+
+ /* Was -u specified with no inode
+ so undelete file by regex */
+ if (opts.mode == MODE_UNDELETE) {
+ if (!undelete_file (vol, file->inode))
+ Vprintf ("ERROR: Failed to undelete "
+ "inode %lli\n!",
+ file->inode);
+ printf ("\n");
+ }
+ }
+ if (((opts.percent == -1) && (percent > 0)) ||
+ ((opts.percent > 0) && (percent >= opts.percent))) {
+ results++;
+ }
+skip:
+ free_file (file);
+ }
+ }
+ }
+done:
+ Qprintf ("\nFiles with potentially recoverable content: %d\n", results);
+out:
+ if (opts.match)
+ regfree (&re);
+ free (buffer);
+ if (attr)
+ ntfs_attr_close (attr);
+ return results;
+}
+
+/**
* copy_mft - Write a range of MFT Records to a file
* @vol: An ntfs volume obtained from ntfs_mount
* @mft_begin: First MFT Record to save
Index: ntfsundelete.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsundelete.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- ntfsundelete.h 6 Jul 2005 22:47:20 -0000 1.12
+++ ntfsundelete.h 21 Oct 2005 18:05:14 -0000 1.13
@@ -102,7 +102,7 @@ struct ufile {
struct list_head name; /* A list of filenames */
struct list_head data; /* A list of data streams */
char *pref_name; /* Preferred filename */
- char *pref_pname; /* parent filename */
+ char *pref_pname; /* parent filename */
long long max_size; /* Largest size we find */
int attr_list; /* MFT record may be one of many */
int directory; /* MFT record represents a directory */
Index: sd.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/sd.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- sd.c 20 Oct 2005 13:49:56 -0000 1.9
+++ sd.c 21 Oct 2005 18:05:14 -0000 1.10
@@ -1,5 +1,6 @@
#include "types.h"
#include "layout.h"
+#include "sd.h"
/**
* init_system_file_sd
@@ -27,7 +28,6 @@
* Do NOT free *@sd_val as it is static memory. This also means that you can
* only use *@sd_val until the next call to this function.
*/
-void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len);
[...2092 lines suppressed...]
+ sid->sub_authority[1] =
+ cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+
+ //group sid
+ sid = (SID*)((char*)sd + le32_to_cpu(sd->group));
+ sid->revision = 0x01;
+ sid->sub_authority_count = 0x01;
+ // SECURITY_NT_SID_AUTHORITY (S-1-5)
+ sid->identifier_authority.value[0] = 0;
+ sid->identifier_authority.value[1] = 0;
+ sid->identifier_authority.value[2] = 0;
+ sid->identifier_authority.value[3] = 0;
+ sid->identifier_authority.value[4] = 0;
+ sid->identifier_authority.value[5] = 5;
+ sid->sub_authority[0] =
+ cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+
+ return;
+}
Index: upcase.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/upcase.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- upcase.c 28 Sep 2005 13:47:48 -0000 1.9
+++ upcase.c 21 Oct 2005 18:05:14 -0000 1.10
@@ -29,11 +29,11 @@
#endif
#include "types.h"
+#include "upcase.h"
/**
* init_upcase_table
*/
-void init_upcase_table(ntfschar *uc, u32 uc_len);
void init_upcase_table(ntfschar *uc, u32 uc_len)
{
static int uc_run_table[][3] = { /* Start, End, Add */
Index: utils.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/utils.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -p -r1.52 -r1.53
--- utils.c 16 Oct 2005 23:33:04 -0000 1.52
+++ utils.c 21 Oct 2005 18:05:14 -0000 1.53
@@ -50,7 +50,7 @@
#include <locale.h>
#endif
#ifdef HAVE_LIBINTL_H
-# include <libintl.h>
+#include <libintl.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -69,6 +69,7 @@
#include "debug.h"
#include "dir.h"
#include "version.h"
+#include "logging.h"
const char *ntfs_bugs = "Developers' email address: lin...@li...\n";
const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n";
@@ -89,10 +90,10 @@ int utils_set_locale (void)
locale = setlocale (LC_ALL, "");
if (!locale) {
locale = setlocale (LC_ALL, NULL);
- Eprintf ("Failed to set locale, using default '%s'.\n", locale);
+ ntfs_log_error ("Failed to set locale, using default '%s'.\n", locale);
return 1;
} else {
- Vprintf ("Using locale '%s'.\n", locale);
+ ntfs_log_verbose ("Using locale '%s'.\n", locale);
return 0;
}
}
@@ -125,37 +126,37 @@ int utils_valid_device (const char *name
if (stat (name, &st) == -1) {
if (errno == ENOENT) {
- Eprintf ("The device %s doesn't exist\n", name);
+ ntfs_log_error ("The device %s doesn't exist\n", name);
} else {
- Eprintf ("Error getting information about %s: %s\n", name, strerror (errno));
+ ntfs_log_error ("Error getting information about %s: %s\n", name, strerror (errno));
}
return 0;
}
if (!S_ISBLK (st.st_mode)) {
- Vprintf ("%s is not a block device.\n", name);
+ ntfs_log_verbose ("%s is not a block device.\n", name);
if (!force) {
- Eprintf ("Use the force option to work with files.\n");
+ ntfs_log_error ("Use the force option to work with files.\n");
return 0;
}
- Vprintf ("Forced to continue.\n");
+ ntfs_log_verbose ("Forced to continue.\n");
}
/* Make sure the file system is not mounted. */
if (ntfs_check_if_mounted (name, &mnt_flags)) {
- Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno));
+ ntfs_log_verbose ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno));
if (!force) {
- Eprintf ("Use the force option to ignore this error.\n");
+ ntfs_log_error ("Use the force option to ignore this error.\n");
return 0;
}
- Vprintf ("Forced to continue.\n");
+ ntfs_log_verbose ("Forced to continue.\n");
} else if (mnt_flags & NTFS_MF_MOUNTED) {
- Vprintf ("The device %s, is mounted.\n", name);
+ ntfs_log_verbose ("The device %s, is mounted.\n", name);
if (!force) {
- Eprintf ("Use the force option to work a mounted filesystem.\n");
+ ntfs_log_error ("Use the force option to work a mounted filesystem.\n");
return 0;
}
- Vprintf ("Forced to continue.\n");
+ ntfs_log_verbose ("Forced to continue.\n");
}
return 1;
@@ -181,27 +182,27 @@ ntfs_volume * utils_mount_volume (const
int err;
err = errno;
- Eprintf("Couldn't mount device '%s': %s\n", device,
+ ntfs_log_error("Couldn't mount device '%s': %s\n", device,
strerror(err));
if (err == EPERM)
- Eprintf("Windows was hibernated. Try to mount volume "
+ ntfs_log_error("Windows was hibernated. Try to mount volume "
"in windows, shut down and try "
"again.\n");
if (err == EOPNOTSUPP)
- Eprintf("Windows did not shut down properly. Try to "
+ ntfs_log_error("Windows did not shut down properly. Try to "
"mount volume in windows, shut down "
"and try again.\n");
return NULL;
}
if (vol->flags & VOLUME_IS_DIRTY) {
- Qprintf ("Volume is dirty.\n");
+ ntfs_log_quiet ("Volume is dirty.\n");
if (!force) {
- Eprintf ("Run chkdsk and try again, or use the --force option.\n");
+ ntfs_log_error ("Run chkdsk and try again, or use the --force option.\n");
ntfs_umount (vol, FALSE);
return NULL;
}
- Qprintf ("Forced to continue.\n");
+ ntfs_log_quiet ("Forced to continue.\n");
}
return vol;
@@ -241,16 +242,16 @@ int utils_parse_size (const char *value,
return 0;
}
- Dprintf ("Parsing size '%s'.\n", value);
+ ntfs_log_debug ("Parsing size '%s'.\n", value);
result = strtoll (value, &suffix, 10);
if (result < 0 || errno == ERANGE) {
- Eprintf ("Invalid size '%s'.\n", value);
+ ntfs_log_error ("Invalid size '%s'.\n", value);
return 0;
}
if (!suffix) {
- Eprintf ("Internal error, strtoll didn't return a suffix.\n");
+ ntfs_log_error ("Internal error, strtoll didn't return a suffix.\n");
return 0;
}
@@ -263,17 +264,17 @@ int utils_parse_size (const char *value,
case '-': case 0:
break;
default:
- Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix);
+ ntfs_log_error ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix);
return 0;
}
} else {
if ((suffix[0] != '-') && (suffix[0] != 0)) {
- Eprintf ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value);
+ ntfs_log_error ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value);
return 0;
}
}
- Dprintf ("Parsed size = %lld.\n", result);
+ ntfs_log_debug ("Parsed size = %lld.\n", result);
*size = result;
return 1;
}
@@ -303,7 +304,7 @@ int utils_parse_range (const char *strin
middle = strchr (string, '-');
if (string == middle) {
- Dprintf ("Range has no beginning, defaulting to 0.\n");
+ ntfs_log_debug ("Range has no beginning, defaulting to 0.\n");
a = 0;
} else {
if (!utils_parse_size (string, &a, scale))
@@ -313,7 +314,7 @@ int utils_parse_range (const char *strin
if (middle) {
if (middle[1] == 0) {
b = LONG_MAX; // XXX ULLONG_MAX
- Dprintf ("Range has no end, defaulting to %lld.\n", b);
+ ntfs_log_debug ("Range has no end, defaulting to %lld.\n", b);
} else {
if (!utils_parse_size (middle+1, &b, scale))
return 0;
@@ -322,7 +323,7 @@ int utils_parse_range (const char *strin
b = a;
}
- Dprintf ("Range '%s' = %lld - %lld\n", string, a, b);
+ ntfs_log_debug ("Range '%s' = %lld - %lld\n", string, a, b);
*start = a;
*finish = b;
@@ -352,11 +353,11 @@ ATTR_RECORD * find_attribute (const ATTR
}
if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) {
- Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type);
+ ntfs_log_debug ("find_attribute didn't find an attribute of type: 0x%02x.\n", type);
return NULL; /* None / no more of that type */
}
- Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type);
+ ntfs_log_debug ("find_attribute found an attribute of type: 0x%02x.\n", type);
return ctx->attr;
}
@@ -386,16 +387,16 @@ ATTR_RECORD * find_first_attribute (cons
ctx = ntfs_attr_get_search_ctx (NULL, mft);
if (!ctx) {
- Eprintf ("Couldn't create a search context.\n");
+ ntfs_log_error ("Couldn't create a search context.\n");
return NULL;
}
rec = find_attribute (type, ctx);
ntfs_attr_put_search_ctx (ctx);
if (rec)
- Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type);
+ ntfs_log_debug ("find_first_attribute: found attr of type 0x%02x.\n", type);
else
- Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type);
+ ntfs_log_debug ("find_first_attribute: didn't find attr of type 0x%02x.\n", type);
return rec;
}
@@ -432,18 +433,18 @@ int utils_inode_get_name (ntfs_inode *in
vol = inode->vol;
- //printf ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names));
+ //ntfs_log_debug ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names));
memset (names, 0, sizeof (names));
for (i = 0; i < max_path; i++) {
ctx = ntfs_attr_get_search_ctx (inode, NULL);
if (!ctx) {
- Eprintf ("Couldn't create a search context.\n");
+ ntfs_log_error ("Couldn't create a search context.\n");
return 0;
}
- //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no);
+ //ntfs_log_debug ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no);
name_space = 4;
while ((rec = find_attribute (AT_FILE_NAME, ctx))) {
@@ -465,7 +466,7 @@ int utils_inode_get_name (ntfs_inode *in
if (ntfs_ucstombs (attr->file_name, attr->file_name_length,
&names[i], 0) < 0) {
char *temp;
- Eprintf ("Couldn't translate filename to current locale.\n");
+ ntfs_log_error ("Couldn't translate filename to current locale.\n");
temp = malloc (30);
if (!temp)
return 0;
@@ -474,8 +475,8 @@ int utils_inode_get_name (ntfs_inode *in
names[i] = temp;
}
- //printf ("names[%d] %s\n", i, names[i]);
- //printf ("parent = %lld\n", MREF (parent));
+ //ntfs_log_debug ("names[%d] %s\n", i, names[i]);
+ //ntfs_log_debug ("parent = %lld\n", MREF (parent));
}
ntfs_attr_put_search_ctx(ctx);
@@ -484,13 +485,13 @@ int utils_inode_get_name (ntfs_inode *in
ntfs_inode_close (inode);
if (MREF (parent) == FILE_root) { /* The root directory, stop. */
- //printf ("inode 5\n");
+ //ntfs_log_debug ("inode 5\n");
break;
}
inode = ntfs_inode_open (vol, parent);
if (!inode) {
- Eprintf ("Couldn't open inode %llu.\n",
+ ntfs_log_error ("Couldn't open inode %llu.\n",
(unsigned long long)MREF(parent));
break;
}
@@ -498,7 +499,7 @@ int utils_inode_get_name (ntfs_inode *in
if (i >= max_path) {
/* If we get into an infinite loop, we'll end up here. */
- Eprintf ("The directory structure is too deep (over %d) nested directories.\n", max_path);
+ ntfs_log_error ("The directory structure is too deep (over %d) nested directories.\n", max_path);
return 0;
}
@@ -509,7 +510,7 @@ int utils_inode_get_name (ntfs_inode *in
len = snprintf (buffer + offset, bufsize - offset, "%c%s", PATH_SEP, names[i]);
if (len >= (bufsize - offset)) {
- Eprintf ("Pathname was truncated.\n");
+ ntfs_log_error ("Pathname was truncated.\n");
break;
}
@@ -520,7 +521,7 @@ int utils_inode_get_name (ntfs_inode *in
for (i = 0; i < max_path; i++)
free (names[i]);
- Dprintf ("Pathname: %s\n", buffer);
+ ntfs_log_debug ("Pathname: %s\n", buffer);
return 0;
}
@@ -545,18 +546,18 @@ int utils_attr_get_name (ntfs_volume *vo
name = NULL;
namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name));
if (ntfs_ucstombs (attrdef->name, namelen, &name, 0) < 0) {
- Eprintf ("Couldn't translate attribute type to current locale.\n");
+ ntfs_log_error ("Couldn't translate attribute type to current locale.\n");
// <UNKNOWN>?
return 0;
}
len = snprintf (buffer, bufsize, "%s", name);
} else {
- Eprintf ("Unknown attribute type 0x%02x\n", attr->type);
+ ntfs_log_error ("Unknown attribute type 0x%02x\n", attr->type);
len = snprintf (buffer, bufsize, "<UNKNOWN>");
}
if (len >= bufsize) {
- Eprintf ("Attribute type was truncated.\n");
+ ntfs_log_error ("Attribute type was truncated.\n");
return 0;
}
@@ -571,7 +572,7 @@ int utils_attr_get_name (ntfs_volume *vo
namelen = attr->name_length;
if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset),
namelen, &name, 0) < 0) {
- Eprintf ("Couldn't translate attribute name to current locale.\n");
+ ntfs_log_error ("Couldn't translate attribute name to current locale.\n");
// <UNKNOWN>?
len = snprintf (buffer, bufsize, "<UNKNOWN>");
return 0;
@@ -581,7 +582,7 @@ int utils_attr_get_name (ntfs_volume *vo
free (name);
if (len >= bufsize) {
- Eprintf ("Attribute name was truncated.\n");
+ ntfs_log_error ("Attribute name was truncated.\n");
return 0;
}
@@ -620,10 +621,10 @@ int utils_cluster_in_use (ntfs_volume *v
/* Does lcn lie in the section of $Bitmap we already have cached? */
if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) {
- Dprintf ("Bit lies outside cache.\n");
+ ntfs_log_debug ("Bit lies outside cache.\n");
attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0);
if (!attr) {
- Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno));
+ ntfs_log_error ("Couldn't open $Bitmap: %s\n", strerror (errno));
return -1;
}
@@ -632,19 +633,18 @@ int utils_cluster_in_use (ntfs_volume *v
bmplcn = lcn & (~((sizeof (buffer) << 3) - 1));
if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) {
- Eprintf ("Couldn't read $Bitmap: %s\n", strerror (errno));
+ ntfs_log_error ("Couldn't read $Bitmap: %s\n", strerror (errno));
ntfs_attr_close (attr);
return -1;
}
- Dprintf ("Reloaded bitmap buffer.\n");
+ ntfs_log_debug ("Reloaded bitmap buffer.\n");
ntfs_attr_close (attr);
}
bit = 1 << (lcn & 7);
byte = (lcn >> 3) & (sizeof (buffer) - 1);
- Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n",
- lcn, bmplcn, byte, bit, buffer[byte] & bit);
+ ntfs_log_debug ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", lcn, bmplcn, byte, bit, buffer[byte] & bit);
return (buffer[byte] & bit);
}
@@ -681,24 +681,23 @@ int utils_mftrec_in_use (ntfs_volume *vo
/* Does mref lie in the section of $Bitmap we already have cached? */
if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref +
(sizeof (buffer) << 3)))) {
- Dprintf ("Bit lies outside cache.\n");
+ ntfs_log_debug ("Bit lies outside cache.\n");
/* Mark the buffer as not in use, in case the read is shorter. */
memset (buffer, 0, sizeof (buffer));
bmpmref = mref & (~((sizeof (buffer) << 3) - 1));
if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) {
- Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno));
+ ntfs_log_error ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno));
return -1;
}
- Dprintf ("Reloaded bitmap buffer.\n");
+ ntfs_log_debug ("Reloaded bitmap buffer.\n");
}
bit = 1 << (mref & 7);
byte = (mref >> 3) & (sizeof (buffer) - 1);
- Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n",
- mref, bmpmref, byte, bit, buffer[byte] & bit);
+ ntfs_log_debug ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit);
return (buffer[byte] & bit);
}
@@ -804,38 +803,38 @@ void utils_dump_mem (void *buf, int star
if (flags & DM_BLUE)
col += 4;
if (flags & DM_INDENT)
- printf ("\t");
+ ntfs_log_debug ("\t");
if (flags & DM_BOLD)
- printf ("\e[01m");
+ ntfs_log_debug ("\e[01m");
if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD))
- printf ("\e[%dm", col);
+ ntfs_log_debug ("\e[%dm", col);
if (off == s)
- printf("%6.6x ", start);
+ ntfs_log_debug("%6.6x ", start);
else
- printf("%6.6x ", off);
+ ntfs_log_debug("%6.6x ", off);
for (i = 0; i < 16; i++) {
if ((i == 8) && (!(flags & DM_NO_DIVIDER)))
- printf (" -");
+ ntfs_log_debug (" -");
if (((off+i) >= start) && ((off+i) < (start+length)))
- printf (" %02X", mem[off+i]);
+ ntfs_log_debug (" %02X", mem[off+i]);
else
- printf (" ");
+ ntfs_log_debug (" ");
}
if (!(flags & DM_NO_ASCII)) {
- printf (" ");
+ ntfs_log_debug (" ");
for (i = 0; i < 16; i++) {
if (((off+i) < start) || ((off+i) >= (start+length)))
- printf (" ");
+ ntfs_log_debug (" ");
else if (isprint (mem[off + i]))
- printf ("%c", mem[off + i]);
+ ntfs_log_debug ("%c", mem[off + i]);
else
- printf (".");
+ ntfs_log_debug (".");
}
}
if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD))
- printf ("\e[0m");
- printf ("\n");
+ ntfs_log_debug ("\e[0m");
+ ntfs_log_debug ("\n");
}
}
@@ -902,7 +901,7 @@ int mft_next_record (struct mft_search_c
ctx->flags_match = 0;
in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num);
if (in_use == -1) {
- Eprintf ("Error reading inode %llu. Aborting.\n",
+ ntfs_log_error ("Error reading inode %llu. Aborting.\n",
(unsigned long long)ctx->mft_num);
return -1;
}
@@ -912,7 +911,7 @@ int mft_next_record (struct mft_search_c
ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num);
if (ctx->inode == NULL) {
- Eprintf ("Error reading inode %llu.\n", (unsigned
+ ntfs_log_error ("Error reading inode %llu.\n", (unsigned
long long) ctx->mft_num);
continue;
}
@@ -940,7 +939,7 @@ int mft_next_record (struct mft_search_c
ntfs_attr_put_search_ctx (attr_ctx);
} else {
- Eprintf ("Couldn't create a search context.\n");
+ ntfs_log_error ("Couldn't create a search context.\n");
return -1;
}
}
@@ -950,7 +949,7 @@ int mft_next_record (struct mft_search_c
case 0: ctx->flags_match |= FEMR_NOT_METADATA; break;
default:
ctx->flags_match |= FEMR_NOT_METADATA; break;
- //Eprintf ("Error reading inode %lld.\n", ctx->mft_num);
+ //ntfs_log_error ("Error reading inode %lld.\n", ctx->mft_num);
//return -1;
}
@@ -961,7 +960,7 @@ int mft_next_record (struct mft_search_c
ctx->inode = calloc (1, sizeof (*ctx->inode));
if (!ctx->inode) {
- Eprintf ("Out of memory. Aborting.\n");
+ ntfs_log_error ("Out of memory. Aborting.\n");
return -1;
}
@@ -970,20 +969,20 @@ int mft_next_record (struct mft_search_c
ctx->inode->mrec = malloc (ctx->vol->mft_record_size);
if (!ctx->inode->mrec) {
free (ctx->inode); // == ntfs_inode_close
- Eprintf ("Out of memory. Aborting.\n");
+ ntfs_log_error ("Out of memory. Aborting.\n");
return -1;
}
mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA,
AT_UNNAMED, 0);
if (!mft) {
- Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno));
+ ntfs_log_error ("Couldn't open $MFT/$DATA: %s\n", strerror (errno));
// free / close
return -1;
}
if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) {
- Eprintf ("Couldn't read MFT Record %llu: %s.\n",
+ ntfs_log_error ("Couldn't read MFT Record %llu: %s.\n",
(unsigned long long)
ctx->mft_num, strerror (errno));
// free / close
@@ -999,7 +998,7 @@ int mft_next_record (struct mft_search_c
}
if (ntfs_inode_close (ctx->inode)) {
- Eprintf ("Error closing inode %llu.\n",
+ ntfs_log_error ("Error closing inode %llu.\n",
(unsigned long long)ctx->mft_num);
return -errno;
}
Index: utils.h
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/utils.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- utils.h 17 Oct 2005 14:07:28 -0000 1.28
+++ utils.h 21 Oct 2005 18:05:14 -0000 1.29
@@ -31...
[truncated message content] |