int (*fn)(struct logical_volume *lv, void *data),
void *data);
-static int _lv_postorder_level(struct logical_volume *lv, void *data)
-{
- struct _lv_postorder_baton *baton = data;
- if (lv->status & POSTORDER_OPEN_FLAG)
- return 1; // a data structure loop has closed...
- lv->status |= POSTORDER_OPEN_FLAG;
- int r =_lv_postorder_visit(lv, baton->fn, baton->data);
- lv->status &= ~POSTORDER_OPEN_FLAG;
- lv->status |= POSTORDER_FLAG;
- return r;
-};
-
static int _lv_each_dependency(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
return 1;
}
+static int _lv_postorder_level(struct logical_volume *lv, void *data)
+{
+ struct _lv_postorder_baton *baton = data;
+ return _lv_postorder_visit(lv, baton->fn, baton->data);
+};
+
static int _lv_postorder_visit(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
if (lv->status & POSTORDER_FLAG)
return 1;
+ if (lv->status & POSTORDER_OPEN_FLAG)
+ return 1; // a data structure loop has closed...
+ lv->status |= POSTORDER_OPEN_FLAG;
baton.fn = fn;
baton.data = data;
r = _lv_each_dependency(lv, _lv_postorder_level, &baton);
+
if (r)
r = fn(lv, data);
+ lv->status &= ~POSTORDER_OPEN_FLAG;
+ lv->status |= POSTORDER_FLAG;
+
return r;
}