4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2015, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * libcfs/libcfs/linux/linux-curproc.c
34 * Lustre curproc API implementation for Linux kernel
36 * Author: Nikita Danilov <nikita@clusterfs.com>
39 #include <linux/sched.h>
40 #include <linux/fs_struct.h>
42 #include <linux/compat.h>
43 #include <linux/thread_info.h>
45 #define DEBUG_SUBSYSTEM S_LNET
47 #include <linux/libcfs/libcfs.h>
50 * Implementation of cfs_curproc API (see portals/include/libcfs/curproc.h)
54 void cfs_cap_raise(cfs_cap_t cap)
58 cred = prepare_creds();
60 cap_raise(cred->cap_effective, cap);
64 EXPORT_SYMBOL(cfs_cap_raise);
66 void cfs_cap_lower(cfs_cap_t cap)
70 cred = prepare_creds();
72 cap_lower(cred->cap_effective, cap);
76 EXPORT_SYMBOL(cfs_cap_lower);
78 int cfs_cap_raised(cfs_cap_t cap)
80 return cap_raised(current_cap(), cap);
82 EXPORT_SYMBOL(cfs_cap_raised);
84 static void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
86 /* XXX lost high byte */
90 cfs_cap_t cfs_curproc_cap_pack(void)
94 cfs_kernel_cap_pack(current_cap(), &cap);
97 EXPORT_SYMBOL(cfs_curproc_cap_pack);
101 * c-indentation-style: "K&R"