English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 03 April 2021, 19:16   #1
BSzili
old chunk of coal
 
BSzili's Avatar
 
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?
BSzili is offline  
Old 03 April 2021, 19:52   #2
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,162
the first sector of the disk contains the fourcc of the real dos type.
jotd is offline  
Old 03 April 2021, 20:20   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by BSzili View Post
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?
DosEnvec has it. (DosList->dol_Startup->fssm_Environ)

Quote:
Originally Posted by jotd View Post
the first sector of the disk contains the fourcc of the real dos type.
Yes but it gets problematic when partition start is outside of first 4G.
Toni Wilen is offline  
Old 03 April 2021, 21:18   #4
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,215
Quote:
Originally Posted by BSzili View Post
I'd like to make a small program that prints out the real DosType for a volume/drive.
As Toni said, the Environment contains it. If you look for a program that prints it, get "Devices" from Aminet. It prints all informations on a volume you could ask for.
Thomas Richter is offline  
Old 04 April 2021, 07:51   #5
BSzili
old chunk of coal
 
BSzili's Avatar
 
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.
BSzili is offline  
Old 04 April 2021, 11:58   #6
Thomas Richter
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.
Thomas Richter is offline  
Old 04 April 2021, 16:48   #7
BSzili
old chunk of coal
 
BSzili's Avatar
 
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?
BSzili is offline  
Old 04 April 2021, 17:21   #8
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Quote:
Originally Posted by BSzili View Post
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?

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.
thomas is offline  
Old 04 April 2021, 17:53   #9
Thomas Richter
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.
Thomas Richter is offline  
Old 05 April 2021, 12:34   #10
BSzili
old chunk of coal
 
BSzili's Avatar
 
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.
BSzili is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:57.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08011 seconds with 15 queries