DevkitDisksDevice *device;
gchar canonical_device_file[PATH_MAX];
- /* TODO: maybe use realpath() on the given device_file so the caller can pass in symlinks? */
realpath (device_file, canonical_device_file);
object_path = NULL;
/*--------------------------------------------------------------------------------------------------------------*/
+gboolean
+devkit_disks_daemon_find_device_by_major_minor (DevkitDisksDaemon *daemon,
+ gint64 major,
+ gint64 minor,
+ DBusGMethodInvocation *context)
+{
+ const char *object_path;
+ DevkitDisksDevice *device;
+ dev_t dev;
+
+ dev = makedev (major, minor);
+
+ object_path = NULL;
+
+ device = devkit_disks_daemon_local_find_by_dev (daemon, dev);
+ if (device != NULL) {
+ object_path = devkit_disks_device_local_get_object_path (device);
+ dbus_g_method_return (context, object_path);
+ } else {
+ throw_error (context,
+ DEVKIT_DISKS_ERROR_FAILED,
+ "No such device");
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
static void
daemon_polling_inhibitor_disconnected_cb (DevkitDisksInhibitor *inhibitor,
DevkitDisksDaemon *daemon)
const char *device_file,
DBusGMethodInvocation *context);
+gboolean devkit_disks_daemon_find_device_by_major_minor (DevkitDisksDaemon *daemon,
+ gint64 major,
+ gint64 minor,
+ DBusGMethodInvocation *context);
+
gboolean devkit_disks_daemon_linux_md_start (DevkitDisksDaemon *daemon,
GPtrArray *components,
char **options,
<method name="FindDeviceByDeviceFile">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg name="device_file" direction="in" type="s">
+ <arg name="device-file" direction="in" type="s">
<doc:doc><doc:summary>UNIX special device file</doc:summary></doc:doc>
</arg>
<arg name="device" direction="out" type="o">
<!-- ************************************************************ -->
+ <method name="FindDeviceByMajorMinor">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="device-major" direction="in" type="x">
+ <doc:doc><doc:summary>Device major</doc:summary></doc:doc>
+ </arg>
+ <arg name="device-minor" direction="in" type="x">
+ <doc:doc><doc:summary>Device minor</doc:summary></doc:doc>
+ </arg>
+ <arg name="device" direction="out" type="o">
+ <doc:doc><doc:summary>Object path of device</doc:summary></doc:doc>
+ </arg>
+
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Finds a device by major:minor.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </method>
+
+ <!-- ************************************************************ -->
+
<method name="DriveInhibitAllPolling">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="options" direction="in" type="as">