It has been tested on x86 (32-bit) GNU/Linux occasionally.
-wimlib may work on FreeBSD. However, this not well tested. If you do not have
-libntfs-3g 2011-4-12 or later available, you may have to configure with
+wimlib may work on FreeBSD. However, this is not well tested. If you do not
+have libntfs-3g 2011-4-12 or later available, you must configure with
--without-ntfs-3g. Also, GNU coreutils is needed to run the test suite. Before
mounting a WIM you need to load the POSIX message queue module (run `kldload
-mqueuefs'). There is no `fusermount' command on FreeBSD, so you must use
-`umount' rather than `imagex unmount' to unmount a mounted WIM, but this won't
-allow you to commit changes to a read-write mounted WIM...
+mqueuefs').
wimlib should work on big endian machines but it has not been tested.
#include "wimlib_internal.h"
#ifdef WITH_FUSE
+
#include "sha1.h"
#include "lookup_table.h"
#include "xml.h"
int msgsize;
int errno_save;
+ mount_dir = dir;
+
+ /* Open message queues between the unmount process and the
+ * filesystem daemon. */
+ ret = open_message_queues(false);
+ if (ret != 0)
+ return ret;
+
+ /* Send a message to the filesystem saying whether to commit or
+ * not. */
+ msg[0] = (flags & WIMLIB_UNMOUNT_FLAG_COMMIT) ? 1 : 0;
+ msg[1] = (flags & WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY) ? 1 : 0;
+
+ DEBUG("Sending message: %s, %s",
+ (msg[0] == 0) ? "don't commit" : "commit",
+ (msg[1] == 0) ? "don't check" : "check");
+ ret = mq_send(unmount_to_daemon_mq, msg, 2, 1);
+ if (ret == -1) {
+ ERROR("Failed to notify filesystem daemon whether we want to "
+ "commit changes or not");
+ close_message_queues();
+ return WIMLIB_ERR_MQUEUE;
+ }
+
/* Execute `fusermount -u', which is installed setuid root, to unmount
* the WIM.
*
* the WIM file.
*/
- mount_dir = dir;
pid = fork();
if (pid == -1) {
if (pid == 0) {
execlp("fusermount", "fusermount", "-u", dir, NULL);
ERROR_WITH_ERRNO("Failed to execute `fusermount'");
- return WIMLIB_ERR_FUSERMOUNT;
+ exit(WIMLIB_ERR_FUSERMOUNT);
}
- ret = waitpid(pid, &status, 0);
+ ret = wait(&status);
if (ret == -1) {
ERROR_WITH_ERRNO("Failed to wait for fusermount process to "
"terminate");
if (status != 0) {
ERROR("fusermount exited with status %d", status);
- return WIMLIB_ERR_FUSERMOUNT;
- }
- /* Open message queues between the unmount process and the
- * filesystem daemon. */
- ret = open_message_queues(false);
- if (ret != 0)
- return ret;
+ /* Try again, but with the `umount' program. This is required
+ * on other FUSE implementations such as FreeBSD's that do not
+ * have a `fusermount' program. */
- /* Send a message to the filesystem saying whether to commit or
- * not. */
- msg[0] = (flags & WIMLIB_UNMOUNT_FLAG_COMMIT) ? 1 : 0;
- msg[1] = (flags & WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY) ? 1 : 0;
+ pid = fork();
+ if (pid == -1) {
+ ERROR_WITH_ERRNO("Failed to fork()");
+ return WIMLIB_ERR_FORK;
+ }
+ if (pid == 0) {
+ execlp("umount", "umount", dir, NULL);
+ ERROR_WITH_ERRNO("Failed to execute `umount'");
+ exit(WIMLIB_ERR_FUSERMOUNT);
+ }
- DEBUG("Sending message: %s, %s",
- (msg[0] == 0) ? "don't commit" : "commit",
- (msg[1] == 0) ? "don't check" : "check");
- ret = mq_send(unmount_to_daemon_mq, msg, 2, 1);
- if (ret == -1) {
- ERROR("Failed to notify filesystem daemon whether we want to "
- "commit changes or not");
- close_message_queues();
- return WIMLIB_ERR_MQUEUE;
+ ret = wait(&status);
+ if (ret == -1) {
+ ERROR_WITH_ERRNO("Failed to wait for `umount' process to "
+ "terminate");
+ return WIMLIB_ERR_FUSERMOUNT;
+ }
+ if (status != 0) {
+ ERROR("`umount' exited with failure status");
+ return WIMLIB_ERR_FUSERMOUNT;
+ }
}
+
/* Wait for a message from the filesytem daemon indicating whether the
* filesystem was unmounted successfully (0) or an error occurred (1).
* This may take a long time if a big WIM file needs to be rewritten. */