#define FUSE_USE_VERSION 26
-#include <sys/types.h> /* sometimes required before <attr/xattr.h> */
-
-#include <attr/xattr.h>
+#include <sys/types.h> /* sometimes required before <sys/xattr.h> */
+#include <sys/xattr.h>
#include <dirent.h>
#include <errno.h>
#include <fuse.h>
#include <limits.h>
#include <mqueue.h>
-#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#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"
# define O_NOFOLLOW 0 /* Security only... */
#endif
+#ifndef ENOATTR
+# define ENOATTR ENODATA
+#endif
+
#define WIMFS_MQUEUE_NAME_LEN 32
#define WIMLIB_UNMOUNT_FLAG_SEND_PROGRESS 0x80000000
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)) {
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';
return ret;
}
-static struct fuse_operations wimfs_operations = {
+static const struct fuse_operations wimfs_operations = {
.chmod = wimfs_chmod,
.chown = wimfs_chown,
.fgetattr = wimfs_fgetattr,
{
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';
}
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));
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;
}
/* 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) {
int mount_flags;
int ret;
- ret = wimlib_global_init(WIMLIB_INIT_FLAG_ASSUME_UTF8);
+ ret = wimlib_global_init(0);
if (ret)
return ret;