poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] redoxfs.pk: Pickle for RedoxFS file system


From: Mohammad-Reza Nabipoor
Subject: Re: [RFC] redoxfs.pk: Pickle for RedoxFS file system
Date: Sat, 19 Dec 2020 09:05:58 +0330

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.


> 
> If the user wanted to look at the extents in reverse order:
> 
> (poke) areverse (fs.extents)
> [#<...>, #<...>, ...]


:+1:


> 
> (Yes I know someone has to write an `areverse' function in the std
> library :))
> 


:)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]