Page 1 of 1

Check if device is active

Posted: Mon May 29, 2017 8:03 pm
by mritter0
I am having no luck at scanning the device list and skipping the ones that are not fully mounted yet (Activate=0; in mountlist and not accessed yet). All the functions I have been using activates it when it should be skipping it.

How do I skip them?

Code: Select all

	if ((ADOList=IDOS->AllocDosObjectTags(DOS_VOLUMELIST,
		ADO_Type,								LDF_DEVICES|LDF_READ,
		ADO_AddColon,							FALSE,
	TAG_DONE)))
	{
		for(node=IExec->GetHead(ADOList); node; node=IExec->GetSucc(node))
		{
			if ((dl=IDOS->LockDosList(LDF_DEVICES|LDF_READ)))
			{
				if ((dl=IDOS->FindDosEntry(dl,node->ln_Name,LDF_DEVICES|LDF_READ) ))
				{
					if (dl->dol_Type==DLT_DEVICE)
					{
// if not fully mounted (Activate=0;) then skip
// else add to list
					}
				}

				IDOS->UnLockDosList(LDF_DEVICES|LDF_READ);
			}
		}

		IDOS->FreeDosObject(DOS_VOLUMELIST,ADOList);
	}

Re: Check if device is active

Posted: Tue May 30, 2017 7:30 am
by thomasrapp
I guess that dol_Port would be NULL if the device is not active.

Re: Check if device is active

Posted: Tue May 30, 2017 11:37 pm
by mritter0
You are correct, sir. Thank you.

Re: Check if device is active

Posted: Wed May 31, 2017 1:09 am
by colinw
I wrote the ACTION_STARTUP dospacket documentation to show how it all works...
Also, "if (dl->dol_Type==DLT_DEVICE)" is redundant, because the FindDosEntry() filters by flags.

====================================================================
* FUNCTION
* This action has the same value as ACTION_NIL (0)
* however it is always used by dos.library as a handshake mechanism
* to start up handlers and filesystems.
*
* When dos.library sends this packet to the process message port of a
* handler or filesystem, the following sequence will occur.
*
* (1) DOS will first check if this handler is already running by looking
* to see if devicenode->dn_Port != NULL then (6), otherwise ...
*
* (2) DOS library will check if the module requires loading by looking
* to see if the devicenode->dn_SegList != ZERO, if it is already
* loaded then (4), otherwise ...
*
* (3) DOS will obtain the loadable name from devicenode->dn_Handler,
* if that is valid, DOS will attempt to IDOS->LoadSeg() it,
* once loaded, the devicenode->dn_SegList will be initialised.
*
* (4) A DOS process will be started for this handler device, the name of
* this process will default to the same as the devicenode->dn_Name,
* from V53.102 handler version information is appended to the name.
*
* (5) The ACTION_STARTUP packet will be sent to the default process
* message port, DOS will wait for the packet to return.
*
* (6) The message port will be extracted from either the result of
* the startup packet (from dp_Arg4) or the devicenode->dn_Port.
* (See notes below).
*
====================================================================