Revert "Fix all warnings caused by -Wunused-but-set-variable"
authorDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:40 +0000 (13:09 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 26 Aug 2011 17:09:40 +0000 (13:09 -0400)
This reverts commit 75aa5d3b67ace13eba3d2e39f0806742e1fd7bb5.

src/adapter.c
src/daemon.c
src/device.c
src/expander.c
src/helpers/job-create-partition.c
src/helpers/job-delete-partition.c
src/helpers/partutil.c
src/port.c
tools/udisks.c

index b85a0ef..a197c2e 100644 (file)
@@ -258,6 +258,7 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_adapter (Adapter *adapter)
 {
+  DBusConnection *connection;
   GError *error = NULL;
 
   adapter->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -270,6 +271,7 @@ register_disks_adapter (Adapter *adapter)
         }
       goto error;
     }
+  connection = dbus_g_connection_get_connection (adapter->priv->system_bus_connection);
 
   adapter->priv->object_path = compute_object_path (adapter->priv->native_path);
 
@@ -428,7 +430,9 @@ update_info_fabric_and_num_ports (Adapter *adapter)
   guint num_ports;
   guint64 device_class;
   const gchar *driver;
+  guint class;
   guint subclass;
+  guint interface;
   gchar *scsi_host_name;
   gchar *s;
   gchar *s2;
@@ -441,7 +445,9 @@ update_info_fabric_and_num_ports (Adapter *adapter)
   device_class = g_udev_device_get_sysfs_attr_as_uint64 (adapter->priv->d, "class");
   driver = g_udev_device_get_driver (adapter->priv->d);
 
+  class = (device_class & 0xff0000) >> 16;
   subclass = (device_class & 0x00ff00) >> 8;
+  interface = (device_class & 0x0000ff);
 
   /* count number of scsi_host objects - this is to detect whether we are dealing with
    * ATA - see comment in port.c:update_info_ata() for details about
index 075db22..afcd8fb 100644 (file)
@@ -213,6 +213,9 @@ daemon_constructor (GType type,
                     GObjectConstructParam *construct_properties)
 {
   Daemon *daemon;
+  DaemonClass *klass;
+
+  klass = DAEMON_CLASS (g_type_class_peek (TYPE_DAEMON));
 
   daemon = DAEMON (G_OBJECT_CLASS (daemon_parent_class)->constructor (type,
                                                                       n_construct_properties,
@@ -766,6 +769,9 @@ _filter (DBusConnection *connection,
          void *user_data)
 {
   //Daemon *daemon = DAEMON (user_data);
+  const char *interface;
+
+  interface = dbus_message_get_interface (message);
 
   if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
     {
index bee68e0..6f244cb 100644 (file)
@@ -344,6 +344,9 @@ device_constructor (GType type,
                     GObjectConstructParam *construct_properties)
 {
   Device *device;
+  DeviceClass *klass;
+
+  klass = DEVICE_CLASS (g_type_class_peek (TYPE_DEVICE));
 
   device = DEVICE (G_OBJECT_CLASS (device_parent_class)->constructor (type,
                                                                       n_construct_properties,
@@ -1934,6 +1937,7 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_device (Device *device)
 {
+  DBusConnection *connection;
   GError *error = NULL;
 
   device->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -1946,6 +1950,8 @@ register_disks_device (Device *device)
         }
       goto error;
     }
+  connection = dbus_g_connection_get_connection (device->priv->system_bus_connection);
+
   device->priv->object_path = compute_object_path (device->priv->native_path);
 
   /* safety first */
@@ -2484,6 +2490,7 @@ update_info_partition (Device *device)
    */
   if (!is_partition && sysfs_file_exists (device->priv->native_path, "start"))
     {
+      guint64 start;
       guint64 size;
       guint64 offset;
       guint64 alignment_offset;
@@ -2491,6 +2498,7 @@ update_info_partition (Device *device)
       guint n;
 
       device_set_device_is_partition (device, TRUE);
+      start = sysfs_get_uint64 (device->priv->native_path, "start");
       size = sysfs_get_uint64 (device->priv->native_path, "size");
       alignment_offset = sysfs_get_uint64 (device->priv->native_path, "alignment_offset");
 
@@ -6699,6 +6707,7 @@ device_filesystem_unmount_authorized_cb (Daemon *daemon,
   gchar **options = user_data_elements[0];
   int n;
   char *argv[16];
+  GError *error;
   gboolean force_unmount;
   char *mount_path;
   uid_t uid;
@@ -6765,6 +6774,7 @@ device_filesystem_unmount_authorized_cb (Daemon *daemon,
   argv[n++] = NULL;
 
  run_job:
+  error = NULL;
   if (!job_new (context,
                 "FilesystemUnmount",
                 FALSE,
@@ -6949,6 +6959,7 @@ device_filesystem_list_open_files_authorized_cb (Daemon *daemon,
 {
   int n;
   char *argv[16];
+  GError *error;
 
   if (!device->priv->device_is_mounted || device->priv->device_mount_paths->len == 0)
     {
@@ -6962,6 +6973,7 @@ device_filesystem_list_open_files_authorized_cb (Daemon *daemon,
   argv[n++] = ((gchar **) device->priv->device_mount_paths->pdata)[0];
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context, NULL, /* don't run this as a job */
                 FALSE, device, argv, NULL, filesystem_list_open_files_completed_cb, FALSE, NULL, NULL))
     {
@@ -7041,8 +7053,10 @@ device_drive_eject_authorized_cb (Daemon *daemon,
   int n;
   char *argv[16];
   GError *error;
+  char *mount_path;
 
   error = NULL;
+  mount_path = NULL;
 
   if (!device->priv->device_is_drive)
     {
@@ -7161,8 +7175,10 @@ device_drive_detach_authorized_cb (Daemon *daemon,
   int n;
   char *argv[16];
   GError *error;
+  char *mount_path;
 
   error = NULL;
+  mount_path = NULL;
 
   if (!device->priv->device_is_drive)
     {
@@ -7291,6 +7307,7 @@ device_filesystem_check_authorized_cb (Daemon *daemon,
   //gchar **options = user_data_elements[0];
   int n;
   char *argv[16];
+  GError *error;
 
   /* TODO: change when we have a file system that supports online fsck */
   if (device->priv->device_is_mounted)
@@ -7305,6 +7322,7 @@ device_filesystem_check_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context, "FilesystemCheck", FALSE, device, argv, NULL, filesystem_check_completed_cb, FALSE, NULL, NULL))
     {
       goto out;
@@ -9385,6 +9403,7 @@ device_luks_lock_authorized_cb (Daemon *daemon,
   Device *cleartext_device;
   int n;
   char *argv[10];
+  GError *error;
 
   if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, "crypto") != 0)
     {
@@ -9411,6 +9430,7 @@ device_luks_lock_authorized_cb (Daemon *daemon,
   argv[n++] = cleartext_device->priv->dm_name;
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context,
                 "LuksLock",
                 FALSE,
@@ -9542,6 +9562,7 @@ device_luks_change_passphrase_authorized_cb (Daemon *daemon,
   const char *new_secret = user_data_elements[1];
   int n;
   char *argv[10];
+  GError *error;
   char *secrets_as_stdin;
 
   secrets_as_stdin = NULL;
@@ -9559,6 +9580,7 @@ device_luks_change_passphrase_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context,
                 "LuksChangePassphrase",
                 FALSE,
@@ -9912,6 +9934,7 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon,
   char **options = user_data_elements[0];
   int n;
   char *argv[10];
+  GError *error;
   const char *simuldata;
   gboolean nowakeup;
   uid_t caller_uid;
@@ -9964,6 +9987,8 @@ device_drive_ata_smart_refresh_data_authorized_cb (Daemon *daemon,
       argv[n++] = NULL;
     }
 
+  error = NULL;
+
   if (!job_new (context, NULL, /* don't run this as a job */
                 FALSE, device, argv, NULL, drive_ata_smart_refresh_data_completed_cb, FALSE, NULL, NULL))
     {
@@ -10056,6 +10081,7 @@ device_drive_ata_smart_initiate_selftest_authorized_cb (Daemon *daemon,
   //gchar       **options = user_data_elements[1];
   int n;
   char *argv[10];
+  GError *error;
   const gchar *job_name;
 
   if (g_strcmp0 (test, "short") == 0)
@@ -10082,6 +10108,7 @@ device_drive_ata_smart_initiate_selftest_authorized_cb (Daemon *daemon,
   argv[n++] = (char *) test;
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context,
                 job_name,
                 TRUE,
@@ -10181,6 +10208,7 @@ device_linux_md_stop_authorized_cb (Daemon *daemon,
   //gchar       **options = user_data_elements[0];
   int n;
   char *argv[10];
+  GError *error;
 
   n = 0;
   argv[n++] = "mdadm";
@@ -10188,6 +10216,7 @@ device_linux_md_stop_authorized_cb (Daemon *daemon,
   argv[n++] = device->priv->device_file;
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context, "LinuxMdStop", TRUE, device, argv, NULL, linux_md_stop_completed_cb, FALSE, NULL, NULL))
     {
       goto out;
@@ -10268,10 +10297,13 @@ device_linux_md_check_authorized_cb (Daemon *daemon,
                                      gpointer *user_data_elements)
 {
   gchar **options = user_data_elements[0];
+  gchar *filename;
   int n, m;
   char *argv[128];
   const gchar *job_name;
 
+  filename = NULL;
+
   if (!device->priv->device_is_linux_md)
     {
       throw_error (context, ERROR_FAILED, "Device is not a Linux md drive");
@@ -10811,6 +10843,7 @@ device_linux_md_remove_component_authorized_cb (Daemon *daemon,
   char **options = user_data_elements[1];
   int n, m;
   char *argv[128];
+  GError *error;
   Device *slave;
 
   slave = daemon_local_find_by_object_path (device->priv->daemon, component);
@@ -10848,6 +10881,7 @@ device_linux_md_remove_component_authorized_cb (Daemon *daemon,
     }
   argv[n++] = NULL;
 
+  error = NULL;
   if (!job_new (context,
                 "LinuxMdRemoveComponent",
                 TRUE,
index 734ec0a..80e75b7 100644 (file)
@@ -290,6 +290,7 @@ compute_object_path (const char *native_path)
 static gboolean
 register_disks_expander (Expander *expander)
 {
+  DBusConnection *connection;
   GError *error = NULL;
 
   expander->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -302,6 +303,7 @@ register_disks_expander (Expander *expander)
         }
       goto error;
     }
+  connection = dbus_g_connection_get_connection (expander->priv->system_bus_connection);
 
   expander->priv->object_path = compute_object_path (expander->priv->native_path);
 
index 80277b8..9f8b202 100644 (file)
@@ -49,6 +49,7 @@ main (int argc,
   int n;
   int ret;
   const char *device;
+  char **options;
   char *label;
   char *type;
   char *flags_as_string;
@@ -84,6 +85,7 @@ main (int argc,
   type = argv[4];
   label = argv[5];
   flags_as_string = argv[6];
+  options = argv + 7;
 
   flags = g_strsplit (flags_as_string, ",", 0);
 
index 2f2775a..44945d2 100644 (file)
@@ -47,6 +47,7 @@ main (int argc,
 {
   int ret;
   const char *device;
+  const char *partition_device;
   char **options;
   int n;
   guint64 offset;
@@ -62,6 +63,7 @@ main (int argc,
       goto out;
     }
   device = argv[1];
+  partition_device = argv[2];
   offset = strtoll (argv[3], &endp, 10);
   if (*endp != '\0')
     {
index 72a8fe3..3bd64b8 100644 (file)
@@ -851,6 +851,7 @@ part_table_parse_apple (int fd,
     /* more stuff */
   }__attribute__ ((packed)) mac_part;
   int block_size;
+  int block_count;
   int map_count;
 
   DEBUG ("Entering Apple parser");
@@ -875,6 +876,7 @@ part_table_parse_apple (int fd,
     }
 
   block_size = GUINT16_FROM_BE (mac_header.block_size);
+  block_count = GUINT32_FROM_BE (mac_header.block_count); /* num blocks on whole disk */
 
   DEBUG ("Mac MAGIC found, block_size=%d", block_size);
 
index a43f019..f52ae51 100644 (file)
@@ -262,6 +262,7 @@ compute_object_path (Port *port)
 static gboolean
 register_disks_port (Port *port)
 {
+  DBusConnection *connection;
   GError *error = NULL;
 
   port->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -274,6 +275,7 @@ register_disks_port (Port *port)
         }
       goto error;
     }
+  connection = dbus_g_connection_get_connection (port->priv->system_bus_connection);
 
   port->priv->object_path = compute_object_path (port);
 
index ea6d2fc..6481efb 100644 (file)
@@ -931,8 +931,12 @@ device_properties_get (DBusGConnection *bus,
 static gboolean
 do_monitor (void)
 {
+  GError *error;
+
   g_print ("Monitoring activity from the disks daemon. Press Ctrl+C to cancel.\n");
 
+  error = NULL;
+
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceAdded", G_CALLBACK (device_added_signal_handler), NULL, NULL);
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceRemoved", G_CALLBACK (device_removed_signal_handler), NULL, NULL);
   dbus_g_proxy_connect_signal (disks_proxy, "DeviceChanged", G_CALLBACK (device_changed_signal_handler), NULL, NULL);