All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@redhat.com
Subject: Re: [dm-devel] [PATCH 3/9] libmultipath: variable-size parameters in assemble_map()
Date: Wed, 11 Aug 2021 17:15:53 +0200	[thread overview]
Message-ID: <dfed5aadec9c3656c50620b0c0e405c7c4497fa4.camel@suse.com> (raw)
In-Reply-To: <20210728155420.GK3087@octiron.msp.redhat.com>

On Mi, 2021-07-28 at 10:54 -0500, Benjamin Marzinski wrote:
> On Thu, Jul 15, 2021 at 12:52:17PM +0200, mwilck@suse.com wrote:
> > From: Martin Wilck <mwilck@suse.com>
> > 
> > Instead of using fixed PARAMS_SIZE-sized arrays for parameters, use
> > dynamically allocated memory.
> > 
> > The library version needs to be bumped, because setup_map()
> > argument
> > list has changed.
> > 
> 
> Looks good. Only minor nits below.
> 
> > -
> >  /*
> >   * Transforms the path group vector into a proper device map
> > string
> >   */
> > -int
> > -assemble_map (struct multipath * mp, char * params, int len)
> > +int assemble_map(struct multipath *mp, char **params)
> >  {
> > +       static const char no_path_retry[] = "queue_if_no_path";
> > +       static const char retain_hwhandler[] =
> > "retain_attached_hw_handler";
> >         int i, j;
> >         int minio;
> >         int nr_priority_groups, initial_pg_nr;
> > -       char * p;
> > -       const char *const end = params + len;
> > -       char no_path_retry[] = "queue_if_no_path";
> > -       char retain_hwhandler[] = "retain_attached_hw_handler";
> 
> Why not use STRBUF_ON_STACK() here?

Good catch. I probably wrote this before I wrote the macro.

> 
> > +       struct strbuf __attribute__((cleanup(reset_strbuf))) buff =
> > STRBUF_INIT;
> >         struct pathgroup * pgp;
> >         struct path * pp;
> >  


> > @@ -1028,7 +1030,7 @@ int
> >  ev_add_path (struct path * pp, struct vectors * vecs, int
> > need_do_map)
> >  {
> >         struct multipath * mpp;
> > -       char params[PARAMS_SIZE] = {0};
> > +       char *params __attribute((cleanup(cleanup_charp))) = NULL;
> >         int retries = 3;
> >         int start_waiter = 0;
> >         int ret;
> > @@ -1104,7 +1106,9 @@ rescan:
> >         /*
> >          * push the map to the device-mapper
> >          */
> > -       if (setup_map(mpp, params, PARAMS_SIZE, vecs)) {
> 
> Is there a reason to free params here, instead of just doing it
> before
> the "goto rescan"?

No strong reason. I thought it was more obvious this way, and perhaps
less prone to future error. I will change it.

Martin




--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-08-11 15:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 10:52 [dm-devel] [PATCH 0/9] multipath-tools: use variable-size string buffers mwilck
2021-07-15 10:52 ` [dm-devel] [PATCH 1/9] libmultipath: variable-size parameters in dm_get_map() mwilck
2021-07-26 22:17   ` Benjamin Marzinski
2021-08-11 14:18     ` Martin Wilck
2021-07-15 10:52 ` [dm-devel] [PATCH 2/9] libmultipath: strbuf: simple api for growing string buffers mwilck
2021-07-27  4:54   ` Benjamin Marzinski
2021-08-11 15:03     ` Martin Wilck
2021-07-15 10:52 ` [dm-devel] [PATCH 3/9] libmultipath: variable-size parameters in assemble_map() mwilck
2021-07-28 15:54   ` Benjamin Marzinski
2021-08-11 15:15     ` Martin Wilck [this message]
2021-07-15 10:52 ` [dm-devel] [PATCH 4/9] libmultipath: use strbuf in dict.c mwilck
2021-07-28 19:03   ` Benjamin Marzinski
2021-08-11 15:27     ` Martin Wilck
2021-08-30 18:23       ` Benjamin Marzinski
2021-07-15 10:52 ` [dm-devel] [PATCH 5/9] libmultipath: use strbuf in print.c mwilck
2021-07-29  0:00   ` Benjamin Marzinski
2021-07-15 10:52 ` [dm-devel] [PATCH 6/9] libmultipath: print.c: fail hard if keywords are not found mwilck
2021-07-29  2:36   ` Benjamin Marzinski
2021-07-15 10:52 ` [dm-devel] [PATCH 7/9] libmultipath: print.h: move macros to print.c mwilck
2021-07-29  2:36   ` Benjamin Marzinski
2021-07-15 10:52 ` [dm-devel] [PATCH 8/9] libmultipath: use strbuf in alias.c mwilck
2021-07-29 15:22   ` Benjamin Marzinski
2021-07-15 10:52 ` [dm-devel] [PATCH 9/9] multipathd: use strbuf in cli.c mwilck
2021-07-29 15:46   ` Benjamin Marzinski

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=dfed5aadec9c3656c50620b0c0e405c7c4497fa4.camel@suse.com \
    --to=mwilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-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.