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*
22*******************************************************************************/
23/******************************************************************************
24
25Note:
26This program is separated from main driver source due to the common usage
27of both initiator and target.
28*******************************************************************************
29Module Name:
30  osstring.h
31Abstract:
32  FreeBSD SPCv Initiator driver module OS API definitions
33Authors:
34  EW - Eddie Wang
35Environment:
36  Kernel or loadable module
37
38Version Control Information:
39  $ver. 1.0.0
40
41Revision History:
42  $Revision: 114125 $0.1.0
43  $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $08-27-2001
44  $Modtime: 11/12/01 11:15a $11:46:00
45
46Notes:
47
48**************************** MODIFICATION HISTORY *****************************
49NAME     DATE         Rev.        DESCRIPTION
50----     ----         ----        -----------
51EW     05-27-2002     1.0.0     Code construction started.
52******************************************************************************/
53
54#ifndef __OSSTRING_H__
55#define __OSSTRING_H__
56#include <sys/libkern.h>
57#include <sys/syslimits.h>
58#include <sys/param.h>
59#include <sys/kernel.h>
60#include <sys/ctype.h>
61
62#define osti_memcmp(s1, s2, n)     memcmp((void *)s1, (void *)s2, (size_t)n)
63#define osti_memcpy(des, src, n)   memcpy((void *)des, (void *)src, (size_t)n)
64#define osti_memset(s, c, n)       memset((void *)s, (int)c, (size_t)n)
65#define osti_strcat(des, src)      strcat((char *)des, (char *)src)
66#define osti_strchr(s, n)          strchr((char *)s, (int)n)
67#define osti_strcmp(s1, s2)        strcmp((char *)s1, (char *)s2)
68#define osti_strcpy(des, src)      strcpy((char *)des, (char *)src)
69#define osti_strlen(s)             strlen((char *)s)
70#define osti_strncmp(s1, s2, n)    strncmp((char *)s1, (char *)s2, (size_t)n)
71#define osti_strncpy(des, src, n)  strncpy((char *)des, (char *)src, (size_t)n)
72#define osti_strstr(s1, s2)        strstr((char *)s1, (char *)s2)
73
74#define osti_strtoul(nptr, endptr, base)    \
75          strtoul((char *)nptr, (char **)endptr, 0)
76
77#define osti_isxdigit(c)           isxdigit(c)
78#define osti_isdigit(c)            isdigit(c)
79#define osti_islower(c)            islower(c)
80
81#define osMemCpy(des, src, n)   memcpy((void *)des, (void *)src, (size_t)n)
82#define osMemSet(s, c, n)       memset((void *)s, (int)c, (size_t)n)
83
84#endif  /* __OSSTRING_H__ */
85