11bd4fe43Sopenharmony_ci/*
21bd4fe43Sopenharmony_ci * @file hi_fs.h
31bd4fe43Sopenharmony_ci *
41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
101bd4fe43Sopenharmony_ci *
111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
151bd4fe43Sopenharmony_ci * limitations under the License.
161bd4fe43Sopenharmony_ci */
171bd4fe43Sopenharmony_ci
181bd4fe43Sopenharmony_ci/**
191bd4fe43Sopenharmony_ci * @defgroup iot_fs Filesystem
201bd4fe43Sopenharmony_ci * @ingroup osa
211bd4fe43Sopenharmony_ci */
221bd4fe43Sopenharmony_ci#ifndef __HI_FS_H__
231bd4fe43Sopenharmony_ci#define __HI_FS_H__
241bd4fe43Sopenharmony_ci
251bd4fe43Sopenharmony_ci#include <hi_types.h>
261bd4fe43Sopenharmony_ci
271bd4fe43Sopenharmony_citypedef struct {
281bd4fe43Sopenharmony_ci    hi_u32  size;
291bd4fe43Sopenharmony_ci    hi_u32  next_offset;
301bd4fe43Sopenharmony_ci    hi_char name[1];
311bd4fe43Sopenharmony_ci}hi_file_list;
321bd4fe43Sopenharmony_ci
331bd4fe43Sopenharmony_ci
341bd4fe43Sopenharmony_ci#define HI_FS_SEEK_SET                 (0)  /**< set file offset to offset */
351bd4fe43Sopenharmony_ci#define HI_FS_SEEK_CUR                 (1)  /**< set file offset to current plus offset */
361bd4fe43Sopenharmony_ci#define HI_FS_SEEK_END                 (2)  /**< set file offset to EOF plus offset */
371bd4fe43Sopenharmony_ci
381bd4fe43Sopenharmony_ci#define HI_FS_O_RDONLY       00
391bd4fe43Sopenharmony_ci#define HI_FS_O_WRONLY       01
401bd4fe43Sopenharmony_ci#define HI_FS_O_RDWR         02
411bd4fe43Sopenharmony_ci
421bd4fe43Sopenharmony_ci#define HI_FS_O_CREAT        0100
431bd4fe43Sopenharmony_ci#define HI_FS_O_EXCL         0200
441bd4fe43Sopenharmony_ci#define HI_FS_O_TRUNC        01000
451bd4fe43Sopenharmony_ci#define HI_FS_O_APPEND       02000
461bd4fe43Sopenharmony_ci#define HI_FS_O_PATH         010000000
471bd4fe43Sopenharmony_ci
481bd4fe43Sopenharmony_ci
491bd4fe43Sopenharmony_ci#define HI_FS_O_SEARCH       HI_FS_O_PATH
501bd4fe43Sopenharmony_ci#define HI_FS_O_ACCMODE      (HI_FS_O_RDONLY | HI_FS_O_WRONLY | HI_FS_O_RDWR | HI_FS_O_SEARCH)
511bd4fe43Sopenharmony_ci
521bd4fe43Sopenharmony_ci/**
531bd4fe43Sopenharmony_ci* @ingroup  iot_fs
541bd4fe43Sopenharmony_ci* @brief Get filesystem error code.CNcomment:获取错误码。CNend
551bd4fe43Sopenharmony_ci*
561bd4fe43Sopenharmony_ci* @par 描述:
571bd4fe43Sopenharmony_ci*           @li Returns the filesystem's most recent error code value.CNcomment:返回文件系统最近的错误代码值。CNend
581bd4fe43Sopenharmony_ci*
591bd4fe43Sopenharmony_ci* @attention None
601bd4fe43Sopenharmony_ci* @param  None
611bd4fe43Sopenharmony_ci*
621bd4fe43Sopenharmony_ci* @retval filesystem error code.CNcomment:文件系统错误码。CNend
631bd4fe43Sopenharmony_ci* @par 依赖:
641bd4fe43Sopenharmony_ci*            @li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
651bd4fe43Sopenharmony_ci* @see hi_get_fs_error
661bd4fe43Sopenharmony_ci*/
671bd4fe43Sopenharmony_cihi_s32 hi_get_fs_error(hi_void);
681bd4fe43Sopenharmony_ci
691bd4fe43Sopenharmony_ci/**
701bd4fe43Sopenharmony_ci* @ingroup  iot_fs
711bd4fe43Sopenharmony_ci* @brief Set filesystem check and repair.CNcomment:设置文件系统加载时是否自动检查并修复。CNend
721bd4fe43Sopenharmony_ci*
731bd4fe43Sopenharmony_ci* @par 描述:
741bd4fe43Sopenharmony_ci*           @li Set filesystem check and repair, default True.
751bd4fe43Sopenharmony_ciCNcomment:设置文件系统加载时是否自动检查并修复,默认自动检查并修复。CNend
761bd4fe43Sopenharmony_ci*
771bd4fe43Sopenharmony_ci* @attention set before fs init.CNcomment:在文件系统初始化之前调用。CNend
781bd4fe43Sopenharmony_ci* @param  check      [IN] type  #hi_bool,whether check and repair when filesystem mount.
791bd4fe43Sopenharmony_ciCNcomment:是否自动检查并修复。CNend
801bd4fe43Sopenharmony_ci*
811bd4fe43Sopenharmony_ci* @retval None
821bd4fe43Sopenharmony_ci* @par 依赖:
831bd4fe43Sopenharmony_ci*            @li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
841bd4fe43Sopenharmony_ci* @see hi_get_fs_check
851bd4fe43Sopenharmony_ci*/
861bd4fe43Sopenharmony_cihi_void hi_set_fs_check(hi_bool check);
871bd4fe43Sopenharmony_ci
881bd4fe43Sopenharmony_ci/**
891bd4fe43Sopenharmony_ci* @ingroup  iot_fs
901bd4fe43Sopenharmony_ci* @brief Get filesystem check and repair.CNcomment:获取文件系统加载时是否自动检查并修复。CNend
911bd4fe43Sopenharmony_ci*
921bd4fe43Sopenharmony_ci* @par 描述:
931bd4fe43Sopenharmony_ci*           @li Get filesystem check and repair, default True.
941bd4fe43Sopenharmony_ciCNcomment:获取文件系统加载时是否自动检查并修复,默认自动检查并修复。CNend
951bd4fe43Sopenharmony_ci*
961bd4fe43Sopenharmony_ci* @attention None
971bd4fe43Sopenharmony_ci* @param  None
981bd4fe43Sopenharmony_ci*
991bd4fe43Sopenharmony_ci* @retval #HI_TRUE   auto check and repair when filesystem mount.
1001bd4fe43Sopenharmony_ci* @retval #HI_FALSE  not check and repair when filesystem mount.
1011bd4fe43Sopenharmony_ci* @par 依赖:
1021bd4fe43Sopenharmony_ci*            @li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
1031bd4fe43Sopenharmony_ci* @see hi_set_fs_check
1041bd4fe43Sopenharmony_ci*/
1051bd4fe43Sopenharmony_cihi_bool hi_get_fs_check(hi_void);
1061bd4fe43Sopenharmony_ci
1071bd4fe43Sopenharmony_ci/**
1081bd4fe43Sopenharmony_ci* @ingroup  iot_fs
1091bd4fe43Sopenharmony_ci* @brief Initialize virtual filesystem.CNcomment:初始化虚拟文件系统。CNend
1101bd4fe43Sopenharmony_ci*
1111bd4fe43Sopenharmony_ci* @par 描述:
1121bd4fe43Sopenharmony_ci*           @li Initialize virtual file system configuration related parameters.
1131bd4fe43Sopenharmony_ci             CNcomment:初始化虚拟文件系统配置相关参数。CNend
1141bd4fe43Sopenharmony_ci*           @li Mount partition to virtual file system work buffer.CNcomment:挂载分区到虚拟文件系统工作缓冲区。CNend
1151bd4fe43Sopenharmony_ci*
1161bd4fe43Sopenharmony_ci* @attention None
1171bd4fe43Sopenharmony_ci* @param  None
1181bd4fe43Sopenharmony_ci*
1191bd4fe43Sopenharmony_ci* @retval None
1201bd4fe43Sopenharmony_ci* @par 依赖:
1211bd4fe43Sopenharmony_ci*            @li hi_fs.h:describes the file system APIs.CNcomment:文件用于描述文件系统相关接口。CNend
1221bd4fe43Sopenharmony_ci* @see hi_fs_init
1231bd4fe43Sopenharmony_ci*/
1241bd4fe43Sopenharmony_cihi_void hi_fs_init(hi_void);
1251bd4fe43Sopenharmony_ci
1261bd4fe43Sopenharmony_ci/**
1271bd4fe43Sopenharmony_ci* @ingroup  iot_fs
1281bd4fe43Sopenharmony_ci* @brief  Open or create a file.CNcomment:打开或创建文件。 CNend
1291bd4fe43Sopenharmony_ci*
1301bd4fe43Sopenharmony_ci* @par 描述:
1311bd4fe43Sopenharmony_ci*         Open or create a file.CNcomment:打开或创建指定的文件。CNend
1321bd4fe43Sopenharmony_ci*
1331bd4fe43Sopenharmony_ci* @attention The path length is less than 31 bytes, excluding the terminator.
1341bd4fe43Sopenharmony_ci             Maximum support for opening 32 files at the same time.
1351bd4fe43Sopenharmony_ci
1361bd4fe43Sopenharmony_ci* @param  path      [IN] type  #const hi_char*,file name  CNcomment:要打开或创建的目标文件。CNend
1371bd4fe43Sopenharmony_ci*
1381bd4fe43Sopenharmony_ci* @param flags      [IN] type #hi_u32,The flag combination is as follows:
1391bd4fe43Sopenharmony_ci*             HI_FS_O_RDONLY:Open file as read-only.CNcomment:以只读的方式打开文件。CNend
1401bd4fe43Sopenharmony_ci*             HI_FS_O_WRONLY:Open the file in write-only mode.CNcomment:以只写的方式打开文件。CNend
1411bd4fe43Sopenharmony_ci*             HI_FS_O_RDWR:Open file in read-write mode.CNcomment:以读写的方式打开文件。CNend
1421bd4fe43Sopenharmony_ci*             HI_FS_O_CREAT:If the file you want to open does not exist, the file will be created automatically.
1431bd4fe43Sopenharmony_ci                  CNcomment:如果要打开的文件不存在则自动建立该文件。CNend
1441bd4fe43Sopenharmony_ci*             HI_FS_O_EXCL:If HI_FS_O_CREAT is also set, this command will check to see if the file exists.
1451bd4fe43Sopenharmony_ci                  If the file does not exist, create the file, otherwise it will cause a file error to open.
1461bd4fe43Sopenharmony_ci                  CNcomment:如果HI_FS_O_CREAT也被设置,此指令会去检查文件是否存在。
1471bd4fe43Sopenharmony_ci                            文件若不存在则建立该文件,否则将导致打开文件错误。CNend
1481bd4fe43Sopenharmony_ci*             HI_FS_O_TRUNC:If the file exists and is opened in write mode, this flag will make the file length
1491bd4fe43Sopenharmony_ci                            clear to 0, and the data originally stored in the file will disappear.
1501bd4fe43Sopenharmony_ci              CNcomment:若文件存在并且以可写的模式打开时,此标志会令文件长度清为0,而原来存于该文件的数据也会消失。CNend
1511bd4fe43Sopenharmony_ci*             HI_FS_O_APPEND:When reading and writing a file, it will start moving from the end of the file, that is,
1521bd4fe43Sopenharmony_ci                              the written data will be added to the file in an additional way.
1531bd4fe43Sopenharmony_ci                   CNcomment:当读写文件时会从文件尾开始移动,也就是所写入的数据会以附加的方式加入到文件后面。CNend
1541bd4fe43Sopenharmony_ci*             CNcomment:打开文件时,可以传入多个参数选项。CNend
1551bd4fe43Sopenharmony_ci*
1561bd4fe43Sopenharmony_ci* @retval #>0     Success. Return file descriptor
1571bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
1581bd4fe43Sopenharmony_ci* @par 依赖:
1591bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
1601bd4fe43Sopenharmony_ci* @see  hi_open
1611bd4fe43Sopenharmony_ci*/
1621bd4fe43Sopenharmony_cihi_s32 hi_open(const hi_char* path, hi_u32 flags);
1631bd4fe43Sopenharmony_ci
1641bd4fe43Sopenharmony_ci/**
1651bd4fe43Sopenharmony_ci* @ingroup  iot_fs
1661bd4fe43Sopenharmony_ci* @brief  Close an open file.CNcomment:关闭已经打开的文件。 CNend
1671bd4fe43Sopenharmony_ci*
1681bd4fe43Sopenharmony_ci* @par 描述:
1691bd4fe43Sopenharmony_ci*         Close an open file.CNcomment:关闭一个已经打开的文件。CNend
1701bd4fe43Sopenharmony_ci*
1711bd4fe43Sopenharmony_ci* @attention None
1721bd4fe43Sopenharmony_ci* @param  fd      [IN] type  #hi_s32,file descriptor  CNcomment:需要关闭的文件描述符。CNend
1731bd4fe43Sopenharmony_ci*
1741bd4fe43Sopenharmony_ci*
1751bd4fe43Sopenharmony_ci* @retval #0     Success.
1761bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
1771bd4fe43Sopenharmony_ci* @par 依赖:
1781bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
1791bd4fe43Sopenharmony_ci* @see  hi_open
1801bd4fe43Sopenharmony_ci*/
1811bd4fe43Sopenharmony_cihi_s32 hi_close(hi_s32 fd);
1821bd4fe43Sopenharmony_ci
1831bd4fe43Sopenharmony_ci/**
1841bd4fe43Sopenharmony_ci* @ingroup  iot_fs
1851bd4fe43Sopenharmony_ci* @brief  Read file data of the specified size:从文件中,读取指定大小的文件数据。CNend
1861bd4fe43Sopenharmony_ci*
1871bd4fe43Sopenharmony_ci* @par 描述:
1881bd4fe43Sopenharmony_ci*         Read file data of the specified size:从文件中,读取指定大小的文件数据。CNend
1891bd4fe43Sopenharmony_ci*
1901bd4fe43Sopenharmony_ci* @attention None
1911bd4fe43Sopenharmony_ci* @param  fd       [IN] type  #hi_s32,file descriptor  CNcomment:需要读文件的文件描述符。CNend
1921bd4fe43Sopenharmony_ci* @param  buf      [OUT] type #hi_char*,save read data buffer  CNcomment:保存读数据缓冲区。CNend
1931bd4fe43Sopenharmony_ci* @param  len      [IN] type  #hi_u32,The number of bytes requested to be read
1941bd4fe43Sopenharmony_ci                              CNcomment:需要读取数据的长度。CNend
1951bd4fe43Sopenharmony_ci*
1961bd4fe43Sopenharmony_ci*
1971bd4fe43Sopenharmony_ci* @retval #>=0     Success. Returns the number of bytes read, if it returns 0, it means that the end of the file
1981bd4fe43Sopenharmony_ci                   has been reached or there is no data to be read.
1991bd4fe43Sopenharmony_ci                   CNcomment:返回读取的字节数,如果返回0,表示已到达文件尾或无可读取的数据。CNend
2001bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
2011bd4fe43Sopenharmony_ci* @par 依赖:
2021bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
2031bd4fe43Sopenharmony_ci* @see  hi_open
2041bd4fe43Sopenharmony_ci*/
2051bd4fe43Sopenharmony_cihi_s32 hi_read(hi_s32 fd, hi_char* buf, hi_u32 len);
2061bd4fe43Sopenharmony_ci
2071bd4fe43Sopenharmony_ci/**
2081bd4fe43Sopenharmony_ci* @ingroup  iot_fs
2091bd4fe43Sopenharmony_ci* @brief  Write file data of the specified size:向文件中,写入指定大小的文件数据。CNend
2101bd4fe43Sopenharmony_ci*
2111bd4fe43Sopenharmony_ci* @par 描述:
2121bd4fe43Sopenharmony_ci*         Write file data of the specified size:向文件中,写入指定大小的文件数据。CNend
2131bd4fe43Sopenharmony_ci*
2141bd4fe43Sopenharmony_ci* @attention None
2151bd4fe43Sopenharmony_ci* @param  fd      [IN] type  #hi_s32,file descriptor  CNcomment:需要写文件的文件描述符。CNend
2161bd4fe43Sopenharmony_ci* @param  buf     [IN] type  #hi_char*,Store data that needs to be written to a file.
2171bd4fe43Sopenharmony_ci                             CNcomment:存放需要写入文件的数据。CNend
2181bd4fe43Sopenharmony_ci* @param  len     [IN] type  #hi_u32,The number of bytes requested to be write  CNcomment:需要写入数据的长度。CNend
2191bd4fe43Sopenharmony_ci*
2201bd4fe43Sopenharmony_ci*
2211bd4fe43Sopenharmony_ci* @retval #>=0     Success. Returns the number of bytes actually written, if it returns 0, it means nothing to do.
2221bd4fe43Sopenharmony_ci                   reached or there is no data to be read.
2231bd4fe43Sopenharmony_ci                   CNcomment:返回实际写入的字节数,如果返回0,表示什么也没有做。CNend
2241bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
2251bd4fe43Sopenharmony_ci* @par 依赖:
2261bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
2271bd4fe43Sopenharmony_ci* @see  hi_open
2281bd4fe43Sopenharmony_ci*/
2291bd4fe43Sopenharmony_cihi_s32 hi_write(hi_s32 fd, const hi_char* buf, hi_u32 len);
2301bd4fe43Sopenharmony_ci
2311bd4fe43Sopenharmony_ci/**
2321bd4fe43Sopenharmony_ci* @ingroup  iot_fs
2331bd4fe43Sopenharmony_ci* @brief  Delete a file.CNcomment:删除指定的文件。 CNend
2341bd4fe43Sopenharmony_ci*
2351bd4fe43Sopenharmony_ci* @par 描述:
2361bd4fe43Sopenharmony_ci*         Delete a file.CNcomment:删除指定的文件。CNend
2371bd4fe43Sopenharmony_ci*
2381bd4fe43Sopenharmony_ci* @attention If the number of file descriptors currently open has reached the upper limit (32),
2391bd4fe43Sopenharmony_ci*            then one of the file descriptors must be closed, otherwise the file will not be deleted.
2401bd4fe43Sopenharmony_ci*            CNcomment:如果当前已经打开的文件描述符数已达上限(32个),
2411bd4fe43Sopenharmony_ci*                      那么必须要关闭其中一个文件描述符,否则文件将不能被删除。CNend
2421bd4fe43Sopenharmony_ci* @attention The path length is less than 31 bytes, excluding the terminator.
2431bd4fe43Sopenharmony_ci*
2441bd4fe43Sopenharmony_ci* @param  path      [IN] type  #const hi_char*,file name  CNcomment:要删除的目标文件。CNend
2451bd4fe43Sopenharmony_ci*
2461bd4fe43Sopenharmony_ci*
2471bd4fe43Sopenharmony_ci* @retval #0     Success.
2481bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
2491bd4fe43Sopenharmony_ci* @par 依赖:
2501bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
2511bd4fe43Sopenharmony_ci* @see  hi_open
2521bd4fe43Sopenharmony_ci*/
2531bd4fe43Sopenharmony_cihi_s32 hi_unlink(const hi_char *path);
2541bd4fe43Sopenharmony_ci
2551bd4fe43Sopenharmony_ci/**
2561bd4fe43Sopenharmony_ci* @ingroup  iot_fs
2571bd4fe43Sopenharmony_ci* @brief  Relocate read/write file offsets.CNcomment:重新定位文件的读/写偏移量。 CNend
2581bd4fe43Sopenharmony_ci*
2591bd4fe43Sopenharmony_ci* @par 描述:
2601bd4fe43Sopenharmony_ci*         Relocate read/write file offsets.CNcomment:重新定位文件的读/写偏移量。 CNend
2611bd4fe43Sopenharmony_ci*
2621bd4fe43Sopenharmony_ci* @attention whence is one of the following:
2631bd4fe43Sopenharmony_ci             SEEK_SET Point the read and write position to the file header and then increase the offset amount.
2641bd4fe43Sopenharmony_ci                      CNcomment:将读写位置指向文件头后再增加offset个位移量。CNend
2651bd4fe43Sopenharmony_ci             SEEK_CUR Increase the offset by the current read and write position.
2661bd4fe43Sopenharmony_ci                      CNcomment:以目前的读写位置往后增加offset个位移量。 CNend
2671bd4fe43Sopenharmony_ci             SEEK_END Point the read and write position to the end of the file and then increase the offset amount,
2681bd4fe43Sopenharmony_ci                      only support offset values can only be negative.
2691bd4fe43Sopenharmony_ci                      CNcomment:将读写位置指向文件尾后再增加offset个位移量,只支持offset的值为负数。CNend
2701bd4fe43Sopenharmony_ci             When the whennce value is SEEK_CUR or SEEK_END, the parameter offet allows
2711bd4fe43Sopenharmony_ci                      the occurrence of a negative value.
2721bd4fe43Sopenharmony_ci                      CNcomment:当whence 值为SEEK_CUR 或SEEK_END时,参数offet允许负值的出现。CNend
2731bd4fe43Sopenharmony_ci
2741bd4fe43Sopenharmony_ci* @param  fd      [IN] type  #hi_s32,file descriptor  CNcomment:需要重新定位读/写偏移量的文件描述符。CNend
2751bd4fe43Sopenharmony_ci* @param  offs    [IN] type  #hi_s32,Move the number of displacements of the read/write position
2761bd4fe43Sopenharmony_ci*                  according to the parameter whence  CNcomment:根据参数whence来移动读写位置的位移数。CNend
2771bd4fe43Sopenharmony_ci* @param  whence  [IN] type  #hi_u32,Read / write file offset. CNcomment:读/写文件偏移。CNend
2781bd4fe43Sopenharmony_ci*
2791bd4fe43Sopenharmony_ci* @retval #>=0    Success. Returns the current read and write position,
2801bd4fe43Sopenharmony_ci*                          which is how many bytes from the beginning of the file
2811bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
2821bd4fe43Sopenharmony_ci* @par 依赖:
2831bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
2841bd4fe43Sopenharmony_ci* @see  hi_open
2851bd4fe43Sopenharmony_ci*/
2861bd4fe43Sopenharmony_cihi_s32 hi_lseek(hi_s32 fd, hi_s32 offs, hi_u32 whence);
2871bd4fe43Sopenharmony_ci
2881bd4fe43Sopenharmony_ci/**
2891bd4fe43Sopenharmony_ci* @ingroup  iot_fs
2901bd4fe43Sopenharmony_ci* @brief  Relocate Enumerate all files in the directory, the file system does not support multi-level directories.
2911bd4fe43Sopenharmony_ci*         CNcomment:枚举目录下的所有文件,文件系统不支持多级目录。 CNend
2921bd4fe43Sopenharmony_ci*
2931bd4fe43Sopenharmony_ci* @par 描述:
2941bd4fe43Sopenharmony_ci*         Relocate Enumerate all files in the directory, the file system does not support multi-level directories.
2951bd4fe43Sopenharmony_ci*         CNcomment:枚举目录下的所有文件,文件系统不支持多级目录。CNend
2961bd4fe43Sopenharmony_ci*
2971bd4fe43Sopenharmony_ci* @attention
2981bd4fe43Sopenharmony_ci*
2991bd4fe43Sopenharmony_ci* @param  buf      [OUT] type  #hi_char**,Buf stores information about all files and is released by the user.
3001bd4fe43Sopenharmony_ci*         CNcomment:buf中存放所有文件的信息,由用户释放。CNend
3011bd4fe43Sopenharmony_ci*
3021bd4fe43Sopenharmony_ci* @retval #>=0     Success.
3031bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
3041bd4fe43Sopenharmony_ci* @par 依赖:
3051bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
3061bd4fe43Sopenharmony_ci* @see  hi_open
3071bd4fe43Sopenharmony_ci*/
3081bd4fe43Sopenharmony_cihi_s32 hi_enum_file(hi_char** buf);
3091bd4fe43Sopenharmony_ci
3101bd4fe43Sopenharmony_ci/**
3111bd4fe43Sopenharmony_ci* @ingroup  iot_fs
3121bd4fe43Sopenharmony_ci* @brief  Relocate Get file size. CNcomment:获取指定文件的大小。 CNend
3131bd4fe43Sopenharmony_ci*
3141bd4fe43Sopenharmony_ci* @par 描述:
3151bd4fe43Sopenharmony_ci*         Relocate Get file size. CNcomment:获取指定文件的大小。CNend
3161bd4fe43Sopenharmony_ci*
3171bd4fe43Sopenharmony_ci* @attention
3181bd4fe43Sopenharmony_ci*
3191bd4fe43Sopenharmony_ci* @param  file_name      [IN] type  #const hi_char*,file name  CNcomment:文件名。CNend
3201bd4fe43Sopenharmony_ci* @param  file_size      [OUT] type  #hi_u32*,file size. CNcomment:返回文件的大小。CNend
3211bd4fe43Sopenharmony_ci*
3221bd4fe43Sopenharmony_ci* @retval #>=0     Success.
3231bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
3241bd4fe43Sopenharmony_ci* @par 依赖:
3251bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
3261bd4fe43Sopenharmony_ci* @see  hi_open
3271bd4fe43Sopenharmony_ci*/
3281bd4fe43Sopenharmony_cihi_s32 hi_stat(const hi_char *file_name, hi_u32* file_size);
3291bd4fe43Sopenharmony_ci/**
3301bd4fe43Sopenharmony_ci* @ingroup  iot_fs
3311bd4fe43Sopenharmony_ci* @brief  Relocate Get file size. CNcomment:获取指定文件的大小。 CNend
3321bd4fe43Sopenharmony_ci*
3331bd4fe43Sopenharmony_ci* @par 描述:
3341bd4fe43Sopenharmony_ci*         Relocate Get file size. CNcomment:获取指定文件的大小。CNend
3351bd4fe43Sopenharmony_ci*
3361bd4fe43Sopenharmony_ci* @attention
3371bd4fe43Sopenharmony_ci*
3381bd4fe43Sopenharmony_ci* @param  fd      [IN] type  #hi_s32,file descriptor  CNcomment:文件描述符。CNend
3391bd4fe43Sopenharmony_ci* @param  file_size      [OUT] type  #hi_u32*,file size. CNcomment:返回文件的大小。CNend
3401bd4fe43Sopenharmony_ci*
3411bd4fe43Sopenharmony_ci* @retval #>=0     Success.
3421bd4fe43Sopenharmony_ci* @retval #-1     Failure. For details,Get error code by hi_get_fs_error.
3431bd4fe43Sopenharmony_ci* @par 依赖:
3441bd4fe43Sopenharmony_ci@li hi_fs.h:describes the filesystem APIs.CNcomment:文件用于描述文件系统相关接口。CNend
3451bd4fe43Sopenharmony_ci* @see  hi_open
3461bd4fe43Sopenharmony_ci*/
3471bd4fe43Sopenharmony_cihi_s32 hi_fstat(hi_s32 fd, hi_u32 *file_size);
3481bd4fe43Sopenharmony_ci#endif
3491bd4fe43Sopenharmony_ci
350