1 /******************************************************************************* 2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved. 3 * 4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided 5 *that the following conditions are met: 6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 7 *following disclaimer. 8 *2. Redistributions in binary form must reproduce the above copyright notice, 9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided 10 *with the distribution. 11 * 12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED 13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 20 * 21 * $FreeBSD$ 22 * 23 *******************************************************************************/ 24 /****************************************************************************** 25 26 Note: 27 This program is separated from main driver source due to the common usage 28 of both initiator and target. 29 ******************************************************************************* 30 Module Name: 31 osstring.h 32 Abstract: 33 FreeBSD SPCv Initiator driver module OS API definitions 34 Authors: 35 EW - Eddie Wang 36 Environment: 37 Kernel or loadable module 38 39 Version Control Information: 40 $ver. 1.0.0 41 42 Revision History: 43 $Revision: 114125 $0.1.0 44 $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $08-27-2001 45 $Modtime: 11/12/01 11:15a $11:46:00 46 47 Notes: 48 49 **************************** MODIFICATION HISTORY ***************************** 50 NAME DATE Rev. DESCRIPTION 51 ---- ---- ---- ----------- 52 EW 05-27-2002 1.0.0 Code construction started. 53 ******************************************************************************/ 54 55 #ifndef __OSSTRING_H__ 56 #define __OSSTRING_H__ 57 #include <sys/libkern.h> 58 #include <sys/syslimits.h> 59 #include <sys/param.h> 60 #include <sys/kernel.h> 61 #include <sys/ctype.h> 62 63 #define osti_memcmp(s1, s2, n) memcmp((void *)s1, (void *)s2, (size_t)n) 64 #define osti_memcpy(des, src, n) memcpy((void *)des, (void *)src, (size_t)n) 65 #define osti_memset(s, c, n) memset((void *)s, (int)c, (size_t)n) 66 #define osti_strcat(des, src) strcat((char *)des, (char *)src) 67 #define osti_strchr(s, n) strchr((char *)s, (int)n) 68 #define osti_strcmp(s1, s2) strcmp((char *)s1, (char *)s2) 69 #define osti_strcpy(des, src) strcpy((char *)des, (char *)src) 70 #define osti_strlen(s) strlen((char *)s) 71 #define osti_strncmp(s1, s2, n) strncmp((char *)s1, (char *)s2, (size_t)n) 72 #define osti_strncpy(des, src, n) strncpy((char *)des, (char *)src, (size_t)n) 73 #define osti_strstr(s1, s2) strstr((char *)s1, (char *)s2) 74 75 #define osti_strtoul(nptr, endptr, base) \ 76 strtoul((char *)nptr, (char **)endptr, 0) 77 78 #define osti_isxdigit(c) isxdigit(c) 79 #define osti_isdigit(c) isdigit(c) 80 #define osti_islower(c) islower(c) 81 82 #define osMemCpy(des, src, n) memcpy((void *)des, (void *)src, (size_t)n) 83 #define osMemSet(s, c, n) memset((void *)s, (int)c, (size_t)n) 84 85 #endif /* __OSSTRING_H__ */ 86