hfsplus: add support of manipulation by attributes file
[firefly-linux-kernel-4.4.55.git] / fs / hfsplus / inode.c
index dcd05be5344b8ff6d8cebbca3bac213b04005f1b..160ccc9cdb4be2da98633eee6c7e5d94116e5c43 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "hfsplus_fs.h"
 #include "hfsplus_raw.h"
+#include "xattr.h"
 
 static int hfsplus_readpage(struct file *file, struct page *page)
 {
@@ -348,6 +349,18 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
                        error = error2;
        }
 
+       if (test_and_clear_bit(HFSPLUS_I_ATTR_DIRTY, &hip->flags)) {
+               if (sbi->attr_tree) {
+                       error2 =
+                               filemap_write_and_wait(
+                                           sbi->attr_tree->inode->i_mapping);
+                       if (!error)
+                               error = error2;
+               } else {
+                       printk(KERN_ERR "hfs: sync non-existent attributes tree\n");
+               }
+       }
+
        if (test_and_clear_bit(HFSPLUS_I_ALLOC_DIRTY, &hip->flags)) {
                error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping);
                if (!error)
@@ -365,9 +378,10 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
 static const struct inode_operations hfsplus_file_inode_operations = {
        .lookup         = hfsplus_file_lookup,
        .setattr        = hfsplus_setattr,
-       .setxattr       = hfsplus_setxattr,
-       .getxattr       = hfsplus_getxattr,
+       .setxattr       = generic_setxattr,
+       .getxattr       = generic_getxattr,
        .listxattr      = hfsplus_listxattr,
+       .removexattr    = hfsplus_removexattr,
 };
 
 static const struct file_operations hfsplus_file_operations = {