On 03/22/2013 03:48 AM, Glauber Costa wrote:
We need to pass more information to fs_create. Instead of adding arguments, it
is preferred to pass the whole vps_p structure and unfold it inside the callee.

Signed-off-by: Glauber Costa <[email protected]>
---
  src/lib/create.c | 13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/lib/create.c b/src/lib/create.c
index 39e5555..0a0330f 100644
--- a/src/lib/create.c
+++ b/src/lib/create.c
@@ -90,8 +90,8 @@ static int download_template(char *tmpl)
        return run_script(VPS_DOWNLOAD, arg, env, 0);
  }
-static int fs_create(envid_t veid, fs_param *fs, tmpl_param *tmpl,
-       dq_param *dq, int layout, int ploop_mode)
+static int fs_create(envid_t veid, vps_handler *h, fs_param *fs,
+                       tmpl_param *tmpl, vps_param *vps_p)

fs_param *fs and tmpl_param *tmpl should go as well.



  {
        char tarball[PATH_LEN];
        char tmp_dir[PATH_LEN];
@@ -104,6 +104,10 @@ static int fs_create(envid_t veid, fs_param *fs, 
tmpl_param *tmpl,
        char *dst;
        const char *ext[] = { "", ".gz", ".bz2", ".xz", NULL };
        const char *errmsg_ext = "[.gz|.bz2|.xz]";
+       dq_param *dq = &vps_p->res.dq;
+       int layout = vps_p->opt.layout;
+       unsigned int uid_offset = vps_p->res.misc.local_uid;
+       unsigned int gid_offset = vps_p->res.misc.local_gid;
        int ploop = (layout == VE_LAYOUT_PLOOP);
if (ploop && (!dq->diskspace || dq->diskspace[1] <= 0)) {
@@ -153,6 +157,7 @@ find:
                /* Create and mount ploop image */
                struct vzctl_create_image_param param = {};
                struct vzctl_mount_param mount_param = {};
+               int ploop_mode = vps_p->opt.mode;
if (ploop_mode < 0)
                        ploop_mode = PLOOP_EXPANDED_MODE;
@@ -360,9 +365,7 @@ int vps_create(vps_handler *h, envid_t veid, vps_param 
*vps_p, vps_param *cmd_p,
                                tmpl->ostmpl = full_ostmpl;
                        }
                }
-               if ((ret = fs_create(veid, fs, tmpl, &vps_p->res.dq,
-                                               vps_p->opt.layout,
-                                               vps_p->opt.mode)))
+               if ((ret = fs_create(veid, h, fs, tmpl, vps_p)))
                        goto err_root;
        }

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to