Adapted to ntfs-3g.1.5130

N2009_11_14_FIXES
jpandre 2008-12-01 15:29:23 +00:00
parent c4c3c8f90f
commit 6faf38df12
6 changed files with 15 additions and 65 deletions

View File

@ -86,7 +86,6 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define NTFS_LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */
#define NTFS_LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */
#define NTFS_LOG_FLAG_ONLYNAME (1 << 4) /* Only display the filename, not the pathname */
#define NTFS_LOG_FLAG_COLOUR (1 << 5) /* Colour highlight some messages */
/* Macros to simplify logging. One for each level defined above.
* Note, ntfs_log_debug/trace have effect only if DEBUG is defined.

View File

@ -920,8 +920,9 @@ retry:
total += br;
count -= br;
b = (u8*)b + br;
continue;
}
if (br == to_read)
continue;
/* If the syscall was interrupted, try again. */
if (br == (s64)-1 && errno == EINTR)
goto retry;
@ -2112,7 +2113,7 @@ is_enumeration:
if (MSEQNO_LE(al_entry->mft_reference) !=
le16_to_cpu(
ni->mrec->sequence_number)) {
ntfs_log_debug("Found stale mft reference in "
ntfs_log_error("Found stale mft reference in "
"attribute list!\n");
break;
}
@ -2198,8 +2199,8 @@ do_next_attr:
ctx->mrec = ctx->base_mrec;
ctx->attr = ctx->base_attr;
}
ntfs_log_debug("Inode is corrupt.\n");
errno = EIO;
ntfs_log_perror("Inode is corrupt (%lld)", (unsigned long long)ni->mft_no);
return -1;
not_found:
/*

View File

@ -50,14 +50,6 @@
#define PATH_SEP '/'
#endif
/* Colour prefixes and a suffix */
static const char *col_green = "\e[32m";
static const char *col_cyan = "\e[36m";
static const char *col_yellow = "\e[01;33m";
static const char *col_red = "\e[01;31m";
static const char *col_redinv = "\e[01;07;31m";
static const char *col_end = "\e[0m";
#ifdef DEBUG
static int tab;
#endif
@ -426,8 +418,6 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
int ret = 0;
int olderr = errno;
FILE *stream;
const char *col_prefix = NULL;
const char *col_suffix = NULL;
if (!data) /* Interpret data as a FILE stream. */
return 0; /* If it's NULL, we can't do anything. */
@ -439,41 +429,10 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
tab--;
return 0;
}
#endif
if (ntfs_log.flags & NTFS_LOG_FLAG_COLOUR) {
/* Pick a colour determined by the log level */
switch (level) {
case NTFS_LOG_LEVEL_DEBUG:
col_prefix = col_green;
col_suffix = col_end;
break;
case NTFS_LOG_LEVEL_TRACE:
col_prefix = col_cyan;
col_suffix = col_end;
break;
case NTFS_LOG_LEVEL_WARNING:
col_prefix = col_yellow;
col_suffix = col_end;
break;
case NTFS_LOG_LEVEL_ERROR:
case NTFS_LOG_LEVEL_PERROR:
col_prefix = col_red;
col_suffix = col_end;
break;
case NTFS_LOG_LEVEL_CRITICAL:
col_prefix = col_redinv;
col_suffix = col_end;
break;
}
}
#ifdef DEBUG
for (i = 0; i < tab; i++)
ret += fprintf(stream, " ");
#endif
if (col_prefix)
ret += fprintf(stream, col_prefix);
if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) &&
(strchr(file, PATH_SEP))) /* Abbreviate the filename */
file = strrchr(file, PATH_SEP) + 1;
@ -496,9 +455,6 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
if (level & NTFS_LOG_LEVEL_PERROR)
ret += fprintf(stream, ": %s\n", strerror(olderr));
if (col_suffix)
ret += fprintf(stream, col_suffix);
#ifdef DEBUG
if (level == NTFS_LOG_LEVEL_ENTER)
tab++;
@ -649,10 +605,6 @@ BOOL ntfs_log_parse_option(const char *option)
} else if (strcmp(option, "--log-trace") == 0) {
ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE);
return TRUE;
} else if ((strcmp(option, "--log-colour") == 0) ||
(strcmp(option, "--log-color") == 0)) {
ntfs_log_set_flags(NTFS_LOG_FLAG_COLOUR);
return TRUE;
}
ntfs_log_debug("Unknown logging option '%s'\n", option);

View File

@ -612,7 +612,7 @@ leave:
return ret;
}
int ntfs_mft_attr_extend(ntfs_volume *vol, ntfs_attr *na)
static int ntfs_mft_attr_extend(ntfs_attr *na)
{
int ret = STATUS_ERROR;
ntfs_log_enter("Entering\n");
@ -732,7 +732,7 @@ static int ntfs_mft_bitmap_extend_allocation_i(ntfs_volume *vol)
if (ntfs_attr_record_resize(m, a, mp_size +
le16_to_cpu(a->mapping_pairs_offset))) {
ntfs_log_info("extending $MFT bitmap\n");
ret = ntfs_mft_attr_extend(vol, vol->mftbmp_na);
ret = ntfs_mft_attr_extend(vol->mftbmp_na);
if (ret == STATUS_OK)
goto ok;
if (ret == STATUS_ERROR) {
@ -1080,7 +1080,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol)
old_alen = le32_to_cpu(a->length);
if (ntfs_attr_record_resize(m, a,
mp_size + le16_to_cpu(a->mapping_pairs_offset))) {
ret = ntfs_mft_attr_extend(vol, vol->mft_na);
ret = ntfs_mft_attr_extend(vol->mft_na);
if (ret == STATUS_OK)
goto ok;
if (ret == STATUS_ERROR) {
@ -1354,7 +1354,7 @@ undo_data_init:
goto out;
}
ntfs_inode *ntfs_mft_rec_alloc(ntfs_volume *vol)
static ntfs_inode *ntfs_mft_rec_alloc(ntfs_volume *vol)
{
s64 ll, bit;
ntfs_attr *mft_na, *mftbmp_na;
@ -1498,7 +1498,6 @@ undo_mftbmp_alloc:
err_out:
if (!errno)
errno = EIO;
err_exit:
ni = NULL;
goto out;
}

View File

@ -91,7 +91,6 @@
#include "layout.h"
#include "index.h"
#include "utils.h"
#include "version.h"
#include "ntfstime.h"
#include "security.h"
#include "reparse.h"
@ -175,13 +174,13 @@ static const char *usage_msg =
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2007-2008 Jean-Pierre Andre\n"
"\n"
"Usage: %s <device|image_file> <mount_point> [-o option[,...]]\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"
"\n"
"Options: ro (read-only mount), force, remove_hiberfile, locale=,\n"
" uid=, gid=, umask=, fmask=, dmask=, streams_interface=.\n"
" Please see the details in the manual.\n"
"\n"
"Example: ntfs-3g /dev/sda1 /mnt/win -o force\n"
"Examples: ntfs-3g -o force /dev/sda1 /mnt/windows\n"
"\n"
"%s";
@ -2776,7 +2775,7 @@ static void mknod_dev_fuse(const char *dev)
if (mknod(dev, S_IFCHR | 0666, makedev(10, 229))) {
ntfs_log_perror("Failed to create '%s'", dev);
if (errno == EPERM)
ntfs_log_error(dev_fuse_msg);
ntfs_log_error("%s", dev_fuse_msg);
}
umask(mask);
}
@ -3109,7 +3108,7 @@ int main(int argc, char *argv[])
#if defined(linux) || defined(__uClinux__)
if (S_ISBLK(sbuf.st_mode) && (fstype == FSTYPE_FUSE))
ntfs_log_info(fuse26_kmod_msg);
ntfs_log_info("%s", fuse26_kmod_msg);
#endif
setup_logging(parsed_options);
if (failed_secure)

View File

@ -66,7 +66,7 @@ static const char *hibernated_volume_msg =
"mount the volume read-write with the 'remove_hiberfile' mount option.\n"
"For example type on the command line:\n"
"\n"
" mount -t ntfs-3g %s %s -o remove_hiberfile\n"
" mount -t ntfs-3g -o remove_hiberfile %s %s\n"
"\n";
static const char *unclean_journal_msg =
@ -97,7 +97,7 @@ static const char *access_denied_msg =
static const char *forced_mount_msg =
"\n"
" mount -t ntfs-3g %s %s -o force\n"
" mount -t ntfs-3g -o force %s %s\n"
"\n"
" Or add the option to the relevant row in the /etc/fstab file:\n"
"\n"
@ -133,7 +133,7 @@ void utils_mount_error(const char *volume, const char *mntpoint, int err)
ntfs_log_error(hibernated_volume_msg, volume, mntpoint);
break;
case NTFS_VOLUME_UNCLEAN_UNMOUNT:
ntfs_log_error(unclean_journal_msg);
ntfs_log_error("%s", unclean_journal_msg);
ntfs_log_error(forced_mount_msg, volume, mntpoint,
volume, mntpoint);
break;