cregit-Linux how code gets into the kernel

Release 4.12 include/linux/err.h

Directory: include/linux
#ifndef _LINUX_ERR_H

#define _LINUX_ERR_H

#include <linux/compiler.h>
#include <linux/types.h>

#include <asm/errno.h>

/*
 * Kernel pointers have redundant information, so we can use a
 * scheme where we can return either an error code or a normal
 * pointer with the same return value.
 *
 * This should be a per-architecture thing, to allow different
 * error and pointer decisions.
 */

#define MAX_ERRNO	4095

#ifndef __ASSEMBLY__


#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)


static inline void * __must_check ERR_PTR(long error) { return (void *) error; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones1894.74%150.00%
Jani Nikula15.26%150.00%
Total19100.00%2100.00%


static inline long __must_check PTR_ERR(__force const void *ptr) { return (long) ptr; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones1890.00%133.33%
Dan Carpenter15.00%133.33%
Jani Nikula15.00%133.33%
Total20100.00%3100.00%


static inline bool __must_check IS_ERR(__force const void *ptr) { return IS_ERR_VALUE((unsigned long)ptr); }

Contributors

PersonTokensPropCommitsCommitProp
Dave Jones1875.00%116.67%
Andrew Morton28.33%116.67%
Jani Nikula14.17%116.67%
Joe Perches14.17%116.67%
Linus Torvalds14.17%116.67%
Dan Carpenter14.17%116.67%
Total24100.00%6100.00%


static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr) { return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr); }

Contributors

PersonTokensPropCommitsCommitProp
Phil Carmody2480.00%120.00%
Viresh Kumar310.00%120.00%
Dan Carpenter13.33%120.00%
Jani Nikula13.33%120.00%
Joe Perches13.33%120.00%
Total30100.00%5100.00%

/** * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type * @ptr: The pointer to cast. * * Explicitly cast an error-valued pointer to another pointer type in such a * way as to make it clear that's what's going on. */
static inline void * __must_check ERR_CAST(__force const void *ptr) { /* cast away the const */ return (void *) ptr; }

Contributors

PersonTokensPropCommitsCommitProp
David Howells2191.30%133.33%
Dan Carpenter14.35%133.33%
Jani Nikula14.35%133.33%
Total23100.00%3100.00%


static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) { if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Uwe Kleine-König2993.55%133.33%
Rusty Russell13.23%133.33%
Dan Carpenter13.23%133.33%
Total31100.00%3100.00%

/* Deprecated */ #define PTR_RET(p) PTR_ERR_OR_ZERO(p) #endif #endif /* _LINUX_ERR_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Dave Jones6634.55%17.14%
Uwe Kleine-König2915.18%17.14%
Phil Carmody2412.57%17.14%
David Howells2211.52%17.14%
Rusty Russell94.71%17.14%
Linus Torvalds84.19%214.29%
Joe Perches63.14%17.14%
Dan Carpenter52.62%17.14%
Andrew Morton52.62%17.14%
Randy Dunlap52.62%17.14%
Jani Nikula52.62%17.14%
Ralf Bächle42.09%17.14%
Viresh Kumar31.57%17.14%
Total191100.00%14100.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.