syscalls: Rename 'network-interfaces' and 'all-network-interfaces'.

* guix/build/syscalls.scm (network-interfaces): Rename to...
  (network-interface-names): ... this.
  (all-network-interfaces): Rename to...
  (all-network-interface-names): ... this.
* gnu/services/networking.scm (dhcp-client-service): Adjust accordingly.
* tests/syscalls.scm ("all-network-interfaces"): Rename to...
  ("all-network-interface-names"): ... this, and adjust accordingly.
  ("network-interfaces"): Rename to...
  ("network-interface-names"): ... this, and adjust accordingly.
This commit is contained in:
Ludovic Courtès 2015-07-25 11:46:31 +02:00
parent 53de532f28
commit b89e74054e
3 changed files with 13 additions and 13 deletions

View File

@ -173,7 +173,7 @@ Protocol (DHCP) client, on all the non-loopback network interfaces."
(define valid? (define valid?
(negate loopback-network-interface?)) (negate loopback-network-interface?))
(define ifaces (define ifaces
(filter valid? (all-network-interfaces))) (filter valid? (all-network-interface-names)))
;; XXX: Make sure the interfaces are up so that ;; XXX: Make sure the interfaces are up so that
;; 'dhclient' can actually send/receive over them. ;; 'dhclient' can actually send/receive over them.

View File

@ -60,8 +60,8 @@
IFF_UP IFF_UP
IFF_BROADCAST IFF_BROADCAST
IFF_LOOPBACK IFF_LOOPBACK
all-network-interfaces all-network-interface-names
network-interfaces network-interface-names
network-interface-flags network-interface-flags
loopback-network-interface? loopback-network-interface?
network-interface-address network-interface-address
@ -533,8 +533,8 @@ most LEN bytes from BV."
(take-while (negate zero?) bytes))) (take-while (negate zero?) bytes)))
result)))))) result))))))
(define* (network-interfaces #:optional sock) (define* (network-interface-names #:optional sock)
"Return the list of existing network interfaces. This is typically limited "Return the names of existing network interfaces. This is typically limited
to interfaces that are currently up." to interfaces that are currently up."
(let* ((close? (not sock)) (let* ((close? (not sock))
(sock (or sock (socket SOCK_STREAM AF_INET 0))) (sock (or sock (socket SOCK_STREAM AF_INET 0)))
@ -559,9 +559,9 @@ to interfaces that are currently up."
;; Regexp matching an interface line in Linux's /proc/net/dev. ;; Regexp matching an interface line in Linux's /proc/net/dev.
(make-regexp "^[[:blank:]]*([[:alnum:]]+):.*$")) (make-regexp "^[[:blank:]]*([[:alnum:]]+):.*$"))
(define (all-network-interfaces) (define (all-network-interface-names)
"Return all the registered network interfaces, including those that are not "Return all the names of the registered network interfaces, including those
up." that are not up."
(call-with-input-file "/proc/net/dev" ;XXX: Linux-specific (call-with-input-file "/proc/net/dev" ;XXX: Linux-specific
(lambda (port) (lambda (port)
(let loop ((interfaces '())) (let loop ((interfaces '()))

View File

@ -152,15 +152,15 @@
(status:exit-val status)))) (status:exit-val status))))
(eq? #t result)))))))) (eq? #t result))))))))
(test-assert "all-network-interfaces" (test-assert "all-network-interface-names"
(match (all-network-interfaces) (match (all-network-interface-names)
(((? string? names) ..1) (((? string? names) ..1)
(member "lo" names)))) (member "lo" names))))
(test-assert "network-interfaces" (test-assert "network-interface-names"
(match (network-interfaces) (match (network-interface-names)
(((? string? names) ..1) (((? string? names) ..1)
(lset<= string=? names (all-network-interfaces))))) (lset<= string=? names (all-network-interface-names)))))
(test-assert "network-interface-flags" (test-assert "network-interface-flags"
(let* ((sock (socket AF_INET SOCK_STREAM 0)) (let* ((sock (socket AF_INET SOCK_STREAM 0))