char *xenstore_gets(const char *fmt, ...)
{
    char *s;
    va_list ap;

    va_start(ap, fmt);
    s = xenstore_getsv(fmt, ap);
    va_end(ap);
    return s;
}
Example #2
0
static char *
xenstore_gets(int domid, const char *fmt, ...)
{
    char *s;
    va_list ap;

    va_start(ap, fmt);
    s = xenstore_getsv(domid, fmt, ap);
    va_end(ap);
    return s;
}
Example #3
0
static uint64_t
xenstore_get(int domid, const char *fmt, ...)
{
    char *s;
    uint64_t value = 0;
    va_list ap;

    va_start(ap, fmt);
    s = xenstore_getsv(domid, fmt, ap);
    if (s) {
        if (!strcasecmp(s, "true"))
            value = 1;
        else if (sscanf(s, "%Ld", &value) != 1)
            value = 0;
        free(s);
    }
    va_end(ap);
    return value;
}
uint64_t xenstore_get(const char *fmt, ...)
{
    char *s;
    uint64_t value = 0;
    va_list ap;

    va_start(ap, fmt);
    s = xenstore_getsv(fmt, ap);
    if (s) {
        if (!strcasecmp(s, "true"))
            value = 1;
        else
        {
            errno = 0;
            value = strtoull(s, NULL, 0);
            if ( errno )
                value = 0;
        }
        free(s);
    }
    va_end(ap);
    return value;
}