]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Various formatting and style fixes
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 17 Apr 2016 19:43:16 +0000 (15:43 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Apr 2016 03:35:51 +0000 (23:35 -0400)
src/core/dbus-manager.c
src/shared/install.c
src/shared/install.h
src/systemctl/systemctl.c
src/test/test-install.c

index 9a913a6c916469079de2769692102f6ec0e52587..0c3b011b8b6c857cf143807e9d4fabf459096bdd 100644 (file)
@@ -1731,8 +1731,8 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use
 
 static int method_disable_unit_files_generic(
                 sd_bus_message *message,
-                Manager *m, const
-                char *verb,
+                Manager *m,
+                const char *verb,
                 int (*call)(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
                 sd_bus_error *error) {
 
@@ -1885,8 +1885,7 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd
         UnitFileChange *changes = NULL;
         unsigned n_changes = 0;
         int runtime, force, r;
-        char *target;
-        char *type;
+        char *target, *type;
         UnitDependency dep;
 
         assert(message);
index 10c724edbd2292819023b4b84432fb481660ab3c..1522435f7f080dce58efa18e5aa9ff6ba827ec00 100644 (file)
@@ -434,8 +434,7 @@ static int remove_marked_symlinks_fd(
                         /* We remove all links pointing to a file or path that is marked, as well as all files sharing
                          * the same name as a file that is marked. */
 
-                        found =
-                                set_contains(remove_symlinks_to, dest) ||
+                        found = set_contains(remove_symlinks_to, dest) ||
                                 set_contains(remove_symlinks_to, basename(dest)) ||
                                 set_contains(remove_symlinks_to, de->d_name);
 
@@ -1481,7 +1480,7 @@ static int install_context_apply(
                         if (q < 0)
                                 r = q;
                         else
-                                r+= q;
+                                r += q;
                 }
         }
 
@@ -2413,7 +2412,7 @@ static int execute_preset(
                         if (q < 0)
                                 r = q;
                         else
-                                r+= q;
+                                r += q;
                 }
         }
 
index 6b760def9b2347513b0baf0797208f611daa67c5..99cd1409f32e7f2216aca8df1df510a1d219ab94 100644 (file)
@@ -130,18 +130,96 @@ static inline bool UNIT_FILE_INSTALL_INFO_HAS_ALSO(UnitFileInstallInfo *i) {
         return !strv_isempty(i->also);
 }
 
-int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_preset_all(UnitFileScope scope, bool runtime, const char *root_dir, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_revert(UnitFileScope scope, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_set_default(UnitFileScope scope, const char *root_dir, const char *file, bool force, UnitFileChange **changes, unsigned *n_changes);
-int unit_file_get_default(UnitFileScope scope, const char *root_dir, char **name);
-int unit_file_add_dependency(UnitFileScope scope, bool runtime, const char *root_dir, char **files, const char *target, UnitDependency dep, bool force, UnitFileChange **changes, unsigned *n_changes);
+int unit_file_enable(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_disable(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_reenable(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_preset(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                UnitFilePresetMode mode,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_preset_all(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                UnitFilePresetMode mode,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_mask(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_unmask(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_link(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_revert(
+                UnitFileScope scope,
+                const char *root_dir,
+                char **files,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_set_default(
+                UnitFileScope scope,
+                const char *root_dir,
+                const char *file,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
+int unit_file_get_default(
+                UnitFileScope scope,
+                const char *root_dir,
+                char **name);
+int unit_file_add_dependency(
+                UnitFileScope scope,
+                bool runtime,
+                const char *root_dir,
+                char **files,
+                const char *target,
+                UnitDependency dep,
+                bool force,
+                UnitFileChange **changes,
+                unsigned *n_changes);
 
 int unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename, UnitFileState *ret);
 int unit_file_exists(UnitFileScope scope, const LookupPaths *paths, const char *name);
index 0c64cbab8060f1d6decc9169ad917fe498f74647..5f87e4a97fae71eab317b588f714860261702266 100644 (file)
@@ -5684,23 +5684,22 @@ static int add_dependency(int argc, char *argv[], void *userdata) {
 }
 
 static int preset_all(int argc, char *argv[], void *userdata) {
-        UnitFileChange *changes = NULL;
-        unsigned n_changes = 0;
         int r;
 
         if (install_client_side()) {
+                UnitFileChange *changes = NULL;
+                unsigned n_changes = 0;
 
                 r = unit_file_preset_all(arg_scope, arg_runtime, arg_root, arg_preset_mode, arg_force, &changes, &n_changes);
-                if (r < 0) {
+                if (r < 0)
                         log_error_errno(r, "Operation failed: %m");
-                        goto finish;
+                else {
+                        if (!arg_quiet)
+                                dump_unit_file_changes(changes, n_changes);
                 }
 
-                if (!arg_quiet)
-                        dump_unit_file_changes(changes, n_changes);
-
-                r = 0;
-
+                unit_file_changes_free(changes, n_changes);
+                return r;
         } else {
                 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
                 _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
@@ -5731,16 +5730,10 @@ static int preset_all(int argc, char *argv[], void *userdata) {
                 if (r < 0)
                         return r;
 
-                if (!arg_no_reload)
-                        r = daemon_reload(argc, argv, userdata);
-                else
-                        r = 0;
+                if (arg_no_reload)
+                        return 0;
+                return daemon_reload(argc, argv, userdata);
         }
-
-finish:
-        unit_file_changes_free(changes, n_changes);
-
-        return r;
 }
 
 static int unit_is_enabled(int argc, char *argv[], void *userdata) {
index 874d617621c2205e129c0681cdfb60f9dad5a9c5..50315c1d9a3ed355929bae73c6b12813679ce501 100644 (file)
@@ -46,6 +46,9 @@ int main(int argc, char* argv[]) {
         unsigned n_changes = 0;
         UnitFileState state = 0;
 
+        log_set_max_level(LOG_DEBUG);
+        log_parse_environment();
+
         h = hashmap_new(&string_hash_ops);
         r = unit_file_get_list(UNIT_FILE_SYSTEM, NULL, h);
         assert_se(r == 0);
@@ -65,12 +68,12 @@ int main(int argc, char* argv[]) {
 
         unit_file_list_free(h);
 
-        log_error("enable");
+        log_info("/*** enable **/");
 
         r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
         assert_se(r >= 0);
 
-        log_error("enable2");
+        log_info("/*** enable2 **/");
 
         r = unit_file_enable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
         assert_se(r >= 0);
@@ -82,8 +85,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_ENABLED);
 
-        log_error("disable");
-
+        log_info("/*** disable ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -97,13 +99,13 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_DISABLED);
 
-        log_error("mask");
+        log_info("/*** mask ***/");
         changes = NULL;
         n_changes = 0;
 
         r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
         assert_se(r >= 0);
-        log_error("mask2");
+        log_info("/*** mask2 ***/");
         r = unit_file_mask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, false, &changes, &n_changes);
         assert_se(r >= 0);
 
@@ -114,13 +116,13 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_MASKED);
 
-        log_error("unmask");
+        log_info("/*** unmask ***/");
         changes = NULL;
         n_changes = 0;
 
         r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
         assert_se(r >= 0);
-        log_error("unmask2");
+        log_info("/*** unmask2 ***/");
         r = unit_file_unmask(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
         assert_se(r >= 0);
 
@@ -131,7 +133,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_DISABLED);
 
-        log_error("mask");
+        log_info("/*** mask ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -145,13 +147,13 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_MASKED);
 
-        log_error("disable");
+        log_info("/*** disable ***/");
         changes = NULL;
         n_changes = 0;
 
         r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
         assert_se(r >= 0);
-        log_error("disable2");
+        log_info("/*** disable2 ***/");
         r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, (char**) files, &changes, &n_changes);
         assert_se(r >= 0);
 
@@ -162,7 +164,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_MASKED);
 
-        log_error("umask");
+        log_info("/*** umask ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -176,7 +178,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_DISABLED);
 
-        log_error("enable files2");
+        log_info("/*** enable files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -190,7 +192,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_ENABLED);
 
-        log_error("disable files2");
+        log_info("/*** disable files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -203,7 +205,7 @@ int main(int argc, char* argv[]) {
         r = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0]), &state);
         assert_se(r < 0);
 
-        log_error("link files2");
+        log_info("/*** link files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -217,7 +219,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_LINKED);
 
-        log_error("disable files2");
+        log_info("/*** disable files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -230,7 +232,7 @@ int main(int argc, char* argv[]) {
         r = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0]), &state);
         assert_se(r < 0);
 
-        log_error("link files2");
+        log_info("/*** link files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -244,7 +246,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_LINKED);
 
-        log_error("reenable files2");
+        log_info("/*** reenable files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -258,7 +260,7 @@ int main(int argc, char* argv[]) {
         assert_se(r >= 0);
         assert_se(state == UNIT_FILE_ENABLED);
 
-        log_error("disable files2");
+        log_info("/*** disable files2 ***/");
         changes = NULL;
         n_changes = 0;
 
@@ -270,7 +272,7 @@ int main(int argc, char* argv[]) {
 
         r = unit_file_get_state(UNIT_FILE_SYSTEM, NULL, basename(files2[0]), &state);
         assert_se(r < 0);
-        log_error("preset files");
+        log_info("/*** preset files ***/");
         changes = NULL;
         n_changes = 0;