changed matchlist-API to pass additional information about a
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 1 Feb 2005 02:08:20 +0000 (02:08 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 1 Feb 2005 02:08:20 +0000 (02:08 +0000)
vserver. This allows to turn off pkgmgmt-queries for not-yet
existent vservers in 'vcopy'

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1840 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/lib_internal/matchlist-initbyvserver.c
util-vserver/lib_internal/matchlist-initmanually.c
util-vserver/lib_internal/matchlist-initrefserverlist.c
util-vserver/src/vcopy-init.hc
util-vserver/src/vunify-init.hc

index 13b2828..20c3d64 100644 (file)
 
 
 bool
-MatchList_initByVserver(struct MatchList *list, char const *vserver,
+MatchList_initByVserver(struct MatchList *list,
+                       struct MatchVserverInfo const *vserver,
                        char const **res_appdir)
 {
   vcCfgStyle   style;
   char const   *vdir;
   char const   *appdir;
 
-  style  = vc_getVserverCfgStyle(vserver);
-  vdir   = vc_getVserverVdir(  vserver, style, true);
-  appdir = vc_getVserverAppDir(vserver, style, "vunify");
+  style  = vc_getVserverCfgStyle(vserver->name);
+  vdir   = vc_getVserverVdir(  vserver->name, style, true);
+  appdir = vc_getVserverAppDir(vserver->name, style, "vunify");
 
   if (vdir==0 || appdir==0) {
     free((char *)appdir);
index 02aecd3..7ce0b8e 100644 (file)
@@ -146,7 +146,8 @@ getConfigfileList(char const *vserver,
 }
 
 void
-MatchList_initManually(struct MatchList *list, char const *vserver,
+MatchList_initManually(struct MatchList *list,
+                      struct MatchVserverInfo const *vserver,
                       char const *vdir, char const *exclude_file)
 {
   char                 *buf[2] = { 0,0 };
@@ -162,15 +163,15 @@ MatchList_initManually(struct MatchList *list, char const *vserver,
     WRITE_STR(1, vdir);
     if (vserver!=0) {
       WRITE_MSG(1, " (");
-      WRITE_STR(1, vserver);
+      WRITE_STR(1, vserver->name);
       WRITE_MSG(1, ")");
     }
     WRITE_MSG(1, "\n");
   }
-  if (vserver && Global_doRenew()) {
+  if (vserver && vserver->use_pkgmgmt && Global_doRenew()) {
     if (Global_getVerbosity()>=2)
       WRITE_MSG(1, "  Fetching configuration-file list from packagemanagement\n");
-    getConfigfileList(vserver, &fixed_files, &fixed_count, buf+0);
+    getConfigfileList(vserver->name, &fixed_files, &fixed_count, buf+0);
   }
 
   // abuse special values (NULL, empty string) to skip the next step
index f39a98b..ddf7509 100644 (file)
@@ -61,14 +61,15 @@ MatchList_initRefserverList(struct MatchList **lst, size_t *cnt,
   *lst = Emalloc(sizeof(struct MatchList) * count);
   *cnt = count;
   for (i=0; i<count; ++i) {
-    char const                 *tmp   = entries[i]->d_name;
-    size_t             l      = strlen(tmp);
-    char               vname[sizeof("./") + l];
+    char const                         *tmp   = entries[i]->d_name;
+    size_t                     l      = strlen(tmp);
+    char                       vname[sizeof("./") + l];
+    struct MatchVserverInfo    vserver = { vname, true };
 
     memcpy(vname,   "./", 2);
     memcpy(vname+2, tmp,  l+1);
     
-    if (!MatchList_initByVserver((*lst)+i, vname, 0)) {
+    if (!MatchList_initByVserver((*lst)+i, &vserver, 0)) {
       WRITE_MSG(2, "unification for reference vserver not configured\n");
       exit(1);
     }
index ace737e..6feaecf 100644 (file)
@@ -68,22 +68,25 @@ initModeManually(int argc, char *argv[])
 static void
 initModeVserver(int argc, char *argv[])
 {
-  int          count=argc;
+  int                                  count       = argc;
+  struct MatchVserverInfo const                src_vserver = { argv[1], true  };
+  struct MatchVserverInfo const                dst_vserver = { argv[0], false };
+  
 
   if (count!=2) {
     WRITE_MSG(2, "Bad arguments; try '--help' for more information\n");
     exit(1);
   }
 
-  if (!MatchList_initByVserver(&global_info.src_list, argv[1], 0)) {
+  if (!MatchList_initByVserver(&global_info.src_list, &src_vserver, 0)) {
     WRITE_MSG(2, "unification not configured for source vserver\n");
     exit(1);
   }
 
   if (!global_args->is_strict)
-    createSkeleton(argv[0]);
+    createSkeleton(dst_vserver.name);
 
-  if (!MatchList_initByVserver(&global_info.dst_list, argv[0], 0)) {
+  if (!MatchList_initByVserver(&global_info.dst_list, &dst_vserver, 0)) {
     WRITE_MSG(2, "unification not configured for destination vserver\n");
     exit(1);
   }
index f661241..fd20662 100644 (file)
@@ -47,14 +47,15 @@ initModeManually(struct Arguments const UNUSED *args, int argc, char *argv[])
 static void
 initModeVserver(struct Arguments const UNUSED *args, int argc, char *argv[])
 {
-  char const   *appdir;
+  char const                           *appdir;
+  struct MatchVserverInfo const                dst_vserver = { argv[0], true };
   
   if (argc!=1) {
     WRITE_MSG(2, "More than one vserver is not supported\n");
     exit(1);
   }
 
-  if (!MatchList_initByVserver(&global_info.dst_list, argv[0], &appdir)) {
+  if (!MatchList_initByVserver(&global_info.dst_list, &dst_vserver, &appdir)) {
     WRITE_MSG(2, "unification not configured for this vserver\n");
     exit(1);
   }