[comp.sys.amiga] Need help with trackdisk problem

mark@unisec.usi.com (Mark Rinfret) (08/27/87)

I've been working on a hard disk backup utility and it's in pretty good
shape, however, I'm having a small problem that I'm sure one of you wizards
can help me with ("Never a sentence end a preposition with!").

When my program detects that the current backup floppy is full (or when the
first file is output to the first floppy), it requests a new diskette, then
formats it.  Prior to formatting, I "inhibit" the validator and after
formatting, I "uninhibit", allowing the new disk to be validated.  Currently,
I have a Delay(3 seconds) after a successful format operation 
to allow the validator to do its thing (Gack! Pfft! Blech!).  I'm doing this
to prevent the "Insert volume..." requester from appearing when the disk is
accessed before validation is complete.  I'm sure there's a cleaner way to
do this, but I guess I don't have a clue as to what it is.  I played some
games with TD_CHANGESTATE, etc., but I've concluded that CHANGESTATE isn't 
affected by the completion of validation since the diskette never really 
leaves the drive.  Pseudo code for the program currently looks like this:

	Put up requester for new diskette
	Wait for DISKINSERTED from IDCMP or OK selection.
	Inhibit the drive (ACTION_INHIBIT)
	Format the diskette
	Uninhibit the drive
	If sucessful, delay 3 seconds <<<--- What's the right thing to do?
	...proceed with backup...

I hope the answer isn't too obvious or I'll feel like an idiot, but I sure
would like a suggestion or two.


By the way, I posted version 1.0 of this program to comp.sources.amiga some
time ago, but I don't think it ever got out.  I'm up to version 1.2 now, and
would like to repost.  I was thinking about posting binaries directly to
comp.sys.amiga if there aren't any objections.  Here's a quick rundown on
MRBackup's features:

	1.  Incremental backup is supported, using a delta date.  File dates
            are preserved during backup and restore.

        2.  Partial backup (start at a subdirectory).

        3.  Restore to other than original path.

        4.  Floppies need not be formatted in advance.  MRBackup formats as
            necessary.

        5.  Optional data compression/decompression (LZW) during restore and
            backup.

        6.  File exclusion capability.  Candidate filenames are checked
            against a user-specified file containing full, or partial pathname
            specifications.  Un*x wildcarding is supported.  Example:

                *.o			omit all object files
                include                 omit directory "include" and all
                                        lower levels
                Trashcan*               Traschcan and Trashcan.info

        7.  Backup is done on a "files-first" basis.  That is, sub-
            directories are not processed until all files at a given level
            have been processed.   Filenames are sorted on the backup media.

        8.  MRBackup talks.  I added this just for fun, but found later that
            this is a useful feature.  By audibly requesting new floppies as
            needed, MRBackup frees you to leave the room, at least as long
            as you stay within hearing distance.

        9.  User preferences can be defined in a special initialization file.

       10.  The user interface is fairly reasonable.  I started out using
            stdio and switched over to an Intuition-based interface which
            added a lot of work but made the program MUCH nicer to use.  

My fingers are out of breath :-) !  Thanks in advance for any light you
can shed on my "find out if the disk is ready" problem.

Mark

-- 
| Mark R. Rinfret, SofTech, Inc.		mark@unisec.usi.com |
| Guest of UniSecure Systems, Inc., Newport, RI                     |
| UUCP:  {gatech|mirror|cbosgd|uiucdcs|ihnp4}!rayssd!unisec!mark    |
| work: (401)-849-4174	home: (401)-846-7639                        |

bryce@COGSCI.BERKELEY.EDU (Bryce Nesbitt) (08/29/87)

In article <> baer@percival.UUCP (Ken Baer) typed:
>
> Prior to formatting, I "inhibit" the validator and after formatting, I
> "uninhibit", allowing the new disk to be validated.  Currently, I have a
> Delay(3 seconds) after a successful format operation to allow the validator
> to do its thing (Gack! Pfft! Blech!).  I'm doing this to prevent the
> "Insert volume..." requester from appearing when the disk is accessed
> before validation is complete.  [How can I do this better?...]

Why not just wait for the DISKINSERTED ICDMP message?  Intuition sends you
DISKINSERTED messages whenever a disk is inserted (no kidding!) or when you
"uninhibit".  The "Insert volume..." requester is, in fact, retried by a
DISKINSERTED IDCMP message.

You could also set the process structure member pr_WindowPTR to -1.  This
will return the "Insert volume..." causing error directly instead of
building a requester.  Of course, there is no easy way to turn around and
build the requester if it turns out that the error called for it.

-----
|\ /|  . Ack! (NAK, EOT, SOH)
{O o} . 
( " )	bryce@hoser.berkeley.EDU -or- ucbvax!hoser!bryce
  U	If "hoser" does not work, try my old address at "cogsci"

peter@sugar.UUCP (08/30/87)

Can't you wait for a "disk inserted" idcmp message? After all, won't 
intuition send one after the validator does its thing?

>         6.  File exclusion capability.  Candidate filenames are checked
>             against a user-specified file containing full, or partial pathname
>             specifications.  Un*x wildcarding is supported.  Example:

How about supporting AmigaDOS wildcarding? The File Name Requestor I posted
to the net a month or so ago included a nice Amiga Wild Card handler. This
isn't a UNIX machine... and AmigaDOS wildcarding is a bit more powerful
than UNIX wildcarding. Especially since the one I grabbed and included handles
such things as "file1|file2|file3" and "#(bigpat)".
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter
--                  U   <--- not a copyrighted cartoon :->

jesup@steinmetz.steinmetz.UUCP (Randell Jesup) (09/01/87)

[ in response to questions involving waiting for validator to finish ]

In article <594@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes:
>Can't you wait for a "disk inserted" idcmp message? After all, won't 
>intuition send one after the validator does its thing?

	Yes, or you can poll (evil, I know) every second or half-second doing
an info on the drive (GET_INFO or some such packet).

>>         6.  File exclusion capability.  Candidate filenames are checked
>>           against a user-specified file containing full, or partial pathname
>>             specifications.  Un*x wildcarding is supported.  Example:
>
>How about supporting AmigaDOS wildcarding? The File Name Requestor I posted
>to the net a month or so ago included a nice Amiga Wild Card handler. This
>isn't a UNIX machine... and AmigaDOS wildcarding is a bit more powerful
>than UNIX wildcarding. Especially since the one I grabbed and included handles
>such things as "file1|file2|file3" and "#(bigpat)".
>-- 
>-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter
>--                  U   <--- not a copyrighted cartoon :->

	The ARP library (which should be released very soon) includes
a file-requestor (by Charlie Heath), UNIX and Amiga wildcards, and many other
usefull routines.  Total size, about 8K.  (Note: this is all from memory).

	For your HD Backup program, I sincerely hope you can handle backups
to any device.  This would be MUCH appreciated by those that have SCSI tape
units, Bernoulii's (sp), multiple HD's, backup from 1 partition to another,
etc.  Also, I'm fairly sure that there will be a 'dont back up' bit somewhere
in the protection field in 1.3, so it would be nice if the user could specify
(in a file, or some other semi-permanent way) which bit it is.

	Randell Jesup
	jesup@steinmetz.UUCP  (uunet!steinmetz!jesup)
	jesup@ge-crd.arpa
-- 
	Randell Jesup  (Please use one of these paths for mail)
	jesup@steinmetz.UUCP (uunet!steinmetz!jesup)
	jesup@ge-crd.ARPA

mrr@softie.UUCP (09/01/87)

In article <594@sugar.UUCP>, peter@sugar.UUCP (Peter da Silva) writes:
> Can't you wait for a "disk inserted" idcmp message? After all, won't 
> intuition send one after the validator does its thing?

You're the second person to suggest that, and I suspected that it would work
until I attempted to check TD_CHANGESTATE.  I was hoping for a more
definitive response than "this oughta work...".  I guess I could just stick
the code in and try it, though (sigh...).
> 
> >         6.  File exclusion capability.  Candidate filenames are checked
> >             against a user-specified file containing full, or partial pathname
> >             specifications.  Un*x wildcarding is supported.  Example:
> 
> How about supporting AmigaDOS wildcarding? The File Name Requestor I posted
> to the net a month or so ago included a nice Amiga Wild Card handler. This
> isn't a UNIX machine... and AmigaDOS wildcarding is a bit more powerful
> than UNIX wildcarding. Especially since the one I grabbed and included handles
> such things as "file1|file2|file3" and "#(bigpat)".

I grabbed a copy of your requester some time ago but neglected to thank you.

		Thank you.

Honestly, I had been considering adding your code with a new Menu item which
would toggle between Un*x and AmigaDOS wildcarding.  I KNEW someone would
give me hell for that one :-).  Thanks for your input.

> -- 
> -- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter
> --                  U   <--- not a copyrighted cartoon :->

Mark

peter@sugar.UUCP (Peter da Silva) (09/03/87)

> I grabbed a copy of your requester some time ago but neglected to thank you.
> 
> 		Thank you.

You're welcome. You're the first person to actually admit to getting it :->.

		Thank you.

> Honestly, I had been considering adding your code with a new Menu item which
> would toggle between Un*x and AmigaDOS wildcarding.  I KNEW someone would
> give me hell for that one :-).  Thanks for your input.

It's not my code. The wildcard code (if you look at the file) came from someone
in Canada. I'd like to take the credit for it, but I think that if I want to
get credit where it's due, I should extend the same courtesy. The rest of the
program is all original, barring one line taken from one of the Manx demo
programs. I didn't have access to the Autodocs, so I grabbed their code to
activate a string gadget.
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter
--                  U   <--- not a copyrighted cartoon :->