rem: if (!partition) return B_ENTRY_NOT_FOUND; PartitionRegistrar registrar1(partition, true); PartitionRegistrar registrar2(partition->Device(), true); DeviceReadLocker locker(partition->Device(), true); if (!check_shadow_partition(partition, changeCounter)) return B_BAD_VALUE;  KDiskSystem *diskSystem = partition->DiskSystem(); if (!diskSystem) return B_ENTRY_NOT_FOUND;  if (diskSystem->GetNextSupportedType(partition, cookie, type)) return B_OK; return B_ERROR;
add: status_t error = partition ? B_OK : B_ENTRY_NOT_FOUND; if (!error) { PartitionRegistrar registrar1(partition, true); PartitionRegistrar registrar2(partition->Device(), true); DeviceReadLocker locker(partition->Device(), true); error = check_shadow_partition(partition, changeCounter) ? B_OK : B_BAD_VALUE; if (!error) {  KDiskSystem *diskSystem = partition->DiskSystem(); error = diskSystem ? B_OK : B_ENTRY_NOT_FOUND; if (!error) {  char type[B_OS_NAME_LENGTH]; error = diskSystem->GetNextSupportedType(partition, &cookie, type); if (!error) { error = user_strlcpy(_type, type, B_OS_NAME_LENGTH) < B_OS_NAME_LENGTH ? B_OK : B_NAME_TOO_LONG; } } } } if (!error) user_memcpy(_cookie, &cookie, sizeof(cookie)); return error;
context: _kern_get_next_supported_partition_type(partition_id partitionID,										int32 changeCounter, int32 *cookie,										char *type){	if (!cookie || !type)		return B_BAD_VALUE;	KDiskDeviceManager *manager = KDiskDeviceManager::Default();	// get the partition	KPartition *partition = manager->ReadLockPartition(partitionID);	if (!partition)		return B_ENTRY_NOT_FOUND;	PartitionRegistrar registrar1(partition, true);	PartitionRegistrar registrar2(partition->Device(), true);	DeviceReadLocker locker(partition->Device(), true);	if (!check_shadow_partition(partition, changeCounter))		return B_BAD_VALUE;	// get the disk system	KDiskSystem *diskSystem = partition->DiskSystem();	if (!diskSystem)		return B_ENTRY_NOT_FOUND;	// get the info	if (diskSystem->GetNextSupportedType(partition, cookie, type))		return B_OK;	return B_ERROR;}