[kernel] Automatic re-read partition table after MBR modified#2367
Merged
[kernel] Automatic re-read partition table after MBR modified#2367
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the fdisk reboot and sys problems described in #2364 (comment).
Now, after running
fdiskthe system automatically rereads the partition table when using either the BIOSHD or ATA CF drivers. No reboot necessary.The partition table will be re-read the next time any process opens the device with the modified MBR. The revised partition table will at that point be (re)displayed on the console in the same format as the partition table boot screen display. For example, running fdisk again after writing the MBR will provoke this behavior, or accessing the newly created partition using
mkfsormkfat.Also fixes a major problem writing garbage data when using the ATA CF driver (to either hard disk or CF). This was bad code added approximately a week ago when I added XMS support. This is now fixed, and is likely the cause of @toncho11's second problem described in the link above where
sysafter fdisk/reboot didn't work: the MBR was being written incorrectly, as well as any other data written to a CF card or hard disk by the ATA CF driver.The partition reading code was moved out of INITPROC into far text to allow for re-reading the partition table; this added 2K to the kernel resident memory usage. The ATA CF driver was also added to the far text segment to make room in the normal text segment.
Also added was an automatic
syncafterfdiskwrites the MBR; it was previously possible that the MBR would not actually have been synced to disk if the system were rebooted immediately after fdisk without syncing. Neither sync nor reboot are necessary anymore.