file: Move the data rearrangement function into file.{c|h}.