• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NULL_CHECK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NULL_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ NULL_CHECK函数的具体用法?C++ NULL_CHECK怎么用?C++ NULL_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NULL_CHECK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: TcgParseSyncSession

/**
 Parses the Sync Session response contained in the parseStruct to retrieve Tper session ID.  If the Sync Session response
 parameters do not match the comID, extended ComID and host session ID then a failure is returned.

 @param[in/out]   ParseStruct          Structure used to parse received TCG response, contains Sync Session response.
 @param[in]       ComId                Expected ComID that is compared to actual ComID of response
 @param[in]       ComIdExtension       Expected Extended ComID that is compared to actual Extended ComID of response
 @param[in]       HostSessionId        Expected Host Session ID that is compared to actual  Host Session ID of response
 @param[in/out]   TperSessionId        Tper Session ID retrieved from the Sync Session response.

**/
TCG_RESULT
EFIAPI
TcgParseSyncSession(
  const TCG_PARSE_STRUCT  *ParseStruct,
  UINT16                  ComId,
  UINT16                  ComIdExtension,
  UINT32                  HostSessionId,
  UINT32                  *TperSessionId
  )
{
  UINT8 MethodStatus;
  TCG_PARSE_STRUCT TmpParseStruct;
  UINT16 ParseComId;
  UINT16 ParseExtComId;
  TCG_UID InvokingUID;
  TCG_UID MethodUID;
  UINT32 RecvHostSessionId;

  NULL_CHECK(ParseStruct);
  NULL_CHECK(TperSessionId);

  CopyMem (&TmpParseStruct, ParseStruct, sizeof(TCG_PARSE_STRUCT));

  // verify method status is good
  ERROR_CHECK(TcgGetMethodStatus(&TmpParseStruct, &MethodStatus));
  METHOD_STATUS_ERROR_CHECK (MethodStatus, TcgResultFailure);

  // verify comids
  ERROR_CHECK(TcgGetComIds(&TmpParseStruct, &ParseComId, &ParseExtComId));

  if ((ComId != ParseComId) || (ComIdExtension != ParseExtComId)) {
    DEBUG ((DEBUG_INFO, "unmatched comid (exp: 0x%X recv: 0x%X) or comid extension (exp: 0x%X recv: 0x%X)\n", ComId, ParseComId, ComIdExtension, ParseExtComId));
    return TcgResultFailure;
  }
  ERROR_CHECK(TcgGetNextCall(&TmpParseStruct));
  ERROR_CHECK(TcgGetNextTcgUid(&TmpParseStruct, &InvokingUID));
  ERROR_CHECK(TcgGetNextTcgUid(&TmpParseStruct, &MethodUID));
  ERROR_CHECK(TcgGetNextStartList(&TmpParseStruct));
  ERROR_CHECK(TcgGetNextUINT32(&TmpParseStruct, &RecvHostSessionId));
  ERROR_CHECK(TcgGetNextUINT32(&TmpParseStruct, TperSessionId));
  ERROR_CHECK(TcgGetNextEndList(&TmpParseStruct));
  ERROR_CHECK(TcgGetNextEndOfData(&TmpParseStruct));

  if (InvokingUID != TCG_UID_SMUID) {
    DEBUG ((DEBUG_INFO, "Invoking UID did not match UID_SMUID\n"));
    return TcgResultFailure;
  }

  if (MethodUID != TCG_UID_SM_SYNC_SESSION) {
    DEBUG ((DEBUG_INFO, "Method UID did not match UID_SM_SYNC_SESSION\n"));
    return TcgResultFailure;
  }

  if (HostSessionId != RecvHostSessionId) {
    DEBUG ((DEBUG_INFO, "unmatched HostSessionId (exp: 0x%X recv: 0x%X)\n", HostSessionId, RecvHostSessionId));
    return TcgResultFailure;
  }

  return TcgResultSuccess;
}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:71,代码来源:TcgStorageUtil.c


示例2: OpalUtilVerifyPassword

/**
  Verify whether user input the correct password.

  @param[in]      Session,               The session info for one opal device.
  @param[in]      Password                    Admin password
  @param[in]      PasswordLength              Length of password in bytes
  @param[in/out]  HostSigningAuthority        Use the Host signing authority type.

**/
TCG_RESULT
EFIAPI
OpalUtilVerifyPassword (
  OPAL_SESSION   *Session,
  const VOID     *Password,
  UINT32         PasswordLength,
  TCG_UID        HostSigningAuthority
  )
{
  TCG_RESULT                    Ret;
  UINT8                         MethodStatus;

  NULL_CHECK(Session);
  NULL_CHECK(Password);

  Ret = OpalStartSession(
            Session,
            OPAL_UID_LOCKING_SP,
            TRUE,
            PasswordLength,
            Password,
            HostSigningAuthority,
            &MethodStatus);
  if (Ret == TcgResultSuccess && MethodStatus == TCG_METHOD_STATUS_CODE_SUCCESS) {
    OpalEndSession(Session);
    return TcgResultSuccess;
  }

  return TcgResultFailure;
}
开发者ID:b-man,项目名称:edk2,代码行数:39,代码来源:TcgStorageOpalUtil.c


示例3: main

int
main (int argc, char **argv)
{
  int i;

  for (i = 1; i < argc; i++)
    {
      const char *e;
      char *username, *groupname;
      uid_t uid;
      gid_t gid;
      char *tmp;

      tmp = strdup (argv[i]);
      e = parse_user_spec (tmp, &uid, &gid, &username, &groupname);
      free (tmp);
      printf ("%s: %lu %lu %s %s %s\n",
              argv[i],
              (unsigned long int) uid,
              (unsigned long int) gid,
              NULL_CHECK (username),
              NULL_CHECK (groupname),
              NULL_CHECK (e));
    }

  exit (0);
}
开发者ID:8l,项目名称:csolve,代码行数:27,代码来源:userspec.c


示例4: TcgInitTcgCreateStruct

/**
  Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT.
  Initializes the packet variables to NULL.  Additionally, the buffer will be memset.

  @param [in/out]    CreateStruct    Structure to initialize
  @param [in]        Buffer          Buffer allocated by client of library.  It will contain the Tcg encoded packet.  This cannot be null.
  @param [in]        BufferSize      Size of buffer provided.  It cannot be 0.

  @retval       Return the action result.
**/
TCG_RESULT
EFIAPI
TcgInitTcgCreateStruct(
  TCG_CREATE_STRUCT      *CreateStruct,
  VOID                   *Buffer,
  UINT32                 BufferSize
  )
{
  NULL_CHECK(CreateStruct);
  NULL_CHECK(Buffer);

  if (BufferSize == 0) {
    DEBUG ((DEBUG_INFO, "BufferSize=0\n"));
    return (TcgResultFailureZeroSize);
  }

  ZeroMem(Buffer, BufferSize);
  CreateStruct->BufferSize = BufferSize;
  CreateStruct->Buffer = Buffer;
  CreateStruct->ComPacket = NULL;
  CreateStruct->CurPacket = NULL;
  CreateStruct->CurSubPacket = NULL;

  return (TcgResultSuccess);
}
开发者ID:shijunjing,项目名称:edk2,代码行数:35,代码来源:TcgStorageCore.c


示例5: sysdb_sudo_filter_rules_by_time

errno_t sysdb_sudo_filter_rules_by_time(TALLOC_CTX *mem_ctx,
                                        uint32_t in_num_rules,
                                        struct sysdb_attrs **in_rules,
                                        time_t now,
                                        uint32_t *_num_rules,
                                        struct sysdb_attrs ***_rules)
{
    uint32_t num_rules = 0;
    struct sysdb_attrs **rules = NULL;
    TALLOC_CTX *tmp_ctx = NULL;
    bool allowed = false;
    errno_t ret;
    int i;

    tmp_ctx = talloc_new(NULL);
    NULL_CHECK(tmp_ctx, ret, done);

    if (now == 0) {
        now = time(NULL);
    }

    for (i = 0; i < in_num_rules; i++) {
        ret = sysdb_sudo_check_time(in_rules[i], now, &allowed);
        if (ret == EOK && allowed) {
            num_rules++;
            rules = talloc_realloc(tmp_ctx, rules, struct sysdb_attrs *,
                                   num_rules);
            NULL_CHECK(rules, ret, done);

            rules[num_rules - 1] = in_rules[i];
        }
    }
开发者ID:mmsrubar,项目名称:thesis,代码行数:32,代码来源:sysdb_sudo.c


示例6: failed

/**
  Opens a session with OPAL_UID_ADMIN_SP as OPAL_ADMIN_SP_PSID_AUTHORITY, then reverts the device using the RevertSP method.

  @param[in]      Session            The opal session for the opal device.
  @param[in]      KeepUserData       TRUE to keep existing Data on the disk, or FALSE to erase it
  @param[in]      Password           Admin password
  @param[in]      PasswordLength     Length of password in bytes
  @param[in]      Msid               Msid
  @param[in]      MsidLength         Msid Length
  @param[out]     PasswordFailed     indicates if password failed (start session didn't work)
  @param[in]      DevicePath         The device path for the opal devcie.

**/
TCG_RESULT
EFIAPI
OpalSupportRevert(
  IN  OPAL_SESSION              *Session,
  IN  BOOLEAN                   KeepUserData,
  IN  VOID                      *Password,
  IN  UINT32                    PasswordLength,
  IN  VOID                      *Msid,
  IN  UINT32                    MsidLength,
  OUT BOOLEAN                   *PasswordFailed,
  IN  EFI_DEVICE_PATH_PROTOCOL  *DevicePath
  )
{
  TCG_RESULT   Ret;

  NULL_CHECK(Session);
  NULL_CHECK(Password);
  NULL_CHECK(Msid);
  NULL_CHECK(PasswordFailed);

  Ret = OpalUtilRevert(Session, KeepUserData, Password, PasswordLength, PasswordFailed, Msid, MsidLength);
  if (Ret == TcgResultSuccess && !gInSmm) {
    OpalSupportSendPasword (DevicePath, 0, NULL);
  }

  return Ret;
}
开发者ID:leoliao1980,项目名称:edk2,代码行数:40,代码来源:OpalPasswordSupportLib.c


示例7: dhd_rtt_stop

int
dhd_rtt_stop(dhd_pub_t *dhd, struct ether_addr *mac_list, int mac_cnt)
{
	int err = BCME_OK;
	int i = 0, j = 0;
	rtt_status_info_t *rtt_status;

	NULL_CHECK(dhd, "dhd is NULL", err);
	rtt_status = GET_RTTSTATE(dhd);
	NULL_CHECK(rtt_status, "rtt_status is NULL", err);
	if (rtt_status->status == RTT_STOPPED) {
		DHD_ERROR(("rtt is not started\n"));
		return BCME_OK;
	}
	DHD_RTT(("%s enter\n", __FUNCTION__));
	mutex_lock(&rtt_status->rtt_mutex);
	for (i = 0; i < mac_cnt; i++) {
		for ( j = 0; j < rtt_status->rtt_config.rtt_target_cnt; j++) {
				if (!bcmp(&mac_list[i],&rtt_status->rtt_config.target_info[j].addr,
					ETHER_ADDR_LEN)) {
					rtt_status->rtt_config.target_info[j].disable = TRUE;
				}
		}
	}
	mutex_unlock(&rtt_status->rtt_mutex);
	return err;
}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:27,代码来源:dhd_rtt.c


示例8: retvm_if

Evas_Object *clk_widget_create_button(Evas_Object * parent,
				      const char *file, const char *group,
				      Edje_Color_Class * color_class,
				      Edje_Signal_Cb clicked_cb, void *data)
{
	retvm_if(NULL_CHECK(parent), NULL, "parent null");
	retvm_if(NULL_CHECK(file), NULL, "file null");
	retvm_if(NULL_CHECK(group), NULL, "group null");
	retvm_if(NULL_CHECK(color_class), NULL, "color_class null");
	CLK_FUN_BEG();
	Evas_Object *ret = NULL;
	ret = load_edj(parent, file, group);
	retvm_if(NULL_CHECK(ret), NULL, "ret null");
	edje_object_signal_callback_add(_EDJ(ret), "mouse,down", "rect",
					_clk_btn_mouse_down_cb,
					(void *)color_class);
	edje_object_signal_callback_add(_EDJ(ret), "mouse,up", "rect",
					_clk_btn_mouse_up_cb,
					(void *)color_class);
	if (clicked_cb) {
		edje_object_signal_callback_add(_EDJ(ret), "mouse,clicked",
						"rect", clicked_cb, data);
	}
	CLK_FUN_END();
	return ret;
}
开发者ID:ysdafa,项目名称:test,代码行数:26,代码来源:noa_fwk_widget.c


示例9: OpalSupportSetPassword

/**
  Opens a session with OPAL_UID_ADMIN_SP as OPAL_ADMIN_SP_SID_AUTHORITY,
  sets OPAL_UID_ADMIN_SP_C_PIN_SID with the new password,
  and sets OPAL_LOCKING_SP_C_PIN_ADMIN1 with the new password.

  @param[in]      Session            The opal session for the opal device.
  @param[in]      OldPassword        Current admin password
  @param[in]      OldPasswordLength  Length of current admin password in bytes
  @param[in]      NewPassword        New admin password to set
  @param[in]      NewPasswordLength  Length of new password in bytes
  @param[in]      DevicePath         The device path for the opal devcie.
  @param[in]      SetAdmin           Whether set admin password or user password.
                                     TRUE for admin, FALSE for user.

**/
TCG_RESULT
EFIAPI
OpalSupportSetPassword(
  IN OPAL_SESSION              *Session,
  IN VOID                      *OldPassword,
  IN UINT32                    OldPasswordLength,
  IN VOID                      *NewPassword,
  IN UINT32                    NewPasswordLength,
  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath,
  IN BOOLEAN                   SetAdmin
  )
{
  TCG_RESULT   Ret;

  NULL_CHECK(Session);
  NULL_CHECK(OldPassword);
  NULL_CHECK(NewPassword);

  if (SetAdmin) {
    Ret = OpalUtilSetAdminPassword(Session, OldPassword, OldPasswordLength, NewPassword, NewPasswordLength);
  } else {
    Ret = OpalUtilSetUserPassword(Session, OldPassword, OldPasswordLength, NewPassword, NewPasswordLength);
  }
  if (Ret == TcgResultSuccess && !gInSmm) {
    OpalSupportSendPasword (DevicePath, NewPasswordLength, NewPassword);
  }

  return Ret;
}
开发者ID:leoliao1980,项目名称:edk2,代码行数:44,代码来源:OpalPasswordSupportLib.c


示例10: clExtendedPoolDestroy

static
ClRcT
clExtendedPoolDestroy(
    ClPoolHeaderT*          pPoolHeader,
    ClExtendedPoolHeaderT*  pExtendedPoolHeader)
{
    ClRcT rc = CL_OK;
    NULL_CHECK (pPoolHeader);
    NULL_CHECK (pExtendedPoolHeader);

    CL_POOL_FREE_EXT (pExtendedPoolHeader->pExtendedPoolStart,
            pPoolHeader->poolConfig.incrementPoolSize);
    /*
     * For debug mode this would be set to the free list.
     * Rip this off if it exists.
     */
    if (pExtendedPoolHeader->pFreeListStart)
    {
        CL_POOL_FREE_EXTERNAL (pPoolHeader->flags,
                pExtendedPoolHeader->pFreeListStart,
                sizeof (ClFreeListHeaderT) * pExtendedPoolHeader->numChunks);
    }
    CL_POOL_FREE_EXTERNAL (pPoolHeader->flags, (void*)pExtendedPoolHeader,
            sizeof (*pExtendedPoolHeader));
    CL_POOL_STATS_UPDATE_EXTENDED_POOLS_DECR(pPoolHeader);
    return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:27,代码来源:clPool.c


示例11: TcgAddAtom

/**
   simple tokens - atoms: tiny, short, medium, long and empty atoms.
   tiny atom can be a signed or unsigned integer.
   short, medium, long can be a signed or unsigned integer OR a complete or non-final byte sequence.

  @param       CreateStruct       The create structure.
  @param       Data               The data need to add.
  @param       DataSize           The data size.
  @param       ByteOrInt,         Data format is byte or int.
  @param       SignOrCont         sign or cont.


**/
TCG_RESULT
TcgAddAtom(
  TCG_CREATE_STRUCT   *CreateStruct,
  const VOID          *Data,
  UINT32              DataSize,
  UINT8               ByteOrInt,
  UINT8               SignOrCont
  )
{
  const UINT8* DataBytes;
  TCG_SIMPLE_TOKEN_TINY_ATOM TinyAtom;
  TCG_SIMPLE_TOKEN_SHORT_ATOM ShortAtom;
  TCG_SIMPLE_TOKEN_MEDIUM_ATOM MediumAtom;
  TCG_SIMPLE_TOKEN_LONG_ATOM LongAtom;

  NULL_CHECK(CreateStruct);

  if (DataSize == 0) {
    if (ByteOrInt == TCG_ATOM_TYPE_INTEGER) {
      DEBUG ((DEBUG_INFO, "0-Size integer not allowed\n"));
      return TcgResultFailure;
    }
  } else {
    // if DataSize != 0, Data must be valid
    NULL_CHECK(Data);
  }

  // encode Data using the shortest possible atom
  DataBytes = (const UINT8*)Data;
  if ((DataSize == 1) &&
      (ByteOrInt == TCG_ATOM_TYPE_INTEGER) &&
      ((SignOrCont != 0 && ((TCG_TOKEN_TINYATOM_SIGNED_MIN_VALUE <= *(INT8*)Data) && (*(INT8*)Data <= TCG_TOKEN_TINYATOM_SIGNED_MAX_VALUE))) ||
       (SignOrCont == 0 && ((*DataBytes <= TCG_TOKEN_TINYATOM_UNSIGNED_MAX_VALUE))))
     ) {
    TinyAtom.TinyAtomBits.IsZero = 0;
    TinyAtom.TinyAtomBits.Sign = SignOrCont;
    TinyAtom.TinyAtomBits.Data = *DataBytes & TCG_TOKEN_TINYATOM_UNSIGNED_MAX_VALUE;
    return TcgAddRawTokenData(CreateStruct, NULL, 0, (UINT8*)&TinyAtom, sizeof(TCG_SIMPLE_TOKEN_TINY_ATOM), FALSE);
  }

  if (DataSize <= TCG_TOKEN_SHORTATOM_MAX_BYTE_SIZE) {
    ShortAtom.ShortAtomBits.IsOne = 1;
    ShortAtom.ShortAtomBits.IsZero = 0;
    ShortAtom.ShortAtomBits.ByteOrInt = ByteOrInt;
    ShortAtom.ShortAtomBits.SignOrCont = SignOrCont;
    ShortAtom.ShortAtomBits.Length = DataSize & 0x0F;
    return TcgAddRawTokenData(CreateStruct, &ShortAtom, sizeof(TCG_SIMPLE_TOKEN_SHORT_ATOM), Data, DataSize, ByteOrInt == TCG_ATOM_TYPE_INTEGER);
  }

  if (DataSize <= TCG_TOKEN_MEDIUMATOM_MAX_BYTE_SIZE) {
    MediumAtom.MediumAtomBits.IsOne1 = 1;
    MediumAtom.MediumAtomBits.IsOne2 = 1;
    MediumAtom.MediumAtomBits.IsZero = 0;
    MediumAtom.MediumAtomBits.ByteOrInt = ByteOrInt;
    MediumAtom.MediumAtomBits.SignOrCont = SignOrCont;
    MediumAtom.MediumAtomBits.LengthLow = DataSize & 0xFF;
    MediumAtom.MediumAtomBits.LengthHigh = (DataSize >> TCG_MEDIUM_ATOM_LENGTH_HIGH_SHIFT) & TCG_MEDIUM_ATOM_LENGTH_HIGH_MASK;
    return TcgAddRawTokenData(CreateStruct, &MediumAtom, sizeof(TCG_SIMPLE_TOKEN_MEDIUM_ATOM), Data, DataSize, ByteOrInt == TCG_ATOM_TYPE_INTEGER);
  }
开发者ID:shijunjing,项目名称:edk2,代码行数:72,代码来源:TcgStorageCore.c


示例12: cdbGDBMNextRecordGet

static ClRcT
cdbGDBMNextRecordGet(ClDBHandleT      dbHandle,         /* Handle to the database */
                     ClDBKeyT         currentKey,       /* Handle to the current key */
                     ClUint32T       currentKeySize,   /* Size of the current key */
                     ClDBKeyT*        pDBNextKey,       /* pointer to handle in which the next key is returned */
                     ClUint32T*      pNextKeySize,     /* pointer to size in which the next key's size is returned */
                     ClDBRecordT*     pDBNextRec,       /* pointer to handle in which the next record is returned */
                     ClUint32T*      pNextRecSize)     /* pointer to size in which the next record's size is returned */
{
  ClRcT errorCode = CL_OK;
  GDBMHandle_t* pGDBMHandle = (GDBMHandle_t*)dbHandle;
  datum key = {NULL, 0};
  datum nextKey = {NULL, 0};
  datum data = {NULL, 0};

  CL_FUNC_ENTER();
  NULL_CHECK(pDBNextKey);
  NULL_CHECK(pNextKeySize);

  NULL_CHECK(pDBNextRec);
  NULL_CHECK(pNextRecSize);

  key.dsize = currentKeySize;
  key.dptr = (ClCharT *)currentKey;

  /* Retrieve the next key */
  nextKey = gdbm_nextkey(pGDBMHandle->gdbmInstance, key);

  if(NULL == nextKey.dptr) {
    /* The next key does not exist. So return error */
    errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
    CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM get next key failed"));
    CL_FUNC_EXIT();
    return(errorCode);
  }

  *pDBNextKey = (ClDBKeyT)nextKey.dptr;
  *pNextKeySize = nextKey.dsize;

  /* retrieve the associated record */
  data = gdbm_fetch(pGDBMHandle->gdbmInstance, nextKey);

  if(NULL == data.dptr) {
    errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
    CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM fetch record failed"));
    CL_FUNC_EXIT();
    return(errorCode);
  }
  
  *pDBNextRec = (ClDBRecordT)data.dptr;
  *pNextRecSize = data.dsize;

  CL_FUNC_EXIT();
  return(CL_OK);  

}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:56,代码来源:clovisGDBM.c


示例13: clPoolFree

ClRcT
clPoolFree(
    ClUint8T*   pChunk,
    void*       pCookie)
{
    ClRcT                   rc                  = CL_OK;
    ClPoolHeaderT*          pPoolHeader         = NULL;
    ClExtendedPoolHeaderT*  pExtendedPoolHeader = NULL;
    ClUint32T               freeChunk           = 0;
    ClUint32T               chunkSize           = 0;
    ClFreeListHeaderT*      pCurrentFreeList    = NULL;

    NULL_CHECK (pChunk);
    NULL_CHECK (pCookie);

    pExtendedPoolHeader = (ClExtendedPoolHeaderT*)pCookie;
    pPoolHeader = pExtendedPoolHeader->pPoolHeader;

    CL_POOL_LOG(CL_LOG_SEV_TRACE,"freeing chunk  pChunk = %p,extended pool = %p\n", pChunk,(void*)pExtendedPoolHeader);

    CL_POOL_LOCK (pPoolHeader);

    chunkSize = pPoolHeader->poolConfig.chunkSize;

    CL_POOL_REVOKE_SIZE(pPoolHeader->flags,chunkSize);

    CL_POOL_FREE_LIST_GET (pChunk, pExtendedPoolHeader, pCurrentFreeList);

    pCurrentFreeList->pChunk = (ClUint8T*)pChunk;
    pCurrentFreeList->pNextFreeChunk = pExtendedPoolHeader->pFirstFreeChunk;
    pExtendedPoolHeader->pFirstFreeChunk = pCurrentFreeList;

    CL_POOL_STATS_UPDATE_FREES (pPoolHeader);
    freeChunk = ++pExtendedPoolHeader->numFreeChunks;
    if (freeChunk == 1)
    {
        /*Was full before. Move it to partial*/
        CL_POOL_LOG(CL_LOG_SEV_TRACE,"Dequeuing extended pool %p from full list and moving the extended pool to partial list\n", (void*)pExtendedPoolHeader);
        CL_POOL_EXTENDED_FULLLIST_DEQUEUE (pPoolHeader, pExtendedPoolHeader);
        CL_POOL_EXTENDED_PARTIALLIST_QUEUE (pPoolHeader, pExtendedPoolHeader);
    }
    if (freeChunk == pExtendedPoolHeader->numChunks)
    {
        /*
         *  Add to the free extended pool list after deleting from the partial
         *  list
         */
        CL_POOL_LOG(CL_LOG_SEV_TRACE, "Dequeuing extended pool %p from partial list and moving the extended pool to free list\n", (void*)pExtendedPoolHeader);
        CL_POOL_EXTENDED_PARTIALLIST_DEQUEUE(pPoolHeader,pExtendedPoolHeader);
        CL_POOL_EXTENDED_FREELIST_QUEUE(pPoolHeader,pExtendedPoolHeader);
    }
    CL_POOL_UNLOCK(pPoolHeader);
    rc = CL_OK;
    return rc;
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:55,代码来源:clPool.c


示例14: clPoolStartGet

/*Currently used by the heap debug layer*/
ClRcT
clPoolStartGet(
    void*   pCookie,
    void**  ppAddress)
{
    ClRcT rc = CL_OK;
    NULL_CHECK (pCookie);
    NULL_CHECK (ppAddress);
    *ppAddress = ((ClExtendedPoolHeaderT*)pCookie)->pExtendedPoolStart;
    return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:12,代码来源:clPool.c


示例15: PrintJavaVersion

/*
 * Prints the version information from the java.version and other properties.
 */
static void
PrintJavaVersion(JNIEnv *env)
{
    jclass ver;
    jmethodID print;

    NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version"));
    NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V"));

    (*env)->CallStaticVoidMethod(env, ver, print);
}
开发者ID:zxlooong,项目名称:jdk14219,代码行数:14,代码来源:java.c


示例16: clPoolChunkSizeGet

ClRcT
clPoolChunkSizeGet(
    void*       pCookie,
    ClUint32T*  pSize)
{
    ClPoolHeaderT* pPoolHeader = NULL;
    NULL_CHECK (pCookie);
    NULL_CHECK (pSize);
    pPoolHeader = ((ClExtendedPoolHeaderT*)pCookie)->pPoolHeader;
    *pSize = pPoolHeader->poolConfig.chunkSize;
    return CL_OK;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:12,代码来源:clPool.c


示例17: TcgGetMethodStatus

/**
 Returns the method status of the current subpacket.  Does not affect the current position
 in the ComPacket.  In other words, it can be called whenever you have a valid SubPacket.

 @param [in/out]  ParseStruct       Structure used to parse received TCG response
 @param [in/out]  MethodStatus      Method status retrieved of the current SubPacket

**/
TCG_RESULT
EFIAPI
TcgGetMethodStatus(
  const TCG_PARSE_STRUCT            *ParseStruct,
  UINT8                             *MethodStatus
  )
{
  TCG_PARSE_STRUCT TmpParseStruct;
  TCG_TOKEN TcgToken;
  UINT8 Reserved1, Reserved2;

  NULL_CHECK(ParseStruct);
  NULL_CHECK(MethodStatus);

  if (ParseStruct->ComPacket == NULL ||
      ParseStruct->CurPacket == NULL ||
      ParseStruct->CurSubPacket == NULL
     ) {
    DEBUG ((DEBUG_INFO, "unexpected state: ComPacket=%p CurPacket=%p CurSubPacket=%p\n", ParseStruct->ComPacket, ParseStruct->CurPacket, ParseStruct->CurSubPacket));
    return TcgResultFailureInvalidAction;
  }

  // duplicate ParseStruct, then don't need to "reset" location cur ptr
  CopyMem (&TmpParseStruct, ParseStruct, sizeof(TCG_PARSE_STRUCT));

  // method status list exists after the end method call in the subpacket
  // skip tokens until ENDDATA is found
  do {
    ERROR_CHECK(TcgGetNextToken(&TmpParseStruct, &TcgToken));
  } while (TcgToken.Type != TcgTokenTypeEndOfData);

  // only reach here if enddata is found
  // at this point, the curptr is pointing at method status list beginning
  ERROR_CHECK(TcgGetNextStartList(&TmpParseStruct));
  ERROR_CHECK(TcgGetNextUINT8(&TmpParseStruct, MethodStatus));
  ERROR_CHECK(TcgGetNextUINT8(&TmpParseStruct, &Reserved1));
  ERROR_CHECK(TcgGetNextUINT8(&TmpParseStruct, &Reserved2));
  ERROR_CHECK(TcgGetNextEndList(&TmpParseStruct));

  if (Reserved1 != 0) {
    DEBUG ((DEBUG_INFO, "Method status reserved1 = 0x%02X (expected 0)\n", Reserved1));
    return TcgResultFailure;
  }

  if (Reserved2 != 0) {
    DEBUG ((DEBUG_INFO, "Method status reserved2 = 0x%02X (expected 0)\n", Reserved1));
    return TcgResultFailure;
  }

  return TcgResultSuccess;
}
开发者ID:EvanLloyd,项目名称:tianocore,代码行数:59,代码来源:TcgStorageUtil.c


示例18: cdbGDBMFirstRecordGet

static ClRcT
cdbGDBMFirstRecordGet(ClDBHandleT      dbHandle,    /* Handle to the database */
                      ClDBKeyT*        pDBKey,      /* Pointer to handle in which the key handle is returned */
                      ClUint32T*      pKeySize,    /* Pointer to size, in which the size of the key is returned */
                      ClDBRecordT*     pDBRec,      /* Pointer to handle in which the record handle is returned */
                      ClUint32T*      pRecSize)    /* Pointer to size, in which the size of the record is returned */
{
  ClRcT errorCode = CL_OK;
  GDBMHandle_t* pGDBMHandle = (GDBMHandle_t*)dbHandle;
  datum key = {NULL, 0};
  datum data = {NULL, 0};

  CL_FUNC_ENTER();
  NULL_CHECK(pDBKey);
  NULL_CHECK(pKeySize);

  NULL_CHECK(pDBRec);
  NULL_CHECK(pRecSize);

  /* Retrieve the first key in the database */  
  key = gdbm_firstkey(pGDBMHandle->gdbmInstance);

  if(NULL == key.dptr) {
    /* The first key does exist. So return error */
    errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
    CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM record get failed"));
    CL_FUNC_EXIT();
    return(errorCode);
  }

  *pDBKey = (ClDBKeyT)key.dptr;
  *pKeySize = key.dsize;

  /* Retrieve the associated record in the database */
  data = gdbm_fetch(pGDBMHandle->gdbmInstance, key);

  if(NULL == data.dptr) {
    errorCode = CL_DBAL_RC(CL_ERR_NOT_EXIST);
    CL_DEBUG_PRINT ( CL_DEBUG_TRACE,("\nGDBM record fetch failed"));
    CL_FUNC_EXIT();
    return(errorCode);
  }
  
  *pDBRec = (ClDBRecordT)data.dptr;
  *pRecSize = data.dsize;

  CL_FUNC_EXIT();
  return(CL_OK);  

}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:50,代码来源:clovisGDBM.c


示例19: NewStringArray

/*
 * Creates an array of Java string objects from the specified array of C
 * strings. Returns 0 if the array could not be created.
 */
jarray NewStringArray(JNIEnv *env, char **cpp, int count)
{
	jclass cls;
	jarray arr;
	int i;
	NULL_CHECK(cls = env->FindClass( "java/lang/String"));
	NULL_CHECK(arr = env->NewObjectArray( count+3, cls, 0));
	addStringToStringArray(env,arr,mainWabaClassName,0);
	addStringToStringArray(env,arr,"/color",1);
	for (i = 0; i < count; i++) {
		addStringToStringArray(env,arr,*cpp++,i+2);
	}
	addStringToStringArray(env,arr,mainClassName,count+2);
	return arr;
}
开发者ID:concord-consortium,项目名称:teemss,代码行数:19,代码来源:jre_main.c


示例20: OpalSupportEnableOpalFeature

/**
  Enable Opal Feature for the input device.

  @param[in]      Session            The opal session for the opal device.
  @param[in]      Msid               Msid
  @param[in]      MsidLength         Msid Length
  @param[in]      Password           Admin password
  @param[in]      PassLength         Length of password in bytes
  @param[in]      DevicePath         The device path for the opal devcie.

**/
TCG_RESULT
EFIAPI
OpalSupportEnableOpalFeature (
  IN OPAL_SESSION              *Session,
  IN VOID                      *Msid,
  IN UINT32                    MsidLength,
  IN VOID                      *Password,
  IN UINT32                    PassLength,
  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePath
  )
{
  TCG_RESULT   Ret;

  NULL_CHECK(Session);
  NULL_CHECK(Msid);
  NULL_CHECK(Password);

  Ret = OpalUtilSetAdminPasswordAsSid(
                          Session,
                          Msid,
                          MsidLength,
                          Password,
                          PassLength
                          );
  if (Ret == TcgResultSuccess) {
    //
    // Enable global locking range
    //
    Ret = OpalUtilSetOpalLockingRange(
                              Session,
                              Password,
                              PassLength,
                              OPAL_LOCKING_SP_LOCKING_GLOBALRANGE,
                              0,
                              0,
                              TRUE,
                              TRUE,
                              FALSE,
                              FALSE
                              );
  }

  if (Ret == TcgResultSuccess && !gInSmm) {
    OpalSupportSendPasword (DevicePath, PassLength, Password);
  }

  return Ret;
}
开发者ID:leoliao1980,项目名称:edk2,代码行数:59,代码来源:OpalPasswordSupportLib.c



注:本文中的NULL_CHECK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NULL_IF_CONFIG_SMALL函数代码示例发布时间:2022-05-30
下一篇:
C++ NULLSTR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap