All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Mengdong Lin <mengdong.lin@intel.com>,
	alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v2 3/3] topology: A API calls to directly build	topology data from templates
Date: Tue, 11 Aug 2015 13:36:22 +0100	[thread overview]
Message-ID: <1439296582.2427.53.camel@loki> (raw)
In-Reply-To: <s5htws62r6d.wl-tiwai@suse.de>

On Tue, 2015-08-11 at 09:57 +0200, Takashi Iwai wrote:
> On Mon, 10 Aug 2015 20:13:49 +0200,
> Liam Girdwood wrote:

> 
> > +int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
> > +{
> > +	int err;
> > +
> > +	/* delete any old output files */
> > +	unlink(outfile);
> > +
> > +	tplg->out_fd =
> > +		open(outfile, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
> > +	if (tplg->out_fd < 0) {
> > +		SNDERR("error: failed to open %s err %d\n",
> > +			outfile, -errno);
> > +		return -errno;
> > +	}
> > +
> > +	err = tplg_build_integ(tplg);
> > +	if (err < 0) {
> > +		SNDERR("error: failed to check topology integrity\n");
> > +		goto out;
> > +	}
> > +
> > +	err = tplg_write_data(tplg);
> > +	if (err < 0) {
> > +		SNDERR("error: failed to write data %d\n", err);
> > +		goto out;
> > +	}
> > +
> > +out:
> > +	close(tplg->out_fd);
> 
> It's a question whether we should unlink automatically at error or
> not.  If we leave the file as is, it should be documented.
> 

The unlink is not really needed so I'll remove it. The file permissions
should be 0600 too, so I'll fix that as well.

Liam

  parent reply	other threads:[~2015-08-11 12:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 18:13 [PATCH v2 0/3] topology: Add external API for building topology data Liam Girdwood
2015-08-10 18:13 ` [PATCH v2 1/3] topology: rename OBJECT_TYPE_ to SND_TPLG_TYPE_ Liam Girdwood
2015-08-10 18:13 ` [PATCH v2 2/3] topology: Add C templates structure for building topology from C programs Liam Girdwood
2015-08-10 18:13 ` [PATCH v2 3/3] topology: A API calls to directly build topology data from templates Liam Girdwood
2015-08-11  7:57   ` Takashi Iwai
2015-08-11  8:04     ` Liam Girdwood
2015-08-11  8:18       ` Takashi Iwai
2015-08-11 12:36     ` Liam Girdwood [this message]
2015-08-11 15:37     ` Lin, Mengdong
2015-08-11 15:55       ` Takashi Iwai

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=1439296582.2427.53.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=mengdong.lin@intel.com \
    --cc=tiwai@suse.de \
    /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.