03 April 2021, 19:16 | #1 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
|
Finding the real DosType of a volume
I'd like to make a small program that prints out the real DosType for a volume/drive. For example "dostype dh0:" would print "FPS\3", "SFS\0" or "DOS\1" depending on the DosType value the user gave in HDToolBox.
From what I understand the the id_DiskType field in the InfoData struct is usually ID_DOS_DISK or ID_FFS_DISK for compatibility reasons. Some examples suggest the dol_DiskType field in the DosList struct reachable via id_VolumeNode, but that appears to hold a "DOS" compatibility-value as well. I'm wondering, is there a way to find the real DosType? |
03 April 2021, 19:52 | #2 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
the first sector of the disk contains the fourcc of the real dos type.
|
03 April 2021, 20:20 | #3 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Quote:
Yes but it gets problematic when partition start is outside of first 4G. |
|
03 April 2021, 21:18 | #4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
|
04 April 2021, 07:51 | #5 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
|
Thank you Toni and Thomas, this is what I was looking for! Can this be extended to locks of arbitrary paths? Finding the actual volume that holds "Work:SomeDrawer" for example, and then printing the DosType of that volume?
I tried finding an entry in the LDF_DEVICES list with a matching dol_Task to the lock's fl_Task, and I found the device name and unit number (e.g. uaehf.device unit 1), is this what I'm looking for? I found the volume's DosList too via the same method, just checking the LDF_VOLUMES list, but the dol_Startup for that entry was 0. edit: I also tried checking the lock's fl_Volume DosList, but that one also has a 0 dol_Startup. Last edited by BSzili; 04 April 2021 at 08:33. |
04 April 2021, 11:58 | #6 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
Yes. Look for the handler in the dos list whose dol_Task points to the same message port as the fl_Task in the file lock structure. From there, navigate to dol_Startup, which may be a number, or a BPTR to FileSysStartupMsg (see dos/filehandler.h). There is a BPTR to the environment, and this contains the dos type.
|
04 April 2021, 16:48 | #7 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
|
This worked great, I tried on a couple of volumes with different file systems, also verified with the Devices program. You mentioned that dol_Startup may be a number. Should I check if it's a valid FileSysStartupMsg BPTR? For example if TypeOfMem(BADDR(dol_Startup)) is non-zero, then it should be the fssm pointer?
|
04 April 2021, 17:21 | #8 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 6,985
|
Quote:
Yes, and also check that it is higher than 1000 or so, because TypeOfMem(small number) will return MEMF_CHIP, but is not a valid FSSM. |
|
04 April 2021, 17:53 | #9 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
The problem with dol_startup is that it is actually private to the file system what exactly it means. In principle, it could also be a C pointer or a pointer to something completely different than the documented startup message. Thus, it is not really completely safe to interpret it as a BPTR, even though in relality I haven't seen a handler on the Amiga that does not use it as either as a number or a BPTR to the startup message.
|
05 April 2021, 12:34 | #10 |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
|
I suspected this would be the case, but for now it's good enough that it works with the most common file systems (I tried it with FFS, PFS, FAT32, emulated WinUAE directory drives, etc.). If I encounter one that doesn't play by these rules I can always add workarounds later.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
integrating cd volume in master volume | honx | request.UAE Wishlist | 2 | 14 June 2020 22:43 |
Guru when booting a real wb image form an real Amiga. | chocsplease | support.WinUAE | 2 | 26 July 2017 16:01 |
CD audio volume change is not applied if Paula volume is changed, too | thomas | support.WinUAE | 1 | 21 March 2014 16:50 |
Help finding two games! | nfmucci | request.Old Rare Games | 8 | 07 May 2012 19:09 |
Need Help Finding A PC Game..... | yugioh | Looking for a game name ? | 1 | 17 December 2008 09:07 |
|
|