]> wimlib.net Git - wimlib/commitdiff
Various portability fixes
authorEric Biggers <ebiggers3@gmail.com>
Sun, 18 Nov 2012 20:44:46 +0000 (14:44 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 18 Nov 2012 20:44:46 +0000 (14:44 -0600)
18 files changed:
config.h.in
configure.ac
debian/changelog
debian/control
programs/mkwinpeimg
rpm/wimlib-minimal.spec
rpm/wimlib-without-ntfs-3g.spec
rpm/wimlib.spec
src/integrity.c
src/lookup_table.c
src/mount.c
src/ntfs-apply.c
src/util.h
src/write.c
tests/test-imagex
tests/test-imagex-capture_and_apply
tests/test-imagex-mount
tests/test-imagex-ntfs

index 16781521529cad0f9f1918776bce69eeaed2e43a..05d6092eddaddef893bfaa53c40638433abe8600 100644 (file)
@@ -18,6 +18,9 @@
 /* Define to 1 if including even more debug messages. */
 #undef ENABLE_MORE_DEBUG
 
+/* Define to 1 if including support for multithreaded compression */
+#undef ENABLE_MULTITHREADED_COMPRESSION
+
 /* Define to 1 if using vectorized implementation of SHA1 */
 #undef ENABLE_SSSE3_SHA1
 
    */
 #undef LT_OBJDIR
 
-/* Define to 1 if including support for multithreaded compression */
-#undef MULTITHREADED_COMPRESSION
-
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
 #undef NO_MINUS_C_MINUS_O
 
index cc96b9321bfd2de1e22ecffae16fe1dd1aaa6ff5..63f009754202ea43460cb603f83c9c1faa48ee82 100644 (file)
@@ -144,7 +144,7 @@ AC_ARG_ENABLE([multithreaded-compression],
        )
 AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
 if test "x$ENABLE_MULTITHREADED_COMPRESSION" = "xyes"; then
-       AC_DEFINE([MULTITHREADED_COMPRESSION], [1],
+       AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
                        [Define to 1 if including support for multithreaded
                         compression])
 fi
index a37117c894ebb8d087406c612bfcb23c6598d1bd..bcf014f8a86416eadb34af2b924a70fd85092893 100644 (file)
@@ -1,3 +1,9 @@
+wimlib (1.1.0-1) unstable; urgency=low
+
+  * Update to v1.1.0
+
+ -- Eric Biggers <ebiggers3@gmail.com>  Sun, 18 Nov 2012 13:49:54 -0600
+
 wimlib (1.0.4-1) unstable; urgency=low
 
   * Update to v1.0.4
index 34510d8b75351a9ab51044a077a6e201e716d607..4b1e6e8fc1d7a15d4f81f6980d7f8cf29c1a6303 100644 (file)
@@ -3,7 +3,7 @@ Priority: optional
 Maintainer: Eric Biggers <ebiggers3@gmail.com>
 Build-Depends: debhelper (>= 7.0.0), autotools-dev, pkg-config,
                libfuse-dev, libxml2-dev, libssl-dev,
-               ntfs-3g-dev (>= 2011.4.12), attr-dev, bash
+               ntfs-3g-dev (>= 2011.4.12), attr-dev, bash, attr
 Standards-Version: 3.9.2
 Section: libs
 Homepage: http://sourceforge.net/projects/wimlib
index 3e932e749fa739c778c6bc047ddb2eb62d0344fb..e3cc1dc536332fbf173070aa3fca237b565972a2 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # This script can make a customized bootable image of Windows PE.
 #
index 54dc8c7a4f636557cb6088cbd78422f13b687dd6..cbd32727420867dec91815e6719dec9328e57e52 100644 (file)
@@ -1,6 +1,6 @@
 Summary:   Library to extract, create, and modify WIM files
 Name:      wimlib
-Version:   1.0.4
+Version:   1.1.0
 Release:   1
 License:   GPLv3+
 Group:     System/Libraries
index f9c5637d22d5ab1d05ef849978395112e1bac568..01b9ff3089e587b7973b682b2be63fd72233c859 100644 (file)
@@ -1,6 +1,6 @@
 Summary:   Library to extract, create, and modify WIM files
 Name:      wimlib
-Version:   1.0.4
+Version:   1.1.0
 Release:   1
 License:   GPLv3+
 Group:     System/Libraries
index 090c7ebbc0186320eb265ade9abd29a12e90e667..4ab654dc0c815276268aa6e0d6f2d53e256e46f9 100644 (file)
@@ -1,6 +1,6 @@
 Summary:   Library to extract, create, and modify WIM files
 Name:      wimlib
-Version:   1.0.4
+Version:   1.1.0
 Release:   1
 License:   GPLv3+
 Group:     System/Libraries
index f1e208f17d2a4a1fc26363ddba8580a8aae55b90..f9d7aaa57fd9ae7a18f0c0e555d6cf42666a314c 100644 (file)
@@ -144,10 +144,12 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status)
        }
 
        /* Read the integrity table into memory. */
-       buf = MALLOC(res_entry->original_size);
-       if (!buf) {
+       if ((sizeof(size_t) < sizeof(u64)
+           && res_entry->original_size > ~(size_t)0)
+           || ((buf = MALLOC(res_entry->original_size)) == NULL))
+       {
                ERROR("Out of memory (needed %zu bytes for integrity table)",
-                     res_entry->original_size);
+                     (size_t)res_entry->original_size);
                ret = WIMLIB_ERR_NOMEM;
                goto out;
        }
index f0da2b423c59c521612aa7d4f23033bc85b693e4..f320e2dde128fa58d932a41f8cd96f276019eadb 100644 (file)
@@ -233,9 +233,10 @@ void lte_decrement_refcnt(struct lookup_table_entry *lte,
 void lte_decrement_num_opened_fds(struct lookup_table_entry *lte)
 {
        wimlib_assert(lte != NULL);
-       wimlib_assert(lte->num_opened_fds != 0);
-       if (atomic_dec(&lte->num_opened_fds) == 0 && lte->refcnt == 0)
-               finalize_lte(lte);
+       if (lte->num_opened_fds != 0) {
+               if (--lte->num_opened_fds == 0 && lte->refcnt == 0)
+                       finalize_lte(lte);
+       }
 }
 #endif
 
index 3c0b9290e1a209c12e79942a3dd5a659787df373..8b9cab93cc47514c6d4d8e8348fdc051452a94ad 100644 (file)
@@ -115,6 +115,11 @@ static inline WIMStruct *wimfs_get_WIMStruct()
        return wimfs_get_context()->wim;
 }
 
+static inline bool wimfs_ctx_readonly(const struct wimfs_context *ctx)
+{
+       return (ctx->mount_flags & WIMLIB_MOUNT_FLAG_READWRITE) == 0;
+}
+
 static inline int get_lookup_flags(const struct wimfs_context *ctx)
 {
        if (ctx->mount_flags & WIMLIB_MOUNT_FLAG_STREAM_INTERFACE_WINDOWS)
@@ -136,13 +141,15 @@ static inline int flags_writable(int open_flags)
  * @stream_id: ID of the stream we're opening
  * @lte:       Lookup table entry for the stream (may be NULL)
  * @fd_ret:    Return the allocated file descriptor if successful.
+ * @readonly:  True if this is a read-only mount.
  *
  * Return 0 iff successful or error code if unsuccessful.
  */
 static int alloc_wimlib_fd(struct inode *inode,
                           u32 stream_id,
                           struct lookup_table_entry *lte,
-                          struct wimlib_fd **fd_ret)
+                          struct wimlib_fd **fd_ret,
+                          bool readonly)
 {
        static const u16 fds_per_alloc = 8;
        static const u16 max_fds = 0xffff;
@@ -192,8 +199,8 @@ static int alloc_wimlib_fd(struct inode *inode,
                        *fd_ret        = fd;
                        inode->fds[i]  = fd;
                        inode->num_opened_fds++;
-                       if (lte)
-                               atomic_inc(&lte->num_opened_fds);
+                       if (lte && !readonly)
+                               lte->num_opened_fds++;
                        DEBUG("Allocated fd (idx = %u)", fd->idx);
                        ret = 0;
                        break;
@@ -1269,7 +1276,8 @@ static int wimfs_open(const char *path, struct fuse_file_info *fi)
                        return ret;
        }
 
-       ret = alloc_wimlib_fd(inode, stream_id, lte, &fd);
+       ret = alloc_wimlib_fd(inode, stream_id, lte, &fd,
+                             wimfs_ctx_readonly(ctx));
        if (ret != 0)
                return ret;
 
@@ -1290,14 +1298,15 @@ static int wimfs_opendir(const char *path, struct fuse_file_info *fi)
        struct inode *inode;
        int ret;
        struct wimlib_fd *fd = NULL;
-       WIMStruct *w = wimfs_get_WIMStruct();
+       struct wimfs_context *ctx = wimfs_get_context();
+       WIMStruct *w = ctx->wim;
 
        inode = wim_pathname_to_inode(w, path);
        if (!inode)
                return -ENOENT;
        if (!inode_is_directory(inode))
                return -ENOTDIR;
-       ret = alloc_wimlib_fd(inode, 0, NULL, &fd);
+       ret = alloc_wimlib_fd(inode, 0, NULL, &fd, wimfs_ctx_readonly(ctx));
        fi->fh = (uintptr_t)fd;
        return ret;
 }
@@ -1834,9 +1843,13 @@ static struct fuse_operations wimfs_operations = {
 #endif
        .write       = wimfs_write,
 
+#if FUSE_MAJOR_VERSION > 2 || (FUSE_MAJOR_VERSION == 2 && FUSE_MINOR_VERSION >= 8)
        .flag_nullpath_ok = 1,
+#endif
+#if FUSE_MAJOR_VERSION > 2 || (FUSE_MAJOR_VERSION == 2 && FUSE_MINOR_VERSION >= 9)
        .flag_nopath = 1,
        .flag_utime_omit_ok = 1,
+#endif
 };
 
 
index 9b880a3dd6e047209f33aab0de76138469f0b723..32d981082da0a9e0edb4754904fe09f62561f296 100644 (file)
@@ -299,7 +299,7 @@ static int apply_reparse_data(ntfs_inode *ni, const struct dentry *dentry,
        }
 
        if (wim_resource_size(lte) >= 0xffff) {
-               ERROR("Reparse data of `%s' is too long (%lu bytes)",
+               ERROR("Reparse data of `%s' is too long (%"PRIu64" bytes)",
                      dentry->full_path_utf8, wim_resource_size(lte));
                return WIMLIB_ERR_INVALID_DENTRY;
        }
index 08a661b8d34572de7e02a37a28406f6335921d24..d87a0e827d16e5c2d80629c84b8af4e5ef3b3769 100644 (file)
@@ -30,6 +30,8 @@
 #      define HOT
 #endif /* __GNUC__ */
 
+
+#if 0
 #ifdef WITH_FUSE
 #define atomic_inc(ptr) \
        __sync_fetch_and_add(ptr, 1)
@@ -37,6 +39,7 @@
 #define atomic_dec(ptr) \
        __sync_sub_and_fetch(ptr, 1)
 #endif
+#endif
 
 #ifndef _NTFS_TYPES_H
 typedef uint8_t  u8;
index ef1e02dba39effd838e25408d0d1e2e6b60b6fa3..b12ec7acbfa65451df025e9372bd422fc0c42f0f 100644 (file)
 
 #ifdef HAVE_ALLOCA_H
 #include <alloca.h>
+#else
+#include <stdlib.h>
 #endif
 
-
 /* Reopens the FILE* for a WIM read-write. */
 static int reopen_rw(WIMStruct *w)
 {
@@ -1427,6 +1428,19 @@ out:
        return ret;
 }
 
+
+static const char *get_data_type(int ctype)
+{
+       switch (ctype) {
+       case WIM_COMPRESSION_TYPE_NONE:
+               return "uncompressed";
+       case WIM_COMPRESSION_TYPE_LZX:
+               return "LZX-compressed";
+       case WIM_COMPRESSION_TYPE_XPRESS:
+               return "XPRESS-compressed";
+       }
+}
+
 static int write_stream_list_parallel(struct list_head *stream_list,
                                      FILE *out_fp, int out_ctype,
                                      int write_flags, u64 total_size,
@@ -1484,8 +1498,8 @@ static int write_stream_list_parallel(struct list_head *stream_list,
        }
 
        if (write_flags & WIMLIB_WRITE_FLAG_SHOW_PROGRESS) {
-               printf("Writing compressed data using %u threads...\n",
-                      num_threads);
+               printf("Writing %s compressed data using %u threads...\n",
+                      get_data_type(out_ctype), num_threads);
        }
 
        ret = main_writer_thread_proc(stream_list,
@@ -1561,7 +1575,8 @@ static int write_stream_list(struct list_head *stream_list, FILE *out_fp,
                        const char *reason = "";
                        if (!compression_needed)
                                reason = " (no compression needed)";
-                       printf("Writing data using 1 thread%s\n", reason);
+                       printf("Writing %s data using 1 thread%s\n",
+                              get_data_type(out_ctype), reason);
                }
 
                return write_stream_list_serial(stream_list, out_fp,
index 2601d876d49cb01efbbf760e74088074c5fd1f41..0ac5fc3592672214aa6502a2fe855ae45be59b3c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # This script does some sanity testing of the 'imagex' program.  It by no means
 # tests every aspect of wimlib comprehensively.
index 00090281f378ab1b544c1191da182505293628f0..caa4d47ea8abb7b1f12fddf05763fae3a17a1251 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Test capturing and applying a WIM image in the normal (non-NTFS) capture mode
 #
index 74cff3f7661adcb916a9a83ee46753ce3633a96b..4f6d1c95e58521ae0570339abdf65e2c5b207646 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Test WIM mounting
 
@@ -239,7 +239,7 @@ do_test() {
        fi
 
        cd tmp.mnt
-       if ! tar xf ../test.tar; then
+       if ! tar xf ../test.tar --no-same-owner; then
                error "Failed to untar archive on read-write mounted WIM"
        fi
        cd ..
@@ -254,7 +254,7 @@ do_test() {
        fi
 
        cd tmp.mnt
-       if ! tar xf ../test.tar; then
+       if ! tar xf ../test.tar --no-same-owner; then
                error "Failed to untar archive on read-write mounted WIM"
        fi
        cd ..
index 85812baf022dad29c897e5c89fed840f73e02ebe..c046c2de7fa39dbe326bb72b8578ed2d98ea0920 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # This script does some sanity testing of the 'imagex' program, specifically
 # checking the NTFS capture and apply features.