]> wimlib.net Git - wimlib/blobdiff - src/mount_image.c
Update hyperlinks
[wimlib] / src / mount_image.c
index 3641b204c3aec966d938b57d86517f181c5d9589..dc981988b36b1550e9657fa097fbc6acf48e2ace 100644 (file)
@@ -2,7 +2,7 @@
  * mount_image.c
  *
  * This file implements mounting of WIM images using FUSE
- * (Filesystem in Userspace).  See http://fuse.sourceforge.net/.
+ * (Filesystem in Userspace).  See https://github.com/libfuse/libfuse
  *
  * Currently it is only expected to work on Linux.
  */
@@ -21,7 +21,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with this file; if not, see http://www.gnu.org/licenses/.
+ * along with this file; if not, see https://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -33,7 +33,7 @@
 
 #ifdef WITH_FUSE
 
-#ifdef __WIN32__
+#ifdef _WIN32
 #  error "FUSE mount not supported on Windows!  Please configure --without-fuse"
 #endif
 
@@ -46,7 +46,6 @@
 #include <fuse.h>
 #include <limits.h>
 #include <mqueue.h>
-#include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
@@ -61,6 +60,7 @@
 #include "wimlib/paths.h"
 #include "wimlib/progress.h"
 #include "wimlib/reparse.h"
+#include "wimlib/threads.h"
 #include "wimlib/timestamp.h"
 #include "wimlib/unix_data.h"
 #include "wimlib/write.h"
@@ -669,7 +669,7 @@ create_staging_file(const struct wimfs_context *ctx, char **name_ret)
        name[STAGING_FILE_NAME_LEN] = '\0';
 
 retry:
-       randomize_char_array_with_alnum(name, STAGING_FILE_NAME_LEN);
+       get_random_alnum_chars(name, STAGING_FILE_NAME_LEN);
        fd = openat(ctx->staging_dir_fd, name,
                    O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
        if (unlikely(fd < 0)) {
@@ -853,7 +853,7 @@ make_staging_dir_at(int parent_dir_fd, const char *wim_basename,
        p = staging_dir_name;
        p = mempcpy(p, wim_basename, wim_basename_len);
        p = mempcpy(p, common_suffix, sizeof(common_suffix));
-       randomize_char_array_with_alnum(p, random_suffix_len);
+       get_random_alnum_chars(p, random_suffix_len);
        p += random_suffix_len;
        *p = '\0';
 
@@ -2036,7 +2036,7 @@ wimfs_write(const char *path, const char *buf, size_t size,
        return ret;
 }
 
-static struct fuse_operations wimfs_operations = {
+static const struct fuse_operations wimfs_operations = {
        .chmod       = wimfs_chmod,
        .chown       = wimfs_chown,
        .fgetattr    = wimfs_fgetattr,
@@ -2305,7 +2305,7 @@ generate_message_queue_name(char name[WIMFS_MQUEUE_NAME_LEN + 1])
 {
        name[0] = '/';
        memcpy(name + 1, "wimfs-", 6);
-       randomize_char_array_with_alnum(name + 7, WIMFS_MQUEUE_NAME_LEN - 7);
+       get_random_alnum_chars(name + 7, WIMFS_MQUEUE_NAME_LEN - 7);
        name[WIMFS_MQUEUE_NAME_LEN] = '\0';
 }
 
@@ -2390,7 +2390,7 @@ do_unmount_commit(const char *dir, int unmount_flags,
        struct wimfs_unmount_info unmount_info;
        mqd_t mq;
        struct commit_progress_thread_args args;
-       pthread_t commit_progress_tid;
+       struct thread commit_progress_tid;
        int ret;
 
        memset(&unmount_info, 0, sizeof(unmount_info));
@@ -2409,11 +2409,8 @@ do_unmount_commit(const char *dir, int unmount_flags,
                args.mq = mq;
                args.progfunc = progfunc;
                args.progctx = progctx;
-               ret = pthread_create(&commit_progress_tid, NULL,
-                                    commit_progress_thread_proc, &args);
-               if (ret) {
-                       errno = ret;
-                       ERROR_WITH_ERRNO("Can't create thread");
+               if (!thread_create(&commit_progress_tid,
+                                  commit_progress_thread_proc, &args)) {
                        ret = WIMLIB_ERR_NOMEM;
                        goto out_delete_mq;
                }
@@ -2427,7 +2424,7 @@ do_unmount_commit(const char *dir, int unmount_flags,
                /* Terminate the progress thread.  */
                char empty[1];
                mq_send(mq, empty, 0, 1);
-               pthread_join(commit_progress_tid, NULL);
+               thread_join(&commit_progress_tid);
        }
 out_delete_mq:
        if (progfunc) {
@@ -2518,7 +2515,7 @@ wimlib_unmount_image_with_progress(const char *dir, int unmount_flags,
 static int
 mount_unsupported_error(void)
 {
-#if defined(__WIN32__)
+#ifdef _WIN32
        ERROR("Sorry-- Mounting WIM images is not supported on Windows!");
 #else
        ERROR("wimlib was compiled with --without-fuse, which disables support "