1285809Sscottl/*******************************************************************************
2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3285809Sscottl*
4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5285809Sscottl*that the following conditions are met:
6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7285809Sscottl*following disclaimer.
8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10285809Sscottl*with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl*
21285809Sscottl* $FreeBSD$
22285809Sscottl*
23285809Sscottl*******************************************************************************/
24285809Sscottl/******************************************************************************
25285809Sscottl
26285809SscottlNote:
27285809SscottlThis program is separated from main driver source due to the common usage
28285809Sscottlof both initiator and target.
29285809Sscottl*******************************************************************************
30285809SscottlModule Name:
31285809Sscottl  osstring.h
32285809SscottlAbstract:
33285809Sscottl  FreeBSD SPCv Initiator driver module OS API definitions
34285809SscottlAuthors:
35285809Sscottl  EW - Eddie Wang
36285809SscottlEnvironment:
37285809Sscottl  Kernel or loadable module
38285809Sscottl
39285809SscottlVersion Control Information:
40285809Sscottl  $ver. 1.0.0
41285809Sscottl
42285809SscottlRevision History:
43285809Sscottl  $Revision: 114125 $0.1.0
44285809Sscottl  $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $08-27-2001
45285809Sscottl  $Modtime: 11/12/01 11:15a $11:46:00
46285809Sscottl
47285809SscottlNotes:
48285809Sscottl
49285809Sscottl**************************** MODIFICATION HISTORY *****************************
50285809SscottlNAME     DATE         Rev.        DESCRIPTION
51285809Sscottl----     ----         ----        -----------
52285809SscottlEW     05-27-2002     1.0.0     Code construction started.
53285809Sscottl******************************************************************************/
54285809Sscottl
55285809Sscottl#ifndef __OSSTRING_H__
56285809Sscottl#define __OSSTRING_H__
57285809Sscottl#include <sys/libkern.h>
58285809Sscottl#include <sys/syslimits.h>
59285809Sscottl#include <sys/param.h>
60285809Sscottl#include <sys/kernel.h>
61285809Sscottl#include <sys/ctype.h>
62285809Sscottl
63285809Sscottl#define osti_memcmp(s1, s2, n)     memcmp((void *)s1, (void *)s2, (size_t)n)
64285809Sscottl#define osti_memcpy(des, src, n)   memcpy((void *)des, (void *)src, (size_t)n)
65285809Sscottl#define osti_memset(s, c, n)       memset((void *)s, (int)c, (size_t)n)
66285809Sscottl#define osti_strcat(des, src)      strcat((char *)des, (char *)src)
67285809Sscottl#define osti_strchr(s, n)          strchr((char *)s, (int)n)
68285809Sscottl#define osti_strcmp(s1, s2)        strcmp((char *)s1, (char *)s2)
69285809Sscottl#define osti_strcpy(des, src)      strcpy((char *)des, (char *)src)
70285809Sscottl#define osti_strlen(s)             strlen((char *)s)
71285809Sscottl#define osti_strncmp(s1, s2, n)    strncmp((char *)s1, (char *)s2, (size_t)n)
72285809Sscottl#define osti_strncpy(des, src, n)  strncpy((char *)des, (char *)src, (size_t)n)
73285809Sscottl#define osti_strstr(s1, s2)        strstr((char *)s1, (char *)s2)
74285809Sscottl
75285809Sscottl#define osti_strtoul(nptr, endptr, base)    \
76285809Sscottl          strtoul((char *)nptr, (char **)endptr, 0)
77285809Sscottl
78285809Sscottl#define osti_isxdigit(c)           isxdigit(c)
79285809Sscottl#define osti_isdigit(c)            isdigit(c)
80285809Sscottl#define osti_islower(c)            islower(c)
81285809Sscottl
82285809Sscottl#define osMemCpy(des, src, n)   memcpy((void *)des, (void *)src, (size_t)n)
83285809Sscottl#define osMemSet(s, c, n)       memset((void *)s, (int)c, (size_t)n)
84285809Sscottl
85285809Sscottl#endif  /* __OSSTRING_H__ */
86