API参考
载入中...
搜索中...
未找到
sal_fileimpl.h
1/*
2 * This file is part of the openHiTLS project.
3 *
4 * openHiTLS is licensed under the Mulan PSL v2.
5 * You can use this software according to the terms and conditions of the Mulan PSL v2.
6 * You may obtain a copy of Mulan PSL v2 at:
7 *
8 * http://license.coscl.org.cn/MulanPSL2
9 *
10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13 * See the Mulan PSL v2 for more details.
14 */
15
16#ifndef SAL_FILEIMPL_H
17#define SAL_FILEIMPL_H
18
19#include "hitls_build.h"
20#ifdef HITLS_BSL_SAL_FILE
21
22#include <stdint.h>
23#include "bsl_sal.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef struct {
30 BslSalFileOpen pfFileOpen;
31 BslSalFileRead pfFileRead;
32 BslSalFileWrite pfFileWrite;
33 BslSalFileClose pfFileClose;
34 BslSalFileLength pfFileLength;
35 BslSalFileError pfFileError;
36 BslSalFileTell pfFileTell;
37 BslSalFileSeek pfFileSeek;
38 BslSalFGets pfFileGets;
39 BslSalFPuts pfFilePuts;
40 BslSalFlush pfFileFlush;
41 BslSalFeof pfFileEof;
42 BslSalFSetAttr pfFileSetAttr;
43 BslSalFGetAttr pfFileGetAttr;
44} BSL_SAL_FileCallback;
45
46int32_t SAL_FileCallBack_Ctrl(BSL_SAL_CB_FUNC_TYPE type, void *funcCb);
47
48#if defined(HITLS_BSL_SAL_LINUX) || defined(HITLS_BSL_SAL_DARWIN)
49int32_t SAL_FILE_FOpen(bsl_sal_file_handle *stream, const char *path, const char *mode);
50int32_t SAL_FILE_FRead(bsl_sal_file_handle stream, void *buffer, size_t size, size_t num, size_t *len);
51int32_t SAL_FILE_FWrite(bsl_sal_file_handle stream, const void *buffer, size_t size, size_t num);
52void SAL_FILE_FClose(bsl_sal_file_handle stream);
53int32_t SAL_FILE_FLength(const char *path, size_t *len);
54bool SAL_FILE_FError(bsl_sal_file_handle stream);
55int32_t SAL_FILE_FTell(bsl_sal_file_handle stream, long *pos);
56int32_t SAL_FILE_FSeek(bsl_sal_file_handle stream, long offset, int32_t origin);
57char *SAL_FILE_FGets(bsl_sal_file_handle stream, char *buf, int32_t readLen);
58bool SAL_FILE_FPuts(bsl_sal_file_handle stream, const char *buf);
59bool SAL_FILE_Flush(bsl_sal_file_handle stream);
60int32_t SAL_FILE_Feof(bsl_sal_file_handle stream);
61int32_t SAL_FILE_FSetAttr(bsl_sal_file_handle stream, int cmd, const void *arg);
62int32_t SAL_FILE_FGetAttr(bsl_sal_file_handle stream, void *arg);
63#endif
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif // HITLS_BSL_SAL_FILE
70#endif // SAL_FILEIMPL_H
int32_t(* BslSalFileSeek)(bsl_sal_file_handle stream, long offset, int32_t origin)
Change the current file position associated with stream to a new location within the file.
定义 bsl_sal.h:1693
bool(* BslSalFlush)(bsl_sal_file_handle stream)
Flush cache buffer associated with the specified output stream.
定义 bsl_sal.h:1736
void(* BslSalFileClose)(bsl_sal_file_handle stream)
Close the file.
定义 bsl_sal.h:1630
int32_t(* BslSalFSetAttr)(bsl_sal_file_handle stream, int cmd, const void *arg)
Set the attributes associated with the terminal referred to by the open stream.
定义 bsl_sal.h:1766
int32_t(* BslSalFileLength)(const char *path, size_t *len)
Obtain the file length.
定义 bsl_sal.h:1646
int32_t(* BslSalFileTell)(bsl_sal_file_handle stream, long *pos)
Get the current file position in stream.
定义 bsl_sal.h:1676
int32_t(* BslSalFeof)(bsl_sal_file_handle stream)
Indicate whether the end-of-file flag is set for the given stream.
定义 bsl_sal.h:1749
int32_t(* BslSalFileRead)(bsl_sal_file_handle stream, void *buffer, size_t size, size_t num, size_t *len)
Read the file.
定义 bsl_sal.h:1599
int32_t(* BslSalFileOpen)(bsl_sal_file_handle *stream, const char *path, const char *mode)
Open the file.
定义 bsl_sal.h:1580
bool(* BslSalFileError)(bsl_sal_file_handle stream)
Test the error indicator for the given stream.
定义 bsl_sal.h:1660
int32_t(* BslSalFGetAttr)(bsl_sal_file_handle stream, void *arg)
Get the attributes associated with the terminal referred to by the open stream.
定义 bsl_sal.h:1782
int32_t(* BslSalFileWrite)(bsl_sal_file_handle stream, const void *buffer, size_t size, size_t num)
Write the file
定义 bsl_sal.h:1617
char *(* BslSalFGets)(bsl_sal_file_handle stream, char *buf, int32_t readLen)
Read a line from the stream and store it into the buffer.
定义 bsl_sal.h:1709
bool(* BslSalFPuts)(bsl_sal_file_handle stream, const char *buf)
Write a string to the specified stream.
定义 bsl_sal.h:1723