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

Re: [PATCH 10/20] tools/xenstore: replace watch->relative_path with a prefix length



Hi Juergen,

On 01/11/2022 15:28, Juergen Gross wrote:
@@ -324,8 +312,7 @@ const char *dump_state_watches(FILE *fp, struct connection 
*conn,
                head.length = sizeof(sw);
sw.conn_id = conn_id;
-               path = get_watch_path(watch, watch->node);
-               sw.path_length = strlen(path) + 1;
+               sw.path_length = strlen(watch->node + watch->prefix_len) + 1;

Why are you open-coding get_watch_path()?

                sw.token_length = strlen(watch->token) + 1;
                head.length += sw.path_length + sw.token_length;
                head.length = ROUNDUP(head.length, 3);
@@ -334,7 +321,8 @@ 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->node + watch->prefix_len, 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®.