[systemd-devel] [PATCH] sd-dhcp-lease: expose load/save functions

Dan Williams dcbw at redhat.com
Tue Nov 4 09:41:31 PST 2014


They're useful outside of networkd itself in the libsystemd-network
library.
---
 src/libsystemd-network/dhcp-lease-internal.h | 3 ---
 src/libsystemd-network/sd-dhcp-lease.c       | 4 ++--
 src/network/networkd-link.c                  | 2 +-
 src/systemd/sd-dhcp-lease.h                  | 3 +++
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/libsystemd-network/dhcp-lease-internal.h b/src/libsystemd-network/dhcp-lease-internal.h
index b85b698..9e184ac 100644
--- a/src/libsystemd-network/dhcp-lease-internal.h
+++ b/src/libsystemd-network/dhcp-lease-internal.h
@@ -78,9 +78,6 @@ int dhcp_lease_new(sd_dhcp_lease **ret);
 int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option,
                               void *user_data);
 
-int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
-int dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret);
-
 int dhcp_lease_set_default_subnet_mask(sd_dhcp_lease *lease);
 
 int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const uint8_t *client_id,
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 3e338dc..0d74800 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -581,7 +581,7 @@ int dhcp_lease_new(sd_dhcp_lease **ret) {
         return 0;
 }
 
-int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
+int sd_dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file) {
         _cleanup_free_ char *temp_path = NULL;
         _cleanup_fclose_ FILE *f = NULL;
         struct in_addr address;
@@ -690,7 +690,7 @@ finish:
         return r;
 }
 
-int dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret) {
+int sd_dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret) {
         _cleanup_dhcp_lease_unref_ sd_dhcp_lease *lease = NULL;
         _cleanup_free_ char *address = NULL, *router = NULL, *netmask = NULL,
                             *server_address = NULL, *next_server = NULL,
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 26ef0fe..fcfbd3e 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1857,7 +1857,7 @@ int link_save(Link *link) {
         if (link->dhcp_lease) {
                 assert(link->network);
 
-                r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
+                r = sd_dhcp_lease_save(link->dhcp_lease, link->lease_file);
                 if (r < 0)
                         goto fail;
 
diff --git a/src/systemd/sd-dhcp-lease.h b/src/systemd/sd-dhcp-lease.h
index 5fafc04..1b0207b 100644
--- a/src/systemd/sd-dhcp-lease.h
+++ b/src/systemd/sd-dhcp-lease.h
@@ -48,4 +48,7 @@ int sd_dhcp_lease_get_routes(sd_dhcp_lease *lease, struct sd_dhcp_route **routes
 int sd_dhcp_lease_get_client_id(sd_dhcp_lease *lease, const uint8_t **client_id,
                                 size_t *client_id_len);
 
+int sd_dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
+int sd_dhcp_lease_load(const char *lease_file, sd_dhcp_lease **ret);
+
 #endif
-- 
1.9.3




More information about the systemd-devel mailing list