From patchwork Fri May 23 12:00:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4231911 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3FAFC9F1CD for ; Fri, 23 May 2014 12:00:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CC662039C for ; Fri, 23 May 2014 12:00:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 009022022A for ; Fri, 23 May 2014 12:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751434AbaEWMAl (ORCPT ); Fri, 23 May 2014 08:00:41 -0400 Received: from mail-qc0-f171.google.com ([209.85.216.171]:49149 "EHLO mail-qc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbaEWMAk (ORCPT ); Fri, 23 May 2014 08:00:40 -0400 Received: by mail-qc0-f171.google.com with SMTP id x13so7895024qcv.2 for ; Fri, 23 May 2014 05:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=pJ3jqeZaLbcxC/wMKoejoP8jh95CPBRYPtSXQeMrRgg=; b=fJvqelbk7Y5oWkvIGmGSS2OQgjeH2xXykL4Y93ByszioXo22mZX79OeCi3wn4Utfsm CCHp7cMwRKiyHnQcePYLkEsk57Dq5FCIIojwZd7EucbRKgeZIl4LI4rELWdYvnUhtl/c rhe02i/A5Kff7ijdQe3WRq5risZy8tlMJ1rDiZqLwhXYFiYPiuspK8LqzRq190lEQFP6 L7CP0didWFBIJsubkd2FJ274uR1nFuNOQZuv4FS0cl/E+2PDFZEJz+tdZOhb8e5lQ/Rv 0uDU/CU5vzm6H5dgl0A5Qppwuy+Y/PFWBSgWqKQAddKRHpZ9aCBH36oLsGVzTzRS1UlB RlvA== X-Received: by 10.224.25.133 with SMTP id z5mr5463540qab.97.1400846440091; Fri, 23 May 2014 05:00:40 -0700 (PDT) Received: from [192.168.31.158] ([118.117.113.227]) by mx.google.com with ESMTPSA id w101sm1814543qge.12.2014.05.23.05.00.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 05:00:39 -0700 (PDT) Message-ID: <537F3853.3090109@gmail.com> Date: Fri, 23 May 2014 20:00:19 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH 3/4] NFSD: Adds macro EX_UUID_LEN for exports uuid's length Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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: Kinglong Mee --- fs/nfsd/export.c | 6 +++--- fs/nfsd/export.h | 1 + fs/nfsd/nfs4xdr.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 8771f41..90d37b6 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -487,10 +487,10 @@ uuid_parse(char **mesg, char *buf, unsigned char **puuid) /* expect a 16 byte uuid encoded as \xXXXX... */ len = qword_get(mesg, buf, PAGE_SIZE); - if (len != 16) + if (len != EX_UUID_LEN) return -EINVAL; - *puuid = kmemdup(buf, 16, GFP_KERNEL); + *puuid = kmemdup(buf, EX_UUID_LEN, GFP_KERNEL); if (*puuid == NULL) return -ENOMEM; @@ -663,7 +663,7 @@ static int svc_export_show(struct seq_file *m, if (exp->ex_uuid) { int i; seq_puts(m, ",uuid="); - for (i=0; i<16; i++) { + for (i = 0; i < EX_UUID_LEN; i++) { if ((i&3) == 0 && i) seq_putc(m, ':'); seq_printf(m, "%02x", exp->ex_uuid[i]); diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h index d7939a6..c7d4ed0 100644 --- a/fs/nfsd/export.h +++ b/fs/nfsd/export.h @@ -37,6 +37,7 @@ struct nfsd4_fs_locations { * spkm3i, and spkm3p (and using all 8 at once should be rare). */ #define MAX_SECINFO_LIST 8 +#define EX_UUID_LEN 16 struct exp_flavor_info { u32 pseudoflavor; diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 18881f3..071b0be 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2250,7 +2250,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, WRITE32(MINOR(stat.dev)); break; case FSIDSOURCE_UUID: - WRITEMEM(exp->ex_uuid, 16); + WRITEMEM(exp->ex_uuid, EX_UUID_LEN); break; } }