+ const struct wimfs_context *ctx = wimfs_get_context();
+ const struct wim_inode *inode;
+ const struct wim_inode_stream *strm;
+ const struct blob_descriptor *blob;
+
+ if (!strncmp(name, "wimfs.", 6)) {
+ /* Handle some magical extended attributes. These really should
+ * be ioctls, but directory ioctls aren't supported until
+ * libfuse 2.9, and even then they are broken. */
+ name += 6;
+ if (!strcmp(name, "wim_filename")) {
+ return copy_xattr(value, size, ctx->wim->filename,
+ strlen(ctx->wim->filename));
+ }
+ if (!strcmp(name, "wim_info")) {
+ struct wimlib_wim_info info;
+
+ wimlib_get_wim_info(ctx->wim, &info);
+
+ return copy_xattr(value, size, &info, sizeof(info));
+ }
+ if (!strcmp(name, "mounted_image")) {
+ return copy_xattr(value, size,
+ &ctx->wim->current_image, sizeof(int));
+ }
+ if (!strcmp(name, "mount_flags")) {
+ return copy_xattr(value, size,
+ &ctx->mount_flags, sizeof(int));
+ }
+ if (!strcmp(name, "unmount")) {
+ if (!may_unmount_wimfs())
+ return -EPERM;
+ if (size) {
+ int status;
+
+ if (size < sizeof(int))
+ return -ERANGE;
+ status = unmount_wimfs();
+ memcpy(value, &status, sizeof(int));
+ }
+ return sizeof(int);
+ }
+ return -ENOATTR;
+ }