diff options
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 8 | ||||
| -rw-r--r-- | include/linux/cred.h | 50 | ||||
| -rw-r--r-- | include/linux/sched.h | 1 |
5 files changed, 57 insertions, 8 deletions
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 3b7c4ff48ba0..cc0f7b3a9795 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
| @@ -126,8 +126,6 @@ | |||
| 126 | 126 | ||
| 127 | #define current_cpu() (raw_smp_processor_id()) | 127 | #define current_cpu() (raw_smp_processor_id()) |
| 128 | #define current_pid() (current->pid) | 128 | #define current_pid() (current->pid) |
| 129 | #define current_fsuid(cred) (current->fsuid) | ||
| 130 | #define current_fsgid(cred) (current->fsgid) | ||
| 131 | #define current_test_flags(f) (current->flags & (f)) | 129 | #define current_test_flags(f) (current->flags & (f)) |
| 132 | #define current_set_flags_nested(sp, f) \ | 130 | #define current_set_flags_nested(sp, f) \ |
| 133 | (*(sp) = current->flags, current->flags |= (f)) | 131 | (*(sp) = current->flags, current->flags |= (f)) |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 358511b85ced..00e80df9dd9d 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -1081,8 +1081,8 @@ xfs_ialloc( | |||
| 1081 | ip->i_d.di_onlink = 0; | 1081 | ip->i_d.di_onlink = 0; |
| 1082 | ip->i_d.di_nlink = nlink; | 1082 | ip->i_d.di_nlink = nlink; |
| 1083 | ASSERT(ip->i_d.di_nlink == nlink); | 1083 | ASSERT(ip->i_d.di_nlink == nlink); |
| 1084 | ip->i_d.di_uid = current_fsuid(cr); | 1084 | ip->i_d.di_uid = current_fsuid(); |
| 1085 | ip->i_d.di_gid = current_fsgid(cr); | 1085 | ip->i_d.di_gid = current_fsgid(); |
| 1086 | ip->i_d.di_projid = prid; | 1086 | ip->i_d.di_projid = prid; |
| 1087 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); | 1087 | memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); |
| 1088 | 1088 | ||
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 588bb4aa215d..aa238c8fbd7a 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -182,7 +182,7 @@ xfs_setattr( | |||
| 182 | xfs_ilock(ip, lock_flags); | 182 | xfs_ilock(ip, lock_flags); |
| 183 | 183 | ||
| 184 | /* boolean: are we the file owner? */ | 184 | /* boolean: are we the file owner? */ |
| 185 | file_owner = (current_fsuid(credp) == ip->i_d.di_uid); | 185 | file_owner = (current_fsuid() == ip->i_d.di_uid); |
| 186 | 186 | ||
| 187 | /* | 187 | /* |
| 188 | * Change various properties of a file. | 188 | * Change various properties of a file. |
| @@ -1533,7 +1533,7 @@ xfs_create( | |||
| 1533 | * Make sure that we have allocated dquot(s) on disk. | 1533 | * Make sure that we have allocated dquot(s) on disk. |
| 1534 | */ | 1534 | */ |
| 1535 | error = XFS_QM_DQVOPALLOC(mp, dp, | 1535 | error = XFS_QM_DQVOPALLOC(mp, dp, |
| 1536 | current_fsuid(credp), current_fsgid(credp), prid, | 1536 | current_fsuid(), current_fsgid(), prid, |
| 1537 | XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp); | 1537 | XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp); |
| 1538 | if (error) | 1538 | if (error) |
| 1539 | goto std_return; | 1539 | goto std_return; |
| @@ -2269,7 +2269,7 @@ xfs_mkdir( | |||
| 2269 | * Make sure that we have allocated dquot(s) on disk. | 2269 | * Make sure that we have allocated dquot(s) on disk. |
| 2270 | */ | 2270 | */ |
| 2271 | error = XFS_QM_DQVOPALLOC(mp, dp, | 2271 | error = XFS_QM_DQVOPALLOC(mp, dp, |
| 2272 | current_fsuid(credp), current_fsgid(credp), prid, | 2272 | current_fsuid(), current_fsgid(), prid, |
| 2273 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); | 2273 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); |
| 2274 | if (error) | 2274 | if (error) |
| 2275 | goto std_return; | 2275 | goto std_return; |
| @@ -2495,7 +2495,7 @@ xfs_symlink( | |||
| 2495 | * Make sure that we have allocated dquot(s) on disk. | 2495 | * Make sure that we have allocated dquot(s) on disk. |
| 2496 | */ | 2496 | */ |
| 2497 | error = XFS_QM_DQVOPALLOC(mp, dp, | 2497 | error = XFS_QM_DQVOPALLOC(mp, dp, |
| 2498 | current_fsuid(credp), current_fsgid(credp), prid, | 2498 | current_fsuid(), current_fsgid(), prid, |
| 2499 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); | 2499 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); |
| 2500 | if (error) | 2500 | if (error) |
| 2501 | goto std_return; | 2501 | goto std_return; |
diff --git a/include/linux/cred.h b/include/linux/cred.h new file mode 100644 index 000000000000..b69222cc1fd2 --- /dev/null +++ b/include/linux/cred.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* Credentials management | ||
| 2 | * | ||
| 3 | * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. | ||
| 4 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public Licence | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the Licence, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _LINUX_CRED_H | ||
| 13 | #define _LINUX_CRED_H | ||
| 14 | |||
| 15 | #define get_current_user() (get_uid(current->user)) | ||
| 16 | |||
| 17 | #define task_uid(task) ((task)->uid) | ||
| 18 | #define task_gid(task) ((task)->gid) | ||
| 19 | #define task_euid(task) ((task)->euid) | ||
| 20 | #define task_egid(task) ((task)->egid) | ||
| 21 | |||
| 22 | #define current_uid() (current->uid) | ||
| 23 | #define current_gid() (current->gid) | ||
| 24 | #define current_euid() (current->euid) | ||
| 25 | #define current_egid() (current->egid) | ||
| 26 | #define current_suid() (current->suid) | ||
| 27 | #define current_sgid() (current->sgid) | ||
| 28 | #define current_fsuid() (current->fsuid) | ||
| 29 | #define current_fsgid() (current->fsgid) | ||
| 30 | #define current_cap() (current->cap_effective) | ||
| 31 | |||
| 32 | #define current_uid_gid(_uid, _gid) \ | ||
| 33 | do { \ | ||
| 34 | *(_uid) = current->uid; \ | ||
| 35 | *(_gid) = current->gid; \ | ||
| 36 | } while(0) | ||
| 37 | |||
| 38 | #define current_euid_egid(_uid, _gid) \ | ||
| 39 | do { \ | ||
| 40 | *(_uid) = current->euid; \ | ||
| 41 | *(_gid) = current->egid; \ | ||
| 42 | } while(0) | ||
| 43 | |||
| 44 | #define current_fsuid_fsgid(_uid, _gid) \ | ||
| 45 | do { \ | ||
| 46 | *(_uid) = current->fsuid; \ | ||
| 47 | *(_gid) = current->fsgid; \ | ||
| 48 | } while(0) | ||
| 49 | |||
| 50 | #endif /* _LINUX_CRED_H */ | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 5850bfb968a8..cfb0d87b99fc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -87,6 +87,7 @@ struct sched_param { | |||
| 87 | #include <linux/task_io_accounting.h> | 87 | #include <linux/task_io_accounting.h> |
| 88 | #include <linux/kobject.h> | 88 | #include <linux/kobject.h> |
| 89 | #include <linux/latencytop.h> | 89 | #include <linux/latencytop.h> |
| 90 | #include <linux/cred.h> | ||
| 90 | 91 | ||
| 91 | #include <asm/processor.h> | 92 | #include <asm/processor.h> |
| 92 | 93 | ||
