From patchwork Tue Nov 20 20:26:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 200507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "aserp1040.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EF62E2C007C for ; Wed, 21 Nov 2012 07:27:20 +1100 (EST) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qAKKRHG0017847 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Nov 2012 20:27:17 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qAKKRGC0022071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Nov 2012 20:27:17 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TauPc-0002DJ-To; Tue, 20 Nov 2012 12:27:16 -0800 Received: from ucsinet21.oracle.com ([156.151.31.93]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1TauPH-0002Bi-84 for fedfs-utils-devel@oss.oracle.com; Tue, 20 Nov 2012 12:26:55 -0800 Received: from rcsinet12.oracle.com (rcsinet12.oracle.com [148.87.113.124]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qAKKQsVX019378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Nov 2012 20:26:54 GMT Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by rcsinet12.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qAKKQPex026400 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 20 Nov 2012 20:26:54 GMT Received: by mail-ie0-f171.google.com with SMTP id 17so3879499iea.2 for ; Tue, 20 Nov 2012 12:26:54 -0800 (PST) Received: by 10.50.213.69 with SMTP id nq5mr11244110igc.70.1353443214020; Tue, 20 Nov 2012 12:26:54 -0800 (PST) Received: from seurat.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id b13sm11221115igp.7.2012.11.20.12.26.52 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 12:26:53 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Tue, 20 Nov 2012 15:26:52 -0500 Message-ID: <20121120202652.47389.76893.stgit@seurat.1015granger.net> In-Reply-To: <20121120201753.47389.51902.stgit@seurat.1015granger.net> References: <20121120201753.47389.51902.stgit@seurat.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Flow-Control-Info: class=Default reputation=ipRepBelow100 ip=209.85.223.171 ct-class=R5 ct-vol1=0 ct-vol2=9 ct-vol3=8 ct-risk=47 ct-spam1=75 ct-spam2=6 ct-bulk=5 rcpts=1 size=2264 X-MM-CT-Classification: not spam X-MM-CT-RefID: str=0001.0A090205.50ABE78E.004A,ss=1,re=0.000,fgs=0 Subject: [fedfs-utils] [PATCH 3/7] libnsdb: Generalize nsdb_parse_annotations() X-BeenThere: fedfs-utils-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: fedfs-utils Developers List-Id: fedfs-utils Developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] At one point, nsdb_parse_annotations() used to parse fedfsAnnotations by breaking them into key-value pairs. But now it just stores each pair into an array of strings. This was changed before the initial 0.6.0 commit, but the documenting comment was never updated. This looks like something that can be used for any FedFS-related LDAP object that has a fedfsAnnotations attribute. Instead of having a version of this function that is specific to fedfsFsl records, let's make it more general by having it output a string array rather than filling in a struct fedfs_fsl. Signed-off-by: Chuck Lever --- src/libnsdb/fileserver.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libnsdb/fileserver.c b/src/libnsdb/fileserver.c index 9ec0f37..fe09604 100644 --- a/src/libnsdb/fileserver.c +++ b/src/libnsdb/fileserver.c @@ -585,14 +585,11 @@ nsdb_resolve_fsn_parse_objectclass(char *attr, struct berval **values, * Parse fedfsAnnotation attribute of a fedfsFsl * * @param values array of values for this attribute - * @param fsl OUT: fedfs_fsl structure to fill in + * @param annotations OUT: pointer to array of NUL-terminated C strings * @return a FedFsStatus code - * - * Place the keywords in fsl->fl_anno_keys and the values in - * fsl->fl_anno_vals. */ static FedFsStatus -nsdb_parse_annotations(struct berval **values, struct fedfs_fsl *fsl) +nsdb_parse_annotations(struct berval **values, char ***annotations) { char **tmp_annos; int i, count; @@ -619,7 +616,7 @@ nsdb_parse_annotations(struct berval **values, struct fedfs_fsl *fsl) } tmp_annos[i] = NULL; - fsl->fl_annotations = tmp_annos; + *annotations = tmp_annos; return FEDFS_OK; } @@ -662,7 +659,7 @@ nsdb_resolve_fsn_parse_attribute(LDAP *ld, LDAPMessage *entry, char *attr, retval = nsdb_parse_singlevalue_int(attr, values, &fsl->fl_fslport); else if (strcasecmp(attr, "fedfsAnnotation") == 0) - retval = nsdb_parse_annotations(values, fsl); + retval = nsdb_parse_annotations(values, &fsl->fl_annotations); else if (strcasecmp(attr, "fedfsDescr") == 0) retval = nsdb_parse_multivalue_str(attr, values, &fsl->fl_description);