ready for tagging
[util-vserver.git] / lib / issupported.c
1 // $Id: issupported.c 2589 2007-08-16 03:06:50Z dhozac $    --*- c -*--
2
3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 //  
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
8 //  
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //  
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19 #ifdef HAVE_CONFIG_H
20 #  include <config.h>
21 #endif
22
23 #include "vserver.h"
24 #include "assert.h"
25
26 bool
27 vc_isSupported(vcFeatureSet feature)
28 {
29   int           ver = vc_get_version();
30   vc_vci_t      conf = vc_get_vci();
31   if (ver==-1) return false;
32   if (conf==(vc_vci_t)-1) conf = 0;
33
34   switch (feature) {
35     case vcFEATURE_COMPAT       :  return true;
36     case vcFEATURE_VSHELPER0    :  return ver >= 0x00010000 && ver < 0x00010010;
37     case vcFEATURE_VSHELPER     :  return ver >= 0x00010000;
38     case vcFEATURE_VKILL        :  return ver >= 0x00010004;
39     case vcFEATURE_RLIMIT       :  return ver >= 0x00010004;
40     case vcFEATURE_VINFO        :  return ver >= 0x00010010;
41     case vcFEATURE_VHI          :  return ver >= 0x00010010;
42     case vcFEATURE_IATTR        :  return ver >= 0x00010011;
43     case vcFEATURE_MIGRATE      :  return ver >= 0x00010012;
44     case vcFEATURE_NAMESPACE    :  return ver >= 0x00010012;
45     case vcFEATURE_VWAIT        :  return ver >= 0x00010025;
46     case vcFEATURE_SCHED        :  return ver >= 0x00020000;  // todo
47     case vcFEATURE_VNET         :  return ver >= 0x00020001;
48     case vcFEATURE_VSTAT        :  return ver >= 0x00020103;
49     case vcFEATURE_PPTAG        :  return conf & VC_VCI_PPTAG;
50     default                     :  assert(false); 
51   }
52
53   return false;
54 }