shared/install: add helper function unit_file_changes_have_modification()

As suggested in review of #3049.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2016-04-18 23:38:22 -04:00
parent 596fc2636a
commit 795ff6d5d8
2 changed files with 13 additions and 11 deletions
+8 -4
View File
@@ -77,16 +77,20 @@ enum UnitFileChangeType {
_UNIT_FILE_CHANGE_TYPE_INVALID = -1
};
static inline bool unit_file_change_is_modification(UnitFileChangeType type) {
return IN_SET(type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK);
}
struct UnitFileChange {
UnitFileChangeType type;
char *path;
char *source;
};
static inline bool unit_file_changes_have_modification(const UnitFileChange* changes, unsigned n_changes) {
unsigned i;
for (i = 0; i < n_changes; i++)
if (IN_SET(changes[i].type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK))
return true;
return false;
}
struct UnitFileList {
char *path;
UnitFileState state;