[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] redoxfs.pk: Pickle for RedoxFS file system
From: |
Jose E. Marchesi |
Subject: |
Re: [RFC] redoxfs.pk: Pickle for RedoxFS file system |
Date: |
Sat, 19 Dec 2020 07:32:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> On Fri, Dec 18, 2020 at 06:10:06PM +0100, Jose E. Marchesi wrote:
>>
>> > /* Node pretty-printer
>> > *
>> > * Prints the contents of a `RedoxFS_Node` in a readable fashion.
>> > * To increase readability, only non-empty extents are get printed before
>> > any
>> > * other fields. By default, extents are get printed from first one to last
>> > * one by default, but this can be changed by passing 1 in `reverse`
>> > argument.
>> > */
>> > fun redoxfs_nprint = (RedoxFS_Node n, int reverse = 0) void:
>>
>> If you turn this into a proper method pretty printer (_print) in the
>> type RedoxFS_Node, then you can omit the `reverse' argument: see comment
>> below.
>>
>> > {
>> > print ("#<\n extents = [\n");
>> >
>> > var f = reverse ? n.extents'length : 0UL; /* first */
>> > var l = reverse ? 0UL : n.extents'length; /* last */
>> >
>> > while (f != l) {
>> > if (reverse)
>> > --f;
>> >
>> > var e = n.extents[f];
>> >
>> > if (!e.empty)
>> > printf (" .[%u64d]={block=%v, length=%v}\n", f, e.block,
>> > e.length);
>>
>> Looks like the above line should go to the pretty printer (_print) of
>> RedoxFS_Extent, including the handling of !empty.
>>
>> The poke user could then do:
>>
>> (poke) var fs = RedoxFS_Node @ WHEREVER
>> (poke) fs
>> #<
>> extents=[#<...>, #<...>, ...],
>> FILE
>> ...
>> >
>
>
> The problem is the index part of the output: `.[%u64d]=`
> If we omit the empty blocks, the user needs a way to know which extents
> are get printed in the output.
But the index is not part of the extent itself... What contains extents?
Nodes, right? Then I would say it is the node's pretty-printer who is
responsible to print these indexes...