exfat_xattr.c 1017 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <linux/file.h>
  2. #include <linux/fs.h>
  3. #include <linux/xattr.h>
  4. #include <linux/dcache.h>
  5. #include "exfat.h"
  6. #ifndef CONFIG_EXFAT_VIRTUAL_XATTR_SELINUX_LABEL
  7. #define CONFIG_EXFAT_VIRTUAL_XATTR_SELINUX_LABEL ("undefined")
  8. #endif
  9. static const char default_xattr[] = CONFIG_EXFAT_VIRTUAL_XATTR_SELINUX_LABEL;
  10. int exfat_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) {
  11. if (!name || strcmp(name, "security.selinux"))
  12. return -EOPNOTSUPP;
  13. return 0;
  14. }
  15. ssize_t exfat_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) {
  16. if (!name || strcmp(name, "security.selinux"))
  17. return -EOPNOTSUPP;
  18. if (size > strlen(default_xattr)+1 && value)
  19. strcpy(value, default_xattr);
  20. return strlen(default_xattr);
  21. }
  22. ssize_t exfat_listxattr(struct dentry *dentry, char *list, size_t size) {
  23. return 0;
  24. }
  25. int exfat_removexattr(struct dentry *dentry, const char *name) {
  26. if (!name || strcmp(name, "security.selinux"))
  27. return -EOPNOTSUPP;
  28. return 0;
  29. }