Hello community,
here is the log from the commit of package ntfs-3g for openSUSE:Factory
checked in at Wed Apr 1 18:30:16 CEST 2009.
--------
--- ntfs-3g/ntfs-3g.changes 2009-02-12 02:34:33.000000000 +0100
+++ ntfs-3g/ntfs-3g.changes 2009-03-27 11:17:01.000000000 +0100
@@ -1,0 +2,29 @@
+Fri Mar 27 11:04:42 CET 2009 - vuntz@novell.com
+
+- Update to version 2009.3.8:
+ + Fix: Some defragmenters reported NTFS-3G created directories
+ unmovable.
+ + Fix: The Windows NTFS file system checker, CHKDSK, may reported
+ "free space marked as allocated in the master file table (MFT)
+ bitmap".
+ + Fix: The driver may returned "No space left on device" error
+ when there was still free space on the NTFS volume.
+ + Fix: A file may got corrupted when the STANDARD INFORMATION
+ attribute was moved to an extent MFT record. Only the already
+ fixed Advanced NTFS-3G Driver had this problem, not the Stable
+ NTFS-3G Driver.
+ + Change: 10-50% faster file and directory creation, removal,
+ copy, unpackaging performance.
+ + Change: 500-1000% faster mount time. This is mostly noticable
+ on multi-TB volumes and embedded devices. Please note, a
+ generally 10-20 times faster performing NTFS-3G driver is
+ available for embedded devices separately.
+ + Change: Improved multi-cluster allocation, non-aligned file
+ write performance.
+ + Change: Improved volume consistency and recovery if the storage
+ device was unsafely detached or powered down.
+ + Change: Less disk space usage.
+ + New: The version/-V command line option has been added.
+- Use makeinstall
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
ntfs-3g-2009.2.1.tar.bz2
New:
----
ntfs-3g-2009.3.8.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ntfs-3g.spec ++++++
--- /var/tmp/diff_new_pack.h19685/_old 2009-04-01 18:29:13.000000000 +0200
+++ /var/tmp/diff_new_pack.h19685/_new 2009-04-01 18:29:13.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package ntfs-3g (Version 2009.2.1)
+# spec file for package ntfs-3g (Version 2009.3.8)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,7 +19,7 @@
Name: ntfs-3g
Summary: Linux NTFS-3G userspace filesystem with full write support
-Version: 2009.2.1
+Version: 2009.3.8
Release: 1
Provides: ntfsprogs-fuse = 1.13.1
Obsoletes: ntfsprogs-fuse <= 1.13.1
@@ -123,7 +123,7 @@
make %{?jobs:-j%jobs}
%install
-make DESTDIR=$RPM_BUILD_ROOT install
+%makeinstall
# Move pkg-config to the real libdir
mkdir -p $RPM_BUILD_ROOT/%{_prefix}/%{_libdir}/pkgconfig
mv $RPM_BUILD_ROOT/%{_libdir}/pkgconfig/*.pc $RPM_BUILD_ROOT/%{_prefix}/%{_libdir}/pkgconfig/
@@ -173,6 +173,32 @@
/sbin/ldconfig
%changelog
+* Fri Mar 27 2009 vuntz@novell.com
+- Update to version 2009.3.8:
+ + Fix: Some defragmenters reported NTFS-3G created directories
+ unmovable.
+ + Fix: The Windows NTFS file system checker, CHKDSK, may reported
+ "free space marked as allocated in the master file table (MFT)
+ bitmap".
+ + Fix: The driver may returned "No space left on device" error
+ when there was still free space on the NTFS volume.
+ + Fix: A file may got corrupted when the STANDARD INFORMATION
+ attribute was moved to an extent MFT record. Only the already
+ fixed Advanced NTFS-3G Driver had this problem, not the Stable
+ NTFS-3G Driver.
+ + Change: 10-50%% faster file and directory creation, removal,
+ copy, unpackaging performance.
+ + Change: 500-1000%% faster mount time. This is mostly noticable
+ on multi-TB volumes and embedded devices. Please note, a
+ generally 10-20 times faster performing NTFS-3G driver is
+ available for embedded devices separately.
+ + Change: Improved multi-cluster allocation, non-aligned file
+ write performance.
+ + Change: Improved volume consistency and recovery if the storage
+ device was unsafely detached or powered down.
+ + Change: Less disk space usage.
+ + New: The version/-V command line option has been added.
+- Use makeinstall
* Thu Feb 12 2009 vuntz@novell.com
- Update to version 2009.2.1:
+ The 'recover' and 'norecover' mount options were introduced.
++++++ ntfs-3g-2009.2.1.tar.bz2 -> ntfs-3g-2009.3.8.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/configure new/ntfs-3g-2009.3.8/configure
--- old/ntfs-3g-2009.2.1/configure 2009-02-11 23:28:10.000000000 +0100
+++ new/ntfs-3g-2009.3.8/configure 2009-03-26 00:54:12.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for ntfs-3g 2009.2.1.
+# Generated by GNU Autoconf 2.61 for ntfs-3g 2009.3.8.
#
# Report bugs to .
#
@@ -728,8 +728,8 @@
# Identity of this package.
PACKAGE_NAME='ntfs-3g'
PACKAGE_TARNAME='ntfs-3g'
-PACKAGE_VERSION='2009.2.1'
-PACKAGE_STRING='ntfs-3g 2009.2.1'
+PACKAGE_VERSION='2009.3.8'
+PACKAGE_STRING='ntfs-3g 2009.3.8'
PACKAGE_BUGREPORT='ntfs-3g-devel@lists.sf.net'
ac_unique_file="src/ntfs-3g.c"
@@ -1433,7 +1433,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ntfs-3g 2009.2.1 to adapt to many kinds of systems.
+\`configure' configures ntfs-3g 2009.3.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1504,7 +1504,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ntfs-3g 2009.2.1:";;
+ short | recursive ) echo "Configuration of ntfs-3g 2009.3.8:";;
esac
cat <<\_ACEOF
@@ -1629,7 +1629,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ntfs-3g configure 2009.2.1
+ntfs-3g configure 2009.3.8
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1643,7 +1643,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ntfs-3g $as_me 2009.2.1, which was
+It was created by ntfs-3g $as_me 2009.3.8, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -1997,7 +1997,7 @@
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-LIBNTFS_3G_VERSION="49"
+LIBNTFS_3G_VERSION="52"
# Environment
@@ -23627,7 +23627,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ntfs-3g $as_me 2009.2.1, which was
+This file was extended by ntfs-3g $as_me 2009.3.8, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -23680,7 +23680,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-ntfs-3g config.status 2009.2.1
+ntfs-3g config.status 2009.3.8
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/configure.ac new/ntfs-3g-2009.3.8/configure.ac
--- old/ntfs-3g-2009.2.1/configure.ac 2009-02-11 22:41:49.000000000 +0100
+++ new/ntfs-3g-2009.3.8/configure.ac 2009-03-26 00:45:11.000000000 +0100
@@ -23,8 +23,8 @@
# Autoconf
AC_PREREQ(2.59)
-AC_INIT([ntfs-3g],[2009.2.1],[ntfs-3g-devel@lists.sf.net])
-LIBNTFS_3G_VERSION="49"
+AC_INIT([ntfs-3g],[2009.3.8],[ntfs-3g-devel@lists.sf.net])
+LIBNTFS_3G_VERSION="52"
AC_CONFIG_SRCDIR([src/ntfs-3g.c])
# Environment
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/include/fuse-lite/fuse_lowlevel.h new/ntfs-3g-2009.3.8/include/fuse-lite/fuse_lowlevel.h
--- old/ntfs-3g-2009.2.1/include/fuse-lite/fuse_lowlevel.h 2008-07-19 00:13:46.000000000 +0200
+++ new/ntfs-3g-2009.3.8/include/fuse-lite/fuse_lowlevel.h 2009-02-21 20:49:15.000000000 +0100
@@ -921,19 +921,6 @@
int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size);
/**
- * Reply with data vector
- *
- * Possible requests:
- * read, readdir, getxattr, listxattr
- *
- * @param req request handle
- * @param iov the vector containing the data
- * @param count the size of vector
- * @return zero for success, -errno for failure to send reply
- */
-int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
-
-/**
* Reply with filesystem statistics
*
* Possible requests:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/include/ntfs-3g/attrib.h new/ntfs-3g-2009.3.8/include/ntfs-3g/attrib.h
--- old/ntfs-3g-2009.2.1/include/ntfs-3g/attrib.h 2008-07-15 19:11:16.000000000 +0200
+++ new/ntfs-3g-2009.3.8/include/ntfs-3g/attrib.h 2009-02-27 00:41:32.000000000 +0100
@@ -92,6 +92,8 @@
const VCN lowest_vcn, const u8 *val, const u32 val_len,
ntfs_attr_search_ctx *ctx);
+extern int ntfs_attr_position(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx);
+
extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol,
const ATTR_TYPES type);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/include/ntfs-3g/mft.h new/ntfs-3g-2009.3.8/include/ntfs-3g/mft.h
--- old/ntfs-3g-2009.2.1/include/ntfs-3g/mft.h 2008-06-30 01:45:34.000000000 +0200
+++ new/ntfs-3g-2009.3.8/include/ntfs-3g/mft.h 2009-03-03 20:53:14.000000000 +0100
@@ -52,7 +52,7 @@
{
int ret;
- ntfs_log_enter("Entering for inode %lld\n", MREF(mref));
+ ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref));
ret = ntfs_mft_records_read(vol, mref, 1, b);
ntfs_log_leave("\n");
return ret;
@@ -87,7 +87,7 @@
{
int ret;
- ntfs_log_enter("Entering for inode %lld\n", MREF(mref));
+ ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref));
ret = ntfs_mft_records_write(vol, mref, 1, b);
ntfs_log_leave("\n");
return ret;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libfuse-lite/fuse_lowlevel.c new/ntfs-3g-2009.3.8/libfuse-lite/fuse_lowlevel.c
--- old/ntfs-3g-2009.2.1/libfuse-lite/fuse_lowlevel.c 2008-07-16 04:03:50.000000000 +0200
+++ new/ntfs-3g-2009.3.8/libfuse-lite/fuse_lowlevel.c 2009-02-21 20:49:15.000000000 +0100
@@ -189,24 +189,6 @@
return send_reply_iov(req, error, iov, count);
}
-int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count)
-{
- int res;
- struct iovec *padded_iov;
-
- padded_iov = malloc((count + 1) * sizeof(struct iovec));
- if (padded_iov == NULL)
- return fuse_reply_err(req, -ENOMEM);
-
- memcpy(padded_iov + 1, iov, count * sizeof(struct iovec));
- count++;
-
- res = send_reply_iov(req, 0, padded_iov, count);
- free(padded_iov);
-
- return res;
-}
-
size_t fuse_dirent_size(size_t namelen)
{
return FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + namelen);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/attrib.c new/ntfs-3g-2009.3.8/libntfs-3g/attrib.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/attrib.c 2009-02-10 22:56:48.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/attrib.c 2009-03-25 21:52:24.000000000 +0100
@@ -561,14 +561,14 @@
ntfs_attr_search_ctx *ctx;
ntfs_volume *vol = na->ni->vol;
ATTR_RECORD *a;
- int err;
+ int ret = -1;
- ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n",
- (unsigned long long)na->ni->mft_no, na->type);
+ ntfs_log_enter("Entering for inode %llu, attr 0x%x.\n",
+ (unsigned long long)na->ni->mft_no, na->type);
ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
if (!ctx)
- return -1;
+ goto out;
/* Map all attribute extents one by one. */
next_vcn = last_vcn = highest_vcn = 0;
@@ -639,17 +639,13 @@
(long long)highest_vcn, (long long)last_vcn);
goto err_out;
}
- err = errno;
+ if (errno == ENOENT)
+ ret = 0;
+err_out:
ntfs_attr_put_search_ctx(ctx);
- if (err == ENOENT)
- return 0;
-out_now:
- errno = err;
- return -1;
-err_out:
- err = errno;
- ntfs_attr_put_search_ctx(ctx);
- goto out_now;
+out:
+ ntfs_log_leave("\n");
+ return ret;
}
/**
@@ -909,8 +905,9 @@
to_read = min(count, (rl->length << vol->cluster_size_bits) -
ofs);
retry:
- ntfs_log_trace("Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, "
- "ofs 0x%llx.\n", to_read, rl->vcn, rl->lcn, ofs);
+ ntfs_log_trace("Reading %lld bytes from vcn %lld, lcn %lld, ofs"
+ " %lld.\n", (long long)to_read, (long long)rl->vcn,
+ (long long )rl->lcn, (long long)ofs);
br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) +
ofs, to_read, b);
/* If everything ok, update progress counters and continue. */
@@ -961,7 +958,7 @@
*/
s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b)
{
- int ret;
+ s64 ret;
if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
errno = EINVAL;
@@ -1032,7 +1029,8 @@
from_vcn = (*rl)->vcn + (*ofs >> vol->cluster_size_bits);
ntfs_log_trace("count: %lld, cur_vcn: %lld, from: %lld, to: %lld, ofs: "
- "%lld\n", count, cur_vcn, from_vcn, to_write, *ofs);
+ "%lld\n", (long long)count, (long long)cur_vcn,
+ (long long)from_vcn, (long long)to_write, (long long)*ofs);
/* Map whole runlist to be able update mapping pairs later. */
if (ntfs_attr_map_whole_runlist(na))
@@ -1164,15 +1162,16 @@
ntfs_volume *vol;
ntfs_attr_search_ctx *ctx = NULL;
runlist_element *rl;
- s64 eo, hole;
+ s64 hole_end;
+ int eo;
struct {
unsigned int undo_initialized_size : 1;
unsigned int undo_data_size : 1;
} need_to = { 0, 0 };
- ntfs_log_enter("Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, count "
- "0x%llx.\n", na->ni->mft_no, na->type, (long long)pos,
- (long long)count);
+ ntfs_log_enter("Entering for inode %lld, attr 0x%x, pos 0x%llx, count "
+ "0x%llx.\n", (long long)na->ni->mft_no, na->type,
+ (long long)pos, (long long)count);
if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
errno = EINVAL;
@@ -1309,7 +1308,7 @@
* length.
*/
ofs = pos - (rl->vcn << vol->cluster_size_bits);
- for (hole = 0; count; rl++, ofs = 0, hole = 0) {
+ for (hole_end = 0; count; rl++, ofs = 0, hole_end = 0) {
if (rl->lcn == LCN_RL_NOT_MAPPED) {
rl = ntfs_attr_find_vcn(na, rl->vcn);
if (!rl) {
@@ -1330,7 +1329,7 @@
}
if (rl->lcn < (LCN)0) {
- hole = rl->vcn + rl->length;
+ hole_end = rl->vcn + rl->length;
if (rl->lcn != (LCN)LCN_HOLE) {
errno = EIO;
@@ -1347,38 +1346,38 @@
to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs);
retry:
ntfs_log_trace("Writing %lld bytes to vcn %lld, lcn %lld, ofs "
- "%lld.\n", to_write, rl->vcn, rl->lcn, ofs);
+ "%lld.\n", (long long)to_write, (long long)rl->vcn,
+ (long long)rl->lcn, (long long)ofs);
if (!NVolReadOnly(vol)) {
s64 wpos = (rl->lcn << vol->cluster_size_bits) + ofs;
s64 wend = (rl->vcn << vol->cluster_size_bits) + ofs + to_write;
u32 bsize = vol->cluster_size;
- s64 rounded = ((wend + bsize - 1) & ~(s64)(bsize - 1)) - wend;
-
- /*
- * Zero fill to cluster boundary if we're writing to an
- * ex-sparse cluster or we're at the end of the attribute.
+ /* Byte size needed to zero fill a cluster */
+ s64 rounding = ((wend + bsize - 1) & ~(s64)(bsize - 1)) - wend;
+ /**
+ * Zero fill to cluster boundary if we're writing at the
+ * end of the attribute or into an ex-sparse cluster.
* This will cause the kernel not to seek and read disk
* blocks during write(2) to fill the end of the buffer
* which increases write speed by 2-10 fold typically.
*/
- if ((rounded && (wend < (hole << vol->cluster_size_bits))) ||
- (((to_write % bsize) &&
- (ofs + to_write == na->initialized_size)))) {
+ if (rounding && ((wend == na->initialized_size) ||
+ (wend < (hole_end << vol->cluster_size_bits)))){
char *cb;
- rounded += to_write;
+ rounding += to_write;
- cb = ntfs_malloc(rounded);
+ cb = ntfs_malloc(rounding);
if (!cb)
goto err_out;
memcpy(cb, b, to_write);
- memset(cb + to_write, 0, rounded - to_write);
+ memset(cb + to_write, 0, rounding - to_write);
- written = ntfs_pwrite(vol->dev, wpos, rounded, cb);
- if (written == rounded)
+ written = ntfs_pwrite(vol->dev, wpos, rounding, cb);
+ if (written == rounding)
written = to_write;
free(cb);
@@ -1426,7 +1425,6 @@
* TODO: Need to try to change initialized_size. If it
* succeeds goto done, otherwise goto err_out. (AIA)
*/
- errno = EOPNOTSUPP;
goto err_out;
}
goto done;
@@ -2352,6 +2350,36 @@
}
/**
+ * ntfs_attr_position - find given or next attribute type in an ntfs inode
+ * @type: attribute type to start lookup
+ * @ctx: search context with mft record and attribute to search from
+ *
+ * Find an attribute type in an ntfs inode or the next attribute which is not
+ * the AT_END attribute. Please see more details at ntfs_attr_lookup.
+ *
+ * Return 0 if the search was successful and -1 if not, with errno set to the
+ * error code.
+ *
+ * The following error codes are defined:
+ * EINVAL Invalid arguments.
+ * EIO I/O error or corrupt data structures found.
+ * ENOMEM Not enough memory to allocate necessary buffers.
+ * ENOSPC No attribute was found after 'type', only AT_END.
+ */
+int ntfs_attr_position(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx)
+{
+ if (ntfs_attr_lookup(type, NULL, 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ if (errno != ENOENT)
+ return -1;
+ if (ctx->attr->type == AT_END) {
+ errno = ENOSPC;
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/**
* ntfs_attr_init_search_ctx - initialize an attribute search context
* @ctx: attribute search context to initialize
* @ni: ntfs inode with which to initialize the search context
@@ -3106,8 +3134,8 @@
return -1;
}
- ntfs_log_trace("Entering for inode 0x%llx, attr %x, size %lld.\n",
- (long long) ni->mft_no, type, size);
+ ntfs_log_trace("Entering for inode %lld, attr %x, size %lld.\n",
+ (long long)ni->mft_no, type, (long long)size);
if (ni->nr_extents == -1)
ni = ni->base_ni;
@@ -3372,6 +3400,14 @@
"(%u > %u)\n", new_muse, alloc_size);
return -1;
}
+
+ if (a->type == AT_INDEX_ROOT && new_size > attr_size &&
+ new_muse + 120 > alloc_size && old_size + 120 <= alloc_size) {
+ errno = ENOSPC;
+ ntfs_log_trace("Too big INDEX_ROOT (%u > %u)\n",
+ new_muse, alloc_size);
+ return STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT;
+ }
/* Move attributes following @a to their new location. */
memmove((u8 *)a + new_size, (u8 *)a + attr_size,
@@ -3404,12 +3440,14 @@
int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a,
const u32 new_size)
{
+ int ret;
+
ntfs_log_trace("Entering for new size %u.\n", (unsigned)new_size);
/* Resize the resident part of the attribute record. */
- if (ntfs_attr_record_resize(m, a, (le16_to_cpu(a->value_offset) +
- new_size + 7) & ~7) < 0)
- return -1;
+ if ((ret = ntfs_attr_record_resize(m, a, (le16_to_cpu(a->value_offset) +
+ new_size + 7) & ~7)) < 0)
+ return ret;
/*
* If we made the attribute value bigger, clear the area between the
* old size and @new_size.
@@ -3765,6 +3803,9 @@
return -1;
}
+
+static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize);
+
/**
* ntfs_resident_attr_resize - resize a resident, open ntfs attribute
* @na: resident ntfs attribute to resize
@@ -3781,7 +3822,7 @@
* ERANGE - @newsize is not valid for the attribute type of @na.
* ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST.
*/
-static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize)
+static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
{
ntfs_attr_search_ctx *ctx;
ntfs_volume *vol;
@@ -3821,8 +3862,8 @@
*/
if (newsize < vol->mft_record_size) {
/* Perform the resize of the attribute record. */
- if (!ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr,
- newsize)) {
+ if (!(ret = ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr,
+ newsize))) {
/* Update attribute size everywhere. */
na->data_size = na->initialized_size = newsize;
na->allocated_size = (newsize + 7) & ~7;
@@ -3835,6 +3876,11 @@
}
goto resize_done;
}
+ /* Prefer AT_INDEX_ALLOCATION instead of AT_ATTRIBUTE_LIST */
+ if (ret == STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT) {
+ err = errno;
+ goto put_err_out;
+ }
}
/* There is not enough space in the mft record to perform the resize. */
@@ -3891,14 +3937,16 @@
ntfs_log_perror("%s: Attribute lookup failed 1", __FUNCTION__);
goto put_err_out;
}
-
- /* We can't move out attribute list, thus move out others. */
- if (na->type == AT_ATTRIBUTE_LIST) {
+
+ /*
+ * The standard information and attribute list attributes can't be
+ * moved out from the base MFT record, so try to move out others.
+ */
+ if (na->type==AT_STANDARD_INFORMATION || na->type==AT_ATTRIBUTE_LIST) {
ntfs_attr_put_search_ctx(ctx);
if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD,
non_resident_end) + 8)) {
- ntfs_log_perror("Couldn't free space in the MFT record to "
- "make attribute list non resident");
+ ntfs_log_perror("Could not free space in MFT record");
return -1;
}
return ntfs_resident_attr_resize(na, newsize);
@@ -3977,6 +4025,16 @@
return ret;
}
+static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize)
+{
+ int ret;
+
+ ntfs_log_enter("Entering\n");
+ ret = ntfs_resident_attr_resize_i(na, newsize);
+ ntfs_log_leave("\n");
+ return ret;
+}
+
/**
* ntfs_attr_make_resident - convert a non-resident to a resident attribute
* @na: open ntfs attribute to make resident
@@ -4343,8 +4401,8 @@
*/
if (finished_build) {
ntfs_log_trace("Mark attr 0x%x for delete in inode "
- "0x%llx.\n", (unsigned)le32_to_cpu(
- a->type), ctx->ntfs_ino->mft_no);
+ "%lld.\n", (unsigned)le32_to_cpu(a->type),
+ (long long)ctx->ntfs_ino->mft_no);
a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK);
ntfs_inode_mark_dirty(ctx->ntfs_ino);
continue;
@@ -4731,7 +4789,7 @@
* ERANGE - @newsize is not valid for the attribute type of @na.
* ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST.
*/
-static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
+static int ntfs_non_resident_attr_expand_i(ntfs_attr *na, const s64 newsize)
{
LCN lcn_seek_from;
VCN first_free_vcn;
@@ -4741,7 +4799,7 @@
s64 org_alloc_size;
int err;
- ntfs_log_trace("Inode 0x%llx, attr 0x%x, new size %lld old size %lld\n",
+ ntfs_log_trace("Inode %lld, attr 0x%x, new size %lld old size %lld\n",
(unsigned long long)na->ni->mft_no, na->type,
(long long)newsize, (long long)na->data_size);
@@ -4925,6 +4983,17 @@
return -1;
}
+
+static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
+{
+ int ret;
+
+ ntfs_log_enter("Entering\n");
+ ret = ntfs_non_resident_attr_expand_i(na, newsize);
+ ntfs_log_leave("\n");
+ return ret;
+}
+
/**
* ntfs_attr_truncate - resize an ntfs attribute
* @na: open ntfs attribute to resize
@@ -4947,7 +5016,7 @@
*/
int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
{
- int ret;
+ int ret = STATUS_ERROR;
if (!na || newsize < 0 ||
(na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) {
@@ -4956,12 +5025,14 @@
return STATUS_ERROR;
}
- ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, size %lld\n",
- (unsigned long long)na->ni->mft_no, na->type, newsize);
+ ntfs_log_enter("Entering for inode %lld, attr 0x%x, size %lld\n",
+ (unsigned long long)na->ni->mft_no, na->type,
+ (long long)newsize);
if (na->data_size == newsize) {
ntfs_log_trace("Size is already ok\n");
- return STATUS_OK;
+ ret = STATUS_OK;
+ goto out;
}
/*
* Encrypted attributes are not supported. We return access denied,
@@ -4970,7 +5041,7 @@
if (NAttrEncrypted(na)) {
errno = EACCES;
ntfs_log_perror("Failed to truncate encrypted attribute");
- return STATUS_ERROR;
+ goto out;
}
/*
* TODO: Implement making handling of compressed attributes.
@@ -4978,7 +5049,7 @@
if (NAttrCompressed(na)) {
errno = EOPNOTSUPP;
ntfs_log_perror("Failed to truncate compressed attribute");
- return STATUS_ERROR;
+ goto out;
}
if (NAttrNonResident(na)) {
if (newsize > na->data_size)
@@ -4987,8 +5058,8 @@
ret = ntfs_non_resident_attr_shrink(na, newsize);
} else
ret = ntfs_resident_attr_resize(na, newsize);
-
- ntfs_log_trace("Return status %d\n", ret);
+out:
+ ntfs_log_leave("Return status %d\n", ret);
return ret;
}
@@ -5097,28 +5168,61 @@
return ret;
}
+/* Below macros are 32-bit ready. */
+#define BCX(x) ((x) - (((x) >> 1) & 0x77777777) - \
+ (((x) >> 2) & 0x33333333) - \
+ (((x) >> 3) & 0x11111111))
+#define BITCOUNT(x) (((BCX(x) + (BCX(x) >> 4)) & 0x0F0F0F0F) % 255)
+
+static u8 *ntfs_init_lut256(void)
+{
+ int i;
+ u8 *lut;
+
+ lut = ntfs_malloc(256);
+ if (lut)
+ for(i = 0; i < 256; i++)
+ *(lut + i) = 8 - BITCOUNT(i);
+ return lut;
+}
+
s64 ntfs_attr_get_free_bits(ntfs_attr *na)
{
- u8 *buf;
+ u8 *buf, *lut;
+ s64 br = 0;
+ s64 total = 0;
s64 nr_free = 0;
- s64 br, total = 0;
- buf = ntfs_malloc(na->ni->vol->cluster_size);
- if (!buf)
+ lut = ntfs_init_lut256();
+ if (!lut)
return -1;
- while (1) {
- int i, j;
+
+ buf = ntfs_malloc(65536);
+ if (!buf)
+ goto out;
- br = ntfs_attr_pread(na, total, na->ni->vol->cluster_size, buf);
+ while (1) {
+ u32 *p;
+ br = ntfs_attr_pread(na, total, 65536, buf);
if (br <= 0)
break;
total += br;
- for (i = 0; i < br; i++)
- for (j = 0; j < 8; j++)
- if (!((buf[i] >> j) & 1))
- nr_free++;
+ p = (u32 *)buf + br / 4 - 1;
+ for (; (u8 *)p >= buf; p--) {
+ nr_free += lut[ *p & 255] +
+ lut[(*p >> 8) & 255] +
+ lut[(*p >> 16) & 255] +
+ lut[(*p >> 24) ];
+ }
+ switch (br % 4) {
+ case 3: nr_free += lut[*(buf + br - 3)];
+ case 2: nr_free += lut[*(buf + br - 2)];
+ case 1: nr_free += lut[*(buf + br - 1)];
+ }
}
free(buf);
+out:
+ free(lut);
if (!total || br < 0)
return -1;
return nr_free;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/bootsect.c new/ntfs-3g-2009.3.8/libntfs-3g/bootsect.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/bootsect.c 2008-06-30 01:08:53.000000000 +0200
+++ new/ntfs-3g-2009.3.8/libntfs-3g/bootsect.c 2009-03-03 20:53:14.000000000 +0100
@@ -195,7 +195,7 @@
}
sectors = sle64_to_cpu(bs->number_of_sectors);
- ntfs_log_debug("NumberOfSectors = %lld\n", sectors);
+ ntfs_log_debug("NumberOfSectors = %lld\n", (long long)sectors);
if (!sectors) {
ntfs_log_error("Volume size is set to zero.\n");
return -1;
@@ -213,8 +213,8 @@
vol->mft_lcn = sle64_to_cpu(bs->mft_lcn);
vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn);
- ntfs_log_debug("MFT LCN = 0x%llx\n", vol->mft_lcn);
- ntfs_log_debug("MFTMirr LCN = 0x%llx\n", vol->mftmirr_lcn);
+ ntfs_log_debug("MFT LCN = %lld\n", (long long)vol->mft_lcn);
+ ntfs_log_debug("MFTMirr LCN = %lld\n", (long long)vol->mftmirr_lcn);
if (vol->mft_lcn > vol->nr_clusters ||
vol->mftmirr_lcn > vol->nr_clusters) {
ntfs_log_error("$MFT LCN (%lld) or $MFTMirr LCN (%lld) is "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/compress.c new/ntfs-3g-2009.3.8/libntfs-3g/compress.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/compress.c 2006-10-30 23:32:46.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/compress.c 2009-03-03 20:53:14.000000000 +0100
@@ -100,8 +100,8 @@
ntfs_log_trace("Entering, cb_size = 0x%x.\n", (unsigned)cb_size);
do_next_sb:
- ntfs_log_debug("Beginning sub-block at offset = 0x%x in the cb.\n",
- cb - cb_start);
+ ntfs_log_debug("Beginning sub-block at offset = %d in the cb.\n",
+ (int)(cb - cb_start));
/*
* Have we reached the end of the compression block or the end of the
* decompressed data? The latter can happen for example if the current
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/debug.c new/ntfs-3g-2009.3.8/libntfs-3g/debug.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/debug.c 2006-10-30 23:32:46.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/debug.c 2009-03-03 20:53:14.000000000 +0100
@@ -63,9 +63,15 @@
if (idx > -LCN_EINVAL - 1)
idx = 4;
- ntfs_log_debug("%-16llx %s %-16llx%s\n", rl[i].vcn, lcn_str[idx], rl[i].length, rl[i].length ? "" : " (runlist end)");
+ ntfs_log_debug("%-16lld %s %-16lld%s\n",
+ (long long)rl[i].vcn, lcn_str[idx],
+ (long long)rl[i].length,
+ rl[i].length ? "" : " (runlist end)");
} else
- ntfs_log_debug("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, rl[i].lcn, rl[i].length, rl[i].length ? "" : " (runlist end)");
+ ntfs_log_debug("%-16lld %-16lld %-16lld%s\n",
+ (long long)rl[i].vcn, (long long)rl[i].lcn,
+ (long long)rl[i].length,
+ rl[i].length ? "" : " (runlist end)");
} while (rl[i++].length);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/device.c new/ntfs-3g-2009.3.8/libntfs-3g/device.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/device.c 2007-01-09 22:22:57.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/device.c 2009-03-03 20:53:14.000000000 +0100
@@ -178,7 +178,7 @@
s64 br, total;
struct ntfs_device_operations *dops;
- ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count);
+ ntfs_log_trace("pos %lld, count %lld\n",(long long)pos,(long long)count);
if (!b || count < 0 || pos < 0) {
errno = EINVAL;
@@ -229,7 +229,8 @@
s64 written, total, ret = -1;
struct ntfs_device_operations *dops;
- ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count);
+ ntfs_log_trace("pos %lld, count %lld\n",(long long)pos,(long long)count);
+
if (!b || count < 0 || pos < 0) {
errno = EINVAL;
goto out;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/dir.c new/ntfs-3g-2009.3.8/libntfs-3g/dir.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/dir.c 2008-12-22 02:28:30.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/dir.c 2009-03-18 01:47:58.000000000 +0100
@@ -482,8 +482,8 @@
len = ntfs_mbstoucs(p, &unicode);
if (len < 0) {
- ntfs_log_perror("Couldn't convert filename to Unicode: "
- "'%s'.\n", p);
+ ntfs_log_perror("Could not convert filename to Unicode:"
+ " '%s'", p);
err = errno;
goto close;
} else if (len > NTFS_MAX_NAME_LEN) {
@@ -814,7 +814,7 @@
* or signals an error (both covered by the rc test).
*/
for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
- ntfs_log_debug("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir);
+ ntfs_log_debug("In index root, offset %d.\n", (int)((u8*)ie - (u8*)ir));
/* Bounds checks. */
if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
@@ -1442,8 +1442,9 @@
/* Ignore hard links from other directories */
if (dir_ni->mft_no != MREF_LE(fn->parent_directory)) {
ntfs_log_debug("MFT record numbers don't match "
- "(%llu != %llu)\n", dir_ni->mft_no,
- MREF_LE(fn->parent_directory));
+ "(%llu != %llu)\n",
+ (long long unsigned)dir_ni->mft_no,
+ (long long unsigned)MREF_LE(fn->parent_directory));
continue;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/index.c new/ntfs-3g-2009.3.8/libntfs-3g/index.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/index.c 2008-07-15 16:29:52.000000000 +0200
+++ new/ntfs-3g-2009.3.8/libntfs-3g/index.c 2009-03-22 14:32:34.000000000 +0100
@@ -82,7 +82,7 @@
{
s64 ret, vcn = sle64_to_cpu(ib->index_block_vcn);
- ntfs_log_trace("vcn: %lld\n", vcn);
+ ntfs_log_trace("vcn: %lld\n", (long long)vcn);
ret = ntfs_attr_mst_pwrite(icx->ia_na, ntfs_ib_vcn_to_pos(icx, vcn),
1, icx->block_size, ib);
@@ -585,7 +585,7 @@
{
s64 pos, ret;
- ntfs_log_trace("vcn: %lld\n", vcn);
+ ntfs_log_trace("vcn: %lld\n", (long long)vcn);
pos = ntfs_ib_vcn_to_pos(icx, vcn);
@@ -746,7 +746,7 @@
}
old_vcn = vcn;
- ntfs_log_debug("Descend into node with VCN %lld.\n", vcn);
+ ntfs_log_debug("Descend into node with VCN %lld\n", (long long)vcn);
if (ntfs_ib_read(icx, vcn, ib))
goto err_out;
@@ -797,7 +797,7 @@
INDEX_BLOCK *ib;
int ih_size = sizeof(INDEX_HEADER);
- ntfs_log_trace("Entering ib_vcn = %lld ib_size = %u\n", ib_vcn, ib_size);
+ ntfs_log_trace("ib_vcn: %lld ib_size: %u\n", (long long)ib_vcn, ib_size);
ib = ntfs_calloc(ib_size);
if (!ib)
@@ -893,7 +893,7 @@
ntfs_attr *na;
int ret = STATUS_ERROR;
- ntfs_log_trace("%s vcn: %lld\n", set ? "set" : "clear", vcn);
+ ntfs_log_trace("%s vcn: %lld\n", set ? "set" : "clear", (long long)vcn);
na = ntfs_attr_open(icx->ni, AT_BITMAP, icx->name, icx->name_len);
if (!na) {
@@ -970,7 +970,7 @@
vcn = ntfs_ibm_pos_to_vcn(icx, size * 8);
out:
- ntfs_log_trace("allocated vcn: %lld\n", vcn);
+ ntfs_log_trace("allocated vcn: %lld\n", (long long)vcn);
if (ntfs_ibm_set(icx, vcn))
vcn = (VCN)-1;
@@ -1228,16 +1228,16 @@
int ret;
ntfs_log_trace("Entering\n");
-
+
ret = ntfs_ir_truncate(icx, data_size);
if (ret == STATUS_RESIDENT_ATTRIBUTE_FILLED_MFT) {
-
+
ret = ntfs_ir_reparent(icx);
if (ret == STATUS_OK)
ret = STATUS_KEEP_SEARCHING;
else
ntfs_log_perror("Failed to nodify INDEX_ROOT");
- }
+ }
return ret;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/inode.c new/ntfs-3g-2009.3.8/libntfs-3g/inode.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/inode.c 2009-02-10 14:55:13.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/inode.c 2009-03-22 01:08:50.000000000 +0100
@@ -156,7 +156,7 @@
ntfs_attr_search_ctx *ctx;
STANDARD_INFORMATION *std_info;
- ntfs_log_enter("Entering for inode %lld\n", MREF(mref));
+ ntfs_log_enter("Entering for inode %lld\n", (long long)MREF(mref));
if (!vol) {
errno = EINVAL;
goto out;
@@ -177,8 +177,7 @@
/* Receive some basic information about inode. */
if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED,
0, CASE_SENSITIVE, 0, NULL, 0, ctx)) {
- ntfs_log_trace("Failed to receive STANDARD_INFORMATION "
- "attribute.\n");
+ ntfs_log_perror("No STANDARD_INFORMATION in base record\n");
goto put_err_out;
}
std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr +
@@ -202,6 +201,7 @@
goto put_err_out;
if (l > 0x40000) {
errno = EIO;
+ ntfs_log_perror("Too large attrlist (%lld)\n", (long long)l);
goto put_err_out;
}
ni->attr_list_size = l;
@@ -213,6 +213,8 @@
goto put_err_out;
if (l != ni->attr_list_size) {
errno = EIO;
+ ntfs_log_perror("Unexpected attrlist size (%lld <> %u)\n",
+ (long long)l, ni->attr_list_size);
goto put_err_out;
}
get_size:
@@ -512,20 +514,17 @@
{
ntfs_attr_search_ctx *ctx;
STANDARD_INFORMATION *std_info;
- int err;
- ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no);
+ ntfs_log_trace("Entering for inode %lld\n", (long long)ni->mft_no);
ctx = ntfs_attr_get_search_ctx(ni, NULL);
if (!ctx)
return -1;
if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED,
- 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) {
- err = errno;
- ntfs_log_trace("Failed to receive STANDARD_INFORMATION "
- "attribute.\n");
+ 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ ntfs_log_perror("Failed to sync standard info (inode %lld)",
+ (long long)ni->mft_no);
ntfs_attr_put_search_ctx(ctx);
- errno = err;
return -1;
}
std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr +
@@ -686,8 +685,6 @@
if (err != EIO)
err = EBUSY;
}
- ntfs_log_perror("Failed to sync standard info (inode %lld)",
- (long long)ni->mft_no);
}
/* Update FILE_NAME's in the index. */
@@ -986,8 +983,8 @@
}
/**
- * ntfs_inode_free_space - free space in the MFT record of inode
- * @ni: ntfs inode in which MFT record free space
+ * ntfs_inode_free_space - free space in the MFT record of an inode
+ * @ni: ntfs inode in which MFT record needs more free space
* @size: amount of space needed to free
*
* Return 0 on success or -1 on error with errno set to the error code.
@@ -995,7 +992,7 @@
int ntfs_inode_free_space(ntfs_inode *ni, int size)
{
ntfs_attr_search_ctx *ctx;
- int freed, err;
+ int freed;
if (!ni || size < 0) {
errno = EINVAL;
@@ -1015,97 +1012,60 @@
ctx = ntfs_attr_get_search_ctx(ni, NULL);
if (!ctx)
return -1;
-
/*
- * Chkdsk complain if $STANDARD_INFORMATION is not in the base MFT
- * record. FIXME: I'm not sure in this, need to recheck. For now simply
- * do not move $STANDARD_INFORMATION at all.
- *
- * Also we can't move $ATTRIBUTE_LIST from base MFT_RECORD, so position
- * search context on first attribute after $STANDARD_INFORMATION and
- * $ATTRIBUTE_LIST.
- *
- * Why we reposition instead of simply skip this attributes during
- * enumeration? Because in case we have got only in-memory attribute
- * list ntfs_attr_lookup will fail when it will try to find
- * $ATTRIBUTE_LIST.
+ * $STANDARD_INFORMATION and $ATTRIBUTE_LIST must stay in the base MFT
+ * record, so position search context on the first attribute after them.
*/
- if (ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, NULL,
- 0, ctx)) {
- if (errno != ENOENT) {
- err = errno;
- ntfs_log_perror("%s: attr lookup failed #2", __FUNCTION__);
- goto put_err_out;
- }
- if (ctx->attr->type == AT_END) {
- err = ENOSPC;
- goto put_err_out;
- }
- }
+ if (ntfs_attr_position(AT_FILE_NAME, ctx))
+ goto put_err_out;
while (1) {
int record_size;
-
/*
* Check whether attribute is from different MFT record. If so,
* find next, because we don't need such.
*/
while (ctx->ntfs_ino->mft_no != ni->mft_no) {
retry:
- if (ntfs_attr_lookup(AT_UNUSED, NULL, 0, CASE_SENSITIVE,
- 0, NULL, 0, ctx)) {
- err = errno;
- if (errno != ENOENT) {
- ntfs_log_perror("Attr lookup failed #2");
- } else
- err = ENOSPC;
+ if (ntfs_attr_position(AT_UNUSED, ctx))
goto put_err_out;
- }
}
if (ntfs_inode_base(ctx->ntfs_ino)->mft_no == FILE_MFT &&
ctx->attr->type == AT_DATA)
goto retry;
+ if (ctx->attr->type == AT_INDEX_ROOT)
+ goto retry;
+
record_size = le32_to_cpu(ctx->attr->length);
- /* Move away attribute. */
if (ntfs_attr_record_move_away(ctx, 0)) {
- err = errno;
ntfs_log_perror("Failed to move out attribute #2");
break;
}
freed += record_size;
- /* Check whether we done. */
+ /* Check whether we are done. */
if (size <= freed) {
ntfs_attr_put_search_ctx(ctx);
return 0;
}
-
/*
- * Reposition to first attribute after $STANDARD_INFORMATION and
- * $ATTRIBUTE_LIST (see comments upwards).
+ * Reposition to first attribute after $STANDARD_INFORMATION
+ * and $ATTRIBUTE_LIST instead of simply skipping this attribute
+ * because in the case when we have got only in-memory attribute
+ * list then ntfs_attr_lookup will fail when it tries to find
+ * $ATTRIBUTE_LIST.
*/
ntfs_attr_reinit_search_ctx(ctx);
- if (ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0,
- NULL, 0, ctx)) {
- if (errno != ENOENT) {
- err = errno;
- ntfs_log_perror("Attr lookup #2 failed");
- break;
- }
- if (ctx->attr->type == AT_END) {
- err = ENOSPC;
- break;
- }
- }
+ if (ntfs_attr_position(AT_FILE_NAME, ctx))
+ break;
}
put_err_out:
ntfs_attr_put_search_ctx(ctx);
- if (err == ENOSPC)
- ntfs_log_trace("No attributes left that can be moved out.\n");
- errno = err;
+ if (errno == ENOSPC)
+ ntfs_log_trace("No attributes left that could be moved out.\n");
return -1;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/lcnalloc.c new/ntfs-3g-2009.3.8/libntfs-3g/lcnalloc.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/lcnalloc.c 2008-06-30 01:08:53.000000000 +0200
+++ new/ntfs-3g-2009.3.8/libntfs-3g/lcnalloc.c 2009-03-25 01:10:38.000000000 +0100
@@ -56,7 +56,7 @@
static void ntfs_cluster_set_zone_pos(LCN start, LCN end, LCN *pos, LCN tc)
{
- ntfs_log_trace("pos: %lld tc: %lld\n", (long long)*pos, tc);
+ ntfs_log_trace("pos: %lld tc: %lld\n", (long long)*pos, (long long)tc);
if (tc >= end)
*pos = start;
@@ -326,8 +326,10 @@
if (prev_lcn == lcn + bmp_pos - prev_run_len && rlpos) {
ntfs_log_debug("Cluster coalesce: prev_lcn: "
"%lld lcn: %lld bmp_pos: %lld "
- "prev_run_len: %lld\n", prev_lcn,
- lcn, bmp_pos, prev_run_len);
+ "prev_run_len: %lld\n",
+ (long long)prev_lcn,
+ (long long)lcn, (long long)bmp_pos,
+ (long long)prev_run_len);
rl[rlpos - 1].length = ++prev_run_len;
} else {
if (rlpos)
@@ -336,7 +338,7 @@
else {
rl[rlpos].vcn = start_vcn;
ntfs_log_debug("Start_vcn: %lld\n",
- start_vcn);
+ (long long)start_vcn);
}
rl[rlpos].lcn = prev_lcn = lcn + bmp_pos;
@@ -345,8 +347,9 @@
}
ntfs_log_debug("RUN: %-16lld %-16lld %-16lld\n",
- rl[rlpos - 1].vcn, rl[rlpos - 1].lcn,
- rl[rlpos - 1].length);
+ (long long)rl[rlpos - 1].vcn,
+ (long long)rl[rlpos - 1].lcn,
+ (long long)rl[rlpos - 1].length);
/* Done? */
if (!--clusters) {
if (used_zone_pos)
@@ -448,7 +451,7 @@
search_zone = 1;
zone_start = vol->mft_zone_pos;
zone_end = vol->mft_zone_end;
- if (!zone_start == vol->mft_zone_start)
+ if (zone_start == vol->mft_zone_start)
pass = 2;
break;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/mft.c new/ntfs-3g-2009.3.8/libntfs-3g/mft.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/mft.c 2009-02-11 01:46:01.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/mft.c 2009-03-03 20:53:14.000000000 +0100
@@ -1025,7 +1025,7 @@
"count %lli.\n", (long long)nr);
} while (1);
- ntfs_log_debug("Allocated %lli clusters.\n", nr);
+ ntfs_log_debug("Allocated %lld clusters.\n", (long long)nr);
rl = ntfs_runlists_merge(mft_na->rl, rl2);
if (!rl) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/mst.c new/ntfs-3g-2009.3.8/libntfs-3g/mst.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/mst.c 2009-02-10 20:32:15.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/mst.c 2009-03-26 00:42:49.000000000 +0100
@@ -63,7 +63,9 @@
(u32)(usa_ofs + (usa_count * 2)) > size ||
(size >> NTFS_BLOCK_SIZE_BITS) != usa_count) {
errno = EINVAL;
- ntfs_log_perror("%s", __FUNCTION__);
+ ntfs_log_perror("%s: magic: 0x%08x size: %d usa_ofs: %d "
+ "usa_count: %d", __FUNCTION__, *(le32 *)b,
+ size, usa_ofs, usa_count);
return -1;
}
/* Position of usn in update sequence array. */
@@ -90,9 +92,12 @@
* Set the magic to "BAAD" and return failure.
* Note that magic_BAAD is already converted to le32.
*/
- b->magic = magic_BAAD;
errno = EIO;
- ntfs_log_perror("Incomplete multi-sector transfer");
+ ntfs_log_perror("Incomplete multi-sector transfer: "
+ "magic: 0x%08x size: %d usa_ofs: %d usa_count:"
+ " %d data: %d usn: %d", *(le32 *)b, size,
+ usa_ofs, usa_count, *data_pos, usn);
+ b->magic = magic_BAAD;
return -1;
}
data_pos += NTFS_BLOCK_SIZE/sizeof(u16);
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/runlist.c new/ntfs-3g-2009.3.8/libntfs-3g/runlist.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/runlist.c 2008-06-30 01:08:54.000000000 +0200
+++ new/ntfs-3g-2009.3.8/libntfs-3g/runlist.c 2009-03-03 20:06:35.000000000 +0100
@@ -742,7 +742,7 @@
* two into one, if that is possible (we check for overlap and discard the new
* runlist if overlap present before returning NULL, with errno = ERANGE).
*/
-runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
+runlist_element *ntfs_mapping_pairs_decompress_i(const ntfs_volume *vol,
const ATTR_RECORD *attr, runlist_element *old_rl)
{
VCN vcn; /* Current vcn. */
@@ -966,6 +966,17 @@
return NULL;
}
+runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol,
+ const ATTR_RECORD *attr, runlist_element *old_rl)
+{
+ runlist_element *rle;
+
+ ntfs_log_enter("Entering\n");
+ rle = ntfs_mapping_pairs_decompress_i(vol, attr, old_rl);
+ ntfs_log_leave("\n");
+ return rle;
+}
+
/**
* ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist
* @rl: runlist to use for conversion
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/libntfs-3g/volume.c new/ntfs-3g-2009.3.8/libntfs-3g/volume.c
--- old/ntfs-3g-2009.2.1/libntfs-3g/volume.c 2009-02-10 14:00:02.000000000 +0100
+++ new/ntfs-3g-2009.3.8/libntfs-3g/volume.c 2009-03-03 20:53:14.000000000 +0100
@@ -565,9 +565,9 @@
* respective zone.
*/
vol->data1_zone_pos = vol->mft_zone_end;
- ntfs_log_debug("data1_zone_pos = 0x%llx\n", vol->data1_zone_pos);
+ ntfs_log_debug("data1_zone_pos = %lld\n", (long long)vol->data1_zone_pos);
vol->data2_zone_pos = 0;
- ntfs_log_debug("data2_zone_pos = 0x%llx\n", vol->data2_zone_pos);
+ ntfs_log_debug("data2_zone_pos = %lld\n", (long long)vol->data2_zone_pos);
/* Set the mft data allocation position to mft record 24. */
vol->mft_data_pos = 24;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/README new/ntfs-3g-2009.3.8/README
--- old/ntfs-3g-2009.2.1/README 2008-01-20 15:26:51.000000000 +0100
+++ new/ntfs-3g-2009.3.8/README 2009-02-28 14:56:46.000000000 +0100
@@ -3,10 +3,9 @@
============
The NTFS-3G driver is an open source, freely available read/write NTFS driver
-for Linux, FreeBSD, Mac OS X, NetBSD, and Haiku. It provides safe and fast
-handling of the Windows XP, Windows Server 2003, Windows 2000 and Windows
-Vista file systems. Most POSIX file system operations are supported, and
-full file ownership and permission support is also coming along fast.
+for Linux, FreeBSD, Mac OS X, NetBSD, Solaris and Haiku. It provides safe and
+fast handling of the Windows XP, Windows Server 2003, Windows 2000, Windows
+Vista, and Windows Server 2008 file systems.
The purpose of the project is to develop, continuously quality test and
support a trustable, featureful and high performance solution for hardware
@@ -15,16 +14,16 @@
the limits of the hybrid, kernel/user space filesystem driver approach,
performance, reliability and feature richness per invested effort wise.
-The driver is in STABLE status. The test methods, the test suites used and
-testimonials can be found on
+The driver is in STABLE status. The test methods, the test suites used
+can be found at
- http://www.ntfs-3g.org/quality.html
+ http://ntfs-3g.org/quality.html
News, support answers, problem submission instructions, support and discussion
forums, performance numbers and other information are available on the project
web site at
- http://www.ntfs-3g.org
+ http://ntfs-3g.org
QUICK INSTALLATION
@@ -47,21 +46,14 @@
=====
If there was no error during installation then the NTFS volume can be
-read-write mounted for everybody the following way (unmount the volume if
-it was already mounted, and replace /dev/sda1 and /mnt/windows, if needed):
+read-write mounted for everybody the following way as the root user
+(unmount the volume if it was already mounted, and replace /dev/sda1
+and /mnt/windows, if needed):
mount -t ntfs-3g /dev/sda1 /mnt/windows
or
ntfs-3g /dev/sda1 /mnt/windows
-If your Operating System vendor didn't setup your language specific settings
-then you may also need to set the 'locale' mount option to make all filenames
-with national characters visible. Replace the below en_US.UTF-8 with the
-appropriate setting. You can find more information about his topic at
-http://ntfs-3g.org/support.html#locale
-
- mount -t ntfs-3g /dev/hda1 /mnt/windows -o locale=en_US.UTF-8
-
Please see the ntfs-3g manual page for more options and examples.
You can also make NTFS to be mounted during boot by putting the below
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/src/ntfs-3g.8.in new/ntfs-3g-2009.3.8/src/ntfs-3g.8.in
--- old/ntfs-3g-2009.2.1/src/ntfs-3g.8.in 2009-02-11 22:38:49.000000000 +0100
+++ new/ntfs-3g-2009.3.8/src/ntfs-3g.8.in 2009-03-19 18:42:58.000000000 +0100
@@ -3,7 +3,7 @@
.\" Copyright (c) 2006-2009 Szabolcs Szakacsits.
.\" This file may be copied under the terms of the GNU Public License.
.\"
-.TH NTFS-3G 8 "February 2009" "ntfs-3g @VERSION@"
+.TH NTFS-3G 8 "March 2009" "ntfs-3g @VERSION@"
.SH NAME
ntfs-3g \- Third Generation Read/Write NTFS Driver
.SH SYNOPSIS
@@ -157,7 +157,15 @@
limited anyway to 32 pages (which is 128kbyte on i386).
.TP
.B silent
-Do nothing on chmod and chown operations, but do not return error.
+Do not return error for chown and chmod unless access right
+handling is turned on by either of the
+.B uid,
+.B gid,
+.B umask,
+.B fmask,
+or
+.B dmask
+option.
This option is on by default.
.TP
.BI locale= value
@@ -236,8 +244,7 @@
http://ntfs-3g.org/support.html
.sp
.RE
-for common questions and known issues. You can contact the development
-team on the ntfs\-3g\-devel@lists.sf.net address.
+for common questions, known issues and support.
.SH ACKNOWLEDGEMENT
Several people made heroic efforts, often over five or more
years which resulted the ntfs-3g driver. Most importantly they are
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/ntfs-3g-2009.2.1/src/ntfs-3g.c new/ntfs-3g-2009.3.8/src/ntfs-3g.c
--- old/ntfs-3g-2009.2.1/src/ntfs-3g.c 2009-02-11 22:38:49.000000000 +0100
+++ new/ntfs-3g-2009.3.8/src/ntfs-3g.c 2009-03-04 01:01:21.000000000 +0100
@@ -2012,11 +2012,12 @@
{
int c;
- static const char *sopt = "-o:hv";
+ static const char *sopt = "-o:hvV";
static const struct option lopt[] = {
{ "options", required_argument, NULL, 'o' },
{ "help", no_argument, NULL, 'h' },
{ "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
@@ -2063,6 +2064,10 @@
* we don't use it because mount(8) passes it.
*/
break;
+ case 'V':
+ ntfs_log_info("%s %s %s %d\n", EXEC_NAME, VERSION,
+ FUSE_TYPE, fuse_version());
+ exit(0);
default:
ntfs_log_error("%s: Unknown option '%s'.\n", EXEC_NAME,
argv[optind - 1]);
@@ -2320,8 +2325,7 @@
ntfs_log_set_handler(ntfs_log_handler_stderr);
if (parse_options(argc, argv)) {
- ntfs_log_error("Please type '%s --help' for more "
- "information.\n", argv[0]);
+ usage();
return NTFS_VOLUME_SYNTAX_ERROR;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org