/* It will remove all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as  for WRQ. When it gets the last block number, it will call this function to set the last block number. */
VOID Mtftp4SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
/* It will remove all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as  for WRQ. When it gets the last block number, it will call this function to set the last block number. */
VOID Mtftp4SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
{
  MTFTP4_BLOCK_RANGE  *Range;
  while (!IsListEmpty (Head)) {
    Range = NET_LIST_TAIL (Head, MTFTP4_BLOCK_RANGE, Link);
    if (Range->Start > Last) {
      RemoveEntryList (&Range->Link);
      FreePool (Range);
      continue;
    }
    if (Range->End > Last) {
      Range->End = Last;
    }
    return;
  }
}