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

Re: [Libguestfs] [PATCH] Report last-modified time of hive root and nodes

On Wed, Aug 10, 2011 at 11:03:21AM -0700, Alex‎ Nelson wrote:
> The reason for this change was to expose some of the handle's
> fields.  I wasn't sure how to detect being at the root node.

>From the public API you can use:

  hive_node_h some_node = ...;

  if (some_node == hivex_root (h)) {
    // you're at the root node

> It also looked like a good place to stash the last-modified time of
> the root node.  With your ABI suggestions below, I think I have a
> better way that doesn't muck with the handle structure.

Stashing the last-modified time in the handle may be a good idea, but
the handle structure doesn't have to be public to do this.  When
writing or changing the library (ie. in lib/hivex.c) you already have
access to the internal structure of struct hive_h.

> Thank you, I'll adjust my changes to use differently-named
> functions.  Is it acceptable style to you to have these become
> Java-like wrapper functions, e.g.:
> static int
> node_start_with_time (hive_h *h, void *writer_v, hive_node_h node, const char *name, const char *last_modified)
> {
>   //Body:  the node_start function as it is now, augmented with null-checking work on last_modified
> }
> static int
> node_start (hive_h *h, void *writer_v, hive_node_h node, const char *name, const char *last_modified)
> {
>   return node_start_with_time (h, write_v, node, name, NULL);
> }
> This preserves the C ABI, and prevents code duplication.

I'm not entirely sure what you mean here.  Functions like 'node_start'
are defined by the caller of the hivex API, and so have nothing to do
with the implementation.  To make this clearer: xml/hivexml.c is a
caller of the public API, while lib/hivex.c is the internal
implementation of the API.

If you mean using node_start_with_time instead of node_start2, then
yes that's a better name.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

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