diff options
author | Benoît Dejean <bdejean@src.gnome.org> | 2005-10-30 18:46:27 +0000 |
---|---|---|
committer | Benoît Dejean <bdejean@src.gnome.org> | 2005-10-30 18:46:27 +0000 |
commit | 95b2dfa32656496d956dafe3a131c80315d2acbe (patch) | |
tree | 7bce2113a846312950024c52351dd4438f75f71c | |
parent | ac3ad6d2aabb2ee5ebc541e43bfb9f25c96383e7 (diff) | |
download | libgtop-95b2dfa32656496d956dafe3a131c80315d2acbe.tar.gz |
Dropped many dead files. Bumped release number. I guess this closes
* configure.in:
* include/glibtop/glibtop-backend-info.h:
* include/glibtop/glibtop-backend.h:
* include/glibtop/glibtop-client.h:
* lib/glibtop-backend-info.c:
* lib/glibtop-backend.c:
* lib/glibtop-client-private.h:
* lib/glibtop-client.c:
* lib/test-backends.c:
* sysdeps/common/backend.c:
* sysdeps/common/libgtop-common.backend:
Dropped many dead files.
Bumped release number.
I guess this closes #320250.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | include/glibtop/glibtop-backend-info.h | 102 | ||||
-rw-r--r-- | include/glibtop/glibtop-backend.h | 85 | ||||
-rw-r--r-- | include/glibtop/glibtop-client.h | 97 | ||||
-rw-r--r-- | lib/glibtop-backend-info.c | 280 | ||||
-rw-r--r-- | lib/glibtop-backend.c | 271 | ||||
-rw-r--r-- | lib/glibtop-client-private.h | 34 | ||||
-rw-r--r-- | lib/glibtop-client.c | 257 | ||||
-rw-r--r-- | lib/test-backends.c | 74 | ||||
-rw-r--r-- | sysdeps/common/backend.c | 80 | ||||
-rw-r--r-- | sysdeps/common/libgtop-common.backend | 13 |
12 files changed, 19 insertions, 1294 deletions
@@ -1,3 +1,21 @@ +2005-10-30 Benoît Dejean <benoit@placenet.org> + + * configure.in: + * include/glibtop/glibtop-backend-info.h: + * include/glibtop/glibtop-backend.h: + * include/glibtop/glibtop-client.h: + * lib/glibtop-backend-info.c: + * lib/glibtop-backend.c: + * lib/glibtop-client-private.h: + * lib/glibtop-client.c: + * lib/test-backends.c: + * sysdeps/common/backend.c: + * sysdeps/common/libgtop-common.backend: + + Dropped many dead files. + Bumped release number. + I guess this closes #320250. + 2005-10-28 Erdal Ronahi <erdal.ronahi@gmail.com> * configure.in: Added ku (Kurdish) to ALL_LINGUAS diff --git a/configure.in b/configure.in index 97725532..9c0b88ad 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ AC_CANONICAL_SYSTEM LIBGTOP_MAJOR_VERSION=2 LIBGTOP_MINOR_VERSION=12 -LIBGTOP_MICRO_VERSION=0 +LIBGTOP_MICRO_VERSION=1 LIBGTOP_VERSION=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION.$LIBGTOP_MICRO_VERSION AM_INIT_AUTOMAKE(libgtop, $LIBGTOP_VERSION) diff --git a/include/glibtop/glibtop-backend-info.h b/include/glibtop/glibtop-backend-info.h deleted file mode 100644 index 786545ab..00000000 --- a/include/glibtop/glibtop-backend-info.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_BACKEND_INFO_H__ -#define __GLIBTOP_BACKEND_INFO_H__ - -#include <glibtop.h> -#include <glibtop/global.h> - -#include <glibtop/glibtop-server.h> - -G_BEGIN_DECLS - -typedef struct _glibtop_backend_info glibtop_backend_info; -typedef struct _glibtop_backend_entry glibtop_backend_entry; -typedef struct _glibtop_backend_module glibtop_backend_module; - -typedef struct _glibtop_call_vector glibtop_call_vector; - -typedef int (*glibtop_backend_open_func_t) (glibtop_server *, glibtop_backend *, - guint64, const char **); -typedef int (*glibtop_backend_close_func_t) (glibtop_server *, glibtop_backend *, - glibtop_closure *); - -struct _glibtop_backend_info -{ - const char *name; - glibtop_backend_open_func_t open; - glibtop_backend_close_func_t close; - glibtop_call_vector *call_vector; -}; - -#ifdef _IN_LIBGTOP - -#include <gmodule.h> - -/* private structure */ -struct _glibtop_backend_module -{ - int refcount; - GModule *module; - GSList *extra_modules; -}; - -struct _glibtop_backend_entry -{ - char *name; - char *libtool_name; - char *shlib_name; - - GSList *extra_libs; - - /* This is const since you must not attempt to - * write into gmodule loaded memory. */ - const glibtop_backend_info *info; - - /* private pointer */ - glibtop_backend_module *_priv; -}; - -#endif /* _IN_LIBGTOP */ - -long -glibtop_register_backend (glibtop_backend_entry *entry); - -void -glibtop_unregister_backend (long id); - -glibtop_backend_entry * -glibtop_backend_by_id (long id); - -glibtop_backend_entry * -glibtop_backend_by_name (const char *backend_name); - -void -glibtop_init_backends (void); - -G_END_DECLS - -#endif diff --git a/include/glibtop/glibtop-backend.h b/include/glibtop/glibtop-backend.h deleted file mode 100644 index 63c58cd0..00000000 --- a/include/glibtop/glibtop-backend.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 2.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_BACKEND_H__ -#define __GLIBTOP_BACKEND_H__ - -#include <glibtop.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define GLIBTOP_TYPE_BACKEND (glibtop_backend_get_type ()) -#define GLIBTOP_BACKEND(backend) (G_TYPE_CHECK_INSTANCE_CAST ((backend), GLIBTOP_TYPE_BACKEND, glibtop_backend)) -#define GLIBTOP_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIBTOP_TYPE_BACKEND, glibtop_backend_class)) -#define GLIBTOP_IS_BACKEND(backend) (G_TYPE_CHECK_INSTANCE_TYPE ((backend), GLIBTOP_TYPE_BACKEND)) -#define GLIBTOP_IS_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIBTOP_TYPE_BACKEND)) -#define GLIBTOP_BACKEND_GET_CLASS(backend)(G_TYPE_INSTANCE_GET_CLASS ((backend), GLIBTOP_TYPE_BACKEND, glibtop_backend_class)) - -#define GLIBTOP_BACKEND_TYPE(backend) (G_TYPE_FROM_INSTANCE (backend)) -#define GLIBTOP_BACKEND_TYPE_NAME(backend)(g_type_name (GLIBTOP_BACKEND_TYPE (backend))) - -/* --- typedefs & structures --- */ -typedef struct _glibtop_backend glibtop_backend; -typedef struct _glibtop_backend_class glibtop_backend_class; -typedef struct _glibtop_backend_private glibtop_backend_private; - -#include <glibtop/glibtop-backend-info.h> - -struct _glibtop_backend -{ - GObject object; - - /* <private> */ - glibtop_backend_private *_priv; -}; - -struct _glibtop_backend_class -{ - GObjectClass parent_class;; -}; - -GType -glibtop_backend_get_type (void); - -glibtop_backend * -glibtop_backend_get (const char *backend_name, guint64 features, - const char **backend_args, GError **error); - -void -glibtop_backend_set_closure_data (glibtop_backend *backend, glibtop_closure *closure); - -glibtop_closure * -glibtop_backend_get_closure_data (glibtop_backend *backend); - -glibtop_call_vector * -glibtop_backend_get_call_vector (glibtop_backend *backend); - -glibtop_server * -glibtop_backend_get_server (glibtop_backend *backend); - -G_END_DECLS - -#endif diff --git a/include/glibtop/glibtop-client.h b/include/glibtop/glibtop-client.h deleted file mode 100644 index e389653e..00000000 --- a/include/glibtop/glibtop-client.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 2.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_CLIENT_H__ -#define __GLIBTOP_CLIENT_H__ - -#include <glibtop.h> - -#include <glib-object.h> - -#include <glibtop/glibtop-backend.h> - -G_BEGIN_DECLS - -#define GLIBTOP_TYPE_CLIENT (glibtop_client_get_type ()) -#define GLIBTOP_CLIENT(client) (G_TYPE_CHECK_INSTANCE_CAST ((client), GLIBTOP_TYPE_CLIENT, glibtop_client)) -#define GLIBTOP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLIBTOP_TYPE_CLIENT, glibtop_client_class)) -#define GLIBTOP_IS_CLIENT(client) (G_TYPE_CHECK_INSTANCE_TYPE ((client), GLIBTOP_TYPE_CLIENT)) -#define GLIBTOP_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIBTOP_TYPE_CLIENT)) -#define GLIBTOP_CLIENT_GET_CLASS(client)(G_TYPE_INSTANCE_GET_CLASS ((client), GLIBTOP_TYPE_CLIENT, glibtop_client_class)) - -#define GLIBTOP_CLIENT_TYPE(client) (G_TYPE_FROM_INSTANCE (client)) -#define GLIBTOP_CLIENT_TYPE_NAME(client)(g_type_name (GLIBTOP_CLIENT_TYPE (client))) - -/* --- typedefs & structures --- */ -typedef struct _glibtop_client glibtop_client; -typedef struct _glibtop_client_class glibtop_client_class; -typedef struct _glibtop_client_private glibtop_client_private; - -struct _glibtop_client -{ - GObject object; - - /* <public> */ - GError *error; - - /* <private> */ - glibtop_client_private *_priv; -}; - -struct _glibtop_client_class -{ - GObjectClass parent_class;; - - void (*error) (glibtop_client *client, GError *error); - void (*warning) (glibtop_client *client, GError *error); -}; - -GType -glibtop_client_get_type (void); - -glibtop_client * -glibtop_client_new (void); - -void -glibtop_client_propagate_error (glibtop_client *client, GError *error); - -void -glibtop_client_propagate_warning (glibtop_client *client, GError *error); - -void -glibtop_client_open_backend (glibtop_client *client, const char *backend_name, - guint64 features, const char **backend_args); - -void -glibtop_client_add_backend (glibtop_client *client, - glibtop_backend *backend); - -void -glibtop_client_remove_backend (glibtop_client *client, - glibtop_backend *backend); - -G_END_DECLS - -#endif diff --git a/lib/glibtop-backend-info.c b/lib/glibtop-backend-info.c deleted file mode 100644 index cedb5cf9..00000000 --- a/lib/glibtop-backend-info.c +++ /dev/null @@ -1,280 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/global.h> - -#include <glibtop/glibtop-backend.h> -#include <glibtop/glibtop-backend-info.h> - -static GHashTable *_glibtop_backend_list = NULL; -static long _glibtop_backend_nr = 0; - -#define LIBGTOP_XML_NAMESPACE "http://www.home-of-linux.org/libgtop/1.1" - -#include <libxml/parser.h> - -#include <dirent.h> - -static void _glibtop_init_gmodule_backends (const char *); - -void -glibtop_init_backends (void) -{ - static int backends_initialized = 0; - - if (backends_initialized) - return; - backends_initialized = 1; - - LIBXML_TEST_VERSION; - - _glibtop_init_gmodule_backends (LIBGTOP_BACKEND_DIR); -} - -static gchar * -_get_library_filename (xmlDocPtr doc, xmlNodePtr cur, const char *directory) -{ - char *filename = xmlNodeListGetString (doc, cur->xmlChildrenNode, 1); - gchar *retval; - - if (!filename) - return NULL; - - /* already absolute */ - if (filename [0] == '/') - retval = g_strdup (filename); - else - retval = g_strdup_printf ("%s/%s", directory, filename); - - return retval; -} - -static GSList * -_parse_extra_libs (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, const char *dir) -{ - GSList *list = NULL; - - /* We don't care what the top level element name is */ - cur = cur->xmlChildrenNode; - while (cur != NULL) { - if ((!strcmp (cur->name, "ExtraLib")) && (cur->ns == ns)) { - xmlNodePtr sub = cur->xmlChildrenNode; - - while (sub != NULL) { - if ((!strcmp (sub->name, "ShlibName")) && (sub->ns == ns)) - list = g_slist_append - (list, _get_library_filename (doc, sub, dir)); - - sub = sub->next; - } - } - - cur = cur->next; - } - - return list; -} - -static glibtop_backend_entry * -_parseBackend (xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur, const char *dir) -{ - glibtop_backend_entry *ret = NULL; - - /* - * allocate the struct - */ - ret = g_new0 (glibtop_backend_entry, 1); - - /* We don't care what the top level element name is */ - cur = cur->xmlChildrenNode; - while (cur != NULL) { - if ((!strcmp (cur->name, "Name")) && (cur->ns == ns)) - ret->name = xmlNodeListGetString - (doc, cur->xmlChildrenNode, 1); - - if ((!strcmp (cur->name, "Location")) && (cur->ns == ns)) { - xmlNodePtr sub = cur->xmlChildrenNode; - - while (sub != NULL) { - if ((!strcmp (sub->name, "LibtoolName")) && (sub->ns == ns)) - ret->libtool_name = _get_library_filename (doc, sub, dir); - if ((!strcmp (sub->name, "ShlibName")) && (sub->ns == ns)) - ret->shlib_name = _get_library_filename (doc, sub, dir); - - if ((!strcmp (sub->name, "ExtraLibs")) && (sub->ns == ns)) - ret->extra_libs = _parse_extra_libs (doc, ns, sub, dir); - - sub = sub->next; - } - } - - cur = cur->next; - } - - return ret; -} - -static void -_glibtop_init_gmodule_backends (const char *directory) -{ - DIR *dir; - struct dirent *entry; - - dir = opendir (directory); - if (!dir) return; - - while ((entry = readdir (dir)) != NULL) { - size_t len = strlen (entry->d_name); - gchar *filename; - xmlDocPtr doc; - xmlNsPtr ns; - xmlNodePtr cur; - - if (len < 8) - continue; - - if (strcmp (entry->d_name+len-8, ".backend")) - continue; - - filename = g_strdup_printf ("%s/%s", directory, entry->d_name); - - doc = xmlParseFile (filename); - - if (!doc) { - g_warning ("Cannot parse %s", filename); - g_free (filename); - continue; - } - - /* Make sure the document is of the right kind */ - - cur = xmlDocGetRootElement (doc); - if (!cur) { - xmlFreeDoc (doc); - g_free (filename); - continue; - } - - ns = xmlSearchNsByHref (doc, cur, LIBGTOP_XML_NAMESPACE); - if (!ns) { - g_warning ("File %s of wrong type; LibGTop Namespace not found", - filename); - g_free (filename); - xmlFreeDoc (doc); - continue; - } - - if (strcmp (cur->name, "Backends")) { - g_warning ("File %s of the wrong type, root node != 'Backends'", - filename); - g_free (filename); - xmlFreeDoc (doc); - continue; - } - - cur = cur->xmlChildrenNode; - while (cur != NULL) { - glibtop_backend_entry *backend; - - if ((!strcmp(cur->name, "Backend")) && (cur->ns == ns)) { - backend = _parseBackend (doc, ns, cur, directory); - if (!backend) { - g_warning ("File %s of wrong type; cannot parse", - filename); - continue; - } - - glibtop_register_backend (backend); - } - cur = cur->next; - } - - g_free (filename); - xmlFreeDoc (doc); - } - - closedir (dir); -} - -long -glibtop_register_backend (glibtop_backend_entry *entry) -{ - long id; - - if (!_glibtop_backend_list) - _glibtop_backend_list = g_hash_table_new (NULL, NULL); - - id = ++_glibtop_backend_nr; - - g_hash_table_insert (_glibtop_backend_list, - GINT_TO_POINTER (id), - entry); - - return id; -} - -void -glibtop_unregister_backend (long id) -{ - g_hash_table_remove (_glibtop_backend_list, - GINT_TO_POINTER (id)); -} - -glibtop_backend_entry * -glibtop_backend_by_id (long id) -{ - return g_hash_table_lookup (_glibtop_backend_list, - GINT_TO_POINTER (id)); -} - -typedef struct { - const char *backend_name; - glibtop_backend_entry *entry; -} _find_by_name_param_t; - -static void -find_by_name (gpointer key, gpointer value, gpointer user_data) -{ - _find_by_name_param_t *param = (_find_by_name_param_t *) user_data; - glibtop_backend_entry *entry = (glibtop_backend_entry *) value; - - if (!entry || !entry->name || param->entry) - return; - - if (!strcmp (entry->name, param->backend_name)) - param->entry = entry; -} - -glibtop_backend_entry * -glibtop_backend_by_name (const char *backend_name) -{ - _find_by_name_param_t param = { backend_name, NULL }; - - g_hash_table_foreach (_glibtop_backend_list, - find_by_name, ¶m); - - return param.entry; -} diff --git a/lib/glibtop-backend.c b/lib/glibtop-backend.c deleted file mode 100644 index 4db68809..00000000 --- a/lib/glibtop-backend.c +++ /dev/null @@ -1,271 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 2.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> - -#include <glib-object.h> - -#include <glibtop/glibtop-backend.h> -#include <glibtop/glibtop-backend-info.h> - -static void glibtop_backend_class_init (glibtop_backend_class *klass); -static void glibtop_backend_init (glibtop_backend *backend); -static void glibtop_backend_finalize (GObject *object); - -static gpointer parent_class = NULL; - - -/* Internal data */ - -struct _glibtop_backend_private -{ - const glibtop_backend_info *info; - - glibtop_closure *closure_data; - - glibtop_server *server; - glibtop_backend_module *module; -}; - -GType -glibtop_backend_get_type (void) -{ - static GType glibtop_backend_type = 0; - - if (!glibtop_backend_type) { - static const GTypeInfo glibtop_backend_info = { - sizeof (glibtop_backend_class), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) glibtop_backend_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glibtop_backend), - 16, /* n_preallocs */ - (GInstanceInitFunc) glibtop_backend_init, - }; - - glibtop_backend_type = g_type_register_static - (G_TYPE_OBJECT, "glibtop_backend", &glibtop_backend_info, 0); - } - - return glibtop_backend_type; -} - -static void -glibtop_backend_class_init (glibtop_backend_class *class) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) class; - - parent_class = g_type_class_ref (G_TYPE_OBJECT); - - gobject_class->finalize = glibtop_backend_finalize; -} - -static void -glibtop_backend_init (glibtop_backend *backend) -{ - glibtop_backend_private *priv; - - priv = g_new0 (glibtop_backend_private, 1); - backend->_priv = priv; -} - -static void -glibtop_backend_finalize (GObject *object) -{ - glibtop_backend *glibtop; - glibtop_backend_private *priv = NULL; - - glibtop = GLIBTOP_BACKEND (object); - priv = glibtop->_priv; - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -unload_module (gpointer data, gpointer user_data) -{ - g_module_close (data); -} - -static int -load_extra_libs (glibtop_backend_entry *entry, GError **error) -{ - GSList *list; - GSList *loaded_here = NULL; - - for (list = entry->extra_libs; list; list = list->next) { - const gchar *filename = list->data; - GModule *module; - - module = g_module_open (filename, G_MODULE_BIND_LAZY); - if (!module) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "Cannot open extra shared library `%s' " - "for backend `%s' (%s)", filename, entry->name, - g_module_error ()); - g_slist_foreach (loaded_here, unload_module, NULL); - return -GLIBTOP_ERROR_NO_SUCH_BACKEND; - } - - loaded_here = g_slist_prepend (loaded_here, module); - } - - entry->_priv->extra_modules = g_slist_concat - (loaded_here, entry->_priv->extra_modules); - - return 0; -} - -glibtop_backend * -glibtop_backend_get (const char *backend_name, guint64 features, - const char **backend_args, GError **error) -{ - const glibtop_backend_info *info; - glibtop_backend_entry *entry; - glibtop_backend *backend; - - glibtop_init_backends (); - - entry = glibtop_backend_by_name (backend_name); - if (!entry) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "No backend with this name"); - return NULL; - } - - if (!entry->_priv) { - entry->_priv = g_new0 (glibtop_backend_module, 1); - - if (entry->extra_libs) { - int retval; - - retval = load_extra_libs (entry, error); - if (retval < 0) - return NULL; - } - - entry->_priv->module = g_module_open (entry->shlib_name, - G_MODULE_BIND_LAZY); - if (!entry->_priv->module) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "Cannot open shared library `%s' " - "for backend `%s' (%s)", entry->shlib_name, - entry->name, g_module_error ()); - return NULL; - } - - if (!g_module_symbol (entry->_priv->module, - "LibGTopBackendInfo", - (gpointer*) &entry->info)) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "Library `%s' is not a valid " - "LibGTop Backend library (start symbol not found)", - entry->shlib_name); - - g_module_close (entry->_priv->module); - g_free (entry->_priv); - entry->_priv = NULL; - - return NULL; - } - } - - info = entry->info; - if (!info) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "Can't get backend info"); - return NULL; - } - - backend = g_object_new (GLIBTOP_TYPE_BACKEND, NULL); - - backend->_priv->module = entry->_priv; - backend->_priv->info = info; - - backend->_priv->server = glibtop_server_new (); - - if (info->open) { - int retval; - - retval = info->open (backend->_priv->server, backend, features, - backend_args); - if (retval) { - g_set_error (error, GLIBTOP_ERROR, GLIBTOP_ERROR_NO_SUCH_BACKEND, - "Backend open function return error condition"); - - g_object_unref (G_OBJECT (backend)); - return NULL; - } - } - - entry->_priv->refcount++; - - return backend; -} - -glibtop_call_vector * -glibtop_backend_get_call_vector (glibtop_backend *backend) -{ - g_return_val_if_fail (GLIBTOP_IS_BACKEND (backend), NULL); - - g_assert (backend->_priv->info != NULL); - - return backend->_priv->info->call_vector; -} - -glibtop_server * -glibtop_backend_get_server (glibtop_backend *backend) -{ - g_return_val_if_fail (GLIBTOP_IS_BACKEND (backend), NULL); - - glibtop_server_ref (backend->_priv->server); - - return backend->_priv->server; -} - -glibtop_closure * -glibtop_backend_get_closure_data (glibtop_backend *backend) -{ - g_return_val_if_fail (GLIBTOP_IS_BACKEND (backend), NULL); - - return backend->_priv->closure_data; -} - -void -glibtop_backend_set_closure_data (glibtop_backend *backend, - glibtop_closure *closure) -{ - g_return_if_fail (GLIBTOP_IS_BACKEND (backend)); - g_return_if_fail (backend->_priv->closure_data == NULL); - - backend->_priv->closure_data = closure; -} diff --git a/lib/glibtop-client-private.h b/lib/glibtop-client-private.h deleted file mode 100644 index 244cabdf..00000000 --- a/lib/glibtop-client-private.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 2.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#ifndef __GLIBTOP_CLIENT_PRIVATE_H__ -#define __GLIBTOP_CLIENT_PRIVATE_H__ - -struct _glibtop_client_private -{ - GSList *backend_list; -}; - -#endif diff --git a/lib/glibtop-client.c b/lib/glibtop-client.c deleted file mode 100644 index a8f50f68..00000000 --- a/lib/glibtop-client.c +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 2.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> - -#include <glib-object.h> - -static void glibtop_client_class_init (glibtop_client_class *klass); -static void glibtop_client_init (glibtop_client *client); -static void glibtop_client_finalize (GObject *object); - -static gpointer parent_class = NULL; - -#include <glibtop-client-private.h> - -enum { - GLIBTOP_CLIENT_SIGNAL_ERROR, - GLIBTOP_CLIENT_SIGNAL_WARNING, - LAST_SIGNAL -}; - -static guint glibtop_client_signals [LAST_SIGNAL] = { 0 }; - -GType -glibtop_client_get_type (void) -{ - static GType glibtop_client_type = 0; - - if (!glibtop_client_type) { - static const GTypeInfo glibtop_client_info = { - sizeof (glibtop_client_class), - NULL, /* base_class_init */ - NULL, /* base_class_finalize */ - (GClassInitFunc) glibtop_client_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glibtop_client), - 16, /* n_preallocs */ - (GInstanceInitFunc) glibtop_client_init, - }; - - glibtop_client_type = g_type_register_static - (G_TYPE_OBJECT, "glibtop_client", &glibtop_client_info, 0); - } - - return glibtop_client_type; -} - -static void -glibtop_client_error_handler (glibtop_client *client, GError *error) -{ - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - - if (error == NULL) - return; - - g_error ("%s (%d): %s", g_quark_to_string (error->domain), - error->code, error->message); -} - -static void -glibtop_client_warning_handler (glibtop_client *client, GError *error) -{ - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - - if (error == NULL) - return; - - g_warning ("%s (%d): %s", g_quark_to_string (error->domain), - error->code, error->message); - -} - -static void -glibtop_client_class_init (glibtop_client_class *klass) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR] = - g_signal_new ("error", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (glibtop_client_class, error), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER, NULL); - - glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_WARNING] = - g_signal_new ("warning", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (glibtop_client_class, warning), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER, NULL); - - klass->error = glibtop_client_error_handler; - klass->warning = glibtop_client_warning_handler; - - gobject_class->finalize = glibtop_client_finalize; -} - -static void -glibtop_client_init (glibtop_client *glibtop) -{ - glibtop_client_private *priv; - - priv = g_new0 (glibtop_client_private, 1); - glibtop->_priv = priv; -} - -static void -glibtop_client_finalize (GObject *object) -{ - glibtop_client *glibtop; - glibtop_client_private *priv = NULL; - GSList *c; - - glibtop = GLIBTOP_CLIENT (object); - priv = glibtop->_priv; - - for (c = priv->backend_list; c; c = c->next) - g_object_unref (G_OBJECT (c->data)); - g_slist_free (priv->backend_list); - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -glibtop_client * -glibtop_client_new (void) -{ - return g_object_new (GLIBTOP_TYPE_CLIENT, NULL); -} - -void -glibtop_client_propagate_error (glibtop_client *client, GError *error) -{ - GValue params [2] = { { 0, }, { 0, } }; - - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - - if (error == NULL) - return; - - g_value_init (params, GLIBTOP_CLIENT_TYPE (client)); - g_value_set_object (params, G_OBJECT (client)); - - g_value_init (params + 1, G_TYPE_POINTER); - g_value_set_pointer (params + 1, error); - - g_signal_emitv (params, - glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_ERROR], - 0, NULL); - - g_value_unset (params + 1); - g_value_unset (params + 0); -} - -void -glibtop_client_propagate_warning (glibtop_client *client, GError *error) -{ - GValue params [2] = { { 0, }, { 0, } }; - - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - - if (error == NULL) - return; - - g_value_init (params, GLIBTOP_CLIENT_TYPE (client)); - g_value_set_object (params, G_OBJECT (client)); - - g_value_init (params + 1, G_TYPE_POINTER); - g_value_set_pointer (params + 1, error); - - g_signal_emitv (params, - glibtop_client_signals [GLIBTOP_CLIENT_SIGNAL_WARNING], - 0, NULL); - - g_value_unset (params + 1); - g_value_unset (params + 0); -} - -void -glibtop_client_open_backend (glibtop_client *client, const char *backend_name, - guint64 features, const char **backend_args) -{ - glibtop_backend *backend; - GError *error = NULL; - - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - - backend = glibtop_backend_get (backend_name, features, backend_args, - &error); - if (!backend) { - glibtop_client_propagate_error (client, error); - g_error_free (error); - return; - } - - glibtop_client_add_backend (client, backend); -} - -void -glibtop_client_add_backend (glibtop_client *client, - glibtop_backend *backend) -{ - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - g_return_if_fail (GLIBTOP_IS_BACKEND (backend)); - - client->_priv->backend_list = g_slist_append - (client->_priv->backend_list, backend); -} - -void -glibtop_client_remove_backend (glibtop_client *client, - glibtop_backend *backend) -{ - GSList *c; - - g_return_if_fail (GLIBTOP_IS_CLIENT (client)); - g_return_if_fail (GLIBTOP_IS_BACKEND (backend)); - - c = g_slist_find (client->_priv->backend_list, backend); - if (!c) return; - - g_slist_remove_link (client->_priv->backend_list, c); - g_object_unref (G_OBJECT (backend)); -} diff --git a/lib/test-backends.c b/lib/test-backends.c deleted file mode 100644 index 7c152dca..00000000 --- a/lib/test-backends.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> - -#include <glibtop/cpu.h> - -int -main (int argc, char *argv []) -{ - glibtop_client *client; - glibtop_backend *backend_common; - glibtop_backend *backend_sysdeps; - GError *error = NULL; - glibtop_cpu cpu; - - g_type_init (); - - client = glibtop_client_new (); - - backend_common = glibtop_backend_get ("glibtop-backend-common", - 0, NULL, &error); - - if (error != NULL) { - glibtop_client_propagate_warning (client, error); - g_error_free (error); - error = NULL; - } - - g_message (G_STRLOC ": backend = %p", backend_common); - - if (backend_common != NULL) - glibtop_client_add_backend (client, backend_common); - - backend_sysdeps = glibtop_backend_get ("glibtop-backend-sysdeps-stub", - 0, NULL, &error); - - if (error != NULL) { - glibtop_client_propagate_warning (client, error); - g_error_free (error); - error = NULL; - } - - g_message (G_STRLOC ": backend = %p", backend_sysdeps); - - if (backend_sysdeps != NULL) - glibtop_client_add_backend (client, backend_sysdeps); - - glibtop_get_cpu_l (client, &cpu); - - exit (0); -} diff --git a/sysdeps/common/backend.c b/sysdeps/common/backend.c deleted file mode 100644 index d1f744b5..00000000 --- a/sysdeps/common/backend.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* $Id$ */ - -/* Copyright (C) 1998-99 Martin Baulig - This file is part of LibGTop 1.0. - - Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998. - - LibGTop is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - LibGTop 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 General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with LibGTop; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. -*/ - -#include <glibtop.h> -#include <glibtop/fsusage.h> -#include <glibtop/mountlist.h> - -#include <glibtop/glibtop-server.h> -#include <glibtop/glibtop-backend.h> -#include <glibtop/call-vector.h> - -static int -_open_common (glibtop_server *server, glibtop_backend *backend, - guint64 features, const char **backend_args) -{ - return 0; -} - -static int -_close_common (glibtop_server *server, glibtop_backend *backend, - glibtop_closure *closure) -{ - return 0; -} - -static glibtop_call_vector _glibtop_call_vector = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - glibtop_get_mountlist_s, - glibtop_get_fsusage_s, - NULL, - NULL, - NULL, - NULL -}; - -glibtop_backend_info LibGTopBackendInfo = { - "glibtop-backend-common", _open_common, _close_common, - &_glibtop_call_vector -}; - diff --git a/sysdeps/common/libgtop-common.backend b/sysdeps/common/libgtop-common.backend deleted file mode 100644 index b4910d34..00000000 --- a/sysdeps/common/libgtop-common.backend +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?> <!-- -*-xml-*- --> -<!DOCTYPE libgtop:backends SYSTEM 'libgtop-backends.dtd'> -<libgtop:Backends xmlns:libgtop="http://www.home-of-linux.org/libgtop/1.1"> - - <libgtop:Backend> - <libgtop:Name>glibtop-backend-common</libgtop:Name> - <libgtop:Location> - <libgtop:LibtoolName>libgtop_backend_common.la</libgtop:LibtoolName> - <libgtop:ShlibName>libgtop_backend_common.so</libgtop:ShlibName> - </libgtop:Location> - </libgtop:Backend> - -</libgtop:Backends> |