/* DiskMisc.c - miscellaneous disk support routines.
 * Mark Rinfret (et al), 1987
 */

/*#define DEBUG*/

#define __NO_PRAGMAS /* DAV */

#include <exec/types.h>
#include <exec/memory.h>
#include <exec/ports.h>
#include <exec/io.h>
#include <libraries/dosextens.h>
#include <functions.h>

extern LONG 	sendpkt();


/* Disk ACTION_INHIBIT support routine.
 * Author:		Mark R. Rinfret
 * Date:		06/29/87
 * 
 * This routine provides support for user-written disk formatting, copy
 * operations which benefit from suppressing/restoring disk validation.
 */

int
MyInhibit(drivename, code)
	char *drivename; int code;
{
	struct MsgPort     *task;
	LONG 	arg[2];

	if (!(task=(struct MsgPort *) DeviceProc(drivename))) 
		return 1;			/* fail, darn it! */

	arg[0] = code;

	/* Now, cross all your fingers and toes... */

	return ( !sendpkt(task,ACTION_INHIBIT,arg,1L));
}

#ifdef DEBUG
main(argc,argv)
int argc;
char *argv[];
{
	int status;

	if(argc >1)
		status = Inhibit("df1:",1);
	else
		status = Inhibit("df1:",0);

	printf("Status %d\n",status);
}
#endif
