diff --git a/.gitignore b/.gitignore
index e69de29..325cb73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,6 @@
+*~
+*.rpm
+.build*.log
+clog
+ntfs-3g_ntfsprogs-*.tgz
+ntfs-3g_ntfsprogs-*/
diff --git a/20-ntfs-config-write-policy.fdi b/20-ntfs-config-write-policy.fdi
new file mode 100644
index 0000000..82731c5
--- /dev/null
+++ b/20-ntfs-config-write-policy.fdi
@@ -0,0 +1,11 @@
+
+
+
+
+ ntfs-3g
+ ntfs-3g
+ locale=
+
+
+
+
diff --git a/libguestfs-winsupport.spec b/libguestfs-winsupport.spec
new file mode 100644
index 0000000..64ad322
--- /dev/null
+++ b/libguestfs-winsupport.spec
@@ -0,0 +1,181 @@
+%global debug_package %{nil}
+
+%global ntfs_version 2012.1.15
+
+Name: libguestfs-winsupport
+Version: 7.0
+Release: 1%{?dist}
+Summary: Add support for Windows guests to libguestfs
+
+License: GPLv2+
+ExclusiveArch: x86_64
+
+# This package shouldn't be installed without installing the base
+# libguestfs package.
+Requires: libguestfs >= 1:1.20.0
+
+# Needs fuse-libs (RHBZ#599300).
+Requires: fuse-libs
+
+# Source and patches for ntfs. Try to keep this in step with Fedora.
+Source0: http://tuxera.com/opensource/ntfs-3g_ntfsprogs-%{ntfs_version}.tgz
+Source1: 20-ntfs-config-write-policy.fdi
+
+Patch0: ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
+Patch1: ntfs-3g-junction-point-fix.patch
+# Windows 8 safety checks
+Patch2: ntfs-3g-4d0b9163c9ef1f0cdbbf533317b291220c7fd1c7.patch
+Patch3: ntfs-3g-559270a8f67c77a7ce51246c23d2b2837bcff0c9.patch
+
+BuildRequires: fuse-devel
+Requires: fuse
+
+BuildRequires: libtool, libattr-devel
+BuildRequires: libconfig-devel, libgcrypt-devel, gnutls-devel, libuuid-devel
+
+# Required by binaries in the supermin appliance.
+Requires: libgcrypt, gnutls, p11-kit, libtasn1, zlib
+
+
+%description
+This optional package adds support for Windows guests (NTFS) to the
+base libguestfs Red Hat Enterprise Linux (RHEL) package. This is
+useful for examining Windows virtual machines running on RHEL, and for
+performing V2V of Windows guests from another hypervisor to RHEL.
+
+To enable Windows support, simply install this package.
+
+To disable Windows support, uninstall this package.
+
+
+%prep
+%setup -q -n ntfs-3g_ntfsprogs-%{ntfs_version}
+%patch0 -p1 -b .unsupported
+%patch1 -p1 -b .junction-fix
+%patch2 -p1 -b .4d0b9163
+%patch3 -p1 -b .559270a8
+
+
+%build
+CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
+%configure \
+ --disable-static \
+ --disable-ldconfig \
+ --with-fuse=external \
+ --exec-prefix=/ \
+ --enable-crypto \
+ --enable-extras
+make %{?_smp_mflags} LIBTOOL=%{_bindir}/libtool
+
+# Create a README file.
+cat <<'EOF' > README
+This optional package adds support for Windows guests (NTFS) to the
+base libguestfs Red Hat Enterprise Linux (RHEL) package. This is
+useful for examining Windows virtual machines running on RHEL, and for
+performing V2V of Windows guests from another hypervisor to RHEL.
+
+The package contains NTFS programs from ntfsprogs %{ntfsprogs_version}
+and NTFS FUSE filesystem support from ntfs-3g %{ntfs_3g_version}.
+EOF
+
+
+%install
+mkdir ntfs
+export DESTDIR=$(pwd)/ntfs
+
+#----- Standard package install rule, but installing into ntfs/ subdir.
+make LIBTOOL=%{_bindir}/libtool install
+rm -rf $DESTDIR%{_libdir}/*.la
+rm -rf $DESTDIR%{_libdir}/*.a
+
+rm -rf $DESTDIR%{_sbindir}/mount.ntfs-3g
+cp -a $DESTDIR%{_bindir}/ntfs-3g $DESTDIR%{_sbindir}/mount.ntfs-3g
+
+# Actually make some symlinks for simplicity...
+# ... since we're obsoleting ntfsprogs-fuse
+pushd $DESTDIR%{_bindir}
+ln -s ntfs-3g ntfsmount
+popd
+pushd $DESTDIR%{_sbindir}
+ln -s mount.ntfs-3g mount.ntfs-fuse
+# And since there is no other package in Fedora that provides an ntfs
+# mount...
+ln -s mount.ntfs-3g mount.ntfs
+# Need this for fsck to find it
+ln -s ../bin/ntfsck fsck.ntfs
+popd
+mv $DESTDIR/sbin/* $DESTDIR%{_sbindir}
+rmdir $DESTDIR/sbin
+
+# We get this on our own, thanks.
+rm -rf $DESTDIR%{_defaultdocdir}/%{name}/README
+
+mkdir -p $DESTDIR%{_datadir}/hal/fdi/policy/10osvendor/
+cp -a %{SOURCE1} $DESTDIR%{_datadir}/hal/fdi/policy/10osvendor/
+#----- End of standard package install rule.
+
+# Copy the files we need to a static supermin appliance.
+rm -f files
+echo . >> files
+echo usr >> files
+echo usr/bin >> files
+echo usr/lib64 >> files
+echo usr/sbin >> files
+pushd ntfs
+find | egrep '/s?bin/|/lib(64)/' >> ../files
+cpio --quiet -o -H newc < ../files > ../ntfs.img
+popd
+
+# Supporting hostfiles.
+cat <<'EOF' > ntfs.hostfiles
+.
+./usr
+.%{_libdir}
+.%{_libdir}/libfuse.so.*
+.%{_libdir}/libgcrypt.so.*
+.%{_libdir}/libgnutls.so.*
+.%{_libdir}/libgpg-error.so.*
+.%{_libdir}/libp11-kit.so.*
+.%{_libdir}/libtasn1.so.*
+.%{_libdir}/libz.so.*
+./lib64
+./lib64/libfuse.so.*
+EOF
+
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d
+install -m 0644 ntfs.img $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d/
+install -m 0644 ntfs.hostfiles $RPM_BUILD_ROOT%{_libdir}/guestfs/supermin.d/
+
+
+%files
+%doc COPYING README
+%{_libdir}/guestfs/supermin.d/ntfs.img
+%{_libdir}/guestfs/supermin.d/ntfs.hostfiles
+
+
+%changelog
+* Thu Dec 20 2011 Richard W.M. Jones - 7.0-1
+- New package for RHEL 7
+ resolves: rhbz#819939
+- Resync against Rawhide package.
+
+* Mon Mar 28 2011 Richard W.M. Jones - 1.0-7
+- Disable debuginfo package.
+ resolves: RHBZ#691555.
+
+* Tue Mar 8 2011 Richard W.M. Jones - 1.0-6
+- Require libguestfs 1.7.17 (newer version in RHEL 6.1).
+- Require febootstrap-supermin-helper instead of febootstrap
+ resolves: RHBZ#670299.
+
+* Thu Jul 1 2010 Richard W.M. Jones - 1.0-5
+- Make sure intermediate lib* directories are created in hostfiles (RHBZ#603429)
+
+* Thu Jun 3 2010 Richard W.M. Jones - 1.0-4
+- Requires fuse-libs (RHBZ#599300).
+
+* Fri May 21 2010 Richard W.M. Jones - 1.0-3
+- ExclusiveArch x86_64.
+
+* Tue May 18 2010 Richard W.M. Jones - 1.0-2
+- Package Windows support for libguestfs.
diff --git a/ntfs-3g-4d0b9163c9ef1f0cdbbf533317b291220c7fd1c7.patch b/ntfs-3g-4d0b9163c9ef1f0cdbbf533317b291220c7fd1c7.patch
new file mode 100644
index 0000000..ec1a762
--- /dev/null
+++ b/ntfs-3g-4d0b9163c9ef1f0cdbbf533317b291220c7fd1c7.patch
@@ -0,0 +1,42 @@
+From 4d0b9163c9ef1f0cdbbf533317b291220c7fd1c7 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Jean-Pierre=20Andr=C3=A9?=
+Date: Wed, 12 Sep 2012 09:42:24 +0200
+Subject: [PATCH] Accepted processing restart pages v 2.0 with no warning (used by Windows 8)
+
+In the $LogFile, Windows 8 defines restart pages with version 2.0.
+The checks designed for version 1.1 appear to apply, so accept v 2.0
+and apply the usual checks.
+---
+ libntfs-3g/logfile.c | 15 +++++++++------
+ 1 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/libntfs-3g/logfile.c b/libntfs-3g/logfile.c
+index a4f00d5..83811fa 100644
+--- a/libntfs-3g/logfile.c
++++ b/libntfs-3g/logfile.c
+@@ -84,13 +84,16 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos)
+ "position in $LogFile.\n");
+ return FALSE;
+ }
+- /* We only know how to handle version 1.1. */
+- if (sle16_to_cpu(rp->major_ver) != 1 ||
+- sle16_to_cpu(rp->minor_ver) != 1) {
++ /* We only know how to handle version 1.1 and 2.0. */
++ if (((rp->major_ver != const_cpu_to_le16(1))
++ || (rp->minor_ver != const_cpu_to_le16(1)))
++ && ((rp->major_ver != const_cpu_to_le16(2))
++ || (rp->minor_ver != const_cpu_to_le16(0)))) {
+ ntfs_log_error("$LogFile version %i.%i is not "
+- "supported. (This driver supports version "
+- "1.1 only.)\n", (int)sle16_to_cpu(rp->major_ver),
+- (int)sle16_to_cpu(rp->minor_ver));
++ "supported.\n (This driver supports version "
++ "1.1 and 2.0 only.)\n",
++ (int)sle16_to_cpu(rp->major_ver),
++ (int)sle16_to_cpu(rp->minor_ver));
+ return FALSE;
+ }
+ /*
+--
+1.7.4.1
+
diff --git a/ntfs-3g-559270a8f67c77a7ce51246c23d2b2837bcff0c9.patch b/ntfs-3g-559270a8f67c77a7ce51246c23d2b2837bcff0c9.patch
new file mode 100644
index 0000000..9b92298
--- /dev/null
+++ b/ntfs-3g-559270a8f67c77a7ce51246c23d2b2837bcff0c9.patch
@@ -0,0 +1,109 @@
+diff -up ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/logfile.c.559270a8 ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/logfile.c
+--- ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/logfile.c.559270a8 2012-10-04 16:14:28.439011268 -0400
++++ ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/logfile.c 2012-10-04 16:14:28.443011272 -0400
+@@ -84,7 +84,12 @@ static BOOL ntfs_check_restart_page_head
+ "position in $LogFile.\n");
+ return FALSE;
+ }
+- /* We only know how to handle version 1.1 and 2.0. */
++ /*
++ * We only know how to handle version 1.1 and 2.0, though
++ * version 2.0 is probably related to cached metadata in
++ * Windows 8, and we will refuse to mount.
++ * Nevertheless, do all the relevant checks before rejecting.
++ */
+ if (((rp->major_ver != const_cpu_to_le16(1))
+ || (rp->minor_ver != const_cpu_to_le16(1)))
+ && ((rp->major_ver != const_cpu_to_le16(2))
+diff -up ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/volume.c.559270a8 ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/volume.c
+--- ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/volume.c.559270a8 2012-01-15 08:26:14.000000000 -0500
++++ ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/volume.c 2012-10-04 16:16:55.324071714 -0400
+@@ -89,13 +89,9 @@ static const char *corrupt_volume_msg =
+ "for more details.\n";
+
+ static const char *hibernated_volume_msg =
+-"The NTFS partition is hibernated. Please resume and shutdown Windows\n"
+-"properly, or mount the volume read-only with the 'ro' mount option, or\n"
+-"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 -o remove_hiberfile %s %s\n"
+-"\n";
++"The NTFS partition is in an unsafe state. Please resume and shutdown\n"
++"Windows fully (no hibernation or fast restarting), or mount the volume\n"
++"read-only with the 'ro' mount option.\n";
+
+ static const char *unclean_journal_msg =
+ "Write access is denied because the disk wasn't safely powered\n"
+@@ -649,6 +645,24 @@ static int ntfs_volume_check_logfile(ntf
+
+ if (!ntfs_check_logfile(na, &rp) || !ntfs_is_logfile_clean(na, rp))
+ err = EOPNOTSUPP;
++ /*
++ * If the latest restart page was identified as version
++ * 2.0, then Windows may have kept a cached copy of
++ * metadata for fast restarting, and we should not mount.
++ * Hibernation will be seen the same way on a non
++ * Windows-system partition, so we have to use the same
++ * error code (EPERM).
++ * The restart page may also be identified as version 2.0
++ * when access to the file system is terminated abruptly
++ * by unplugging or power cut, so mounting is also rejected
++ * after such an event.
++ */
++ if (rp
++ && (rp->major_ver == const_cpu_to_le16(2))
++ && (rp->minor_ver == const_cpu_to_le16(0))) {
++ ntfs_log_error("Metadata kept in Windows cache, refused to mount.\n");
++ err = EPERM;
++ }
+ free(rp);
+ ntfs_attr_close(na);
+ out:
+@@ -1200,7 +1214,8 @@ ntfs_volume *ntfs_device_mount(struct nt
+ ntfs_volume_check_hiberfile(vol, 1) < 0)
+ goto error_exit;
+ if (ntfs_volume_check_logfile(vol) < 0) {
+- if (!(flags & MS_RECOVER))
++ /* Always reject cached metadata for now */
++ if (!(flags & MS_RECOVER) || (errno == EPERM))
+ goto error_exit;
+ ntfs_log_info("The file system wasn't safely "
+ "closed on Windows. Fixing.\n");
+@@ -1642,6 +1657,10 @@ int ntfs_volume_error(int err)
+ ret = NTFS_VOLUME_CORRUPT;
+ break;
+ case EPERM:
++ /*
++ * Hibernation and fast restarting are seen the
++ * same way on a non Windows-system partition.
++ */
+ ret = NTFS_VOLUME_HIBERNATED;
+ break;
+ case EOPNOTSUPP:
+diff -up ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.8.in.559270a8 ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.8.in
+--- ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.8.in.559270a8 2012-01-15 08:26:14.000000000 -0500
++++ ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.8.in 2012-10-04 16:14:28.445011274 -0400
+@@ -36,6 +36,22 @@ a few differences mentioned below in rel
+ .PP
+ The \fIvolume\fR to be mounted can be either a block device or
+ an image file.
++.SS Windows hibernation and fast restarting
++On computers which can be dual-booted into Windows or Linux, Windows has
++to be fully shut down before booting into Linux, otherwise the NTFS file
++systems on internal disks may be left in an inconsistent state and changes
++made by Linux may be ignored by Windows.
++.P
++So, Windows may not be left in hibernation when starting Linux, in order
++to avoid inconsistencies. Moreover, the fast restart feature available on
++recent Windows systems has to be disabled. This can be achieved by issuing
++as an Administrator the Windows command which disables both
++hibernation and fast restarting :
++.RS
++.sp
++powercfg /h off
++.sp
++.RE
+ .SS Access Handling and Security
+ By default, files and directories are owned by the effective
+ user and group of the mounting process, and everybody has
diff --git a/ntfs-3g-junction-point-fix.patch b/ntfs-3g-junction-point-fix.patch
new file mode 100644
index 0000000..90c72ae
--- /dev/null
+++ b/ntfs-3g-junction-point-fix.patch
@@ -0,0 +1,187 @@
+--- ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/dir.c.ref 2012-08-18 09:46:22.000000000 +0200
++++ ntfs-3g_ntfsprogs-2012.1.15/libntfs-3g/dir.c 2012-08-18 11:07:57.000000000 +0200
+@@ -867,6 +867,83 @@
+ INDEX_TYPE_ALLOCATION, /* index allocation */
+ } INDEX_TYPE;
+
++/*
++ * Decode Interix file types
++ *
++ * Non-Interix types are returned as plain files, because a
++ * Windows user may force patterns very similar to Interix.
++ */
++
++static u32 ntfs_interix_types(ntfs_inode *ni)
++{
++ ntfs_attr *na;
++ u32 dt_type;
++ le64 magic;
++
++ dt_type = NTFS_DT_UNKNOWN;
++ na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
++ if (na) {
++ /* Unrecognized patterns (eg HID + SYST) are plain files */
++ dt_type = NTFS_DT_REG;
++ if (na->data_size <= 1) {
++ if (!(ni->flags & FILE_ATTR_HIDDEN))
++ dt_type = (na->data_size ?
++ NTFS_DT_SOCK : NTFS_DT_FIFO);
++ } else {
++ if ((na->data_size >= (s64)sizeof(magic))
++ && (ntfs_attr_pread(na, 0, sizeof(magic), &magic)
++ == sizeof(magic))) {
++ if (magic == INTX_SYMBOLIC_LINK)
++ dt_type = NTFS_DT_LNK;
++ else if (magic == INTX_BLOCK_DEVICE)
++ dt_type = NTFS_DT_BLK;
++ else if (magic == INTX_CHARACTER_DEVICE)
++ dt_type = NTFS_DT_CHR;
++ }
++ }
++ ntfs_attr_close(na);
++ }
++ return (dt_type);
++}
++
++/*
++ * Decode file types
++ *
++ * Better only use for Interix types and junctions,
++ * unneeded complexity when used for plain files or directories
++ *
++ * Error cases are logged and returned as unknown.
++ */
++
++static u32 ntfs_dir_entry_type(ntfs_inode *dir_ni, MFT_REF mref, FILE_ATTR_FLAGS attributes)
++{
++ ntfs_inode *ni;
++ u32 dt_type;
++
++ dt_type = NTFS_DT_UNKNOWN;
++ ni = ntfs_inode_open(dir_ni->vol, mref);
++ if (ni) {
++ if ((attributes & FILE_ATTR_REPARSE_POINT)
++ && ntfs_possible_symlink(ni))
++ dt_type = NTFS_DT_LNK;
++ else
++ if ((attributes & FILE_ATTR_SYSTEM)
++ && !(attributes & FILE_ATTR_I30_INDEX_PRESENT))
++ dt_type = ntfs_interix_types(ni);
++ else
++ dt_type = (attributes
++ & FILE_ATTR_I30_INDEX_PRESENT
++ ? NTFS_DT_DIR : NTFS_DT_REG);
++ if (ntfs_inode_close(ni)) {
++ /* anything special to do ? */
++ }
++ }
++ if (dt_type == NTFS_DT_UNKNOWN)
++ ntfs_log_error("Could not decode the type of inode %lld\n",
++ (long long)MREF(mref));
++ return (dt_type);
++}
++
+ /**
+ * ntfs_filldir - ntfs specific filldir method
+ * @dir_ni: ntfs inode of current directory
+@@ -901,19 +978,23 @@
+ dir_ni->vol->mft_record_size;
+ else /* if (index_type == INDEX_TYPE_ROOT) */
+ *pos = (u8*)ie - (u8*)iu.ir;
++ mref = le64_to_cpu(ie->indexed_file);
++ metadata = (MREF(mref) != FILE_root) && (MREF(mref) < FILE_first_user);
+ /* Skip root directory self reference entry. */
+ if (MREF_LE(ie->indexed_file) == FILE_root)
+ return 0;
+- if (ie->key.file_name.file_attributes & FILE_ATTR_I30_INDEX_PRESENT)
++ if ((ie->key.file_name.file_attributes
++ & (FILE_ATTR_REPARSE_POINT | FILE_ATTR_SYSTEM))
++ && !metadata)
++ dt_type = ntfs_dir_entry_type(dir_ni, mref,
++ ie->key.file_name.file_attributes);
++ else if (ie->key.file_name.file_attributes
++ & FILE_ATTR_I30_INDEX_PRESENT)
+ dt_type = NTFS_DT_DIR;
+- else if (fn->file_attributes & FILE_ATTR_SYSTEM)
+- dt_type = NTFS_DT_UNKNOWN;
+ else
+ dt_type = NTFS_DT_REG;
+
+ /* return metadata files and hidden files if requested */
+- mref = le64_to_cpu(ie->indexed_file);
+- metadata = (MREF(mref) != FILE_root) && (MREF(mref) < FILE_first_user);
+ if ((!metadata && (NVolShowHidFiles(dir_ni->vol)
+ || !(fn->file_attributes & FILE_ATTR_HIDDEN)))
+ || (NVolShowSysFiles(dir_ni->vol) && (NVolShowHidFiles(dir_ni->vol)
+--- ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.c.ref 2012-08-18 09:44:57.000000000 +0200
++++ ntfs-3g_ntfsprogs-2012.1.15/src/ntfs-3g.c 2012-08-18 09:47:41.000000000 +0200
+@@ -1017,10 +1017,30 @@
+ } else {
+ struct stat st = { .st_ino = MREF(mref) };
+
+- if (dt_type == NTFS_DT_REG)
+- st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
+- else if (dt_type == NTFS_DT_DIR)
++ switch (dt_type) {
++ case NTFS_DT_DIR :
+ st.st_mode = S_IFDIR | (0777 & ~ctx->dmask);
++ break;
++ case NTFS_DT_LNK :
++ st.st_mode = S_IFLNK | 0777;
++ break;
++ case NTFS_DT_FIFO :
++ st.st_mode = S_IFIFO;
++ break;
++ case NTFS_DT_SOCK :
++ st.st_mode = S_IFSOCK;
++ break;
++ case NTFS_DT_BLK :
++ st.st_mode = S_IFBLK;
++ break;
++ case NTFS_DT_CHR :
++ st.st_mode = S_IFCHR;
++ break;
++ default : /* unexpected types shown as plain files */
++ case NTFS_DT_REG :
++ st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
++ break;
++ }
+
+ #if defined(__APPLE__) || defined(__DARWIN__)
+ /*
+--- ntfs-3g_ntfsprogs-2012.1.15/src/lowntfs-3g.c.ref 2012-08-18 09:44:57.000000000 +0200
++++ ntfs-3g_ntfsprogs-2012.1.15/src/lowntfs-3g.c 2012-08-18 09:47:41.000000000 +0200
+@@ -920,10 +920,30 @@
+ if (MREF(mref) > 1) {
+ struct stat st = { .st_ino = MREF(mref) };
+
+- if (dt_type == NTFS_DT_REG)
+- st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
+- else if (dt_type == NTFS_DT_DIR)
++ switch (dt_type) {
++ case NTFS_DT_DIR :
+ st.st_mode = S_IFDIR | (0777 & ~ctx->dmask);
++ break;
++ case NTFS_DT_LNK :
++ st.st_mode = S_IFLNK | 0777;
++ break;
++ case NTFS_DT_FIFO :
++ st.st_mode = S_IFIFO;
++ break;
++ case NTFS_DT_SOCK :
++ st.st_mode = S_IFSOCK;
++ break;
++ case NTFS_DT_BLK :
++ st.st_mode = S_IFBLK;
++ break;
++ case NTFS_DT_CHR :
++ st.st_mode = S_IFCHR;
++ break;
++ default : /* unexpected types shown as plain files */
++ case NTFS_DT_REG :
++ st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
++ break;
++ }
+
+ #if defined(__APPLE__) || defined(__DARWIN__)
+ /*
diff --git a/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch b/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
new file mode 100644
index 0000000..8fd39c6
--- /dev/null
+++ b/ntfs-3g_ntfsprogs-2011.10.9-RC-ntfsck-unsupported-return-0.patch
@@ -0,0 +1,16 @@
+diff -up ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c
+--- ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c.OLD 2011-10-11 10:24:02.381335115 -0400
++++ ntfs-3g_ntfsprogs-2011.10.9-RC/ntfsprogs/ntfsck.c 2011-10-11 10:26:41.513559206 -0400
+@@ -877,7 +877,11 @@ int main(int argc, char **argv)
+ if (errors)
+ return 2;
+ if (unsupported)
+- return 1;
++ ntfs_log_info("ntfsck was unable to run properly.\n");
++ // If we return 1 here, we fail for ntfs services fscking on boot just because
++ // ntfsck isn't smart enough to handle 99% of cases. So, we just return 0.
++ // return 1;
++ return 0;
+ return 0;
+ }
+
diff --git a/sources b/sources
new file mode 100644
index 0000000..89d5b8e
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+341acae00a290cab9b00464db65015cc ntfs-3g_ntfsprogs-2012.1.15.tgz