]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
config: parse CEPH_ARGS env var too
authorSage Weil <sage@newdream.net>
Wed, 5 Nov 2008 22:31:44 +0000 (14:31 -0800)
committerSage Weil <sage@newdream.net>
Wed, 5 Nov 2008 22:32:40 +0000 (14:32 -0800)
src/config.cc
src/vstartnew.sh

index d3c1f113f08232532056ac07dbbe8719df0c59ee..94374e1fdfae0be92d1787d0222c41aa6bf8cfab 100644 (file)
@@ -487,26 +487,25 @@ md_config_t g_conf = {
 
 void env_to_vec(std::vector<const char*>& args) 
 {
-  const char *p = getenv("CEPH_ARGS");
+  char *p = getenv("CEPH_ARGS");
   if (!p) return;
   
+  int len = MIN(strlen(p), 1000);  // bleh.
   static char buf[1000];  
-  int len = strlen(p);
   memcpy(buf, p, len);
   buf[len] = 0;
-  //cout << "CEPH_ARGS " << buf << endl;
-
-  int l = 0;
-  for (int i=0; i<len; i++) {
-    if (buf[i] == ' ') {
-      buf[i] = 0;
-      args.push_back(buf+l);
-      //cout << "arg " << (buf+l) << endl;
-      l = i+1;
-    }
+  //cout << "CEPH_ARGS='" << p << ";" << endl;
+
+  p = buf;
+  while (*p && p < buf + len) {
+    char *e = p;
+    while (*e && *e != ' ')
+      e++;
+    *e = 0;
+    args.push_back(p);
+    //cout << "arg " << p << std::endl;
+    p = e+1;
   }
-  args.push_back(buf+l);
-  //cout << "arg " << (buf+l) << endl;
 }
 
 
@@ -515,6 +514,8 @@ void argv_to_vec(int argc, const char **argv,
 {
   for (int i=1; i<argc; i++)
     args.push_back(argv[i]);
+
+  env_to_vec(args);
 }
 
 void vec_to_argv(std::vector<const char*>& args,
index 75ca202a5affbb81dcc28566d364750c3632a904..40b23ab0f142ad12748b26c312b3fbac1c5a857e 100755 (executable)
@@ -32,6 +32,10 @@ else
 fi
 
 
+# lockdep everywhere?
+export CEPH_ARGS="--lockdep 1"
+
+
 # sudo if btrfs
 test -d dev/osd0 && SUDO="sudo"