The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/raidframe/rf_general.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: rf_general.h,v 1.13 2004/01/01 20:39:58 oster Exp $    */
    2 /*
    3  * Copyright (c) 1995 Carnegie-Mellon University.
    4  * All rights reserved.
    5  *
    6  * Author: Mark Holland
    7  *
    8  * Permission to use, copy, modify and distribute this software and
    9  * its documentation is hereby granted, provided that both the copyright
   10  * notice and this permission notice appear in all copies of the
   11  * software, derivative works or modified versions, and any portions
   12  * thereof, and that both notices appear in supporting documentation.
   13  *
   14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   17  *
   18  * Carnegie Mellon requests users of this software to return to
   19  *
   20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   21  *  School of Computer Science
   22  *  Carnegie Mellon University
   23  *  Pittsburgh PA 15213-3890
   24  *
   25  * any improvements or extensions that they make and grant Carnegie the
   26  * rights to redistribute these changes.
   27  */
   28 
   29 /*
   30  * rf_general.h -- some general-use definitions
   31  */
   32 
   33 /* #define NOASSERT */
   34 
   35 #ifndef _RF__RF_GENERAL_H_
   36 #define _RF__RF_GENERAL_H_
   37 
   38 #ifdef _KERNEL_OPT
   39 #include "opt_raid_diagnostic.h"
   40 #endif /* _KERNEL_OPT */
   41 
   42 /* error reporting and handling */
   43 
   44 #include <sys/systm.h>          /* printf, sprintf, and friends */
   45 #include <uvm/uvm_extern.h>     /* PAGE_SIZE, PAGE_MASK */
   46 
   47 #define RF_ERRORMSG(s)            printf((s))
   48 #define RF_ERRORMSG1(s,a)         printf((s),(a))
   49 #define RF_ERRORMSG2(s,a,b)       printf((s),(a),(b))
   50 #define RF_ERRORMSG3(s,a,b,c)     printf((s),(a),(b),(c))
   51 
   52 void rf_print_panic_message(int, char *);
   53 void rf_print_assert_panic_message(int, char *, char *);
   54 void rf_print_unable_to_init_mutex(char *, int, int);
   55 void rf_print_unable_to_add_shutdown(char *, int, int);
   56 
   57         
   58 extern char rf_panicbuf[];
   59 #define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__); panic(rf_panicbuf);}
   60 
   61 #ifdef RAID_DIAGNOSTIC
   62 #define RF_ASSERT(_x_) { \
   63   if (!(_x_)) { \
   64     rf_print_assert_panic_message(__LINE__, __FILE__, #_x_); \
   65     panic(rf_panicbuf); \
   66   } \
   67 }
   68 #else /* RAID_DIAGNOSTIC */
   69 #define RF_ASSERT(x) {/*noop*/}
   70 #endif /* RAID_DIAGNOSTIC */
   71 
   72 /* random stuff */
   73 #define RF_MAX(a,b) (((a) > (b)) ? (a) : (b))
   74 #define RF_MIN(a,b) (((a) < (b)) ? (a) : (b))
   75 
   76 /* divide-by-zero check */
   77 #define RF_DB0_CHECK(a,b) ( ((b)==0) ? 0 : (a)/(b) )
   78 
   79 /* get time of day */
   80 #define RF_GETTIME(_t) microtime(&(_t))
   81 
   82 #define RF_UL(x)           ((unsigned long) (x))
   83 #define RF_PGMASK          PAGE_MASK
   84 #define RF_BLIP(x)         (PAGE_SIZE - (RF_UL(x) & RF_PGMASK)) /* bytes left in page */
   85 #define RF_PAGE_ALIGNED(x) ((RF_UL(x) & RF_PGMASK) == 0)
   86 
   87 #ifdef __STDC__
   88 #define RF_STRING(_str_) #_str_
   89 #else                           /* __STDC__ */
   90 #define RF_STRING(_str_) "_str_"
   91 #endif                          /* __STDC__ */
   92 
   93 #endif                          /* !_RF__RF_GENERAL_H_ */

Cache object: 79ee5341a28bfe1db124367bdeac809d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.