[Devel] [PATCH v2 2/8] adjust fs_create parameter

Dmitry Guryanov dguryanov at parallels.com
Mon Apr 1 07:58:25 PDT 2013


On 130322 14:48:16, 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.
> 

Can't apply this patch :(

[root at localhost vzctl]# git am ~/2.patch 
Applying: adjust fs_create parameter
error: patch failed: src/lib/create.c:90
error: src/lib/create.c: patch does not apply
Patch failed at 0001 adjust fs_create parameter
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".


I've cloned git from git://git.openvz.org/pub/vzctl, latest commit is

commit 0f78f1bcd841373c4592da2f961943c236082a21
Author: Kir Kolyshkin <kir at openvz.org>
Date:   Wed Mar 13 21:45:04 2013 -0700

    vzctl console: recognize ESC as a first character
    
    After commit 88f582e, ESC is only recognized after Enter. While this is
    a good thing in general, one possible scenario is a user runs vzctl
....

> Signed-off-by: Glauber Costa <glommer at parallels.com>
> ---
>  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)
>  {
>  	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;
>  	}
>  
> -- 
> 1.7.11.7
> 
> _______________________________________________
> Devel mailing list
> Devel at openvz.org
> https://lists.openvz.org/mailman/listinfo/devel

-- 
Dmitry Guryanov



More information about the Devel mailing list