[lxc-devel] [PATCH 0/2 v2] Update absolute paths for overlay and aufs mounts

Christian Brauner christianvanbrauner at gmail.com
Fri Oct 30 09:19:37 UTC 2015


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_dir() function
  Update absolute paths for overlay and aufs mounts

 src/lxc/confile.c      | 103 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/lxc/confile.h      |   3 ++
 src/lxc/lxccontainer.c |  97 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 203 insertions(+)

-- 
2.6.2



More information about the lxc-devel mailing list