From patchwork Tue Oct 16 11:26:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1600241 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9011F40ABA for ; Tue, 16 Oct 2012 11:26:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754235Ab2JPL04 (ORCPT ); Tue, 16 Oct 2012 07:26:56 -0400 Received: from mail-ye0-f174.google.com ([209.85.213.174]:50944 "EHLO mail-ye0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753916Ab2JPL0z (ORCPT ); Tue, 16 Oct 2012 07:26:55 -0400 Received: by mail-ye0-f174.google.com with SMTP id m12so91631yen.19 for ; Tue, 16 Oct 2012 04:26:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=7SReEE5RUgSopzZvz7edvyhzF9yuNC8Q0o/Eonechcg=; b=Fx/BDirt0J+BBDG+tBDX1ukrSEXatu6nfOOkKqrBnfDXU2nxbuwHUyQ6fCnVqpatf3 aqwdI3xJndvQxQ2yoaqXp8p0hFFjUHHrIdJrNSx/wGmQp3dua0N/NP2+tDNqVns9pn+b Zps9VPG5eHYptWt2vzpMQrafPdCzSC55sGUdzpL2Nsrjc1ZPjcJqtCpuPGn3Ghv4lPr+ pe69c7E+cI0ASwcLHA+locHIMxWdwkB91RgspSq/k1Nc2PbjnXWHpFkiPAH9mW4jCurY C/Cnu+0zwt+TM7mIPBB94t+8eIRz1tWxVxdFmEOUVM2vBtWiwZp6CaaZPJzMZHMkj6Y2 ANgA== Received: by 10.236.103.232 with SMTP id f68mr12881537yhg.76.1350386815186; Tue, 16 Oct 2012 04:26:55 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id o12sm15888943anp.8.2012.10.16.04.26.54 (version=SSLv3 cipher=OTHER); Tue, 16 Oct 2012 04:26:54 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH 3/4] cifs: use the NUM_AUTHS and NUM_SUBAUTHS constants in cifsacl code Date: Tue, 16 Oct 2012 07:26:45 -0400 Message-Id: <1350386806-18356-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1350386806-18356-1-git-send-email-jlayton@redhat.com> References: <1350386806-18356-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQkbfoLgSVYssEG3RekH1vP+JMpI31FmCOwkqFVQOleNSwh+DQ5ly7d15MZgm2yzFkDepvNV Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org ...instead of hardcoding in '5' and '6' all over the place. Cc: Shirish Pargaonkar Signed-off-by: Jeff Layton Reviewed-by: Shirish Pargaonkar --- fs/cifs/cifsacl.c | 6 +++--- fs/cifs/cifsacl.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index eddadcd..9819aa8 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -210,7 +210,7 @@ sid_to_str(struct cifs_sid *sidptr, char *sidstr) sprintf(strptr, "-%d", sidptr->revision); strptr = sidstr + strlen(sidstr); - for (i = 0; i < 6; ++i) { + for (i = 0; i < NUM_AUTHS; ++i) { if (sidptr->authority[i]) { sprintf(strptr, "-%d", sidptr->authority[i]); strptr = sidstr + strlen(sidstr); @@ -649,7 +649,7 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) } /* compare all of the six auth values */ - for (i = 0; i < 6; ++i) { + for (i = 0; i < NUM_AUTHS; ++i) { if (ctsid->authority[i] != cwsid->authority[i]) { if (ctsid->authority[i] > cwsid->authority[i]) return 1; @@ -811,7 +811,7 @@ static __u16 fill_ace_for_sid(struct cifs_ace *pntace, pntace->sid.revision = psid->revision; pntace->sid.num_subauth = psid->num_subauth; - for (i = 0; i < 6; i++) + for (i = 0; i < NUM_AUTHS; i++) pntace->sid.authority[i] = psid->authority[i]; for (i = 0; i < psid->num_subauth; i++) pntace->sid.sub_auth[i] = psid->sub_auth[i]; diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h index 5c902c7..80e0d66 100644 --- a/fs/cifs/cifsacl.h +++ b/fs/cifs/cifsacl.h @@ -60,8 +60,8 @@ struct cifs_ntsd { struct cifs_sid { __u8 revision; /* revision level */ __u8 num_subauth; - __u8 authority[6]; - __le32 sub_auth[5]; /* sub_auth[num_subauth] */ + __u8 authority[NUM_AUTHS]; + __le32 sub_auth[NUM_SUBAUTHS]; /* sub_auth[num_subauth] */ } __attribute__((packed)); struct cifs_acl {