Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd84db6e authored by Yehuda Sadeh's avatar Yehuda Sadeh Committed by Sage Weil
Browse files

ceph: code cleanup



Mainly fixing minor issues reported by sparse.

Signed-off-by: default avatarYehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent ca81f3f6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line

#include <linux/errno.h>

int ceph_armor(char *dst, const char *src, const char *end);
int ceph_unarmor(char *dst, const char *src, const char *end);

/*
 * base64 encode/decode.
 */

const char *pem_key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char *pem_key =
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

static int encode_bits(int c)
{
+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ static u32 supported_protocols[] = {
	CEPH_AUTH_CEPHX
};

int ceph_auth_init_protocol(struct ceph_auth_client *ac, int protocol)
static int ceph_auth_init_protocol(struct ceph_auth_client *ac, int protocol)
{
	switch (protocol) {
	case CEPH_AUTH_NONE:
@@ -133,7 +133,7 @@ int ceph_auth_build_hello(struct ceph_auth_client *ac, void *buf, size_t len)
	return -ERANGE;
}

int ceph_build_auth_request(struct ceph_auth_client *ac,
static int ceph_build_auth_request(struct ceph_auth_client *ac,
				   void *msg_buf, size_t msg_len)
{
	struct ceph_mon_request_header *monhdr = msg_buf;
+3 −3
Original line number Diff line number Diff line
@@ -87,8 +87,8 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret,
/*
 * get existing (or insert new) ticket handler
 */
struct ceph_x_ticket_handler *get_ticket_handler(struct ceph_auth_client *ac,
						 int service)
static struct ceph_x_ticket_handler *
get_ticket_handler(struct ceph_auth_client *ac, int service)
{
	struct ceph_x_ticket_handler *th;
	struct ceph_x_info *xi = ac->private;
@@ -429,7 +429,7 @@ static int ceph_x_build_request(struct ceph_auth_client *ac,
		auth->struct_v = 1;
		auth->key = 0;
		for (u = (u64 *)tmp_enc; u + 1 <= (u64 *)(tmp_enc + ret); u++)
			auth->key ^= *u;
			auth->key ^= *(__le64 *)u;
		dout(" server_challenge %llx client_challenge %llx key %llx\n",
		     xi->server_challenge, le64_to_cpu(auth->client_challenge),
		     le64_to_cpu(auth->key));
+0 −16
Original line number Diff line number Diff line
@@ -47,22 +47,6 @@ void ceph_buffer_release(struct kref *kref)
	kfree(b);
}

int ceph_buffer_alloc(struct ceph_buffer *b, int len, gfp_t gfp)
{
	b->vec.iov_base = kmalloc(len, gfp | __GFP_NOWARN);
	if (b->vec.iov_base) {
		b->is_vmalloc = false;
	} else {
		b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL);
		b->is_vmalloc = true;
	}
	if (!b->vec.iov_base)
		return -ENOMEM;
	b->alloc_len = len;
	b->vec.iov_len = len;
	return 0;
}

int ceph_decode_buffer(struct ceph_buffer **b, void **p, void *end)
{
	size_t len;
+3 −3
Original line number Diff line number Diff line
@@ -1194,6 +1194,8 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
 */
void __ceph_flush_snaps(struct ceph_inode_info *ci,
			struct ceph_mds_session **psession)
		__releases(ci->vfs_inode->i_lock)
		__acquires(ci->vfs_inode->i_lock)
{
	struct inode *inode = &ci->vfs_inode;
	int mds;
@@ -1439,7 +1441,6 @@ static int try_nonblocking_invalidate(struct inode *inode)
 */
void ceph_check_caps(struct ceph_inode_info *ci, int flags,
		     struct ceph_mds_session *session)
	__releases(session->s_mutex)
{
	struct ceph_client *client = ceph_inode_to_client(&ci->vfs_inode);
	struct ceph_mds_client *mdsc = &client->mdsc;
@@ -2257,7 +2258,6 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
			     struct ceph_cap *cap,
			     struct ceph_buffer *xattr_buf)
		__releases(inode->i_lock)
	__releases(session->s_mutex)
{
	struct ceph_inode_info *ci = ceph_inode(inode);
	int mds = session->s_mds;
Loading