void test_remove_attributes(BFile& file, int32 start, int32 count, int32 removeAt, int32 removeIndex1, int32 removeIndex2) { int fd = file.Dup(); if (fd < 0) return; int32 index = 0; bool seen[4096] = {0}; if (gVerbose) printf("test removeAt %ld\n", removeAt); DIR* dir = fs_fopen_attr_dir(fd); while (struct dirent* entry = fs_read_attr_dir(dir)) { if (gVerbose) printf(" %ld. %s\n", index, entry->d_name); if (index == removeAt) { if (removeIndex1 > 0) remove_marker_attribute(file, removeIndex1); if (removeIndex2 > 0) remove_marker_attribute(file, removeIndex2); } index++; if (is_marker(entry->d_name)) continue; int32 attributeIndex = attribute_index(entry->d_name); if (attributeIndex > 0) { if (seen[attributeIndex]) { printf("attribute index %ld already listed!\n", attributeIndex); exit(1); } else seen[attributeIndex] = true; } } fs_close_attr_dir(dir); close(fd); for (int32 i = start; i < start + count; i++) { if (!seen[i]) { printf("attribute index %ld not listed, saw only %ld/%ld!\n", i, index, count); exit(1); } } }