X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Finternal.h;h=3a8786de67d6cdeac1bc10787e003d1327092c85;hb=38fe8b4a2dd28aebf52787c5b65cc79490fa53d3;hp=f7c8e7643ae17ddc5bfbaf818ce99b03563c9e1d;hpb=a10f15f15ac3c657f960b3a67e05dffc422f0c71;p=util-vserver.git diff --git a/util-vserver/lib/internal.h b/util-vserver/lib/internal.h index f7c8e76..3a8786d 100644 --- a/util-vserver/lib/internal.h +++ b/util-vserver/lib/internal.h @@ -15,14 +15,68 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +/** \file internal.h + * \brief Declarations which are used by util-vserver internally. + */ #ifndef H_UTIL_VSERVER_LIB_INTERNAL_H #define H_UTIL_VSERVER_LIB_INTERNAL_H +#include "fmt.h" #include +#include -size_t -utilvserver_uint2str(char *buf, size_t len, unsigned int val, unsigned char base); +#ifdef __cplusplus +extern "C" { +#endif + +int utilvserver_checkCompatVersion(); +bool utilvserver_isDirectory(char const *path, bool follow_link); + +int utilvserver_listparser_uint32(char const *str, size_t len, + char const **err_ptr, size_t *err_len, + uint_least32_t *flag, + uint_least32_t *mask, + uint_least32_t (*func)(char const*, + size_t)) NONNULL((1,5,6,7)); + +int utilvserver_listparser_uint64(char const *str, size_t len, + char const **err_ptr, size_t *err_len, + uint_least64_t *flag, + uint_least64_t *mask, + uint_least64_t (*func)(char const*, + size_t)) NONNULL((1,5,6,7)); + +struct Mapping_uint32 { + char const * const id; + size_t len; + uint_least32_t val; +}; + +struct Mapping_uint64 { + char const * const id; + size_t len; + uint_least64_t val; +}; + +ssize_t utilvserver_value2text_uint32(char const *str, size_t len, + struct Mapping_uint32 const *map, + size_t map_len) NONNULL((1,3)); + +ssize_t utilvserver_value2text_uint64(char const *str, size_t len, + struct Mapping_uint64 const *map, + size_t map_len) NONNULL((1,3)); + +ssize_t utilvserver_text2value_uint32(uint_least32_t *val, + struct Mapping_uint32 const *map, + size_t map_len) NONNULL((1,2)); + +ssize_t utilvserver_text2value_uint64(uint_least64_t *val, + struct Mapping_uint64 const *map, + size_t map_len) NONNULL((1,2)); +#ifdef __cplusplus +} +#endif #endif // H_UTIL_VSERVER_LIB_INTERNAL_H