From: Yu Watanabe Date: Sun, 26 Apr 2026 04:22:07 +0000 (+0900) Subject: sd-dhcp-option: drop unused sd_dhcp_option X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa881fda15025dfb643279d8f983a2409253617b;p=thirdparty%2Fsystemd.git sd-dhcp-option: drop unused sd_dhcp_option --- diff --git a/src/libsystemd-network/dhcp-option.c b/src/libsystemd-network/dhcp-option.c index 75470cb3d6e..da5fd64af67 100644 --- a/src/libsystemd-network/dhcp-option.c +++ b/src/libsystemd-network/dhcp-option.c @@ -434,43 +434,3 @@ int dhcp_option_parse_hostname(const uint8_t *option, size_t len, char **ret) { *ret = TAKE_PTR(hostname); return 0; } - -static sd_dhcp_option* dhcp_option_free(sd_dhcp_option *i) { - if (!i) - return NULL; - - free(i->data); - return mfree(i); -} - -int sd_dhcp_option_new(uint8_t option, const void *data, size_t length, sd_dhcp_option **ret) { - assert_return(ret, -EINVAL); - assert_return(length == 0 || data, -EINVAL); - - _cleanup_free_ void *q = memdup(data, length); - if (!q) - return -ENOMEM; - - sd_dhcp_option *p = new(sd_dhcp_option, 1); - if (!p) - return -ENOMEM; - - *p = (sd_dhcp_option) { - .n_ref = 1, - .option = option, - .length = length, - .data = TAKE_PTR(q), - }; - - *ret = TAKE_PTR(p); - return 0; -} - -DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_option, sd_dhcp_option, dhcp_option_free); -DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR( - dhcp_option_hash_ops, - void, - trivial_hash_func, - trivial_compare_func, - sd_dhcp_option, - sd_dhcp_option_unref); diff --git a/src/libsystemd-network/dhcp-option.h b/src/libsystemd-network/dhcp-option.h index 5ca1cafe388..f0afd892e68 100644 --- a/src/libsystemd-network/dhcp-option.h +++ b/src/libsystemd-network/dhcp-option.h @@ -1,21 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include "sd-dhcp-option.h" /* IWYU pragma: export */ - #include "dhcp-protocol.h" #include "sd-forward.h" -#include "hash-funcs.h" - -struct sd_dhcp_option { - unsigned n_ref; - - uint8_t option; - void *data; - size_t length; -}; - -extern const struct hash_ops dhcp_option_hash_ops; typedef struct DHCPServerData { struct in_addr *addr; diff --git a/src/systemd/meson.build b/src/systemd/meson.build index d7335cee558..ad455d73b21 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -28,7 +28,6 @@ _not_installed_headers = [ 'sd-dhcp-client.h', 'sd-dhcp-duid.h', 'sd-dhcp-lease.h', - 'sd-dhcp-option.h', 'sd-dhcp-protocol.h', 'sd-dhcp-server-lease.h', 'sd-dhcp-server.h', diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h index f7c5602b665..c83aaac2c9d 100644 --- a/src/systemd/sd-dhcp-client.h +++ b/src/systemd/sd-dhcp-client.h @@ -30,7 +30,6 @@ struct in_addr; typedef struct sd_device sd_device; typedef struct sd_dhcp_client_id sd_dhcp_client_id; typedef struct sd_dhcp_lease sd_dhcp_lease; -typedef struct sd_dhcp_option sd_dhcp_option; typedef struct sd_event sd_event; enum { diff --git a/src/systemd/sd-dhcp-option.h b/src/systemd/sd-dhcp-option.h deleted file mode 100644 index edc671b1b57..00000000000 --- a/src/systemd/sd-dhcp-option.h +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -#ifndef foosddhcpoptionhfoo -#define foosddhcpoptionhfoo - -/*** - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -#include "_sd-common.h" -#include "sd-dhcp-protocol.h" /* IWYU pragma: export */ - -_SD_BEGIN_DECLARATIONS; - -typedef struct sd_dhcp_option sd_dhcp_option; - -int sd_dhcp_option_new(uint8_t option, const void *data, size_t length, sd_dhcp_option **ret); -_SD_DECLARE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_option); - -_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_option, sd_dhcp_option_unref); - -_SD_END_DECLARATIONS; - -#endif diff --git a/src/systemd/sd-dhcp-server.h b/src/systemd/sd-dhcp-server.h index c17cd6b7b68..4f2fc688352 100644 --- a/src/systemd/sd-dhcp-server.h +++ b/src/systemd/sd-dhcp-server.h @@ -26,7 +26,6 @@ _SD_BEGIN_DECLARATIONS; typedef struct sd_event sd_event; -typedef struct sd_dhcp_option sd_dhcp_option; typedef struct sd_dhcp_server sd_dhcp_server; enum {