static void get_partition(const char *key, const char *val, void *rock)
{
    struct part_rock *prock = (struct part_rock *) rock;

    if (*prock->partition) return;

    if (prock->is_meta) {
        if (strncmp("meta", key, 4)) return;
        key += 4;
    }
    if (strncmp("partition-", key, 10)) return;

    size_t vlen = strlen(val);
    if (!strncmp(prock->path, val, vlen) &&
        (val[vlen-1] == '/' || prock->path[vlen] == '/')) {
        *prock->partition = xstrdup(key+10);
    }
}
static void get_partition(const char *key, const char *val, void *rock)
{
    struct part_rock *prock = (struct part_rock *) rock;

    if (*prock->partition) return;

    if (prock->is_meta) {
        if (strncmp("meta", key, 4)) return;
        key += 4;
    }
    if (strncmp("partition-", key, 10)) return;

    size_t vlen = strlen(val);
    if (!strncmp(prock->path, val, vlen) &&
        (val[vlen-1] == '/' || prock->path[vlen] == '/')) {
        *prock->partition = xstrdup(key+10);
    }
}