sd-dhcp-option: drop unused sd_dhcp_option
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 <https://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
#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
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user