/* Return logical sector number of either Short or Long Allocation Descriptor. */
EFI_STATUS GetAllocationDescriptorLsn(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN VOID *Ad, OUT UINT64 *Lsn)
/* Return logical sector number of either Short or Long Allocation Descriptor. */
EFI_STATUS GetAllocationDescriptorLsn(IN UDF_FE_RECORDING_FLAGS RecordingFlags, IN UDF_VOLUME_INFO *Volume, IN UDF_LONG_ALLOCATION_DESCRIPTOR *ParentIcb, IN VOID *Ad, OUT UINT64 *Lsn)
{
  UDF_PARTITION_DESCRIPTOR  *PartitionDesc;
  if (RecordingFlags == LongAdsSequence) {
    return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad, Lsn);
  } else if (RecordingFlags == ShortAdsSequence) {
    PartitionDesc = GetPdFromLongAd (Volume, ParentIcb);
    if (PartitionDesc == NULL) {
      return EFI_UNSUPPORTED;
    }
    *Lsn = GetShortAdLsn (
             Volume,
             PartitionDesc,
             (UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
             );
    return EFI_SUCCESS;
  }
  ASSERT (FALSE);
  return EFI_UNSUPPORTED;
}