#include "set.h"
#include "time-util.h"
+#define LATEST_UDEV_DATABASE_VERSION 1
+
struct sd_device {
unsigned n_ref;
+ /* The database version indicates the supported features by the udev database.
+ * This is saved and parsed in V field.
+ *
+ * 0: None of the following features are supported (systemd version <= 246).
+ * 1: The current tags (Q) and the database version (V) features are implemented (>= 247).
+ */
+ unsigned database_version;
+
int watch_handle;
sd_device *parent;
SET_FOREACH(tag, device->current_tags)
fprintf(f, "Q:%s\n", tag); /* Current tag */
+
+ /* Always write the latest database version here, instead of the value stored in
+ * device->database_version, as which may be 0. */
+ fputs("V:" STRINGIFY(LATEST_UDEV_DATABASE_VERSION) "\n", f);
}
r = fflush_and_check(f);
if (r < 0)
return r;
+ break;
+ case 'V':
+ r = safe_atou(value, &device->database_version);
+ if (r < 0)
+ return r;
+
break;
default:
log_device_debug(device, "sd-device: Unknown key '%c' in device db, ignoring", key);