Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B663A11B2E for ; Thu, 21 Aug 2014 09:45:35 +0000 (UTC) Received: (qmail 26897 invoked by uid 500); 21 Aug 2014 09:45:35 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 26867 invoked by uid 500); 21 Aug 2014 09:45:35 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 26460 invoked by uid 99); 21 Aug 2014 09:45:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Aug 2014 09:45:35 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of evgeny.kotkov@visualsvn.com designates 209.85.215.46 as permitted sender) Received: from [209.85.215.46] (HELO mail-la0-f46.google.com) (209.85.215.46) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Aug 2014 09:45:30 +0000 Received: by mail-la0-f46.google.com with SMTP id b8so8503540lan.33 for ; Thu, 21 Aug 2014 02:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=visualsvn.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=AVN2aPDflmWHk0xwfEAaoB0/T8hDx0aoEmQKf4ymSnA=; b=LsnnNB6r3Ruyj1xu3uddWDltm4Oai17+ilfbBPMXYyy7g7r5pvIdM4+41Ammk7jWyJ l+GGAgF/rLo7W78QXqjodcwN5wtfxxoaIa0BBO2fv9PMem9CZnn/FmteCfyFOBMlcV7R Qeg/3qeuP547J3hVwvzYCjk+hwMf65kdzPeSQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=AVN2aPDflmWHk0xwfEAaoB0/T8hDx0aoEmQKf4ymSnA=; b=Zhzj/vF9R+8ptVlsJ7iEt+10XVc6BCmxWY4FZJJjdpl4Y5EvR7AQo3HHSQ+wXaU6PB cs0WxTHhh78yZke543fu6951+0qW0VG0ugqqydy8559LmkUUhA5R+n2PGBuIaNAyyus1 NAoZt+JU1w1368/CAkP3Ny+7OYiHsdRa5VzJ/na3Exq9Jqb5IIjN8RAhC7+bVQFsaihb 1vTgvgJG1kiZWdkoyQ/CLOeVRg3XQi/Fo5kpyA7IY2uYwR+LY0aZl2jH4uPYa2XpbhbR E/2IhXwXWqhL+SPjcSxwwwQocQNVWvWx7XXs/9ZbvKnDOL9e+FQ8VA0khUJEByWxIbE8 oVIw== X-Gm-Message-State: ALoCoQnemlIBCLfyLfJN8yBbqwmllT9Ymm47wcZscvYqCnqPoMRJO3aN/aOTS7T3Knp4M+Do/NQ7 X-Received: by 10.152.236.43 with SMTP id ur11mr48192330lac.74.1408614309446; Thu, 21 Aug 2014 02:45:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.90.104 with HTTP; Thu, 21 Aug 2014 02:44:49 -0700 (PDT) In-Reply-To: <20130724132445.A34FD2388994@eris.apache.org> References: <20130724132445.A34FD2388994@eris.apache.org> From: Evgeny Kotkov Date: Thu, 21 Aug 2014 13:44:49 +0400 Message-ID: Subject: Re: svn commit: r1506545 [1/2] - in /subversion/branches/fsfs-improvements/subversion: include/ libsvn_fs_fs/ To: Subversion Development Cc: commits@subversion.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org > Author: stefan2 > Date: Wed Jul 24 13:24:44 2013 > New Revision: 1506545 > > URL: http://svn.apache.org/r1506545 > Log: > On the fsfs-improvements branch: Finally switch to a new FSFS ID API. > > This replaces the previous string-based API with one that represents > IDs as quadruples of pairs of integers. Thus, it > now matches the implicit usage of the node_id, branch_id, txn_id and > rev_offset parts of those IDs. > > The patch does four things. First, it replaces the current API in > id.*. Second, it must use the new svn_fs_fs__id_part_t * instead of > const char * in all FSFS code. In some places we have to add a level > of indirection as key parts can now be put on stack instead of being > pool-allocated but we always pass them along through pointers. > > Third, structs using a txn ID will use the new data type as well - > requiring more code to be updated. Lastly, we have to update code > that (de-)serializes IDs or handles ID assignment and increments. [...] > svn_fs_fs__id_eq(const svn_fs_id_t *a, > const svn_fs_id_t *b) > { > - id_private_t *pvta = a->fsap_data, *pvtb = b->fsap_data; > + fs_fs__id_t *id_a = (fs_fs__id_t *)a; > + fs_fs__id_t *id_b = (fs_fs__id_t *)b; > > if (a == b) > return TRUE; > - if (strcmp(pvta->node_id, pvtb->node_id) != 0) > - return FALSE; > - if (strcmp(pvta->copy_id, pvtb->copy_id) != 0) > - return FALSE; > - if ((pvta->txn_id == NULL) != (pvtb->txn_id == NULL)) > - return FALSE; > - if (pvta->txn_id && pvtb->txn_id && strcmp(pvta->txn_id, pvtb->txn_id) != 0) > - return FALSE; > - if (pvta->rev != pvtb->rev) > - return FALSE; > - if (pvta->offset != pvtb->offset) > - return FALSE; > - return TRUE; > + > + return memcmp(&id_a->private_id, &id_b->private_id, > + sizeof(id_a->private_id)) == 0; > } I am wondering, whether this is a portable way of comparing structs. Isn't it possible that fs_fs__id_t would compile with padding and hence, result in false negative checks here? It looks like we do not always use apr_pcalloc() to zero out the memory for these structures (e.g. within the subversion/libsvn_fs_fs/temp_deserializer.c code), so it might be possible that the padding bytes would contain some random garbage, and we would attempt to compare it with memcmp(). Regards, Evgeny Kotkov