[lxc-devel] [PATCH 0/2 v3] Update absolute paths for overlay and aufs mounts
Christian Brauner
christianvanbrauner at gmail.com
Sun Nov 1 19:11:31 UTC 2015
Serge, I prefer you to add your Acked-by line for both commits yourself and not
just one as we discussed a few days ago because Instead of just inserting a
comment I also did change the functions names for more consistency. Might be you
disagree with this.
Changes v3:
(1) Better names for functions: update_union_mount_entry_paths() becomes
update_ovl_paths() and clone_update_unexp_ovl_dir() becomes
clone_update_unexp_ovl_paths().
(2) Use the stricter check
if (p >= lend)
continue;
in clone_update_unexp_ovl_paths().
(3) Insert comment into update_ovl_paths() that lxc_conf->unexpanded_config
needs to be updated separately from lxc_conf->mount_list.
Changes v2:
(1) Fix calculations in update_unexp_ovl_dir(). (The function was modelled after
update_unexp_hooks() and I'm pretty sure that things are wrong there too and
need a thorough check but I'm in the Alps for the weekend so this will have
to wait...)
Most noticeably the calculation when olddirlen >= newdirlen becomes:
memmove(q + newdirlen, q + newdirlen + diff,
strlen(q) - newdirlen - diff + 1);
and int the else-branch it becomes:
memmove(new + poffset + newdirlen,
new + poffset + olddirlen,
oldlen - poffset - olddirlen + 1);
The call to realloc() becomes:
new = realloc(conf->unexpanded_config, newlen + 1);
and we *need* to set:
conf->unexpanded_alloced = newlen + 1;
Changes:
(1) Make updating lxc_conf->mnt_list and lxc_conf->unexpanded_config independent
of each other so that users can include overlay mounts from other files.
(2) Update lxc_conf->unexpanded_config by using a separate function
clone_update_unexp_ovl_dir() in confile.c.
(3) Move various temporary variables inside the lxc_list_for_each(iterator,
&lxc_conf->mount_list) {*/ do stuff */} per Serge's request.
(4) Use uniform exit strategy when the function fails or succeeds.
Christian Brauner (2):
Add clone_update_unexp_ovl_paths() function
Update absolute paths for overlay and aufs mounts
src/lxc/confile.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++
src/lxc/confile.h | 3 ++
src/lxc/lxccontainer.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 203 insertions(+)
--
2.6.2
More information about the lxc-devel
mailing list