1 Star 0 Fork 5.4K

OpenHarmony_EU incubator / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hdf_sbuf-h.md 26.32 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

hdf_sbuf.h

Overview

Related Modules:

Core

Description:

Defines functions related to a HdfSBuf. The HDF provides data serialization and deserialization capabilities for data transmission between user-mode applications and kernel-mode drivers.

Since:

1.0

Summary

Data Structures

Data Structure Name

Description

HdfSBuf

Defines a HdfSBuf.

Functions

Function Name

Description

HdfSbufWriteBuffer (struct HdfSBuf *sbuf, const void *data, uint32_t writeSize)

bool

Writes a data segment to a SBuf.

HdfSbufWriteUint64 (struct HdfSBuf *sbuf, uint64_t value)

bool

Writes a 64-bit unsigned integer to a SBuf.

HdfSbufWriteUint32 (struct HdfSBuf *sbuf, uint32_t value)

bool

Writes a 32-bit unsigned integer to a SBuf.

HdfSbufWriteUint16 (struct HdfSBuf *sbuf, uint16_t value)

bool

Writes a 16-bit unsigned integer to a SBuf.

HdfSbufWriteUint8 (struct HdfSBuf *sbuf, uint8_t value)

bool

Writes an 8-bit unsigned integer to a SBuf.

HdfSbufWriteInt64 (struct HdfSBuf *sbuf, int64_t value)

bool

Writes a 64-bit signed integer to a SBuf.

HdfSbufWriteInt32 (struct HdfSBuf *sbuf, int32_t value)

bool

Writes a 32-bit signed integer to a SBuf.

HdfSbufWriteInt16 (struct HdfSBuf *sbuf, int16_t value)

bool

Writes a 16-bit signed integer to a SBuf.

HdfSbufWriteInt8 (struct HdfSBuf *sbuf, int8_t value)

bool

Writes an 8-bit signed integer to a SBuf.

HdfSbufWriteString (struct HdfSBuf *sbuf, const char *value)

bool

Writes a string to a SBuf.

HdfSbufReadBuffer (struct HdfSBuf *sbuf, const void **data, uint32_t *readSize)

bool

Reads a data segment from a SBuf.

HdfSbufReadUint64 (struct HdfSBuf *sbuf, uint64_t *value)

bool

Reads a 64-bit unsigned integer from a SBuf.

HdfSbufReadUint32 (struct HdfSBuf *sbuf, uint32_t *value)

bool

Reads a 32-bit unsigned integer from a SBuf.

HdfSbufReadUint16 (struct HdfSBuf *sbuf, uint16_t *value)

bool

Reads a 16-bit unsigned integer from a SBuf.

HdfSbufReadUint8 (struct HdfSBuf *sbuf, uint8_t *value)

bool

Reads an 8-bit unsigned integer from a SBuf.

HdfSbufReadInt64 (struct HdfSBuf *sbuf, int64_t *value)

bool

Reads a 64-bit signed integer from a SBuf.

HdfSbufReadInt32 (struct HdfSBuf *sbuf, int32_t *value)

bool

Reads a 32-bit signed integer from a SBuf.

HdfSbufReadInt16 (struct HdfSBuf *sbuf, int16_t *value)

bool

Reads a 16-bit signed integer from a SBuf.

HdfSbufReadInt8 (struct HdfSBuf *sbuf, int8_t *value)

bool

Reads an 8-bit signed integer from a SBuf.

HdfSbufReadString (struct HdfSBuf *sbuf)

const char *

Reads a string from a SBuf.

HdfSbufGetData (const struct HdfSBuf *sbuf)

uint8_t *

Obtains the pointer to the data stored in aSBuf.

HdfSbufFlush (struct HdfSBuf *sbuf)

void

Clears the data stored in a SBuf.

HdfSbufGetCapacity (const struct HdfSBuf *sbuf)

size_t

Obtains the capacity of a SBuf.

HdfSbufGetDataSize (const struct HdfSBuf *sbuf)

size_t

Obtains the size of the data stored in a SBuf.

HdfSBufObtain (size_t capacity)

struct HdfSBuf *

Obtains a SBuf instance.

HdfSBufObtainDefaultSize (void)

struct HdfSBuf *

Obtains a SBuf instance of the default capacity (256 bytes).

HdfSBufBind (uintptr_t base, size_t size)

struct HdfSBuf *

Creates a SBuf instance with the specified data and size. The pointer to the data stored in the SBuf is released by the caller, and the written data size should not exceed the specified value of size.

HdfSBufRecycle (struct HdfSBuf *sbuf)

void

Releases a SBuf .

HdfSBufMove (struct HdfSBuf *sbuf)

struct HdfSBuf *

Creates a SBuf instance with an original SBuf. This function moves the data stored in the original SBuf to the new one without memory copy.

HdfSBufCopy (const struct HdfSBuf *sbuf)

struct HdfSBuf *

Creates a SBuf instance with an original SBuf. This function copies the data stored in the original SBuf to the new one.

HdfSbufTransDataOwnership (struct HdfSBuf *sbuf)

void

Transfers the data ownership to a SBuf. Once the SBuf is released, the bound data memory is also released. This function is used together with HdfSBufBind.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/open-harmony-eu-incubator/docs.git
git@gitee.com:open-harmony-eu-incubator/docs.git
open-harmony-eu-incubator
docs
docs
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891