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

Re: [PATCH v2 08/19] tools/xenstore: replace watch->relative_path with a prefix length



Hi Juergen,

On 13/12/2022 16:00, Juergen Gross wrote:
@@ -313,19 +302,19 @@ const char *dump_state_watches(FILE *fp, struct 
connection *conn,
                               unsigned int conn_id)
  {
        const char *ret = NULL;
+       const char *watch_path;
        struct watch *watch;
        struct xs_state_watch sw;
        struct xs_state_record_header head;
-       const char *path;
head.type = XS_STATE_TYPE_WATCH; list_for_each_entry(watch, &conn->watches, list) {
                head.length = sizeof(sw);
+ watch_path = get_watch_path(watch, watch->node);

It is not clear to me why you call get_watch_path() earlier and also rename the variable.

I don't mind the new name, but it doesn't feel like it belongs to this patch as the code in duymp_state_watches() would not be changed otherwise.

Cheers,

                sw.conn_id = conn_id;
-               path = get_watch_path(watch, watch->node);
-               sw.path_length = strlen(path) + 1;
+               sw.path_length = strlen(watch_path) + 1;
                sw.token_length = strlen(watch->token) + 1;
                head.length += sw.path_length + sw.token_length;
                head.length = ROUNDUP(head.length, 3);
@@ -334,7 +323,7 @@ const char *dump_state_watches(FILE *fp, struct connection 
*conn,
                if (fwrite(&sw, sizeof(sw), 1, fp) != 1)
                        return "Dump watch state error";
- if (fwrite(path, sw.path_length, 1, fp) != 1)
+               if (fwrite(watch_path, sw.path_length, 1, fp) != 1)
                        return "Dump watch path error";
                if (fwrite(watch->token, sw.token_length, 1, fp) != 1)
                        return "Dump watch token error";

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.