Commit 5d80a8a7 authored by Thomas Haller's avatar Thomas Haller

keyfile: rename public keyfile functions and names

parent 93c83819
......@@ -800,7 +800,7 @@ add_keyfile_plugin (NMSettings *self)
{
gs_unref_object GObject *keyfile_plugin = NULL;
keyfile_plugin = nm_settings_keyfile_plugin_new ();
keyfile_plugin = nms_keyfile_plugin_new ();
g_assert (keyfile_plugin);
if (!add_plugin (self, NM_SETTINGS_PLUGIN (keyfile_plugin)))
g_return_if_reached ();
......
......@@ -36,12 +36,12 @@
#include "nms-keyfile-writer.h"
#include "nms-keyfile-utils.h"
G_DEFINE_TYPE (NMKeyfileConnection, nm_keyfile_connection, NM_TYPE_SETTINGS_CONNECTION)
G_DEFINE_TYPE (NMSKeyfileConnection, nms_keyfile_connection, NM_TYPE_SETTINGS_CONNECTION)
NMKeyfileConnection *
nm_keyfile_connection_new (NMConnection *source,
const char *full_path,
GError **error)
NMSKeyfileConnection *
nms_keyfile_connection_new (NMConnection *source,
const char *full_path,
GError **error)
{
GObject *object;
NMConnection *tmp;
......@@ -54,7 +54,7 @@ nm_keyfile_connection_new (NMConnection *source,
if (source)
tmp = g_object_ref (source);
else {
tmp = nm_keyfile_plugin_connection_from_file (full_path, error);
tmp = nms_keyfile_reader_from_file (full_path, error);
if (!tmp)
return NULL;
......@@ -70,7 +70,7 @@ nm_keyfile_connection_new (NMConnection *source,
update_unsaved = FALSE;
}
object = (GObject *) g_object_new (NM_TYPE_KEYFILE_CONNECTION,
object = (GObject *) g_object_new (NMS_TYPE_KEYFILE_CONNECTION,
NM_SETTINGS_CONNECTION_FILENAME, full_path,
NULL);
......@@ -85,7 +85,7 @@ nm_keyfile_connection_new (NMConnection *source,
}
g_object_unref (tmp);
return (NMKeyfileConnection *) object;
return (NMSKeyfileConnection *) object;
}
static void
......@@ -97,12 +97,12 @@ commit_changes (NMSettingsConnection *connection,
char *path = NULL;
GError *error = NULL;
if (!nm_keyfile_plugin_write_connection (NM_CONNECTION (connection),
nm_settings_connection_get_filename (connection),
NM_FLAGS_ALL (commit_reason, NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION
| NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED),
&path,
&error)) {
if (!nms_keyfile_writer_connection (NM_CONNECTION (connection),
nm_settings_connection_get_filename (connection),
NM_FLAGS_ALL (commit_reason, NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION
| NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED),
&path,
&error)) {
callback (connection, error, user_data);
g_clear_error (&error);
return;
......@@ -115,27 +115,27 @@ commit_changes (NMSettingsConnection *connection,
nm_settings_connection_set_filename (connection, path);
if (old_path) {
nm_log_info (LOGD_SETTINGS, "keyfile: update "NM_KEYFILE_CONNECTION_LOG_FMT" and rename from \"%s\"",
NM_KEYFILE_CONNECTION_LOG_ARG (connection),
nm_log_info (LOGD_SETTINGS, "keyfile: update "NMS_KEYFILE_CONNECTION_LOG_FMT" and rename from \"%s\"",
NMS_KEYFILE_CONNECTION_LOG_ARG (connection),
old_path);
} else {
nm_log_info (LOGD_SETTINGS, "keyfile: update "NM_KEYFILE_CONNECTION_LOG_FMT" and persist connection",
NM_KEYFILE_CONNECTION_LOG_ARG (connection));
nm_log_info (LOGD_SETTINGS, "keyfile: update "NMS_KEYFILE_CONNECTION_LOG_FMT" and persist connection",
NMS_KEYFILE_CONNECTION_LOG_ARG (connection));
}
} else {
nm_log_info (LOGD_SETTINGS, "keyfile: update "NM_KEYFILE_CONNECTION_LOG_FMT,
NM_KEYFILE_CONNECTION_LOG_ARG (connection));
nm_log_info (LOGD_SETTINGS, "keyfile: update "NMS_KEYFILE_CONNECTION_LOG_FMT,
NMS_KEYFILE_CONNECTION_LOG_ARG (connection));
}
g_free (path);
NM_SETTINGS_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->commit_changes (connection,
commit_reason,
callback,
user_data);
NM_SETTINGS_CONNECTION_CLASS (nms_keyfile_connection_parent_class)->commit_changes (connection,
commit_reason,
callback,
user_data);
}
static void
static void
do_delete (NMSettingsConnection *connection,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data)
......@@ -146,20 +146,20 @@ do_delete (NMSettingsConnection *connection,
if (path)
g_unlink (path);
NM_SETTINGS_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->delete (connection,
callback,
user_data);
NM_SETTINGS_CONNECTION_CLASS (nms_keyfile_connection_parent_class)->delete (connection,
callback,
user_data);
}
/* GObject */
static void
nm_keyfile_connection_init (NMKeyfileConnection *connection)
nms_keyfile_connection_init (NMSKeyfileConnection *connection)
{
}
static void
nm_keyfile_connection_class_init (NMKeyfileConnectionClass *keyfile_connection_class)
nms_keyfile_connection_class_init (NMSKeyfileConnectionClass *keyfile_connection_class)
{
NMSettingsConnectionClass *settings_class = NM_SETTINGS_CONNECTION_CLASS (keyfile_connection_class);
......
......@@ -19,30 +19,30 @@
* Copyright (C) 2008 - 2012 Red Hat, Inc.
*/
#ifndef __NETWORKMANAGER_KEYFILE_CONNECTION_H__
#define __NETWORKMANAGER_KEYFILE_CONNECTION_H__
#ifndef __NMS_KEYFILE_CONNECTION_H__
#define __NMS_KEYFILE_CONNECTION_H__
#include <nm-settings-connection.h>
#define NM_TYPE_KEYFILE_CONNECTION (nm_keyfile_connection_get_type ())
#define NM_KEYFILE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnection))
#define NM_KEYFILE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionClass))
#define NM_IS_KEYFILE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_KEYFILE_CONNECTION))
#define NM_IS_KEYFILE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_KEYFILE_CONNECTION))
#define NM_KEYFILE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionClass))
#define NMS_TYPE_KEYFILE_CONNECTION (nms_keyfile_connection_get_type ())
#define NMS_KEYFILE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMS_TYPE_KEYFILE_CONNECTION, NMSKeyfileConnection))
#define NMS_KEYFILE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMS_TYPE_KEYFILE_CONNECTION, NMSKeyfileConnectionClass))
#define NMS_IS_KEYFILE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMS_TYPE_KEYFILE_CONNECTION))
#define NMS_IS_KEYFILE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMS_TYPE_KEYFILE_CONNECTION))
#define NMS_KEYFILE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMS_TYPE_KEYFILE_CONNECTION, NMSKeyfileConnectionClass))
typedef struct {
NMSettingsConnection parent;
} NMKeyfileConnection;
} NMSKeyfileConnection;
typedef struct {
NMSettingsConnectionClass parent;
} NMKeyfileConnectionClass;
} NMSKeyfileConnectionClass;
GType nm_keyfile_connection_get_type (void);
GType nms_keyfile_connection_get_type (void);
NMKeyfileConnection *nm_keyfile_connection_new (NMConnection *source,
const char *filename,
GError **error);
NMSKeyfileConnection *nms_keyfile_connection_new (NMConnection *source,
const char *filename,
GError **error);
#endif /* __NETWORKMANAGER_KEYFILE_CONNECTION_H__ */
#endif /* __NMS_KEYFILE_CONNECTION_H__ */
......@@ -19,21 +19,21 @@
* Copyright (C) 2008 - 2011 Red Hat, Inc.
*/
#ifndef __NMKF_PLUGIN_H__
#define __NMKF_PLUGIN_H__
#ifndef __NMS_KEYFILE_PLUGIN_H__
#define __NMS_KEYFILE_PLUGIN_H__
#define SETTINGS_TYPE_PLUGIN_KEYFILE (settings_plugin_keyfile_get_type ())
#define SETTINGS_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfile))
#define SETTINGS_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfileClass))
#define SETTINGS_IS_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE))
#define SETTINGS_IS_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_KEYFILE))
#define SETTINGS_PLUGIN_KEYFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfileClass))
#define NMS_TYPE_KEYFILE_PLUGIN (nms_keyfile_plugin_get_type ())
#define NMS_KEYFILE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMS_TYPE_KEYFILE_PLUGIN, NMSKeyfilePlugin))
#define NMS_KEYFILE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NMS_TYPE_KEYFILE_PLUGIN, NMSKeyfilePluginClass))
#define NMS_IS_KEYFILE_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMS_TYPE_KEYFILE_PLUGIN))
#define NMS_IS_KEYFILE_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NMS_TYPE_KEYFILE_PLUGIN))
#define NMS_KEYFILE_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NMS_TYPE_KEYFILE_PLUGIN, NMSKeyfilePluginClass))
typedef struct _SettingsPluginKeyfile SettingsPluginKeyfile;
typedef struct _SettingsPluginKeyfileClass SettingsPluginKeyfileClass;
typedef struct _NMSKeyfilePlugin NMSKeyfilePlugin;
typedef struct _NMSKeyfilePluginClass NMSKeyfilePluginClass;
GType settings_plugin_keyfile_get_type (void);
GType nms_keyfile_plugin_get_type (void);
GObject *nm_settings_keyfile_plugin_new (void);
GObject *nms_keyfile_plugin_new (void);
#endif /* __NMKF_PLUGIN_H__ */
#endif /* __NMS_KEYFILE_PLUGIN_H__ */
......@@ -87,7 +87,7 @@ _handler_read (GKeyFile *keyfile,
}
NMConnection *
nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
nms_keyfile_reader_from_file (const char *filename, GError **error)
{
GKeyFile *key_file;
struct stat statbuf;
......
......@@ -19,11 +19,11 @@
* Copyright (C) 2008 Red Hat, Inc.
*/
#ifndef _KEYFILE_PLUGIN_READER_H
#define _KEYFILE_PLUGIN_READER_H
#ifndef __NMS_KEYFILE_READER_H__
#define __NMS_KEYFILE_READER_H__
#include <nm-connection.h>
NMConnection *nm_keyfile_plugin_connection_from_file (const char *filename, GError **error);
NMConnection *nms_keyfile_reader_from_file (const char *filename, GError **error);
#endif /* _KEYFILE_PLUGIN_READER_H */
#endif /* __NMS_KEYFILE_READER_H__ */
......@@ -88,7 +88,7 @@ check_suffix (const char *base, const char *tag)
#define DER_TAG ".der"
gboolean
nm_keyfile_plugin_utils_should_ignore_file (const char *filename)
nms_keyfile_utils_should_ignore_file (const char *filename)
{
gs_free char *base = NULL;
......@@ -112,7 +112,7 @@ nm_keyfile_plugin_utils_should_ignore_file (const char *filename)
}
char *
nm_keyfile_plugin_utils_escape_filename (const char *filename)
nms_keyfile_utils_escape_filename (const char *filename)
{
GString *str;
const char *f = filename;
......@@ -151,7 +151,7 @@ nm_keyfile_plugin_utils_escape_filename (const char *filename)
/*****************************************************************************/
const char *
nm_keyfile_plugin_get_path (void)
nms_keyfile_utils_get_path (void)
{
static char *path = NULL;
......
......@@ -15,28 +15,27 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 Red Hat, Inc.
* (C) Copyright 2010-2016 Red Hat, Inc.
*/
#ifndef _UTILS_H_
#define _UTILS_H_
#ifndef __NMS_KEYFILE_UTILS_H__
#define __NMS_KEYFILE_UTILS_H__
#include "NetworkManagerUtils.h"
#define KEYFILE_PLUGIN_NAME "keyfile"
#define KEYFILE_PLUGIN_INFO "(c) 2007 - 2015 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."
#define NMS_KEYFILE_PLUGIN_NAME "keyfile"
#define NMS_KEYFILE_PLUGIN_INFO "(c) 2007 - 2016 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."
#define NM_KEYFILE_CONNECTION_LOG_PATH(path) ((path) ?: "in-memory")
#define NM_KEYFILE_CONNECTION_LOG_FMT "%s (%s,\"%s\")"
#define NM_KEYFILE_CONNECTION_LOG_ARG(con) NM_KEYFILE_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con))
#define NM_KEYFILE_CONNECTION_LOG_FMTD "%s (%s,\"%s\",%p)"
#define NM_KEYFILE_CONNECTION_LOG_ARGD(con) NM_KEYFILE_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con)), (con)
#define NMS_KEYFILE_CONNECTION_LOG_PATH(path) ((path) ?: "in-memory")
#define NMS_KEYFILE_CONNECTION_LOG_FMT "%s (%s,\"%s\")"
#define NMS_KEYFILE_CONNECTION_LOG_ARG(con) NMS_KEYFILE_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con))
#define NMS_KEYFILE_CONNECTION_LOG_FMTD "%s (%s,\"%s\",%p)"
#define NMS_KEYFILE_CONNECTION_LOG_ARGD(con) NMS_KEYFILE_CONNECTION_LOG_PATH (nm_settings_connection_get_filename ((NMSettingsConnection *) (con))), nm_connection_get_uuid ((NMConnection *) (con)), nm_connection_get_id ((NMConnection *) (con)), (con)
gboolean nm_keyfile_plugin_utils_should_ignore_file (const char *filename);
gboolean nms_keyfile_utils_should_ignore_file (const char *filename);
char *nm_keyfile_plugin_utils_escape_filename (const char *filename);
char *nms_keyfile_utils_escape_filename (const char *filename);
const char *nm_keyfile_plugin_get_path (void);
#endif /* _UTILS_H_ */
const char *nms_keyfile_utils_get_path (void);
#endif /* __NMS_KEYFILE_UTILS_H__ */
......@@ -264,7 +264,7 @@ _internal_write_connection (NMConnection *connection,
if (existing_path != NULL && !force_rename) {
path = g_strdup (existing_path);
} else {
char *filename_escaped = nm_keyfile_plugin_utils_escape_filename (id);
char *filename_escaped = nms_keyfile_utils_escape_filename (id);
path = g_build_filename (keyfile_dir, filename_escaped, NULL);
g_free (filename_escaped);
......@@ -290,7 +290,7 @@ _internal_write_connection (NMConnection *connection,
else
filename = g_strdup_printf ("%s-%s-%u", id, nm_connection_get_uuid (connection), i);
filename_escaped = nm_keyfile_plugin_utils_escape_filename (filename);
filename_escaped = nms_keyfile_utils_escape_filename (filename);
g_free (path);
path = g_strdup_printf ("%s/%s", keyfile_dir, filename_escaped);
......@@ -353,14 +353,14 @@ out:
}
gboolean
nm_keyfile_plugin_write_connection (NMConnection *connection,
const char *existing_path,
gboolean force_rename,
char **out_path,
GError **error)
nms_keyfile_writer_connection (NMConnection *connection,
const char *existing_path,
gboolean force_rename,
char **out_path,
GError **error)
{
return _internal_write_connection (connection,
nm_keyfile_plugin_get_path (),
nms_keyfile_utils_get_path (),
0, 0,
existing_path,
force_rename,
......@@ -369,12 +369,12 @@ nm_keyfile_plugin_write_connection (NMConnection *connection,
}
gboolean
nm_keyfile_plugin_write_test_connection (NMConnection *connection,
const char *keyfile_dir,
uid_t owner_uid,
pid_t owner_grp,
char **out_path,
GError **error)
nms_keyfile_writer_test_connection (NMConnection *connection,
const char *keyfile_dir,
uid_t owner_uid,
pid_t owner_grp,
char **out_path,
GError **error)
{
return _internal_write_connection (connection,
keyfile_dir,
......
......@@ -19,22 +19,22 @@
* Copyright (C) 2008 - 2011 Red Hat, Inc.
*/
#ifndef _KEYFILE_PLUGIN_WRITER_H
#define _KEYFILE_PLUGIN_WRITER_H
#ifndef __NMS_KEYFILE_WRITER_H__
#define __NMS_KEYFILE_WRITER_H__
#include <nm-connection.h>
gboolean nm_keyfile_plugin_write_connection (NMConnection *connection,
const char *existing_path,
gboolean force_rename,
gboolean nms_keyfile_writer_connection (NMConnection *connection,
const char *existing_path,
gboolean force_rename,
char **out_path,
GError **error);
gboolean nms_keyfile_writer_test_connection (NMConnection *connection,
const char *keyfile_dir,
uid_t owner_uid,
pid_t owner_grp,
char **out_path,
GError **error);
gboolean nm_keyfile_plugin_write_test_connection (NMConnection *connection,
const char *keyfile_dir,
uid_t owner_uid,
pid_t owner_grp,
char **out_path,
GError **error);
#endif /* _KEYFILE_PLUGIN_WRITER_H */
#endif /* __NMS_KEYFILE_WRITER_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment