class FdWriter

Defined at line 33 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

This provides callbacks for using zxdump::ProcessDump to stream output to

a file descriptor. It supports both seekable and non-seekable descriptors.

Writers work in two models: accumulate and flush for small fragments; and

direct writing for large chunks. The first model is used for the headers

and notes, which come in many small pieces that can be collected together in

a single writev call. The second model is used for the bulk data like

memory segments, which is streamed through temporary buffers rather than

held in the dumper's memory throughout, but comes in large chunks big enough

to merit individual write calls.

Public Methods

void FdWriter ()

Defined at line 37 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

void FdWriter (FdWriter && )

Defined at line 38 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

FdWriter & operator= (FdWriter && )

Defined at line 39 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

fit::result<error_type, size_t> WriteFragments ()

Call this after DumpHeaders makes all its calls to that callback, and

before calling the WriteCallback callback. It returns the number of bytes

written out.

Defined at line 39 of file ../../src/lib/zxdump/fd-writer.cc

void FdWriter (fbl::unique_fd fd)

The writer takes ownership of the fd.

Defined at line 42 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

(lambda at ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h:53:12) AccumulateFragmentsCallback ()

Pass the result of this to zxdump::ProcessDump::DumpHeaders or

zxdump::JobDump::DumpHeaders. The callback accumulates small fragments to

be written out by WriteFragments. The views passed to the callback must

stay valid pointers until after WriteFragments returns. This callback

expects to receive a contiguous stream of data with no gaps before each

offset.

The returned callable object is valid for the lifetime of the FdWriter.

Defined at line 52 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

(lambda at ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h:71:12) WriteCallback ()

Pass the result of this to zxdump::ProcessDump::DumpMemory or the like.

The callback makes direct writes. It accepts an offset that advances over

a gap since the preceding write (either via this callback or via the

previous WriteFragments call), but offsets can never go backwards.

The returned callable object is valid for the lifetime of the FdWriter.

Defined at line 70 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h

void ResetOffset ()

Reset the file offset calculations. After this, the next call to one of

the callbacks is expected to use offset 0.

Defined at line 78 of file ../../src/lib/zxdump/include/lib/zxdump/fd-writer.h