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