The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/qat/qat_api/common/utils/sal_string_parse.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* SPDX-License-Identifier: BSD-3-Clause */
    2 /* Copyright(c) 2007-2022 Intel Corporation */
    3 /* $FreeBSD$ */
    4 /**
    5  *****************************************************************************
    6  * @file sal_string_parse.c
    7  *
    8  * @ingroup SalStringParse
    9  *
   10  * @description
   11  *    This file contains string parsing functions for both user space and kernel
   12  *    space
   13  *
   14  *****************************************************************************/
   15 #include "cpa.h"
   16 #include "lac_mem.h"
   17 #include "sal_string_parse.h"
   18 
   19 CpaStatus
   20 Sal_StringParsing(char *string1,
   21                   Cpa32U instanceNumber,
   22                   char *string2,
   23                   char *result)
   24 {
   25         char instNumString[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 };
   26         Cpa32U instNumStringLen = 0;
   27 
   28         snprintf(instNumString,
   29                  SAL_CFG_MAX_VAL_LEN_IN_BYTES,
   30                  "%d",
   31                  instanceNumber);
   32         instNumStringLen = strnlen(instNumString, SAL_CFG_MAX_VAL_LEN_IN_BYTES);
   33         if ((strnlen(string1, SAL_CFG_MAX_VAL_LEN_IN_BYTES) + instNumStringLen +
   34              strnlen(string2, SAL_CFG_MAX_VAL_LEN_IN_BYTES)) >
   35             SAL_CFG_MAX_VAL_LEN_IN_BYTES) {
   36                 QAT_UTILS_LOG("Size of result too small.\n");
   37                 return CPA_STATUS_FAIL;
   38         }
   39 
   40         LAC_OS_BZERO(result, SAL_CFG_MAX_VAL_LEN_IN_BYTES);
   41         snprintf(result,
   42                  SAL_CFG_MAX_VAL_LEN_IN_BYTES,
   43                  "%s%d%s",
   44                  string1,
   45                  instanceNumber,
   46                  string2);
   47 
   48         return CPA_STATUS_SUCCESS;
   49 }
   50 
   51 Cpa64U
   52 Sal_Strtoul(const char *cp, char **endp, unsigned int cfgBase)
   53 {
   54         Cpa64U ulResult = 0;
   55 
   56         ulResult = (Cpa64U)simple_strtoull(cp, endp, cfgBase);
   57 
   58         return ulResult;
   59 }

Cache object: f69e9a988f41f5d0b60490f4bb7406bf


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.