is_case_sensitive(DIR *dirp)
{
    u_int32_t attrbuf[SIZEUP32(vol_capabilities_attr_t) + 1];
    struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, 0, ATTR_VOL_INFO|ATTR_VOL_CAPABILITIES};
    const vol_capabilities_attr_t *cap = (void *)(attrbuf+1);
    const int idx = VOL_CAPABILITIES_FORMAT;
    const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
    struct statfs sf;

    if (fstatfs(dirfd(dirp), &sf)) return -1;
    if (getattrlist(sf.f_mntonname, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
	return -1;
    if (!(cap->valid[idx] & mask))
	return -1;
    return (cap->capabilities[idx] & mask) != 0;
}
is_case_sensitive(DIR *dirp)
{
    u_int32_t attrbuf[SIZEUP32(vol_capabilities_attr_t) + 1];
    struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, 0, ATTR_VOL_INFO|ATTR_VOL_CAPABILITIES};
    const vol_capabilities_attr_t *cap = (void *)(attrbuf+1);
    const int idx = VOL_CAPABILITIES_FORMAT;
    const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
    struct statfs sf;

    if (fstatfs(dirfd(dirp), &sf)) return -1;
    if (getattrlist(sf.f_mntonname, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
	return -1;
    if (!(cap->valid[idx] & mask))
	return -1;
    return (cap->capabilities[idx] & mask) != 0;
}