[systemd-commits] 2 commits - Makefile.am src/gudev
Kay Sievers
kay at kemper.freedesktop.org
Sat Feb 22 09:48:16 PST 2014
Makefile.am | 46 +++++++++++++++++++++++++++++++++++++++--
src/gudev/gudevdevice.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
src/gudev/gudevdevice.h | 3 ++
3 files changed, 100 insertions(+), 2 deletions(-)
New commits:
commit 41fd4c4c15e74a39cecfa5f1764e039c8d88617b
Author: Kay Sievers <kay at vrfy.org>
Date: Sat Feb 22 18:47:28 2014 +0100
build-sys: add seccomp includes where needed
diff --git a/Makefile.am b/Makefile.am
index 647e993..dd9ba96 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -775,6 +775,10 @@ nodist_libsystemd_shared_la_SOURCES = \
src/shared/errno-from-name.h \
src/shared/errno-to-name.h
+libsystemd_shared_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
# ------------------------------------------------------------------------------
noinst_LTLIBRARIES += \
libsystemd-units.la
@@ -817,7 +821,6 @@ libsystemd_label_la_LIBADD = \
# ------------------------------------------------------------------------------
if HAVE_SECCOMP
-
noinst_LTLIBRARIES += \
libsystemd-seccomp.la
@@ -831,7 +834,6 @@ libsystemd_seccomp_la_CFLAGS = \
libsystemd_seccomp_la_LIBADD = \
$(SECCOMP_LIBS)
-
endif
# ------------------------------------------------------------------------------
@@ -1081,6 +1083,10 @@ src/shared/errno-to-name.h: src/shared/errno-list.txt
systemd_SOURCES = \
src/core/main.c
+systemd_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
systemd_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1178,6 +1184,10 @@ test_device_nodes_LDADD = \
test_engine_SOURCES = \
src/test/test-engine.c
+test_engine_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_engine_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1185,6 +1195,10 @@ test_engine_LDADD = \
test_job_type_SOURCES = \
src/test/test-job-type.c
+test_job_type_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_job_type_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1192,6 +1206,10 @@ test_job_type_LDADD = \
test_ns_SOURCES = \
src/test/test-ns.c
+test_ns_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_ns_LDADD = \
libsystemd-core.la
@@ -1221,6 +1239,10 @@ endif
test_unit_name_SOURCES = \
src/test/test-unit-name.c
+test_unit_name_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_unit_name_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1228,6 +1250,10 @@ test_unit_name_LDADD = \
test_unit_file_SOURCES = \
src/test/test-unit-file.c
+test_unit_file_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_unit_file_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1278,6 +1304,10 @@ test_tables_SOURCES = \
src/test/test-tables.c \
src/shared/test-tables.h
+test_tables_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_tables_LDADD = \
libsystemd-logs.la \
libsystemd-journal-internal.la \
@@ -1371,6 +1401,10 @@ test_cgroup_mask_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DTEST_DIR=\"$(abs_top_srcdir)/test\"
+test_cgroup_mask_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_cgroup_mask_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -1437,6 +1471,10 @@ test_sched_prio_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DTEST_DIR=\"$(abs_top_srcdir)/test\"
+test_sched_prio_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_sched_prio_LDADD = \
libsystemd-core.la \
$(RT_LIBS)
@@ -2164,6 +2202,10 @@ test_bus_chat_LDADD = \
test_bus_cleanup_SOURCES = \
src/libsystemd/sd-bus/test-bus-cleanup.c
+test_bus_cleanup_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SECCOMP_CFLAGS)
+
test_bus_cleanup_LDADD = \
libsystemd-internal.la \
libsystemd-shared.la
commit fcc70b92f44788e89252011a4c87151961fd8999
Author: Andreas Fuchs <anduchs at gmail.com>
Date: Sat Feb 22 12:02:35 2014 +0100
gudev: add device::get_sysfs_attr_keys and device::has_sysfs_attr
For gudev -> gudevdevice:
- Add support for get_sysfs_attr_keys()
- Add support for has_sysfs_attr()
diff --git a/src/gudev/gudevdevice.c b/src/gudev/gudevdevice.c
index 6c9e0f5..2c768b7 100644
--- a/src/gudev/gudevdevice.c
+++ b/src/gudev/gudevdevice.c
@@ -59,6 +59,8 @@
* g_udev_device_get_property_as_strv().
*
* To access sysfs attributes for the device, use
+ * g_udev_device_get_sysfs_attr_keys(),
+ * g_udev_device_has_sysfs_attr(),
* g_udev_device_get_sysfs_attr(),
* g_udev_device_get_sysfs_attr_as_int(),
* g_udev_device_get_sysfs_attr_as_uint64(),
@@ -84,6 +86,7 @@ struct _GUdevDevicePrivate
/* computed ondemand and cached */
gchar **device_file_symlinks;
gchar **property_keys;
+ gchar **sysfs_attr_keys;
gchar **tags;
GHashTable *prop_strvs;
GHashTable *sysfs_attr_strvs;
@@ -98,6 +101,7 @@ g_udev_device_finalize (GObject *object)
g_strfreev (device->priv->device_file_symlinks);
g_strfreev (device->priv->property_keys);
+ g_strfreev (device->priv->sysfs_attr_keys);
g_strfreev (device->priv->tags);
if (device->priv->udevice != NULL)
@@ -699,6 +703,55 @@ out:
/* ---------------------------------------------------------------------------------------------------- */
/**
+ * g_udev_device_get_sysfs_attr_keys:
+ * @device: A #GUdevDevice.
+ *
+ * Gets all keys for sysfs attributes on @device.
+ *
+ * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of sysfs attribute keys. This array is owned by @device and should not be freed by the caller.
+ */
+const gchar * const *
+g_udev_device_get_sysfs_attr_keys (GUdevDevice *device)
+{
+ struct udev_list_entry *l;
+ GPtrArray *p;
+
+ g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL);
+
+ if (device->priv->sysfs_attr_keys != NULL)
+ goto out;
+
+ p = g_ptr_array_new ();
+ for (l = udev_device_get_sysattr_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l))
+ {
+ g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l)));
+ }
+ g_ptr_array_add (p, NULL);
+ device->priv->sysfs_attr_keys = (gchar **) g_ptr_array_free (p, FALSE);
+
+ out:
+ return (const gchar * const *) device->priv->sysfs_attr_keys;
+}
+
+/**
+ * g_udev_device_has_sysfs_attr:
+ * @device: A #GUdevDevice.
+ * @key: Name of sysfs attribute.
+ *
+ * Check if a the sysfs attribute with the given key exists.
+ *
+ * Returns: %TRUE only if the value for @key exist.
+ */
+gboolean
+g_udev_device_has_sysfs_attr (GUdevDevice *device,
+ const gchar *key)
+{
+ g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (key != NULL, FALSE);
+ return udev_device_get_sysattr_value (device->priv->udevice, key) != NULL;
+}
+
+/**
* g_udev_device_get_sysfs_attr:
* @device: A #GUdevDevice.
* @name: Name of the sysfs attribute.
diff --git a/src/gudev/gudevdevice.h b/src/gudev/gudevdevice.h
index 457b961..72ec180 100644
--- a/src/gudev/gudevdevice.h
+++ b/src/gudev/gudevdevice.h
@@ -108,6 +108,9 @@ gboolean g_udev_device_get_property_as_boolean (GUdevDevice *devic
const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device,
const gchar *key);
+const gchar* const *g_udev_device_get_sysfs_attr_keys (GUdevDevice *device);
+gboolean g_udev_device_has_sysfs_attr (GUdevDevice *device,
+ const gchar *key);
const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device,
const gchar *name);
gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device,
More information about the systemd-commits
mailing list