From fe7be8ce215eb5dc3a8a7dd995788bbb5dbb2a0e Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Sun, 15 Mar 2009 13:05:18 -0400 Subject: [PATCH] only use a single PolicyKit action for Linux MD operations --- policy/org.freedesktop.devicekit.disks.policy.in | 10 ------ src/devkit-disks-device.c | 8 ----- src/devkit-disks-poller.c | 12 +++++++- src/devkit-disks-poller.h | 4 +++ src/org.freedesktop.DeviceKit.Disks.Device.xml | 39 ++++-------------------- src/org.freedesktop.DeviceKit.Disks.xml | 13 ++------ 6 files changed, 23 insertions(+), 63 deletions(-) diff --git a/policy/org.freedesktop.devicekit.disks.policy.in b/policy/org.freedesktop.devicekit.disks.policy.in index 07099e4..8a3fab6 100644 --- a/policy/org.freedesktop.devicekit.disks.policy.in +++ b/policy/org.freedesktop.devicekit.disks.policy.in @@ -175,16 +175,6 @@ file are instantly applied. no no - yes - - - - - <_description>Configure Linux Software RAID on a system-internal device - <_message>Authentication is required to configure Linux Software RAID devices - - no - no auth_admin diff --git a/src/devkit-disks-device.c b/src/devkit-disks-device.c index fadae11..8c75b53 100644 --- a/src/devkit-disks-device.c +++ b/src/devkit-disks-device.c @@ -7561,8 +7561,6 @@ devkit_disks_device_linux_md_stop (DevkitDisksDevice *device, if (!devkit_disks_damon_local_check_auth (device->priv->daemon, pk_caller, - device->priv->device_is_system_internal ? - "org.freedesktop.devicekit.disks.linux-md-system-internal" : "org.freedesktop.devicekit.disks.linux-md", context)) { goto out; @@ -7676,8 +7674,6 @@ devkit_disks_device_linux_md_add_component (DevkitDisksDevice *device, if (!devkit_disks_damon_local_check_auth (device->priv->daemon, pk_caller, - device->priv->device_is_system_internal ? - "org.freedesktop.devicekit.disks.linux-md-system-internal" : "org.freedesktop.devicekit.disks.linux-md", context)) { goto out; @@ -7895,8 +7891,6 @@ devkit_disks_device_linux_md_remove_component (DevkitDisksDevice *device, if (!devkit_disks_damon_local_check_auth (device->priv->daemon, pk_caller, - device->priv->device_is_system_internal ? - "org.freedesktop.devicekit.disks.linux-md-system-internal" : "org.freedesktop.devicekit.disks.linux-md", context)) { goto out; @@ -8195,8 +8189,6 @@ devkit_disks_daemon_linux_md_start (DevkitDisksDaemon *daemon, if (!devkit_disks_damon_local_check_auth (daemon, pk_caller, - TRUE ? /* TODO: si IFF just a single component is si */ - "org.freedesktop.devicekit.disks.linux-md-system-internal" : "org.freedesktop.devicekit.disks.linux-md", context)) { goto out; diff --git a/src/devkit-disks-poller.c b/src/devkit-disks-poller.c index 4db4004..fe89ad3 100644 --- a/src/devkit-disks-poller.c +++ b/src/devkit-disks-poller.c @@ -95,6 +95,7 @@ out: #endif } +/* ---------------------------------------------------------------------------------------------------- */ static gchar **poller_devices_to_poll = NULL; @@ -130,6 +131,7 @@ devkit_disks_poller_poll_device (const gchar *device_file) } } +/* ---------------------------------------------------------------------------------------------------- */ static gboolean poller_timeout_cb (gpointer user_data) @@ -146,6 +148,8 @@ poller_timeout_cb (gpointer user_data) return TRUE; } +/* ---------------------------------------------------------------------------------------------------- */ + static gboolean poller_have_data (GIOChannel *channel, GIOCondition condition, @@ -211,6 +215,8 @@ poller_have_data (GIOChannel *channel, return TRUE; } +/* ---------------------------------------------------------------------------------------------------- */ + static void poller_run (gint fd) { @@ -269,6 +275,8 @@ devkit_disks_poller_setup (int argc, char *argv[]) return ret; } +/* ---------------------------------------------------------------------------------------------------- */ + void devkit_disks_poller_set_devices (GList *devices) { @@ -299,8 +307,10 @@ devkit_disks_poller_set_devices (GList *devices) devices_currently_polled = devices_to_poll; write (poller_daemon_write_end_fd, devices_currently_polled, strlen (devices_currently_polled)); - //g_debug ("Wanna poll: '%s'", devices_currently_polled); + //g_debug ("Want to poll: '%s'", devices_currently_polled); } else { g_free (devices_to_poll); } } + +/* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/devkit-disks-poller.h b/src/devkit-disks-poller.h index ee6a40d..9d80a38 100644 --- a/src/devkit-disks-poller.h +++ b/src/devkit-disks-poller.h @@ -24,8 +24,12 @@ #include gboolean devkit_disks_poller_setup (int argc, char *argv[]); + +/* media detection polling */ void devkit_disks_poller_set_devices (GList *devices); void devkit_disks_poller_poll_device (const gchar *device_file); +/* ATA smart polling */ +void devkit_disks_poller_set_ata_smart_devices (GList *devices); #endif /* __DEVKIT_DISKS_POLLER_H */ diff --git a/src/org.freedesktop.DeviceKit.Disks.Device.xml b/src/org.freedesktop.DeviceKit.Disks.Device.xml index fa1e9de..2cf9263 100644 --- a/src/org.freedesktop.DeviceKit.Disks.Device.xml +++ b/src/org.freedesktop.DeviceKit.Disks.Device.xml @@ -872,21 +872,12 @@ - The caller will need one of the following PolicyKit authorizations: + The caller will need the following PolicyKit authorization: org.freedesktop.devicekit.disks.linux-md - Needed to configured Linux md Software RAID devices where all components are - non-system-internal. - - - - org.freedesktop.devicekit.disks.linux-md-system-internal - - Needed to configured Linux md Software RAID devices with one or more - system-internal - components. + Needed to configured Linux md Software RAID devices. @@ -922,21 +913,12 @@ - The caller will need one of the following PolicyKit authorizations: + The caller will need the following PolicyKit authorization: org.freedesktop.devicekit.disks.linux-md - Needed to configured Linux md Software RAID devices where all components are - non-system-internal. - - - - org.freedesktop.devicekit.disks.linux-md-system-internal - - Needed to configured Linux md Software RAID devices with one or more - system-internal - components. + Needed to configured Linux md Software RAID devices. @@ -967,21 +949,12 @@ - The caller will need one of the following PolicyKit authorizations: + The caller will need the following PolicyKit authorization: org.freedesktop.devicekit.disks.linux-md - Needed to configured Linux md Software RAID devices where all components are - non-system-internal. - - - - org.freedesktop.devicekit.disks.linux-md-system-internal - - Needed to configured Linux md Software RAID devices with one or more - system-internal - components. + Needed to configured Linux md Software RAID devices. diff --git a/src/org.freedesktop.DeviceKit.Disks.xml b/src/org.freedesktop.DeviceKit.Disks.xml index e5d3822..f4f7ef8 100644 --- a/src/org.freedesktop.DeviceKit.Disks.xml +++ b/src/org.freedesktop.DeviceKit.Disks.xml @@ -150,21 +150,12 @@ - The caller will need one of the following PolicyKit authorizations: + The caller will need the following PolicyKit authorization: org.freedesktop.devicekit.disks.linux-md - Needed to configured Linux md Software RAID devices where all components are - non-system-internal. - - - - org.freedesktop.devicekit.disks.linux-md-system-internal - - Needed to configured Linux md Software RAID devices with one or more - system-internal - components. + Needed to configured Linux md Software RAID devices. -- 2.7.4