2 /* $NetBSD: rf_utils.h,v 1.4 1999/08/13 03:26:55 oster Exp $ */
4 * Copyright (c) 1995 Carnegie-Mellon University.
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.
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.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
30 /***************************************
32 * rf_utils.c -- header file for utils.c
34 ***************************************/
37 #ifndef _RF__RF_UTILS_H_
38 #define _RF__RF_UTILS_H_
40 #include <dev/raidframe/rf_types.h>
41 #include <dev/raidframe/rf_alloclist.h>
42 #include <dev/raidframe/rf_threadstuff.h>
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);
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)
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; \
65 (_diff_)->tv_usec = (_end_)->tv_usec - (_start_)->tv_usec; \
66 (_diff_)->tv_sec = (_end_)->tv_sec - (_start_)->tv_sec; \
70 #endif /* !_RF__RF_UTILS_H_ */