From patchwork Tue Jun 30 20:27:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Fuller X-Patchwork-Id: 6698211 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 309C59F3A0 for ; Tue, 30 Jun 2015 20:30:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61EDF204D3 for ; Tue, 30 Jun 2015 20:30:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AA32204B5 for ; Tue, 30 Jun 2015 20:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751841AbbF3UaC (ORCPT ); Tue, 30 Jun 2015 16:30:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60984 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751982AbbF3U35 (ORCPT ); Tue, 30 Jun 2015 16:29:57 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 1EDD3347A62 for ; Tue, 30 Jun 2015 20:29:57 +0000 (UTC) Received: from rex001.front.sepia.ceph.com ([10.17.112.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5UKTrtk018417 for ; Tue, 30 Jun 2015 16:29:56 -0400 From: Douglas Fuller To: ceph-devel@vger.kernel.org Subject: [PATCH RFC 3/6] auth.c: added ceph_entity_name_encode Date: Tue, 30 Jun 2015 13:27:58 -0700 Message-Id: <6a61ab4e809ccaa6aee711abf727ce0cdda26db8.1435695881.git.dfuller@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Douglas Fuller --- include/linux/ceph/auth.h | 2 ++ net/ceph/auth.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h index 260d78b..7687918 100644 --- a/include/linux/ceph/auth.h +++ b/include/linux/ceph/auth.h @@ -104,6 +104,8 @@ extern int ceph_handle_auth_reply(struct ceph_auth_client *ac, void *buf, size_t len, void *reply_buf, size_t reply_len); extern int ceph_entity_name_encode(const char *name, void **p, void *end); +extern int ceph_entity_name_decode(struct ceph_entity_name *name, void **p, + void *end); extern int ceph_build_auth(struct ceph_auth_client *ac, void *msg_buf, size_t msg_len); diff --git a/net/ceph/auth.c b/net/ceph/auth.c index 6b923bc..50baee6 100644 --- a/net/ceph/auth.c +++ b/net/ceph/auth.c @@ -94,6 +94,17 @@ int ceph_entity_name_encode(const char *name, void **p, void *end) return 0; } +int ceph_entity_name_decode(struct ceph_entity_name *name, void **p, void *end) +{ + ceph_decode_8_safe(p, end, name->type, bad); + ceph_decode_64_safe(p, end, name->num, bad); + + return 0; + +bad: + return -ERANGE; +} + /* * Initiate protocol negotiation with monitor. Include entity name * and list supported protocols.