-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement different DLA methods #86
Comments
implemented by 1c9271f |
For increased compatibility you could use the method described in DOS Internals book. I.e. the drivparam/driver.sys interface, INT 2F/08xx - GET DRIVE DATA TABLE LIST *1 based on snippet from DOS Internals DRVINFO tool:
[*1] the FreeDOS kernel doesn't currently implement this, so I'd need to actually finish my work on it and publish it. |
For fdisk, you may need the reverse function, pass in BIOS# and return DOS drive# (ie swap compare and return ddt_driveno/ddt_logdriveno). |
@PerditionC I could use this to make sure the user deletes the correct drive. But I cannot use this to detect die DLA method if the user starts with an empty partition table. Is there any benefit of using INT2F instead simply peeking at the LoL for getting a pointer to the first ddt? |
There is also the problem that drive letters change with the first modification and are "out of sync" with the letters known to the OS. |
|
at least FreeDOS kernel doesn't, it's pointed to by dyn variable |
You are right, I confused the DDT / UDSC structure with the DPB / DDSC structure. I need the DDT to get the partition offset. |
makes sense, I was thinking of a good interface the kernel could expose current drive letter assignment and realized it already existed, so wanted to mention it. |
Some time ago I think Jerome asked me if partition activation based on drive letter could be implemented. This INT2Fh,08 would be quite useful for it. Also it would be very useful if kernel config like DLA method could be queried by applications. |
relates to #81 |
I am in the process of changing FDISK to make use of volume labels instead the volume id found in the BPB, because this is what Microsoft FDISK does. This depends on FDISK and DOS agreeing on the drive letters to query the right drive for the file with the volume attribute set. I came up with the following algorithm:
This does not catch all possible cases that can go wrong, but I think it is way better than not verifying anything. And it does not peek into internal DOS data structures. |
Why not add code to fdisk to scan the root directory itself, which would allow to always find the correct volume label file? |
Could be done, and is most probably the more reliable solution (if implemented properly). Would allow FDISK to read the volume file if the drive letters disagree. The question is if it is worth implementing FAT support inside FDISK, or continue to use the BPB volume id (and instead modify FreeDOS and EDR kernels to keep the field in sync, like MS-DOS does). I tend to the latter, because it is a cleaner separation of responsibility. Regarding DLA verification, I am quite unsure if this is even beneficial to the user. If a warning is issued on FDISK start, that would also show up if the user altered the partitions and FDISK is started a second time etc. If it is implemented it should be a help and not a disturbance. |
Or both? |
Thought about it. But I do not like it, because then it is not obvious to the user where the volume name originates from. It should at least be indicated somehow, for example by prepending the label with a star or similar if it originates from the BPB. And that star should be explained to the user. |
Agreed, but given that a disk/volume can be formatted by tools and altered by kernels other than those with FreeDOS, I think you'll need to display the volume name's source somehow anyway if they are different. I think you can see an example of this need here https://gitlab.com/FreeDOS/issue-reporting/-/issues/31 I'm pretty sure that the BPB label really needs to be written if the field exists in the BPB:
I can see there is one caveat to this, at present (with FreeDOS) the filesystem volume name and normal files / directories share the same namespace, consequently you cannot have a file or directory with the same name as the volume. I'm sure you are aware of these two issues, but I'll reference them anyway FDOS/label#17 and https://gitlab.com/FreeDOS/base/label/-/issues/1 . I had a stab at fixing this collision in the FreeDOS kernel but ran into trouble and out of enthusiasm. I had better luck and a lot of help with the FDPP version see https://github.com/dosemu2/fdpp/pull/202/files. After seeing an issue/comment/post somewhere this week (it may have been yours?) about int21/69 https://fd.lod.bz/rbil/interrup/dos_kernel/2169.html#3212, I did a little digging into FreeDOS/FDPP and there may already be code to set the label in the BPB without messing about determining the correct location to write. In any case I now know that interface presents another vector for filesystem volume name, and BPB volume name to get out of sync so I guess I'll have to write dosemu tests to cover that, and perhaps see about closing it somehow. |
From reading the code only I have a little follow up to int21/69, at present it seems the kernel will get the volume name, but not set it. Gethttps://github.com/FDOS/kernel/blob/1cc00e194dd969d30c78775c67a1df44af307abf/kernel/dsk.c#L708-L735 Sethttps://github.com/FDOS/kernel/blob/1cc00e194dd969d30c78775c67a1df44af307abf/kernel/dsk.c#L775-L788 I'm off to write some tests now to see what MS-DOS 6.22 does. |
How do you write these tests and what is needed to run them? Would it be possible to open source them so I can also check the EDR kernel against them? |
Written using the python unittest framework to create a clean environment for each test, compile any binaries necessary, and usually provide the logic to validate output. Already open source as part of dosemu2, for instance here's the current label test source https://github.com/andrewbird/dosemu2/blob/ci-115/test/func_label_create.py, which provides 10 tests. It requires dosemu2 to run, and currently runs those tests regularly against DR-DOS 7.01 (opendos), MS-DOS 6.22, FreeDOS 1.3, and FDPP current git. Here's a couple of sample runs
Here's the scheduled weekly test run that does all the default flavours https://github.com/dosemu2/dosemu2/actions/runs/10985259035/job/30496852273. Since it takes a long time, and not wanting to abuse github actions too much, we skip some of the expensive tests there like the 120 libi86, pcmos and freecom build ones. If a test fails, then you'll obviously see a fail message, and you'll get two files, one the dosemu2 log file, and also the interaction transcript. The test framework mostly uses python-pexpect which is like traditional expect in that you 'send' command text, then 'expect' a set of responses to drive dosemu as if you were typing the commands yourself. So this naturally restricts the type of programs you can capture output from. So I think you'd have difficulty driving a graphical program, even text programs that are driven heavily by mouse could be difficult, but most DOS command utilities and obviously our self written test binaries should be fine.
That should be possible, by creating a class file for it which I suspect is easiest by modifying the one for DR-DOS 7.01 https://github.com/dosemu2/dosemu2/blob/fbf64cee350d67aafa02c18dd5fa26b006f1870f/test/test_dos.py#L5016. In an ideal world the classes action dict would be empty as that details the known fails and unsupported features. First step is to get a Dosemu2 to boot EDR kernel, and its command.com from its virtual fatfs directory. Note booting from a floppy image is no good for the test. Got to break off now, going to watch the SpaceX IFT5 launch and 'catch'! |
Thanks for the detailed explanation!
Seems it was catched quite well :) Lets see how re-entry of Spaceship goes... :)
First step for me would be to get Dosem2 running on my laptop (Mac). Probably I better try on my OpenSUSE Linux machine at home... I had a quick look at the structure of the tests. Did you consider loading .c files from Python instead inserting the C source as a string into the Python files? Would make it easier to "fetch" the C tests and compile them independent from the test infrastructure. |
Well I was skeptical that they'd catch it, but so happy to be wrong!
Less flap burnthrough than last time, still too much, however it was on target, not 6km off this time
If you can run a linux distro (ubuntu) in a VM that would work fine. I never tried in a mac, but even KVM nesting works on linux host/linux guest.
Yes, I started out that way, but many of them are built dynamically from the python. I do output the resultant .c files into the test directory as the test is built/run, so you could grab then from there. However mostly the pass/fail logic is in the python as I can do regex etc. Have to go out now. |
Currently there is an incompatibility between the drive letter assignment of the (E)DR-DOS kernel and FDISK, as FDISK follows the FreeDOS (and Microsoft) way of assigning drive letters to partitions. But DR-DOS handles this differently.
We should detect if running under DR-DOS and adapt to its drive letter assignment.
A new FDISK config variable
DLA
will be introduced, defaulting to zero. This means that FDISK will try to auto-adapt its DLA to the operating system.DLA=1
means explicit FreeDOS DLA algorithm, whileDLA=2
means explicit DR-DOS DLA algorithm.Notice: The DLA of the FreeDOS kernel may be changed via a kernel config variable. There is currently no easy way to detect which DLA the FreeDOS kernel uses. But the default is to match the Microsoft way of doing it, and this is what FDISK assumes.
The text was updated successfully, but these errors were encountered: