+static int wimfs_chmod(const char *path, mode_t mask)
+{
+ struct dentry *dentry;
+ struct wimfs_context *ctx = wimfs_get_context();
+ struct inode *inode;
+ struct stat stbuf;
+ int ret;
+
+ ret = lookup_resource(ctx->wim, path,
+ get_lookup_flags(ctx) | LOOKUP_FLAG_DIRECTORY_OK,
+ &dentry, NULL, NULL);
+ if (ret != 0)
+ return ret;
+ inode = dentry->d_inode;
+ inode_to_stbuf(inode, NULL, &stbuf);
+ if (mask == stbuf.st_mode)
+ return 0;
+ else
+ return -EPERM;
+
+}
+