[comp.sys.amiga.tech] Finding disk names

chris@genly.UUCP (Chris Hind Genly) (11/15/90)

I would like to find the names of disks available on a system.  Currently
I'm looking through the DevInfo list.  The disk names are there.  By looking
at dol_Type, I can determine if the entry is for a device or not.  The
problem is how to figure out if it's a disk or not.  Right now I look
for a startup message, and examine it to see if it looks like a disk
startup message.

I'm not happy with this method.  It doesn't find the ram disk, and it may
find a device which is not a disk.  Anybody have any suggestions?

Here's what I'm doing now.

    RootNode = (struct RootNode *)DOSBase->dl_Root;
    DosInfo  = (struct DosInfo *)BADDR(RootNode->rn_Info);
    Devices  = (struct DosList *)BADDR(DosInfo->di_DevInfo);
    
    for(Device = Devices;
        Device;
        Device = (struct DosList *)BADDR(Device->dol_Next))
    {
        if (Device->dol_Type == DLT_DEVICE
        &&  (Startup = (struct FileSysStartupMsg *)
                    BADDR(Device->dol_misc.dol_handler.dol_Startup))
        &&  (DosEnvec = (struct DosEnvec *)BADDR(Startup->fssm_Environ))
        &&  DosEnvec->de_Surfaces < 20
        &&  DosEnvec->de_Surfaces > 0)
            ;
        else
            ;
            
        Name =  (char *)BADDR(Device->dol_Name);
        Name++;
        printf("%08x: %d %s\n", Device, Device->dol_Type, Name);
    }

       *                        *                        *
                                                            \|/
               *           _______                         --O--
                      ____/ KC1VP \____        *            /|\
 *      _____________/  (203) 389-8680 \_______________
 ______/  95 Fountain Terr., New Haven, CT, USA, 06515 \_______
/ Chris Hind Genly    chris@genly.uucp   uunet!hsi!genly!chris \
----------------------------------------------------------------

thad@cup.portal.com (Thad P Floryan) (11/15/90)

chris@genly.UUCP (Chris Hind Genly) in <chris.11102@genly.UUCP> writes:

	I would like to find the names of disks available on a system.
	Currently I'm looking through the DevInfo list.  The disk names are
	there.  By looking at dol_Type, I can determine if the entry is for a
	device or not.  The problem is how to figure out if it's a disk or
	not.  Right now I look for a startup message, and examine it to see if
	it looks like a disk startup message.

	I'm not happy with this method.  It doesn't find the ram disk, and it
	may find a device which is not a disk.  Anybody have any suggestions?

Example code to do what you're seeking can be found on Fish Disk #79 in the
"Info" directory where you'll find:

Info		Replacement for the AmigaDOS info command.  Includes source.
		Author:  Chuck McManis


Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]