The routine diskpart_lookup_bsd_compat is an example of how the old partition naming can be used even with the new nested structure. This takes two integers representing the slice and partition. The behavior is intended to be similar to diskpart_lookup_bsd_string (below), using integers as parameters.
While this `hack' allows two levels of nesting (slice and partition), it is not general enough to support arbitrary nesting. Arbitrary nesting support is most easily achieved by passing string names to a lookup function which can follow the structure down the partition specifications. For example, `sd0eab' would be used to specify the second partition in the first partition inside the fifth top-level partition on the first SCSI disk. Since the lookup routine doesn't need to know about the disk, `eab' would be the partition name passed to the lookup routine. This naming scheme would work well as long as there are not more than 26 partitions at any nesting layer.
diskpart_lookup_bsd_string does a string lookup using the FreeBSD style slice names. FreeBSD considers the DOS partitioning to be slices. A slice can contain a BSD disklabel, and if it does, then partitions can be inside the slice. If the third DOS partition contains a disklabel, then `s3a' would be partition `a' inside the disklabel. The slice name without a partition would mean the entire slice. Note also that `a' would alias to partition `a' in the first BSD slice. If there is no BSD slice, then `a' would be aliased to `s1' instead. However, to avoid confusion, if slice-naming is used, aliases should only be used to point inside a BSD slice.