X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fgetvserverbyctx.c;h=8ceda6f67972fbc3e0d45407682ebc26390fa140;hb=34708129e616039d99cee99a9bae3fb1e200ddb2;hp=6205e50ad110c0c1d5f2421c8db2f2bc477fea1a;hpb=d0ae91f088249a5c126ad170b82a8fc6e669b95f;p=util-vserver.git diff --git a/util-vserver/lib/getvserverbyctx.c b/util-vserver/lib/getvserverbyctx.c index 6205e50..8ceda6f 100644 --- a/util-vserver/lib/getvserverbyctx.c +++ b/util-vserver/lib/getvserverbyctx.c @@ -28,40 +28,14 @@ #include #include +#include "getvserverbyctx-compat.hc" +#include "getvserverbyctx-v13.hc" + char * -vc_getVserverByCtx(ctx_t ctx, vcCfgStyle *style, char const *revdir) +vc_getVserverByCtx(xid_t ctx, vcCfgStyle *style, char const *revdir) { - if (revdir==0) revdir = DEFAULT_PKGSTATEREVDIR; - - BS; - vcCfgStyle cur_style = vcCFG_NONE; - size_t l = strlen(revdir); - size_t l1; - char path[l + sizeof(unsigned int)*3 + 2 + sizeof("/name")]; - - strcpy(path, revdir); - path[l] = '/'; - l1 = utilvserver_fmt_uint(path+l+1, ctx); - path[l+1+l1] = '\0'; - - if (style==0 || *style==vcCFG_AUTO) { - if (access(path, F_OK)==0) cur_style = vcCFG_RECENT_FULL; - // TODO: handle legacy - } + if (vc_isSupported(vcFEATURE_MIGRATE)) + return vc_getVserverByCtx_v13(ctx, style, revdir); else - cur_style = *style; - - switch (cur_style) { - case vcCFG_RECENT_SHORT : - case vcCFG_RECENT_FULL : - // check if expected ctx == actual ctx - if (vc_getVserverCtx(path, vcCFG_RECENT_FULL)!=ctx) return 0; - - if (style) *style = vcCFG_RECENT_FULL; - return strdup(path); - // TODO: handle legacy - default : - return 0; - } - BE; + return vc_getVserverByCtx_compat(ctx, style, revdir); }