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

[xen staging] tools/xenstored: have a single do_control_memreport()



commit f5e1c527d0a0d09ca0cb1dcd8d4ab4a1a5261e91
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Fri Feb 16 17:31:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Feb 23 17:43:06 2024 +0000

    tools/xenstored: have a single do_control_memreport()
    
    With 9pfs now available in Xenstore-stubdom, there is no reason to
    have distinct do_control_memreport() variants for the daemon and the
    stubdom implementations.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>
---
 tools/xenstored/control.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/tools/xenstored/control.c b/tools/xenstored/control.c
index dae23a5ac0..9561289179 100644
--- a/tools/xenstored/control.c
+++ b/tools/xenstored/control.c
@@ -216,23 +216,11 @@ static int do_control_logfile(const void *ctx, struct 
connection *conn,
        return 0;
 }
 
-#ifdef __MINIOS__
-static int do_control_memreport(const void *ctx, struct connection *conn,
-                               const char **vec, int num)
-{
-       if (num)
-               return EINVAL;
-
-       talloc_report_full(NULL, stdout);
-
-       send_ack(conn, XS_CONTROL);
-       return 0;
-}
-#else
 static int do_control_memreport(const void *ctx, struct connection *conn,
                                const char **vec, int num)
 {
        FILE *fp;
+       const char *filename;
        int fd;
 
        if (num > 1)
@@ -255,8 +243,12 @@ static int do_control_memreport(const void *ctx, struct 
connection *conn,
                        if (!fp)
                                close(fd);
                }
-       } else
-               fp = fopen(vec[0], "a");
+       } else {
+               filename = absolute_filename(ctx, vec[0]);
+               if (!filename)
+                       return ENOMEM;
+               fp = fopen(filename, "a");
+       }
 
        if (!fp)
                return EBADF;
@@ -267,7 +259,6 @@ static int do_control_memreport(const void *ctx, struct 
connection *conn,
        send_ack(conn, XS_CONTROL);
        return 0;
 }
-#endif
 
 static int do_control_print(const void *ctx, struct connection *conn,
                            const char **vec, int num)
@@ -310,11 +301,7 @@ static struct cmd_s cmds[] = {
                "    Default timeout is 60 seconds.", 5 },
 #endif
        { "logfile", do_control_logfile, "<file>" },
-#ifdef __MINIOS__
-       { "memreport", do_control_memreport, "" },
-#else
        { "memreport", do_control_memreport, "[<file>]" },
-#endif
        { "print", do_control_print, "<string>" },
        { "quota", do_control_quota,
                "[set <name> <val>|<domid>|max [-r]]" },
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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