cregit-Linux how code gets into the kernel

Release 4.12 include/linux/projid.h

Directory: include/linux
#ifndef _LINUX_PROJID_H

#define _LINUX_PROJID_H

/*
 * A set of types for the internal kernel types representing project ids.
 *
 * The types defined in this header allow distinguishing which project ids in
 * the kernel are values used by userspace and which project id values are
 * the internal kernel values.  With the addition of user namespaces the values
 * can be different.  Using the type system makes it possible for the compiler
 * to detect when we overlook these differences.
 *
 */
#include <linux/types.h>

struct user_namespace;
extern struct user_namespace init_user_ns;


typedef __kernel_uid32_t projid_t;

typedef struct {
	
projid_t val;

} kprojid_t;


static inline projid_t __kprojid_val(kprojid_t projid) { return projid.val; }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann15100.00%1100.00%
Total15100.00%1100.00%

#define KPROJIDT_INIT(value) (kprojid_t){ value } #define INVALID_PROJID KPROJIDT_INIT(-1) #define OVERFLOW_PROJID 65534
static inline bool projid_eq(kprojid_t left, kprojid_t right) { return __kprojid_val(left) == __kprojid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann24100.00%1100.00%
Total24100.00%1100.00%


static inline bool projid_lt(kprojid_t left, kprojid_t right) { return __kprojid_val(left) < __kprojid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann24100.00%1100.00%
Total24100.00%1100.00%


static inline bool projid_valid(kprojid_t projid) { return !projid_eq(projid, INVALID_PROJID); }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann19100.00%1100.00%
Total19100.00%1100.00%

#ifdef CONFIG_USER_NS extern kprojid_t make_kprojid(struct user_namespace *from, projid_t projid); extern projid_t from_kprojid(struct user_namespace *to, kprojid_t projid); extern projid_t from_kprojid_munged(struct user_namespace *to, kprojid_t projid);
static inline bool kprojid_has_mapping(struct user_namespace *ns, kprojid_t projid) { return from_kprojid(ns, projid) != (projid_t)-1; }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann29100.00%1100.00%
Total29100.00%1100.00%

#else
static inline kprojid_t make_kprojid(struct user_namespace *from, projid_t projid) { return KPROJIDT_INIT(projid); }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann21100.00%1100.00%
Total21100.00%1100.00%


static inline projid_t from_kprojid(struct user_namespace *to, kprojid_t kprojid) { return __kprojid_val(kprojid); }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann21100.00%1100.00%
Total21100.00%1100.00%


static inline projid_t from_kprojid_munged(struct user_namespace *to, kprojid_t kprojid) { projid_t projid = from_kprojid(to, kprojid); if (projid == (projid_t)-1) projid = OVERFLOW_PROJID; return projid; }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann42100.00%1100.00%
Total42100.00%1100.00%


static inline bool kprojid_has_mapping(struct user_namespace *ns, kprojid_t projid) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann18100.00%1100.00%
Total18100.00%1100.00%

#endif /* CONFIG_USER_NS */ #endif /* _LINUX_PROJID_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Eric W. Biedermann309100.00%1100.00%
Total309100.00%1100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.