[lxc-devel] [PATCH] API support for container snapshots
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Sep 6 19:13:23 UTC 2013
Quoting Stéphane Graber (stgraber at ubuntu.com):
> > +static struct lxc_container *lxcsnap_open(struct lxc_snapshot *s)
> > +{
> > + return NULL;
> > +}
>
> I guess that's because we may want to do some more stuff in there later
> right? ^
That's what I was originally thinking, but I'm thinking I'll just yank
this out.
> > +static void lxcsnap_free(struct lxc_snapshot *s)
> > +{
> > + if (s->name)
> > + free(s->name);
> > + if (s->comment_pathname)
> > + free(s->comment_pathname);
> > + if (s->timestamp)
> > + free(s->timestamp);
> > + if (s->lxcpath)
> > + free(s->lxcpath);
> > +}
> > +
> > +static char *get_snapcomment(char* snappath, char *name)
> > +{
> > + // $snappath/$name/comment
> > + int ret, len = strlen(snappath) + strlen(name) + 10;
> > + char *s = malloc(len);
> > +
> > + if (s) {
> > + ret = snprintf(s, len, "%s/%s/comment", snappath, name);
> > + if (ret < 0 || ret >= len) {
> > + free(s);
> > + s = NULL;
> > + }
> > + }
> > + return s;
>
> Wouldn't this be better called get_snapcomment_path? Based on the
> function name I was first surprised not to see any fopen/fread before I
> actually took a closer look an understand it's only returning th path.
Yeah, it would, will change that.
We could just put the whole comment in there, but I could see many-page
dissertations on the changes made to a particular snapshot. I've also
considered not having comments, because as I've said I don't want to
cross that line into being a version control for snapshots (that's
for docker). But I think a comment is too useful to not have it.
Thanks for taking a look.
-serge
More information about the lxc-devel
mailing list