ceph_common.c (d6a3408a77807037872892c2a2034180fcc08d12) ceph_common.c (19809c2da28aee5860ad9a2eff760730a0710df0)
1
2#include <linux/ceph/ceph_debug.h>
3#include <linux/backing-dev.h>
4#include <linux/ctype.h>
5#include <linux/fs.h>
6#include <linux/inet.h>
7#include <linux/in6.h>
8#include <linux/key.h>

--- 31 unchanged lines hidden (view full) ---

40 * The data pointer can be null.
41 */
42bool libceph_compatible(void *data)
43{
44 return true;
45}
46EXPORT_SYMBOL(libceph_compatible);
47
1
2#include <linux/ceph/ceph_debug.h>
3#include <linux/backing-dev.h>
4#include <linux/ctype.h>
5#include <linux/fs.h>
6#include <linux/inet.h>
7#include <linux/in6.h>
8#include <linux/key.h>

--- 31 unchanged lines hidden (view full) ---

40 * The data pointer can be null.
41 */
42bool libceph_compatible(void *data)
43{
44 return true;
45}
46EXPORT_SYMBOL(libceph_compatible);
47
48static int param_get_supported_features(char *buffer,
49 const struct kernel_param *kp)
50{
51 return sprintf(buffer, "0x%llx", CEPH_FEATURES_SUPPORTED_DEFAULT);
52}
53static const struct kernel_param_ops param_ops_supported_features = {
54 .get = param_get_supported_features,
55};
56module_param_cb(supported_features, &param_ops_supported_features, NULL,
57 S_IRUGO);
58
59/*
60 * find filename portion of a path (/foo/bar/baz -> baz)
61 */
62const char *ceph_file_part(const char *s, int len)
63{
64 const char *e = s + len;
65
66 while (e != s && *(e-1) != '/')

--- 126 unchanged lines hidden (view full) ---

193void *ceph_kvmalloc(size_t size, gfp_t flags)
194{
195 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
196 void *ptr = kmalloc(size, flags | __GFP_NOWARN);
197 if (ptr)
198 return ptr;
199 }
200
48/*
49 * find filename portion of a path (/foo/bar/baz -> baz)
50 */
51const char *ceph_file_part(const char *s, int len)
52{
53 const char *e = s + len;
54
55 while (e != s && *(e-1) != '/')

--- 126 unchanged lines hidden (view full) ---

182void *ceph_kvmalloc(size_t size, gfp_t flags)
183{
184 if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) {
185 void *ptr = kmalloc(size, flags | __GFP_NOWARN);
186 if (ptr)
187 return ptr;
188 }
189
201 return __vmalloc(size, flags | __GFP_HIGHMEM, PAGE_KERNEL);
190 return __vmalloc(size, flags, PAGE_KERNEL);
202}
203
204
205static int parse_fsid(const char *str, struct ceph_fsid *fsid)
206{
207 int i = 0;
208 char tmp[3];
209 int err = -EINVAL;

--- 392 unchanged lines hidden (view full) ---

602{
603 return client->monc.auth->global_id;
604}
605EXPORT_SYMBOL(ceph_client_gid);
606
607/*
608 * create a fresh client instance
609 */
191}
192
193
194static int parse_fsid(const char *str, struct ceph_fsid *fsid)
195{
196 int i = 0;
197 char tmp[3];
198 int err = -EINVAL;

--- 392 unchanged lines hidden (view full) ---

591{
592 return client->monc.auth->global_id;
593}
594EXPORT_SYMBOL(ceph_client_gid);
595
596/*
597 * create a fresh client instance
598 */
610struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
599struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
600 u64 supported_features,
601 u64 required_features)
611{
612 struct ceph_client *client;
613 struct ceph_entity_addr *myaddr = NULL;
614 int err = -ENOMEM;
615
616 client = kzalloc(sizeof(*client), GFP_KERNEL);
617 if (client == NULL)
618 return ERR_PTR(-ENOMEM);
619
620 client->private = private;
621 client->options = opt;
622
623 mutex_init(&client->mount_mutex);
624 init_waitqueue_head(&client->auth_wq);
625 client->auth_err = 0;
626
602{
603 struct ceph_client *client;
604 struct ceph_entity_addr *myaddr = NULL;
605 int err = -ENOMEM;
606
607 client = kzalloc(sizeof(*client), GFP_KERNEL);
608 if (client == NULL)
609 return ERR_PTR(-ENOMEM);
610
611 client->private = private;
612 client->options = opt;
613
614 mutex_init(&client->mount_mutex);
615 init_waitqueue_head(&client->auth_wq);
616 client->auth_err = 0;
617
627 client->extra_mon_dispatch = NULL;
628 client->supported_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
629 client->required_features = CEPH_FEATURES_REQUIRED_DEFAULT;
630
631 if (!ceph_test_opt(client, NOMSGAUTH))
618 if (!ceph_test_opt(client, NOMSGAUTH))
632 client->required_features |= CEPH_FEATURE_MSG_AUTH;
619 required_features |= CEPH_FEATURE_MSG_AUTH;
633
620
621 client->extra_mon_dispatch = NULL;
622 client->supported_features = CEPH_FEATURES_SUPPORTED_DEFAULT |
623 supported_features;
624 client->required_features = CEPH_FEATURES_REQUIRED_DEFAULT |
625 required_features;
626
634 /* msgr */
635 if (ceph_test_opt(client, MYIP))
636 myaddr = &client->options->my_addr;
637
638 ceph_messenger_init(&client->msgr, myaddr);
639
640 /* subsystems */
641 err = ceph_monc_init(&client->monc, client);

--- 153 unchanged lines hidden ---
627 /* msgr */
628 if (ceph_test_opt(client, MYIP))
629 myaddr = &client->options->my_addr;
630
631 ceph_messenger_init(&client->msgr, myaddr);
632
633 /* subsystems */
634 err = ceph_monc_init(&client->monc, client);

--- 153 unchanged lines hidden ---