Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8878036ybi; Wed, 10 Jul 2019 00:53:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQyaxVCfkN4pOXb3GG6Pqh+Ocb1R877HnBLmMdbTQY9xTlI3aV99vbUHB0bcLDc/xvB9C9 X-Received: by 2002:a65:6401:: with SMTP id a1mr35874123pgv.42.1562745236245; Wed, 10 Jul 2019 00:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562745236; cv=none; d=google.com; s=arc-20160816; b=naGLy5O/OnUk9ycQWJrSgxuipZescg+uPlLKy8TmI2GUIzQai/i69iM2FOWUNIiw2K AWpyBxi4F1idX1y3LqIePeGPQ4g6v28yO/XtEKOt2yK0Kb31Pl6Cn4Bw+/ylqtSOkLYd Lim1wAJqOiq8VZiCGpu3k0RXJi2tTzgQU/rM+3IKHLJ0/nNxpqyhcRtLkp9lZ/dVlxst 1sZj88VyRLsXSxJg5EJeaoCAR+oAY6SpWQv7owbRvRpdlluBs2CsBhtqhMZlpQceqJXV q9LZcqWSEwo1J3jrtlG4N91JNP8u0az49Jt/X2+gRlZdym08caisQ08IHVLwmpRhjgZD Gybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kxfsIK/azxtf+dkgnH9i+nHGvgqgPlzs2CH//OPWnZ8=; b=IQTSIfW7mnhAqYdzyej1ppBQzyT9d9cHhB5IhnabslwaNBK2pPXjdFXQWf5/SgOPt1 FqAdlnncwaiqtTl1qHY1fQOwcxYjSyWt8I3LFWL/zWK67GU330CwxGQzffuunX2k7Gaw B6Ah03Dl7mCT4ilh+VwVH4NnDxnCcaA1pDctf8LDTpdsjGUH3gnzUaCGiVz/m8evPehx G7D/Z+NVbAQ5vI2QczLF2pSz+egPRLXVUS6r6OQT+5NH/lyxH+Wii1iFvx/+fTNtjVyN KsYSJEi2xD34L+hcrKVUP3VrEZLv31zRBQMwRe3PLpbiazTEOgbT8ZgVZpusIdrqP3al 32Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=HZNHQNLh; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si1491351pjw.56.2019.07.10.00.53.32; Wed, 10 Jul 2019 00:53:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@silvair-com.20150623.gappssmtp.com header.s=20150623 header.b=HZNHQNLh; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbfGJHwv (ORCPT + 99 others); Wed, 10 Jul 2019 03:52:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45110 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbfGJHwv (ORCPT ); Wed, 10 Jul 2019 03:52:51 -0400 Received: by mail-wr1-f67.google.com with SMTP id f9so1296366wre.12 for ; Wed, 10 Jul 2019 00:52:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silvair-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=kxfsIK/azxtf+dkgnH9i+nHGvgqgPlzs2CH//OPWnZ8=; b=HZNHQNLhMH5trFthpdaha1PHNG8G5IwEJaNcS3oySGqzUPziJa23k2eaNKxfi7wW2H dnGsVyECBwyg744d3IyyI2pV/D+9u4qUqqnDDtXSJkG4JLxLC+HftsCUnNx494P1arG/ 1RbUjT7IiinI4TmaDC0yNkmdlZV0bByYkNpPubcSA8KS6VxCbB0Ru+HFsri9ZyMFmlvX FsvAAvXxpBRBMukXOZrI47vo/LMENqiCyz37nMbtq7hudwvl8vQvkWy03sUDOvb6MBFS 0eeDojvxmvWfYNeZIy9GHGZpT12g5K8ab/Q6BpkiWegjYANHYD5PloW9BuD5/sZGoT+S DxCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=kxfsIK/azxtf+dkgnH9i+nHGvgqgPlzs2CH//OPWnZ8=; b=TkoNWMOgAFBWZcPqN2PiTKaSTQr03R8moNDpR6TI3+5dCYZj4mLvhfSHngFUn5tQ4A T7+xPNf3TY9GhSNrFTEA19VfVwl+yvI+4cbyoPWGHXMVBo+1NAKPFYqoJfmrEloOfpYY GMsli1ZnU4m08rPfl3DyC/RGJ34Ge8Pw0io9lLSzkY8ljY+CvATvUxZ6wOXKccUiuEF/ hjjf9Mr3ypO5ZkwDRBNEq287p9pGTgQHfpqskBA50t4/bQsSv14hhoPv6OvOQq2fY02m 8kTSAws6nFsXB7g8gDV5BkhkhQ2OYyvGNv3ixeDNxEKf1xNJBgBGApk168jRo/g6f5Je I+gQ== X-Gm-Message-State: APjAAAX4jdTcwlYKfh1pn5G0piuDpaCX38/UPQKsR232Z64TV7YAmBYA e9X8uVdmqUi7gIU9OBv9zZZlIQ== X-Received: by 2002:a5d:6908:: with SMTP id t8mr30836125wru.147.1562745168762; Wed, 10 Jul 2019 00:52:48 -0700 (PDT) Received: from mlowasrzechonek2133 ([217.153.94.18]) by smtp.gmail.com with ESMTPSA id g11sm1442478wrq.92.2019.07.10.00.52.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 00:52:48 -0700 (PDT) Date: Wed, 10 Jul 2019 09:52:45 +0200 From: =?utf-8?Q?Micha=C5=82?= Lowas-Rzechonek To: Inga Stotland Cc: linux-bluetooth@vger.kernel.org, brian.gix@intel.com, jakub.witowski@silvair.com Subject: Re: [PATCH BlueZ 6/9] mesh: Define storage format specific read/write routines Message-ID: <20190710075245.2koao3eyj22wbj7s@mlowasrzechonek2133> Mail-Followup-To: Inga Stotland , linux-bluetooth@vger.kernel.org, brian.gix@intel.com, jakub.witowski@silvair.com References: <20190710050959.7321-1-inga.stotland@intel.com> <20190710050959.7321-7-inga.stotland@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190710050959.7321-7-inga.stotland@intel.com> User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On 07/09, Inga Stotland wrote: > This adds the following generic APIs to mesh-config.h > void *mesh_config_create_config(void); > void mesh_config_release_config(void *config); > void *mesh_config_get_config(const char *dir); > void *mesh_config_get_config_backup(const char *dir); > bool mesh_config_restore_backup(const char *dir); > bool mesh_config_save_config(const char *dir, void *cfg); > > The implementation of these API routines depends on the > underlying storage directory structure and can be specific to > a chosen configuration file format. I don't like the assumption that each node is stored in a separate file, and there needs to be a backup file. One of the storage formats I had in mind is a single transactional database (some flavor of berkeley db, or maybe even sqlite) that would hold all the nodes. With this in mind, how about: union mesh_config *mesh_config_create_config(const uint8_t uuid[16]); bool mesh_config_save(union mesh_config *cfg); and to iterate over saved nodes: typedef struct mesh_node *(*mesh_node_load_cb)(union mesh_config *cfg, const uint8_t uuid[16], void *user_data); void mesh_config_load_nodes(mesh_node_load_cb cb, void *user_data); and move file/directory handling from storage.c to mesh-config-json.c? regards -- Michał Lowas-Rzechonek Silvair http://silvair.com Jasnogórska 44, 31-358 Krakow, POLAND