]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/raidframe/rf_utils.h
This commit was generated by cvs2svn to compensate for changes in r106907,
[FreeBSD/FreeBSD.git] / sys / dev / raidframe / rf_utils.h
1 /*      $FreeBSD$ */
2 /*      $NetBSD: rf_utils.h,v 1.4 1999/08/13 03:26:55 oster Exp $       */
3 /*
4  * Copyright (c) 1995 Carnegie-Mellon University.
5  * All rights reserved.
6  *
7  * Author: Mark Holland
8  *
9  * Permission to use, copy, modify and distribute this software and
10  * its documentation is hereby granted, provided that both the copyright
11  * notice and this permission notice appear in all copies of the
12  * software, derivative works or modified versions, and any portions
13  * thereof, and that both notices appear in supporting documentation.
14  *
15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18  *
19  * Carnegie Mellon requests users of this software to return to
20  *
21  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
22  *  School of Computer Science
23  *  Carnegie Mellon University
24  *  Pittsburgh PA 15213-3890
25  *
26  * any improvements or extensions that they make and grant Carnegie the
27  * rights to redistribute these changes.
28  */
29
30 /***************************************
31  *
32  * rf_utils.c -- header file for utils.c
33  *
34  ***************************************/
35
36
37 #ifndef _RF__RF_UTILS_H_
38 #define _RF__RF_UTILS_H_
39
40 #include <dev/raidframe/rf_types.h>
41 #include <dev/raidframe/rf_alloclist.h>
42 #include <dev/raidframe/rf_threadstuff.h>
43
44 char   *rf_find_non_white(char *p);
45 char   *rf_find_white(char *p);
46 RF_RowCol_t **rf_make_2d_array(int b, int k, RF_AllocListElem_t * allocList);
47 RF_RowCol_t *rf_make_1d_array(int c, RF_AllocListElem_t * allocList);
48 void    rf_free_2d_array(RF_RowCol_t ** a, int b, int k);
49 void    rf_free_1d_array(RF_RowCol_t * a, int n);
50 int     rf_gcd(int m, int n);
51 int     rf_atoi(char *p);
52 int     rf_htoi(char *p);
53
54 #define RF_USEC_PER_SEC 1000000
55 #define RF_TIMEVAL_TO_US(_t_) (((_t_).tv_sec) \
56                 * RF_USEC_PER_SEC + (_t_).tv_usec)
57
58 #define RF_TIMEVAL_DIFF(_start_,_end_,_diff_) { \
59         if ((_end_)->tv_usec < (_start_)->tv_usec) { \
60                 (_diff_)->tv_usec = ((_end_)->tv_usec + RF_USEC_PER_SEC) \
61                                 - (_start_)->tv_usec; \
62                 (_diff_)->tv_sec = ((_end_)->tv_sec-1) - (_start_)->tv_sec; \
63         } \
64         else { \
65                 (_diff_)->tv_usec = (_end_)->tv_usec - (_start_)->tv_usec; \
66                 (_diff_)->tv_sec  = (_end_)->tv_sec  - (_start_)->tv_sec; \
67         } \
68 }
69
70 #endif                          /* !_RF__RF_UTILS_H_ */