Skip to content

Instantly share code, notes, and snippets.

@tasleson
Last active March 28, 2017 17:24
Show Gist options
  • Save tasleson/b18ec17f03fe564fd9ad6e3aac474387 to your computer and use it in GitHub Desktop.
Save tasleson/b18ec17f03fe564fd9ad6e3aac474387 to your computer and use it in GitHub Desktop.
Udisks duplicate code

Individual code duplications, each of which could be done as an individual task.

  • Migrate existing PR to master-libblockdev, this is specific to udiskslinuxpartition.c

Number of tasks = 260, individually listed below

  • Found 31 duplicate lines in the following files:
    • Between lines 454 and 498 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 820 and 866 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
454   g_clear_object (&object);
455   return TRUE;
456 }
457 
458 /* ---------------------------------------------------------------------------------------------------- */
459 
460 struct WaitData {
461   UDisksLinuxVolumeGroupObject *group_object;
462   const gchar *name;
463 };
464 
465 static UDisksObject *
466 wait_for_logical_volume_object (UDisksDaemon *daemon,
467                                 gpointer      user_data)
468 {
469   struct WaitData *data = user_data;
470   return UDISKS_OBJECT (udisks_linux_volume_group_object_find_logical_volume_object (data->group_object,
471                                                                                      data->name));
472 }
473 
474 static const gchar *
475 wait_for_logical_volume_path (UDisksLinuxVolumeGroupObject  *group_object,
476                               const gchar                   *name,
477                               GError                       **error)
478 {
479   struct WaitData data;
480   UDisksDaemon *daemon;
481   UDisksObject *volume_object;
482 
483   data.group_object = group_object;
484   data.name = name;
485   daemon = udisks_linux_volume_group_object_get_daemon (group_object);
486   volume_object = udisks_daemon_wait_for_object_sync (daemon,
487                                                       wait_for_logical_volume_object,
488                                                       &data,
489                                                       NULL,
490                                                       10, /* timeout_seconds */
491                                                       error);
492   if (volume_object == NULL)
493     return NULL;
494 
495   return g_dbus_object_get_object_path (G_DBUS_OBJECT (volume_object));
496 }
497 
498 static gboolean
  • Found 31 duplicate lines in the following files:
    • Between lines 1347 and 1388 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1481 and 1522 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1347   object = udisks_daemon_util_dup_object (drive, &error);
1348   if (object == NULL)
1349     {
1350       g_dbus_method_invocation_take_error (invocation, error);
1351       goto out;
1352     }
1353 
1354   block_object = udisks_linux_drive_object_get_block (object, FALSE);
1355   if (block_object == NULL)
1356     {
1357       g_dbus_method_invocation_return_error (invocation,
1358                                              UDISKS_ERROR,
1359                                              UDISKS_ERROR_FAILED,
1360                                              "Unable to find block device for drive");
1361       goto out;
1362     }
1363   block = udisks_object_peek_block (UDISKS_OBJECT (block_object));
1364 
1365   daemon = udisks_linux_drive_object_get_daemon (object);
1366 
1367   if (!udisks_drive_ata_get_pm_supported (UDISKS_DRIVE_ATA (drive)) ||
1368       !udisks_drive_ata_get_pm_enabled (UDISKS_DRIVE_ATA (drive)))
1369     {
1370       g_dbus_method_invocation_return_error (invocation,
1371                                              UDISKS_ERROR,
1372                                              UDISKS_ERROR_FAILED,
1373                                              "PM is not supported or enabled");
1374       goto out;
1375     }
1376 
1377   error = NULL;
1378   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1379                                                  invocation,
1380                                                  NULL /* GCancellable */,
1381                                                  &caller_uid,
1382                                                  NULL,
1383                                                  NULL,
1384                                                  &error))
1385     {
1386       g_dbus_method_invocation_return_gerror (invocation, error);
1387       g_clear_error (&error);
1388       goto out;
  • Found 30 duplicate lines in the following files:
    • Between lines 2167 and 2211 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1915 and 1959 in /home/tasleson/projects/udisks/tools/udisksctl.c
2167           g_print ("--object-path \n"
2168                    "--block-device \n");
2169         }
2170 
2171       if (complete_objects)
2172         {
2173           const gchar *object_path;
2174           objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
2175           for (l = objects; l != NULL; l = l->next)
2176             {
2177               object = UDISKS_OBJECT (l->data);
2178               ata = udisks_object_peek_drive_ata (object);
2179               if (ata != NULL)
2180                 {
2181                   object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
2182                   g_assert (g_str_has_prefix (object_path, "/org/freedesktop/UDisks2/"));
2183                   g_print ("%s \n", object_path + sizeof ("/org/freedesktop/UDisks2/") - 1);
2184                 }
2185             }
2186           g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2187           g_list_free (objects);
2188         }
2189 
2190       if (complete_devices)
2191         {
2192           objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
2193           for (l = objects; l != NULL; l = l->next)
2194             {
2195               object = UDISKS_OBJECT (l->data);
2196               ata = udisks_object_peek_drive_ata (object);
2197               if (ata != NULL)
2198                 {
2199                   const gchar * const *symlinks;
2200                   UDisksBlock *block;
2201                   block = udisks_client_get_block_for_drive (client, udisks_object_peek_drive (object), TRUE);
2202                   g_print ("%s \n", udisks_block_get_device (block));
2203                   symlinks = udisks_block_get_symlinks (block);
2204                   for (n = 0; symlinks != NULL && symlinks[n] != NULL; n++)
2205                     g_print ("%s \n", symlinks[n]);
2206                 }
2207             }
2208           g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2209           g_list_free (objects);
2210         }
2211       goto out;
  • Found 30 duplicate lines in the following files:
    • Between lines 612 and 655 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 742 and 785 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
612   object = udisks_daemon_util_dup_object (group, &error);
613   if (object == NULL)
614     {
615       g_dbus_method_invocation_take_error (invocation, error);
616       goto out;
617     }
618 
619   daemon = udisks_linux_volume_group_object_get_daemon (object);
620 
621   error = NULL;
622   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
623                                                invocation,
624                                                NULL /* GCancellable */,
625                                                &caller_uid,
626                                                &caller_gid,
627                                                NULL,
628                                                &error))
629     {
630       g_dbus_method_invocation_return_gerror (invocation, error);
631       g_clear_error (&error);
632       goto out;
633     }
634 
635   member_device_object = udisks_daemon_find_object (daemon, member_device_objpath);
636   if (member_device_object == NULL)
637     {
638       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
639                                              "No device for given object path");
640       goto out;
641     }
642 
643   member_device = udisks_object_get_block (member_device_object);
644   if (member_device == NULL)
645     {
646       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
647                                              "No block interface on given object");
648       goto out;
649     }
650 
651   /* Policy check. */
652   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
653                                      UDISKS_OBJECT (object),
654                                      lvm2_policy_action_id,
655                                      options,
  • Found 28 duplicate lines in the following files:
    • Between lines 1150 and 1184 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1039 and 1073 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
1150   if (!udisks_daemon_launch_spawned_job_sync (daemon,
1151                                               UDISKS_OBJECT (object),
1152                                               "lvm-vg-create-volume", caller_uid,
1153                                               NULL, /* GCancellable */
1154                                               0,    /* uid_t run_as_uid */
1155                                               0,    /* uid_t run_as_euid */
1156                                               NULL, /* gint *out_status */
1157                                               &error_message,
1158                                               NULL,  /* input_string */
1159                                               "%s", cmd->str))
1160     {
1161       g_dbus_method_invocation_return_error (invocation,
1162                                              UDISKS_ERROR,
1163                                              UDISKS_ERROR_FAILED,
1164                                              "Error creating volume: %s",
1165                                              error_message);
1166       goto out;
1167     }
1168 
1169   lv_objpath = wait_for_logical_volume_path (object, arg_name, &error);
1170   if (lv_objpath == NULL)
1171     {
1172       g_prefix_error (&error,
1173                       "Error waiting for logical volume object for %s",
1174                       arg_name);
1175       g_dbus_method_invocation_take_error (invocation, error);
1176       goto out;
1177     }
1178 
1179   udisks_volume_group_complete_create_thin_pool_volume (_group, invocation, lv_objpath);
1180 
1181  out:
1182   g_free (error_message);
1183   g_free (escaped_volume_name);
1184   g_free (escaped_group_name);
  • Found 26 duplicate lines in the following files:
    • Between lines 188 and 231 in /home/tasleson/projects/udisks/src/udisksmountmonitor.c
    • Between lines 167 and 210 in /home/tasleson/projects/udisks/src/udiskscrypttabmonitor.c
    • Between lines 168 and 211 in /home/tasleson/projects/udisks/src/udisksfstabmonitor.c
188 static void
189 diff_sorted_lists (GList *list1,
190                    GList *list2,
191                    GCompareFunc compare,
192                    GList **added,
193                    GList **removed)
194 {
195   int order;
196 
197   *added = *removed = NULL;
198 
199   while (list1 != NULL && list2 != NULL)
200     {
201       order = (*compare) (list1->data, list2->data);
202       if (order < 0)
203         {
204           *removed = g_list_prepend (*removed, list1->data);
205           list1 = list1->next;
206         }
207       else if (order > 0)
208         {
209           *added = g_list_prepend (*added, list2->data);
210           list2 = list2->next;
211         }
212       else
213         { /* same item */
214           list1 = list1->next;
215           list2 = list2->next;
216         }
217     }
218 
219   while (list1 != NULL)
220     {
221       *removed = g_list_prepend (*removed, list1->data);
222       list1 = list1->next;
223     }
224   while (list2 != NULL)
225     {
226       *added = g_list_prepend (*added, list2->data);
227       list2 = list2->next;
228     }
229 }
230 
231 static void
  • Found 23 duplicate lines in the following files:
    • Between lines 2290 and 2320 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 2383 and 2413 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
2290   object = udisks_daemon_util_dup_object (drive, &error);
2291   if (object == NULL)
2292     {
2293       g_dbus_method_invocation_take_error (invocation, error);
2294       goto out;
2295     }
2296 
2297   block_object = udisks_linux_drive_object_get_block (object, FALSE);
2298   if (block_object == NULL)
2299     {
2300       g_dbus_method_invocation_return_error (invocation,
2301                                              UDISKS_ERROR,
2302                                              UDISKS_ERROR_FAILED,
2303                                              "Unable to find block device for drive");
2304       goto out;
2305     }
2306 
2307   daemon = udisks_linux_drive_object_get_daemon (object);
2308 
2309   error = NULL;
2310   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
2311                                                invocation,
2312                                                NULL /* GCancellable */,
2313                                                &caller_uid,
2314                                                &caller_gid,
2315                                                NULL,
2316                                                &error))
2317     {
2318       g_dbus_method_invocation_return_gerror (invocation, error);
2319       g_clear_error (&error);
2320       goto out;
  • Found 23 duplicate lines in the following files:
    • Between lines 923 and 949 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1039 and 1065 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1150 and 1176 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
923   if (!udisks_daemon_launch_spawned_job_sync (daemon,
924                                               UDISKS_OBJECT (object),
925                                               "lvm-vg-create-volume", caller_uid,
926                                               NULL, /* GCancellable */
927                                               0,    /* uid_t run_as_uid */
928                                               0,    /* uid_t run_as_euid */
929                                               NULL, /* gint *out_status */
930                                               &error_message,
931                                               NULL,  /* input_string */
932                                               "%s", cmd->str))
933     {
934       g_dbus_method_invocation_return_error (invocation,
935                                              UDISKS_ERROR,
936                                              UDISKS_ERROR_FAILED,
937                                              "Error creating volume: %s",
938                                              error_message);
939       goto out;
940     }
941 
942   lv_objpath = wait_for_logical_volume_path (object, arg_name, &error);
943   if (lv_objpath == NULL)
944     {
945       g_prefix_error (&error,
946                       "Error waiting for logical volume object for %s",
947                       arg_name);
948       g_dbus_method_invocation_take_error (invocation, error);
949       goto out;
  • Found 23 duplicate lines in the following files:
    • Between lines 3334 and 3363 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3398 and 3427 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
3334                         GDBusMethodInvocation *invocation,
3335                         GUnixFDList           *fd_list,
3336                         GVariant              *options)
3337 {
3338   UDisksObject *object;
3339   UDisksDaemon *daemon;
3340   const gchar *action_id;
3341   const gchar *device;
3342   GUnixFDList *out_fd_list = NULL;
3343   GError *error;
3344   gint fd;
3345 
3346   error = NULL;
3347   object = udisks_daemon_util_dup_object (block, &error);
3348   if (object == NULL)
3349     {
3350       g_dbus_method_invocation_take_error (invocation, error);
3351       goto out;
3352     }
3353 
3354   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
3355 
3356   action_id = "org.freedesktop.udisks2.open-device";
3357   if (udisks_block_get_hint_system (block))
3358     action_id = "org.freedesktop.udisks2.open-device-system";
3359 
3360   if (!udisks_daemon_util_check_authorization_sync (daemon,
3361                                                     object,
3362                                                     action_id,
3363                                                     options,
  • Found 22 duplicate lines in the following files:
    • Between lines 1099 and 1129 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 981 and 1011 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 881 and 911 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
1099   GString *cmd = NULL;
1100   gchar *error_message = NULL;
1101   const gchar *lv_objpath;
1102 
1103   object = udisks_daemon_util_dup_object (group, &error);
1104   if (object == NULL)
1105     {
1106       g_dbus_method_invocation_take_error (invocation, error);
1107       goto out;
1108     }
1109 
1110   daemon = udisks_linux_volume_group_object_get_daemon (object);
1111 
1112   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1113                                                invocation,
1114                                                NULL /* GCancellable */,
1115                                                &caller_uid,
1116                                                &caller_gid,
1117                                                NULL,
1118                                                &error))
1119     {
1120       g_dbus_method_invocation_return_gerror (invocation, error);
1121       g_clear_error (&error);
1122       goto out;
1123     }
1124 
1125   /* Policy check. */
1126   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
1127                                      UDISKS_OBJECT (object),
1128                                      lvm2_policy_action_id,
1129                                      options,
  • Found 21 duplicate lines in the following files:
    • Between lines 917 and 945 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1141 and 1169 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
917   GError *error;
918 
919   error = NULL;
920   object = udisks_daemon_util_dup_object (drive, &error);
921   if (object == NULL)
922     {
923       g_dbus_method_invocation_take_error (invocation, error);
924       goto out;
925     }
926 
927   daemon = udisks_linux_drive_object_get_daemon (object);
928   block_object = udisks_linux_drive_object_get_block (object, TRUE);
929   if (block_object == NULL)
930     {
931       g_dbus_method_invocation_return_error (invocation,
932                                              UDISKS_ERROR,
933                                              UDISKS_ERROR_FAILED,
934                                              "Unable to find physical block device for drive");
935       goto out;
936     }
937 
938   if (!udisks_drive_ata_get_smart_supported (UDISKS_DRIVE_ATA (drive)) ||
939       !udisks_drive_ata_get_smart_enabled (UDISKS_DRIVE_ATA (drive)))
940     {
941       g_dbus_method_invocation_return_error (invocation,
942                                              UDISKS_ERROR,
943                                              UDISKS_ERROR_FAILED,
944                                              "SMART is not supported or enabled");
945       goto out;
  • Found 21 duplicate lines in the following files:
    • Between lines 1825 and 1852 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1902 and 1929 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1825                                GDBusMethodInvocation *invocation,
1826                                GVariant              *item,
1827                                GVariant              *options)
1828 {
1829   UDisksLinuxBlock *block = UDISKS_LINUX_BLOCK (_block);
1830   UDisksLinuxBlockObject *object;
1831   UDisksDaemon *daemon;
1832   const gchar *type;
1833   GVariant *details = NULL;
1834   GError *error;
1835 
1836   error = NULL;
1837   object = udisks_daemon_util_dup_object (block, &error);
1838   if (object == NULL)
1839     {
1840       g_dbus_method_invocation_take_error (invocation, error);
1841       goto out;
1842     }
1843 
1844   daemon = udisks_linux_block_object_get_daemon (object);
1845 
1846   g_variant_get (item, "(&s@a{sv})", &type, &details);
1847   if (g_strcmp0 (type, "fstab") == 0)
1848     {
1849       if (!udisks_daemon_util_check_authorization_sync (daemon,
1850                                                         NULL,
1851                                                         "org.freedesktop.udisks2.modify-system-configuration",
1852                                                         options,
  • Found 20 duplicate lines in the following files:
    • Between lines 596 and 620 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 2068 and 2093 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
596 static gchar *
597 subst_str (const gchar *str,
598            const gchar *from,
599            const gchar *to)
600 {
601     gchar **parts;
602     gchar *result;
603 
604     parts = g_strsplit (str, from, 0);
605     result = g_strjoinv (to, parts);
606     g_strfreev (parts);
607     return result;
608 }
609 
610 static gchar *
611 subst_str_and_escape (const gchar *str,
612                       const gchar *from,
613                       const gchar *to)
614 {
615   gchar *quoted_and_escaped;
616   gchar *ret;
617   quoted_and_escaped = udisks_daemon_util_escape_and_quote (to);
618   ret = subst_str (str, from, quoted_and_escaped);
619   g_free (quoted_and_escaped);
620   return ret;
  • Found 20 duplicate lines in the following files:
    • Between lines 1865 and 1899 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1520 and 1554 in /home/tasleson/projects/udisks/tools/udisksctl.c
1865                                      NULL /* GETTEXT_PACKAGE*/);
1866 
1867   complete_objects = FALSE;
1868   if (request_completion && (g_strcmp0 (completion_prev, "--object-path") == 0 || g_strcmp0 (completion_prev, "-p") == 0))
1869     {
1870       complete_objects = TRUE;
1871       remove_arg ((*argc) - 1, argc, argv);
1872     }
1873 
1874   complete_devices = FALSE;
1875   if (request_completion && (g_strcmp0 (completion_prev, "--block-device") == 0 || g_strcmp0 (completion_prev, "-b") == 0))
1876     {
1877       complete_devices = TRUE;
1878       remove_arg ((*argc) - 1, argc, argv);
1879     }
1880 
1881   complete_files = FALSE;
1882   if (request_completion && (g_strcmp0 (completion_prev, "--file") == 0 || g_strcmp0 (completion_prev, "-f") == 0))
1883     {
1884       complete_files = TRUE;
1885       remove_arg ((*argc) - 1, argc, argv);
1886     }
1887 
1888   if (!g_option_context_parse (o, argc, argv, NULL))
1889     {
1890       if (!request_completion)
1891         {
1892           s = g_option_context_get_help (o, FALSE, NULL);
1893           g_printerr ("%s", s);
1894           g_free (s);
1895           goto out;
1896         }
1897     }
1898 
1899   if (request_completion)
  • Found 19 duplicate lines in the following files:
    • Between lines 382 and 408 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 517 and 543 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 617 and 643 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 750 and 776 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 850 and 876 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 938 and 964 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
382   object = udisks_daemon_util_dup_object (volume, &error);
383   if (object == NULL)
384     {
385       g_dbus_method_invocation_take_error (invocation, error);
386       goto out;
387     }
388 
389   daemon = udisks_linux_logical_volume_object_get_daemon (object);
390 
391   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
392                                                invocation,
393                                                NULL /* GCancellable */,
394                                                &caller_uid,
395                                                &caller_gid,
396                                                NULL,
397                                                &error))
398     {
399       g_dbus_method_invocation_return_gerror (invocation, error);
400       g_clear_error (&error);
401       goto out;
402     }
403 
404   /* Policy check. */
405   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
406                                      UDISKS_OBJECT (object),
407                                      lvm2_policy_action_id,
408                                      options,
  • Found 19 duplicate lines in the following files:
    • Between lines 942 and 969 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 877 and 904 in /home/tasleson/projects/udisks/udisks/udisksclient.c
942   GList *l, *object_proxies = NULL;
943   GDBusObject *raid_object;
944   const gchar *raid_objpath;
945 
946   g_return_val_if_fail (UDISKS_IS_CLIENT (client), NULL);
947   g_return_val_if_fail (UDISKS_IS_MDRAID (raid), NULL);
948 
949   raid_object = g_dbus_interface_get_object (G_DBUS_INTERFACE (raid));
950   if (raid_object == NULL)
951     goto out;
952 
953   raid_objpath = g_dbus_object_get_object_path (raid_object);
954 
955   object_proxies = g_dbus_object_manager_get_objects (client->object_manager);
956   for (l = object_proxies; l != NULL; l = l->next)
957     {
958       UDisksObject *object = UDISKS_OBJECT (l->data);
959       UDisksBlock *block;
960 
961       block = udisks_object_get_block (object);
962       if (block == NULL)
963         continue;
964 
965       /* ignore partitions */
966       if (udisks_object_peek_partition (object) != NULL)
967         continue;
968 
969       if (g_strcmp0 (udisks_block_get_mdraid (block), raid_objpath) == 0)
  • Found 19 duplicate lines in the following files:
    • Between lines 391 and 417 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 885 and 911 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 985 and 1011 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1103 and 1129 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
391   object = udisks_daemon_util_dup_object (group, &error);
392   if (object == NULL)
393     {
394       g_dbus_method_invocation_take_error (invocation, error);
395       goto out;
396     }
397 
398   daemon = udisks_linux_volume_group_object_get_daemon (object);
399 
400   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
401                                                invocation,
402                                                NULL /* GCancellable */,
403                                                &caller_uid,
404                                                &caller_gid,
405                                                NULL,
406                                                &error))
407     {
408       g_dbus_method_invocation_return_gerror (invocation, error);
409       g_clear_error (&error);
410       goto out;
411     }
412 
413   /* Policy check. */
414   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
415                                      UDISKS_OBJECT (object),
416                                      lvm2_policy_action_id,
417                                      options,
  • Found 19 duplicate lines in the following files:
    • Between lines 1051 and 1078 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 1156 and 1182 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
1051   gchar *error_message;
1052 
1053   object = udisks_daemon_util_dup_object (volume, &error);
1054   if (object == NULL)
1055     {
1056       g_dbus_method_invocation_take_error (invocation, error);
1057       goto out;
1058     }
1059 
1060 
1061   daemon = udisks_linux_logical_volume_object_get_daemon (object);
1062 
1063   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1064                                                  invocation,
1065                                                  NULL /* GCancellable */,
1066                                                  &caller_uid,
1067                                                  NULL,
1068                                                  NULL,
1069                                                  &error))
1070     {
1071       g_dbus_method_invocation_take_error (invocation, error);
1072       goto out;
1073     }
1074 
1075   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
1076                                        UDISKS_OBJECT (object),
1077                                        lvm2_policy_action_id,
1078                                        options,
  • Found 18 duplicate lines in the following files:
    • Between lines 1409 and 1431 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 2439 and 2461 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1409   if (!udisks_daemon_util_check_authorization_sync (daemon,
1410                                                     UDISKS_OBJECT (object),
1411                                                     action_id,
1412                                                     options,
1413                                                     message,
1414                                                     invocation))
1415     goto out;
1416 
1417   device = udisks_linux_drive_object_get_device (object, TRUE /* get_hw */);
1418   if (device == NULL)
1419     {
1420       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1421                                              "No udev device");
1422       goto out;
1423     }
1424 
1425   fd = open (g_udev_device_get_device_file (device->udev_device), O_RDONLY|O_NONBLOCK);
1426   if (fd == -1)
1427     {
1428       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1429                                              "Error opening device file %s: %m",
1430                                              g_udev_device_get_device_file (device->udev_device));
1431       goto out;
  • Found 18 duplicate lines in the following files:
    • Between lines 1001 and 1025 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 939 and 963 in /home/tasleson/projects/udisks/udisks/udisksclient.c
1001                                       UDisksMDRaid *raid)
1002 {
1003   GList *ret = NULL;
1004   GList *l, *object_proxies = NULL;
1005   GDBusObject *raid_object;
1006   const gchar *raid_objpath;
1007 
1008   g_return_val_if_fail (UDISKS_IS_CLIENT (client), NULL);
1009   g_return_val_if_fail (UDISKS_IS_MDRAID (raid), NULL);
1010 
1011   raid_object = g_dbus_interface_get_object (G_DBUS_INTERFACE (raid));
1012   if (raid_object == NULL)
1013     goto out;
1014 
1015   raid_objpath = g_dbus_object_get_object_path (raid_object);
1016 
1017   object_proxies = g_dbus_object_manager_get_objects (client->object_manager);
1018   for (l = object_proxies; l != NULL; l = l->next)
1019     {
1020       UDisksObject *object = UDISKS_OBJECT (l->data);
1021       UDisksBlock *block;
1022 
1023       block = udisks_object_get_block (object);
1024       if (block == NULL)
1025         continue;
  • Found 18 duplicate lines in the following files:
    • Between lines 1027 and 1048 in /home/tasleson/projects/udisks/src/udisksdaemonutil.c
    • Between lines 924 and 945 in /home/tasleson/projects/udisks/src/udisksdaemonutil.c
1027                                        g_variant_new ("(s)", caller),
1028                                        G_VARIANT_TYPE ("(u)"),
1029                                        G_DBUS_CALL_FLAGS_NONE,
1030                                        -1, /* timeout_msec */
1031                                        cancellable,
1032                                        &local_error);
1033   if (value == NULL)
1034     {
1035       g_set_error (error,
1036                    UDISKS_ERROR,
1037                    UDISKS_ERROR_FAILED,
1038                    "Error determining uid of caller %s: %s (%s, %d)",
1039                    caller,
1040                    local_error->message,
1041                    g_quark_to_string (local_error->domain),
1042                    local_error->code);
1043       g_clear_error (&local_error);
1044       goto out;
1045     }
1046 
1047   {
1048     G_STATIC_ASSERT (sizeof (uid_t) == sizeof (guint32));
  • Found 18 duplicate lines in the following files:
    • Between lines 1460 and 1483 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1340 and 1363 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1209 and 1232 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1460   UDisksBaseJob *job = NULL;
1461 
1462   object = udisks_daemon_util_dup_object (mdraid, &error);
1463   if (object == NULL)
1464     {
1465       g_dbus_method_invocation_take_error (invocation, error);
1466       goto out;
1467     }
1468 
1469   daemon = udisks_linux_mdraid_object_get_daemon (object);
1470   state = udisks_daemon_get_state (daemon);
1471 
1472   error = NULL;
1473   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1474                                                invocation,
1475                                                NULL /* GCancellable */,
1476                                                &caller_uid,
1477                                                &caller_gid,
1478                                                NULL,
1479                                                &error))
1480     {
1481       g_dbus_method_invocation_return_gerror (invocation, error);
1482       g_clear_error (&error);
1483       goto out;
  • Found 17 duplicate lines in the following files:
    • Between lines 1398 and 1422 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1532 and 1556 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1398   action_id = "org.freedesktop.udisks2.ata-standby";
1399   if (udisks_block_get_hint_system (block))
1400     {
1401       action_id = "org.freedesktop.udisks2.ata-standby-system";
1402     }
1403   else if (!udisks_daemon_util_on_user_seat (daemon, UDISKS_OBJECT (object), caller_uid))
1404     {
1405       action_id = "org.freedesktop.udisks2.ata-standby-other-seat";
1406     }
1407 
1408   /* Check that the user is authorized */
1409   if (!udisks_daemon_util_check_authorization_sync (daemon,
1410                                                     UDISKS_OBJECT (object),
1411                                                     action_id,
1412                                                     options,
1413                                                     message,
1414                                                     invocation))
1415     goto out;
1416 
1417   device = udisks_linux_drive_object_get_device (object, TRUE /* get_hw */);
1418   if (device == NULL)
1419     {
1420       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1421                                              "No udev device");
1422       goto out;
  • Found 17 duplicate lines in the following files:
    • Between lines 491 and 513 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 610 and 632 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
491   gchar *escaped_name = NULL;
492 
493   object = udisks_daemon_util_dup_object (group, &error);
494   if (object == NULL)
495     {
496       g_dbus_method_invocation_take_error (invocation, error);
497       goto out;
498     }
499 
500   daemon = udisks_linux_volume_group_object_get_daemon (object);
501 
502   error = NULL;
503   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
504                                                invocation,
505                                                NULL /* GCancellable */,
506                                                &caller_uid,
507                                                &caller_gid,
508                                                NULL,
509                                                &error))
510     {
511       g_dbus_method_invocation_return_gerror (invocation, error);
512       g_clear_error (&error);
513       goto out;
  • Found 17 duplicate lines in the following files:
    • Between lines 516 and 538 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
    • Between lines 371 and 393 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
516   g_return_val_if_fail (object != NULL, FALSE);
517   g_return_val_if_fail (has_func != NULL, FALSE);
518   g_return_val_if_fail (update_func != NULL, FALSE);
519   g_return_val_if_fail (g_type_is_a (skeleton_type, G_TYPE_OBJECT), FALSE);
520   g_return_val_if_fail (g_type_is_a (skeleton_type, G_TYPE_DBUS_INTERFACE), FALSE);
521   g_return_val_if_fail (interface_pointer != NULL, FALSE);
522   g_return_val_if_fail (*interface_pointer == NULL || G_IS_DBUS_INTERFACE (*interface_pointer), FALSE);
523 
524   add = FALSE;
525   has = has_func (object);
526   if (*interface_pointer == NULL)
527     {
528       if (has)
529         {
530           *interface_pointer = g_object_new (skeleton_type, NULL);
531           if (connect_func != NULL)
532             connect_func (object);
533           add = TRUE;
534         }
535     }
536   else
537     {
538       if (!has)
  • Found 16 duplicate lines in the following files:
    • Between lines 1716 and 1736 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1622 and 1642 in /home/tasleson/projects/udisks/src/udisksstate.c
1716   error = NULL;
1717   value = udisks_state_get (state,
1718                             "loop",
1719                             G_VARIANT_TYPE ("a{sa{sv}}"),
1720                             &error);
1721   if (error != NULL)
1722     {
1723       udisks_warning ("Error getting loop: %s (%s, %d)",
1724                       error->message, g_quark_to_string (error->domain), error->code);
1725       g_clear_error (&error);
1726       goto out;
1727     }
1728 
1729   /* start by including existing entries */
1730   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sa{sv}}"));
1731   if (value != NULL)
1732     {
1733       GVariantIter iter;
1734       GVariant *child;
1735       g_variant_iter_init (&iter, value);
1736       while ((child = g_variant_iter_next_value (&iter)) != NULL)
  • Found 16 duplicate lines in the following files:
    • Between lines 181 and 197 in /home/tasleson/projects/udisks/src/udisksata.c
    • Between lines 144 and 160 in /home/tasleson/projects/udisks/src/udisksata.c
181       switch (protocol)
182         {
183         case UDISKS_ATA_COMMAND_PROTOCOL_NONE:
184           cdb[1] = 3 << 1;                  /* PROTOCOL: Non-data */
185           cdb[2] = 0x20;                    /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=0, T_LENGTH=0 */
186           break;
187         case UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST:
188           cdb[1] = 4 << 1;                  /* PROTOCOL: PIO Data-In */
189           cdb[2] = 0x2e;                    /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */
190           break;
191         case UDISKS_ATA_COMMAND_PROTOCOL_HOST_TO_DRIVE:
192           cdb[1] = 5 << 1;                  /* PROTOCOL: PIO Data-Out */
193           cdb[2] = 0x26;                    /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=1, T_LENGTH=2 */
194           break;
195         default:
196           g_assert_not_reached ();
197           break;
  • Found 16 duplicate lines in the following files:
    • Between lines 300 and 324 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
    • Between lines 195 and 214 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
300   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
301 
302   error = NULL;
303   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
304                                                invocation,
305                                                NULL /* GCancellable */,
306                                                &caller_uid,
307                                                &caller_gid,
308                                                NULL,
309                                                &error))
310     {
311       g_dbus_method_invocation_return_gerror (invocation, error);
312       g_clear_error (&error);
313       goto out;
314     }
315 
316   /* Now, check that the user is actually authorized to stop the swap space.
317    *
318    * TODO: want nicer authentication message + special treatment if the
319    * uid that locked the device (e.g. w/o -others).
320    */
321   if (!udisks_daemon_util_check_authorization_sync (daemon,
322                                                     object,
323                                                     "org.freedesktop.udisks2.manage-swapspace",
324                                                     options,
  • Found 16 duplicate lines in the following files:
    • Between lines 2054 and 2074 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1968 and 1988 in /home/tasleson/projects/udisks/src/udisksstate.c
2054   error = NULL;
2055   value = udisks_state_get (state,
2056                             "mdraid",
2057                             G_VARIANT_TYPE ("a{ta{sv}}"),
2058                             &error);
2059   if (error != NULL)
2060     {
2061       udisks_warning ("Error getting mdraid: %s (%s, %d)",
2062                       error->message, g_quark_to_string (error->domain), error->code);
2063       g_clear_error (&error);
2064       goto out;
2065     }
2066 
2067   /* start by including existing entries */
2068   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ta{sv}}"));
2069   if (value != NULL)
2070     {
2071       GVariantIter iter;
2072       GVariant *child;
2073       g_variant_iter_init (&iter, value);
2074       while ((child = g_variant_iter_next_value (&iter)) != NULL)
  • Found 16 duplicate lines in the following files:
    • Between lines 875 and 896 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 782 and 802 in /home/tasleson/projects/udisks/src/udisksstate.c
875   error = NULL;
876   value = udisks_state_get (state,
877                             "mounted-fs",
878                             G_VARIANT_TYPE ("a{sa{sv}}"),
879                             &error);
880   if (error != NULL)
881     {
882       udisks_warning ("Error getting mounted-fs: %s (%s, %d)",
883                       error->message, g_quark_to_string (error->domain), error->code);
884       g_clear_error (&error);
885       goto out;
886     }
887 
888   /* start by including existing entries */
889   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sa{sv}}"));
890   if (value != NULL)
891     {
892       GVariantIter iter;
893       GVariant *child;
894 
895       g_variant_iter_init (&iter, value);
896       while ((child = g_variant_iter_next_value (&iter)) != NULL)
  • Found 16 duplicate lines in the following files:
    • Between lines 1133 and 1160 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 626 and 653 in /home/tasleson/projects/udisks/tools/udisksctl.c
1133                                      NULL /* GETTEXT_PACKAGE*/);
1134 
1135   complete_objects = FALSE;
1136   if (request_completion && (g_strcmp0 (completion_prev, "--object-path") == 0 || g_strcmp0 (completion_prev, "-p") == 0))
1137     {
1138       complete_objects = TRUE;
1139       remove_arg ((*argc) - 1, argc, argv);
1140     }
1141 
1142   complete_devices = FALSE;
1143   if (request_completion && (g_strcmp0 (completion_prev, "--block-device") == 0 || g_strcmp0 (completion_prev, "-b") == 0))
1144     {
1145       complete_devices = TRUE;
1146       remove_arg ((*argc) - 1, argc, argv);
1147     }
1148 
1149   if (!g_option_context_parse (o, argc, argv, NULL))
1150     {
1151       if (!request_completion)
1152         {
1153           s = g_option_context_get_help (o, FALSE, NULL);
1154           g_printerr ("%s", s);
1155           g_free (s);
1156           goto out;
1157         }
1158     }
1159 
1160   if (request_completion &&
  • Found 16 duplicate lines in the following files:
    • Between lines 738 and 787 in /home/tasleson/projects/udisks/src/udisksdaemon.c
    • Between lines 666 and 716 in /home/tasleson/projects/udisks/src/udisksdaemon.c
738   if (object != NULL)
739     udisks_base_job_add_object (UDISKS_BASE_JOB (job), object);
740 
741   job_object_path = g_strdup_printf ("/org/freedesktop/UDisks2/jobs/%u", g_atomic_int_add (&job_id, 1));
742   job_object = udisks_object_skeleton_new (job_object_path);
743   udisks_object_skeleton_set_job (job_object, UDISKS_JOB (job));
744   g_free (job_object_path);
745 
746   udisks_job_set_cancelable (UDISKS_JOB (job), TRUE);
747   udisks_job_set_operation (UDISKS_JOB (job), job_operation);
748   udisks_job_set_started_by_uid (UDISKS_JOB (job), job_started_by_uid);
749 
750   g_dbus_object_manager_server_export (daemon->object_manager, G_DBUS_OBJECT_SKELETON (job_object));
751   g_signal_connect_after (job,
752                           "completed",
753                           G_CALLBACK (on_job_completed),
754                           g_object_ref (daemon));
755 
756   return UDISKS_BASE_JOB (job);
757 }
758 
759 /* ---------------------------------------------------------------------------------------------------- */
760 
761 /**
762  * udisks_daemon_launch_spawned_job:
763  * @daemon: A #UDisksDaemon.
764  * @object: (allow-none): A #UDisksObject to add to the job or %NULL.
765  * @job_operation: The operation for the job.
766  * @job_started_by_uid: The user who started the job.
767  * @cancellable: A #GCancellable or %NULL.
768  * @run_as_uid: The #uid_t to run the command as.
769  * @run_as_euid: The effective #uid_t to run the command as.
770  * @input_string: A string to write to stdin of the spawned program or %NULL.
771  * @command_line_format: printf()-style format for the command line to spawn.
772  * @...: Arguments for @command_line_format.
773  *
774  * Launches a new job for @command_line_format.
775  *
776  * The job is started immediately - connect to the
777  * #UDisksSpawnedJob::spawned-job-completed or #UDisksJob::completed
778  * signals to get notified when the job is done.
779  *
780  * The returned object will be exported on the bus until the
781  * #UDisksJob::completed signal is emitted on the object. It is not
782  * valid to use the returned object after this signal fires.
783  *
784  * Returns: A #UDisksSpawnedJob object. Do not free, the object
785  * belongs to @manager.
786  */
787 UDisksBaseJob *
  • Found 16 duplicate lines in the following files:
    • Between lines 1060 and 1079 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1221 and 1240 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1060   error = NULL;
1061   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1062                                                invocation,
1063                                                NULL /* GCancellable */,
1064                                                &caller_uid,
1065                                                &caller_gid,
1066                                                NULL,
1067                                                &error))
1068     {
1069       g_dbus_method_invocation_return_gerror (invocation, error);
1070       g_clear_error (&error);
1071       goto out;
1072     }
1073 
1074   raid_device = udisks_linux_mdraid_object_get_device (object);
1075   if (raid_device == NULL)
1076     {
1077       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1078                                              "RAID Array is not running");
1079       goto out;
  • Found 16 duplicate lines in the following files:
    • Between lines 1336 and 1356 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1243 and 1263 in /home/tasleson/projects/udisks/src/udisksstate.c
1336   error = NULL;
1337   value = udisks_state_get (state,
1338                             "unlocked-luks",
1339                             G_VARIANT_TYPE ("a{ta{sv}}"),
1340                             &error);
1341   if (error != NULL)
1342     {
1343       udisks_warning ("Error getting unlocked-luks: %s (%s, %d)",
1344                       error->message, g_quark_to_string (error->domain), error->code);
1345       g_clear_error (&error);
1346       goto out;
1347     }
1348 
1349   /* start by including existing entries */
1350   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ta{sv}}"));
1351   if (value != NULL)
1352     {
1353       GVariantIter iter;
1354       GVariant *child;
1355       g_variant_iter_init (&iter, value);
1356       while ((child = g_variant_iter_next_value (&iter)) != NULL)
  • Found 15 duplicate lines in the following files:
    • Between lines 626 and 649 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1133 and 1156 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2135 and 2158 in /home/tasleson/projects/udisks/tools/udisksctl.c
626                                      NULL /* GETTEXT_PACKAGE*/);
627 
628   complete_objects = FALSE;
629   if (request_completion && (g_strcmp0 (completion_prev, "--object-path") == 0 || g_strcmp0 (completion_prev, "-p") == 0))
630     {
631       complete_objects = TRUE;
632       remove_arg ((*argc) - 1, argc, argv);
633     }
634 
635   complete_devices = FALSE;
636   if (request_completion && (g_strcmp0 (completion_prev, "--block-device") == 0 || g_strcmp0 (completion_prev, "-b") == 0))
637     {
638       complete_devices = TRUE;
639       remove_arg ((*argc) - 1, argc, argv);
640     }
641 
642   if (!g_option_context_parse (o, argc, argv, NULL))
643     {
644       if (!request_completion)
645         {
646           s = g_option_context_get_help (o, FALSE, NULL);
647           g_printerr ("%s", s);
648           g_free (s);
649           goto out;
  • Found 15 duplicate lines in the following files:
    • Between lines 612 and 629 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 673 and 690 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
612               GDBusMethodInvocation       *invocation,
613               const gchar                 *arg_name,
614               gint                         arg_tpgt,
615               const gchar                 *arg_address,
616               gint                         arg_port,
617               const gchar                 *arg_iface,
618               GVariant                    *arg_options)
619 {
620   UDisksLinuxManagerISCSIInitiator *manager = UDISKS_LINUX_MANAGER_ISCSI_INITIATOR (object);
621   UDisksISCSIState *state = udisks_linux_manager_iscsi_initiator_get_state (manager);
622   gint err = 0;
623   gchar *errorstr = NULL;
624 
625   /* Policy check. */
626   UDISKS_DAEMON_CHECK_AUTHORIZATION (manager->daemon,
627                                      NULL,
628                                      iscsi_policy_action_id,
629                                      arg_options,
  • Found 15 duplicate lines in the following files:
    • Between lines 379 and 402 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
    • Between lines 395 and 418 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
379   add = FALSE;
380   has = has_func (object);
381   if (*interface_pointer == NULL)
382     {
383       if (has)
384         {
385           *interface_pointer = g_object_new (skeleton_type, NULL);
386           if (connect_func != NULL)
387             connect_func (object);
388           add = TRUE;
389         }
390     }
391   else
392     {
393       if (!has)
394         {
395           g_dbus_object_skeleton_remove_interface (G_DBUS_OBJECT_SKELETON (object),
396                                                    G_DBUS_INTERFACE_SKELETON (*interface_pointer));
397           g_object_unref (*interface_pointer);
398           *interface_pointer = NULL;
399         }
400     }
401 
402   if (*interface_pointer != NULL)
  • Found 15 duplicate lines in the following files:
    • Between lines 226 and 252 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 1025 and 1048 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
226 static gboolean
227 has_option (const gchar *options,
228             const gchar *option)
229 {
230   gboolean ret = FALSE;
231   gchar **tokens;
232   guint n;
233 
234   tokens = g_strsplit (options, ",", -1);
235   for (n = 0; tokens != NULL && tokens[n] != NULL; n++)
236     {
237       if (g_strcmp0 (tokens[n], option) == 0)
238         {
239           ret = TRUE;
240           goto out;
241         }
242     }
243   g_strfreev (tokens);
244 
245  out:
246   return ret;
247 }
248 
249 /* ---------------------------------------------------------------------------------------------------- */
250 
251 /* runs in thread dedicated to handling @invocation */
252 static gboolean
  • Found 15 duplicate lines in the following files:
    • Between lines 484 and 517 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 580 and 613 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
484       else
485         {
486           /* ignore non-device entries */
487           goto continue_loop;
488         }
489 
490       if (device != NULL)
491         {
492           if (g_strcmp0 (device, udisks_block_get_device (UDISKS_BLOCK (block))) == 0)
493             {
494               ret = g_list_prepend (ret, g_object_ref (entry));
495             }
496           else
497             {
498               symlinks = udisks_block_get_symlinks (UDISKS_BLOCK (block));
499               if (symlinks != NULL)
500                 {
501                   for (n = 0; symlinks[n] != NULL; n++)
502                     {
503                       if (g_strcmp0 (device, symlinks[n]) == 0)
504                         {
505                           ret = g_list_prepend (ret, g_object_ref (entry));
506                         }
507                     }
508                 }
509             }
510         }
511       else if (label != NULL && g_strcmp0 (label, udisks_block_get_id_label (UDISKS_BLOCK (block))) == 0)
512         {
513           ret = g_list_prepend (ret, g_object_ref (entry));
514         }
515       else if (uuid != NULL && g_strcmp0 (uuid, udisks_block_get_id_uuid (UDISKS_BLOCK (block))) == 0)
516         {
517           ret = g_list_prepend (ret, g_object_ref (entry));
  • Found 14 duplicate lines in the following files:
    • Between lines 1428 and 1454 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 1250 and 1276 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
1428   action_id = "org.freedesktop.udisks2.filesystem-mount";
1429   /* Translators: Shown in authentication dialog when the user
1430    * requests mounting a filesystem.
1431    *
1432    * Do not translate $(drive), it's a placeholder and
1433    * will be replaced by the name of the drive/device in question
1434    */
1435   message = N_("Authentication is required to mount $(drive)");
1436   if (!udisks_daemon_util_setup_by_user (daemon, object, caller_uid))
1437     {
1438       if (udisks_block_get_hint_system (block))
1439         {
1440           action_id = "org.freedesktop.udisks2.filesystem-mount-system";
1441         }
1442       else if (!udisks_daemon_util_on_user_seat (daemon, object, caller_uid))
1443         {
1444           action_id = "org.freedesktop.udisks2.filesystem-mount-other-seat";
1445         }
1446     }
1447 
1448   if (!udisks_daemon_util_check_authorization_sync (daemon,
1449                                                     object,
1450                                                     action_id,
1451                                                     options,
1452                                                     message,
1453                                                     invocation))
1454     goto out;
  • Found 14 duplicate lines in the following files:
    • Between lines 2186 and 2206 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1860 and 1880 in /home/tasleson/projects/udisks/src/udisksstate.c
2186                   *out_uid = 0;
2187                   if (lookup_value != NULL)
2188                     {
2189                       *out_uid = g_variant_get_uint32 (lookup_value);
2190                       g_variant_unref (lookup_value);
2191                     }
2192                 }
2193               g_variant_unref (details);
2194               g_variant_unref (child);
2195               goto out;
2196             }
2197           g_variant_unref (details);
2198           g_variant_unref (child);
2199         }
2200     }
2201 
2202  out:
2203   if (value != NULL)
2204     g_variant_unref (value);
2205   g_mutex_unlock (&state->lock);
2206   return ret;
  • Found 14 duplicate lines in the following files:
    • Between lines 1305 and 1323 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 2464 and 2482 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1305   for (l = object_proxies; l != NULL; l = l->next)
1306     {
1307       UDisksObject *object = UDISKS_OBJECT (l->data);
1308       UDisksPartition *partition;
1309 
1310       partition = udisks_object_get_partition (object);
1311       if (partition == NULL)
1312         continue;
1313 
1314       if (g_strcmp0 (udisks_partition_get_table (partition), table_object_path) == 0)
1315         ret = g_list_prepend (ret, g_object_ref (partition));
1316 
1317       g_object_unref (partition);
1318     }
1319   ret = g_list_reverse (ret);
1320  out:
1321   g_list_foreach (object_proxies, (GFunc) g_object_unref, NULL);
1322   g_list_free (object_proxies);
1323   return ret;
  • Found 13 duplicate lines in the following files:
    • Between lines 894 and 910 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 994 and 1010 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1112 and 1128 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 400 and 416 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 293 and 309 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 391 and 407 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 526 and 542 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 626 and 642 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 759 and 775 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 859 and 875 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 947 and 963 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
894   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
895                                                invocation,
896                                                NULL /* GCancellable */,
897                                                &caller_uid,
898                                                &caller_gid,
899                                                NULL,
900                                                &error))
901     {
902       g_dbus_method_invocation_return_gerror (invocation, error);
903       g_clear_error (&error);
904       goto out;
905     }
906 
907   /* Policy check. */
908   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
909                                      UDISKS_OBJECT (object),
910                                      lvm2_policy_action_id,
  • Found 13 duplicate lines in the following files:
    • Between lines 919 and 935 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1143 and 1159 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 785 and 801 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
919   error = NULL;
920   object = udisks_daemon_util_dup_object (drive, &error);
921   if (object == NULL)
922     {
923       g_dbus_method_invocation_take_error (invocation, error);
924       goto out;
925     }
926 
927   daemon = udisks_linux_drive_object_get_daemon (object);
928   block_object = udisks_linux_drive_object_get_block (object, TRUE);
929   if (block_object == NULL)
930     {
931       g_dbus_method_invocation_return_error (invocation,
932                                              UDISKS_ERROR,
933                                              UDISKS_ERROR_FAILED,
934                                              "Unable to find physical block device for drive");
935       goto out;
  • Found 13 duplicate lines in the following files:
    • Between lines 2501 and 2520 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1197 and 1216 in /home/tasleson/projects/udisks/udisks/udisksclient.c
2501   for (l = objects; l != NULL; l = l->next)
2502     {
2503       UDisksObject *iter_object = UDISKS_OBJECT (l->data);
2504       UDisksBlock *iter_block;
2505 
2506       iter_block = udisks_object_peek_block (iter_object);
2507       if (iter_block == NULL)
2508         continue;
2509 
2510       if (g_strcmp0 (udisks_block_get_crypto_backing_device (iter_block), object_path) == 0)
2511         {
2512           ret = g_object_ref (iter_block);
2513           goto out;
2514         }
2515     }
2516 
2517  out:
2518   g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2519   g_list_free (objects);
2520   return ret;
  • Found 13 duplicate lines in the following files:
    • Between lines 1332 and 1345 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1465 and 1478 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1332                    GDBusMethodInvocation *invocation,
1333                    GVariant              *options)
1334 {
1335   UDisksLinuxDriveAta *drive = UDISKS_LINUX_DRIVE_ATA (_drive);
1336   UDisksLinuxDriveObject *object = NULL;
1337   UDisksLinuxBlockObject *block_object = NULL;
1338   UDisksBlock *block = NULL;
1339   UDisksDaemon *daemon;
1340   UDisksLinuxDevice *device = NULL;
1341   gint fd = -1;
1342   GError *error = NULL;
1343   const gchar *message;
1344   const gchar *action_id;
1345   uid_t caller_uid;
  • Found 13 duplicate lines in the following files:
    • Between lines 3476 and 3493 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3346 and 3363 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3410 and 3427 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
3476   error = NULL;
3477   object = udisks_daemon_util_dup_object (block, &error);
3478   if (object == NULL)
3479     {
3480       g_dbus_method_invocation_take_error (invocation, error);
3481       goto out;
3482     }
3483 
3484   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
3485 
3486   action_id = "org.freedesktop.udisks2.open-device";
3487   if (udisks_block_get_hint_system (block))
3488     action_id = "org.freedesktop.udisks2.open-device-system";
3489 
3490   if (!udisks_daemon_util_check_authorization_sync (daemon,
3491                                                     object,
3492                                                     action_id,
3493                                                     options,
  • Found 13 duplicate lines in the following files:
    • Between lines 1099 and 1112 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 1201 and 1214 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
1099                                                 NULL,
1100                                                 0,
1101                                                 0,
1102                                                 NULL,
1103                                                 &error_message,
1104                                                 NULL,
1105                                                 "%s", cmd->str))
1106     {
1107       g_dbus_method_invocation_return_error (invocation,
1108                                              UDISKS_ERROR,
1109                                              UDISKS_ERROR_FAILED,
1110                                              N_("Error converting volume: %s"),
1111                                              error_message);
1112       goto out;
  • Found 13 duplicate lines in the following files:
    • Between lines 969 and 986 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
    • Between lines 1350 and 1367 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
969   object = udisks_daemon_util_dup_object (drive, &error);
970   if (object == NULL)
971     {
972       g_dbus_method_invocation_take_error (invocation, error);
973       goto out;
974     }
975 
976   daemon = udisks_linux_drive_object_get_daemon (object);
977   block_object = udisks_linux_drive_object_get_block (object, FALSE);
978   if (block_object == NULL)
979     {
980       g_dbus_method_invocation_return_error (invocation,
981                                              UDISKS_ERROR,
982                                              UDISKS_ERROR_FAILED,
983                                              "Unable to find block device for drive");
984       goto out;
985     }
986   block = udisks_object_peek_block (UDISKS_OBJECT (block_object));
  • Found 12 duplicate lines in the following files:
    • Between lines 699 and 715 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 638 and 654 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
699                       arg_name,
700                       arg_tpgt,
701                       arg_address,
702                       arg_port,
703                       arg_iface,
704                       arg_options,
705                       &errorstr);
706 
707   /* Leave the critical section. */
708   udisks_iscsi_state_unlock_libiscsi_context (state);
709 
710   if (err != 0)
711     {
712       /* Logout failed. */
713       g_dbus_method_invocation_return_error (invocation,
714                                              UDISKS_ERROR,
715                                              iscsi_error_to_udisks_error (err),
  • Found 12 duplicate lines in the following files:
    • Between lines 967 and 979 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 868 and 880 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
967                                 GDBusMethodInvocation *invocation,
968                                 const gchar           *arg_name,
969                                 guint64                arg_size,
970                                 GVariant              *options)
971 {
972   GError *error = NULL;
973   UDisksLinuxVolumeGroup *group = UDISKS_LINUX_VOLUME_GROUP (_group);
974   UDisksLinuxVolumeGroupObject *object = NULL;
975   UDisksDaemon *daemon;
976   uid_t caller_uid;
977   gid_t caller_gid;
978   gchar *escaped_volume_name = NULL;
979   gchar *escaped_group_name = NULL;
  • Found 12 duplicate lines in the following files:
    • Between lines 1326 and 1338 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1192 and 1204 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1026 and 1038 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1326                             GVariant               *options)
1327 {
1328   UDisksLinuxMDRaid *mdraid = UDISKS_LINUX_MDRAID (_mdraid);
1329   UDisksDaemon *daemon;
1330   UDisksState *state;
1331   UDisksLinuxMDRaidObject *object;
1332   const gchar *action_id;
1333   const gchar *message;
1334   uid_t started_by_uid;
1335   uid_t caller_uid;
1336   gid_t caller_gid;
1337   UDisksLinuxDevice *raid_device = NULL;
1338   const gchar *device_file = NULL;
  • Found 12 duplicate lines in the following files:
    • Between lines 270 and 282 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
    • Between lines 159 and 171 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
270                                  gboolean     success,
271                                  const gchar *message,
272                                  gpointer     user_data)
273 {
274   GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (user_data);
275   UDisksSwapspace *swapspace;
276   swapspace = UDISKS_SWAPSPACE (g_dbus_method_invocation_get_user_data (invocation));
277   if (success)
278     udisks_swapspace_complete_start (swapspace, invocation);
279   else
280     g_dbus_method_invocation_return_error (invocation,
281                                            UDISKS_ERROR,
282                                            UDISKS_ERROR_FAILED,
  • Found 12 duplicate lines in the following files:
    • Between lines 1060 and 1074 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 691 and 705 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1221 and 1235 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1060   error = NULL;
1061   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1062                                                invocation,
1063                                                NULL /* GCancellable */,
1064                                                &caller_uid,
1065                                                &caller_gid,
1066                                                NULL,
1067                                                &error))
1068     {
1069       g_dbus_method_invocation_return_gerror (invocation, error);
1070       g_clear_error (&error);
1071       goto out;
1072     }
1073 
1074   raid_device = udisks_linux_mdraid_object_get_device (object);
  • Found 12 duplicate lines in the following files:
    • Between lines 1657 and 1671 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1413 and 1427 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1657                             &contents,
1658                             NULL,
1659                             error))
1660     goto out;
1661 
1662   lines = g_strsplit (contents, "\n", 0);
1663 
1664   str = g_string_new (NULL);
1665   removed = FALSE;
1666   for (n = 0; lines != NULL && lines[n] != NULL; n++)
1667     {
1668       const gchar *line = lines[n];
1669       if (strlen (line) == 0 && lines[n+1] == NULL)
1670         break;
1671       if (remove != NULL && !removed)
  • Found 12 duplicate lines in the following files:
    • Between lines 2390 and 2406 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1187 and 1205 in /home/tasleson/projects/udisks/tools/udisksctl.c
2390           object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
2391           g_assert (g_str_has_prefix (object_path, "/org/freedesktop/UDisks2/"));
2392           g_print ("%s \n", object_path + sizeof ("/org/freedesktop/UDisks2/") - 1);
2393         }
2394       g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2395       g_list_free (objects);
2396       goto out;
2397     }
2398 
2399   if (complete_devices)
2400     {
2401       objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
2402       for (l = objects; l != NULL; l = l->next)
2403         {
2404           object = UDISKS_OBJECT (l->data);
2405           block = udisks_object_peek_block (object);
2406           if (block != NULL)
  • Found 12 duplicate lines in the following files:
    • Between lines 2439 and 2452 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1302 and 1315 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1543 and 1556 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1409 and 1422 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
2439   if (!udisks_daemon_util_check_authorization_sync (daemon,
2440                                                     UDISKS_OBJECT (object),
2441                                                     action_id,
2442                                                     options,
2443                                                     message,
2444                                                     invocation))
2445     goto out;
2446 
2447   device = udisks_linux_drive_object_get_device (object, TRUE /* get_hw */);
2448   if (device == NULL)
2449     {
2450       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
2451                                              "No udev device");
2452       goto out;
  • Found 12 duplicate lines in the following files:
    • Between lines 728 and 740 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 597 and 609 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
728                      GVariant              *options)
729 {
730   UDisksLinuxVolumeGroup *group = UDISKS_LINUX_VOLUME_GROUP (_group);
731   UDisksDaemon *daemon;
732   UDisksLinuxVolumeGroupObject *object;
733   uid_t caller_uid;
734   gid_t caller_gid;
735   const gchar *member_device_file = NULL;
736   gchar *escaped_member_device_file = NULL;
737   GError *error = NULL;
738   gchar *error_message = NULL;
739   UDisksObject *member_device_object = NULL;
740   UDisksBlock *member_device = NULL;
  • Found 12 duplicate lines in the following files:
    • Between lines 836 and 848 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 735 and 747 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
836                    GDBusMethodInvocation *invocation,
837                    GVariant              *options)
838 {
839   GError *error = NULL;
840   UDisksLinuxLogicalVolume *volume = UDISKS_LINUX_LOGICAL_VOLUME (_volume);
841   UDisksLinuxLogicalVolumeObject *object = NULL;
842   UDisksDaemon *daemon;
843   uid_t caller_uid;
844   gid_t caller_gid;
845   UDisksLinuxVolumeGroupObject *group_object;
846   gchar *escaped_group_name = NULL;
847   gchar *escaped_name = NULL;
848   gchar *error_message = NULL;
  • Found 12 duplicate lines in the following files:
    • Between lines 1169 and 1183 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 222 and 236 in /home/tasleson/projects/udisks/src/udiskslinuxpartitiontable.c
    • Between lines 993 and 1007 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
1169       goto out;
1170     }
1171 
1172   error = NULL;
1173   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
1174                                                invocation,
1175                                                NULL /* GCancellable */,
1176                                                &caller_uid,
1177                                                &caller_gid,
1178                                                NULL,
1179                                                &error))
1180     {
1181       g_dbus_method_invocation_return_gerror (invocation, error);
1182       g_clear_error (&error);
1183       goto out;
  • Found 11 duplicate lines in the following files:
    • Between lines 1370 and 1390 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1492 and 1512 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1370       goto out;
1371     }
1372 
1373   raid_device = udisks_linux_mdraid_object_get_device (object);
1374   if (raid_device == NULL)
1375     {
1376       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1377                                              "RAID Array is not running");
1378       goto out;
1379     }
1380 
1381   if (!udisks_state_has_mdraid (state,
1382                                 g_udev_device_get_device_number (raid_device->udev_device),
1383                                 &started_by_uid))
1384     {
1385       /* allow stopping arrays stuff not mentioned in mounted-fs, but treat it like root mounted it */
1386       started_by_uid = 0;
1387     }
1388 
1389   /* First check the user is authorized to manage RAID */
1390   if (caller_uid != 0 && (caller_uid != started_by_uid))
  • Found 11 duplicate lines in the following files:
    • Between lines 520 and 532 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 563 and 575 in /home/tasleson/projects/udisks/tools/udisksctl.c
520     NULL
521   },
522   {
523     "no-user-interaction",
524     0, /* no short option */
525     0,
526     G_OPTION_ARG_NONE,
527     &opt_mount_unmount_no_user_interaction,
528     "Do not authenticate the user if needed",
529     NULL
530   },
531   {
532     NULL
  • Found 11 duplicate lines in the following files:
    • Between lines 1026 and 1037 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1192 and 1203 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1326 and 1337 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1446 and 1457 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1026                       GVariant               *options)
1027 {
1028   UDisksLinuxMDRaid *mdraid = UDISKS_LINUX_MDRAID (_mdraid);
1029   UDisksDaemon *daemon;
1030   UDisksState *state;
1031   UDisksLinuxMDRaidObject *object;
1032   const gchar *action_id;
1033   const gchar *message;
1034   uid_t started_by_uid;
1035   uid_t caller_uid;
1036   gid_t caller_gid;
1037   UDisksLinuxDevice *raid_device = NULL;
  • Found 11 duplicate lines in the following files:
    • Between lines 1783 and 1795 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1812 and 1824 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1783       if (!udisks_ata_send_command_sync (fd,
1784                                          -1,
1785                                          UDISKS_ATA_COMMAND_PROTOCOL_NONE,
1786                                          &input,
1787                                          &output,
1788                                          &error))
1789         {
1790           udisks_critical ("Error sending ATA command SET FEATURES, sub-command 0x%02x to %s: %s (%s, %d)",
1791                         (guint) input.feature, device_file,
1792                         error->message, g_quark_to_string (error->domain), error->code);
1793           g_clear_error (&error);
1794         }
1795       else
  • Found 11 duplicate lines in the following files:
    • Between lines 507 and 523 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 903 and 919 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
507   fd = open (path, O_WRONLY);
508   if (fd < 0)
509     {
510       udisks_warning ("Error opening %s: %m", path);
511       goto out;
512     }
513 
514   if (write (fd, "change", sizeof "change" - 1) != sizeof "change" - 1)
515     {
516       udisks_warning ("Error writing 'change' to file %s: %m", path);
517       goto out;
518     }
519 
520  out:
521   if (fd >= 0)
522     close (fd);
523   g_free (path);
  • Found 11 duplicate lines in the following files:
    • Between lines 1240 and 1256 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 513 and 529 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
1240       goto out;
1241     }
1242 
1243   new_member_device_object = udisks_daemon_find_object (daemon, new_member_device_objpath);
1244   if (new_member_device_object == NULL)
1245     {
1246       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1247                                              "No device for given object path");
1248       goto out;
1249     }
1250 
1251   new_member_device = udisks_object_get_block (new_member_device_object);
1252   if (new_member_device == NULL)
1253     {
1254       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1255                                              "No block interface on given object");
1256       goto out;
  • Found 11 duplicate lines in the following files:
    • Between lines 151 and 163 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxmanagerzram.c
    • Between lines 168 and 180 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 148 and 160 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 140 and 152 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxmanagerbtrfs.c
    • Between lines 146 and 158 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxmanagerbcache.c
151   g_object_class_install_property (gobject_class,
152                                    PROP_DAEMON,
153                                    g_param_spec_object ("daemon",
154                                                         "Daemon",
155                                                         "The daemon for the object",
156                                                         UDISKS_TYPE_DAEMON,
157                                                         G_PARAM_READABLE |
158                                                         G_PARAM_WRITABLE |
159                                                         G_PARAM_CONSTRUCT_ONLY |
160                                                         G_PARAM_STATIC_STRINGS));
161 }
162 
163 static void
  • Found 11 duplicate lines in the following files:
    • Between lines 1079 and 1095 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 762 and 778 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 632 and 648 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
1079       goto out;
1080     }
1081 
1082   member_device_object = udisks_daemon_find_object (daemon, member_device_objpath);
1083   if (member_device_object == NULL)
1084     {
1085       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1086                                              "No device for given object path");
1087       goto out;
1088     }
1089 
1090   member_device = udisks_object_get_block (member_device_object);
1091   if (member_device == NULL)
1092     {
1093       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
1094                                              "No block interface on given object");
1095       goto out;
  • Found 11 duplicate lines in the following files:
    • Between lines 1397 and 1410 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1519 and 1532 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1397       action_id = "org.freedesktop.udisks2.manage-md-raid";
1398       if (!udisks_daemon_util_check_authorization_sync (daemon,
1399                                                         UDISKS_OBJECT (object),
1400                                                         action_id,
1401                                                         options,
1402                                                         message,
1403                                                         invocation))
1404         goto out;
1405     }
1406 
1407   device_file = g_udev_device_get_device_file (raid_device->udev_device);
1408 
1409   job = udisks_daemon_launch_simple_job (daemon,
1410                                          UDISKS_OBJECT (object),
  • Found 11 duplicate lines in the following files:
    • Between lines 1426 and 1438 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1460 and 1472 in /home/tasleson/projects/udisks/tools/udisksctl.c
1426     NULL
1427   },
1428   {
1429     "no-user-interaction",
1430     0, /* no short option */
1431     0,
1432     G_OPTION_ARG_NONE,
1433     &opt_loop_no_user_interaction,
1434     "Do not authenticate the user if needed",
1435     NULL
1436   },
1437   {
1438     NULL
  • Found 11 duplicate lines in the following files:
    • Between lines 737 and 753 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 857 and 873 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
737   for (l = entries; l != NULL; l = l->next)
738     {
739       if (!add_crypttab_entry (&builder, UDISKS_CRYPTTAB_ENTRY (l->data), include_secrets, error))
740         {
741           g_variant_builder_clear (&builder);
742           g_list_foreach (entries, (GFunc) g_object_unref, NULL);
743           g_list_free (entries);
744           goto out;
745         }
746     }
747   g_list_foreach (entries, (GFunc) g_object_unref, NULL);
748   g_list_free (entries);
749 
750   ret = g_variant_builder_end (&builder);
751 
752  out:
753   return ret;
  • Found 11 duplicate lines in the following files:
    • Between lines 683 and 699 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1187 and 1203 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1585 and 1600 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2390 and 2405 in /home/tasleson/projects/udisks/tools/udisksctl.c
683               object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
684               g_assert (g_str_has_prefix (object_path, "/org/freedesktop/UDisks2/"));
685               g_print ("%s \n", object_path + sizeof ("/org/freedesktop/UDisks2/") - 1);
686             }
687         }
688       g_list_foreach (objects, (GFunc) g_object_unref, NULL);
689       g_list_free (objects);
690       goto out;
691     }
692 
693   if (complete_devices)
694     {
695       objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
696       for (l = objects; l != NULL; l = l->next)
697         {
698           object = UDISKS_OBJECT (l->data);
699           block = udisks_object_peek_block (object);
  • Found 11 duplicate lines in the following files:
    • Between lines 1463 and 1481 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1710 and 1728 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1463                   removed = TRUE;
1464                   continue;
1465                 }
1466             }
1467         }
1468       g_string_append (str, line);
1469       g_string_append_c (str, '\n');
1470     }
1471 
1472   if (remove != NULL && !removed)
1473     {
1474       g_set_error (error,
1475                    UDISKS_ERROR,
1476                    UDISKS_ERROR_FAILED,
1477                    "Didn't find entry to remove");
1478       goto out;
1479     }
1480 
1481   if (add != NULL)
  • Found 11 duplicate lines in the following files:
    • Between lines 235 and 248 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
    • Between lines 289 and 302 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
235                                          UDisksBlock      *block,
236                                          UDisksPartition  *partition,
237                                          UDisksObjectInfo *info)
238 {
239   guint64 size = 0;
240   gchar *size_str = NULL;
241   gchar *s;
242 
243   size = udisks_block_get_size (block);
244   if (size > 0)
245     size_str = udisks_client_get_size_for_display (client, size, FALSE, FALSE);
246 
247   info->icon = g_themed_icon_new_with_default_fallbacks ("drive-removable-media");
248   info->icon_symbolic = g_themed_icon_new_with_default_fallbacks ("drive-removable-media-symbolic");
  • Found 10 duplicate lines in the following files:
    • Between lines 1201 and 1211 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 1099 and 1109 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 986 and 996 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 666 and 676 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 1153 and 1163 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1042 and 1052 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 926 and 936 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
1201                                                 NULL,
1202                                                 0,
1203                                                 0,
1204                                                 NULL,
1205                                                 &error_message,
1206                                                 NULL,
1207                                                 "%s", cmd->str))
1208     {
1209       g_dbus_method_invocation_return_error (invocation,
1210                                              UDISKS_ERROR,
1211                                              UDISKS_ERROR_FAILED,
  • Found 10 duplicate lines in the following files:
    • Between lines 1824 and 1834 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1716 and 1726 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1622 and 1632 in /home/tasleson/projects/udisks/src/udisksstate.c
1824   error = NULL;
1825   value = udisks_state_get (state,
1826                             "loop",
1827                             G_VARIANT_TYPE ("a{sa{sv}}"),
1828                             &error);
1829   if (error != NULL)
1830     {
1831       udisks_warning ("Error getting loop: %s (%s, %d)",
1832                       error->message, g_quark_to_string (error->domain), error->code);
1833       g_clear_error (&error);
1834       goto out;
  • Found 10 duplicate lines in the following files:
    • Between lines 1603 and 1618 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1213 and 1228 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 716 and 731 in /home/tasleson/projects/udisks/tools/udisksctl.c
1603                       const gchar * const *symlinks;
1604                       g_print ("%s \n", udisks_block_get_device (block));
1605                       symlinks = udisks_block_get_symlinks (block);
1606                       for (n = 0; symlinks != NULL && symlinks[n] != NULL; n++)
1607                         g_print ("%s \n", symlinks[n]);
1608                     }
1609                 }
1610               g_list_foreach (objects, (GFunc) g_object_unref, NULL);
1611               g_list_free (objects);
1612               goto out;
1613             }
1614         }
1615 
1616       /* done with completion */
1617       if (request_completion)
1618         goto out;
  • Found 10 duplicate lines in the following files:
    • Between lines 1183 and 1195 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 2487 and 2499 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1183                                    UDisksBlock   *block)
1184 {
1185   UDisksBlock *ret = NULL;
1186   GDBusObject *object;
1187   const gchar *object_path;
1188   GList *objects = NULL;
1189   GList *l;
1190 
1191   object = g_dbus_interface_get_object (G_DBUS_INTERFACE (block));
1192   if (object == NULL)
1193     goto out;
1194 
1195   object_path = g_dbus_object_get_object_path (object);
  • Found 10 duplicate lines in the following files:
    • Between lines 397 and 416 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
    • Between lines 553 and 572 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
397           g_object_unref (*interface_pointer);
398           *interface_pointer = NULL;
399         }
400     }
401 
402   if (*interface_pointer != NULL)
403     {
404       if (update_func (object, uevent_action, G_DBUS_INTERFACE (*interface_pointer)))
405         ret = TRUE;
406       if (add)
407         g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object),
408                                               G_DBUS_INTERFACE_SKELETON (*interface_pointer));
409     }
410 
411   return ret;
412 }
413 
414 /* ---------------------------------------------------------------------------------------------------- */
415 
416 static gboolean
  • Found 10 duplicate lines in the following files:
    • Between lines 38 and 47 in /home/tasleson/projects/udisks/src/tests/testutil.h
    • Between lines 5 and 14 in /home/tasleson/projects/udisks/src/tests/testutil.h
38   do                                                                    \
39     {                                                                   \
40       if (!G_IS_OBJECT (object))                                        \
41         {                                                               \
42           g_assertion_message (G_LOG_DOMAIN,                            \
43                                __FILE__,                                \
44                                __LINE__,                                \
45                                G_STRFUNC,                               \
46                                "Not a GObject instance");               \
47         }                                                               \
  • Found 10 duplicate lines in the following files:
    • Between lines 1956 and 1969 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1610 and 1623 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1231 and 1244 in /home/tasleson/projects/udisks/src/udisksstate.c
1956                            gboolean     check_only,
1957                            GArray      *devs_to_clean)
1958 {
1959   gboolean changed;
1960   GVariant *value;
1961   GVariant *new_value;
1962   GVariantBuilder builder;
1963   GError *error;
1964 
1965   changed = FALSE;
1966 
1967   /* load existing entries */
1968   error = NULL;
1969   value = udisks_state_get (state,
  • Found 10 duplicate lines in the following files:
    • Between lines 502 and 512 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 837 and 847 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 736 and 746 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
502                GVariant              *options)
503 {
504   GError *error = NULL;
505   UDisksLinuxLogicalVolume *volume = UDISKS_LINUX_LOGICAL_VOLUME (_volume);
506   UDisksLinuxLogicalVolumeObject *object = NULL;
507   UDisksDaemon *daemon;
508   uid_t caller_uid;
509   gid_t caller_gid;
510   UDisksLinuxVolumeGroupObject *group_object;
511   gchar *escaped_group_name = NULL;
512   gchar *escaped_name = NULL;
  • Found 10 duplicate lines in the following files:
    • Between lines 986 and 996 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 875 and 885 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 782 and 792 in /home/tasleson/projects/udisks/src/udisksstate.c
986   error = NULL;
987   value = udisks_state_get (state,
988                             "mounted-fs",
989                             G_VARIANT_TYPE ("a{sa{sv}}"),
990                             &error);
991   if (error != NULL)
992     {
993       udisks_warning ("Error getting mounted-fs: %s (%s, %d)",
994                       error->message, g_quark_to_string (error->domain), error->code);
995       g_clear_error (&error);
996       goto out;
  • Found 10 duplicate lines in the following files:
    • Between lines 2271 and 2285 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2038 and 2052 in /home/tasleson/projects/udisks/tools/udisksctl.c
2271                   error->message, g_quark_to_string (error->domain), error->code);
2272       g_clear_error (&error);
2273       g_object_unref (object);
2274       goto out;
2275     }
2276 
2277   g_object_unref (object);
2278 
2279 
2280   ret = 0;
2281 
2282  out:
2283   if (options != NULL)
2284     g_variant_unref (options);
2285   g_option_context_free (o);
  • Found 10 duplicate lines in the following files:
    • Between lines 1053 and 1063 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1010 and 1020 in /home/tasleson/projects/udisks/tools/udisksctl.c
1053     NULL
1054   },
1055   {
1056     "no-user-interaction",
1057     0, /* no short option */
1058     0,
1059     G_OPTION_ARG_NONE,
1060     &opt_unlock_lock_no_user_interaction,
1061     "Do not authenticate the user if needed",
1062     NULL
1063   },
  • Found 10 duplicate lines in the following files:
    • Between lines 1445 and 1455 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1336 and 1346 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1243 and 1253 in /home/tasleson/projects/udisks/src/udisksstate.c
1445   error = NULL;
1446   value = udisks_state_get (state,
1447                             "unlocked-luks",
1448                             G_VARIANT_TYPE ("a{ta{sv}}"),
1449                             &error);
1450   if (error != NULL)
1451     {
1452       udisks_warning ("Error getting unlocked-luks: %s (%s, %d)",
1453                       error->message, g_quark_to_string (error->domain), error->code);
1454       g_clear_error (&error);
1455       goto out;
  • Found 10 duplicate lines in the following files:
    • Between lines 225 and 235 in /home/tasleson/projects/udisks/src/udiskslinuxdevice.c
    • Between lines 202 and 212 in /home/tasleson/projects/udisks/src/udiskslinuxdevice.c
225       input.count = 1;
226       output.buffer = g_new0 (guchar, 512);
227       output.buffer_size = 512;
228       if (!udisks_ata_send_command_sync (fd,
229                                          -1,
230                                          UDISKS_ATA_COMMAND_PROTOCOL_DRIVE_TO_HOST,
231                                          &input,
232                                          &output,
233                                          error))
234         {
235           g_free (output.buffer);
  • Found 10 duplicate lines in the following files:
    • Between lines 247 and 259 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
    • Between lines 136 and 148 in /home/tasleson/projects/udisks/src/udiskslinuxswapspace.c
247                GCancellable       *cancellable,
248                gpointer            user_data,
249                GError            **error)
250 {
251 
252   UDisksObject *object = NULL;
253   UDisksBlock *block = NULL;
254   gchar *device = NULL;
255   gboolean ret = FALSE;
256 
257   object = UDISKS_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (user_data)));
258   block = udisks_object_get_block (object);
259   device = udisks_block_dup_device (block);
  • Found 10 duplicate lines in the following files:
    • Between lines 38 and 51 in /home/tasleson/projects/udisks/tools/umount-udisks.c
    • Between lines 395 and 408 in /home/tasleson/projects/udisks/tools/udisksctl.c
38   UDisksObject *ret;
39   GList *objects;
40   GList *l;
41 
42   ret = NULL;
43 
44   objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
45   for (l = objects; l != NULL; l = l->next)
46     {
47       UDisksObject *object = UDISKS_OBJECT (l->data);
48       UDisksBlock *block;
49 
50       block = udisks_object_peek_block (object);
51       if (block != NULL)
  • Found 9 duplicate lines in the following files:
    • Between lines 2000 and 2011 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2241 and 2252 in /home/tasleson/projects/udisks/tools/udisksctl.c
2000           goto out;
2001         }
2002       drive = udisks_client_get_drive_for_block (client, udisks_object_peek_block (block_object));
2003       object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (drive));
2004       g_object_unref (block_object);
2005     }
2006   else
2007     {
2008       s = g_option_context_get_help (o, FALSE, NULL);
2009       g_printerr ("%s", s);
2010       g_free (s);
2011       goto out;
  • Found 9 duplicate lines in the following files:
    • Between lines 108 and 122 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxmanagerzram.c
    • Between lines 112 and 126 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 97 and 111 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxmanagerbtrfs.c
    • Between lines 103 and 117 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxmanagerbcache.c
108   switch (property_id)
109     {
110     case PROP_DAEMON:
111       g_assert (manager->daemon == NULL);
112       /* We don't take a reference to the daemon */
113       manager->daemon = g_value_get_object (value);
114       break;
115 
116     default:
117       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
118       break;
119     }
120 }
121 
122 static void
  • Found 9 duplicate lines in the following files:
    • Between lines 307 and 317 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2752 and 2762 in /home/tasleson/projects/udisks/tools/udisksctl.c
307       guint property_name_len;
308       property_name_len = strlen (property_name);
309       if (max_property_name_len < property_name_len)
310         max_property_name_len = property_name_len;
311     }
312 
313   value_column = ((max_property_name_len + 7) / 8) * 8 + 8;
314   if (value_column < 24)
315     value_column = 24;
316   else if (value_column > 64)
317     value_column = 64;
  • Found 9 duplicate lines in the following files:
    • Between lines 1232 and 1244 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1611 and 1623 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1957 and 1969 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 771 and 783 in /home/tasleson/projects/udisks/src/udisksstate.c
1232                                   GArray      *devs_to_clean)
1233 {
1234   gboolean changed;
1235   GVariant *value;
1236   GVariant *new_value;
1237   GVariantBuilder builder;
1238   GError *error;
1239 
1240   changed = FALSE;
1241 
1242   /* load existing entries */
1243   error = NULL;
1244   value = udisks_state_get (state,
  • Found 9 duplicate lines in the following files:
    • Between lines 826 and 855 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1287 and 1316 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1666 and 1695 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 2012 and 2037 in /home/tasleson/projects/udisks/src/udisksstate.c
826                           error->message,
827                           g_quark_to_string (error->domain),
828                           error->code);
829           g_clear_error (&error);
830           goto out;
831         }
832     }
833   else
834     {
835       g_variant_unref (new_value);
836     }
837 
838  out:
839   ;
840 }
841 
842 /* ---------------------------------------------------------------------------------------------------- */
843 
844 /**
845  * udisks_state_add_mounted_fs:
846  * @state: A #UDisksState.
847  * @block_device: The block device.
848  * @mount_point: The mount point.
849  * @uid: The user id of the process requesting the device to be mounted.
850  * @fstab_mount: %TRUE if the device was mounted via /etc/fstab.
851  *
852  * Adds a new entry to the
853  * <filename>/run/udisks2/mounted-fs</filename> file.
854  */
855 void
  • Found 9 duplicate lines in the following files:
    • Between lines 387 and 396 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 422 and 431 in /home/tasleson/projects/udisks/src/tests/test.c
387                                        GError           *error,
388                                        gint              status,
389                                        GString          *standard_output,
390                                        GString          *standard_error,
391                                        gpointer          user_data)
392 {
393   g_assert_no_error (error);
394   g_assert_cmpstr (standard_error->str, ==, "");
395   g_assert (WIFEXITED (status));
396   g_assert (WEXITSTATUS (status) == 0);
  • Found 9 duplicate lines in the following files:
    • Between lines 2151 and 2160 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1969 and 1978 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 2055 and 2064 in /home/tasleson/projects/udisks/src/udisksstate.c
2151   value = udisks_state_get (state,
2152                             "mdraid",
2153                             G_VARIANT_TYPE ("a{ta{sv}}"),
2154                             &error);
2155   if (error != NULL)
2156     {
2157       udisks_warning ("Error getting mdraid: %s (%s, %d)",
2158                       error->message, g_quark_to_string (error->domain), error->code);
2159       g_clear_error (&error);
2160       goto out;
  • Found 9 duplicate lines in the following files:
    • Between lines 135 and 149 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
    • Between lines 113 and 127 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
135   switch (prop_id)
136     {
137     case PROP_DAEMON:
138       g_assert (manager->daemon == NULL);
139       /* we don't take a reference to the daemon */
140       manager->daemon = g_value_get_object (value);
141       break;
142 
143     default:
144       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
145       break;
146     }
147 }
148 
149 static void
  • Found 9 duplicate lines in the following files:
    • Between lines 805 and 819 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1266 and 1280 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1645 and 1659 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1991 and 2005 in /home/tasleson/projects/udisks/src/udisksstate.c
805             g_variant_builder_add_value (&builder, child);
806           else
807             changed = TRUE;
808           g_variant_unref (child);
809         }
810       g_variant_unref (value);
811     }
812 
813   new_value = g_variant_builder_end (&builder);
814 
815   /* save new entries */
816   if (changed)
817     {
818       error = NULL;
819       if (!udisks_state_set (state,
  • Found 9 duplicate lines in the following files:
    • Between lines 854 and 863 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1594 and 1603 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
854   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
855                                                invocation,
856                                                NULL /* GCancellable */,
857                                                &caller_uid,
858                                                &caller_gid,
859                                                NULL,
860                                                error))
861     {
862       ret = FALSE;
863       goto out;
  • Found 9 duplicate lines in the following files:
    • Between lines 2025 and 2036 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2258 and 2269 in /home/tasleson/projects/udisks/tools/udisksctl.c
2025                                                 options,
2026                                                 NULL,                       /* GCancellable */
2027                                                 &error))
2028     {
2029       if (error->domain == UDISKS_ERROR &&
2030           error->code == UDISKS_ERROR_NOT_AUTHORIZED_CAN_OBTAIN &&
2031           setup_local_polkit_agent ())
2032         {
2033           g_clear_error (&error);
2034           goto try_again;
2035         }
2036       g_dbus_error_strip_remote_error (error);
  • Found 9 duplicate lines in the following files:
    • Between lines 1830 and 1839 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2101 and 2110 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2307 and 2316 in /home/tasleson/projects/udisks/tools/udisksctl.c
1830                                gchar      **argv[],
1831                                gboolean     request_completion,
1832                                const gchar *completion_cur,
1833                                const gchar *completion_prev)
1834 {
1835   gint ret;
1836   GOptionContext *o;
1837   gchar *s;
1838   gboolean complete_objects;
1839   gboolean complete_devices;
  • Found 9 duplicate lines in the following files:
    • Between lines 1183 and 1198 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 1568 and 1582 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
1183   UDisksBaseJob *job = NULL;
1184 
1185 
1186   /* only allow a single call at a time */
1187   g_mutex_lock (&UDISKS_LINUX_FILESYSTEM (filesystem)->lock);
1188 
1189   object = udisks_daemon_util_dup_object (filesystem, &error);
1190   if (object == NULL)
1191     {
1192       g_dbus_method_invocation_take_error (invocation, error);
1193       goto out;
1194     }
1195 
1196   block = udisks_object_peek_block (object);
1197   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
1198   state = udisks_daemon_get_state (daemon);
  • Found 9 duplicate lines in the following files:
    • Between lines 386 and 399 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 782 and 795 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
386   gchar *mount_point = NULL;
387 
388   object = udisks_daemon_util_dup_object (l_fs_btrfs, &error);
389   if (! object)
390     {
391       g_dbus_method_invocation_take_error (invocation, error);
392       goto out;
393     }
394 
395   /* Policy check. */
396   UDISKS_DAEMON_CHECK_AUTHORIZATION (udisks_linux_filesystem_btrfs_get_daemon (l_fs_btrfs),
397                                      UDISKS_OBJECT (object),
398                                      btrfs_policy_action_id,
399                                      arg_options,
  • Found 9 duplicate lines in the following files:
    • Between lines 1347 and 1358 in /home/tasleson/projects/udisks/src/udisksdaemon.c
    • Between lines 1386 and 1397 in /home/tasleson/projects/udisks/src/udisksdaemon.c
1347   UDisksObject *ret = NULL;
1348   GList *objects, *l;
1349 
1350   objects = g_dbus_object_manager_get_objects (G_DBUS_OBJECT_MANAGER (daemon->object_manager));
1351   for (l = objects; l != NULL; l = l->next)
1352     {
1353       UDisksObject *object = UDISKS_OBJECT (l->data);
1354       UDisksBlock *block;
1355 
1356       block = udisks_object_peek_block (object);
1357       if (block == NULL)
1358         continue;
  • Found 9 duplicate lines in the following files:
    • Between lines 1608 and 1617 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1627 and 1636 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1608   if (!udisks_daemon_util_check_authorization_sync_with_error (daemon,
1609                                                                NULL,
1610                                                                action_id,
1611                                                                options,
1612                                                                message,
1613                                                                invocation,
1614                                                                error))
1615     {
1616       ret = FALSE;
1617       goto out;
  • Found 9 duplicate lines in the following files:
    • Between lines 75 and 90 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
    • Between lines 103 and 118 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
75   UDisksObjectSkeletonClass parent_class;
76 };
77 
78 typedef struct
79 {
80   UDisksObject *interface;
81   UDisksObjectHasInterfaceFunc has_func;
82   UDisksObjectConnectInterfaceFunc connect_func;
83   UDisksObjectUpdateInterfaceFunc update_func;
84 } ModuleInterfaceEntry;
85 
86 enum
87 {
88   PROP_0,
89   PROP_DAEMON,
90   PROP_DEVICE
  • Found 9 duplicate lines in the following files:
    • Between lines 231 and 244 in /home/tasleson/projects/udisks/src/udisksata.c
    • Between lines 1225 and 1237 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
231     io_v4.timeout = timeout_msec;
232 
233   rc = ioctl (fd, SG_IO, &io_v4);
234   if (rc != 0)
235     {
236       /* could be that the driver doesn't do version 4, try version 3 */
237       if (errno == EINVAL)
238         {
239           struct sg_io_hdr io_hdr;
240 
241           memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
242           io_hdr.interface_id = 'S';
243           io_hdr.cmdp = (unsigned char*) cdb;
244           io_hdr.cmd_len = cdb_len;
  • Found 9 duplicate lines in the following files:
    • Between lines 1121 and 1131 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1275 and 1285 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1397 and 1407 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1519 and 1529 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1121       action_id = "org.freedesktop.udisks2.manage-md-raid";
1122       if (!udisks_daemon_util_check_authorization_sync (daemon,
1123                                                         UDISKS_OBJECT (object),
1124                                                         action_id,
1125                                                         options,
1126                                                         message,
1127                                                         invocation))
1128         goto out;
1129     }
1130 
1131   device_file = g_udev_device_get_device_file (raid_device->udev_device);
  • Found 8 duplicate lines in the following files:
    • Between lines 2040 and 2049 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1700 and 1709 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1321 and 1330 in /home/tasleson/projects/udisks/src/udisksstate.c
2040                          uid_t          uid)
2041 {
2042   GVariant *value;
2043   GVariant *new_value;
2044   GVariant *details_value;
2045   GVariantBuilder builder;
2046   GVariantBuilder details_builder;
2047   GError *error;
2048 
2049   g_return_if_fail (UDISKS_IS_STATE (state));
  • Found 8 duplicate lines in the following files:
    • Between lines 836 and 844 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 735 and 743 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 365 and 373 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
836                    GDBusMethodInvocation *invocation,
837                    GVariant              *options)
838 {
839   GError *error = NULL;
840   UDisksLinuxLogicalVolume *volume = UDISKS_LINUX_LOGICAL_VOLUME (_volume);
841   UDisksLinuxLogicalVolumeObject *object = NULL;
842   UDisksDaemon *daemon;
843   uid_t caller_uid;
844   gid_t caller_gid;
  • Found 8 duplicate lines in the following files:
    • Between lines 641 and 654 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 2204 and 2219 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 156 and 171 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
641               g_object_unref (block);
642               ret = g_object_ref (object);
643               goto out;
644             }
645           g_object_unref (block);
646         }
647     }
648 
649  out:
650   g_list_free_full (objects, g_object_unref);
651   return ret;
652 }
653 
654 static gboolean
  • Found 8 duplicate lines in the following files:
    • Between lines 731 and 742 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 331 and 342 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 784 and 795 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 388 and 399 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
731   object = udisks_daemon_util_dup_object (l_fs_btrfs, &error);
732   if (! object)
733     {
734       g_dbus_method_invocation_take_error (invocation, error);
735       goto out;
736     }
737 
738   /* Policy check. */
739   UDISKS_DAEMON_CHECK_AUTHORIZATION (udisks_linux_filesystem_btrfs_get_daemon (l_fs_btrfs),
740                                      UDISKS_OBJECT (object),
741                                      btrfs_policy_action_id,
742                                      arg_options,
  • Found 8 duplicate lines in the following files:
    • Between lines 672 and 683 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 604 and 615 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
672   object = udisks_daemon_util_dup_object (fs_btrfs, &error);
673   if (! object)
674     {
675       g_dbus_method_invocation_take_error (invocation, error);
676       goto out;
677     }
678 
679   /* Policy check. */
680   UDISKS_DAEMON_CHECK_AUTHORIZATION (udisks_linux_filesystem_btrfs_get_daemon (l_fs_btrfs),
681                                      UDISKS_OBJECT (object),
682                                      btrfs_policy_action_id,
683                                      arg_options,
  • Found 8 duplicate lines in the following files:
    • Between lines 125 and 144 in /home/tasleson/projects/udisks/modules/bcache/udisksbcachemoduleiface.c
    • Between lines 127 and 146 in /home/tasleson/projects/udisks/modules/zram/udiskszrammoduleiface.c
125   return iface;
126 }
127 
128 /* ------------------------------------------------------------------------------------ */
129 
130 UDisksModuleInterfaceInfo **
131 udisks_module_get_drive_object_iface_setup_entries (void)
132 {
133   return NULL;
134 }
135 
136 UDisksModuleObjectNewFunc *
137 udisks_module_get_object_new_funcs (void)
138 {
139   return NULL;
140 }
141 
142 /* ------------------------------------------------------------------------------------ */
143 
144 static GDBusInterfaceSkeleton *
  • Found 8 duplicate lines in the following files:
    • Between lines 78 and 90 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxblockbcache.c
    • Between lines 64 and 76 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxblockbcache.c
    • Between lines 80 and 92 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxblockzram.c
    • Between lines 66 and 78 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxblockzram.c
78                                           guint          property_id,
79                                           const GValue  *value,
80                                           GParamSpec    *pspec)
81 {
82   switch (property_id)
83     {
84     default:
85       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
86       break;
87     }
88 }
89 
90 static void
  • Found 8 duplicate lines in the following files:
    • Between lines 288 and 296 in /home/tasleson/projects/udisks/src/udisksmountmonitor.c
    • Between lines 275 and 283 in /home/tasleson/projects/udisks/src/udisksmountmonitor.c
288                      GIOCondition cond,
289                      gpointer user_data)
290 {
291   UDisksMountMonitor *monitor = UDISKS_MOUNT_MONITOR (user_data);
292   if (cond & ~G_IO_ERR)
293     goto out;
294   reload_mounts (monitor);
295  out:
296   return TRUE;
  • Found 8 duplicate lines in the following files:
    • Between lines 257 and 267 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
    • Between lines 687 and 697 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
257           goto out;
258         }
259 
260       block = udisks_object_get_block (object);
261       if (block == NULL)
262         {
263           g_dbus_method_invocation_return_error (invocation,
264                                                  UDISKS_ERROR,
265                                                  UDISKS_ERROR_FAILED,
266                                                  "Object path %s for index %u is not a block device",
267                                                  arg_blocks[n], n);
  • Found 8 duplicate lines in the following files:
    • Between lines 2408 and 2417 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1603 and 1612 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1213 and 1223 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 716 and 726 in /home/tasleson/projects/udisks/tools/udisksctl.c
2408               const gchar * const *symlinks;
2409               g_print ("%s \n", udisks_block_get_device (block));
2410               symlinks = udisks_block_get_symlinks (block);
2411               for (n = 0; symlinks != NULL && symlinks[n] != NULL; n++)
2412                 g_print ("%s \n", symlinks[n]);
2413             }
2414         }
2415       g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2416       g_list_free (objects);
2417       goto out;
  • Found 8 duplicate lines in the following files:
    • Between lines 3462 and 3470 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3398 and 3406 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3334 and 3342 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
3462                            GDBusMethodInvocation *invocation,
3463                            GUnixFDList           *fd_list,
3464                            GVariant              *options)
3465 {
3466   UDisksObject *object;
3467   UDisksDaemon *daemon;
3468   const gchar *action_id;
3469   const gchar *device;
3470   GUnixFDList *out_fd_list = NULL;
  • Found 8 duplicate lines in the following files:
    • Between lines 983 and 992 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 967 and 976 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
983       for (n = 0; s[n] != '\0'; n++)
984         {
985           gint c = s[n];
986           if (c == '/')
987             g_string_append_c (str, '_');
988           else
989             g_string_append_c (str, c);
990         }
991       mount_point = g_string_free (str, FALSE);
992       g_free (s);
  • Found 8 duplicate lines in the following files:
    • Between lines 2339 and 2350 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2137 and 2148 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1867 and 1878 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1522 and 1533 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1135 and 1146 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 628 and 639 in /home/tasleson/projects/udisks/tools/udisksctl.c
2339   complete_objects = FALSE;
2340   if (request_completion && (g_strcmp0 (completion_prev, "--object-path") == 0 || g_strcmp0 (completion_prev, "-p") == 0))
2341     {
2342       complete_objects = TRUE;
2343       remove_arg ((*argc) - 1, argc, argv);
2344     }
2345 
2346   complete_devices = FALSE;
2347   if (request_completion && (g_strcmp0 (completion_prev, "--block-device") == 0 || g_strcmp0 (completion_prev, "-b") == 0))
2348     {
2349       complete_devices = TRUE;
2350       remove_arg ((*argc) - 1, argc, argv);
  • Found 8 duplicate lines in the following files:
    • Between lines 922 and 930 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 601 and 609 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 502 and 510 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 837 and 845 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 736 and 744 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
922                         GVariant              *options)
923 {
924   GError *error = NULL;
925   UDisksLinuxLogicalVolume *volume = UDISKS_LINUX_LOGICAL_VOLUME (_volume);
926   UDisksLinuxLogicalVolumeObject *object = NULL;
927   UDisksDaemon *daemon;
928   uid_t caller_uid;
929   gid_t caller_gid;
930   UDisksLinuxVolumeGroupObject *group_object;
  • Found 8 duplicate lines in the following files:
    • Between lines 1501 and 1516 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1053 and 1068 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1871 and 1886 in /home/tasleson/projects/udisks/src/udisksstate.c
1501           g_variant_unref (details);
1502           g_variant_unref (child);
1503         }
1504     }
1505 
1506  out:
1507   if (value != NULL)
1508     g_variant_unref (value);
1509   g_mutex_unlock (&state->lock);
1510   return ret;
1511 }
1512 
1513 /* ---------------------------------------------------------------------------------------------------- */
1514 
1515 /* returns TRUE if the entry should be kept */
1516 static gboolean
  • Found 8 duplicate lines in the following files:
    • Between lines 277 and 288 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxblockbcache.c
    • Between lines 234 and 245 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxblockbcache.c
277   object = udisks_daemon_util_dup_object (block, &error);
278   if (! object)
279     {
280       g_dbus_method_invocation_take_error (invocation, error);
281       goto out;
282     }
283 
284   /* Policy check */
285   UDISKS_DAEMON_CHECK_AUTHORIZATION (udisks_linux_block_bcache_get_daemon (block),
286                                      NULL,
287                                      bcache_policy_action_id,
288                                      options,
  • Found 8 duplicate lines in the following files:
    • Between lines 788 and 808 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 676 and 696 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
788       for (; l; l = l->next)
789         {
790           ii = l->data;
791           entry = g_new0 (ModuleInterfaceEntry, 1);
792           entry->has_func = ii->has_func;
793           entry->connect_func = ii->connect_func;
794           entry->update_func = ii->update_func;
795           g_hash_table_replace (object->module_ifaces, GSIZE_TO_POINTER (ii->skeleton_type), entry);
796         }
797     }
798 }
799 
800 /**
801  * udisks_linux_block_object_uevent:
802  * @object: A #UDisksLinuxBlockObject.
803  * @action: Uevent action or %NULL
804  * @device: A new #UDisksLinuxDevice device object or %NULL if the device hasn't changed.
805  *
806  * Updates all information on interfaces on @object.
807  */
808 void
  • Found 8 duplicate lines in the following files:
    • Between lines 906 and 937 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 686 and 700 in /home/tasleson/projects/udisks/udisks/udisksclient.c
906           ret = block;
907           goto out;
908         }
909       g_object_unref (block);
910     }
911 
912  out:
913   g_list_foreach (object_proxies, (GFunc) g_object_unref, NULL);
914   g_list_free (object_proxies);
915   return ret;
916 }
917 
918 /**
919  * udisks_client_get_all_blocks_for_mdraid:
920  * @client: A #UDisksClient.
921  * @raid: A #UDisksMDRaid.
922  *
923  * Gets all RAID devices (e.g. <filename>/dev/md0</filename> and <filename>/dev/md1</filename>) for @raid.
924  *
925  * This is usually only useful in <ulink
926  * url="http://en.wikipedia.org/wiki/Split-brain_(computing)">split-brain
927  * situations</ulink> — see udisks_client_get_block_for_mdraid() for
928  * an example — and is normally used only to convey the problem in an
929  * user interface.
930  *
931  * Returns: (transfer full) (element-type UDisksBlock): A list of #UDisksBlock instances. The
932  *   returned list should be freed with g_list_free() after each
933  *   element has been freed with g_object_unref().
934  *
935  * Since: 2.1
936  */
937 GList *
  • Found 8 duplicate lines in the following files:
    • Between lines 894 and 902 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 794 and 802 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 437 and 445 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
894                                                 escaped_group_name,
895                                                 escaped_name))
896     {
897       g_dbus_method_invocation_return_error (invocation,
898                                              UDISKS_ERROR,
899                                              UDISKS_ERROR_FAILED,
900                                              "Error deleting logical volume: %s",
901                                              error_message);
902       goto out;
  • Found 8 duplicate lines in the following files:
    • Between lines 805 and 816 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 547 and 559 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
805                                   UDisksDaemon *daemon)
806 {
807   GList *entries;
808   GList *l;
809   GList *ret;
810 
811   ret = NULL;
812 
813   entries = udisks_crypttab_monitor_get_entries (udisks_daemon_get_crypttab_monitor (daemon));
814   for (l = entries; l != NULL; l = l->next)
815     {
816       UDisksCrypttabEntry *entry = UDISKS_CRYPTTAB_ENTRY (l->data);
  • Found 8 duplicate lines in the following files:
    • Between lines 345 and 353 in /home/tasleson/projects/udisks/modules/iscsi/udisksiscsiutil.c
    • Between lines 284 and 292 in /home/tasleson/projects/udisks/modules/iscsi/udisksiscsiutil.c
345               const gchar   *name,
346               const gint     tpgt,
347               const gchar   *address,
348               const gint     port,
349               const gchar   *iface,
350               GVariant      *params,
351               gchar        **errorstr)
352 {
353   struct libiscsi_context *ctx;
  • Found 8 duplicate lines in the following files:
    • Between lines 2158 and 2169 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1832 and 1843 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1453 and 1464 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 994 and 1005 in /home/tasleson/projects/udisks/src/udisksstate.c
2158                       error->message, g_quark_to_string (error->domain), error->code);
2159       g_clear_error (&error);
2160       goto out;
2161     }
2162 
2163   /* look through list */
2164   if (value != NULL)
2165     {
2166       GVariantIter iter;
2167       GVariant *child;
2168       g_variant_iter_init (&iter, value);
2169       while ((child = g_variant_iter_next_value (&iter)) != NULL)
  • Found 8 duplicate lines in the following files:
    • Between lines 779 and 790 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 440 and 452 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
779                                UDisksDaemon *daemon)
780 {
781   GList *entries;
782   GList *l;
783   GList *ret;
784 
785   ret = NULL;
786 
787   entries = udisks_fstab_monitor_get_entries (udisks_daemon_get_fstab_monitor (daemon));
788   for (l = entries; l != NULL; l = l->next)
789     {
790       UDisksFstabEntry *entry = UDISKS_FSTAB_ENTRY (l->data);
  • Found 8 duplicate lines in the following files:
    • Between lines 248 and 257 in /home/tasleson/projects/udisks/src/udiskscrypttabmonitor.c
    • Between lines 249 and 258 in /home/tasleson/projects/udisks/src/udisksfstabmonitor.c
248   g_list_free (removed);
249   g_list_free (added);
250 }
251 
252 static void
253 on_file_monitor_changed (GFileMonitor      *file_monitor,
254                          GFile             *file,
255                          GFile             *other_file,
256                          GFileMonitorEvent  event_type,
257                          gpointer           user_data)
  • Found 8 duplicate lines in the following files:
    • Between lines 626 and 636 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 2189 and 2199 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
626   UDisksObject *ret = NULL;
627   GList *objects, *l;
628 
629   objects = udisks_daemon_get_objects (daemon);
630   for (l = objects; l != NULL; l = l->next)
631     {
632       UDisksObject *object = UDISKS_OBJECT (l->data);
633       UDisksBlock *block = NULL;
634 
635       block = udisks_object_get_block (object);
636       if (block != NULL)
  • Found 8 duplicate lines in the following files:
    • Between lines 1914 and 1927 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 899 and 908 in /home/tasleson/projects/udisks/src/udiskslinuxpartition.c
    • Between lines 255 and 265 in /home/tasleson/projects/udisks/src/udiskslinuxpartitiontable.c
    • Between lines 460 and 469 in /home/tasleson/projects/udisks/src/udiskslinuxpartition.c
    • Between lines 282 and 292 in /home/tasleson/projects/udisks/src/udiskslinuxpartition.c
    • Between lines 801 and 810 in /home/tasleson/projects/udisks/src/udiskslinuxpartition.c
1914           action_id = "org.freedesktop.udisks2.modify-device-other-seat";
1915         }
1916     }
1917 
1918   /* Check that the user is actually authorized to change the
1919    * filesystem label.
1920    */
1921   if (!udisks_daemon_util_check_authorization_sync (daemon,
1922                                                     object,
1923                                                     action_id,
1924                                                     options,
1925                                                     message,
1926                                                     invocation))
1927     goto out;
  • Found 8 duplicate lines in the following files:
    • Between lines 344 and 355 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxblockzram.c
    • Between lines 244 and 255 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxblockzram.c
344   object = udisks_daemon_util_dup_object (zramblock, &error);
345   if (! object)
346     {
347       g_dbus_method_invocation_take_error (invocation, error);
348       goto out;
349     }
350 
351   /* Policy check */
352   UDISKS_DAEMON_CHECK_AUTHORIZATION (udisks_linux_block_zram_get_daemon(zramblock),
353                                      UDISKS_OBJECT (object),
354                                      zram_policy_action_id,
355                                      options,
  • Found 8 duplicate lines in the following files:
    • Between lines 156 and 180 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxblockbcache.c
    • Between lines 199 and 222 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 157 and 181 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxblockzram.c
156   if (object)
157     {
158       daemon = udisks_linux_block_object_get_daemon (object);
159       g_clear_object (&object);
160     }
161   else
162     {
163       udisks_critical ("%s", error->message);
164       g_clear_error (&error);
165     }
166 
167   return daemon;
168 }
169 
170 /**
171  * udisks_linux_block_bcache_update:
172  * @block: A #UDisksLinuxBlockBcache
173  * @object: The enclosing #UDisksLinuxBlockBcache instance.
174  *
175  * Updates the interface.
176  *
177  * Returns: %TRUE if configuration has changed, %FALSE otherwise.
178  */
179 
180 gboolean
  • Found 8 duplicate lines in the following files:
    • Between lines 2357 and 2371 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1146 and 1160 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 639 and 653 in /home/tasleson/projects/udisks/tools/udisksctl.c
2357       remove_arg ((*argc) - 1, argc, argv);
2358     }
2359 
2360   if (!g_option_context_parse (o, argc, argv, NULL))
2361     {
2362       if (!request_completion)
2363         {
2364           s = g_option_context_get_help (o, FALSE, NULL);
2365           g_printerr ("%s", s);
2366           g_free (s);
2367           goto out;
2368         }
2369     }
2370 
2371   if (request_completion &&
  • Found 8 duplicate lines in the following files:
    • Between lines 2997 and 3010 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2853 and 2866 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2547 and 2560 in /home/tasleson/projects/udisks/tools/udisksctl.c
2997   if (!g_option_context_parse (o, argc, argv, NULL))
2998     {
2999       if (!request_completion)
3000         {
3001           s = g_option_context_get_help (o, FALSE, NULL);
3002           g_printerr ("%s", s);
3003           g_free (s);
3004           goto out;
3005         }
3006     }
3007 
3008   /* done with completion */
3009   if (request_completion)
3010     goto out;
  • Found 8 duplicate lines in the following files:
    • Between lines 700 and 708 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 296 and 304 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
700   if (!(g_strcmp0 (udisks_block_get_id_usage (block), "crypto") == 0 &&
701         g_strcmp0 (udisks_block_get_id_type (block), "crypto_LUKS") == 0))
702     {
703       g_dbus_method_invocation_return_error (invocation,
704                                              UDISKS_ERROR,
705                                              UDISKS_ERROR_FAILED,
706                                              "Device %s does not appear to be a LUKS device",
707                                              udisks_block_get_device (block));
708       goto out;
  • Found 8 duplicate lines in the following files:
    • Between lines 2148 and 2162 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1885 and 1899 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1540 and 1554 in /home/tasleson/projects/udisks/tools/udisksctl.c
2148       remove_arg ((*argc) - 1, argc, argv);
2149     }
2150 
2151   if (!g_option_context_parse (o, argc, argv, NULL))
2152     {
2153       if (!request_completion)
2154         {
2155           s = g_option_context_get_help (o, FALSE, NULL);
2156           g_printerr ("%s", s);
2157           g_free (s);
2158           goto out;
2159         }
2160     }
2161 
2162   if (request_completion)
  • Found 8 duplicate lines in the following files:
    • Between lines 285 and 295 in /home/tasleson/projects/udisks/src/udiskscrypttabmonitor.c
    • Between lines 286 and 296 in /home/tasleson/projects/udisks/src/udisksfstabmonitor.c
285                     error->message, g_quark_to_string (error->domain), error->code);
286       g_clear_error (&error);
287     }
288   else
289     {
290       g_signal_connect (monitor->file_monitor,
291                         "changed",
292                         G_CALLBACK (on_file_monitor_changed),
293                         monitor);
294     }
295   g_object_unref (file);
  • Found 8 duplicate lines in the following files:
    • Between lines 2258 and 2267 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2025 and 2034 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1335 and 1344 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 843 and 852 in /home/tasleson/projects/udisks/tools/udisksctl.c
2258                                          options,
2259                                          NULL,                       /* GCancellable */
2260                                          &error))
2261     {
2262       if (error->domain == UDISKS_ERROR &&
2263           error->code == UDISKS_ERROR_NOT_AUTHORIZED_CAN_OBTAIN &&
2264           setup_local_polkit_agent ())
2265         {
2266           g_clear_error (&error);
2267           goto try_again;
  • Found 7 duplicate lines in the following files:
    • Between lines 1437 and 1443 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1689 and 1695 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1437     UDisksAtaCommandOutput output = {0};
1438     if (!udisks_ata_send_command_sync (fd,
1439                                        -1,
1440                                        UDISKS_ATA_COMMAND_PROTOCOL_NONE,
1441                                        &input,
1442                                        &output,
1443                                        &error))
  • Found 7 duplicate lines in the following files:
    • Between lines 268 and 278 in /home/tasleson/projects/udisks/src/udisksata.c
    • Between lines 1241 and 1250 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
268             io_hdr.timeout = timeout_msec;
269 
270           rc = ioctl(fd, SG_IO, &io_hdr);
271           if (rc != 0)
272             {
273               g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
274                            "SGIO v3 ioctl failed (v4 not supported): %m");
275               goto out;
276             }
277         }
278       else
  • Found 7 duplicate lines in the following files:
    • Between lines 1610 and 1617 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1629 and 1636 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 898 and 905 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1610                                                                action_id,
1611                                                                options,
1612                                                                message,
1613                                                                invocation,
1614                                                                error))
1615     {
1616       ret = FALSE;
1617       goto out;
  • Found 7 duplicate lines in the following files:
    • Between lines 1802 and 1809 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2073 and 2080 in /home/tasleson/projects/udisks/tools/udisksctl.c
1802     "Object path for ATA device",
1803     NULL
1804   },
1805   {
1806     "block-device",
1807     'b',
1808     0,
1809     G_OPTION_ARG_STRING,
  • Found 7 duplicate lines in the following files:
    • Between lines 277 and 287 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 682 and 692 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
277   LuksJobData data;
278 
279   object = udisks_daemon_util_dup_object (encrypted, &error);
280   if (object == NULL)
281     {
282       g_dbus_method_invocation_take_error (invocation, error);
283       goto out;
284     }
285 
286   block = udisks_object_peek_block (object);
287   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
  • Found 7 duplicate lines in the following files:
    • Between lines 378 and 385 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 1087 and 1094 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 871 and 878 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 970 and 977 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
378                GVariant              *options)
379 {
380   GError *error = NULL;
381   UDisksLinuxVolumeGroup *group = UDISKS_LINUX_VOLUME_GROUP (_group);
382   UDisksLinuxVolumeGroupObject *object = NULL;
383   UDisksDaemon *daemon;
384   uid_t caller_uid;
385   gid_t caller_gid;
  • Found 7 duplicate lines in the following files:
    • Between lines 524 and 534 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroupobject.c
    • Between lines 655 and 664 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroupobject.c
524   if (g_variant_lookup (info, "lvs", "aa{sv}", &iter))
525     {
526       GVariant *lv_info = NULL;
527       while (g_variant_iter_loop (iter, "@a{sv}", &lv_info))
528         {
529           const gchar *name;
530           UDisksLinuxLogicalVolumeObject *volume;
531 
532           g_variant_lookup (lv_info, "name", "&s", &name);
533 
534           update_operations (daemon, name, lv_info, &needs_polling);
  • Found 7 duplicate lines in the following files:
    • Between lines 301 and 308 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 407 and 414 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
301   if (initiator_name_fd == -1)
302     {
303       g_dbus_method_invocation_return_error (invocation,
304                                              UDISKS_ERROR,
305                                              UDISKS_ERROR_FAILED,
306                                              N_("Error opening %s: %s"),
307                                              initiator_filename,
308                                              strerror (errno));
  • Found 7 duplicate lines in the following files:
    • Between lines 710 and 719 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
    • Between lines 744 and 753 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
710       if (media_removable)
711         {
712           s = g_strdup_printf ("drive-removable-media%s-symbolic", hyphenated_connection_bus);
713         }
714       else
715         {
716           if (rotation_rate == 0)
717             s = g_strdup_printf ("drive-harddisk-solidstate%s-symbolic", hyphenated_connection_bus);
718           else
719             s = g_strdup_printf ("drive-harddisk%s-symbolic", hyphenated_connection_bus);
  • Found 7 duplicate lines in the following files:
    • Between lines 605 and 615 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 735 and 744 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
605           goto out;
606         }
607     }
608 
609   if (sk_disk_open (g_udev_device_get_device_file (device->udev_device), &d) != 0)
610     {
611       g_set_error (error,
612                    UDISKS_ERROR,
613                    UDISKS_ERROR_FAILED,
614                    "sk_disk_open: %m");
615       goto out;
  • Found 7 duplicate lines in the following files:
    • Between lines 245 and 252 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 279 and 286 in /home/tasleson/projects/udisks/src/tests/test.c
245                                       GError           *error,
246                                       gint              status,
247                                       GString          *standard_output,
248                                       GString          *standard_error,
249                                       gpointer          user_data)
250 {
251   g_assert_no_error (error);
252   g_assert_cmpstr (standard_output->str, ==, "");
  • Found 7 duplicate lines in the following files:
    • Between lines 1830 and 1837 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2101 and 2108 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2307 and 2314 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2832 and 2839 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2975 and 2982 in /home/tasleson/projects/udisks/tools/udisksctl.c
1830                                gchar      **argv[],
1831                                gboolean     request_completion,
1832                                const gchar *completion_cur,
1833                                const gchar *completion_prev)
1834 {
1835   gint ret;
1836   GOptionContext *o;
1837   gchar *s;
  • Found 7 duplicate lines in the following files:
    • Between lines 676 and 702 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 758 and 768 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
676  out:
677   g_clear_object (&device);
678   if (d != NULL)
679     sk_disk_free (d);
680   g_clear_object (&object);
681   return ret;
682 }
683 
684 /* ---------------------------------------------------------------------------------------------------- */
685 
686 /**
687  * udisks_linux_drive_ata_smart_selftest_sync:
688  * @drive: A #UDisksLinuxDriveAta.
689  * @type: The type of selftest to run.
690  * @cancellable: (allow-none): A #GCancellable that can be used to cancel the operation or %NULL.
691  * @error: Return location for error or %NULL.
692  *
693  * Starts (or aborts) a SMART self-test on @drive. Valid values for
694  * @type includes 'short', 'extended', 'conveyance' and 'abort'.
695  *
696  * The calling thread is blocked while sending the command to the
697  * drive but will return immediately after the drive acknowledges the
698  * command.
699  *
700  * Returns: %TRUE if the operation succeed, %FALSE if @error is set.
701  */
702 gboolean
  • Found 7 duplicate lines in the following files:
    • Between lines 1572 and 1582 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1915 and 1925 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2167 and 2177 in /home/tasleson/projects/udisks/tools/udisksctl.c
1572               g_print ("--object-path \n"
1573                        "--block-device \n");
1574             }
1575 
1576           if (complete_objects)
1577             {
1578               const gchar *object_path;
1579               objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
1580               for (l = objects; l != NULL; l = l->next)
1581                 {
1582                   object = UDISKS_OBJECT (l->data);
  • Found 7 duplicate lines in the following files:
    • Between lines 993 and 1001 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
    • Between lines 222 and 230 in /home/tasleson/projects/udisks/src/udiskslinuxpartitiontable.c
    • Between lines 1169 and 1177 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1227 and 1235 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
993       goto out;
994     }
995 
996   error = NULL;
997   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
998                                                invocation,
999                                                NULL /* GCancellable */,
1000                                                &caller_uid,
1001                                                &caller_gid,
  • Found 7 duplicate lines in the following files:
    • Between lines 1279 and 1286 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1400 and 1407 in /home/tasleson/projects/udisks/src/udisksstate.c
1279       error = NULL;
1280       if (!udisks_state_set (state,
1281                              "unlocked-luks",
1282                              G_VARIANT_TYPE ("a{ta{sv}}"),
1283                              new_value, /* consumes new_value */
1284                              &error))
1285         {
1286           udisks_warning ("Error setting unlocked-luks: %s (%s, %d)",
  • Found 7 duplicate lines in the following files:
    • Between lines 304 and 313 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 540 and 549 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
304       goto out;
305     }
306 
307   /* Fail if device is already unlocked */
308   cleartext_object = udisks_daemon_wait_for_object_sync (daemon,
309                                                          wait_for_cleartext_object,
310                                                          g_strdup (g_dbus_object_get_object_path (G_DBUS_OBJECT (object))),
311                                                          g_free,
312                                                          0, /* timeout_seconds */
313                                                          NULL); /* error */
  • Found 7 duplicate lines in the following files:
    • Between lines 527 and 536 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 646 and 655 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 776 and 785 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
527       g_dbus_method_invocation_return_error (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
528                                              "No block interface on given object");
529       goto out;
530     }
531 
532   /* Policy check. */
533   UDISKS_DAEMON_CHECK_AUTHORIZATION (daemon,
534                                      UDISKS_OBJECT (object),
535                                      lvm2_policy_action_id,
536                                      options,
  • Found 7 duplicate lines in the following files:
    • Between lines 906 and 918 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1367 and 1379 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1746 and 1758 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 2084 and 2096 in /home/tasleson/projects/udisks/src/udisksstate.c
906           else
907             {
908               g_variant_builder_add_value (&builder, child);
909             }
910           g_variant_unref (child);
911         }
912       g_variant_unref (value);
913     }
914 
915   /* build the details */
916   g_variant_builder_init (&details_builder, G_VARIANT_TYPE ("a{sv}"));
917   g_variant_builder_add (&details_builder,
918                          "{sv}",
  • Found 7 duplicate lines in the following files:
    • Between lines 429 and 436 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 757 and 764 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
429                                                &data,
430                                                NULL, /* user_data_free_func */
431                                                NULL, /* cancellable */
432                                                &error))
433     {
434       g_dbus_method_invocation_return_error (invocation,
435                                              UDISKS_ERROR,
436                                              UDISKS_ERROR_FAILED,
  • Found 7 duplicate lines in the following files:
    • Between lines 861 and 868 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 988 and 995 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
861                                                   NULL, /* cancellable */
862                                                   &error))
863     {
864       udisks_warning ("Error updating ATA smart for %s: %s (%s, %d)",
865                       g_dbus_object_get_object_path (G_DBUS_OBJECT (object)),
866                       error->message, g_quark_to_string (error->domain), error->code);
867       g_dbus_method_invocation_take_error (invocation, error);
868       goto out;
  • Found 7 duplicate lines in the following files:
    • Between lines 1658 and 1665 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1779 and 1786 in /home/tasleson/projects/udisks/src/udisksstate.c
1658       error = NULL;
1659       if (!udisks_state_set (state,
1660                              "loop",
1661                              G_VARIANT_TYPE ("a{sa{sv}}"),
1662                              new_value, /* consumes new_value */
1663                              &error))
1664         {
1665           udisks_warning ("Error setting loop: %s (%s, %d)",
  • Found 7 duplicate lines in the following files:
    • Between lines 843 and 851 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1335 and 1343 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1746 and 1754 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2025 and 2033 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2258 and 2266 in /home/tasleson/projects/udisks/tools/udisksctl.c
843                                                 options,
844                                                 NULL,         /* GCancellable */
845                                                 &error))
846         {
847           if (error->domain == UDISKS_ERROR &&
848               error->code == UDISKS_ERROR_NOT_AUTHORIZED_CAN_OBTAIN &&
849               setup_local_polkit_agent ())
850             {
851               g_clear_error (&error);
  • Found 7 duplicate lines in the following files:
    • Between lines 757 and 764 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
    • Between lines 799 and 806 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
757       vendor = g_udev_device_get_property (device->udev_device, "ID_VENDOR_ENC");
758       if (vendor != NULL)
759         {
760           gchar *s;
761           s = udisks_decode_udev_string (vendor);
762           g_strstrip (s);
763           udisks_drive_set_vendor (iface, s);
764           g_free (s);
  • Found 7 duplicate lines in the following files:
    • Between lines 1761 and 1771 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2041 and 2052 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2274 and 2285 in /home/tasleson/projects/udisks/tools/udisksctl.c
1761           goto out;
1762         }
1763       g_object_unref (object);
1764     }
1765 
1766   ret = 0;
1767 
1768  out:
1769   if (options != NULL)
1770     g_variant_unref (options);
1771   g_option_context_free (o);
  • Found 7 duplicate lines in the following files:
    • Between lines 1834 and 1844 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1911 and 1921 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1156 and 1166 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1991 and 2001 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1834   GError *error;
1835 
1836   error = NULL;
1837   object = udisks_daemon_util_dup_object (block, &error);
1838   if (object == NULL)
1839     {
1840       g_dbus_method_invocation_take_error (invocation, error);
1841       goto out;
1842     }
1843 
1844   daemon = udisks_linux_block_object_get_daemon (object);
  • Found 7 duplicate lines in the following files:
    • Between lines 707 and 716 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 1599 and 1608 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
707                                              udisks_block_get_device (block));
708       goto out;
709     }
710 
711   error = NULL;
712   if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
713     {
714       g_dbus_method_invocation_return_gerror (invocation, error);
715       g_clear_error (&error);
716       goto out;
  • Found 7 duplicate lines in the following files:
    • Between lines 1001 and 1008 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1044 and 1051 in /home/tasleson/projects/udisks/tools/udisksctl.c
1001     NULL
1002   },
1003   {
1004     "block-device",
1005     'b',
1006     0,
1007     G_OPTION_ARG_STRING,
1008     &opt_unlock_lock_device,
  • Found 7 duplicate lines in the following files:
    • Between lines 657 and 664 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1026 and 1033 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1192 and 1199 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1326 and 1333 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1446 and 1453 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
657               GVariant               *options)
658 {
659   UDisksLinuxMDRaid *mdraid = UDISKS_LINUX_MDRAID (_mdraid);
660   UDisksDaemon *daemon;
661   UDisksState *state;
662   UDisksLinuxMDRaidObject *object;
663   const gchar *action_id;
664   const gchar *message;
  • Found 7 duplicate lines in the following files:
    • Between lines 815 and 823 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1305 and 1313 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 844 and 852 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1336 and 1344 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2026 and 2034 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2259 and 2267 in /home/tasleson/projects/udisks/tools/udisksctl.c
815                                               NULL,                       /* GCancellable */
816                                               &error))
817         {
818           if (error->domain == UDISKS_ERROR &&
819               error->code == UDISKS_ERROR_NOT_AUTHORIZED_CAN_OBTAIN &&
820               setup_local_polkit_agent ())
821             {
822               g_clear_error (&error);
823               goto try_again;
  • Found 7 duplicate lines in the following files:
    • Between lines 215 and 225 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
    • Between lines 188 and 198 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
215 static void
216 strip_and_replace_with_uscore (gchar *s)
217 {
218   guint n;
219 
220   if (s == NULL)
221     goto out;
222 
223   g_strstrip (s);
224 
225   for (n = 0; s != NULL && s[n] != '\0'; n++)
  • Found 7 duplicate lines in the following files:
    • Between lines 1811 and 1818 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2082 and 2089 in /home/tasleson/projects/udisks/tools/udisksctl.c
1811     "Device file for ATA device",
1812     NULL
1813   },
1814   {
1815     "no-user-interaction",
1816     0, /* no short option */
1817     0,
1818     G_OPTION_ARG_NONE,
  • Found 7 duplicate lines in the following files:
    • Between lines 748 and 759 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1245 and 1256 in /home/tasleson/projects/udisks/tools/udisksctl.c
748           goto out;
749         }
750     }
751   else
752     {
753       s = g_option_context_get_help (o, FALSE, NULL);
754       g_printerr ("%s", s);
755       g_free (s);
756       goto out;
757     }
758 
759   block = udisks_object_peek_block (object);
  • Found 7 duplicate lines in the following files:
    • Between lines 820 and 828 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
    • Between lines 791 and 799 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
820       goto out;
821     }
822   if (!S_ISBLK (statbuf.st_mode))
823     {
824       g_dbus_method_invocation_return_error (invocation,
825                                              UDISKS_ERROR,
826                                              UDISKS_ERROR_FAILED,
827                                              "Device file %s is not a block device",
828                                              raid_device_file);
  • Found 7 duplicate lines in the following files:
    • Between lines 595 and 603 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 640 and 648 in /home/tasleson/projects/udisks/udisks/udisksclient.c
595         ret = g_list_prepend (ret, block);
596       else
597         g_object_unref (block);
598     }
599 
600   g_list_foreach (object_proxies, (GFunc) g_object_unref, NULL);
601   g_list_free (object_proxies);
602   ret = g_list_reverse (ret);
603   return ret;
  • Found 7 duplicate lines in the following files:
    • Between lines 714 and 721 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 832 and 839 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
714                          UDisksDaemon      *daemon,
715                          gboolean           include_secrets,
716                          GError           **error)
717 {
718   GList *entries;
719   GList *l;
720   GVariantBuilder builder;
721   GVariant *ret;
  • Found 7 duplicate lines in the following files:
    • Between lines 678 and 685 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
    • Between lines 249 and 256 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
678       object = udisks_daemon_find_object (manager->daemon, arg_blocks[n]);
679       if (object == NULL)
680         {
681           g_dbus_method_invocation_return_error (invocation,
682                                                  UDISKS_ERROR,
683                                                  UDISKS_ERROR_FAILED,
684                                                  "Invalid object path %s at index %u",
685                                                  arg_blocks[n], n);
  • Found 7 duplicate lines in the following files:
    • Between lines 154 and 165 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxiscsisession.c
    • Between lines 642 and 653 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 703 and 714 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
154                       arg_iface,
155                       arg_options,
156                       &errorstr);
157 
158   /* Leave the critical section. */
159   udisks_iscsi_state_unlock_libiscsi_context (state);
160 
161   if (err != 0)
162     {
163       /* Logout failed. */
164       g_dbus_method_invocation_return_error (invocation,
165                                              UDISKS_ERROR,
  • Found 7 duplicate lines in the following files:
    • Between lines 3268 and 3275 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 101 and 108 in /home/tasleson/projects/udisks/tools/umount-udisks.c
3268   error = NULL;
3269   client = udisks_client_new_sync (NULL, /* GCancellable */
3270                                    &error);
3271   if (client == NULL)
3272     {
3273       g_printerr ("Error connecting to the udisks daemon: %s\n", error->message);
3274       g_clear_error (&error);
3275       goto out;
  • Found 7 duplicate lines in the following files:
    • Between lines 677 and 687 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1209 and 1219 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1340 and 1350 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1460 and 1470 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
677   UDisksBaseJob *job = NULL;
678 
679   object = udisks_daemon_util_dup_object (mdraid, &error);
680   if (object == NULL)
681     {
682       g_dbus_method_invocation_take_error (invocation, error);
683       goto out;
684     }
685 
686   daemon = udisks_linux_mdraid_object_get_daemon (object);
687   state = udisks_daemon_get_state (daemon);
  • Found 7 duplicate lines in the following files:
    • Between lines 493 and 500 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 545 and 552 in /home/tasleson/projects/udisks/tools/udisksctl.c
493     NULL
494   },
495   {
496     "block-device",
497     'b',
498     0,
499     G_OPTION_ARG_STRING,
500     &opt_mount_unmount_device,
  • Found 7 duplicate lines in the following files:
    • Between lines 2004 and 2011 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 2109 and 2116 in /home/tasleson/projects/udisks/src/udisksstate.c
2004       error = NULL;
2005       if (!udisks_state_set (state,
2006                              "mdraid",
2007                              G_VARIANT_TYPE ("a{ta{sv}}"),
2008                              new_value, /* consumes new_value */
2009                              &error))
2010         {
2011           udisks_warning ("Error setting mdraid: %s (%s, %d)",
  • Found 7 duplicate lines in the following files:
    • Between lines 693 and 702 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
    • Between lines 727 and 736 in /home/tasleson/projects/udisks/udisks/udisksobjectinfo.c
693       if (media_removable)
694         {
695           s = g_strdup_printf ("drive-removable-media%s", hyphenated_connection_bus);
696         }
697       else
698         {
699           if (rotation_rate == 0)
700             s = g_strdup_printf ("drive-harddisk-solidstate%s", hyphenated_connection_bus);
701           else
702             s = g_strdup_printf ("drive-harddisk%s", hyphenated_connection_bus);
  • Found 7 duplicate lines in the following files:
    • Between lines 738 and 745 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
    • Between lines 767 and 774 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
    • Between lines 828 and 835 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
738       model = g_udev_device_get_property (device->udev_device, "ID_MODEL_ENC");
739       if (model != NULL)
740         {
741           gchar *s;
742           s = udisks_decode_udev_string (model);
743           g_strstrip (s);
744           udisks_drive_set_model (iface, s);
745           g_free (s);
  • Found 7 duplicate lines in the following files:
    • Between lines 1722 and 1729 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1753 and 1760 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
1722           input.count = 0x00;
1723         }
1724       if (!udisks_ata_send_command_sync (fd,
1725                                          -1,
1726                                          UDISKS_ATA_COMMAND_PROTOCOL_NONE,
1727                                          &input,
1728                                          &output,
1729                                          &error))
  • Found 7 duplicate lines in the following files:
    • Between lines 2578 and 2590 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 3103 and 3115 in /home/tasleson/projects/udisks/tools/udisksctl.c
2578   g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2579   g_list_free (objects);
2580 
2581   ret = 0;
2582 
2583  out:
2584   g_option_context_free (o);
2585   return ret;
2586 }
2587 
2588 /* ---------------------------------------------------------------------------------------------------- */
2589 
2590 static void
  • Found 7 duplicate lines in the following files:
    • Between lines 1725 and 1733 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 729 and 736 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1725                                                         action_id,
1726                                                         options,
1727                                                         message,
1728                                                         invocation))
1729         goto out;
1730     }
1731 
1732   job = udisks_daemon_launch_simple_job (daemon,
1733                                          UDISKS_OBJECT (object),
  • Found 7 duplicate lines in the following files:
    • Between lines 955 and 963 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 1017 and 1025 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 890 and 898 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 584 and 592 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 629 and 637 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 674 and 682 in /home/tasleson/projects/udisks/udisks/udisksclient.c
955   object_proxies = g_dbus_object_manager_get_objects (client->object_manager);
956   for (l = object_proxies; l != NULL; l = l->next)
957     {
958       UDisksObject *object = UDISKS_OBJECT (l->data);
959       UDisksBlock *block;
960 
961       block = udisks_object_get_block (object);
962       if (block == NULL)
963         continue;
  • Found 7 duplicate lines in the following files:
    • Between lines 818 and 825 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 939 and 946 in /home/tasleson/projects/udisks/src/udisksstate.c
818       error = NULL;
819       if (!udisks_state_set (state,
820                              "mounted-fs",
821                              G_VARIANT_TYPE ("a{sa{sv}}"),
822                              new_value, /* consumes new_value */
823                              &error))
824         {
825           udisks_warning ("Error setting mounted-fs: %s (%s, %d)",
  • Found 6 duplicate lines in the following files:
    • Between lines 151 and 159 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroupobject.c
    • Between lines 132 and 140 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolumeobject.c
151   switch (prop_id)
152     {
153     case PROP_DAEMON:
154       g_assert (object->daemon == NULL);
155       /* we don't take a reference to the daemon */
156       object->daemon = g_value_get_object (value);
157       break;
158 
159     case PROP_NAME:
  • Found 6 duplicate lines in the following files:
    • Between lines 2975 and 2981 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2832 and 2838 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2524 and 2530 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2307 and 2313 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2101 and 2107 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1830 and 1836 in /home/tasleson/projects/udisks/tools/udisksctl.c
2975                         gchar      **argv[],
2976                         gboolean     request_completion,
2977                         const gchar *completion_cur,
2978                         const gchar *completion_prev)
2979 {
2980   gint ret;
2981   GOptionContext *o;
  • Found 6 duplicate lines in the following files:
    • Between lines 1462 and 1470 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1342 and 1350 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1211 and 1219 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1048 and 1056 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 679 and 687 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1462   object = udisks_daemon_util_dup_object (mdraid, &error);
1463   if (object == NULL)
1464     {
1465       g_dbus_method_invocation_take_error (invocation, error);
1466       goto out;
1467     }
1468 
1469   daemon = udisks_linux_mdraid_object_get_daemon (object);
1470   state = udisks_daemon_get_state (daemon);
  • Found 6 duplicate lines in the following files:
    • Between lines 2513 and 2523 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 488 and 500 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
2513           goto out;
2514         }
2515     }
2516 
2517  out:
2518   g_list_foreach (objects, (GFunc) g_object_unref, NULL);
2519   g_list_free (objects);
2520   return ret;
2521 }
2522 
2523 static gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 228 and 236 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxmanagerbtrfs.c
    • Between lines 257 and 265 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
    • Between lines 687 and 695 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
228           goto out;
229         }
230 
231       block = udisks_object_get_block (object);
232       if (block == NULL)
233         {
234           g_dbus_method_invocation_return_error (invocation,
235                                                  UDISKS_ERROR,
236                                                  UDISKS_ERROR_FAILED,
  • Found 6 duplicate lines in the following files:
    • Between lines 125 and 137 in /home/tasleson/projects/udisks/modules/bcache/udisksbcachemoduleiface.c
    • Between lines 130 and 144 in /home/tasleson/projects/udisks/modules/btrfs/udisksbtrfsmoduleiface.c
    • Between lines 127 and 139 in /home/tasleson/projects/udisks/modules/zram/udiskszrammoduleiface.c
125   return iface;
126 }
127 
128 /* ------------------------------------------------------------------------------------ */
129 
130 UDisksModuleInterfaceInfo **
131 udisks_module_get_drive_object_iface_setup_entries (void)
132 {
133   return NULL;
134 }
135 
136 UDisksModuleObjectNewFunc *
137 udisks_module_get_object_new_funcs (void)
  • Found 6 duplicate lines in the following files:
    • Between lines 784 and 790 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 812 and 818 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
784   if (stat (raid_device_file, &statbuf) != 0)
785     {
786       g_dbus_method_invocation_return_error (invocation,
787                                              UDISKS_ERROR,
788                                              UDISKS_ERROR_FAILED,
789                                              "Error calling stat(2) on %s: %m",
790                                              raid_device_file);
  • Found 6 duplicate lines in the following files:
    • Between lines 1814 and 1823 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1512 and 1521 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1814   g_strfreev (lines);
1815   g_free (contents);
1816   if (str != NULL)
1817     g_string_free (str, TRUE);
1818   return ret;
1819 }
1820 
1821 /* ---------------------------------------------------------------------------------------------------- */
1822 
1823 static gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 1966 and 1977 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 1889 and 1900 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
1966       goto out;
1967     }
1968 
1969  out:
1970   g_variant_unref (details);
1971   g_clear_object (&object);
1972   return TRUE; /* returning TRUE means that we handled the method invocation */
1973 }
1974 
1975 /* ---------------------------------------------------------------------------------------------------- */
1976 
1977 static gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 44 and 51 in /home/tasleson/projects/udisks/tools/umount-udisks.c
    • Between lines 964 and 971 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 401 and 408 in /home/tasleson/projects/udisks/tools/udisksctl.c
44   objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
45   for (l = objects; l != NULL; l = l->next)
46     {
47       UDisksObject *object = UDISKS_OBJECT (l->data);
48       UDisksBlock *block;
49 
50       block = udisks_object_peek_block (object);
51       if (block != NULL)
  • Found 6 duplicate lines in the following files:
    • Between lines 422 and 428 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 387 and 393 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 279 and 285 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 245 and 251 in /home/tasleson/projects/udisks/src/tests/test.c
    • Between lines 211 and 217 in /home/tasleson/projects/udisks/src/tests/test.c
422                                               GError           *error,
423                                               gint              status,
424                                               GString          *standard_output,
425                                               GString          *standard_error,
426                                               gpointer          user_data)
427 {
428   g_assert_no_error (error);
  • Found 6 duplicate lines in the following files:
    • Between lines 83 and 91 in /home/tasleson/projects/udisks/src/udisksconfigmanager.c
    • Between lines 59 and 67 in /home/tasleson/projects/udisks/src/udisksconfigmanager.c
83                                     guint         property_id,
84                                     const GValue *value,
85                                     GParamSpec   *pspec)
86 {
87   UDisksConfigManager *manager = UDISKS_CONFIG_MANAGER (object);
88 
89   switch (property_id)
90     {
91     case PROP_UNINSTALLED:
  • Found 6 duplicate lines in the following files:
    • Between lines 102 and 110 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxmanagerzram.c
    • Between lines 82 and 90 in /home/tasleson/projects/udisks/modules/zram/udiskslinuxmanagerzram.c
102                                         guint          property_id,
103                                         const GValue  *value,
104                                         GParamSpec    *pspec)
105 {
106   UDisksLinuxManagerZRAM *manager = UDISKS_LINUX_MANAGER_ZRAM (object);
107 
108   switch (property_id)
109     {
110     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 518 and 532 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 283 and 297 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
518       goto out;
519     }
520 
521   block = udisks_object_peek_block (object);
522   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
523   state = udisks_daemon_get_state (daemon);
524 
525   /* TODO: check if the device is mentioned in /etc/crypttab (see crypttab(5)) - if so use that
526    *
527    *       Of course cryptsetup(8) don't support that, see https://bugzilla.redhat.com/show_bug.cgi?id=692258
528    */
529 
530   /* Fail if the device is not a LUKS device */
531   if (!(g_strcmp0 (udisks_block_get_id_usage (block), "crypto") == 0 &&
532         g_strcmp0 (udisks_block_get_id_type (block), "crypto_LUKS") == 0))
  • Found 6 duplicate lines in the following files:
    • Between lines 365 and 374 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 194 and 203 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
365 static UDisksObject *
366 wait_for_volume_group_object (UDisksDaemon *daemon,
367                               gpointer      user_data)
368 {
369   const gchar *name = user_data;
370 
371   return UDISKS_OBJECT (udisks_daemon_util_lvm2_find_volume_group_object (daemon, name));
372 }
373 
374 static gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 705 and 715 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 644 and 654 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 533 and 543 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
705                       &errorstr);
706 
707   /* Leave the critical section. */
708   udisks_iscsi_state_unlock_libiscsi_context (state);
709 
710   if (err != 0)
711     {
712       /* Logout failed. */
713       g_dbus_method_invocation_return_error (invocation,
714                                              UDISKS_ERROR,
715                                              iscsi_error_to_udisks_error (err),
  • Found 6 duplicate lines in the following files:
    • Between lines 194 and 202 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 143 and 151 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
194   switch (prop_id)
195     {
196     case PROP_DAEMON:
197       g_assert (object->daemon == NULL);
198       /* we don't take a reference to the daemon */
199       object->daemon = g_value_get_object (value);
200       break;
201 
202     case PROP_DEVICE:
  • Found 6 duplicate lines in the following files:
    • Between lines 156 and 164 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
    • Between lines 136 and 144 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
156                                          guint         prop_id,
157                                          const GValue *value,
158                                          GParamSpec   *pspec)
159 {
160   UDisksLinuxMDRaidObject *object = UDISKS_LINUX_MDRAID_OBJECT (__object);
161 
162   switch (prop_id)
163     {
164     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 2117 and 2137 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 1787 and 1807 in /home/tasleson/projects/udisks/src/udisksstate.c
2117                       error->message, g_quark_to_string (error->domain), error->code);
2118       g_clear_error (&error);
2119       goto out;
2120     }
2121 
2122  out:
2123   g_mutex_unlock (&state->lock);
2124 }
2125 
2126 /**
2127  * udisks_state_has_mdraid:
2128  * @state: A #UDisksState
2129  * @raid_device: A #dev_t for the RAID device.
2130  * @out_uid: Return location for the user id who setup the loop device or %NULL.
2131  * @error: Return location for error or %NULL.
2132  *
2133  * Checks if @raid_device is set up via udisks.
2134  *
2135  * Returns: %TRUE if set up via udisks, otherwise %FALSE or if @error is set.
2136  */
2137 gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 239 and 247 in /home/tasleson/projects/udisks/src/udisksstate.c
    • Between lines 219 and 227 in /home/tasleson/projects/udisks/src/udisksstate.c
239                            guint         prop_id,
240                            const GValue *value,
241                            GParamSpec   *pspec)
242 {
243   UDisksState *state = UDISKS_STATE (object);
244 
245   switch (prop_id)
246     {
247     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 126 and 134 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolumeobject.c
    • Between lines 102 and 110 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolumeobject.c
126                                                  guint         prop_id,
127                                                  const GValue *value,
128                                                  GParamSpec   *pspec)
129 {
130   UDisksLinuxLogicalVolumeObject *object = UDISKS_LINUX_LOGICAL_VOLUME_OBJECT (__object);
131 
132   switch (prop_id)
133     {
134     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 140 and 148 in /home/tasleson/projects/udisks/src/udisksthreadedjob.c
    • Between lines 112 and 120 in /home/tasleson/projects/udisks/src/udisksthreadedjob.c
140                                   guint         prop_id,
141                                   const GValue *value,
142                                   GParamSpec   *pspec)
143 {
144   UDisksThreadedJob *job = UDISKS_THREADED_JOB (object);
145 
146   switch (prop_id)
147     {
148     case PROP_JOB_FUNC:
  • Found 6 duplicate lines in the following files:
    • Between lines 63 and 74 in /home/tasleson/projects/udisks/modules/iscsi/udisksiscsimoduleiface.c
    • Between lines 93 and 104 in /home/tasleson/projects/udisks/modules/lvm2/udiskslvm2moduleiface.c
63 UDisksModuleInterfaceInfo **
64 udisks_module_get_block_object_iface_setup_entries (void)
65 {
66   return NULL;
67 }
68 
69 /* ---------------------------------------------------------------------------------------------------- */
70 
71 UDisksModuleInterfaceInfo **
72 udisks_module_get_drive_object_iface_setup_entries (void)
73 {
74   return NULL;
  • Found 6 duplicate lines in the following files:
    • Between lines 2380 and 2387 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 966 and 973 in /home/tasleson/projects/udisks/src/udiskslinuxdrive.c
2380   uid_t caller_uid;
2381   gid_t caller_gid;
2382 
2383   object = udisks_daemon_util_dup_object (drive, &error);
2384   if (object == NULL)
2385     {
2386       g_dbus_method_invocation_take_error (invocation, error);
2387       goto out;
  • Found 6 duplicate lines in the following files:
    • Between lines 425 and 435 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 360 and 368 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
425       g_dbus_method_invocation_take_error (invocation, error);
426       goto out;
427     }
428 
429   /* Complete DBus call. */
430   udisks_filesystem_btrfs_complete_set_label (fs_btrfs,
431                                               invocation);
432 
433 out:
434   /* Release the resources */
435   g_clear_object (&object);
  • Found 6 duplicate lines in the following files:
    • Between lines 728 and 734 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 597 and 603 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 478 and 484 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
728                      GVariant              *options)
729 {
730   UDisksLinuxVolumeGroup *group = UDISKS_LINUX_VOLUME_GROUP (_group);
731   UDisksDaemon *daemon;
732   UDisksLinuxVolumeGroupObject *object;
733   uid_t caller_uid;
734   gid_t caller_gid;
  • Found 6 duplicate lines in the following files:
    • Between lines 184 and 192 in /home/tasleson/projects/udisks/src/udisksspawnedjob.c
    • Between lines 164 and 172 in /home/tasleson/projects/udisks/src/udisksspawnedjob.c
184                                  guint         prop_id,
185                                  const GValue *value,
186                                  GParamSpec   *pspec)
187 {
188   UDisksSpawnedJob *job = UDISKS_SPAWNED_JOB (object);
189 
190   switch (prop_id)
191     {
192     case PROP_COMMAND_LINE:
  • Found 6 duplicate lines in the following files:
    • Between lines 301 and 308 in /home/tasleson/projects/udisks/src/udisksspawnedjob.c
    • Between lines 287 and 294 in /home/tasleson/projects/udisks/src/udisksspawnedjob.c
301                    GIOCondition condition,
302                    gpointer user_data)
303 {
304   UDisksSpawnedJob *job = UDISKS_SPAWNED_JOB (user_data);
305   gchar buf[1024];
306   gsize bytes_read;
307 
308   g_io_channel_read_chars (channel, buf, sizeof buf, &bytes_read, NULL);
  • Found 6 duplicate lines in the following files:
    • Between lines 2167 and 2175 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1915 and 1923 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1572 and 1580 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1164 and 1173 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 657 and 666 in /home/tasleson/projects/udisks/tools/udisksctl.c
2167           g_print ("--object-path \n"
2168                    "--block-device \n");
2169         }
2170 
2171       if (complete_objects)
2172         {
2173           const gchar *object_path;
2174           objects = g_dbus_object_manager_get_objects (udisks_client_get_object_manager (client));
2175           for (l = objects; l != NULL; l = l->next)
  • Found 6 duplicate lines in the following files:
    • Between lines 1222 and 1231 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 1121 and 1131 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
1222   if (cmd)
1223     g_string_free (cmd, TRUE);
1224   g_clear_object (&object);
1225 
1226   return TRUE;
1227 
1228 #endif /* HAVE_LVMCACHE */
1229 }
1230 
1231 static gboolean
  • Found 6 duplicate lines in the following files:
    • Between lines 137 and 145 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
    • Between lines 117 and 125 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
137                                         guint         prop_id,
138                                         const GValue *value,
139                                         GParamSpec   *pspec)
140 {
141   UDisksLinuxDriveObject *object = UDISKS_LINUX_DRIVE_OBJECT (__object);
142 
143   switch (prop_id)
144     {
145     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 972 and 978 in /home/tasleson/projects/udisks/src/udisksdaemon.c
    • Between lines 795 and 801 in /home/tasleson/projects/udisks/src/udisksdaemon.c
972                                        const gchar     *input_string,
973                                        const gchar     *command_line_format,
974                                        ...)
975 {
976   va_list var_args;
977   gchar *command_line;
978   GString *input_string_as_gstring = NULL;
  • Found 6 duplicate lines in the following files:
    • Between lines 1029 and 1039 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 971 and 981 in /home/tasleson/projects/udisks/udisks/udisksclient.c
1029           ret = g_list_prepend (ret, block); /* adopts reference to block */
1030         }
1031       else
1032         {
1033           g_object_unref (block);
1034         }
1035     }
1036 
1037  out:
1038   g_list_foreach (object_proxies, (GFunc) g_object_unref, NULL);
1039   g_list_free (object_proxies);
  • Found 6 duplicate lines in the following files:
    • Between lines 55 and 65 in /home/tasleson/projects/udisks/tools/umount-udisks.c
    • Between lines 424 and 435 in /home/tasleson/projects/udisks/tools/udisksctl.c
55               ret = g_object_ref (object);
56               goto out;
57             }
58         }
59     }
60 
61  out:
62   g_list_foreach (objects, (GFunc) g_object_unref, NULL);
63   g_list_free (objects);
64 
65   return ret;
  • Found 6 duplicate lines in the following files:
    • Between lines 198 and 206 in /home/tasleson/projects/udisks/src/udisksdaemon.c
    • Between lines 142 and 150 in /home/tasleson/projects/udisks/src/udisksdaemon.c
198                             guint         prop_id,
199                             const GValue *value,
200                             GParamSpec   *pspec)
201 {
202   UDisksDaemon *daemon = UDISKS_DAEMON (object);
203 
204   switch (prop_id)
205     {
206     case PROP_CONNECTION:
  • Found 6 duplicate lines in the following files:
    • Between lines 2468 and 2476 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1726 and 1734 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1245 and 1253 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 748 and 756 in /home/tasleson/projects/udisks/tools/udisksctl.c
2468           goto out;
2469         }
2470     }
2471   else
2472     {
2473       s = g_option_context_get_help (o, FALSE, NULL);
2474       g_printerr ("%s", s);
2475       g_free (s);
2476       goto out;
  • Found 6 duplicate lines in the following files:
    • Between lines 398 and 404 in /home/tasleson/projects/udisks/src/udiskslinuxpartitiontable.c
    • Between lines 2897 and 2904 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
398           if (g_error_matches (error, BD_FS_ERROR, BD_FS_ERROR_NOFS))
399             g_clear_error (&error);
400           else
401             {
402               g_dbus_method_invocation_return_error (invocation,
403                                                      UDISKS_ERROR,
404                                                      UDISKS_ERROR_FAILED,
  • Found 6 duplicate lines in the following files:
    • Between lines 3202 and 3211 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3187 and 3196 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
3202           if (umount (tos_dir) != 0)
3203             {
3204               udisks_warning ("Error unmounting directory %s: %m", tos_dir);
3205               goto out;
3206             }
3207           if (rmdir (tos_dir) != 0)
3208             {
3209               udisks_warning ("Error removing directory %s: %m", tos_dir);
3210             }
3211           goto out;
  • Found 6 duplicate lines in the following files:
    • Between lines 97 and 105 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxmanagerbcache.c
    • Between lines 77 and 85 in /home/tasleson/projects/udisks/modules/bcache/udiskslinuxmanagerbcache.c
97                                           guint          property_id,
98                                           const GValue  *value,
99                                           GParamSpec    *pspec)
100 {
101   UDisksLinuxManagerBcache *manager = UDISKS_LINUX_MANAGER_BCACHE (object);
102 
103   switch (property_id)
104     {
105     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 188 and 196 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 164 and 172 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
188                                         guint         prop_id,
189                                         const GValue *value,
190                                         GParamSpec   *pspec)
191 {
192   UDisksLinuxBlockObject *object = UDISKS_LINUX_BLOCK_OBJECT (__object);
193 
194   switch (prop_id)
195     {
196     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 1551 and 1557 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 187 and 193 in /home/tasleson/projects/udisks/src/udiskslinuxloop.c
1551                 GDBusMethodInvocation *invocation,
1552                 GVariant              *options)
1553 {
1554   UDisksObject *object;
1555   UDisksBlock *block;
1556   UDisksDaemon *daemon;
1557   UDisksState *state;
  • Found 6 duplicate lines in the following files:
    • Between lines 145 and 153 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroupobject.c
    • Between lines 121 and 129 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroupobject.c
145                                                guint         prop_id,
146                                                const GValue *value,
147                                                GParamSpec   *pspec)
148 {
149   UDisksLinuxVolumeGroupObject *object = UDISKS_LINUX_VOLUME_GROUP_OBJECT (__object);
150 
151   switch (prop_id)
152     {
153     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 1363 and 1375 in /home/tasleson/projects/udisks/src/udiskslinuxprovider.c
    • Between lines 1320 and 1331 in /home/tasleson/projects/udisks/src/udiskslinuxprovider.c
1363                           g_dbus_object_get_object_path (G_DBUS_OBJECT (object)),
1364                           error->message, g_quark_to_string (error->domain), error->code);
1365           g_clear_error (&error);
1366         }
1367     }
1368 
1369   g_list_foreach (objects, (GFunc) g_object_unref, NULL);
1370   g_list_free (objects);
1371 }
1372 
1373 /* ---------------------------------------------------------------------------------------------------- */
1374 
1375 static void
  • Found 6 duplicate lines in the following files:
    • Between lines 110 and 119 in /home/tasleson/projects/udisks/modules/bcache/udisksbcachemoduleiface.c
    • Between lines 115 and 124 in /home/tasleson/projects/udisks/modules/btrfs/udisksbtrfsmoduleiface.c
    • Between lines 112 and 121 in /home/tasleson/projects/udisks/modules/zram/udiskszrammoduleiface.c
110                                            UDISKS_LINUX_BLOCK_OBJECT (object));
111 }
112 
113 UDisksModuleInterfaceInfo **
114 udisks_module_get_block_object_iface_setup_entries (void)
115 {
116   UDisksModuleInterfaceInfo **iface;
117 
118   iface = g_new0 (UDisksModuleInterfaceInfo *, 2);
119   iface[0] = g_new0 (UDisksModuleInterfaceInfo, 1);
  • Found 6 duplicate lines in the following files:
    • Between lines 1401 and 1421 in /home/tasleson/projects/udisks/src/udisksdaemon.c
    • Between lines 1362 and 1382 in /home/tasleson/projects/udisks/src/udisksdaemon.c
1401           ret = g_object_ref (object);
1402           goto out;
1403         }
1404     }
1405  out:
1406   g_list_free_full (objects, g_object_unref);
1407   return ret;
1408 }
1409 
1410 /* ---------------------------------------------------------------------------------------------------- */
1411 
1412 /**
1413  * udisks_daemon_find_block_by_sysfs_path:
1414  * @daemon: A #UDisksDaemon.
1415  * @sysfs_path: A sysfs path.
1416  *
1417  * Finds a block device with a sysfs path given by @sysfs_path.
1418  *
1419  * Returns: (transfer full): A #UDisksObject or %NULL if not found. Free with g_object_unref().
1420  */
1421 UDisksObject *
  • Found 6 duplicate lines in the following files:
    • Between lines 766 and 774 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 654 and 662 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
766 static void
767 free_module_interface_entry (ModuleInterfaceEntry *entry)
768 {
769   if (entry->interface != NULL)
770     g_object_unref (entry->interface);
771   g_free (entry);
772 }
773 
774 static void
  • Found 6 duplicate lines in the following files:
    • Between lines 2369 and 2375 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 2276 and 2282 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
2369                           GVariant              *options)
2370 {
2371   UDisksLinuxDriveAta *drive = UDISKS_LINUX_DRIVE_ATA (_drive);
2372   UDisksLinuxDriveObject *object = NULL;
2373   UDisksLinuxBlockObject *block_object = NULL;
2374   UDisksDaemon *daemon;
2375   GError *error = NULL;
  • Found 6 duplicate lines in the following files:
    • Between lines 121 and 129 in /home/tasleson/projects/udisks/src/udisksbasejob.c
    • Between lines 93 and 101 in /home/tasleson/projects/udisks/src/udisksbasejob.c
121                               guint         prop_id,
122                               const GValue *value,
123                               GParamSpec   *pspec)
124 {
125   UDisksBaseJob *job = UDISKS_BASE_JOB (object);
126 
127   switch (prop_id)
128     {
129     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 294 and 300 in /home/tasleson/projects/udisks/modules/lsm/lsm_local.c
    • Between lines 124 and 130 in /home/tasleson/projects/udisks/modules/lsm/lsm_local.c
294   ud_lx_blk_obj = udisks_linux_drive_object_get_block (ud_lx_drv_obj, FALSE);
295   if (ud_lx_blk_obj == NULL)
296     {
297       g_dbus_method_invocation_return_error
298         (invocation, UDISKS_ERROR, UDISKS_ERROR_FAILED,
299          "Unable to find block device for drive");
300       goto out;
  • Found 6 duplicate lines in the following files:
    • Between lines 3476 and 3484 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3410 and 3418 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 3346 and 3354 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
    • Between lines 2747 and 2755 in /home/tasleson/projects/udisks/src/udiskslinuxblock.c
3476   error = NULL;
3477   object = udisks_daemon_util_dup_object (block, &error);
3478   if (object == NULL)
3479     {
3480       g_dbus_method_invocation_take_error (invocation, error);
3481       goto out;
3482     }
3483 
3484   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
  • Found 6 duplicate lines in the following files:
    • Between lines 1500 and 1512 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1378 and 1390 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1256 and 1268 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 1103 and 1114 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
    • Between lines 874 and 885 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
1500       goto out;
1501     }
1502 
1503   if (!udisks_state_has_mdraid (state,
1504                                 g_udev_device_get_device_number (raid_device->udev_device),
1505                                 &started_by_uid))
1506     {
1507       /* allow stopping arrays stuff not mentioned in mounted-fs, but treat it like root mounted it */
1508       started_by_uid = 0;
1509     }
1510 
1511   /* First check the user is authorized to manage RAID */
1512   if (caller_uid != 0 && (caller_uid != started_by_uid))
  • Found 6 duplicate lines in the following files:
    • Between lines 807 and 813 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxlogicalvolume.c
    • Between lines 761 and 767 in /home/tasleson/projects/udisks/src/udiskslinuxmdraid.c
807                                                      object,
808                                                      NULL,
809                                                      10, /* timeout_seconds */
810                                                      &error);
811   if (block_object == NULL)
812     {
813       g_prefix_error (&error,
  • Found 6 duplicate lines in the following files:
    • Between lines 2153 and 2158 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1689 and 1694 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
    • Between lines 1437 and 1442 in /home/tasleson/projects/udisks/src/udiskslinuxdriveata.c
2153     UDisksAtaCommandOutput output = {0};
2154     if (!udisks_ata_send_command_sync (fd,
2155                                        -1,
2156                                        UDISKS_ATA_COMMAND_PROTOCOL_NONE,
2157                                        &input,
2158                                        &output,
  • Found 6 duplicate lines in the following files:
    • Between lines 107 and 115 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
    • Between lines 87 and 95 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
107                                         guint         prop_id,
108                                         const GValue *value,
109                                         GParamSpec   *pspec)
110 {
111   UDisksLinuxManagerLVM2 *manager = UDISKS_LINUX_MANAGER_LVM2 (object);
112 
113   switch (prop_id)
114     {
115     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 2447 and 2455 in /home/tasleson/projects/udisks/udisks/udisksclient.c
    • Between lines 2408 and 2416 in /home/tasleson/projects/udisks/udisks/udisksclient.c
2447                                                           const gchar   *partition_type)
2448 {
2449   const gchar *ret = NULL;
2450   guint n;
2451 
2452   for (n = 0; known_partition_types[n].name != NULL; n++)
2453     {
2454       if (g_strcmp0 (known_partition_types[n].table_type, partition_table_type) == 0 &&
2455           g_strcmp0 (known_partition_types[n].type, partition_type) == 0)
  • Found 6 duplicate lines in the following files:
    • Between lines 129 and 137 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
    • Between lines 109 and 117 in /home/tasleson/projects/udisks/src/udiskslinuxmanager.c
129                                    guint         prop_id,
130                                    const GValue *value,
131                                    GParamSpec   *pspec)
132 {
133   UDisksLinuxManager *manager = UDISKS_LINUX_MANAGER (object);
134 
135   switch (prop_id)
136     {
137     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 363 and 369 in /home/tasleson/projects/udisks/src/udiskslinuxmdraidobject.c
    • Between lines 506 and 512 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
363               GType                     skeleton_type,
364               gpointer                  _interface_pointer)
365 {
366   gboolean ret = FALSE;
367   gboolean has;
368   gboolean add;
369   GDBusInterface **interface_pointer = _interface_pointer;
  • Found 6 duplicate lines in the following files:
    • Between lines 192 and 200 in /home/tasleson/projects/udisks/modules/lsm/lsm_module_iface.c
    • Between lines 49 and 55 in /home/tasleson/projects/udisks/modules/lsm/lsm_module_iface.c
192 static void
193 _lsm_local_connect (UDisksObject *object)
194 {
195 }
196 
197 static gboolean
198 _lsm_local_update(UDisksObject *object,
199                   const gchar *uevent_action,
200                   GDBusInterface *_iface)
  • Found 6 duplicate lines in the following files:
    • Between lines 871 and 892 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 861 and 869 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
871                                 UDisksMount         *mount,
872                                 gpointer             user_data)
873 {
874   UDisksLinuxBlockObject *object = UDISKS_LINUX_BLOCK_OBJECT (user_data);
875   if (udisks_mount_get_dev (mount) == g_udev_device_get_device_number (object->device->udev_device))
876     udisks_linux_block_object_uevent (object, NULL, NULL);
877 }
878 
879 /* ---------------------------------------------------------------------------------------------------- */
880 
881 
882 /**
883  * udisks_linux_block_object_trigger_uevent:
884  * @object: A #UDisksLinuxBlockObject.
885  *
886  * Triggers a 'change' uevent in the kernel.
887  *
888  * The triggered event will bubble up from the kernel through the udev
889  * stack and will eventually be received by the udisks daemon process
890  * itself. This method does not wait for the event to be received.
891  */
892 void
  • Found 6 duplicate lines in the following files:
    • Between lines 99 and 107 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
    • Between lines 79 and 87 in /home/tasleson/projects/udisks/modules/btrfs/udiskslinuxfilesystembtrfs.c
99                                             guint         property_id,
100                                             const GValue *value,
101                                             GParamSpec   *pspec)
102 {
103   UDisksLinuxFilesystemBTRFS *l_fs_btrfs = UDISKS_LINUX_FILESYSTEM_BTRFS (object);
104 
105   switch (property_id)
106     {
107     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 1574 and 1582 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 1190 and 1198 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 207 and 215 in /home/tasleson/projects/udisks/src/udiskslinuxloop.c
    • Between lines 280 and 288 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
1574   if (object == NULL)
1575     {
1576       g_dbus_method_invocation_take_error (invocation, error);
1577       goto out;
1578     }
1579 
1580   block = udisks_object_peek_block (object);
1581   daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
1582   state = udisks_daemon_get_state (daemon);
  • Found 6 duplicate lines in the following files:
    • Between lines 572 and 580 in /home/tasleson/projects/udisks/src/udisksmodulemanager.c
    • Between lines 544 and 552 in /home/tasleson/projects/udisks/src/udisksmodulemanager.c
572                                     guint         prop_id,
573                                     const GValue *value,
574                                     GParamSpec   *pspec)
575 {
576   UDisksModuleManager *manager = UDISKS_MODULE_MANAGER (object);
577 
578   switch (prop_id)
579     {
580     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 2074 and 2080 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1803 and 1809 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1451 and 1457 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1044 and 1050 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 1001 and 1007 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 545 and 551 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 493 and 499 in /home/tasleson/projects/udisks/tools/udisksctl.c
2074     NULL
2075   },
2076   {
2077     "block-device",
2078     'b',
2079     0,
2080     G_OPTION_ARG_STRING,
  • Found 6 duplicate lines in the following files:
    • Between lines 96 and 104 in /home/tasleson/projects/udisks/src/udisksprovider.c
    • Between lines 76 and 84 in /home/tasleson/projects/udisks/src/udisksprovider.c
96                               guint         prop_id,
97                               const GValue *value,
98                               GParamSpec   *pspec)
99 {
100   UDisksProvider *provider = UDISKS_PROVIDER (object);
101 
102   switch (prop_id)
103     {
104     case PROP_DAEMON:
  • Found 6 duplicate lines in the following files:
    • Between lines 2698 and 2704 in /home/tasleson/projects/udisks/tools/udisksctl.c
    • Between lines 2676 and 2682 in /home/tasleson/projects/udisks/tools/udisksctl.c
2698                                     GDBusObject         *object,
2699                                     GDBusInterface      *interface,
2700                                     gpointer             user_data)
2701 {
2702   if (!monitor_has_name_owner ())
2703     goto out;
2704   monitor_print_timestamp ();
  • Found 6 duplicate lines in the following files:
    • Between lines 1600 and 1608 in /home/tasleson/projects/udisks/src/udiskslinuxfilesystem.c
    • Between lines 708 and 716 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
    • Between lines 324 and 333 in /home/tasleson/projects/udisks/src/udiskslinuxencrypted.c
1600       goto out;
1601     }
1602 
1603   error = NULL;
1604   if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, &error))
1605     {
1606       g_dbus_method_invocation_return_gerror (invocation, error);
1607       g_clear_error (&error);
1608       goto out;
  • Found 6 duplicate lines in the following files:
    • Between lines 448 and 454 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxvolumegroup.c
    • Between lines 340 and 346 in /home/tasleson/projects/udisks/modules/lvm2/udiskslinuxmanagerlvm2.c
448                                                      NULL,
449                                                      10, /* timeout_seconds */
450                                                      &error);
451   if (group_object == NULL)
452     {
453       g_prefix_error (&error,
454                       "Error waiting for volume group object for %s",
  • Found 6 duplicate lines in the following files:
    • Between lines 587 and 594 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
    • Between lines 538 and 545 in /home/tasleson/projects/udisks/modules/iscsi/udiskslinuxmanageriscsiinitiator.c
587   if (err != 0)
588     {
589       /* Discovery failed. */
590       g_dbus_method_invocation_return_error (invocation,
591                                              UDISKS_ERROR,
592                                              iscsi_error_to_udisks_error (err),
593                                              N_("Discovery failed: %s"),
594                                              errorstr);
  • Found 6 duplicate lines in the following files:
    • Between lines 776 and 785 in /home/tasleson/projects/udisks/src/udiskslinuxblockobject.c
    • Between lines 664 and 673 in /home/tasleson/projects/udisks/src/udiskslinuxdriveobject.c
776                       UDisksModuleManager    *module_manager)
777 {
778   GList *l;
779   ModuleInterfaceEntry *entry;
780   UDisksModuleInterfaceInfo *ii;
781 
782   /* Assume all modules are either unloaded or loaded at the same time, so don't regenerate entries */
783   if (object->module_ifaces == NULL)
784     {
785       object->module_ifaces = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) free_module_interface_entry);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment