guix-devel
[Top][All Lists]
Advanced

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

[PATCH 2/4] Rename 'dmd-command' to 'shepherd-command'.


From: Alex Kost
Subject: [PATCH 2/4] Rename 'dmd-command' to 'shepherd-command'.
Date: Fri, 22 Jan 2016 22:44:30 +0300

* 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: Likewise.
* shepherd.texi (Communication): Likewise.
---
 modules/halt.scm          |  2 +-
 modules/herd.scm          |  2 +-
 modules/reboot.scm        |  2 +-
 modules/shepherd.scm      | 10 +++----
 modules/shepherd/comm.scm | 66 +++++++++++++++++++++++------------------------
 shepherd.texi             | 15 ++++++-----
 tests/status-sexp.sh      |  4 +--
 7 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/modules/halt.scm b/modules/halt.scm
index 96da176..0f4a814 100644
--- a/modules/halt.scm
+++ b/modules/halt.scm
@@ -50,7 +50,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.
        (setvbuf sock _IOLBF)
diff --git a/modules/herd.scm b/modules/herd.scm
index 40bd10a..3b330cb 100644
--- a/modules/herd.scm
+++ b/modules/herd.scm
@@ -104,7 +104,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 d92f2de..df21c7f 100644
--- a/modules/reboot.scm
+++ b/modules/reboot.scm
@@ -50,7 +50,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.
        (setvbuf sock _IOLBF)
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 2104848..1a14f09 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -222,9 +222,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
@@ -281,9 +281,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 b7bfc8c..79983b4 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
@@ -53,19 +53,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
@@ -89,24 +89,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/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))
-- 
2.6.3




reply via email to

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