4 #include <linux/ctype.h>
10 #include <linux/module.h>
13 #include <linux/sched.h>
15 #include <linux/slab.h>
17 #include <linux/string.h>
35 const char *
e = s + len;
37 while (e != s && *(e-1) !=
'/')
70 default:
return "unknown";
81 if (ceph_fsid_compare(&client->
fsid, fsid)) {
82 pr_err(
"bad fsid, had %pU got %pU",
93 static int strcmp_null(
const char *
s1,
const char *
s2)
113 ret =
memcmp(opt1, opt2, ofs);
117 ret = strcmp_null(opt1->
name, opt2->
name);
121 if (opt1->
key && !opt2->
key)
123 if (!opt1->
key && opt2->
key)
125 if (opt1->
key && opt2->
key) {
126 if (opt1->
key->type != opt2->
key->type)
128 if (opt1->
key->created.tv_sec != opt2->
key->created.tv_sec)
130 if (opt1->
key->created.tv_nsec != opt2->
key->created.tv_nsec)
132 if (opt1->
key->len != opt2->
key->len)
134 if (opt1->
key->key && !opt2->
key->key)
136 if (!opt1->
key->key && opt2->
key->key)
138 if (opt1->
key->key && opt2->
key->key) {
146 for (i = 0; i < opt1->
num_mon; i++) {
163 dout(
"parse_fsid '%s'\n", str);
165 while (*str && i < 16) {
174 if (
sscanf(tmp,
"%x", &d) < 1)
176 fsid->
fsid[
i] = d & 0xff;
183 dout(
"parse_fsid ret %d got fsid %pU", err, fsid);
231 dout(
"destroy_options %p\n", opt);
234 ceph_crypto_key_destroy(opt->
key);
250 if (!ukey || IS_ERR(ukey)) {
253 key_err = PTR_ERR(ukey);
256 pr_warning(
"ceph: Mount failed due to key not found: %s\n", name);
259 pr_warning(
"ceph: Mount failed due to expired key: %s\n", name);
262 pr_warning(
"ceph: Mount failed due to revoked key: %s\n", name);
265 pr_warning(
"ceph: Mount failed due to unknown key error"
266 " %d: %s\n", key_err, name);
272 ckey = ukey->payload.data;
286 const char *dev_name_end,
287 int (*parse_extra_token)(
char *
c,
void *
private),
303 dout(
"parse_options %p options '%s' dev_name '%s'\n", opt, options,
326 token =
match_token((
char *)c, opt_tokens, argstr);
327 if (token < 0 && parse_extra_token) {
329 err = parse_extra_token((
char *)c,
private);
331 pr_err(
"bad option at '%s'\n", c);
339 pr_err(
"bad mount option arg (not int) "
343 dout(
"got int token %d val %d\n", token, intval);
345 dout(
"got string token %d val %s\n", token,
348 dout(
"got token %d\n", token);
362 err = parse_fsid(argstr[0].from, &opt->
fsid);
368 argstr[0].to-argstr[0].from,
387 err = get_secret(opt->
key, argstr[0].
from);
436 return client->
monc.auth->global_id;
451 client = kzalloc(
sizeof(*client),
GFP_KERNEL);
470 myaddr = &client->
options->my_addr;
496 dout(
"destroy_client %p\n", client);
510 dout(
"destroy_client %p done\n", client);
519 return client->
monc.monmap && client->
monc.monmap->epoch &&
520 client->
osdc.osdmap && client->
osdc.osdmap->epoch;
536 while (!have_mon_and_osd_map(client)) {
542 dout(
"mount waiting for mon_map\n");
544 have_mon_and_osd_map(client) || (client->
auth_err < 0),
562 dout(
"open_session start\n");
573 static int __init init_ceph_lib(
void)
589 pr_info(
"loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n",
604 static void __exit exit_ceph_lib(
void)
606 dout(
"exit_ceph_lib\n");