[alsa-devel] [PATCH v2 3/3] topology: A API calls to directly build topology data from templates
Liam Girdwood
liam.r.girdwood at linux.intel.com
Tue Aug 11 14:36:22 CEST 2015
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
More information about the Alsa-devel
mailing list