[systemd-devel] [PATCH 2/4] Update journal-remote

Goffredo Baroncelli kreijack at libero.it
Thu Mar 5 12:39:12 PST 2015


From: Goffredo Baroncelli <kreijack at inwind.it>

Update the journal-remote due to the update of the parameters of
the functions journal_file_open()/journal_file_open_reliably().


Moreover two options are added to systemd-journal-remote:
--cow-journal and --no-cow-journal to
unset/set the "no copy on write" attribute.

Signed-off-by: Goffredo Baroncelli <kreijack at inwind.it>
---
 src/journal-remote/journal-remote.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index 8f32a9a..5ccd237 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -64,6 +64,7 @@ static char* arg_listen_https = NULL;
 static char** arg_files = NULL;
 static int arg_compress = true;
 static int arg_seal = false;
+static int arg_cow_journal = false;
 static int http_socket = -1, https_socket = -1;
 static char** arg_gnutls_log = NULL;
 
@@ -200,6 +201,7 @@ static int open_output(Writer *w, const char* host) {
         r = journal_file_open_reliably(output,
                                        O_RDWR|O_CREAT, 0640,
                                        arg_compress, arg_seal,
+                                       arg_cow_journal,
                                        &w->metrics,
                                        w->mmap,
                                        NULL, &w->journal);
@@ -1149,6 +1151,8 @@ static void help(void) {
                "     --listen-https=ADDR    Listen for HTTPS connections at ADDR\n"
                "  -o --output=FILE|DIR      Write output to FILE or DIR/external-*.journal\n"
                "     --compress[=BOOL]      XZ-compress the output journal (default: yes)\n"
+               "     --cow-journal[=BOOL]   Enable/Disable the COW behaviour\n"
+               "                            for the journal file (default: no)\n"
                "     --seal[=BOOL]          Use event sealing (default: no)\n"
                "     --key=FILENAME         SSL key in PEM format (default:\n"
                "                            \"" PRIV_KEY_FILE "\")\n"
@@ -1179,6 +1183,7 @@ static int parse_argv(int argc, char *argv[]) {
                 ARG_CERT,
                 ARG_TRUST,
                 ARG_GNUTLS_LOG,
+                ARG_COW_JOURNAL,
         };
 
         static const struct option options[] = {
@@ -1192,6 +1197,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "output",       required_argument, NULL, 'o'              },
                 { "split-mode",   required_argument, NULL, ARG_SPLIT_MODE   },
                 { "compress",     optional_argument, NULL, ARG_COMPRESS     },
+                { "cow-journal",  optional_argument, NULL, ARG_COW_JOURNAL  },
                 { "seal",         optional_argument, NULL, ARG_SEAL         },
                 { "key",          required_argument, NULL, ARG_KEY          },
                 { "cert",         required_argument, NULL, ARG_CERT         },
@@ -1347,6 +1353,20 @@ static int parse_argv(int argc, char *argv[]) {
 
                         break;
 
+                case ARG_COW_JOURNAL:
+                        if (optarg) {
+                                r = parse_boolean(optarg);
+                                if (r < 0) {
+                                        log_error("Failed to parse --allow-cow-journal= parameter.");
+                                        return -EINVAL;
+                                }
+
+                                arg_cow_journal = !!r;
+                        } else
+                                arg_cow_journal = true;
+
+                        break;
+
                 case ARG_SEAL:
                         if (optarg) {
                                 r = parse_boolean(optarg);
-- 
2.1.0



More information about the systemd-devel mailing list