[Btrfs-devel][PATCH]Fix compile on 2.6.22 kernel

Yan Zheng yanzheng at 21cn.com
Wed Jan 16 10:09:55 PST 2008


Hello,

This patch fixes compile error on kernel-2.6.22

Regards
YZ
---
diff -r ec7241de3db5 acl.c
--- a/acl.c	Tue Jan 15 10:33:12 2008 -0500
+++ b/acl.c	Thu Jan 17 01:32:09 2008 +0800
@@ -22,6 +22,11 @@
 #include <linux/posix_acl_xattr.h>
 #include "ctree.h"
 #include "xattr.h"
+#ifndef is_owner_or_cap
+#define is_owner_or_cap(inode)	\
+	((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER))
+#endif
+
 static int btrfs_xattr_set_acl(struct inode *inode, int type,
 			       const void *value, size_t size)
 {
diff -r ec7241de3db5 inode.c
--- a/inode.c	Tue Jan 15 10:33:12 2008 -0500
+++ b/inode.c	Thu Jan 17 01:32:09 2008 +0800
@@ -2302,12 +2302,14 @@ static int create_snapshot(struct btrfs_
 		ret = -ENOMEM;
 		goto fail_unlock;
 	}
-	pending_snapshot->name = kstrndup(name, namelen, GFP_NOFS);
+	pending_snapshot->name = kmalloc(namelen + 1, GFP_NOFS);
 	if (!pending_snapshot->name) {
 		ret = -ENOMEM;
 		kfree(pending_snapshot);
 		goto fail_unlock;
 	}
+	memcpy(pending_snapshot->name, name, namelen);
+	pending_snapshot->name[namelen] = '\0';
 	trans = btrfs_start_transaction(root, 1);
 	BUG_ON(!trans);



More information about the Btrfs-devel mailing list