diff mbox

[v2,1/5] xenstore: rename XS_DEBUG wire command

Message ID 20170221150737.30589-2-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Feb. 21, 2017, 3:07 p.m. UTC
In preparation to support other than pure debug functionality via the
Xenstore XS_DEBUG wire command rename it to XS_CONTROL and make
XS_DEBUG an alias of it.

Add an alias xs_control_command for the associated xs_debug_command,
too.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/include/xenstore.h | 2 +-
 tools/xenstore/xenstored_core.c   | 8 ++++----
 tools/xenstore/xs.c               | 7 +++----
 xen/include/public/io/xs_wire.h   | 3 ++-
 4 files changed, 10 insertions(+), 10 deletions(-)

Comments

Wei Liu Feb. 22, 2017, 12:36 p.m. UTC | #1
On Tue, Feb 21, 2017 at 04:07:33PM +0100, Juergen Gross wrote:
> In preparation to support other than pure debug functionality via the
> Xenstore XS_DEBUG wire command rename it to XS_CONTROL and make
> XS_DEBUG an alias of it.
> 
> Add an alias xs_control_command for the associated xs_debug_command,
> too.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  tools/xenstore/include/xenstore.h | 2 +-
>  tools/xenstore/xenstored_core.c   | 8 ++++----
>  tools/xenstore/xs.c               | 7 +++----
>  xen/include/public/io/xs_wire.h   | 3 ++-
>  4 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
> index 0d12c39..66bb9ed 100644
> --- a/tools/xenstore/include/xenstore.h
> +++ b/tools/xenstore/include/xenstore.h
> @@ -262,9 +262,9 @@ bool xs_path_is_subpath(const char *parent, const char *child);
>   */
>  bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
>  
> -/* Only useful for DEBUG versions */
>  char *xs_debug_command(struct xs_handle *h, const char *cmd,
>  		       void *data, unsigned int len);
> +#define xs_control_command xs_debug_command
>  

Should be the other way around?
Jürgen Groß Feb. 22, 2017, 12:40 p.m. UTC | #2
On 22/02/17 13:36, Wei Liu wrote:
> On Tue, Feb 21, 2017 at 04:07:33PM +0100, Juergen Gross wrote:
>> In preparation to support other than pure debug functionality via the
>> Xenstore XS_DEBUG wire command rename it to XS_CONTROL and make
>> XS_DEBUG an alias of it.
>>
>> Add an alias xs_control_command for the associated xs_debug_command,
>> too.
>>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>  tools/xenstore/include/xenstore.h | 2 +-
>>  tools/xenstore/xenstored_core.c   | 8 ++++----
>>  tools/xenstore/xs.c               | 7 +++----
>>  xen/include/public/io/xs_wire.h   | 3 ++-
>>  4 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
>> index 0d12c39..66bb9ed 100644
>> --- a/tools/xenstore/include/xenstore.h
>> +++ b/tools/xenstore/include/xenstore.h
>> @@ -262,9 +262,9 @@ bool xs_path_is_subpath(const char *parent, const char *child);
>>   */
>>  bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
>>  
>> -/* Only useful for DEBUG versions */
>>  char *xs_debug_command(struct xs_handle *h, const char *cmd,
>>  		       void *data, unsigned int len);
>> +#define xs_control_command xs_debug_command
>>  
> 
> Should be the other way around?
> 

I did it that way to keep the xs_debug_command symbol in the library.
Otherwise someone using that function would have to rebuild.


Juergen
Wei Liu Feb. 22, 2017, 12:43 p.m. UTC | #3
On Wed, Feb 22, 2017 at 01:40:42PM +0100, Juergen Gross wrote:
> On 22/02/17 13:36, Wei Liu wrote:
> > On Tue, Feb 21, 2017 at 04:07:33PM +0100, Juergen Gross wrote:
> >> In preparation to support other than pure debug functionality via the
> >> Xenstore XS_DEBUG wire command rename it to XS_CONTROL and make
> >> XS_DEBUG an alias of it.
> >>
> >> Add an alias xs_control_command for the associated xs_debug_command,
> >> too.
> >>
> >> Signed-off-by: Juergen Gross <jgross@suse.com>
> >> ---
> >>  tools/xenstore/include/xenstore.h | 2 +-
> >>  tools/xenstore/xenstored_core.c   | 8 ++++----
> >>  tools/xenstore/xs.c               | 7 +++----
> >>  xen/include/public/io/xs_wire.h   | 3 ++-
> >>  4 files changed, 10 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
> >> index 0d12c39..66bb9ed 100644
> >> --- a/tools/xenstore/include/xenstore.h
> >> +++ b/tools/xenstore/include/xenstore.h
> >> @@ -262,9 +262,9 @@ bool xs_path_is_subpath(const char *parent, const char *child);
> >>   */
> >>  bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
> >>  
> >> -/* Only useful for DEBUG versions */
> >>  char *xs_debug_command(struct xs_handle *h, const char *cmd,
> >>  		       void *data, unsigned int len);
> >> +#define xs_control_command xs_debug_command
> >>  
> > 
> > Should be the other way around?
> > 
> 
> I did it that way to keep the xs_debug_command symbol in the library.
> Otherwise someone using that function would have to rebuild.
> 

But then there is no xs_control_command symbol now.

I would just have two functions. xs_debug_command should be implemented
with xs_control_command (plus some extra check to only allow certain
behaviours if you fancy that).

> 
> Juergen
Jürgen Groß Feb. 22, 2017, 12:44 p.m. UTC | #4
On 22/02/17 13:43, Wei Liu wrote:
> On Wed, Feb 22, 2017 at 01:40:42PM +0100, Juergen Gross wrote:
>> On 22/02/17 13:36, Wei Liu wrote:
>>> On Tue, Feb 21, 2017 at 04:07:33PM +0100, Juergen Gross wrote:
>>>> In preparation to support other than pure debug functionality via the
>>>> Xenstore XS_DEBUG wire command rename it to XS_CONTROL and make
>>>> XS_DEBUG an alias of it.
>>>>
>>>> Add an alias xs_control_command for the associated xs_debug_command,
>>>> too.
>>>>
>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>> ---
>>>>  tools/xenstore/include/xenstore.h | 2 +-
>>>>  tools/xenstore/xenstored_core.c   | 8 ++++----
>>>>  tools/xenstore/xs.c               | 7 +++----
>>>>  xen/include/public/io/xs_wire.h   | 3 ++-
>>>>  4 files changed, 10 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
>>>> index 0d12c39..66bb9ed 100644
>>>> --- a/tools/xenstore/include/xenstore.h
>>>> +++ b/tools/xenstore/include/xenstore.h
>>>> @@ -262,9 +262,9 @@ bool xs_path_is_subpath(const char *parent, const char *child);
>>>>   */
>>>>  bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
>>>>  
>>>> -/* Only useful for DEBUG versions */
>>>>  char *xs_debug_command(struct xs_handle *h, const char *cmd,
>>>>  		       void *data, unsigned int len);
>>>> +#define xs_control_command xs_debug_command
>>>>  
>>>
>>> Should be the other way around?
>>>
>>
>> I did it that way to keep the xs_debug_command symbol in the library.
>> Otherwise someone using that function would have to rebuild.
>>
> 
> But then there is no xs_control_command symbol now.
> 
> I would just have two functions. xs_debug_command should be implemented
> with xs_control_command (plus some extra check to only allow certain
> behaviours if you fancy that).

Okay, if you like that better.


Juergen
diff mbox

Patch

diff --git a/tools/xenstore/include/xenstore.h b/tools/xenstore/include/xenstore.h
index 0d12c39..66bb9ed 100644
--- a/tools/xenstore/include/xenstore.h
+++ b/tools/xenstore/include/xenstore.h
@@ -262,9 +262,9 @@  bool xs_path_is_subpath(const char *parent, const char *child);
  */
 bool xs_is_domain_introduced(struct xs_handle *h, unsigned int domid);
 
-/* Only useful for DEBUG versions */
 char *xs_debug_command(struct xs_handle *h, const char *cmd,
 		       void *data, unsigned int len);
+#define xs_control_command xs_debug_command
 
 int xs_suspend_evtchn_port(int domid);
 #endif /* XENSTORE_H */
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 1e9b622..e332d7f 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1261,7 +1261,7 @@  static int do_set_perms(struct connection *conn, struct buffered_data *in)
 	return 0;
 }
 
-static int do_debug(struct connection *conn, struct buffered_data *in)
+static int do_control(struct connection *conn, struct buffered_data *in)
 {
 	int num;
 
@@ -1273,13 +1273,13 @@  static int do_debug(struct connection *conn, struct buffered_data *in)
 	if (streq(in->buffer, "print")) {
 		if (num < 2)
 			return EINVAL;
-		xprintf("debug: %s", in->buffer + get_string(in, 0));
+		xprintf("control: %s", in->buffer + get_string(in, 0));
 	}
 
 	if (streq(in->buffer, "check"))
 		check_store();
 
-	send_ack(conn, XS_DEBUG);
+	send_ack(conn, XS_CONTROL);
 
 	return 0;
 }
@@ -1288,7 +1288,7 @@  static struct {
 	const char *str;
 	int (*func)(struct connection *conn, struct buffered_data *in);
 } const wire_funcs[XS_TYPE_COUNT] = {
-	[XS_DEBUG]             = { "DEBUG",             do_debug },
+	[XS_CONTROL]           = { "CONTROL",           do_control },
 	[XS_DIRECTORY]         = { "DIRECTORY",         send_directory },
 	[XS_READ]              = { "READ",              do_read },
 	[XS_GET_PERMS]         = { "GET_PERMS",         do_get_perms },
diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
index 6fa1261..0fdc0bb 100644
--- a/tools/xenstore/xs.c
+++ b/tools/xenstore/xs.c
@@ -1165,9 +1165,8 @@  out:
     return port;
 }
 
-/* Only useful for DEBUG versions */
-char *xs_debug_command(struct xs_handle *h, const char *cmd,
-		       void *data, unsigned int len)
+char *xs_control_command(struct xs_handle *h, const char *cmd,
+			 void *data, unsigned int len)
 {
 	struct iovec iov[2];
 
@@ -1176,7 +1175,7 @@  char *xs_debug_command(struct xs_handle *h, const char *cmd,
 	iov[1].iov_base = data;
 	iov[1].iov_len = len;
 
-	return xs_talkv(h, XBT_NULL, XS_DEBUG, iov,
+	return xs_talkv(h, XBT_NULL, XS_CONTROL, iov,
 			ARRAY_SIZE(iov), NULL);
 }
 
diff --git a/xen/include/public/io/xs_wire.h b/xen/include/public/io/xs_wire.h
index f9f94f1..4dd6632 100644
--- a/xen/include/public/io/xs_wire.h
+++ b/xen/include/public/io/xs_wire.h
@@ -28,7 +28,8 @@ 
 
 enum xsd_sockmsg_type
 {
-    XS_DEBUG,
+    XS_CONTROL,
+#define XS_DEBUG XS_CONTROL
     XS_DIRECTORY,
     XS_READ,
     XS_GET_PERMS,