summaryrefslogtreecommitdiff
path: root/net-fs
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-03-24 04:24:42 +0000
committerMike Frysinger <vapier@gentoo.org>2013-03-24 04:24:42 +0000
commit2de10bce02619e34623e73d9b9ac7cdd31382265 (patch)
tree18194032fe8f0941da232c4a69fdafe6ce623b65 /net-fs
parentVersion bumps #460646 by Andrej Filipcic. (diff)
downloadgentoo-2-2de10bce02619e34623e73d9b9ac7cdd31382265.tar.gz
gentoo-2-2de10bce02619e34623e73d9b9ac7cdd31382265.tar.bz2
gentoo-2-2de10bce02619e34623e73d9b9ac7cdd31382265.zip
Version bump #460646 by Andrej Filipcic.
(Portage version: 2.2.0_alpha164/cvs/Linux x86_64, signed Manifest commit with key FB7C4156)
Diffstat (limited to 'net-fs')
-rw-r--r--net-fs/openafs-kernel/ChangeLog12
-rw-r--r--net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-1.patch366
-rw-r--r--net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-2.patch137
-rw-r--r--net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-3.patch80
-rw-r--r--net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-4.patch37
-rw-r--r--net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-5.patch65
-rw-r--r--net-fs/openafs-kernel/openafs-kernel-1.6.2.ebuild89
7 files changed, 785 insertions, 1 deletions
diff --git a/net-fs/openafs-kernel/ChangeLog b/net-fs/openafs-kernel/ChangeLog
index ea5f2b4e60c8..250f8b12566d 100644
--- a/net-fs/openafs-kernel/ChangeLog
+++ b/net-fs/openafs-kernel/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for net-fs/openafs-kernel
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-fs/openafs-kernel/ChangeLog,v 1.146 2013/03/17 15:56:08 hwoarang Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-fs/openafs-kernel/ChangeLog,v 1.147 2013/03/24 04:24:42 vapier Exp $
+
+*openafs-kernel-1.6.2 (24 Mar 2013)
+
+ 24 Mar 2013; Mike Frysinger <vapier@gentoo.org>
+ +files/openafs-1.6.2-kernel-3.8-1.patch,
+ +files/openafs-1.6.2-kernel-3.8-2.patch,
+ +files/openafs-1.6.2-kernel-3.8-3.patch,
+ +files/openafs-1.6.2-kernel-3.8-4.patch,
+ +files/openafs-1.6.2-kernel-3.8-5.patch, +openafs-kernel-1.6.2.ebuild:
+ Version bump #460646 by Andrej Filipcic.
17 Mar 2013; Markos Chandras <hwoarang@gentoo.org> metadata.xml:
Add proxy-maintainers to metadata.xml
diff --git a/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-1.patch b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-1.patch
new file mode 100644
index 000000000000..125bc4e6e8af
--- /dev/null
+++ b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-1.patch
@@ -0,0 +1,366 @@
+From bb75426b891ac03f2baa0abfaf565d12e026f35d Mon Sep 17 00:00:00 2001
+From: Andrew Deason <adeason@sinenomine.net>
+Date: Wed, 29 Aug 2012 11:34:06 -0500
+Subject: [PATCH] LINUX: Indent osi_machdep.h maze
+
+This one isn't so bad, actually, but it still benefits from some
+indentation.
+
+Reviewed-on: http://gerrit.openafs.org/8018
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Derrick Brashear <shadow@dementix.org>
+(cherry picked from commit 579048cb1ec24b09a869928ceb521c8db4201a43)
+
+Change-Id: I91bddcafe4141c5e6789b01cc4be1a879b6464d1
+---
+ src/afs/LINUX/osi_machdep.h | 240 +++++++++++++++++++++---------------------
+ 1 files changed, 120 insertions(+), 120 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index a2c16f5..9260733 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -17,60 +17,60 @@
+
+ #include <linux/version.h>
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
+-#define AFS_LINUX26_ONEGROUP_ENV 1
++# define AFS_LINUX26_ONEGROUP_ENV 1
+ #endif
+
+ /* Only needed for xdr.h in glibc 2.1.x */
+ #ifndef quad_t
+-#define quad_t __quad_t
+-#define u_quad_t __u_quad_t
++# define quad_t __quad_t
++# define u_quad_t __u_quad_t
+ #endif
+
+ #undef getuerror
+
+ #ifdef STRUCT_TASK_STRUCT_HAS_TGID
+-#define getpid() current->tgid
+-#ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+-#define getppid() current->real_parent->tgid
+-#elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
+-#define getppid() current->parent->tgid
+-#else
+-#define getppid() current->p_opptr->tgid
+-#endif
++# define getpid() current->tgid
++# ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
++# define getppid() current->real_parent->tgid
++# elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
++# define getppid() current->parent->tgid
++# else
++# define getppid() current->p_opptr->tgid
++# endif
+ #else /* !STRUCT_TASK_STRUCT_HAS_TGID */
+-#define getpid() current->pid
+-#ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
+-#define getppid() current->real_parent->pid
+-#elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
+-#define getppid() current->parent->pid
+-#else
+-#define getppid() current->p_opptr->pid
+-#endif
++# define getpid() current->pid
++# ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
++# define getppid() current->real_parent->pid
++# elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
++# define getppid() current->parent->pid
++# else
++# define getppid() current->p_opptr->pid
++# endif
+ #endif /* STRUCT_TASK_STRUCT_HAS_TGID */
+
+ #ifdef RECALC_SIGPENDING_TAKES_VOID
+-#define RECALC_SIGPENDING(X) recalc_sigpending()
++# define RECALC_SIGPENDING(X) recalc_sigpending()
+ #else
+-#define RECALC_SIGPENDING(X) recalc_sigpending(X)
++# define RECALC_SIGPENDING(X) recalc_sigpending(X)
+ #endif
+
+ #if defined (STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK)
+-#define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
++# define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
++# define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
+ #elif defined (STRUCT_TASK_STRUCT_HAS_SIGHAND)
+-#define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
++# define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
++# define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
+ #else
+-#define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
++# define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
++# define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
+ #endif
+
+ #if defined (STRUCT_TASK_STRUCT_HAS_RLIM)
+-#define TASK_STRUCT_RLIM rlim
++# define TASK_STRUCT_RLIM rlim
+ #elif defined (STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM)
+-#define TASK_STRUCT_RLIM signal->rlim
++# define TASK_STRUCT_RLIM signal->rlim
+ #else
+-#error Not sure what to do about rlim (should be in the Linux task struct somewhere....)
++# error Not sure what to do about rlim (should be in the Linux task struct somewhere....)
+ #endif
+
+
+@@ -83,13 +83,13 @@ static inline time_t osi_Time(void) {
+ return xtime.tv_sec;
+ }
+ #else
+-#define osi_Time() (xtime.tv_sec)
++# define osi_Time() (xtime.tv_sec)
+ #endif
+
+
+
+ #ifdef AFS_LINUX_64BIT_KERNEL
+-#define osi_GetTime(V) \
++# define osi_GetTime(V) \
+ do { \
+ struct timeval __afs_tv; \
+ do_gettimeofday(&__afs_tv); \
+@@ -97,7 +97,7 @@ static inline time_t osi_Time(void) {
+ (V)->tv_usec = (afs_int32)__afs_tv.tv_usec; \
+ } while (0)
+ #else
+-#define osi_GetTime(V) do_gettimeofday((V))
++# define osi_GetTime(V) do_gettimeofday((V))
+ #endif
+
+ #undef gop_lookupname
+@@ -149,12 +149,12 @@ typedef struct task_struct afs_proc_t;
+ typedef struct cred afs_ucred_t;
+ typedef struct cred cred_t;
+
+-#define afs_cr_uid(cred) ((cred)->fsuid)
+-#define afs_cr_gid(cred) ((cred)->fsgid)
+-#define afs_cr_ruid(cred) ((cred)->uid)
+-#define afs_cr_rgid(cred) ((cred)->gid)
+-#define afs_cr_group_info(cred) ((cred)->group_info)
+-#define crhold(c) (get_cred(c))
++# define afs_cr_uid(cred) ((cred)->fsuid)
++# define afs_cr_gid(cred) ((cred)->fsgid)
++# define afs_cr_ruid(cred) ((cred)->uid)
++# define afs_cr_rgid(cred) ((cred)->gid)
++# define afs_cr_group_info(cred) ((cred)->group_info)
++# define crhold(c) (get_cred(c))
+ static inline void
+ afs_set_cr_uid(cred_t *cred, uid_t uid) {
+ cred->fsuid = uid;
+@@ -176,11 +176,11 @@ afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) {
+ cred->group_info = group_info;
+ }
+
+-#define current_group_info() (current->cred->group_info)
+-#define task_gid(task) (task->cred->gid)
+-#define task_user(task) (task->cred->user)
+-#define task_session_keyring(task) (task->cred->tgcred->session_keyring)
+-#define current_session_keyring() (current->cred->tgcred->session_keyring)
++# define current_group_info() (current->cred->group_info)
++# define task_gid(task) (task->cred->gid)
++# define task_user(task) (task->cred->user)
++# define task_session_keyring(task) (task->cred->tgcred->session_keyring)
++# define current_session_keyring() (current->cred->tgcred->session_keyring)
+
+ #else
+
+@@ -194,31 +194,31 @@ typedef struct afs_cred {
+ } cred_t;
+
+ typedef struct afs_cred afs_ucred_t;
+-#define afs_cr_group_info(cred) ((cred)->cr_group_info)
++# define afs_cr_group_info(cred) ((cred)->cr_group_info)
+ static inline void
+ afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) {
+ cred->cr_group_info = group_info;
+ }
+
+-#define current_group_info() (current->group_info)
+-#if !defined(task_gid)
+-#define task_gid(task) (task->gid)
+-#endif
+-#if !defined(task_uid)
+-#define task_uid(task) (task->uid)
+-#endif
+-#define task_user(task) (task->user)
+-#define task_session_keyring(task) (task->signal->session_keyring)
+-#define current_session_keyring() (current->signal->session_keyring)
+-#define crhold(c) atomic_inc(&(c)->cr_ref)
++# define current_group_info() (current->group_info)
++# if !defined(task_gid)
++# define task_gid(task) (task->gid)
++# endif
++# if !defined(task_uid)
++# define task_uid(task) (task->uid)
++# endif
++# define task_user(task) (task->user)
++# define task_session_keyring(task) (task->signal->session_keyring)
++# define current_session_keyring() (current->signal->session_keyring)
++# define crhold(c) atomic_inc(&(c)->cr_ref)
+
+ #endif /* defined(STRUCT_TASK_STRUCT_HAS_CRED) */
+
+ #if !defined(current_cred)
+-#define current_gid() (current->gid)
+-#define current_uid() (current->uid)
+-#define current_fsgid() (current->fsgid)
+-#define current_fsuid() (current->fsuid)
++# define current_gid() (current->gid)
++# define current_uid() (current->uid)
++# define current_fsgid() (current->fsgid)
++# define current_fsuid() (current->fsuid)
+ #endif
+
+ /* UIO manipulation */
+@@ -245,7 +245,7 @@ struct uio {
+ #define OSIFILE_INODE(a) FILE_INODE((a)->filp)
+
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+-#define NEED_IOCTL32
++# define NEED_IOCTL32
+ #endif
+
+ #include <linux/version.h>
+@@ -256,8 +256,8 @@ struct uio {
+ extern struct mutex afs_global_lock;
+ #else
+ extern struct semaphore afs_global_lock;
+-#define mutex_lock(lock) down(lock)
+-#define mutex_unlock(lock) up(lock)
++# define mutex_lock(lock) down(lock)
++# define mutex_unlock(lock) up(lock)
+ #endif
+ extern int afs_global_owner;
+
+@@ -285,63 +285,63 @@ do { \
+ #ifdef AFS_AMD64_LINUX20_ENV
+ /* RHEL5 beta's kernel doesn't define these. They aren't gonna change, so... */
+
+-#ifndef __NR_ia32_afs_syscall
+-#define __NR_ia32_afs_syscall 137
+-#endif
+-#ifndef __NR_ia32_setgroups
+-#define __NR_ia32_setgroups 81
+-#endif
+-#ifndef __NR_ia32_setgroups32
+-#define __NR_ia32_setgroups32 206
+-#endif
+-#ifndef __NR_ia32_close
+-#define __NR_ia32_close 6
+-#endif
+-#ifndef __NR_ia32_chdir
+-#define __NR_ia32_chdir 12
+-#endif
+-#ifndef __NR_ia32_break
+-#define __NR_ia32_break 17
+-#endif
+-#ifndef __NR_ia32_stty
+-#define __NR_ia32_stty 31
+-#endif
+-#ifndef __NR_ia32_gtty
+-#define __NR_ia32_gtty 32
+-#endif
+-#ifndef __NR_ia32_ftime
+-#define __NR_ia32_ftime 35
+-#endif
+-#ifndef __NR_ia32_prof
+-#define __NR_ia32_prof 44
+-#endif
+-#ifndef __NR_ia32_lock
+-#define __NR_ia32_lock 53
+-#endif
+-#ifndef __NR_ia32_mpx
+-#define __NR_ia32_mpx 56
+-#endif
+-#ifndef __NR_ia32_exit
+-#define __NR_ia32_exit 1
+-#endif
+-#ifndef __NR_ia32_mount
+-#define __NR_ia32_mount 21
+-#endif
+-#ifndef __NR_ia32_read
+-#define __NR_ia32_read 3
+-#endif
+-#ifndef __NR_ia32_write
+-#define __NR_ia32_write 4
+-#endif
+-#ifndef __NR_ia32_open
+-#define __NR_ia32_open 5
+-#endif
+-#ifndef __NR_ia32_close
+-#define __NR_ia32_close 6
+-#endif
+-#ifndef __NR_ia32_unlink
+-#define __NR_ia32_unlink 10
+-#endif
++# ifndef __NR_ia32_afs_syscall
++# define __NR_ia32_afs_syscall 137
++# endif
++# ifndef __NR_ia32_setgroups
++# define __NR_ia32_setgroups 81
++# endif
++# ifndef __NR_ia32_setgroups32
++# define __NR_ia32_setgroups32 206
++# endif
++# ifndef __NR_ia32_close
++# define __NR_ia32_close 6
++# endif
++# ifndef __NR_ia32_chdir
++# define __NR_ia32_chdir 12
++# endif
++# ifndef __NR_ia32_break
++# define __NR_ia32_break 17
++# endif
++# ifndef __NR_ia32_stty
++# define __NR_ia32_stty 31
++# endif
++# ifndef __NR_ia32_gtty
++# define __NR_ia32_gtty 32
++# endif
++# ifndef __NR_ia32_ftime
++# define __NR_ia32_ftime 35
++# endif
++# ifndef __NR_ia32_prof
++# define __NR_ia32_prof 44
++# endif
++# ifndef __NR_ia32_lock
++# define __NR_ia32_lock 53
++# endif
++# ifndef __NR_ia32_mpx
++# define __NR_ia32_mpx 56
++# endif
++# ifndef __NR_ia32_exit
++# define __NR_ia32_exit 1
++# endif
++# ifndef __NR_ia32_mount
++# define __NR_ia32_mount 21
++# endif
++# ifndef __NR_ia32_read
++# define __NR_ia32_read 3
++# endif
++# ifndef __NR_ia32_write
++# define __NR_ia32_write 4
++# endif
++# ifndef __NR_ia32_open
++# define __NR_ia32_open 5
++# endif
++# ifndef __NR_ia32_close
++# define __NR_ia32_close 6
++# endif
++# ifndef __NR_ia32_unlink
++# define __NR_ia32_unlink 10
++# endif
+ #endif
+
+ #define osi_procname(procname, size) strncpy(procname, current->comm, size)
+--
+1.7.2.5
+
diff --git a/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-2.patch b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-2.patch
new file mode 100644
index 000000000000..64ed5adfcb06
--- /dev/null
+++ b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-2.patch
@@ -0,0 +1,137 @@
+From eeaabffccffca0bf4c622819da62c6eaa51888bb Mon Sep 17 00:00:00 2001
+From: Marc Dionne <marc.c.dionne@gmail.com>
+Date: Wed, 9 Jan 2013 19:26:54 -0500
+Subject: [PATCH] Linux 3.8: session_keyring changes
+
+The session_keyring is now attached directly to the cred structure
+and the thread_group_cred structure (cred->tgcred) no longer exists.
+
+Adapt code that makes use of tgcred, and use the standard rcu based
+mechanism to update session_keyring.
+
+Reviewed-on: http://gerrit.openafs.org/8905
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
+(cherry picked from commit c6d27e322a8d3b352554650473a048235a9c763a)
+
+Change-Id: I048ed7b52062a5d666c78dba2599d5fb81c676c1
+---
+ acinclude.m4 | 1 +
+ src/afs/LINUX/osi_compat.h | 34 ++++++++++++++++++++++++++++++++--
+ src/afs/LINUX/osi_groups.c | 9 ++-------
+ src/afs/LINUX/osi_machdep.h | 9 +++++++--
+ 4 files changed, 42 insertions(+), 11 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 8c57779..0a05caa 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -812,6 +812,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+ [write_begin], [fs.h])
+ AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
+ [backing-dev.h])
++ AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
+ AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
+ AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
+ AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
+diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
+index 2dda136..a777542 100644
+--- a/src/afs/LINUX/osi_compat.h
++++ b/src/afs/LINUX/osi_compat.h
+@@ -186,14 +186,24 @@ afs_linux_key_alloc(struct key_type *type, const char *desc, uid_t uid,
+ }
+
+ # if defined(STRUCT_TASK_STRUCT_HAS_CRED)
++static inline struct key *
++afs_session_keyring(afs_ucred_t *cred)
++{
++# if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
++ return cred->session_keyring;
++# else
++ return cred->tgcred->session_keyring;
++# endif
++}
++
+ static inline struct key*
+ afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type)
+ {
+ key_ref_t key_ref;
+
+- if (cred->tgcred->session_keyring) {
++ if (afs_session_keyring(cred)) {
+ key_ref = keyring_search(
+- make_key_ref(cred->tgcred->session_keyring, 1),
++ make_key_ref(afs_session_keyring(cred), 1),
+ type, "_pag");
+ if (IS_ERR(key_ref))
+ return ERR_CAST(key_ref);
+@@ -507,4 +517,24 @@ afs_set_name(afs_name_t aname, char *string) {
+ }
+ #endif
+
++static_inline struct key *
++afs_set_session_keyring(struct key *keyring)
++{
++ struct key *old;
++#if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
++ struct cred *new_creds;
++ old = current_session_keyring();
++ new_creds = prepare_creds();
++ rcu_assign_pointer(new_creds->session_keyring, keyring);
++ commit_creds(new_creds);
++#else
++ spin_lock_irq(&current->sighand->siglock);
++ old = task_session_keyring(current);
++ smp_wmb();
++ task_session_keyring(current) = keyring;
++ spin_unlock_irq(&current->sighand->siglock);
++#endif
++ return old;
++}
++
+ #endif /* AFS_LINUX_OSI_COMPAT_H */
+diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c
+index c2a0308..e351344 100644
+--- a/src/afs/LINUX/osi_groups.c
++++ b/src/afs/LINUX/osi_groups.c
+@@ -214,14 +214,9 @@ install_session_keyring(struct key *keyring)
+ }
+
+ /* install the keyring */
+- spin_lock_irq(&current->sighand->siglock);
+- old = task_session_keyring(current);
+- smp_wmb();
+- task_session_keyring(current) = keyring;
+- spin_unlock_irq(&current->sighand->siglock);
+-
++ old = afs_set_session_keyring(keyring);
+ if (old)
+- key_put(old);
++ key_put(old);
+
+ out:
+ return code;
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 9260733..0202d0d 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -179,8 +179,13 @@ afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) {
+ # define current_group_info() (current->cred->group_info)
+ # define task_gid(task) (task->cred->gid)
+ # define task_user(task) (task->cred->user)
+-# define task_session_keyring(task) (task->cred->tgcred->session_keyring)
+-# define current_session_keyring() (current->cred->tgcred->session_keyring)
++# if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
++# define task_session_keyring(task) (task->cred->session_keyring)
++# define current_session_keyring() (current->cred->session_keyring)
++# else
++# define task_session_keyring(task) (task->cred->tgcred->session_keyring)
++# define current_session_keyring() (current->cred->tgcred->session_keyring)
++# endif
+
+ #else
+
+--
+1.7.2.5
+
diff --git a/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-3.patch b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-3.patch
new file mode 100644
index 000000000000..7aab040db769
--- /dev/null
+++ b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-3.patch
@@ -0,0 +1,80 @@
+From e18d900f585d2fe319d3c0f6d10c11dc0acefed4 Mon Sep 17 00:00:00 2001
+From: Marc Dionne <marc.c.dionne@gmail.com>
+Date: Wed, 9 Jan 2013 21:22:27 -0500
+Subject: [PATCH] Linux 3.8: vmtruncate removal
+
+vmtruncate had been deprecated for a while and has now been
+removed. Do things the new way based on truncate_setsize.
+
+Reviewed-on: http://gerrit.openafs.org/8906
+Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
+(cherry picked from commit d0479bbaf43900d6733c3f7517926ee9813c9610)
+
+Change-Id: Ie0065cb0ca817c1af5ed51418a0474012050f34d
+---
+ acinclude.m4 | 1 +
+ src/afs/LINUX/osi_compat.h | 14 ++++++++++++++
+ src/afs/LINUX/osi_vm.c | 5 ++---
+ 3 files changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 0a05caa..4223bb1 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -824,6 +824,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
+ AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
+ AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
+ AC_CHECK_LINUX_STRUCT([filename], [name], [fs.h])
++ AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
+ AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
+ AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
+ AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
+diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
+index a777542..e8bf003 100644
+--- a/src/afs/LINUX/osi_compat.h
++++ b/src/afs/LINUX/osi_compat.h
+@@ -537,4 +537,18 @@ afs_set_session_keyring(struct key *keyring)
+ return old;
+ }
+
++static inline int
++afs_truncate(struct inode *inode, int len)
++{
++ int code;
++#if defined(STRUCT_INODE_OPERATIONS_HAS_TRUNCATE)
++ code = vmtruncate(inode, len);
++#else
++ code = inode_newsize_ok(inode, len);
++ if (!code)
++ truncate_setsize(inode, len);
++#endif
++ return code;
++}
++
+ #endif /* AFS_LINUX_OSI_COMPAT_H */
+diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c
+index 2cd34f9..8bc792e 100644
+--- a/src/afs/LINUX/osi_vm.c
++++ b/src/afs/LINUX/osi_vm.c
+@@ -51,8 +51,7 @@ osi_VM_FlushVCache(struct vcache *avc, int *slept)
+ if (avc->opens != 0)
+ return EBUSY;
+
+- return vmtruncate(ip, 0);
+- return 0;
++ return afs_truncate(ip, 0);
+ }
+
+ /* Try to invalidate pages, for "fs flush" or "fs flushv"; or
+@@ -132,5 +131,5 @@ osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp)
+ void
+ osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
+ {
+- vmtruncate(AFSTOV(avc), alen);
++ afs_truncate(AFSTOV(avc), alen);
+ }
+--
+1.7.2.5
+
diff --git a/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-4.patch b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-4.patch
new file mode 100644
index 000000000000..d8cfbbbcdbb5
--- /dev/null
+++ b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-4.patch
@@ -0,0 +1,37 @@
+From 7e8731d4971f6c93c5edaf28d8582d6accc5c42c Mon Sep 17 00:00:00 2001
+From: Marc Dionne <marc.c.dionne@gmail.com>
+Date: Thu, 24 Jan 2013 21:38:28 -0500
+Subject: [PATCH] Linux: crset should use passed credentials
+
+When copying credentials in crset, take the passed credentials as
+the source instead of the current process credentials.
+
+This doesn't cause any problems currently since crset always gets
+called with the current credentials.
+
+Reviewed-on: http://gerrit.openafs.org/8980
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
+(cherry picked from commit 3b733db8bf2bc3a1366554ae97814cc722437149)
+
+Change-Id: I4d0000a139d16fafe480f7ebccc6759da7dea6bb
+---
+ src/afs/LINUX/osi_cred.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c
+index 20be594..f271321 100644
+--- a/src/afs/LINUX/osi_cred.c
++++ b/src/afs/LINUX/osi_cred.c
+@@ -117,7 +117,7 @@ crset(cred_t * cr)
+ new_creds = prepare_creds();
+ /* Drop the reference to group_info - we'll overwrite it in afs_copy_creds */
+ put_group_info(new_creds->group_info);
+- afs_copy_creds(new_creds, current_cred());
++ afs_copy_creds(new_creds, cr);
+
+ commit_creds(new_creds);
+ #else
+--
+1.7.2.5
+
diff --git a/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-5.patch b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-5.patch
new file mode 100644
index 000000000000..4a40f748d8a5
--- /dev/null
+++ b/net-fs/openafs-kernel/files/openafs-1.6.2-kernel-3.8-5.patch
@@ -0,0 +1,65 @@
+From 5f1d570c7bcafbda90bc5985b716fdb94e2aa10a Mon Sep 17 00:00:00 2001
+From: Marc Dionne <marc.c.dionne@gmail.com>
+Date: Sun, 27 Jan 2013 20:52:39 -0500
+Subject: [PATCH] Linux: Detect undefined symbols in kernel modules
+
+Undefined symbols in the kernel modules are not currently detected
+at build time. As a result, buildbot may indicate success while
+the resulting kernel modules are unusable.
+
+In the kernel build process, modpost warns about missing symbols
+but does not return an error in the case of external modules.
+Detect these warnings and cause the libafs build to fail.
+
+Reviewed-on: http://gerrit.openafs.org/8981
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
+Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
+(cherry picked from commit dbdee60a83d72d38a04a0eeb2a5324cf497e57e3)
+
+Change-Id: If28b97b6ce53b0feef2464a56fd7a48443c973ae
+---
+ src/libafs/.gitignore | 1 +
+ src/libafs/MakefileProto.LINUX.in | 10 +++++++++-
+ 2 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/src/libafs/.gitignore b/src/libafs/.gitignore
+index d87f88a..225e979 100644
+--- a/src/libafs/.gitignore
++++ b/src/libafs/.gitignore
+@@ -26,3 +26,4 @@
+ /rpc
+ /sys
+ /rx
++/.makelog
+diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in
+index 63b2f35..9449360 100644
+--- a/src/libafs/MakefileProto.LINUX.in
++++ b/src/libafs/MakefileProto.LINUX.in
+@@ -19,6 +19,8 @@ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+
++AFS_OS_CLEAN = .makelog
++
+ # OS specific object files:
+ AFS_OS_OBJS = \
+ osi_alloc.o \
+@@ -338,7 +340,13 @@ ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: ${LINUX_LIBAFS_NAME}.ko
+ .FORCE:
+ ${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE
+ env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common
+- env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules
++ env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules 2>&1 | tee .makelog
++ @if [ `grep ^WARNING .makelog | wc -l` -ne 0 ]; then \
++ echo Error: Undefined symbols in modules ; \
++ rm .makelog \
++ exit 1 ; \
++ fi
++ rm .makelog
+
+ <all -linux26 -linux_26 -umlinux26>
+ ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)
+--
+1.7.2.5
+
diff --git a/net-fs/openafs-kernel/openafs-kernel-1.6.2.ebuild b/net-fs/openafs-kernel/openafs-kernel-1.6.2.ebuild
new file mode 100644
index 000000000000..df7fdcb7081e
--- /dev/null
+++ b/net-fs/openafs-kernel/openafs-kernel-1.6.2.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/openafs-kernel/openafs-kernel-1.6.2.ebuild,v 1.1 2013/03/24 04:24:42 vapier Exp $
+
+EAPI="4"
+
+inherit eutils autotools multilib linux-mod versionator toolchain-funcs
+
+MY_PV=$(delete_version_separator '_')
+MY_PN=${PN/-kernel}
+MY_P2="${MY_PN}-${PV}"
+MY_P="${MY_PN}-${MY_PV}"
+PVER="1"
+DESCRIPTION="The OpenAFS distributed file system kernel module"
+HOMEPAGE="http://www.openafs.org/"
+# We always d/l the doc tarball as man pages are not USE=doc material
+SRC_URI="http://openafs.org/dl/openafs/${MY_PV}/${MY_P}-src.tar.bz2
+ mirror://gentoo/${MY_P2}-patches-${PVER}.tar.bz2"
+
+LICENSE="IBM BSD openafs-krb5-a APSL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE=""
+
+S=${WORKDIR}/${MY_P}
+
+CONFIG_CHECK="!DEBUG_RODATA ~!AFS_FS KEYS"
+ERROR_DEBUG_RODATA="OpenAFS is incompatible with linux' CONFIG_DEBUG_RODATA option"
+ERROR_AFS_FS="OpenAFS conflicts with the in-kernel AFS-support. Make sure not to load both at the same time!"
+ERROR_KEYS="OpenAFS needs CONFIG_KEYS option enabled"
+
+QA_TEXTRELS_x86_fbsd="/boot/modules/libafs.ko"
+QA_TEXTRELS_amd64_fbsd="/boot/modules/libafs.ko"
+
+pkg_setup() {
+ if use kernel_linux; then
+ linux-mod_pkg_setup
+ fi
+}
+
+src_prepare() {
+ EPATCH_EXCLUDE="012_all_kbuild.patch" \
+ EPATCH_SUFFIX="patch" \
+ epatch "${WORKDIR}"/gentoo/patches
+ epatch "${FILESDIR}"/openafs-1.6.2-kernel-3.8-{1..5}.patch
+
+ # packaging is f-ed up, so we can't run automake (i.e. eautoreconf)
+ sed -i 's/^\(\s*\)a/\1ea/' regen.sh
+ : # this line makes repoman ok with not calling eautoconf etc. directly
+ skipman=1
+ . regen.sh
+}
+
+src_configure() {
+ ARCH="$(tc-arch-kernel)" \
+ econf \
+ --with-linux-kernel-headers=${KV_DIR} \
+ --with-linux-kernel-build=${KV_OUT_DIR}
+}
+
+src_compile() {
+ ARCH="$(tc-arch-kernel)" emake -j1 only_libafs || die
+}
+
+src_install() {
+ if use kernel_linux; then
+ local srcdir=$(expr "${S}"/src/libafs/MODLOAD-*)
+ [[ -f ${srcdir}/libafs.${KV_OBJ} ]] || die "Couldn't find compiled kernel module"
+
+ MODULE_NAMES="libafs(fs/openafs:${srcdir})"
+
+ linux-mod_src_install
+ elif use kernel_FreeBSD; then
+ insinto /boot/modules
+ doins "${S}"/src/libafs/MODLOAD/libafs.ko
+ fi
+}
+
+pkg_postinst() {
+ # Update linker.hints file
+ use kernel_FreeBSD && /usr/sbin/kldxref "${EPREFIX}/boot/modules"
+ use linux_kernel && linux-mod_pkg_postinst
+}
+
+pkg_postrm() {
+ # Update linker.hints file
+ use kernel_FreeBSD && /usr/sbin/kldxref "${EPREFIX}/boot/modules"
+ use linux_kernel && linux-mod_pkg_postrm
+}