Skip to contentSkip to conversation

Udev integration: add semaphore IPC to wait for udev rule completion (updated)

PATCH New Peter Rajnoha 1 participant 1 message Apr 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 Udev integration: add semaphore IPC to wait for udev rule completion (updated)

...resending updated and cleaned up patches for udev integration.

libdm/.exported_symbols +6 -0
index a6e04f8..80ec533 100644
@@ -21,6 +21,7 @@ dm_task_get_uuid
 dm_task_get_read_ahead
 dm_task_set_ro
 dm_task_set_newname
+dm_task_set_cookie
 dm_task_set_event_nr
 dm_task_set_major
 dm_task_set_minor
@@ -148,3 +149,8 @@ dm_list_last
 dm_list_prev
 dm_list_next
 dm_list_size
+dm_notification_sem_open
+dm_notification_sem_inc
+dm_notification_sem_dec
+dm_notification_sem_wait_zero
+dm_notification_sem_close
libdm/ioctl/libdm-iface.c +7 -0
index 3698eda..7bfc633 100644
@@ -864,6 +864,13 @@ int dm_check_version(void)
 	return 0;
 }
 
+int dm_cookie_supported()
+{
+	return (dm_check_version() &&
+	        _dm_version >= 4 &&
+	        _dm_version_minor >= 15);
+}
+
 void *dm_get_next_target(struct dm_task *dmt, void *next,
 			 uint64_t *start, uint64_t *length,
 			 char **target_type, char **params)
libdm/libdevmapper.h +16 -0
index ded0eaf..d07c82f 100644
@@ -155,6 +155,7 @@ int dm_task_set_major(struct dm_task *dmt, int major);
 int dm_task_set_uid(struct dm_task *dmt, uid_t uid);
 int dm_task_set_gid(struct dm_task *dmt, gid_t gid);
 int dm_task_set_mode(struct dm_task *dmt, mode_t mode);
+int dm_task_set_cookie(struct dm_task *dmt, uint32_t cookie);
 int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr);
 int dm_task_set_geometry(struct dm_task *dmt, const char *cylinders, const char *heads, const char *sectors, const char *start);
 int dm_task_set_message(struct dm_task *dmt, const char *message);
@@ -983,4 +984,19 @@ int dm_report_field_uint64(struct dm_report *rh, struct dm_report_field *field,
 void dm_report_field_set_value(struct dm_report_field *field, const void *value,
 			       const void *sortvalue);
 
+int dm_cookie_supported(void);
+
+/*
+ * Functions to set simple notification channel between instances of libdm
+ * code by means of using semaphore identified by a cookie. Primarily used
+ * to provide a way of notification that related udev rule is completed as
+ * a consequence of libdm actions fired before and marked by the value of
+ * the cookie.
+ */
+int dm_notification_sem_open(uint32_t *cookie);
+int dm_notification_sem_inc(uint32_t cookie);
+int dm_notification_sem_dec(uint32_t cookie);
+int dm_notification_sem_wait_zero(uint32_t cookie);
+int dm_notification_sem_close(uint32_t cookie);
+
 #endif				/* LIB_DEVICE_MAPPER_H */
libdm/libdm-common.c +147 -0

162 lines not on this page · raw message