1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
// automatically generated by rust-bindgen 0.71.1
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#[cfg(doc)]
use crate::raw_file_manager::OH_ResourceManager_OpenRawFile64;
#[cfg(doc)]
use crate::raw_file_manager::{OH_ResourceManager_OpenRawDir, OH_ResourceManager_OpenRawFile};
use crate::raw_file_types_ffi::*;
extern "C" {
/// Reads a raw file.
///
/// This function attempts to read data of <b>length</b> bytes from the current offset.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// * `buf` - Indicates the pointer to the buffer for receiving the data read.
///
/// * `length` - Indicates the number of bytes to read.
///
/// # Returns
///
/// * Returns the number of bytes read if any;
/// if the number reaches the end of file (EOF) or rawFile is nullptr also returns <b>0</b>
///
/// Available since API-level: 8
///
/// Version: 1.0
pub fn OH_ResourceManager_ReadRawFile(
rawFile: *const RawFile,
buf: *mut ::core::ffi::c_void,
length: usize,
) -> ::core::ffi::c_int;
/// Uses the 32-bit data type to seek a data read position based on the specified offset within a raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// * `offset` - Indicates the specified offset.
///
/// * `whence` - Indicates the new read position, which can be one of the following values:
///
/// <b>0</b>: The new read position is set to <b>offset</b>.
///
/// <b>1</b>: The read position is set to the current position plus <b>offset</b>.
///
/// <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
///
/// # Returns
///
/// * Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
/// occurs.
///
/// Available since API-level: 8
///
/// Version: 1.0
pub fn OH_ResourceManager_SeekRawFile(
rawFile: *const RawFile,
offset: ::core::ffi::c_long,
whence: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
/// Obtains the raw file length represented by an long.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// # Returns
///
/// * Returns the total length of the raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 8
///
/// Version: 1.0
pub fn OH_ResourceManager_GetRawFileSize(rawFile: *mut RawFile) -> ::core::ffi::c_long;
/// Obtains the remaining raw file length represented by an long.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// # Returns
///
/// * Returns the remaining length of the raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_GetRawFileRemainingLength(
rawFile: *const RawFile,
) -> ::core::ffi::c_long;
/// Closes an opened [`RawFile`] and releases all associated resources.
///
///
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
/// [`OH_ResourceManager_OpenRawFile`]
/// Available since API-level: 8
///
/// Version: 1.0
pub fn OH_ResourceManager_CloseRawFile(rawFile: *mut RawFile);
/// Obtains the current offset of a raw file, represented by an long.
///
/// The current offset of a raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// # Returns
///
/// * Returns the current offset of a raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 8
///
/// Version: 1.0
pub fn OH_ResourceManager_GetRawFileOffset(rawFile: *const RawFile) -> ::core::ffi::c_long;
/// Opens the file descriptor of a raw file based on the long offset and file length.
///
/// The opened raw file descriptor is used to read the raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
///
/// Available since API-level: 8
///
/// Version: 1.0
///
/// **Deprecated** since 12
/// OH_ResourceManager_GetRawFileDescriptorData
#[deprecated(since = "12")]
pub fn OH_ResourceManager_GetRawFileDescriptor(
rawFile: *const RawFile,
descriptor: *mut RawFileDescriptor,
) -> bool;
/// Obtains the file descriptor of a raw file based on the long offset and file length.
///
/// The obtains raw file descriptor is used to read the raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile`].
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: obtains the raw file descriptor successfully, false: the raw file is not allowed to access.
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_ResourceManager_GetRawFileDescriptorData(
rawFile: *const RawFile,
descriptor: *mut RawFileDescriptor,
) -> bool;
/// Closes the file descriptor of a raw file.
///
/// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
///
/// # Arguments
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
///
/// Available since API-level: 8
///
/// Version: 1.0
///
/// **Deprecated** since 12
/// OH_ResourceManager_ReleaseRawFileDescriptorData
#[deprecated(since = "12")]
pub fn OH_ResourceManager_ReleaseRawFileDescriptor(
descriptor: *const RawFileDescriptor,
) -> bool;
/// Release the file descriptor of a raw file.
///
/// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
///
/// # Arguments
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: release the raw file descriptor successfully, false: release the raw file descriptor failed.
///
/// Available since API-level: 12
///
/// Version: 1.0
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub fn OH_ResourceManager_ReleaseRawFileDescriptorData(
descriptor: *const RawFileDescriptor,
) -> bool;
/// Reads a raw file.
///
/// This function attempts to read data of <b>length</b> bytes from the current offset. using a 64-bit
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// * `buf` - Indicates the pointer to the buffer for receiving the data read.
///
/// * `length` - Indicates the number of bytes to read.
///
/// # Returns
///
/// * Returns the number of bytes read if any;
/// returns <b>0</b> if the number reaches the end of file (EOF). or rawFile is nullptr also returns 0
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_ReadRawFile64(
rawFile: *const RawFile64,
buf: *mut ::core::ffi::c_void,
length: i64,
) -> i64;
/// Uses the 64-bit data type to seek a data read position based on the specified offset within a raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// * `offset` - Indicates the specified offset.
///
/// * `whence` - Indicates the new read position, which can be one of the following values:
///
/// <b>0</b>: The new read position is set to <b>offset</b>.
///
/// <b>1</b>: The read position is set to the current position plus <b>offset</b>.
///
/// <b>2</b>: The read position is set to the end of file (EOF) plus <b>offset</b>.
///
/// # Returns
///
/// * Returns <b>(int) 0</b> if the operation is successful; returns <b>(int) -1</b> if an error
/// occurs.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_SeekRawFile64(
rawFile: *const RawFile64,
offset: i64,
whence: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
/// Obtains the raw file length represented by an int64_t.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// # Returns
///
/// * Returns the total length of the raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_GetRawFileSize64(rawFile: *mut RawFile64) -> i64;
/// Obtains the remaining raw file length represented by an int64_t.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// # Returns
///
/// * Returns the remaining length of the raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_GetRawFileRemainingLength64(rawFile: *const RawFile64) -> i64;
/// Closes an opened [`RawFile64`] and releases all associated resources.
///
///
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
/// [`OH_ResourceManager_OpenRawFile64`]
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_CloseRawFile64(rawFile: *mut RawFile64);
/// Obtains the current offset of a raw file, represented by an int64_t.
///
/// The current offset of a raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// # Returns
///
/// * Returns the current offset of a raw file. If rawFile is nullptr also returns 0.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_GetRawFileOffset64(rawFile: *const RawFile64) -> i64;
/// Opens the file descriptor of a raw file based on the int64_t offset and file length.
///
/// The opened raw file descriptor is used to read the raw file.
///
/// # Arguments
///
/// * `rawFile` - Indicates the pointer to [`RawFile64`].
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: open the raw file descriptor successfully, false: the raw file is not allowed to access.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_GetRawFileDescriptor64(
rawFile: *const RawFile64,
descriptor: *mut RawFileDescriptor64,
) -> bool;
/// Closes the file descriptor of a raw file.
///
/// The opened raw file descriptor must be released after used to avoid the file descriptor leak.
///
/// # Arguments
///
/// * `descriptor` - Indicates the raw file's file descriptor, start position and the length in the HAP.
///
/// # Returns
///
/// * Returns true: closes the raw file descriptor successfully, false: closes the raw file descriptor failed.
///
/// Available since API-level: 11
///
/// Version: 1.0
#[cfg(feature = "api-11")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
pub fn OH_ResourceManager_ReleaseRawFileDescriptor64(
descriptor: *const RawFileDescriptor64,
) -> bool;
}