[comp.sys.amiga] Writing to Floopies on Amiga

brianm@sco.COM (Brian Moffet) (12/22/89)

Could someone please tell me why doing the following
was not implemented:

main()
{
	int i;
	int fd;
	extern char data[];
	extern int data_len;

	fd = open("df1:", O_WRONLY);
	if (fd == -1)
		perror("df1:"), exit( 1 );

	for (i = 0; i < data_len; i += 512)
		if (write(fd, &data[i], 512) == -1)
			break;
}

I would like to be able to write raw data to the floppies with out
having to go though opening the trackdisk.device.  What would be
the problem with the trackdisk driver looking at the file
being opened ("df1:"), mark the disk as "in use", and then 
take data in using the file_offset value and byte_count to
write directly to the disk?

I can use the trackdisk.device, but it seems to be a large amount of
coding to deal with floppies without filesystems.  They are out
there.

brian moffet

riley@batcomputer.tn.cornell.edu (Daniel S. Riley) (12/23/89)

In article <4205@scolex.sco.COM> brianm@sco.COM (Brian Moffet) writes:
>I would like to be able to write raw data to the floppies with out
>having to go though opening the trackdisk.device.  What would be
>the problem with the trackdisk driver looking at the file
>being opened ("df1:"), mark the disk as "in use", and then 
>take data in using the file_offset value and byte_count to
>write directly to the disk?

It wouldn't be the trackdisk driver--the trackdisk device doesn't see
filenames (except when it writes them to header blocks, and it doesn't
understand those).  It would have to be the filesystem handler.  A
major responsibility of the file system handler is to ensure the
integrity of the file system it manages.  Writing blindly all over
the raw device is *not* a good way to ensure the integrity of the file
system, and it makes it *much* too easy to destroy your data.  If you
really want easy access access like that, it should be pretty easy to
implement as a separate handler, but it certainly doesn't belong in
the usual file system handlers.

-Dan Riley (riley@tcgould.tn.cornell.edu, cornell!batcomputer!riley)
-Wilson Lab, Cornell University

scott@grlab.UUCP (Scott Blachowicz) (01/03/90)

Regarding Writing to Floopies on Amiga; brianm@sco.COM (Brian Moffet) writes:


> Could someone please tell me why doing the following
> was not implemented:

> main()
> ...
> }

> I would like to be able to write raw data to the floppies with out
> having to go though opening the trackdisk.device.
Why not dig up the sources to one of the public domain DiskCopy
programs. It seems they would need to be doing something close to
this...they do track-by-track copies.

Scott Blachowicz    scott@grlab.uucp
--
Scott Blachowicz                E-mail:  scott@grlab.UUCP
USPS:  Graphicus                 ..or..  ...!hpubvwa!grlab!scott
       150 Lake Str S, #206     VoicePh: 206/828-4691
       Kirkland, WA 98033       FAX:     206/828-4236