-/* The WIMStruct for the mounted WIM. */
-static WIMStruct *w;
-
-/* Working directory when `imagex mount' is run. */
-static const char *working_directory;
-
-/* Name of the staging directory for a read-write mount. Whenever a new file is
- * created, it is done so in the staging directory. Furthermore, whenever a
- * file in the WIM is modified, it is extracted to the staging directory. If
- * changes are commited when the WIM is unmounted, the file resources are merged
- * in from the staging directory when writing the new WIM. */
-static char *staging_dir_name;
-static size_t staging_dir_name_len;
+struct wimfs_context {
+ /* The WIMStruct for the mounted WIM. */
+ WIMStruct *wim;
+
+ /* Name of the staging directory for a read-write mount. Whenever a new file is
+ * created, it is done so in the staging directory. Furthermore, whenever a
+ * file in the WIM is modified, it is extracted to the staging directory. If
+ * changes are commited when the WIM is unmounted, the file resources are merged
+ * in from the staging directory when writing the new WIM. */
+ char *staging_dir_name;
+ size_t staging_dir_name_len;
+
+ /* Flags passed to wimlib_mount(). */
+ int mount_flags;
+
+ /* Next inode number to be assigned. */
+ u64 next_ino;
+
+ /* List of lookup table entries in the staging directory */
+ struct list_head staging_list;
+
+ /* Name and message queue descriptors for message queues between the filesystem
+ * daemon process and the unmount process. These are used when the filesystem
+ * is unmounted and the process running wimlib_mount() (i.e. the `imagex
+ * unmount' command) needs to communicate with the filesystem daemon running
+ * fuse_main() (i.e. that spawned by the `imagex mount' or `imagex mountrw'
+ * commands */
+ char *unmount_to_daemon_mq_name;
+ char *daemon_to_unmount_mq_name;
+ mqd_t unmount_to_daemon_mq;
+ mqd_t daemon_to_unmount_mq;
+};