All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Wysochanski <dwysocha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 02/13] Add lvm_create, lvm_destroy, lvm_reload_config() APIs.
Date: Fri, 13 Feb 2009 06:42:06 -0500	[thread overview]
Message-ID: <1234525326.2731.38.camel@f10-node1> (raw)
In-Reply-To: <87pri077c5.fsf@eriador.mornfall.net>

On Tue, 2009-02-03 at 00:22 +0100, Petr Rockai wrote:
> Hi,
> 
> see comments inline.
> 
> Dave Wysochanski <dwysocha@redhat.com> writes:
> > +++ b/lib/lvm2.c
> > @@ -0,0 +1,70 @@
> > +/*
> > + * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
> > + *
> > + * This file is part of LVM2.
> > + *
> > + * This copyrighted material is made available to anyone wishing to use,
> > + * modify, copy, or redistribute it subject to the terms and conditions
> > + * of the GNU Lesser General Public License v.2.1.
> > + *
> > + * You should have received a copy of the GNU Lesser General Public License
> > + * along with this program; if not, write to the Free Software Foundation,
> > + * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> > + */
> > +
> > +#include "lvm2.h"
> > +#include "lib.h"
> > +#include "toolcontext.h"
> > +#include "locking.h"
> > +#include "metadata-exported.h"
> > +#include "report.h"
> > +
> > +
> > +lvm_handle_t lvm_create(const char *system_dir)
> > +{
> > +	struct cmd_context *cmd;
> > +
> > +	/* To be done:
> > +	 * logging bound to handle
> > +	 */
> > +
> > +	/* create context */
> > +	cmd = create_toolcontext(1, system_dir);
> > +
> > +	/* initilize remaining */
> > +	if (cmd) {
> > +		int locking_type;
> > +
> > +		/* initilization from lvm_run_command */
> > +		init_error_message_produced(0);
> > +		sigint_clear();
> > +
> > +		/* get locking type from config tree */
> > +		/* FIXME: config option needed? */
> > +		locking_type = find_config_tree_int(cmd, "global/locking_type",
> > +						    1);
> I'm wondering if it would make sense to unify the code reading the default
> locking type and the code reading the fallback options and such. As things are,
> half of the configuration processing is done here and the other half inside
> init_locking called below (cf lib/locking/locking.c, init_locking).
> 

I did submit a patch I thought was a simple cleanup but more work is
needed to clean up locking.  Ideally I'd like to place init_locking
inside create_toolcontext and just make this the initialization
function.  I ran into a problem with clvmd though being a "locking
implementor" or "locking backend".  Alasdair spent some time with me
brainstorming how we might solve this - splitting the API into different
portions:
1. Calls ok for a locking back-end
2. Calls ok for a locking front-end
3. Calls ok for both

I have temporarily put this on the back-burner while I try to solve some
other things but should make another attempt at cleanup soon.


> > +
> > +void lvm_destroy(lvm_handle_t libh)
> > +{
> > +	destroy_toolcontext((struct cmd_context *)libh);
> > +	/* no error handling here */
> > +}
> > +
> > +
> > +int lvm_reload_config(lvm_handle_t libh)
> > +{
> > +	return refresh_toolcontext((struct cmd_context *)libh);
> > +}
> Should this also cater for locking re-initialisation? I suppose if
> configuration changed, so might have locking.
> 

Indeed - thanks.



      parent reply	other threads:[~2009-02-13 11:42 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 20:49 [PATCH 0/13] liblvm initialization, attribute, and object handling Dave Wysochanski
2009-02-02 20:49 ` [PATCH 01/13] Add system_dir to create_toolcontext() Dave Wysochanski
2009-02-02 20:49   ` [PATCH 02/13] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Dave Wysochanski
2009-02-02 20:49     ` [PATCH 03/13] Move vg_t, lv_t, and pv_t from metadata-exported.h into lvm2.h Dave Wysochanski
2009-02-02 20:50       ` [PATCH 04/13] Add lvm_pv_name, lvm_vg_name, and lvm_lv_name accessors Dave Wysochanski
2009-02-02 20:50         ` [PATCH 05/13] Add lvm_vg_open() Dave Wysochanski
2009-02-02 20:50           ` [PATCH 06/13] Add lvm_vg_close() Dave Wysochanski
2009-02-02 20:50             ` [PATCH 07/13] Add lvm_vg_get_attr_list() libLVM API to return a list of VG attribute names Dave Wysochanski
2009-02-02 20:50               ` [PATCH 08/13] Add lvm_vg_get_attr_value() libLVM API to query to value of a VG attribute Dave Wysochanski
2009-02-02 20:50                 ` [PATCH 09/13] Add lvm_lvs_in_vg() API Dave Wysochanski
2009-02-02 20:50                   ` [PATCH 10/13] Add lvm_pvs_in_vg() Dave Wysochanski
2009-02-02 20:50                     ` [PATCH 11/13] Add lvm_lv_get_attr_list() and lvm_lv_get_attr_value() Dave Wysochanski
2009-02-02 20:50                       ` [PATCH 12/13] First cut at adding pv_obj_* APIs Dave Wysochanski
2009-02-02 20:50                         ` [PATCH 13/13] Add test code Dave Wysochanski
2009-02-02 23:58                         ` [PATCH 12/13] First cut at adding pv_obj_* APIs Petr Rockai
2009-02-13 11:23                           ` Dave Wysochanski
2009-02-02 23:47                 ` [PATCH 08/13] Add lvm_vg_get_attr_value() libLVM API to query to value of a VG attribute Petr Rockai
2009-02-13 11:30                   ` Dave Wysochanski
2009-02-02 23:45             ` [PATCH 06/13] Add lvm_vg_close() Petr Rockai
2009-02-04 17:11               ` Dave Wysochanski
2009-02-04 20:27                 ` Dave Wysochanski
2009-02-02 23:28           ` [PATCH 05/13] Add lvm_vg_open() Petr Rockai
2009-02-04 15:01             ` Dave Wysochanski
2009-02-02 23:25       ` [PATCH 03/13] Move vg_t, lv_t, and pv_t from metadata-exported.h into lvm2.h Petr Rockai
2009-02-04 14:57         ` Dave Wysochanski
2009-02-02 23:22     ` [PATCH 02/13] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Petr Rockai
2009-02-03  0:44       ` [PATCH] Move locking_type reading inside init_locking() Dave Wysochanski
2009-02-03  1:12         ` [PATCH take2] Add lvm_create, lvm_destroy, lvm_reload_config() APIs Dave Wysochanski
2009-02-13 11:42       ` Dave Wysochanski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1234525326.2731.38.camel@f10-node1 \
    --to=dwysocha@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.