mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
serialize: add serialize_image_policy()
This commit is contained in:
parent
81b913f076
commit
665c6e46e3
@ -240,6 +240,27 @@ int serialize_string_set(FILE *f, const char *key, Set *s) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int serialize_image_policy(FILE *f, const char *key, const ImagePolicy *p) {
|
||||
_cleanup_free_ char *policy = NULL;
|
||||
int r;
|
||||
|
||||
assert(f);
|
||||
assert(key);
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
r = image_policy_to_string(p, /* simplify= */ false, &policy);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = serialize_item(f, key, policy);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int deserialize_read_line(FILE *f, char **ret) {
|
||||
_cleanup_free_ char *line = NULL;
|
||||
int r;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "fdset.h"
|
||||
#include "image-policy.h"
|
||||
#include "macro.h"
|
||||
#include "pidref.h"
|
||||
#include "set.h"
|
||||
@ -21,6 +22,7 @@ int serialize_dual_timestamp(FILE *f, const char *key, const dual_timestamp *t);
|
||||
int serialize_strv(FILE *f, const char *key, char **l);
|
||||
int serialize_pidref(FILE *f, FDSet *fds, const char *key, PidRef *pidref);
|
||||
int serialize_string_set(FILE *f, const char *key, Set *s);
|
||||
int serialize_image_policy(FILE *f, const char *key, const ImagePolicy *p);
|
||||
|
||||
static inline int serialize_bool(FILE *f, const char *key, bool b) {
|
||||
return serialize_item(f, key, yes_no(b));
|
||||
|
Loading…
Reference in New Issue
Block a user