util-vserver (libvserver) 0.30.216-pre2955

internal.h

Go to the documentation of this file.
00001 // $Id$    --*- c++ -*--
00002 
00003 // Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
00004 //  
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; version 2 of the License.
00008 //  
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //  
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 
00022 #ifndef H_UTIL_VSERVER_LIB_INTERNAL_H
00023 #define H_UTIL_VSERVER_LIB_INTERNAL_H
00024 
00025 #include "fmt.h"
00026 #include "vserver.h"
00027 
00028 #include <stdlib.h>
00029 #include <stdbool.h>
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 
00036 #ifdef HAVE_VERSIONING
00037 /* FIXME: HAVE_ASM_DOT_GLOBAL_NAME */
00038 #  define _symbol_version(real, name, version) \
00039      __asm__ (".symver " #real "," #name "@" #version)
00040 #  define _default_symbol_version(real, name, version) \
00041      __asm__ (".symver " #real "," #name "@@" #version)
00042 #else
00043 #  define _symbol_version(real, name, version)
00044 #  define _default_symbol_version(real, name, version) \
00045   extern __typeof (real) name __attribute__ ((alias (#name)));
00046 #endif
00047 #define symbol_version(real, name, version) \
00048         _symbol_version(real, name, version)
00049 #define default_symbol_version(real, name, version) \
00050         _default_symbol_version(real, name, version)
00051 
00052 
00053 char *  vc_getVserverByCtx_Internal(xid_t ctx, /*@null@*/vcCfgStyle *style,
00054                                     /*@null@*/char const *revdir,
00055                                     bool validate_result);
00056 
00057   
00058 int     utilvserver_checkCompatVersion();
00059 uint_least32_t  utilvserver_checkCompatConfig();
00060 bool    utilvserver_isDirectory(char const *path, bool follow_link);
00061 bool    utilvserver_isFile(char const *path, bool follow_link);
00062 bool    utilvserver_isLink(char const *path);
00063 
00064 int     utilvserver_listparser_uint32(char const *str, size_t len,
00065                                       char const **err_ptr, size_t *err_len,
00066                                       uint_least32_t *flag,
00067                                       uint_least32_t *mask,
00068                                       uint_least32_t (*func)(char const*,
00069                                                              size_t, bool *
00070                                         )) NONNULL((1,5,7));
00071   
00072 int     utilvserver_listparser_uint64(char const *str, size_t len,
00073                                       char const **err_ptr, size_t *err_len,
00074                                       uint_least64_t *flag,
00075                                       uint_least64_t *mask,
00076                                       uint_least64_t (*func)(char const*,
00077                                                              size_t, bool *
00078                                         )) NONNULL((1,5,7));
00079 
00080 struct Mapping_uint32 {
00081     char const * const  id;
00082     size_t                      len;
00083     uint_least32_t              val;
00084 };
00085 
00086 struct Mapping_uint64 {
00087     char const * const  id;
00088     size_t                      len;
00089     uint_least64_t              val;
00090 };
00091   
00092 ssize_t utilvserver_value2text_uint32(char const *str, size_t len,
00093                                       struct Mapping_uint32 const *map,
00094                                       size_t map_len) NONNULL((1,3));
00095 
00096 ssize_t utilvserver_value2text_uint64(char const *str, size_t len,
00097                                       struct Mapping_uint64 const *map,
00098                                       size_t map_len) NONNULL((1,3));
00099 
00100 ssize_t utilvserver_text2value_uint32(uint_least32_t *val,
00101                                       struct Mapping_uint32 const *map,
00102                                       size_t map_len) NONNULL((1,2));
00103   
00104 ssize_t utilvserver_text2value_uint64(uint_least64_t *val,
00105                                       struct Mapping_uint64 const *map,
00106                                       size_t map_len) NONNULL((1,2));
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 
00112 #endif  //  H_UTIL_VSERVER_LIB_INTERNAL_H