commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 04/07: procfs: provide a more meaningful response to fsys_get_opt


From: Samuel Thibault
Subject: [hurd] 04/07: procfs: provide a more meaningful response to fsys_get_options
Date: Mon, 16 Sep 2013 07:41:32 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch procfs-jkoenig
in repository hurd.

commit 883e9a3bcbd0de620272c79b6a081b42b0832ef4
Author: Justus Winter <address@hidden>
Date:   Fri Jun 28 18:37:45 2013 +0200

    procfs: provide a more meaningful response to fsys_get_options
    
    Implement our own netfs_append_args function that provides the
    appropriate command line flags if the current values differ from the
    default values.
    
    * procfs/main.c (netfs_append_args): New function.
---
 main.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/main.c b/main.c
index fc4c5e5..54e9682 100644
--- a/main.c
+++ b/main.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 #include <error.h>
 #include <argp.h>
+#include <argz.h>
 #include <hurd/netfs.h>
 #include <ps.h>
 #include "procfs.h"
@@ -218,6 +219,47 @@ struct argp netfs_runtime_argp_ = {
 /* Used by netfs_set_options to handle runtime option parsing.  */
 struct argp *netfs_runtime_argp = &argp;
 
+/* Return an argz string describing the current options.  Fill *ARGZ
+   with a pointer to newly malloced storage holding the list and *LEN
+   to the length of that storage.  */
+error_t
+netfs_append_args (char **argz, size_t *argz_len)
+{
+  char buf[80];
+  error_t err = 0;
+
+#define FOPT(opt, default, fmt, args...)             \
+  do { \
+    if (! err && opt != default) \
+      { \
+       snprintf (buf, sizeof buf, fmt, ## args); \
+       err = argz_add (argz, argz_len, buf); \
+      } \
+  } while (0)
+
+  FOPT (opt_clk_tck, OPT_CLK_TCK,
+        "--clk-tck=%d", opt_clk_tck);
+
+  FOPT (opt_stat_mode, OPT_STAT_MODE,
+        "--stat-mode=%o", opt_stat_mode);
+
+  FOPT (opt_fake_self, OPT_FAKE_SELF,
+        "--fake-self=%d", opt_fake_self);
+
+  FOPT (opt_anon_owner, OPT_ANON_OWNER,
+        "--anonymous-owner=%d", opt_anon_owner);
+
+  FOPT (opt_kernel_pid, OPT_KERNEL_PID,
+        "--kernel-process=%d", opt_kernel_pid);
+
+#undef FOPT
+
+  if (! err)
+    err = netfs_append_std_options (argz, argz_len);
+
+  return err;
+}
+
 error_t
 root_make_node (struct ps_context *pc, struct node **np)
 {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]