guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 01/02: Rename 'dmd-command' to 'shepherd-command'.


From: Ludovic Courtès
Subject: [shepherd] 01/02: Rename 'dmd-command' to 'shepherd-command'.
Date: Sat, 23 Jan 2016 11:12:08 +0000

civodul pushed a commit to branch master
in repository shepherd.

commit 3c7cf633b15767a8224df5d9aab2e941eb83db61
Author: Alex Kost <address@hidden>
Date:   Fri Jan 22 22:44:30 2016 +0300

    Rename 'dmd-command' to 'shepherd-command'.
    
    * modules/shepherd/comm.scm (<dmd-command>): Rename record type and its
    accessors to...
    (<shepherd-command>): ... this.
    (read-command, write-command): Adjust accordingly.
    * modules/halt.scm (main): Likewise.
    * modules/herd.scm (run-command): Likewise.
    * modules/reboot.scm (main): Likewise.
    * modules/shepherd.scm (process-command, process-textual-commands): 
Likewise.
    * tests/status-sexp.sh, tests/misbehaved-client.sh: Likewise.
    * shepherd.texi (Communication): Likewise.
    
    Signed-off-by: Ludovic Courtès <address@hidden>
---
 modules/halt.scm           |    2 +-
 modules/herd.scm           |    2 +-
 modules/reboot.scm         |    2 +-
 modules/shepherd.scm       |   10 +++---
 modules/shepherd/comm.scm  |   64 ++++++++++++++++++++++----------------------
 shepherd.texi              |   15 +++++-----
 tests/misbehaved-client.sh |    2 +-
 tests/status-sexp.sh       |    4 +-
 8 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/modules/halt.scm b/modules/halt.scm
index 77dddbe..75497d8 100644
--- a/modules/halt.scm
+++ b/modules/halt.scm
@@ -49,7 +49,7 @@
       (with-system-error-handling
        (let ((sock (open-connection socket-file)))
          ;; Send the command without further ado.
-         (write-command (dmd-command 'power-off 'dmd) sock)
+         (write-command (shepherd-command 'power-off 'dmd) sock)
 
          ;; Receive output if we're not already dead.
          (match (read sock)
diff --git a/modules/herd.scm b/modules/herd.scm
index bc6c578..c2cca85 100644
--- a/modules/herd.scm
+++ b/modules/herd.scm
@@ -92,7 +92,7 @@ the daemon via SOCKET-FILE."
                       'status
                       action)))
      ;; Send the command.
-     (write-command (dmd-command action* service #:arguments args)
+     (write-command (shepherd-command action* service #:arguments args)
                     sock)
 
      ;; Receive output.
diff --git a/modules/reboot.scm b/modules/reboot.scm
index af05cc2..8642ac2 100644
--- a/modules/reboot.scm
+++ b/modules/reboot.scm
@@ -49,7 +49,7 @@
       (with-system-error-handling
        (let ((sock (open-connection socket-file)))
          ;; Send the command without further ado.
-         (write-command (dmd-command 'stop 'dmd) sock)
+         (write-command (shepherd-command 'stop 'dmd) sock)
 
          ;; Receive output if we're not already dead.
          (match (read sock)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 9551267..3650e0e 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -224,9 +224,9 @@
 
 (define (process-command command port)
   "Interpret COMMAND, a command sent by the user, represented as a
-<dmd-command> object.  Send the reply to PORT."
+<shepherd-command> object.  Send the reply to PORT."
   (match command
-    (($ <dmd-command> the-action service-symbol (args ...) dir)
+    (($ <shepherd-command> the-action service-symbol (args ...) dir)
      (chdir dir)
 
      ;; We have to catch `quit' so that we can send the terminator
@@ -283,9 +283,9 @@ would write them on the 'herd' command line."
         (begin
           (match (string-tokenize line)
             ((action service arguments ...)
-             (process-command (dmd-command (string->symbol action)
-                                           (string->symbol service)
-                                           #:arguments arguments)
+             (process-command (shepherd-command (string->symbol action)
+                                                (string->symbol service)
+                                                #:arguments arguments)
                               port))
             (_
              (local-output "invalid command line" line)))
diff --git a/modules/shepherd/comm.scm b/modules/shepherd/comm.scm
index 0dc7faa..f6f53c2 100644
--- a/modules/shepherd/comm.scm
+++ b/modules/shepherd/comm.scm
@@ -25,13 +25,13 @@
   #:use-module (ice-9 match)
   #:export (open-connection
 
-            <dmd-command>
-            dmd-command?
-            dmd-command
-            dmd-command-directory
-            dmd-command-action
-            dmd-command-service
-            dmd-command-arguments
+            <shepherd-command>
+            shepherd-command?
+            shepherd-command
+            shepherd-command-directory
+            shepherd-command-action
+            shepherd-command-service
+            shepherd-command-arguments
 
             <command-reply>
             command-reply
@@ -54,19 +54,19 @@
             shepherd-output-port))
 
 
-;; Command for dmd.
-(define-record-type <dmd-command>
-  (%dmd-command action service args directory)
-  dmd-command?
-  (action    dmd-command-action)                  ; symbol
-  (service   dmd-command-service)                 ; symbol
-  (args      dmd-command-arguments)               ; list of strings
-  (directory dmd-command-directory))              ; directory name
-
-(define* (dmd-command action service
-                      #:key (arguments '()) (directory (getcwd)))
+;; Command for shepherd.
+(define-record-type <shepherd-command>
+  (%shepherd-command action service args directory)
+  shepherd-command?
+  (action    shepherd-command-action)             ; symbol
+  (service   shepherd-command-service)            ; symbol
+  (args      shepherd-command-arguments)          ; list of strings
+  (directory shepherd-command-directory))         ; directory name
+
+(define* (shepherd-command action service
+                           #:key (arguments '()) (directory (getcwd)))
   "Return a new command for ACTION on SERVICE."
-  (%dmd-command action service arguments directory))
+  (%shepherd-command action service arguments directory))
 
 (define* (open-connection #:optional (file default-socket-file))
   "Open a connection to the daemon, using the Unix-domain socket at FILE, and
@@ -90,24 +90,24 @@ return the socket."
 (define (read-command port)
   "Receive a command from PORT."
   (match (read port)
-    (('dmd-command ('version 0 _ ...)
-                   ('action action)
-                   ('service service)
-                   ('arguments args ...)
-                   ('directory directory))
-     (dmd-command action service
-                  #:arguments args
-                  #:directory directory))))
+    (('shepherd-command ('version 0 _ ...)
+                        ('action action)
+                        ('service service)
+                        ('arguments args ...)
+                        ('directory directory))
+     (shepherd-command action service
+                       #:arguments args
+                       #:directory directory))))
 
 (define (write-command command port)
   "Write COMMAND to PORT."
   (match command
-    (($ <dmd-command> action service (arguments ...) directory)
-     (write `(dmd-command (version 0)             ; protocol version
-                          (action ,action)
-                          (service ,service)
-                          (arguments ,@arguments)
-                          (directory ,directory))
+    (($ <shepherd-command> action service (arguments ...) directory)
+     (write `(shepherd-command (version 0)        ; protocol version
+                               (action ,action)
+                               (service ,service)
+                               (arguments ,@arguments)
+                               (directory ,directory))
             port))))
 
 
diff --git a/shepherd.texi b/shepherd.texi
index b980254..105155f 100644
--- a/shepherd.texi
+++ b/shepherd.texi
@@ -1066,16 +1066,17 @@ as @command{herd} to connect to @command{shepherd} and 
send it commands to
 control or change its behavior (@pxref{Slots of services, actions of
 services}).
 
address@hidden <dmd-command>
address@hidden <shepherd-command>
 Currently, clients may only send @dfn{commands}, represented by the
address@hidden<dmd-command>} type.  Each command specifies a service it applies
-to, an action name, a list of strings to be used as arguments, and a
-working directory.  Commands are instantiated with @code{dmd-command}:
address@hidden<shepherd-command>} type.  Each command specifies a service it
+applies to, an action name, a list of strings to be used as arguments,
+and a working directory.  Commands are instantiated with
address@hidden:
 
address@hidden {procedure} dmd-command @var{action} @var{service} @
address@hidden {procedure} shepherd-command @var{action} @var{service} @
          [#:@var{arguments} '()] [#:@var{directory} (getcwd)]
-Return a new command (a @code{<dmd-command>}) object for @var{action} on
address@hidden
+Return a new command (a @code{<shepherd-command>}) object for
address@hidden on @var{service}.
 @end deffn
 
 @noindent
diff --git a/tests/misbehaved-client.sh b/tests/misbehaved-client.sh
index f69f65e..bbf6b03 100644
--- a/tests/misbehaved-client.sh
+++ b/tests/misbehaved-client.sh
@@ -42,7 +42,7 @@ dmd_pid="`cat $pid`"
 
 (let ((sock (open-connection \"$socket\")))
   (setvbuf sock _IOFBF 5000)
-  (write-command (dmd-command 'status 'dmd) sock)
+  (write-command (shepherd-command 'status 'dmd) sock)
 
   ;; Close prematurely, right after sending the command.
   (close-port sock))"
diff --git a/tests/status-sexp.sh b/tests/status-sexp.sh
index a16c847..b47ce9a 100644
--- a/tests/status-sexp.sh
+++ b/tests/status-sexp.sh
@@ -62,7 +62,7 @@ test -S "$socket"
 # Code to fetch service status info.
 fetch_status="
   (let ((sock (open-connection \"$socket\")))
-    (write-command (dmd-command 'status 'dmd) sock)
+    (write-command (shepherd-command 'status 'dmd) sock)
     (read sock))"
 
 dmd_service_sexp="
@@ -98,7 +98,7 @@ dmd_service_sexp="
 (use-modules (shepherd comm) (ice-9 match))
 
 (match (let ((sock (open-connection \"$socket\")))
-         (write-command (dmd-command 'status 'does-not-exist) sock)
+         (write-command (shepherd-command 'status 'does-not-exist) sock)
          (read sock))
   (('reply _ ...
     ('error ('error _ 'service-not-found 'does-not-exist))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]