fs: add FUSE_SD support
diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig
index 0cf160a..de50c23 100644
--- a/fs/fuse/Kconfig
+++ b/fs/fuse/Kconfig
@@ -13,3 +13,8 @@
If you want to develop a userspace FS, or if you want to use
a filesystem based on FUSE, answer Y or M.
+
+config FUSE_SD
+ bool "FUSE emulated SD support"
+ depends on FUSE_FS
+ default n
diff --git a/fs/inode.c b/fs/inode.c
index 8de457e..4e6a49d 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1738,6 +1738,10 @@
return true;
if (ns_capable(ns, CAP_FOWNER))
return true;
+#ifdef CONFIG_FUSE_SD
+ if (current_user_ns() == ns && inode->i_gid == AID_SDCARD_RW)
+ return true;
+#endif
return false;
}
EXPORT_SYMBOL(inode_owner_or_capable);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3b44026..a0d1978 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -762,6 +762,10 @@
#define IOP_LOOKUP 0x0002
#define IOP_NOFOLLOW 0x0004
+#ifdef CONFIG_FUSE_SD
+#define AID_SDCARD_RW 1015
+#endif
+
/*
* Keep mostly read-only and often accessed (especially for
* the RCU path lookup and 'stat' data) fields at the beginning