NetworkManager/libnm-core/nm-libnm-core-intern/nm-ethtool-utils.h
Thomas Haller e5d2a05ad5
libnm: add "shared/nm-base/nm-base.h"
Our dependencies are complicated.

Currently "src/platform" uses parts of libnm-core and is relatively
strongly entangled with core. It would be nice to have that part
clearly independent from "src" and from "libnm-core".

Also, "src/platform/nm-platform-utils.h" uses NMEthtoolID enum, which
previously was defined in "libnm-core/nm-libnm-core-intern/nm-ethtool-utils.h".

Move that to a new place "shared/nm-base/nm-base.h".

Note that we have "libnm-core/nm-libnm-core-intern", which is
libnm/core related code which uses and is used by libnm-core.
There is a need for a library which is used by libnm-core, but
does not depend on libnm-core itself. Here comes "shared/nm-base".

Yes, many libraries. But the goal is to entangle the dependencies
and have a clear hierarchy of includes. And to have "shared/nm-platform"
independent of libnm-core.
2021-01-15 11:32:32 +01:00

37 lines
950 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018 Red Hat, Inc.
*/
#ifndef __NM_ETHTOOL_UTILS_H__
#define __NM_ETHTOOL_UTILS_H__
#include "nm-base/nm-base.h"
/*****************************************************************************/
typedef struct {
const char *optname;
NMEthtoolID id;
} NMEthtoolData;
extern const NMEthtoolData *const nm_ethtool_data[_NM_ETHTOOL_ID_NUM + 1];
const NMEthtoolData *nm_ethtool_data_get_by_optname(const char *optname);
NMEthtoolType nm_ethtool_id_to_type(NMEthtoolID id);
/****************************************************************************/
static inline NMEthtoolID
nm_ethtool_id_get_by_name(const char *optname)
{
const NMEthtoolData *d;
d = nm_ethtool_data_get_by_optname(optname);
return d ? d->id : NM_ETHTOOL_ID_UNKNOWN;
}
/****************************************************************************/
#endif /* __NM_ETHTOOL_UTILS_H__ */