Skip to content
«interface»SolidSyslogFileFatFsFileFatFsPlusFatFilePlusFatPosixFilePosixWindowsFileWindowsNullFileCore · no-opFileBlockDeviceCore

Struct SolidSyslogFile

ClassList > SolidSyslogFile

  • #include <SolidSyslogFileDefinition.h>
struct SolidSyslogFile
{
    bool (*Open)(struct SolidSyslogFile* base, const char* path);
    void (*Close)(struct SolidSyslogFile* base);
    bool (*IsOpen)(struct SolidSyslogFile* base);
    bool (*Read)(struct SolidSyslogFile* base, void* buf, size_t count);
    bool (*Write)(struct SolidSyslogFile* base, const void* buf, size_t count);
    void (*SeekTo)(struct SolidSyslogFile* base, size_t offset);
    size_t (*Size)(struct SolidSyslogFile* base);
    void (*Truncate)(struct SolidSyslogFile* base);
    bool (*Exists)(struct SolidSyslogFile* base, const char* path);
    bool (*Delete)(struct SolidSyslogFile* base, const char* path);
};

Detailed Description

The File contract a porter implements (FatFs, FreeRTOS-Plus-FAT, a raw flash driver...).

One instance holds at most one open file; Open on an already-open instance is not expected. Read/Write share a single position moved by SeekTo, so the consumer seeks before each transfer.

Public Attributes Documentation

Close

No-op if already closed.

void(* SolidSyslogFile::Close) (struct SolidSyslogFile *base);


Delete

Remove path ; true also when it was already absent.

bool(* SolidSyslogFile::Delete) (struct SolidSyslogFile *base, const char *path);

Independent of any open file.


Exists

Queries path on the filesystem, independent of any open file.

bool(* SolidSyslogFile::Exists) (struct SolidSyslogFile *base, const char *path);


IsOpen

bool(* SolidSyslogFile::IsOpen) (struct SolidSyslogFile *base);

Open

Open path for reading and writing, creating it empty if absent and preserving existing content otherwise (never truncates on open).

bool(* SolidSyslogFile::Open) (struct SolidSyslogFile *base, const char *path);

Return value:

  • false open failed; the instance stays closed.

Read

Read exactly count bytes at the current position intobuf .

bool(* SolidSyslogFile::Read) (struct SolidSyslogFile *base, void *buf, size_t count);

Return value:

  • false fewer than count bytes were available (short read or error); buf content is then unspecified. Partial success is not distinguished from failure.

SeekTo

Position for the next Read/Write, absolute from the start.

void(* SolidSyslogFile::SeekTo) (struct SolidSyslogFile *base, size_t offset);

Errors are silent.


Size

Current length in bytes; 0 on error.

size_t(* SolidSyslogFile::Size) (struct SolidSyslogFile *base);


Truncate

Discard all content, leaving the file open at length 0.

void(* SolidSyslogFile::Truncate) (struct SolidSyslogFile *base);


Write

Write exactly count bytes at the current position and commit them to the media before returning (the BlockStore treats a true return as durable across power loss, so an implementation must flush).

bool(* SolidSyslogFile::Write) (struct SolidSyslogFile *base, const void *buf, size_t count);

Return value:

  • false the full count was not written and committed.


The documentation for this class was generated from the following file Core/Interface/SolidSyslogFileDefinition.h