Line data Source code
1 : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
2 : * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
3 : */
4 :
5 : #ifndef SOLIDSYSLOGFATFSFILEPRIVATE_H
6 : #define SOLIDSYSLOGFATFSFILEPRIVATE_H
7 :
8 : #include <stdint.h>
9 :
10 : #include <stdbool.h>
11 :
12 : #include "SolidSyslogError.h"
13 : #include "SolidSyslogFatFsFileErrors.h"
14 : #include "SolidSyslogFileDefinition.h"
15 : #include "SolidSyslogPrival.h"
16 : #include "ff.h"
17 :
18 : struct SolidSyslogFatFsFile
19 : {
20 : struct SolidSyslogFile Base;
21 : FIL Fp;
22 : bool IsOpen;
23 : /* A close FatFs did not complete: f_close returns without releasing the
24 : file object or its FF_FS_LOCK entry when its sync fails, and only a
25 : later f_close on Fp can. The File reports itself closed regardless;
26 : this is the debt the next Open settles first. */
27 : bool CloseOwed;
28 : };
29 :
30 : void SolidSyslogFatFsFile_Initialise(struct SolidSyslogFile* base);
31 : void SolidSyslogFatFsFile_Cleanup(struct SolidSyslogFile* base);
32 :
33 16 : static inline void FatFsFile_Report(
34 : enum SolidSyslogSeverity severity,
35 : uint16_t category,
36 : enum SolidSyslogFileErrors code
37 : )
38 : {
39 16 : SolidSyslog_Error(severity, &SolidSyslogFatFsFileErrorSource, category, (int32_t) code);
40 16 : }
41 :
42 : #endif /* SOLIDSYSLOGFATFSFILEPRIVATE_H */
|