[comp.sys.amiga] Telling AmigaDOS to be quiet for a bit

rokicki@rocky.STANFORD.EDU (Tomas Rokicki) (01/11/88)

Howdy!  I just wrote a program which copies disks and verifies the copies,
and allows quick multiple copies if you have a meg free.  (This is for
those BADGE Killer Demo Disks, and the orders keep coming in.)  The only
problem I'm having is the damn validator which is always running.  Is
there a way to tell AmigaDOS to ignore a particular drive for a while?
For instance, DiskCopy does this, with those cute little DF1:BUSY things.
Any help?

And secondly, has anyone gotten the _main from robotroff (with the nice
automatic detach feature) to work under Manx 3.4b?

Thanks!

-tom

carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) (01/12/88)

In article <952@rocky.STANFORD.EDU> rokicki@rocky.STANFORD.EDU (Tomas Rokicki) writes:
>Howdy!  I just wrote a program which copies disks and verifies the copies,
>and allows quick multiple copies if you have a meg free.  (This is for
>those BADGE Killer Demo Disks, and the orders keep coming in.)  The only
>problem I'm having is the damn validator which is always running.  Is
>there a way to tell AmigaDOS to ignore a particular drive for a while?
>For instance, DiskCopy does this, with those cute little DF1:BUSY things.
>Any help?

Here's what diskcopy and format do to Inhibit DOS from validating the
drive.  Note that diskcopy updates the root block of the copy with
a new creation date and last-accessed date so that it is not an EXACT
copy when the drives are uninhibited.  You must never have two exact copy
disks in the drives unless the drives are inhibited.

And be very very careful to never leave a drive in an inhibited state
when you exit.

/* Action Inhibit routine
 *
 *   Inhibits validator from validating a drive
 *
 *  DO NOT Uninhibit while two exact copy disks are in drives
 *  Make sure you DO uninhibit any inhibited drives before exit or abort
 */

#include "exec/types.h"
#include "exec/memory.h"
#include "exec/ports.h"
#include "libraries/dos.h"
#include "libraries/dosextens.h"


#define DOSTRUE     (-1L)
#define DOSFALSE    (0L)


/* Sample calling code fragment */

char   *name = "df0:";
struct MsgPort *dproc;
BOOL   Inhibited = FALSE;

main()
   {
   if(!(dproc = DeviceProc(dname)))
      cleanexit("Can't access unit\n",RETURN_FAIL);

   if(!(Inhibited = ActionInhibit(DOSTRUE,dproc)))
      cleanexit("Can't inhibit unit\n",RETURN_FAIL);

   /* Do trackdisk level stuff */

   if(Inhibited)  ActionInhibit(DOSFALSE,dproc);
   }


/* Action Inhibit routine */

ActionInhibit(toggle, diskProc)
LONG toggle;
struct MsgPort *diskProc;
    {
    struct StandardPacket *sp;
    struct MsgPort *rp;
    int error;

    if(!(sp = (struct StandardPacket *)
      AllocMem(sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR)))
       return(0);

    sp->sp_Msg.mn_Node.ln_Name = (char *)&sp->sp_Pkt;
    sp->sp_Pkt.dp_Link = &sp->sp_Msg;
    sp->sp_Pkt.dp_Port = rp = &((struct Process *)FindTask(0))->pr_MsgPort;
    sp->sp_Pkt.dp_Type = ACTION_INHIBIT;
    sp->sp_Pkt.dp_Arg1 = toggle;
    PutMsg(diskProc, &sp->sp_Msg);
    if((ULONG)WaitPort(rp) != (ULONG)&sp->sp_Msg)
       return(0);
    Remove(&sp->sp_Msg);
    error = sp->sp_Pkt.dp_Res1 ? 1 : 0;
    FreeMem(sp, sizeof(struct StandardPacket));
    return(error);
    }

/* end */
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CATS   >>Commodore Amiga Technical Support<<
                     UUCP  ...{allegra,ihnp4,rutgers}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

fnf@mcdsun.UUCP (Fred Fish) (01/12/88)

In article <952@rocky.STANFORD.EDU> rokicki@rocky.STANFORD.EDU (Tomas Rokicki) writes:
>						....		Is
>there a way to tell AmigaDOS to ignore a particular drive for a while?
>For instance, DiskCopy does this, with those cute little DF1:BUSY things.


int DisableDevice (name)
char *name;
{
    auto LONG arg[1];
    register int result = 0;
    register struct MsgPort *task;
    extern void *DeviceProc ();

    if((task = (struct MsgPort *) DeviceProc (name)) != NULL) {
	arg[0] = 1;
	result = sendpkt (task, ACTION_INHIBIT, arg, 1);
    }
    return (result);
}

int EnableDevice (name)
char *name;
{
    auto LONG arg[1];
    register int result = 0;
    register struct MsgPort *task;
    extern void *DeviceProc ();

    if((task = (struct MsgPort *) DeviceProc (name)) != NULL) {
	arg[0] = 0;
	result = sendpkt (task, ACTION_INHIBIT, arg, 1);
    }
    return (result);
}
-- 
# Fred Fish    hao!noao!mcdsun!fnf    (602) 438-3614
# Motorola Computer Division, 2900 S. Diablo Way, Tempe, Az 85282  USA