kernel.h (8363051739fb8cc688255328a3d641dc9fe4718c) | kernel.h (35555d474b21e47a9bd73e0cbdd84286fa0bb0b6) |
---|---|
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 * --- 36 unchanged lines hidden (view full) --- 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/log2.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 * --- 36 unchanged lines hidden (view full) --- 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/log2.h> |
53 |
|
53#include <asm/byteorder.h> | 54#include <asm/byteorder.h> |
55#include <asm/uaccess.h> |
|
54 55#include <machine/stdarg.h> 56 57#define KERN_CONT "" 58#define KERN_EMERG "<0>" 59#define KERN_ALERT "<1>" 60#define KERN_CRIT "<2>" 61#define KERN_ERR "<3>" --- 305 unchanged lines hidden (view full) --- 367 end++; 368 if (*cp == 0 || *end != 0) 369 return (-EINVAL); 370 if (temp != (u32)temp) 371 return (-ERANGE); 372 return (0); 373} 374 | 56 57#include <machine/stdarg.h> 58 59#define KERN_CONT "" 60#define KERN_EMERG "<0>" 61#define KERN_ALERT "<1>" 62#define KERN_CRIT "<2>" 63#define KERN_ERR "<3>" --- 305 unchanged lines hidden (view full) --- 369 end++; 370 if (*cp == 0 || *end != 0) 371 return (-EINVAL); 372 if (temp != (u32)temp) 373 return (-ERANGE); 374 return (0); 375} 376 |
377static inline int 378kstrtobool(const char *s, bool *res) 379{ 380 int len; 381 382 if (s == NULL || (len = strlen(s)) == 0 || res == NULL) 383 return (-EINVAL); 384 385 /* skip newline character, if any */ 386 if (s[len - 1] == '\n') 387 len--; 388 389 if (len == 1 && strchr("yY1", s[0]) != NULL) 390 *res = true; 391 else if (len == 1 && strchr("nN0", s[0]) != NULL) 392 *res = false; 393 else if (strncasecmp("on", s, len) == 0) 394 *res = true; 395 else if (strncasecmp("off", s, len) == 0) 396 *res = false; 397 else 398 return (-EINVAL); 399 400 return (0); 401} 402 403static inline int 404kstrtobool_from_user(const char __user *s, size_t count, bool *res) 405{ 406 char buf[8] = {}; 407 408 if (count > (sizeof(buf) - 1)) 409 count = (sizeof(buf) - 1); 410 411 if (copy_from_user(buf, s, count)) 412 return (-EFAULT); 413 414 return (kstrtobool(buf, res)); 415} 416 |
|
375#define min(x, y) ((x) < (y) ? (x) : (y)) 376#define max(x, y) ((x) > (y) ? (x) : (y)) 377 378#define min3(a, b, c) min(a, min(b,c)) 379#define max3(a, b, c) max(a, max(b,c)) 380 381#define min_t(type, x, y) ({ \ 382 type __min1 = (x); \ --- 78 unchanged lines hidden --- | 417#define min(x, y) ((x) < (y) ? (x) : (y)) 418#define max(x, y) ((x) > (y) ? (x) : (y)) 419 420#define min3(a, b, c) min(a, min(b,c)) 421#define max3(a, b, c) max(a, max(b,c)) 422 423#define min_t(type, x, y) ({ \ 424 type __min1 = (x); \ --- 78 unchanged lines hidden --- |