[comp.sys.amiga.programmer] Device List

ad99s461@sycom.UUCP (Alex Deburie) (06/19/91)

Help! I am desperate need of information on scanning the Device List.
I tried the example in Amiga Worlds Tech Journal, but I found some strange
things happening within it.
The RAM: device never seems to show up in the device list. RAM DISK: does, but
if I, or someone using my program, were to rename RAM DISK: as FRED:, I would
have no way of knowing it is really a RAM: disk.
Also, I can't seem to find a way to find out what is a DiskDrive and what is
not. While my complete device list gives me DF0: and DF1:, both have different
disk types. I've tried the file-lock value from the device list, but this was
incosistant too.

ANY help would be greatly appreciated.

-- Alex Deburie

sl87m@cc.usu.edu (The Barking Pumpkin Digital Gratification Ensemble) (06/25/91)

In article <ad99s461.9855@sycom.UUCP>, ad99s461@sycom.UUCP (Alex Deburie) writes:
> Help! I am desperate need of information on scanning the Device List.
> I tried the example in Amiga Worlds Tech Journal, but I found some strange
> things happening within it.
> The RAM: device never seems to show up in the device list. RAM DISK: does, but
> if I, or someone using my program, were to rename RAM DISK: as FRED:, I would
> have no way of knowing it is really a RAM: disk.
> Also, I can't seem to find a way to find out what is a DiskDrive and what is
> not. While my complete device list gives me DF0: and DF1:, both have different
> disk types. I've tried the file-lock value from the device list, but this was
> incosistant too.
> 
> ANY help would be greatly appreciated.
> 
> -- Alex Deburie

I don't know if this is a long route to your answer, or even if it'll help,
but try getting to the device list by following these pointers:

DOSBase->dl_Root->rn_Info->di_DevInfo

(Go through your include files in libraries/dosextens, and /filehandler
to find the types necesary -- beware of the BPTRs!!!!)

If you need more info, you can follow struct DeviceNode's dn_Startup to find
more information about the structure of the device.  

---
James Knowles
#include <std_disclaimer.h>
#include <cute_sig.h>

S_ASCHMIDT@iravcl.ira.uka.de (|S| Angela Schmidt) (06/25/91)

In <ad99s461.9855@sycom.UUCP> ad99s461@sycom.UUCP writes:

> Help! I am desperate need of information on scanning the Device List.
> [...]

I've included a part of my program which scans the devicelist for
DLT_DEVICE (DF0:, DF1:, DH0:, RAD:,...)

Try to change DLT_DEVICE to DLT_VOLUMES (= Disk names) or DLT_DIRECTORY
(= ASSIGNS) and leave "if (fssm!=0)" out.

Remember that RAM: is no device, so you won't find it using DLT_DEVICE!

struct DeviceInfos {
   char devname[MAX_DEVICE];     /* Devicename (e.g. DF0:) */
   ULONG devunit;                /* Unit */
   ULONG devflags;               /* Memory-Flags */
   char devdriver[MAX_TREIBER];  /* Drivername */
   long entries[MAX_ENTRIES];    /* entrees */
};

void DeviceList ()
{
   register long i, j=0;
   struct DeviceInfos *di[MAXDEVS];
   register struct DeviceInfos **devinf=di;

   Forbid ();
   for (i=0; i<MAXDEVS; i++)
      di[i]=&devinfos[i];
   i=0;
   dev=(struct DeviceList *) BADDR(((struct DosInfo *) BADDR(((struct RootNode *) (DOSBase->dl_Root))->rn_Info))->di_DevInfo);
   while (dev != 0 && i<MAXDEVS) {
      if (dev->dl_Type==DLT_DEVICE) { /* Disks only */
                                      /* DLT_VOLUMES    Volumes */
                                      /* DLT_DIRECTORY  Assigns */
         dn=(struct DeviceNode *) dev;
         if (dn->dn_Task) {
            fssm=(struct FileSysStartupMsg *) (dn->dn_Startup<<2);
            if (fssm!=0) {          /* StartupMessage for disks */
               for (j=0; j<*((char *) BADDR(dn->dn_Name)); j++)
                  devinf[i]->devname[j]=*((char *) BADDR(dn->dn_Name)+1+j);
               devinf[i]->devname[j]=':';
               devinf[i]->devname[j+1]=0;
               devinf[i]->devunit=fssm->fssm_Unit;
               devinf[i]->devflags=fssm->fssm_Flags;
               fenv=(ULONG *) (fssm->fssm_Environ<<2);
               for (j=0; j<*((char *) BADDR(fssm->fssm_Device)); j++)
                  devinf[i]->devdriver[j]=*((char *) BADDR(fssm->fssm_Device)+1+j);
               devinf[i]->devdriver[j]=0;
               for (j=0; j<=fenv[DE_TABLESIZE]; j++)
                  devinf[i]->entries[j]=fenv[j];
               devinf[i]->entries[DE_MEMBUFTYPE]|=MEMF_PUBLIC;
            }
         }
      }
      dev=(struct DeviceList *) BADDR(dev->dl_Next);
   }
   Permit ();
}

> 
> -- Alex Deburie

Hope this helps

Angela




---------------------------------------------------------+---------------------
Angela Schmidt   Internet: S_ASchmidt@iravcl.ira.uka.de  |        //
(Nessy in IRC)   BITNET:   UK8B@DKAUNI2.BITNET           | Amiga //
                 Phone:    +49 731 712316 & 721 6904-263 |   \\ // only 1000
                           MEZ: (10am-9pm)  (12pm-10pm)  |    \X/ the real one!
---------------------------------------------------------+---------------------

jbickers@templar.actrix.gen.nz (John Bickers) (06/27/91)

Quoted from <1991Jun25.131549.25837@ira.uka.de> by S_ASCHMIDT@iravcl.ira.uka.de (|S| Angela Schmidt):

> Remember that RAM: is no device, so you won't find it using DLT_DEVICE!

    It's there - I think the reason you don't find it is because you
    check the dn_Task field. I also find a blank device, which is a
    little wierd. The "assign" command also finds it...

    I'd say I was 100% sure that RAM: is in the list as a device, but...
    :)

> Angela Schmidt   Internet: S_ASchmidt@iravcl.ira.uka.de  |        //
--
*** John Bickers, TAP, NZAmigaUG.        jbickers@templar.actrix.gen.nz ***
***         "Endless variations, make it all seem new" - Devo.          ***

fjrei@kbsaar.UUCP (Franz-Josef Reichert) (06/29/91)

In article <1991Jun25.131549.25837@ira.uka.de> S_ASCHMIDT@iravcl.ira.uka.de (|S| Angela Schmidt) writes:
>In <ad99s461.9855@sycom.UUCP> ad99s461@sycom.UUCP writes:
>
>> Help! I am desperate need of information on scanning the Device List.
>> [...]
>
>I've included a part of my program which scans the devicelist for
>DLT_DEVICE (DF0:, DF1:, DH0:, RAD:,...)
>
>Try to change DLT_DEVICE to DLT_VOLUMES (= Disk names) or DLT_DIRECTORY
>(= ASSIGNS) and leave "if (fssm!=0)" out.
>
>Remember that RAM: is no device, so you won't find it using DLT_DEVICE!

Of course it is. But since it has dn_Startup set to zero, you will 
not be able find it.

>         if (dn->dn_Task) {
>            fssm=(struct FileSysStartupMsg *) (dn->dn_Startup<<2);
>            if (fssm!=0) {          /* StartupMessage for disks */

Would you like to see PAR: or PRT:? This might happen, since they have both
dn_Task and dn_Startup set to a positive value when doing their job.

My suggestion: Send a packet ACTION_DISK_INFO to each handler (dn_Task) and 
see if it responds properly.
 
>Angela

--
Best regards,
Franz-Josef Reichert      VOICE: +49 6805 7417
Kuchlingerstrasse 13      UUCP:  ...uunet!cbmvax!cbmehq!cbmger!kbsaar!fjrei
D-6601 Kleinblittersdorf  GERMANY