I have a scenario that is not answered by other questions about getting the parent device from the partition device.
Imagine that udev is being used to populate /dev instead of the kernel, and that some wacky rules are dictating how these files are populated. The literal path for a partition block device is /dev/partition while the path for its parent is the literal /dev/parent. All the other questions rely on symlinks in /sys to get the parent block device of a partition block device, but the pathnames in /sys are NOT guaranteed to match the names of the corresponding device nodes in /dev. So, the question is: programmatically, how can one get /dev/parent from /dev/partition?
devtmpfs(which is the kernel directly populating /dev) or just a directory with statically made device nodes (the way it was before udev, where the kernel had no way of actually populating the /dev directory itself.