Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / raidframe / rf_utils.h
blob34edb7d61d8a3487c0449001aaa092b366558685
1 /* $NetBSD: rf_utils.h,v 1.4 1999/08/13 03:26:55 oster Exp $ */
2 /*
3 * Copyright (c) 1995 Carnegie-Mellon University.
4 * All rights reserved.
6 * Author: Mark Holland
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.
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.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes.
29 /***************************************
31 * rf_utils.c -- header file for utils.c
33 ***************************************/
36 #ifndef _RF__RF_UTILS_H_
37 #define _RF__RF_UTILS_H_
39 #include <dev/raidframe/raidframevar.h>
40 #include "rf_alloclist.h"
41 #include "rf_threadstuff.h"
43 char *rf_find_non_white(char *p);
44 char *rf_find_white(char *p);
45 RF_RowCol_t **rf_make_2d_array(int b, int k, RF_AllocListElem_t * allocList);
46 RF_RowCol_t *rf_make_1d_array(int c, RF_AllocListElem_t * allocList);
47 void rf_free_2d_array(RF_RowCol_t ** a, int b, int k);
48 void rf_free_1d_array(RF_RowCol_t * a, int n);
49 int rf_gcd(int m, int n);
50 int rf_atoi(char *p);
51 int rf_htoi(char *p);
53 #define RF_USEC_PER_SEC 1000000
54 #define RF_TIMEVAL_TO_US(_t_) (((_t_).tv_sec) \
55 * RF_USEC_PER_SEC + (_t_).tv_usec)
57 #define RF_TIMEVAL_DIFF(_start_,_end_,_diff_) { \
58 if ((_end_)->tv_usec < (_start_)->tv_usec) { \
59 (_diff_)->tv_usec = ((_end_)->tv_usec + RF_USEC_PER_SEC) \
60 - (_start_)->tv_usec; \
61 (_diff_)->tv_sec = ((_end_)->tv_sec-1) - (_start_)->tv_sec; \
62 } \
63 else { \
64 (_diff_)->tv_usec = (_end_)->tv_usec - (_start_)->tv_usec; \
65 (_diff_)->tv_sec = (_end_)->tv_sec - (_start_)->tv_sec; \
66 } \
69 #endif /* !_RF__RF_UTILS_H_ */