*/
int ceph_conf_parse_argv(struct ceph_mount_info *cmount, int argc, const char **argv);
+/**
+ * Configure the cluster handle based on an environment variable
+ *
+ * The contents of the environment variable are parsed as if they were
+ * Ceph command line options. If var is NULL, the CEPH_ARGS
+ * environment variable is used.
+ *
+ * @pre ceph_mount() has not been called on the handle
+ *
+ * @note BUG: this is not threadsafe - it uses a static buffer
+ *
+ * @param cmount handle to configure
+ * @param var name of the environment variable to read
+ * @returns 0 on success, negative error code on failure
+ */
+int ceph_conf_parse_env(struct ceph_mount_info *cmount, const char *var);
+
/** Sets a configuration value from a string.
*
* @param cmount the mount handle to set the configuration value on
return 0;
}
+ int conf_parse_env(const char *name)
+ {
+ md_config_t *conf = cct->_conf;
+ vector<const char*> args;
+ env_to_vec(args, name);
+ int ret = conf->parse_argv(args);
+ if (ret)
+ return ret;
+ conf->apply_changes(NULL);
+ return 0;
+ }
+
int conf_set(const char *option, const char *value)
{
int ret = cct->_conf->set_val(option, value);
return cmount->conf_parse_argv(argc, argv);
}
+extern "C" int ceph_conf_parse_env(struct ceph_mount_info *cmount, const char *name)
+{
+ return cmount->conf_parse_env(name);
+}
+
extern "C" int ceph_conf_set(struct ceph_mount_info *cmount, const char *option,
const char *value)
{