1 /* $NetBSD: rf_utils.h,v 1.1 1998/11/13 04:20:35 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 * 31 * rf_utils.c -- header file for utils.c 32 * 33 ***************************************/ 34 35 /* : 36 * Log: rf_utils.h,v 37 * Revision 1.7 1996/06/07 21:33:04 jimz 38 * begin using consistent types for sector numbers, 39 * stripe numbers, row+col numbers, recon unit numbers 40 * 41 * Revision 1.6 1996/06/02 17:31:48 jimz 42 * Moved a lot of global stuff into array structure, where it belongs. 43 * Fixed up paritylogging, pss modules in this manner. Some general 44 * code cleanup. Removed lots of dead code, some dead files. 45 * 46 * Revision 1.5 1996/05/23 21:46:35 jimz 47 * checkpoint in code cleanup (release prep) 48 * lots of types, function names have been fixed 49 * 50 * Revision 1.4 1996/05/18 19:51:34 jimz 51 * major code cleanup- fix syntax, make some types consistent, 52 * add prototypes, clean out dead code, et cetera 53 * 54 * Revision 1.3 1995/12/06 15:17:53 root 55 * added copyright info 56 * 57 */ 58 59 #ifndef _RF__RF_UTILS_H_ 60 #define _RF__RF_UTILS_H_ 61 62 #include "rf_types.h" 63 #include "rf_alloclist.h" 64 #include "rf_threadstuff.h" 65 66 char *rf_find_non_white(char *p); 67 char *rf_find_white(char *p); 68 RF_RowCol_t **rf_make_2d_array(int b, int k, RF_AllocListElem_t *allocList); 69 RF_RowCol_t *rf_make_1d_array(int c, RF_AllocListElem_t *allocList); 70 void rf_free_2d_array(RF_RowCol_t **a, int b, int k); 71 void rf_free_1d_array(RF_RowCol_t *a, int n); 72 int rf_gcd(int m, int n); 73 int rf_atoi(char *p); 74 int rf_htoi(char *p); 75 76 #define RF_USEC_PER_SEC 1000000 77 #define RF_TIMEVAL_DIFF(_start_,_end_,_diff_) { \ 78 if ((_end_)->tv_usec < (_start_)->tv_usec) { \ 79 (_diff_)->tv_usec = ((_end_)->tv_usec + RF_USEC_PER_SEC) \ 80 - (_start_)->tv_usec; \ 81 (_diff_)->tv_sec = ((_end_)->tv_sec-1) - (_start_)->tv_sec; \ 82 } \ 83 else { \ 84 (_diff_)->tv_usec = (_end_)->tv_usec - (_start_)->tv_usec; \ 85 (_diff_)->tv_sec = (_end_)->tv_sec - (_start_)->tv_sec; \ 86 } \ 87 } 88 89 #endif /* !_RF__RF_UTILS_H_ */ 90