136a3a8d0Sopenharmony_ci/*
236a3a8d0Sopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
336a3a8d0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
436a3a8d0Sopenharmony_ci * you may not use this file except in compliance with the License.
536a3a8d0Sopenharmony_ci * You may obtain a copy of the License at
636a3a8d0Sopenharmony_ci *
736a3a8d0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
836a3a8d0Sopenharmony_ci *
936a3a8d0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1036a3a8d0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1136a3a8d0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1236a3a8d0Sopenharmony_ci * See the License for the specific language governing permissions and
1336a3a8d0Sopenharmony_ci * limitations under the License.
1436a3a8d0Sopenharmony_ci */
1536a3a8d0Sopenharmony_ci
1636a3a8d0Sopenharmony_ci/**
1736a3a8d0Sopenharmony_ci * @addtogroup rawfile
1836a3a8d0Sopenharmony_ci * @{
1936a3a8d0Sopenharmony_ci *
2036a3a8d0Sopenharmony_ci * @brief Provides native functions for the resource manager to operate raw file directories and their raw files.
2136a3a8d0Sopenharmony_ci *
2236a3a8d0Sopenharmony_ci * You can use the resource manager to traverse, open, seek, read, and close raw files.
2336a3a8d0Sopenharmony_ci *
2436a3a8d0Sopenharmony_ci * @since 8
2536a3a8d0Sopenharmony_ci * @version 1.0
2636a3a8d0Sopenharmony_ci */
2736a3a8d0Sopenharmony_ci
2836a3a8d0Sopenharmony_ci/**
2936a3a8d0Sopenharmony_ci * @file raw_file.h
3036a3a8d0Sopenharmony_ci *
3136a3a8d0Sopenharmony_ci * @brief Declares native functions related to raw file.
3236a3a8d0Sopenharmony_ci *
3336a3a8d0Sopenharmony_ci * For example, you can use the functions to search for, read, and close raw files.
3436a3a8d0Sopenharmony_ci *
3536a3a8d0Sopenharmony_ci * @since 8
3636a3a8d0Sopenharmony_ci * @version 1.0
3736a3a8d0Sopenharmony_ci */
3836a3a8d0Sopenharmony_ci#ifndef GLOBAL_RAW_FILE_H
3936a3a8d0Sopenharmony_ci#define GLOBAL_RAW_FILE_H
4036a3a8d0Sopenharmony_ci
4136a3a8d0Sopenharmony_ci#include <stddef.h>
4236a3a8d0Sopenharmony_ci#include <stdint.h>
4336a3a8d0Sopenharmony_ci#include <stdbool.h>
4436a3a8d0Sopenharmony_ci
4536a3a8d0Sopenharmony_ci#ifdef __cplusplus
4636a3a8d0Sopenharmony_ciextern "C" {
4736a3a8d0Sopenharmony_ci#endif
4836a3a8d0Sopenharmony_ci
4936a3a8d0Sopenharmony_cistruct RawFile;
5036a3a8d0Sopenharmony_ci
5136a3a8d0Sopenharmony_ci/**
5236a3a8d0Sopenharmony_ci * @brief Provides access to a raw file.
5336a3a8d0Sopenharmony_ci *
5436a3a8d0Sopenharmony_ci * @since 11
5536a3a8d0Sopenharmony_ci * @version 1.0
5636a3a8d0Sopenharmony_ci */
5736a3a8d0Sopenharmony_cistruct RawFile64;
5836a3a8d0Sopenharmony_ci
5936a3a8d0Sopenharmony_ci/**
6036a3a8d0Sopenharmony_ci * @brief Provides access to a raw file.
6136a3a8d0Sopenharmony_ci *
6236a3a8d0Sopenharmony_ci *
6336a3a8d0Sopenharmony_ci *
6436a3a8d0Sopenharmony_ci * @since 8
6536a3a8d0Sopenharmony_ci * @version 1.0
6636a3a8d0Sopenharmony_ci */
6736a3a8d0Sopenharmony_citypedef struct RawFile RawFile;
6836a3a8d0Sopenharmony_ci
6936a3a8d0Sopenharmony_ci/**
7036a3a8d0Sopenharmony_ci * @brief Provides access to a raw file.
7136a3a8d0Sopenharmony_ci *
7236a3a8d0Sopenharmony_ci * @since 11
7336a3a8d0Sopenharmony_ci * @version 1.0
7436a3a8d0Sopenharmony_ci */
7536a3a8d0Sopenharmony_citypedef struct RawFile64 RawFile64;
7636a3a8d0Sopenharmony_ci
7736a3a8d0Sopenharmony_ci/**
7836a3a8d0Sopenharmony_ci * @brief Represent the raw file descriptor's info.
7936a3a8d0Sopenharmony_ci *
8036a3a8d0Sopenharmony_ci * The RawFileDescriptor is an output parameter in the {@link OH_ResourceManager_GetRawFileDescriptor},
8136a3a8d0Sopenharmony_ci * and describes the raw file's file descriptor, start position and the length in the HAP.
8236a3a8d0Sopenharmony_ci *
8336a3a8d0Sopenharmony_ci * @since 8
8436a3a8d0Sopenharmony_ci * @version 1.0
8536a3a8d0Sopenharmony_ci */
8636a3a8d0Sopenharmony_citypedef struct {
8736a3a8d0Sopenharmony_ci    /** the raw file fd */
8836a3a8d0Sopenharmony_ci    int fd;
8936a3a8d0Sopenharmony_ci
9036a3a8d0Sopenharmony_ci    /** the offset from where the raw file starts in the HAP */
9136a3a8d0Sopenharmony_ci    long start;
9236a3a8d0Sopenharmony_ci
9336a3a8d0Sopenharmony_ci    /** the length of the raw file in the HAP. */
9436a3a8d0Sopenharmony_ci    long length;
9536a3a8d0Sopenharmony_ci} RawFileDescriptor;
9636a3a8d0Sopenharmony_ci
9736a3a8d0Sopenharmony_ci/**
9836a3a8d0Sopenharmony_ci * @brief Represent the raw file descriptor's info.
9936a3a8d0Sopenharmony_ci *
10036a3a8d0Sopenharmony_ci * The RawFileDescriptor64 is an output parameter in the {@link OH_ResourceManager_GetRawFileDescriptor64},
10136a3a8d0Sopenharmony_ci * and describes the raw file's file descriptor, start position and the length in the HAP.
10236a3a8d0Sopenharmony_ci *
10336a3a8d0Sopenharmony_ci * @since 11
10436a3a8d0Sopenharmony_ci * @version 1.0
10536a3a8d0Sopenharmony_ci */
10636a3a8d0Sopenharmony_citypedef struct {
10736a3a8d0Sopenharmony_ci    /** the raw file fd */
10836a3a8d0Sopenharmony_ci    int fd;
10936a3a8d0Sopenharmony_ci
11036a3a8d0Sopenharmony_ci    /** the offset from where the raw file starts in the HAP */
11136a3a8d0Sopenharmony_ci    int64_t start;
11236a3a8d0Sopenharmony_ci
11336a3a8d0Sopenharmony_ci    /** the length of the raw file in the HAP. */
11436a3a8d0Sopenharmony_ci    int64_t length;
11536a3a8d0Sopenharmony_ci} RawFileDescriptor64;
11636a3a8d0Sopenharmony_ci
11736a3a8d0Sopenharmony_ci/**
11836a3a8d0Sopenharmony_ci * @brief Reads a raw file.
11936a3a8d0Sopenharmony_ci *
12036a3a8d0Sopenharmony_ci * This function attempts to read data of <b>length</b> bytes from the current offset.
12136a3a8d0Sopenharmony_ci *
12236a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
12336a3a8d0Sopenharmony_ci * @param buf Indicates the pointer to the buffer for receiving the data read.
12436a3a8d0Sopenharmony_ci * @param length Indicates the number of bytes to read.
12536a3a8d0Sopenharmony_ci * @return Returns the number of bytes read if any; returns <b>0</b> if the number reaches the end of file (EOF).
12636a3a8d0Sopenharmony_ci * @since 8
12736a3a8d0Sopenharmony_ci * @version 1.0
12836a3a8d0Sopenharmony_ci */
12936a3a8d0Sopenharmony_ciint OH_ResourceManager_ReadRawFile(const RawFile *rawFile, void *buf, size_t length);
13036a3a8d0Sopenharmony_ci
13136a3a8d0Sopenharmony_ci/**
13236a3a8d0Sopenharmony_ci * @brief Uses the 32-bit data type to seek a data read position based on the specified offset within a raw file.
13336a3a8d0Sopenharmony_ci *
13436a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
13536a3a8d0Sopenharmony_ci * @param offset Indicates the specified offset.
13636a3a8d0Sopenharmony_ci * @param whence Indicates the new read position, which can be one of the following values: \n
13736a3a8d0Sopenharmony_ci * <b>0</b>: The new read position is set to <b>offset</b>. \n
13836a3a8d0Sopenharmony_ci * <b>1</b>: The read position is set to the current position plus <b>offset</b>. \n
13936a3a8d0Sopenharmony_ci * <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
14036a3a8d0Sopenharmony_ci * @return Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
14136a3a8d0Sopenharmony_ci * occurs.
14236a3a8d0Sopenharmony_ci * @since 8
14336a3a8d0Sopenharmony_ci * @version 1.0
14436a3a8d0Sopenharmony_ci */
14536a3a8d0Sopenharmony_ciint OH_ResourceManager_SeekRawFile(const RawFile *rawFile, long offset, int whence);
14636a3a8d0Sopenharmony_ci
14736a3a8d0Sopenharmony_ci/**
14836a3a8d0Sopenharmony_ci * @brief Obtains the raw file length represented by an long.
14936a3a8d0Sopenharmony_ci *
15036a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
15136a3a8d0Sopenharmony_ci * @return Returns the total length of the raw file.
15236a3a8d0Sopenharmony_ci * @since 8
15336a3a8d0Sopenharmony_ci * @version 1.0
15436a3a8d0Sopenharmony_ci */
15536a3a8d0Sopenharmony_cilong OH_ResourceManager_GetRawFileSize(RawFile *rawFile);
15636a3a8d0Sopenharmony_ci
15736a3a8d0Sopenharmony_ci/**
15836a3a8d0Sopenharmony_ci * @brief Obtains the remaining raw file length represented by an long.
15936a3a8d0Sopenharmony_ci *
16036a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
16136a3a8d0Sopenharmony_ci * @return Returns the remaining length of the raw file.
16236a3a8d0Sopenharmony_ci * @since 11
16336a3a8d0Sopenharmony_ci * @version 1.0
16436a3a8d0Sopenharmony_ci */
16536a3a8d0Sopenharmony_cilong OH_ResourceManager_GetRawFileRemainingLength(const RawFile *rawFile);
16636a3a8d0Sopenharmony_ci
16736a3a8d0Sopenharmony_ci/**
16836a3a8d0Sopenharmony_ci * @brief Closes an opened {@link RawFile} and releases all associated resources.
16936a3a8d0Sopenharmony_ci *
17036a3a8d0Sopenharmony_ci *
17136a3a8d0Sopenharmony_ci *
17236a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
17336a3a8d0Sopenharmony_ci * @see OH_ResourceManager_OpenRawFile
17436a3a8d0Sopenharmony_ci * @since 8
17536a3a8d0Sopenharmony_ci * @version 1.0
17636a3a8d0Sopenharmony_ci */
17736a3a8d0Sopenharmony_civoid OH_ResourceManager_CloseRawFile(RawFile *rawFile);
17836a3a8d0Sopenharmony_ci
17936a3a8d0Sopenharmony_ci/**
18036a3a8d0Sopenharmony_ci * @brief Obtains the current offset of a raw file, represented by an long.
18136a3a8d0Sopenharmony_ci *
18236a3a8d0Sopenharmony_ci * The current offset of a raw file.
18336a3a8d0Sopenharmony_ci *
18436a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
18536a3a8d0Sopenharmony_ci * @return Returns the current offset of a raw file.
18636a3a8d0Sopenharmony_ci * @since 8
18736a3a8d0Sopenharmony_ci * @version 1.0
18836a3a8d0Sopenharmony_ci */
18936a3a8d0Sopenharmony_cilong OH_ResourceManager_GetRawFileOffset(const RawFile *rawFile);
19036a3a8d0Sopenharmony_ci
19136a3a8d0Sopenharmony_ci/**
19236a3a8d0Sopenharmony_ci * @brief Opens the file descriptor of a raw file based on the long offset and file length.
19336a3a8d0Sopenharmony_ci *
19436a3a8d0Sopenharmony_ci * The opened raw file descriptor is used to read the raw file.
19536a3a8d0Sopenharmony_ci *
19636a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
19736a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
19836a3a8d0Sopenharmony_ci * @return Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
19936a3a8d0Sopenharmony_ci * @since 8
20036a3a8d0Sopenharmony_ci * @version 1.0
20136a3a8d0Sopenharmony_ci * @deprecated since 12
20236a3a8d0Sopenharmony_ci * @useinstead OH_ResourceManager_GetRawFileDescriptorData
20336a3a8d0Sopenharmony_ci */
20436a3a8d0Sopenharmony_cibool OH_ResourceManager_GetRawFileDescriptor(const RawFile *rawFile, RawFileDescriptor &descriptor);
20536a3a8d0Sopenharmony_ci
20636a3a8d0Sopenharmony_ci/**
20736a3a8d0Sopenharmony_ci * @brief Obtains the file descriptor of a raw file based on the long offset and file length.
20836a3a8d0Sopenharmony_ci *
20936a3a8d0Sopenharmony_ci * The obtains raw file descriptor is used to read the raw file.
21036a3a8d0Sopenharmony_ci *
21136a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile}.
21236a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
21336a3a8d0Sopenharmony_ci * @return Returns true: obtains the raw file descriptor successfully, false: the raw file is not allowed to access.
21436a3a8d0Sopenharmony_ci * @since 12
21536a3a8d0Sopenharmony_ci * @version 1.0
21636a3a8d0Sopenharmony_ci */
21736a3a8d0Sopenharmony_cibool OH_ResourceManager_GetRawFileDescriptorData(const RawFile *rawFile, RawFileDescriptor *descriptor);
21836a3a8d0Sopenharmony_ci
21936a3a8d0Sopenharmony_ci/**
22036a3a8d0Sopenharmony_ci * @brief Closes the file descriptor of a raw file.
22136a3a8d0Sopenharmony_ci *
22236a3a8d0Sopenharmony_ci * The opened raw file descriptor must be released after used to avoid the file descriptor leak.
22336a3a8d0Sopenharmony_ci *
22436a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
22536a3a8d0Sopenharmony_ci * @return Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
22636a3a8d0Sopenharmony_ci * @since 8
22736a3a8d0Sopenharmony_ci * @version 1.0
22836a3a8d0Sopenharmony_ci * @deprecated since 12
22936a3a8d0Sopenharmony_ci * @useinstead OH_ResourceManager_ReleaseRawFileDescriptorData
23036a3a8d0Sopenharmony_ci */
23136a3a8d0Sopenharmony_cibool OH_ResourceManager_ReleaseRawFileDescriptor(const RawFileDescriptor &descriptor);
23236a3a8d0Sopenharmony_ci
23336a3a8d0Sopenharmony_ci/**
23436a3a8d0Sopenharmony_ci * @brief Release the file descriptor of a raw file.
23536a3a8d0Sopenharmony_ci *
23636a3a8d0Sopenharmony_ci * The opened raw file descriptor must be released after used to avoid the file descriptor leak.
23736a3a8d0Sopenharmony_ci *
23836a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
23936a3a8d0Sopenharmony_ci * @return Returns true: release the raw file descriptor successfully, false: release the raw file descriptor failed.
24036a3a8d0Sopenharmony_ci * @since 12
24136a3a8d0Sopenharmony_ci * @version 1.0
24236a3a8d0Sopenharmony_ci */
24336a3a8d0Sopenharmony_cibool OH_ResourceManager_ReleaseRawFileDescriptorData(const RawFileDescriptor *descriptor);
24436a3a8d0Sopenharmony_ci
24536a3a8d0Sopenharmony_ci/**
24636a3a8d0Sopenharmony_ci * @brief Reads a raw file.
24736a3a8d0Sopenharmony_ci *
24836a3a8d0Sopenharmony_ci * This function attempts to read data of <b>length</b> bytes from the current offset. using a 64-bit
24936a3a8d0Sopenharmony_ci *
25036a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
25136a3a8d0Sopenharmony_ci * @param buf Indicates the pointer to the buffer for receiving the data read.
25236a3a8d0Sopenharmony_ci * @param length Indicates the number of bytes to read.
25336a3a8d0Sopenharmony_ci * @return Returns the number of bytes read if any; returns <b>0</b> if the number reaches the end of file (EOF).
25436a3a8d0Sopenharmony_ci * @since 11
25536a3a8d0Sopenharmony_ci * @version 1.0
25636a3a8d0Sopenharmony_ci */
25736a3a8d0Sopenharmony_ciint64_t OH_ResourceManager_ReadRawFile64(const RawFile64 *rawFile, void *buf, int64_t length);
25836a3a8d0Sopenharmony_ci
25936a3a8d0Sopenharmony_ci/**
26036a3a8d0Sopenharmony_ci * @brief Uses the 64-bit data type to seek a data read position based on the specified offset within a raw file.
26136a3a8d0Sopenharmony_ci *
26236a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
26336a3a8d0Sopenharmony_ci * @param offset Indicates the specified offset.
26436a3a8d0Sopenharmony_ci * @param whence Indicates the new read position, which can be one of the following values: \n
26536a3a8d0Sopenharmony_ci * <b>0</b>: The new read position is set to <b>offset</b>. \n
26636a3a8d0Sopenharmony_ci * <b>1</b>: The read position is set to the current position plus <b>offset</b>. \n
26736a3a8d0Sopenharmony_ci * <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
26836a3a8d0Sopenharmony_ci * @return Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
26936a3a8d0Sopenharmony_ci * occurs.
27036a3a8d0Sopenharmony_ci * @since 11
27136a3a8d0Sopenharmony_ci * @version 1.0
27236a3a8d0Sopenharmony_ci */
27336a3a8d0Sopenharmony_ciint OH_ResourceManager_SeekRawFile64(const RawFile64 *rawFile, int64_t offset, int whence);
27436a3a8d0Sopenharmony_ci
27536a3a8d0Sopenharmony_ci/**
27636a3a8d0Sopenharmony_ci * @brief Obtains the raw file length represented by an int64_t.
27736a3a8d0Sopenharmony_ci *
27836a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
27936a3a8d0Sopenharmony_ci * @return Returns the total length of the raw file.
28036a3a8d0Sopenharmony_ci * @since 11
28136a3a8d0Sopenharmony_ci * @version 1.0
28236a3a8d0Sopenharmony_ci */
28336a3a8d0Sopenharmony_ciint64_t OH_ResourceManager_GetRawFileSize64(RawFile64 *rawFile);
28436a3a8d0Sopenharmony_ci
28536a3a8d0Sopenharmony_ci/**
28636a3a8d0Sopenharmony_ci * @brief Obtains the remaining raw file length represented by an int64_t.
28736a3a8d0Sopenharmony_ci *
28836a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
28936a3a8d0Sopenharmony_ci * @return Returns the remaining length of the raw file.
29036a3a8d0Sopenharmony_ci * @since 11
29136a3a8d0Sopenharmony_ci * @version 1.0
29236a3a8d0Sopenharmony_ci */
29336a3a8d0Sopenharmony_ciint64_t OH_ResourceManager_GetRawFileRemainingLength64(const RawFile64 *rawFile);
29436a3a8d0Sopenharmony_ci
29536a3a8d0Sopenharmony_ci/**
29636a3a8d0Sopenharmony_ci * @brief Closes an opened {@link RawFile64} and releases all associated resources.
29736a3a8d0Sopenharmony_ci *
29836a3a8d0Sopenharmony_ci *
29936a3a8d0Sopenharmony_ci *
30036a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
30136a3a8d0Sopenharmony_ci * @see OH_ResourceManager_OpenRawFile64
30236a3a8d0Sopenharmony_ci * @since 11
30336a3a8d0Sopenharmony_ci * @version 1.0
30436a3a8d0Sopenharmony_ci */
30536a3a8d0Sopenharmony_civoid OH_ResourceManager_CloseRawFile64(RawFile64 *rawFile);
30636a3a8d0Sopenharmony_ci
30736a3a8d0Sopenharmony_ci/**
30836a3a8d0Sopenharmony_ci * @brief Obtains the current offset of a raw file, represented by an int64_t.
30936a3a8d0Sopenharmony_ci *
31036a3a8d0Sopenharmony_ci * The current offset of a raw file.
31136a3a8d0Sopenharmony_ci *
31236a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
31336a3a8d0Sopenharmony_ci * @return Returns the current offset of a raw file.
31436a3a8d0Sopenharmony_ci * @since 11
31536a3a8d0Sopenharmony_ci * @version 1.0
31636a3a8d0Sopenharmony_ci */
31736a3a8d0Sopenharmony_ciint64_t OH_ResourceManager_GetRawFileOffset64(const RawFile64 *rawFile);
31836a3a8d0Sopenharmony_ci
31936a3a8d0Sopenharmony_ci/**
32036a3a8d0Sopenharmony_ci * @brief Opens the file descriptor of a raw file based on the int64_t offset and file length.
32136a3a8d0Sopenharmony_ci *
32236a3a8d0Sopenharmony_ci * The opened raw file descriptor is used to read the raw file.
32336a3a8d0Sopenharmony_ci *
32436a3a8d0Sopenharmony_ci * @param rawFile Indicates the pointer to {@link RawFile64}.
32536a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
32636a3a8d0Sopenharmony_ci * @return Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
32736a3a8d0Sopenharmony_ci * @since 11
32836a3a8d0Sopenharmony_ci * @version 1.0
32936a3a8d0Sopenharmony_ci */
33036a3a8d0Sopenharmony_cibool OH_ResourceManager_GetRawFileDescriptor64(const RawFile64 *rawFile, RawFileDescriptor64 *descriptor);
33136a3a8d0Sopenharmony_ci
33236a3a8d0Sopenharmony_ci/**
33336a3a8d0Sopenharmony_ci * @brief Closes the file descriptor of a raw file.
33436a3a8d0Sopenharmony_ci *
33536a3a8d0Sopenharmony_ci * The opened raw file descriptor must be released after used to avoid the file descriptor leak.
33636a3a8d0Sopenharmony_ci *
33736a3a8d0Sopenharmony_ci * @param descriptor Indicates the raw file's file descriptor, start position and the length in the HAP.
33836a3a8d0Sopenharmony_ci * @return Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
33936a3a8d0Sopenharmony_ci * @since 11
34036a3a8d0Sopenharmony_ci * @version 1.0
34136a3a8d0Sopenharmony_ci */
34236a3a8d0Sopenharmony_cibool OH_ResourceManager_ReleaseRawFileDescriptor64(const RawFileDescriptor64 *descriptor);
34336a3a8d0Sopenharmony_ci
34436a3a8d0Sopenharmony_ci#ifdef __cplusplus
34536a3a8d0Sopenharmony_ci};
34636a3a8d0Sopenharmony_ci#endif
34736a3a8d0Sopenharmony_ci
34836a3a8d0Sopenharmony_ci/** @} */
34936a3a8d0Sopenharmony_ci#endif // GLOBAL_RAW_FILE_H
350