sigprocmask (how, &sigs, (sigset_t *) 0);
}
+void mount_ceph_debug(const char *fmt, ...)
+{
+ if (verboseflag) {
+ va_list args;
+
+ va_start(args, fmt);
+ vprintf(fmt, args);
+ va_end(args);
+ }
+}
+
static char *mount_resolve_src(const char *orig_str)
{
int len, pos;
mount_path = strstr(buf, ":/");
if (!mount_path) {
- printf("source mount path was not specified\n");
+ fprintf(stderr, "source mount path was not specified\n");
free(buf);
return NULL;
}
if (mount_path == buf) {
- printf("server address expected\n");
+ fprintf(stderr, "server address expected\n");
free(buf);
return NULL;
}
mount_path++;
if (!*mount_path) {
- printf("incorrect source mount path\n");
+ fprintf(stderr, "incorrect source mount path\n");
free(buf);
return NULL;
}
char *saw_name = NULL;
char *saw_secret = NULL;
- if(verboseflag)
- printf("parsing options: %s\n", data);
+ mount_ceph_debug("parsing options: %s\n", data);
do {
char * value = NULL;
} else if (strncmp(data, "secretfile", 10) == 0) {
if (!value || !*value) {
- printf("keyword secretfile found, but no secret file specified\n");
+ fprintf(stderr, "keyword secretfile found, but no secret file specified\n");
free(saw_name);
return NULL;
}
if (read_secret_from_file(value, secret, sizeof(secret)) < 0) {
- printf("error reading secret file\n");
+ fprintf(stderr, "error reading secret file\n");
return NULL;
}
skip = true;
} else if (strncmp(data, "secret", 6) == 0) {
if (!value || !*value) {
- printf("mount option secret requires a value.\n");
+ fprintf(stderr, "mount option secret requires a value.\n");
free(saw_name);
return NULL;
}
skip = true;
} else if (strncmp(data, "name", 4) == 0) {
if (!value || !*value) {
- printf("mount option name requires a value.\n");
+ fprintf(stderr, "mount option name requires a value.\n");
return NULL;
}
free(saw_name);
saw_name = strdup(value);
if (!saw_name) {
- printf("out of memory.\n");
+ fprintf(stderr, "out of memory.\n");
return NULL;
}
skip = false;
} else {
skip = false;
- if (verboseflag) {
- fprintf(stderr, "mount.ceph: unrecognized mount option \"%s\", "
- "passing to kernel.\n", data);
- }
+ mount_ceph_debug("mount.ceph: unrecognized mount option \"%s\", passing to kernel.\n",
+ data);
}
/* Copy (possibly modified) option to out */
else if (!strcmp("-o", argv[i])) {
++i;
if (i >= argc) {
- printf("Option -o requires an argument.\n\n");
+ fprintf(stderr, "Option -o requires an argument.\n\n");
return -EINVAL;
}
*opts = argv[i];
}
else {
- printf("Can't understand option: '%s'\n\n", argv[i]);
+ fprintf(stderr, "Can't understand option: '%s'\n\n", argv[i]);
return -EINVAL;
}
}
rsrc = mount_resolve_src(src);
if (!rsrc) {
- printf("failed to resolve source\n");
+ printf(stderr, "failed to resolve source\n");
retval = EX_USAGE;
goto out;
}
popts = parse_options(opts, &flags);
if (!popts) {
- printf("failed to parse ceph_options\n");
+ fprintf(stderr, "failed to parse ceph_options\n");
retval = EX_USAGE;
goto out;
}
retval = EX_FAIL;
switch (errno) {
case ENODEV:
- printf("mount error: ceph filesystem not supported by the system\n");
+ fprintf(stderr, "mount error: ceph filesystem not supported by the system\n");
break;
default:
- printf("mount error %d = %s\n",errno,strerror(errno));
+ fprintf(stderr, "mount error %d = %s\n",errno,strerror(errno));
}
} else {
if (!skip_mtab_flag) {