+_public_ int sd_machine_get_class(const char *machine, char **class) {
+ _cleanup_free_ char *c = NULL;
+ const char *p;
+ int r;
+
+ assert_return(filename_is_safe(machine), -EINVAL);
+ assert_return(class, -EINVAL);
+
+ p = strappenda("/run/systemd/machines/", machine);
+ r = parse_env_file(p, NEWLINE, "CLASS", &c, NULL);
+ if (r < 0)
+ return r;
+ if (!c)
+ return -EIO;
+
+ *class = c;
+ c = NULL;
+
+ return 0;
+}
+