device-mapper/dmeventd dmeventd.c libdevmapper ...
CVSROOT: /cvs/dm
Module name: device-mapper
Changes by: [email protected] 2007-01-16 23:03:13
Modified files:
dmeventd : dmeventd.c libdevmapper-event.c
libdevmapper-event.h
Log message:
more fixes
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/dmeventd.c.diff?cvsroot=dm&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/libdevmapper-event.c.diff?cvsroot=dm&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/libdevmapper-event.h.diff?cvsroot=dm&r1=1.8&r2=1.9
dmeventd/dmeventd.c +26 -10
@@ -1005,40 +1005,55 @@/* If DSO names and device paths are equal. */ if (dso_name && device_uuid)return !strcmp (dso_name, thread->dso_data->dso_name) && - !strcmp (device_uuid, thread->device.uuid); + !strcmp (device_uuid, thread->device.uuid) && + (thread->status ==DM_THREAD_RUNNING || + (thread->events &DM_EVENT_REGISTRATION_PENDING ));/* If DSO names are equal. */ if (dso_name) -return !strcmp (dso_name, thread->dso_data->dso_name); +return !strcmp (dso_name, thread->dso_data->dso_name) && + (thread->status ==DM_THREAD_RUNNING || + (thread->events &DM_EVENT_REGISTRATION_PENDING ));/* If device paths are equal. */ if (device_uuid) -return !strcmp (device_uuid, thread->device.uuid); +return !strcmp (device_uuid, thread->device.uuid) && + (thread->status ==DM_THREAD_RUNNING || + (thread->events &DM_EVENT_REGISTRATION_PENDING ));return 1 ; }static int _get_registered_dev (struct message_data *message_data,int next) { -int hit =0 ; -struct thread_status *thread; +struct thread_status *thread, *hit =NULL ;_lock_mutex ();/* Iterate list of threads checking if we want a particular one. */ list_iterate_items(thread, &_thread_registry) -if ((hit =_want_registered_device (message_data->dso_name, - message_data->device_uuid, - thread))) -break ; +if (_want_registered_device (message_data->dso_name, + message_data->device_uuid, + thread)) { + hit = thread; +break ; + }/* * If we got a registered device and want the next one -> * fetch next conforming element off the list. */ -if (!hit || !next) +if (hit && !next) { +_unlock_mutex (); +return _registered_device (message_data, hit); + } + +if (!hit) goto out; + goto out;/* FIXME the next == 1 thing is currently horridly +broken, do something about it... */ + do { if (list_end(&_thread_registry, &thread->list)) goto out;
@@ -1046,6 +1061,7 @@ thread = list_item(thread->list.n, struct thread_status); }while (!_want_registered_device (message_data->dso_name,NULL , thread)); +_unlock_mutex ();return _registered_device (message_data, thread); out:
dmeventd/libdevmapper-event.c +30 -26
83 lines not on this page · raw message
dmeventd/libdevmapper-event.h +4 -3
@@ -60,6 +60,8 @@/* * Identify the device to monitor by exactly one of * dev_name, uuid or device number. +* FIXME we should give guarantees about how dev_name and uuid +* pontiers are handled, eg dm_strdup them */ void dm_event_handler_set_dev_name (struct dm_event_handler *dmevh,const char *dev_name);
@@ -81,9 +83,8 @@int dm_event_handler_get_minor (const struct dm_event_handler *dmevh);enum dm_event_mask dm_event_handler_get_event_mask (const struct dm_event_handler *dmevh); -/* FIXME Review interface */ -int dm_event_get_registered_device (char **dso_name,char **device_path, -enum dm_event_mask *evmask,int next); +/* FIXME Review interface (what about this next thing?) */ +int dm_event_get_registered_device (struct dm_event_handler *dmevh,int next);/* * Initiate monitoring using dmeventd.