[Tux3] [PATCH] tux3: fix compile error in linus-git

OGAWA Hirofumi hirofumi at mail.parknet.co.jp
Wed Jan 7 07:25:49 PST 2009


Daniel Phillips <phillips at phunq.net> writes:

>> > Your patch breaks the user space compile because your macro definitions
>> > appear outside the __KERNEL__ macro.  Could you try this version?
>> 
>> Yes, It is OK, and better than my version.
>
> OK, committed with credit to you.

COW credential was added after 2.6.28. And we shouldn't add needless #ifdef.
[BTW, if we really want to do this, we should add compat layer like
compat.h of external network drivers.]

Thanks.
-- 
OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>


Cleanup/Fix COW credential

COW credential was added after 2.6.28. And if we really want to do
this, we should add compat layer like compat.h of external network
drivers.

diff -puN user/kernel/tux3.h~cow-cred-cleanup user/kernel/tux3.h
--- tux3/user/kernel/tux3.h~cow-cred-cleanup	2009-01-08 00:00:55.000000000 +0900
+++ tux3-hirofumi/user/kernel/tux3.h	2009-01-08 00:07:36.000000000 +0900
@@ -10,8 +10,9 @@
 #include <linux/buffer_head.h>
 #include <linux/mutex.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-#include <linux/cred.h> // fsuid
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+#define current_fsuid()	({ current->fsuid; })
+#define current_fsgid()	({ current->fsgid; })
 #endif
 
 typedef loff_t block_t;
diff -puN user/kernel/inode.c~cow-cred-cleanup user/kernel/inode.c
--- tux3/user/kernel/inode.c~cow-cred-cleanup	2009-01-08 00:02:54.000000000 +0900
+++ tux3-hirofumi/user/kernel/inode.c	2009-01-08 00:03:00.000000000 +0900
@@ -455,13 +455,8 @@ static void tux_setup_inode(struct inode
 struct inode *tux_create_inode(struct inode *dir, int mode, dev_t rdev)
 {
 	struct tux_iattr iattr = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
 		.uid	= current_fsuid(),
 		.gid	= current_fsgid(),
-#else
-		.uid	= current->fsuid,
-		.gid	= current->fsgid,
-#endif
 		.mode	= mode,
 	};
 	struct inode *inode = tux_new_inode(dir, &iattr, rdev);
_

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list