Make dm_hash_iter safe against deletion.
Accept a NULL pointer to dm_free silently.
Version 1.02.26 -
=================================
+ Skip add_dev_node when ioctls disabled.
+ Make dm_hash_iter safe against deletion.
+ Accept a NULL pointer to dm_free silently.
Add tables_loaded, readonly and suspended columns to reports.
Add --prefixes to dmsetup.
Add field name prefix option to reporting functions.
void dm_hash_iter(struct dm_hash_table *t, dm_hash_iterate_fn f)
{
- struct dm_hash_node *c;
+ struct dm_hash_node *c, *n;
unsigned i;
for (i = 0; i < t->num_slots; i++)
- for (c = t->slots[i]; c; c = c->next)
+ for (c = t->slots[i]; c; c = n) {
+ n = c->next;
f(c->data);
+ }
}
void dm_hash_wipe(struct dm_hash_table *t)
switch (dmt->type) {
case DM_DEVICE_CREATE:
- add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev),
- dmt->uid, dmt->gid, dmt->mode);
+ if (dmt->dev_name && *dmt->dev_name)
+ add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
+ MINOR(dmi->dev), dmt->uid, dmt->gid,
+ dmt->mode);
break;
case DM_DEVICE_REMOVE:
#else
-# define dm_free(p) free(p)
+# define dm_free(p) do {if (p) free(p); } while (0)
# define dbg_realloc(p, s) realloc(p, s)
# define dump_memory()
# define bounds_check()