kernel.h (d2f312e0e7590f31086f259a183eb339b42315e2) kernel.h (8f7eee5a63f1d5a1844fb1b08cf295b309cd0ccf)
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
6 * Copyright (c) 2014-2015 François Tigeot
7 * All rights reserved.
8 *

--- 27 unchanged lines hidden (view full) ---

36#include <sys/types.h>
37#include <sys/systm.h>
38#include <sys/param.h>
39#include <sys/libkern.h>
40#include <sys/stat.h>
41#include <sys/smp.h>
42#include <sys/stddef.h>
43#include <sys/syslog.h>
1/*-
2 * Copyright (c) 2010 Isilon Systems, Inc.
3 * Copyright (c) 2010 iX Systems, Inc.
4 * Copyright (c) 2010 Panasas, Inc.
5 * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
6 * Copyright (c) 2014-2015 François Tigeot
7 * All rights reserved.
8 *

--- 27 unchanged lines hidden (view full) ---

36#include <sys/types.h>
37#include <sys/systm.h>
38#include <sys/param.h>
39#include <sys/libkern.h>
40#include <sys/stat.h>
41#include <sys/smp.h>
42#include <sys/stddef.h>
43#include <sys/syslog.h>
44#include <sys/time.h>
44
45#include <linux/bitops.h>
46#include <linux/compiler.h>
47#include <linux/errno.h>
48#include <linux/sched.h>
49#include <linux/types.h>
50#include <linux/jiffies.h>
51#include <linux/wait.h>

--- 168 unchanged lines hidden (view full) ---

220 log(LOG_NOTICE, pr_fmt(fmt), ##__VA_ARGS__)
221#define pr_info(fmt, ...) \
222 log(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
223#define pr_info_once(fmt, ...) \
224 log_once(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
225#define pr_cont(fmt, ...) \
226 printk(KERN_CONT fmt, ##__VA_ARGS__)
227#define pr_warn_ratelimited(...) do { \
45
46#include <linux/bitops.h>
47#include <linux/compiler.h>
48#include <linux/errno.h>
49#include <linux/sched.h>
50#include <linux/types.h>
51#include <linux/jiffies.h>
52#include <linux/wait.h>

--- 168 unchanged lines hidden (view full) ---

221 log(LOG_NOTICE, pr_fmt(fmt), ##__VA_ARGS__)
222#define pr_info(fmt, ...) \
223 log(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
224#define pr_info_once(fmt, ...) \
225 log_once(LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__)
226#define pr_cont(fmt, ...) \
227 printk(KERN_CONT fmt, ##__VA_ARGS__)
228#define pr_warn_ratelimited(...) do { \
228 static time_t __ratelimited; \
229 static linux_ratelimit_t __ratelimited; \
229 if (linux_ratelimited(&__ratelimited)) \
230 pr_warning(__VA_ARGS__); \
231} while (0)
232
233#ifndef WARN
234#define WARN(condition, ...) ({ \
235 bool __ret_warn_on = (condition); \
236 if (unlikely(__ret_warn_on)) \

--- 181 unchanged lines hidden (view full) ---

418}
419
420static inline int64_t
421abs64(int64_t x)
422{
423 return (x < 0 ? -x : x);
424}
425
230 if (linux_ratelimited(&__ratelimited)) \
231 pr_warning(__VA_ARGS__); \
232} while (0)
233
234#ifndef WARN
235#define WARN(condition, ...) ({ \
236 bool __ret_warn_on = (condition); \
237 if (unlikely(__ret_warn_on)) \

--- 181 unchanged lines hidden (view full) ---

419}
420
421static inline int64_t
422abs64(int64_t x)
423{
424 return (x < 0 ? -x : x);
425}
426
426extern bool linux_ratelimited(time_t *);
427typedef struct linux_ratelimit {
428 struct timeval lasttime;
429 int counter;
430} linux_ratelimit_t;
427
431
432static inline bool
433linux_ratelimited(linux_ratelimit_t *rl)
434{
435 return (ppsratecheck(&rl->lasttime, &rl->counter, 1));
436}
437
428#endif /* _LINUX_KERNEL_H_ */
438#endif /* _LINUX_KERNEL_H_ */