mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-29 18:18:17 +02:00
```bash
readarray -d '' FILES < <(
git ls-files -z \
':(exclude)po' \
':(exclude)shared/c-rbtree' \
':(exclude)shared/c-list' \
':(exclude)shared/c-siphash' \
':(exclude)shared/c-stdaux' \
':(exclude)shared/n-acd' \
':(exclude)shared/n-dhcp4' \
':(exclude)src/systemd/src' \
':(exclude)shared/systemd/src' \
':(exclude)m4' \
':(exclude)COPYING*'
)
sed \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \
-e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \
-i \
"${FILES[@]}"
echo ">>> untouched Copyright lines"
git grep Copyright "${FILES[@]}"
echo ">>> Copyright lines with unusual extra"
git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved
sed \
-e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \
-i \
"${FILES[@]}"
```
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
177 lines
8.5 KiB
C
177 lines
8.5 KiB
C
// SPDX-License-Identifier: LGPL-2.1+
|
|
/*
|
|
* Copyright (C) 2019 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NM_DBUS_AUX_H__
|
|
#define __NM_DBUS_AUX_H__
|
|
|
|
#include "nm-std-aux/nm-dbus-compat.h"
|
|
|
|
/*****************************************************************************/
|
|
|
|
static inline gboolean
|
|
nm_clear_g_dbus_connection_signal (GDBusConnection *dbus_connection,
|
|
guint *id)
|
|
{
|
|
guint v;
|
|
|
|
if ( id
|
|
&& (v = *id)) {
|
|
*id = 0;
|
|
g_dbus_connection_signal_unsubscribe (dbus_connection, v);
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
|
|
typedef void (*NMDBusConnectionCallDefaultCb) (GVariant *result,
|
|
GError *error,
|
|
gpointer user_data);
|
|
|
|
/*****************************************************************************/
|
|
|
|
static inline void
|
|
nm_dbus_connection_call_start_service_by_name (GDBusConnection *dbus_connection,
|
|
const char *name,
|
|
int timeout_msec,
|
|
GCancellable *cancellable,
|
|
GAsyncReadyCallback callback,
|
|
gpointer user_data)
|
|
{
|
|
g_dbus_connection_call (dbus_connection,
|
|
DBUS_SERVICE_DBUS,
|
|
DBUS_PATH_DBUS,
|
|
DBUS_INTERFACE_DBUS,
|
|
"StartServiceByName",
|
|
g_variant_new ("(su)", name, 0u),
|
|
G_VARIANT_TYPE ("(u)"),
|
|
G_DBUS_CALL_FLAGS_NONE,
|
|
timeout_msec,
|
|
cancellable,
|
|
callback,
|
|
user_data);
|
|
}
|
|
|
|
/*****************************************************************************/
|
|
|
|
static inline guint
|
|
nm_dbus_connection_signal_subscribe_name_owner_changed (GDBusConnection *dbus_connection,
|
|
const char *service_name,
|
|
GDBusSignalCallback callback,
|
|
gpointer user_data,
|
|
GDestroyNotify user_data_free_func)
|
|
|
|
{
|
|
return g_dbus_connection_signal_subscribe (dbus_connection,
|
|
DBUS_SERVICE_DBUS,
|
|
DBUS_INTERFACE_DBUS,
|
|
"NameOwnerChanged",
|
|
DBUS_PATH_DBUS,
|
|
service_name,
|
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
|
callback,
|
|
user_data,
|
|
user_data_free_func);
|
|
}
|
|
|
|
typedef void (*NMDBusConnectionCallGetNameOwnerCb) (const char *name_owner,
|
|
GError *error,
|
|
gpointer user_data);
|
|
|
|
void nm_dbus_connection_call_get_name_owner (GDBusConnection *dbus_connection,
|
|
const char *service_name,
|
|
int timeout_msec,
|
|
GCancellable *cancellable,
|
|
NMDBusConnectionCallGetNameOwnerCb callback,
|
|
gpointer user_data);
|
|
|
|
static inline guint
|
|
nm_dbus_connection_signal_subscribe_properties_changed (GDBusConnection *dbus_connection,
|
|
const char *bus_name,
|
|
const char *object_path,
|
|
const char *interface_name,
|
|
GDBusSignalCallback callback,
|
|
gpointer user_data,
|
|
GDestroyNotify user_data_free_func)
|
|
|
|
{
|
|
nm_assert (bus_name);
|
|
|
|
/* it seems that using a non-unique name causes problems that we get signals
|
|
* also from unrelated senders. Usually, you are anyway monitoring the name-owner,
|
|
* so you should have the unique name at hand.
|
|
*
|
|
* If not, investigate this, ensure that it works, and lift this restriction. */
|
|
nm_assert (g_dbus_is_unique_name (bus_name));
|
|
|
|
return g_dbus_connection_signal_subscribe (dbus_connection,
|
|
bus_name,
|
|
DBUS_INTERFACE_PROPERTIES,
|
|
"PropertiesChanged",
|
|
object_path,
|
|
interface_name,
|
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
|
callback,
|
|
user_data,
|
|
user_data_free_func);
|
|
}
|
|
|
|
void nm_dbus_connection_call_get_all (GDBusConnection *dbus_connection,
|
|
const char *bus_name,
|
|
const char *object_path,
|
|
const char *interface_name,
|
|
int timeout_msec,
|
|
GCancellable *cancellable,
|
|
NMDBusConnectionCallDefaultCb callback,
|
|
gpointer user_data);
|
|
|
|
/*****************************************************************************/
|
|
|
|
static inline guint
|
|
nm_dbus_connection_signal_subscribe_object_manager_plain (GDBusConnection *dbus_connection,
|
|
const char *service_name,
|
|
const char *object_path,
|
|
const char *signal_name,
|
|
GDBusSignalCallback callback,
|
|
gpointer user_data,
|
|
GDestroyNotify user_data_free_func)
|
|
{
|
|
return g_dbus_connection_signal_subscribe (dbus_connection,
|
|
service_name,
|
|
DBUS_INTERFACE_OBJECT_MANAGER,
|
|
signal_name,
|
|
object_path,
|
|
NULL,
|
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
|
callback,
|
|
user_data,
|
|
user_data_free_func);
|
|
}
|
|
|
|
typedef void (*NMDBusConnectionSignalObjectMangerCb) (const char *object_path,
|
|
GVariant *added_interfaces_and_properties,
|
|
const char *const*removed_interfaces,
|
|
gpointer user_data);
|
|
|
|
guint nm_dbus_connection_signal_subscribe_object_manager (GDBusConnection *dbus_connection,
|
|
const char *service_name,
|
|
const char *object_path,
|
|
NMDBusConnectionSignalObjectMangerCb callback,
|
|
gpointer user_data,
|
|
GDestroyNotify user_data_free_func);
|
|
|
|
void nm_dbus_connection_call_get_managed_objects (GDBusConnection *dbus_connection,
|
|
const char *bus_name,
|
|
const char *object_path,
|
|
GDBusCallFlags flags,
|
|
int timeout_msec,
|
|
GCancellable *cancellable,
|
|
NMDBusConnectionCallDefaultCb callback,
|
|
gpointer user_data);
|
|
|
|
/*****************************************************************************/
|
|
|
|
#endif /* __NM_DBUS_AUX_H__ */
|