summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2016-01-06 09:05:27 +0100
committerOndrej Holy <oholy@redhat.com>2016-01-06 09:05:27 +0100
commit519877da5c638c41d3491ac2cbbfe6a0a2578263 (patch)
tree74d36d408cc456a4f9b4f1cf8a58b94519fbd27a
parent9e6418c5ffb3b17d2a5535b77303959591ffcf31 (diff)
downloadgvfs-wip/oholy/debug.tar.gz
gphoto2: Be quiet by defaultwip/oholy/debug
Since daemons' stdout and stderr goes into the journal, make it quiet by default by using the existing debug logging mechanism. https://bugzilla.gnome.org/show_bug.cgi?id=740660
-rw-r--r--daemon/gvfsbackendgphoto2.c244
1 files changed, 113 insertions, 131 deletions
diff --git a/daemon/gvfsbackendgphoto2.c b/daemon/gvfsbackendgphoto2.c
index 8e6747e6..07c42580 100644
--- a/daemon/gvfsbackendgphoto2.c
+++ b/daemon/gvfsbackendgphoto2.c
@@ -64,11 +64,6 @@
#include "gvfsjobseekwrite.h"
#include "gvfsicon.h"
-/* showing debug traces */
-#if 1
-#define DEBUG_SHOW_TRACES 1
-#endif
-
/* use this to disable caching */
#if 0
#define DEBUG_NO_CACHING 1
@@ -300,19 +295,6 @@ typedef struct {
/* ------------------------------------------------------------------------------------------------- */
-static void
-DEBUG (const gchar *message, ...)
-{
-#ifdef DEBUG_SHOW_TRACES
- va_list args;
- va_start (args, message);
- g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message, args);
- va_end (args);
-#endif
-}
-
-/* ------------------------------------------------------------------------------------------------- */
-
static int commit_write_handle (GVfsBackendGphoto2 *gphoto2_backend, WriteHandle *write_handle);
static void
@@ -339,7 +321,7 @@ ensure_not_dirty (GVfsBackendGphoto2 *gphoto2_backend)
{
WriteHandle *write_handle = l->data;
- DEBUG ("ensure_not_dirty: looking at handle for '%s'\n", write_handle->filename);
+ g_debug ("ensure_not_dirty: looking at handle for '%s'\n", write_handle->filename);
if (write_handle->is_dirty)
commit_write_handle (gphoto2_backend, write_handle);
@@ -372,7 +354,7 @@ monitors_emit_internal (GVfsBackendGphoto2 *gphoto2_backend,
g_return_if_fail (g_str_has_prefix (dir, gphoto2_backend->ignore_prefix));
- DEBUG ("monitors_emit_internal() %s for '%s' '%s'\n", event_name, dir, name);
+ g_debug ("monitors_emit_internal() %s for '%s' '%s'\n", event_name, dir, name);
for (l = gphoto2_backend->dir_monitor_proxies; l != NULL; l = l->next)
{
@@ -382,7 +364,7 @@ monitors_emit_internal (GVfsBackendGphoto2 *gphoto2_backend,
char *path;
path = g_build_filename (dir + strlen (gphoto2_backend->ignore_prefix), name, NULL);
g_vfs_monitor_emit_event (proxy->vfs_monitor, event, path, NULL);
- DEBUG (" emitted %s for '%s' on dir monitor for '%s'\n", event_name, path, dir);
+ g_debug (" emitted %s for '%s' on dir monitor for '%s'\n", event_name, path, dir);
g_free (path);
}
}
@@ -395,7 +377,7 @@ monitors_emit_internal (GVfsBackendGphoto2 *gphoto2_backend,
{
const char *path = filepath + strlen (gphoto2_backend->ignore_prefix);
g_vfs_monitor_emit_event (proxy->vfs_monitor, event, path, NULL);
- DEBUG (" emitted %s for '%s' on file monitor\n", event_name, path);
+ g_debug (" emitted %s for '%s' on file monitor\n", event_name, path);
}
}
g_free (filepath);
@@ -407,7 +389,7 @@ monitors_emit_internal (GVfsBackendGphoto2 *gphoto2_backend,
static void
monitors_emit_created (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, const char *name)
{
- DEBUG ("monitors_emit_created(): '%s' '%s'\n", dir, name);
+ g_debug ("monitors_emit_created(): '%s' '%s'\n", dir, name);
monitors_emit_internal (gphoto2_backend, dir, name, G_FILE_MONITOR_EVENT_CREATED, "CREATED");
}
@@ -417,7 +399,7 @@ monitors_emit_created (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, con
static void
monitors_emit_deleted (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, const char *name)
{
- DEBUG ("monitors_emit_deleted(): '%s' '%s'\n", dir, name);
+ g_debug ("monitors_emit_deleted(): '%s' '%s'\n", dir, name);
monitors_emit_internal (gphoto2_backend, dir, name, G_FILE_MONITOR_EVENT_DELETED, "DELETED");
}
@@ -427,7 +409,7 @@ monitors_emit_deleted (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, con
static void
monitors_emit_changed (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, const char *name)
{
- DEBUG ("monitors_emit_changed(): '%s' '%s'\n", dir, name);
+ g_debug ("monitors_emit_changed(): '%s' '%s'\n", dir, name);
monitors_emit_internal (gphoto2_backend, dir, name, G_FILE_MONITOR_EVENT_CHANGED, "CHANGED");
}
@@ -436,7 +418,7 @@ monitors_emit_changed (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, con
static void
caches_invalidate_all (GVfsBackendGphoto2 *gphoto2_backend)
{
- DEBUG ("caches_invalidate_all()\n");
+ g_debug ("caches_invalidate_all()\n");
g_mutex_lock (&gphoto2_backend->lock);
if (gphoto2_backend->dir_name_cache != NULL)
@@ -465,7 +447,7 @@ caches_invalidate_free_space (GVfsBackendGphoto2 *gphoto2_backend)
static void
caches_invalidate_dir (GVfsBackendGphoto2 *gphoto2_backend, const char *dir)
{
- DEBUG ("caches_invalidate_dir() for '%s'\n", dir);
+ g_debug ("caches_invalidate_dir() for '%s'\n", dir);
g_mutex_lock (&gphoto2_backend->lock);
g_hash_table_remove (gphoto2_backend->dir_name_cache, dir);
g_hash_table_remove (gphoto2_backend->file_name_cache, dir);
@@ -491,7 +473,7 @@ caches_invalidate_file (GVfsBackendGphoto2 *gphoto2_backend, const char *dir, co
g_hash_table_remove (gphoto2_backend->info_cache, full_name);
g_mutex_unlock (&gphoto2_backend->lock);
- DEBUG ("caches_invalidate_file() for '%s'\n", full_name);
+ g_debug ("caches_invalidate_file() for '%s'\n", full_name);
g_free (full_name);
}
@@ -636,7 +618,7 @@ g_vfs_backend_gphoto2_finalize (GObject *object)
{
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (object);
- DEBUG ("finalizing %p\n", object);
+ g_debug ("finalizing %p\n", object);
release_device (gphoto2_backend);
g_mutex_clear (&gphoto2_backend->lock);
@@ -661,7 +643,7 @@ g_vfs_backend_gphoto2_init (GVfsBackendGphoto2 *gphoto2_backend)
const char *debug;
GPLogLevel level = -1;
- DEBUG ("initing %p\n", gphoto2_backend);
+ g_debug ("initing %p\n", gphoto2_backend);
g_mutex_init (&gphoto2_backend->lock);
@@ -775,20 +757,20 @@ setup_for_device (GVfsBackendGphoto2 *gphoto2_backend)
return;
}
*comma = '/';
- DEBUG ("Parsed '%s' into device name %s\n", gphoto2_backend->gphoto2_port, devname);
+ g_debug ("Parsed '%s' into device name %s\n", gphoto2_backend->gphoto2_port, devname);
/* find corresponding GUdevDevice */
gphoto2_backend->udev_device = g_udev_client_query_by_device_file (gphoto2_backend->gudev_client, devname);
g_free (devname);
if (gphoto2_backend->udev_device)
{
- DEBUG ("-> sysfs path %s, subsys %s, name %s\n", g_udev_device_get_sysfs_path (gphoto2_backend->udev_device), g_udev_device_get_subsystem (gphoto2_backend->udev_device), g_udev_device_get_name (gphoto2_backend->udev_device));
+ g_debug ("-> sysfs path %s, subsys %s, name %s\n", g_udev_device_get_sysfs_path (gphoto2_backend->udev_device), g_udev_device_get_subsystem (gphoto2_backend->udev_device), g_udev_device_get_name (gphoto2_backend->udev_device));
gphoto2_backend->icon_name = g_vfs_get_volume_icon (gphoto2_backend->udev_device);
gphoto2_backend->symbolic_icon_name = g_vfs_get_volume_symbolic_icon (gphoto2_backend->udev_device);
}
else
- DEBUG ("-> did not find matching udev device\n");
+ g_debug ("-> did not find matching udev device\n");
if (is_media_player)
g_vfs_backend_set_x_content_types (G_VFS_BACKEND (gphoto2_backend), media_player_x_content_types);
@@ -801,13 +783,13 @@ on_uevent (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer use
{
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (user_data);
- DEBUG ("on_uevent action %s, device %s\n", action, g_udev_device_get_device_file (device));
+ g_debug ("on_uevent action %s, device %s\n", action, g_udev_device_get_device_file (device));
if (gphoto2_backend->udev_device != NULL &&
g_strcmp0 (g_udev_device_get_device_file (gphoto2_backend->udev_device), g_udev_device_get_device_file (device)) == 0 &&
strcmp (action, "remove") == 0)
{
- DEBUG ("we have been removed!\n");
+ g_debug ("we have been removed!\n");
/* nuke all caches so we're a bit more valgrind friendly */
caches_invalidate_all (gphoto2_backend);
@@ -866,7 +848,7 @@ find_udi_for_device (GVfsBackendGphoto2 *gphoto2_backend)
g_strfreev (tokens);
- DEBUG ("Parsed '%s' into bus=%d device=%d\n", gphoto2_backend->gphoto2_port, usb_bus_num, usb_device_num);
+ g_debug ("Parsed '%s' into bus=%d device=%d\n", gphoto2_backend->gphoto2_port, usb_bus_num, usb_device_num);
camera_devices = libhal_find_device_by_capability (gphoto2_backend->hal_ctx,
"camera",
@@ -906,8 +888,8 @@ find_udi_for_device (GVfsBackendGphoto2 *gphoto2_backend)
icon_from_hal = libhal_ps_get_string (ps, "info.desktop.icon");
name_from_hal = libhal_ps_get_string (ps, "info.desktop.name");
- DEBUG ("looking at usb device '%s' with bus=%d, device=%d\n",
- udi, device_usb_bus_num, device_usb_device_num);
+ g_debug ("looking at usb device '%s' with bus=%d, device=%d\n",
+ udi, device_usb_bus_num, device_usb_device_num);
if (device_usb_bus_num == usb_bus_num &&
device_usb_device_num == usb_device_num)
@@ -916,7 +898,7 @@ find_udi_for_device (GVfsBackendGphoto2 *gphoto2_backend)
const char *parent_udi;
LibHalPropertySet *ps2;
- DEBUG ("udi '%s' is the one!\n", udi);
+ g_debug ("udi '%s' is the one!\n", udi);
/* IMPORTANT:
*
@@ -1025,7 +1007,7 @@ _hal_device_removed (LibHalContext *hal_ctx, const char *udi)
if (gphoto2_backend->hal_udi != NULL && strcmp (udi, gphoto2_backend->hal_udi) == 0)
{
- DEBUG ("we have been removed!\n");
+ g_debug ("we have been removed!\n");
/* nuke all caches so we're a bit more valgrind friendly */
caches_invalidate_all (gphoto2_backend);
@@ -1058,7 +1040,7 @@ split_filename_with_ignore_prefix (GVfsBackendGphoto2 *gphoto2_backend, const ch
if (s[strlen(s)] == '/')
s[strlen(s)] = '\0';
- /*DEBUG ("split_filename_with_ignore_prefix: '%s' -> '%s' '%s'\n", filename, *dir, *name);*/
+ /*g_debug ("split_filename_with_ignore_prefix: '%s' -> '%s' '%s'\n", filename, *dir, *name);*/
}
/* ------------------------------------------------------------------------------------------------- */
@@ -1073,7 +1055,7 @@ add_ignore_prefix (GVfsBackendGphoto2 *gphoto2_backend, const char *filename)
else
result = g_strconcat (gphoto2_backend->ignore_prefix, filename, NULL);
- /*DEBUG ("add_ignore_prefix: '%s' -> '%s'\n", filename, result);*/
+ /*g_debug ("add_ignore_prefix: '%s' -> '%s'\n", filename, result);*/
return result;
}
@@ -1101,9 +1083,9 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
ret = FALSE;
full_path = g_build_filename (dir, name, NULL);
- DEBUG ("file_get_info() try_cache_only=%d dir='%s', name='%s'\n"
- " full_path='%s'\n",
- try_cache_only, dir, name, full_path, gphoto2_backend->ignore_prefix);
+ g_debug ("file_get_info() try_cache_only=%d dir='%s', name='%s'\n"
+ " full_path='%s' ignore_prefix='%s'\n",
+ try_cache_only, dir, name, full_path, gphoto2_backend->ignore_prefix);
/* first look up cache */
@@ -1113,7 +1095,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
{
g_file_info_copy_into (cached_info, info);
g_mutex_unlock (&gphoto2_backend->lock);
- DEBUG (" Using cached info %p for '%s'\n", cached_info, full_path);
+ g_debug (" Using cached info %p for '%s'\n", cached_info, full_path);
ret = TRUE;
goto out;
}
@@ -1124,7 +1106,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
ensure_not_dirty (gphoto2_backend);
- DEBUG (" No cached info for '%s'\n", full_path);
+ g_debug (" No cached info for '%s'\n", full_path);
/* Since we're caching stuff, make sure all information we store is set */
g_file_info_unset_attribute_mask (info);
@@ -1153,7 +1135,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE);
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE);
ret = TRUE;
- DEBUG (" Generating info (root folder) for '%s'\n", full_path);
+ g_debug (" Generating info (root folder) for '%s'\n", full_path);
goto add_to_cache;
}
@@ -1209,7 +1191,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, gphoto2_backend->can_write);
g_file_info_set_is_hidden (info, name != NULL && name[0] == '.');
ret = TRUE;
- DEBUG (" Generating info (folder) for '%s'\n", full_path);
+ g_debug (" Generating info (folder) for '%s'\n", full_path);
goto add_to_cache;
}
@@ -1279,14 +1261,14 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
}
icon = g_content_type_get_icon (mime_type);
- DEBUG (" got icon %p for mime_type '%s'\n", icon, mime_type);
+ g_debug (" got icon %p for mime_type '%s'\n", icon, mime_type);
if (icon != NULL)
{
g_file_info_set_icon (info, icon);
g_object_unref (icon);
}
icon = g_content_type_get_symbolic_icon (mime_type);
- DEBUG (" got symbolic icon %p for mime_type '%s'\n", icon, mime_type);
+ g_debug (" got symbolic icon %p for mime_type '%s'\n", icon, mime_type);
if (icon != NULL)
{
g_file_info_set_symbolic_icon (info, icon);
@@ -1319,7 +1301,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
}
ret = TRUE;
- DEBUG (" Generating info (file) for '%s'\n", full_path);
+ g_debug (" Generating info (file) for '%s'\n", full_path);
add_to_cache:
/* add this sucker to the cache */
@@ -1327,7 +1309,7 @@ file_get_info (GVfsBackendGphoto2 *gphoto2_backend,
{
#ifndef DEBUG_NO_CACHING
cached_info = g_file_info_dup (info);
- DEBUG (" Storing cached info %p for '%s'\n", cached_info, full_path);
+ g_debug (" Storing cached info %p for '%s'\n", cached_info, full_path);
g_mutex_lock (&gphoto2_backend->lock);
g_hash_table_insert (gphoto2_backend->info_cache, g_strdup (full_path), cached_info);
g_mutex_unlock (&gphoto2_backend->lock);
@@ -1394,7 +1376,7 @@ is_directory_empty (GVfsBackendGphoto2 *gphoto2_backend, const char *dir)
int num_dirs;
int num_files;
- DEBUG ("is_directory_empty begin (%s)\n", dir);
+ g_debug ("is_directory_empty begin (%s)\n", dir);
/* TODO: use cache */
@@ -1427,7 +1409,7 @@ is_directory_empty (GVfsBackendGphoto2 *gphoto2_backend, const char *dir)
ret = TRUE;
out:
- DEBUG (" is_directory_empty (%s) -> %d\n", dir, ret);
+ g_debug (" is_directory_empty (%s) -> %d\n", dir, ret);
return ret;
}
@@ -1490,7 +1472,7 @@ ensure_ignore_prefix (GVfsBackendGphoto2 *gphoto2_backend, GVfsJob *job)
else
gphoto2_backend->ignore_prefix = prefix;
- DEBUG ("Using ignore_prefix='%s'\n", gphoto2_backend->ignore_prefix);
+ g_debug ("Using ignore_prefix='%s'\n", gphoto2_backend->ignore_prefix);
return TRUE;
}
@@ -1518,7 +1500,7 @@ do_mount (GVfsBackend *backend,
CameraStorageInformation *storage_info;
int num_storage_info;
- DEBUG ("do_mount %p\n", gphoto2_backend);
+ g_debug ("do_mount %p\n", gphoto2_backend);
#ifdef HAVE_GUDEV
/* setup gudev */
@@ -1580,7 +1562,7 @@ do_mount (GVfsBackend *backend,
/* setup gphoto2 */
host = g_mount_spec_get (mount_spec, "host");
- DEBUG (" host='%s'\n", host);
+ g_debug (" host='%s'\n", host);
if (host == NULL || strlen (host) < 3 || host[0] != '[' || host[strlen (host) - 1] != ']')
{
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("No device specified"));
@@ -1592,7 +1574,7 @@ do_mount (GVfsBackend *backend,
gphoto2_backend->gphoto2_port = g_strdup (host + 1);
gphoto2_backend->gphoto2_port[strlen (gphoto2_backend->gphoto2_port) - 1] = '\0';
- DEBUG (" decoded host='%s'\n", gphoto2_backend->gphoto2_port);
+ g_debug (" decoded host='%s'\n", gphoto2_backend->gphoto2_port);
#ifdef HAVE_GUDEV
setup_for_device (gphoto2_backend);
@@ -1639,7 +1621,7 @@ do_mount (GVfsBackend *backend,
return;
}
- DEBUG (" gphoto2_port='%s'\n", gphoto2_backend->gphoto2_port);
+ g_debug (" gphoto2_port='%s'\n", gphoto2_backend->gphoto2_port);
n = gp_port_info_list_lookup_path (il, gphoto2_backend->gphoto2_port);
if (n == GP_ERROR_UNKNOWN_PORT)
@@ -1660,7 +1642,7 @@ do_mount (GVfsBackend *backend,
}
#ifndef HAVE_GPHOTO25
- DEBUG (" '%s' '%s' '%s'\n", info.name, info.path, info.library_filename);
+ g_debug (" '%s' '%s' '%s'\n", info.name, info.path, info.library_filename);
#endif
/* set port */
@@ -1722,8 +1704,8 @@ do_mount (GVfsBackend *backend,
}
}
}
- DEBUG (" can_write = %d\n", gphoto2_backend->can_write);
- DEBUG (" can_delete = %d\n", gphoto2_backend->can_delete);
+ g_debug (" can_write = %d\n", gphoto2_backend->can_write);
+ g_debug (" can_delete = %d\n", gphoto2_backend->can_delete);
g_vfs_job_succeeded (G_VFS_JOB (job));
@@ -1749,7 +1731,7 @@ do_mount (GVfsBackend *backend,
g_free,
(GDestroyNotify) gp_list_unref);
- DEBUG (" mounted %p\n", gphoto2_backend);
+ g_debug (" mounted %p\n", gphoto2_backend);
}
/* ------------------------------------------------------------------------------------------------- */
@@ -1765,13 +1747,13 @@ try_mount (GVfsBackend *backend,
GError *error = NULL;
GMountSpec *gphoto2_mount_spec;
- DEBUG ("try_mount %p\n", backend);
+ g_debug ("try_mount %p\n", backend);
/* TODO: Hmm.. apparently we have to set the mount spec in
* try_mount(); doing it in mount() do_won't work..
*/
host = g_mount_spec_get (mount_spec, "host");
- DEBUG (" host=%s\n", host);
+ g_debug (" host=%s\n", host);
if (host == NULL)
{
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("No camera specified"));
@@ -1868,7 +1850,7 @@ do_open_for_read_real (GVfsBackend *backend,
goto out;
}
- DEBUG (" data=%p size=%ld handle=%p get_preview=%d\n",
+ g_debug (" data=%p size=%ld handle=%p get_preview=%d\n",
read_handle->data, read_handle->size, read_handle, get_preview);
g_mutex_lock (&gphoto2_backend->lock);
@@ -1892,7 +1874,7 @@ do_open_for_read (GVfsBackend *backend,
GVfsJobOpenForRead *job,
const char *filename)
{
- DEBUG ("open_for_read (%s)\n", filename);
+ g_debug ("open_for_read (%s)\n", filename);
do_open_for_read_real (backend,
job,
@@ -1905,7 +1887,7 @@ do_open_icon_for_read (GVfsBackend *backend,
GVfsJobOpenIconForRead *job,
const char *icon_id)
{
- DEBUG ("open_icon_for_read (%s)\n", icon_id);
+ g_debug ("open_icon_for_read (%s)\n", icon_id);
if (g_str_has_prefix (icon_id, "preview:"))
{
@@ -1938,7 +1920,7 @@ try_read (GVfsBackend *backend,
gsize bytes_left;
gsize bytes_to_copy;
- DEBUG ("do_read() %d @ %ld of %ld, handle=%p\n", bytes_requested, read_handle->cursor, read_handle->size, handle);
+ g_debug ("do_read() %" G_GSIZE_FORMAT " @ %ld of %" G_GSIZE_FORMAT ", handle=%p\n", bytes_requested, read_handle->cursor, read_handle->size, handle);
if (read_handle->cursor >= read_handle->size)
{
@@ -1975,7 +1957,7 @@ try_seek_on_read (GVfsBackend *backend,
ReadHandle *read_handle = (ReadHandle *) handle;
long new_offset;
- DEBUG ("seek_on_read() offset=%d, type=%d, handle=%p\n", (int)offset, type, handle);
+ g_debug ("seek_on_read() offset=%d, type=%d, handle=%p\n", (int)offset, type, handle);
switch (type)
{
@@ -2017,7 +1999,7 @@ do_close_read (GVfsBackend *backend,
ReadHandle *read_handle = (ReadHandle *) handle;
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (backend);
- DEBUG ("close_read() handle=%p\n", handle);
+ g_debug ("close_read() handle=%p\n", handle);
g_mutex_lock (&gphoto2_backend->lock);
gphoto2_backend->open_read_handles = g_list_remove (gphoto2_backend->open_read_handles, read_handle);
@@ -2043,7 +2025,7 @@ do_query_info (GVfsBackend *backend,
char *dir;
char *name;
- DEBUG ("query_info (%s)\n", filename);
+ g_debug ("query_info (%s)\n", filename);
split_filename_with_ignore_prefix (gphoto2_backend, filename, &dir, &name);
@@ -2077,7 +2059,7 @@ try_query_info (GVfsBackend *backend,
char *name;
gboolean ret;
- DEBUG ("try_query_info (%s)\n", filename);
+ g_debug ("try_query_info (%s)\n", filename);
ret = FALSE;
@@ -2085,10 +2067,10 @@ try_query_info (GVfsBackend *backend,
if (!file_get_info (gphoto2_backend, dir, name, info, NULL, TRUE))
{
- DEBUG (" BUU no info from cache for try_query_info (%s)\n", filename);
+ g_debug (" BUU no info from cache for try_query_info (%s)\n", filename);
goto out;
}
- DEBUG (" YAY got info from cache for try_query_info (%s)\n", filename);
+ g_debug (" YAY got info from cache for try_query_info (%s)\n", filename);
g_vfs_job_succeeded (G_VFS_JOB (job));
ret = TRUE;
@@ -2126,7 +2108,7 @@ do_enumerate (GVfsBackend *backend,
using_cached_file_list = FALSE;
filename = add_ignore_prefix (gphoto2_backend, given_filename);
- DEBUG ("enumerate ('%s', with_prefix='%s')\n", given_filename, filename);
+ g_debug ("enumerate ('%s', with_prefix='%s')\n", given_filename, filename);
split_filename_with_ignore_prefix (gphoto2_backend, given_filename, &as_dir, &as_name);
if (!is_directory (gphoto2_backend, as_dir, as_name))
@@ -2159,7 +2141,7 @@ do_enumerate (GVfsBackend *backend,
ensure_not_dirty (gphoto2_backend);
- DEBUG (" Generating dir list for dir '%s'\n", filename);
+ g_debug (" Generating dir list for dir '%s'\n", filename);
gp_list_new (&list);
rc = gp_camera_folder_list_folders (gphoto2_backend->camera,
@@ -2177,7 +2159,7 @@ do_enumerate (GVfsBackend *backend,
}
else
{
- DEBUG (" Using cached dir list for dir '%s'\n", filename);
+ g_debug (" Using cached dir list for dir '%s'\n", filename);
using_cached_dir_list = TRUE;
gp_list_ref (list);
g_mutex_unlock (&gphoto2_backend->lock);
@@ -2187,7 +2169,7 @@ do_enumerate (GVfsBackend *backend,
const char *name;
gp_list_get_name (list, n, &name);
- DEBUG (" enum folder '%s'\n", name);
+ g_debug (" enum folder '%s'\n", name);
info = g_file_info_new ();
error = NULL;
if (!file_get_info (gphoto2_backend, filename, name, info, &error, FALSE))
@@ -2224,7 +2206,7 @@ do_enumerate (GVfsBackend *backend,
g_mutex_unlock (&gphoto2_backend->lock);
ensure_not_dirty (gphoto2_backend);
- DEBUG (" Generating file list for dir '%s'\n", filename);
+ g_debug (" Generating file list for dir '%s'\n", filename);
gp_list_new (&list);
rc = gp_camera_folder_list_files (gphoto2_backend->camera,
@@ -2242,7 +2224,7 @@ do_enumerate (GVfsBackend *backend,
}
else
{
- DEBUG (" Using cached file list for dir '%s'\n", filename);
+ g_debug (" Using cached file list for dir '%s'\n", filename);
using_cached_file_list = TRUE;
gp_list_ref (list);
g_mutex_unlock (&gphoto2_backend->lock);
@@ -2252,7 +2234,7 @@ do_enumerate (GVfsBackend *backend,
const char *name;
gp_list_get_name (list, n, &name);
- DEBUG (" enum file '%s'\n", name);
+ g_debug (" enum file '%s'\n", name);
info = g_file_info_new ();
error = NULL;
@@ -2312,7 +2294,7 @@ try_enumerate (GVfsBackend *backend,
l = NULL;
filename = add_ignore_prefix (gphoto2_backend, given_filename);
- DEBUG ("try_enumerate (%s)\n", given_filename);
+ g_debug ("try_enumerate (%s)\n", given_filename);
/* first, list the folders */
g_mutex_lock (&gphoto2_backend->lock);
@@ -2327,7 +2309,7 @@ try_enumerate (GVfsBackend *backend,
for (n = 0; n < gp_list_count (list); n++)
{
gp_list_get_name (list, n, &name);
- DEBUG (" try_enum folder '%s'\n", name);
+ g_debug (" try_enum folder '%s'\n", name);
info = g_file_info_new ();
if (!file_get_info (gphoto2_backend, filename, name, info, &error, TRUE))
{
@@ -2355,7 +2337,7 @@ try_enumerate (GVfsBackend *backend,
for (n = 0; n < gp_list_count (list); n++)
{
gp_list_get_name (list, n, &name);
- DEBUG (" try_enum file '%s'\n", name);
+ g_debug (" try_enum file '%s'\n", name);
info = g_file_info_new ();
if (!file_get_info (gphoto2_backend, filename, name, info, &error, TRUE))
@@ -2379,14 +2361,14 @@ try_enumerate (GVfsBackend *backend,
g_vfs_job_enumerate_done (job);
g_free (filename);
- DEBUG (" YAY got info from cache for try_enumerate (%s)\n", given_filename);
+ g_debug (" YAY got info from cache for try_enumerate (%s)\n", given_filename);
return TRUE;
error_not_cached:
g_list_free_full (l, g_object_unref);
g_free (filename);
- DEBUG (" BUU no info from cache for try_enumerate (%s)\n", given_filename);
+ g_debug (" BUU no info from cache for try_enumerate (%s)\n", given_filename);
return FALSE;
}
@@ -2404,7 +2386,7 @@ do_query_fs_info (GVfsBackend *backend,
CameraStorageInformation *storage_info;
int num_storage_info;
- DEBUG ("query_fs_info (%s)\n", filename);
+ g_debug ("query_fs_info (%s)\n", filename);
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "gphoto2");
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL);
@@ -2436,7 +2418,7 @@ do_query_fs_info (GVfsBackend *backend,
(guint64) gphoto2_backend->free_space);
}
}
- DEBUG (" got %d storage_info objects\n", num_storage_info);
+ g_debug (" got %d storage_info objects\n", num_storage_info);
}
g_vfs_job_succeeded (G_VFS_JOB (job));
@@ -2456,7 +2438,7 @@ try_query_fs_info (GVfsBackend *backend,
gint64 free_space;
gint64 capacity;
- DEBUG ("try_query_fs_info (%s)\n", filename);
+ g_debug ("try_query_fs_info (%s)\n", filename);
ret = FALSE;
@@ -2467,10 +2449,10 @@ try_query_fs_info (GVfsBackend *backend,
if (free_space == -1 || capacity == -1)
{
- DEBUG (" BUU no info from cache for try_query_fs_info (%s)\n", filename);
+ g_debug (" BUU no info from cache for try_query_fs_info (%s)\n", filename);
goto out;
}
- DEBUG (" YAY got info from cache for try_query_fs_info (%s)\n", filename);
+ g_debug (" YAY got info from cache for try_query_fs_info (%s)\n", filename);
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "gphoto2");
g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL);
@@ -2497,7 +2479,7 @@ do_make_directory (GVfsBackend *backend,
int rc;
GError *error;
- DEBUG ("make_directory (%s)\n", filename);
+ g_debug ("make_directory (%s)\n", filename);
ensure_not_dirty (gphoto2_backend);
@@ -2556,7 +2538,7 @@ do_slow_file_rename_in_same_dir (GVfsBackendGphoto2 *gphoto2_backend,
file = NULL;
file_dest = NULL;
- DEBUG ("do_slow_file_rename_in_same_dir() '%s' '%s' -> '%s'\n", dir, name, new_name);
+ g_debug ("do_slow_file_rename_in_same_dir() '%s' '%s' -> '%s'\n", dir, name, new_name);
rc = gp_file_new (&file);
if (rc != 0)
@@ -2595,7 +2577,7 @@ do_slow_file_rename_in_same_dir (GVfsBackendGphoto2 *gphoto2_backend,
gphoto2_backend->context);
if (rc != 0)
{
- DEBUG (" file delete failed as part of slow rename rc=%d\n", rc);
+ g_debug (" file delete failed as part of slow rename rc=%d\n", rc);
goto out;
}
}
@@ -2661,7 +2643,7 @@ do_dir_rename_in_same_dir (GVfsBackendGphoto2 *gphoto2_backend,
dir_name = g_build_filename (dir, name, NULL);
- DEBUG ("do_dir_rename_in_same_dir() '%s' '%s' -> '%s' ('%s')\n", dir, name, new_name, dir_name);
+ g_debug ("do_dir_rename_in_same_dir() '%s' '%s' -> '%s' ('%s')\n", dir, name, new_name, dir_name);
/* TODO: Support non-empty folders by recursively renaming stuff.
* Or that might be too dangerous as it's not exactly atomic.
@@ -2711,7 +2693,7 @@ do_set_display_name (GVfsBackend *backend,
ensure_not_dirty (gphoto2_backend);
- DEBUG ("set_display_name() '%s' -> '%s'\n", filename, display_name);
+ g_debug ("set_display_name() '%s' -> '%s'\n", filename, display_name);
dir = NULL;
name = NULL;
@@ -2809,7 +2791,7 @@ do_delete (GVfsBackend *backend,
ensure_not_dirty (gphoto2_backend);
- DEBUG ("delete() '%s'\n", filename);
+ g_debug ("delete() '%s'\n", filename);
dir = NULL;
name = NULL;
@@ -3023,7 +3005,7 @@ do_create_internal (GVfsBackend *backend,
gphoto2_backend->open_write_handles = g_list_prepend (gphoto2_backend->open_write_handles, handle);
- DEBUG (" handle=%p\n", handle);
+ g_debug (" handle=%p\n", handle);
/* make sure we invalidate the dir and the file */
caches_invalidate_file (gphoto2_backend, dir, name);
@@ -3052,7 +3034,7 @@ do_create (GVfsBackend *backend,
const char *filename,
GFileCreateFlags flags)
{
- DEBUG ("create() '%s' flags=0x%04x\n", filename, flags);
+ g_debug ("create() '%s' flags=0x%04x\n", filename, flags);
return do_create_internal (backend, job, filename, flags, FALSE, FALSE);
}
@@ -3071,7 +3053,7 @@ do_replace (GVfsBackend *backend,
char *dir;
char *name;
- DEBUG ("replace() '%s' etag='%s' make_backup=%d flags=0x%04x\n", filename, etag, make_backup, flags);
+ g_debug ("replace() '%s' etag='%s' make_backup=%d flags=0x%04x\n", filename, etag, make_backup, flags);
dir = NULL;
name = NULL;
@@ -3098,7 +3080,7 @@ do_append_to (GVfsBackend *backend,
char *dir;
char *name;
- DEBUG ("append_to() '%s' flags=0x%04x\n", filename, flags);
+ g_debug ("append_to() '%s' flags=0x%04x\n", filename, flags);
dir = NULL;
name = NULL;
@@ -3125,7 +3107,7 @@ do_write (GVfsBackend *backend,
{
WriteHandle *handle = _handle;
- DEBUG ("write() %p, '%s', %d bytes\n", handle, handle->filename, buffer_size);
+ g_debug ("write() %p, '%s', %" G_GSIZE_FORMAT " bytes\n", handle, handle->filename, buffer_size);
/* ensure we have enough room */
if (handle->cursor + buffer_size > handle->allocated_size)
@@ -3134,7 +3116,7 @@ do_write (GVfsBackend *backend,
new_allocated_size = ((handle->cursor + buffer_size) / WRITE_INCREMENT + 1) * WRITE_INCREMENT;
handle->data = g_realloc (handle->data, new_allocated_size);
handle->allocated_size = new_allocated_size;
- DEBUG (" allocated_size is now %ld bytes)\n", handle->allocated_size);
+ g_debug (" allocated_size is now %ld bytes)\n", handle->allocated_size);
}
@@ -3164,7 +3146,7 @@ do_seek_on_write (GVfsBackend *backend,
WriteHandle *write_handle = handle;
long new_offset;
- DEBUG ("seek_on_write() %p '%s' offset=%d type=%d cursor=%ld size=%ld\n", write_handle, write_handle->filename, (int)offset, type, write_handle->cursor, write_handle->size);
+ g_debug ("seek_on_write() %p '%s' offset=%d type=%d cursor=%ld size=%ld\n", write_handle, write_handle->filename, (int)offset, type, write_handle->cursor, write_handle->size);
switch (type)
{
@@ -3204,7 +3186,7 @@ do_truncate (GVfsBackend *backend,
{
WriteHandle *handle = _handle;
- DEBUG ("truncate() %p, '%s', %ld bytes\n", handle, handle->filename, size);
+ g_debug ("truncate() %p, '%s', %ld bytes\n", handle, handle->filename, size);
/* ensure we have enough room */
if (size > handle->allocated_size)
@@ -3213,7 +3195,7 @@ do_truncate (GVfsBackend *backend,
new_allocated_size = (size / WRITE_INCREMENT + 1) * WRITE_INCREMENT;
handle->data = g_realloc (handle->data, new_allocated_size);
handle->allocated_size = new_allocated_size;
- DEBUG (" allocated_size is now %ld bytes)\n", handle->allocated_size);
+ g_debug (" allocated_size is now %ld bytes)\n", handle->allocated_size);
}
@@ -3237,12 +3219,12 @@ commit_write_handle (GVfsBackendGphoto2 *gphoto2_backend, WriteHandle *write_han
int rc;
CameraFile *file;
- DEBUG ("commit_write_handle() '%s' of size %ld\n", write_handle->filename, write_handle->size);
+ g_debug ("commit_write_handle() '%s' of size %ld\n", write_handle->filename, write_handle->size);
/* no need to write as we're not dirty */
if (!write_handle->is_dirty)
{
- DEBUG (" not dirty => not writing\n");
+ g_debug (" not dirty => not writing\n");
return 0;
}
@@ -3262,9 +3244,9 @@ commit_write_handle (GVfsBackendGphoto2 *gphoto2_backend, WriteHandle *write_han
if (rc != 0)
goto out;
- DEBUG (" deleted '%s' '%s' for delete_before=%d, job_is_replace=%d, job_is_append_to=%d\n",
- write_handle->dir, write_handle->name,
- write_handle->delete_before, write_handle->job_is_replace, write_handle->job_is_append_to);
+ g_debug (" deleted '%s' '%s' for delete_before=%d, job_is_replace=%d, job_is_append_to=%d\n",
+ write_handle->dir, write_handle->name,
+ write_handle->delete_before, write_handle->job_is_replace, write_handle->job_is_append_to);
}
rc = gp_file_new (&file);
@@ -3289,7 +3271,7 @@ commit_write_handle (GVfsBackendGphoto2 *gphoto2_backend, WriteHandle *write_han
goto out;
}
- DEBUG (" successfully wrote '%s' of %ld bytes\n", write_handle->filename, write_handle->size);
+ g_debug (" successfully wrote '%s' of %ld bytes\n", write_handle->filename, write_handle->size);
monitors_emit_changed (gphoto2_backend, write_handle->dir, write_handle->name);
gp_file_unref (file);
@@ -3316,7 +3298,7 @@ do_close_write (GVfsBackend *backend,
GError *error;
int rc;
- DEBUG ("close_write() %p '%s' %ld bytes total\n", write_handle, write_handle->filename, write_handle->size);
+ g_debug ("close_write() %p '%s' %ld bytes total\n", write_handle, write_handle->filename, write_handle->size);
rc = commit_write_handle (gphoto2_backend, write_handle);
if (rc != 0)
@@ -3356,7 +3338,7 @@ do_move (GVfsBackend *backend,
GError *error;
gboolean mv_dir;
- DEBUG ("move() '%s' -> '%s' %04x)\n", source, destination, flags);
+ g_debug ("move() '%s' -> '%s' %04x)\n", source, destination, flags);
ensure_not_dirty (gphoto2_backend);
@@ -3366,7 +3348,7 @@ do_move (GVfsBackend *backend,
/* this is an limited implementation that can only move files / folders in the same directory */
if (strcmp (src_dir, dst_dir) != 0)
{
- DEBUG (" not supported (not same directory)\n");
+ g_debug (" not supported (not same directory)\n");
g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Not supported (not same directory)"));
@@ -3378,7 +3360,7 @@ do_move (GVfsBackend *backend,
{
if (is_directory (gphoto2_backend, dst_dir, dst_name))
{
- DEBUG (" not supported (src is dir; dst is dir)\n");
+ g_debug (" not supported (src is dir; dst is dir)\n");
g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Not supported (the source is a directory, the destination is a directory too)"));
@@ -3386,7 +3368,7 @@ do_move (GVfsBackend *backend,
}
else if (is_regular (gphoto2_backend, dst_dir, dst_name))
{
- DEBUG (" not supported (src is dir; dst is existing file)\n");
+ g_debug (" not supported (src is dir; dst is existing file)\n");
g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Not supported (the source is a directory, but the destination is an existing file)"));
@@ -3398,7 +3380,7 @@ do_move (GVfsBackend *backend,
{
if (is_directory (gphoto2_backend, dst_dir, dst_name))
{
- DEBUG (" not supported (src is file; dst is dir)\n");
+ g_debug (" not supported (src is file; dst is dir)\n");
g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
_("Not supported (the source is a file, but the destination is a directory)"));
@@ -3419,11 +3401,11 @@ do_move (GVfsBackend *backend,
if (mv_dir)
{
- DEBUG (" renaming dir\n");
+ g_debug (" renaming dir\n");
rc = do_dir_rename_in_same_dir (gphoto2_backend, src_dir, src_name, dst_name);
if (rc != 0)
{
- DEBUG (" error renaming dir\n");
+ g_debug (" error renaming dir\n");
error = get_error_from_gphoto2 (_("Error renaming directory"), rc);
g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
g_error_free (error);
@@ -3432,11 +3414,11 @@ do_move (GVfsBackend *backend,
}
else
{
- DEBUG (" renaming file\n");
+ g_debug (" renaming file\n");
rc = do_file_rename_in_same_dir (gphoto2_backend, src_dir, src_name, dst_name, flags & G_FILE_COPY_OVERWRITE);
if (rc != 0)
{
- DEBUG (" error renaming file\n");
+ g_debug (" error renaming file\n");
error = get_error_from_gphoto2 (_("Error renaming file"), rc);
g_vfs_job_failed_from_error (G_VFS_JOB (job), error);
g_error_free (error);
@@ -3448,7 +3430,7 @@ do_move (GVfsBackend *backend,
monitors_emit_deleted (gphoto2_backend, src_dir, src_name);
monitors_emit_created (gphoto2_backend, src_dir, dst_name);
- DEBUG (" success\n");
+ g_debug (" success\n");
g_vfs_job_succeeded (G_VFS_JOB (job));
@@ -3642,7 +3624,7 @@ vfs_dir_monitor_destroyed (gpointer user_data, GObject *where_the_object_was)
GList *l;
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (user_data);
- DEBUG ("vfs_dir_monitor_destroyed()\n");
+ g_debug ("vfs_dir_monitor_destroyed()\n");
for (l = gphoto2_backend->dir_monitor_proxies; l != NULL; l = l->next)
{
@@ -3650,7 +3632,7 @@ vfs_dir_monitor_destroyed (gpointer user_data, GObject *where_the_object_was)
if (G_OBJECT (proxy->vfs_monitor) == where_the_object_was)
{
gphoto2_backend->dir_monitor_proxies = g_list_remove (gphoto2_backend->dir_monitor_proxies, proxy);
- DEBUG (" Removed dead dir monitor for '%s'\n", proxy->path);
+ g_debug (" Removed dead dir monitor for '%s'\n", proxy->path);
monitor_proxy_free (proxy);
break;
}
@@ -3668,7 +3650,7 @@ do_create_dir_monitor (GVfsBackend *backend,
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (backend);
MonitorProxy *proxy;
- DEBUG ("create_dir_monitor (%s)\n", filename);
+ g_debug ("create_dir_monitor (%s)\n", filename);
split_filename_with_ignore_prefix (gphoto2_backend, filename, &dir, &name);
@@ -3692,7 +3674,7 @@ vfs_file_monitor_destroyed (gpointer user_data, GObject *where_the_object_was)
GList *l;
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (user_data);
- DEBUG ("vfs_file_monitor_destroyed()\n");
+ g_debug ("vfs_file_monitor_destroyed()\n");
for (l = gphoto2_backend->file_monitor_proxies; l != NULL; l = l->next)
{
@@ -3700,7 +3682,7 @@ vfs_file_monitor_destroyed (gpointer user_data, GObject *where_the_object_was)
if (G_OBJECT (proxy->vfs_monitor) == where_the_object_was)
{
gphoto2_backend->dir_monitor_proxies = g_list_remove (gphoto2_backend->dir_monitor_proxies, proxy);
- DEBUG (" Removed dead file monitor for '%s'\n", proxy->path);
+ g_debug (" Removed dead file monitor for '%s'\n", proxy->path);
monitor_proxy_free (proxy);
break;
}
@@ -3718,7 +3700,7 @@ do_create_file_monitor (GVfsBackend *backend,
GVfsBackendGphoto2 *gphoto2_backend = G_VFS_BACKEND_GPHOTO2 (backend);
MonitorProxy *proxy;
- DEBUG ("create_file_monitor (%s)\n", filename);
+ g_debug ("create_file_monitor (%s)\n", filename);
split_filename_with_ignore_prefix (gphoto2_backend, filename, &dir, &name);