AminetAminet
Search:
82217 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/sys/Dev-Handler.lha

Mirror:Random
Showing:ppc-amigaosgeneric
No screenshot available
Short:Un*x like raw device access handler+more
Author:thorfdbg at alumni.tu-berlin.de (Thomas Richter)
Uploader:thorfdbg alumni tu-berlin de (Thomas Richter)
Type:util/sys
Version:40.6
Architecture:m68k-amigaos >= 2.0.4
Date:2017-12-21
Download:http://aminet.net/util/sys/Dev-Handler.lha - View contents
Readme:http://aminet.net/util/sys/Dev-Handler.readme
Downloads:715
------------------------------------------------------------------------------

New in 40.6:
	
	- the handler accepts now a sixth and 7th argument in the path
	  that specify the sector count and the bytes per sector. In
	  case at least the sector count is present, the handler no
	  longer attempts to obtain the disk size by TD_GETGEOMETRY, which
	  might have crashed some bad devices.

------------------------------------------------------------------------------

New in 40.5:
	
	- for some reasons unclear to me, the 40.4 seems to have never
	  made it to Aminet, so this is a re-release.
	- Not many changes from 40.4, mostly cleanup and a better
	  organization of the READ and WRITE implementations, plus a
	  cleaner implementation of the file system inhibit function.

------------------------------------------------------------------------------

New in 40.4:

	- the handler will now try to disable the corresponding DOS
	  device handler as long as it accesses the device itself. This
	  will avoid some race conditions. This does not happen if you
	  access the device by its exec device name.

------------------------------------------------------------------------------

New in 40.3:

	- due to permanent trouble with the NSD specifications, NSD support
	  is now disabled if the NSDPatch isn't found active. This means that
	  the NSDPatch would be even required in case all devices in the system
	  would support NSD correctly. Call this a design bug of NSD.
	- Added the possibility to write-protect certain dos devices. The 
	  devices to be write-protected are specified by the "Control" entry
	  in the mount list. See below for the specifications.
	- Found that the 64 multiplication of the Os - which is used by this
	  device handler - is actually broken. Funny enough, the 68000 and
	  010 version is fine, the 68020 and up versions are broken, but
	  are worked around by the device handler itself. This workaround
	  broke the 68000 version. To complete the mess, the Os specifications
	  will now be changed to continue support for the "broken" API. This
	  release contains a temporary fix for the problem. Further SetPatch
	  releases will contain this fix as well. Please install the patch
	  for now, and replace it by a new version of SetPatch as soon as it
	  appears. (That is, as soon as you install the Os 3.9.1 SetPatch,
	  this issue will be fixed.)

------------------------------------------------------------------------------

New in 40.2.1:

	- included a fix for the statram.device which crashed on NSDQuery.
	- included "Extract", an Amiga lookalike of the Un*x "dd" program to
	  copy or extract portions of files, propably sectors of a "special"
	  file.

------------------------------------------------------------------------------

Purpose of this program:

The DEV-Handler allows easy access to raw sectors of an exec type device under
the dos.library environment. A typical application would be to use the "copy"
command to make a full backup of a floppy to a file, or to use "copy" to make
a backup of the RDB of your HD.

The DEV-Handler is very powerful, but also very dangerous in the wrong hands
because it modifies the device structure going down to the exec handler
directly without using any kind of filing system access.

This DEV-Handler replaces various other DEV-Handlers and improves and fixes
many problems of these earlier releases. Note that no original code of these
versions have been used, this handler is a complete rewrite.

------------------------------------------------------------------------------

Usage:

A file name for the DEV-Handler is either a "DOS" device name like "df0" or
"DH0" in which case this "file" indicates the full partition addressed by this
name. For example, "DEV:df0" is the raw, unmapped first internal floppy drive,
"DEV:dh0" the first harddisk partition. The start of the file using this syntax
is always the start of the partition, the length of the file the full length of
the partition. Especially, this does NOT include the RDB, if there is one.

The alternative syntax addresses an exec device directly and completely,
ignoring partitions. A file name using this syntax looks as follows:

DEV:device/unit/flags/bufmemtype/mask/maxtransfer/sectorcount/bytespersector

where	

device			is an exec device name, i.e. "scsi.device". This is
			mandatory. This can also be the name of a DOS handler,
			in which case all other path components are not
			required.
unit			is the exec unit number, typically the SCSI ID. This
			is mandatory. If only one argument is given, the
			DEV-Handler reads the device as DOS partition name and
			not as an exec name. This is a numeral.
flags			exec flags for opening the device. Optionally and
			defaults to zero. This is a numeral.
bufmemtype		the memory type for the buffer to allocate for device
			I/O. Optionally and defaults to 
			MEMF_24BITDMA|MEMF_PUBLIC.
			This is a numeral, or one of the following hard-coded
			identifiers:

			MEMF_ANY, ANY		whatever is available, this is
						identical to MEMF_PUBLIC for
						the purpose of this handler.
			MEMF_PUBLIC, PUBLIC	public (non-virtual) memory.
			MEMF_CHIP, CHIP		chip memory.
			MEMF_FAST, FAST		non-chip, i.e. FAST memory.
			MEMF_LOCAL, LOCAL	native motherboard memory that
						does not go away on reset.
			MEMF_24BITDMA, 24BITDMA	memory in the 24 bit address
						space reachable for Zorro-II
						DMA.
			MEMF_ZORROII, ZORROII	a synonym for the above.

			All other values are read as numerals, hex identifiers
			using the "$" or "0x" notation are allowed here as
			well.
			
			This field fulfills the same purpose than the
			BUFMEMTYPE in the mount lists.

mask			A mask used for checking whether the supplied buffer is
			"proper". If "memory and not mask" is non-zero, the 
			handler will fall back to single block-I/O like the FFS.

			This field has the same purpose and works in the same
			way as the "MASK" entry in mountlists. 

			It is optional, the handler will compute a reasonable
			mask for you using the supplied or non-supplied 
			bufmemtype.

			This entry is a numeral, hex notation is accepted.

maxtransfer		The maximal amount of bytes the exec device is able to
			transfer at once. Larger chunks are split into smaller
			pieces at most as big as the "maxtransfer".

			This field works as the "MAXTRANSFER" entry in mount-
			lists. It defaults to 32767, i.e. 32K-1. 

			This entry is a numeral, hex notation is accepted.

sectorcount		An optional argument that specifies the number of
			sectors a medium has. If this number is not available,
			the medium size is obtained by TD_GETGEOMETRY, a 
			command to the device driver itself.

bytespersector		The size of a sector in bytes. If not given, the
			handler assumes 512 byte sectors.

------------------------------------------------------------------------------

Examples:		Note that the DEV-Handler is clearly an expert-tool,
			unsophisticated playing with the DEV-Handler may easely
			destroy the data-integrity of your HD!

Make a byte for byte backup of a floppy in drive 0 - known as ".adf" file:

	copy dev:df0 to Backup.adf

No need to run or use any kind of "ADF" conversion utility. 


Restore a backup to the floppy:

	copy Backup.adf to dev:df0

Yes, it is really that simple. (-:


Make a byte copy of the ZIP partition for future use:

	copy DEV:ZIP to Backup


View the "RDB" block of your boot volume, connected to the scsi.device, 
unit 0:

	type DEV:scsi.device/0 hex


Make a backup of the RDB (on block #0) on the omniscsi.device, ID 0 
to a backup file:

	extract dev:omniscsi.device/0 BC=1 to ram:rdb
	

Extract the root block of the floppy drive in df0: to ram:out:

	extract dev:df0 IS=880 BC=1 to ram:out

Restore a previous RDB backup:

	extract ram:rdb to dev:omniscsi.device/0 BC=1

------------------------------------------------------------------------------

Installation:

- Copy "Device-Handler" to L:

- Copy "DEV" and "DEV.info" to "Storage/DOSDrivers".

I *do not* recommend to mount DEV: automatically on startup since accidental
playing with DEV: may really yield to major damage!

The mount file in this archive will write-protect the hard-disk devices DHx,
where x is an arbitrary character. In case you do not want this, or want to
include further devices in the write protection, edit the mount file; the
list of devices to be write protected is specified in the line

Control = "PROTECT=<pattern>"

where <pattern> is an AmigaOs wild card pattern that will be matched against
a DOS device name. In case of a fit, this device will not allow write access.
In case you do not need this protection, just remove this line.

Examples:

Control = "PROTECT=DH?"

Protects the DHx devices, where x is an arbitrary character, i.e. DH0, DH1
and so on.

Control = "PROTECT=(DH?|ZIP)"

Write protection includes the ZIP device. *NOTE THAT THIS SPECIFICATION DOES
NOT INCLUDE THE TERMINATING COLON*.


*DO NOT* remove the dummy specifications below the "Control" line. They are
not required by the DEV-Handler, but by Mount to setup the "Control" entry
correctly. Otherwise, there will be no protection whatsoever.


- Copy "Extract" to C:

- Install the statram.device patch as follows:

	- make a backup of DEVS:statram.device
	- spatch -oram:statram.device -pstatram.pch devs:statram.device
	- copy ram:statram.device back to DEVS:

- Install the FixLongMult patch in your startup-sequence, somewhere below
  SetPatch. This fix repairs a bug in the 64 bit multiplication routine
  which is present for a plain 68000 or 68060 without the latest versions
  of SetPatch or a recent 68060.library.

	- Copy FixLongMult to C:
	- Open S:Startup-Sequence with an editor of your choice.
	- Locate the "SetPatch" command.
	- Insert a blank line below this command.
	- Enter "FixLongMult" into this line.
	- Save the changes.


------------------------------------------------------------------------------

statram.pch:

	This patch fixes a bug in the statram.device which crashes upon
	receiving NSDQuery. Even though this is clearly a bug of the device,
	it is a design flaw of the NSDQuery mechanism to provocate this
	bug by an uncarefully designed interface.
	This fix DOES NOT make statram.device NSD compatible (why?), it just
	fixes the crash and nothing more.

------------------------------------------------------------------------------

FixLongMult:

	Fixes a bug in UMult64 and SMult64 for the 68000, 68010 and 68060.
	Does nothing for 68020, 68030 and 68040. In fact, it "corrects"
	the 68000, 010, 060 versions to use the same "wrong" syntax than the
	68020,030,040 versions. In fact, this "wrong" syntax is now the 
	official syntax.

	*Without this fix, the DEV-Handler and other programs will not run
	correctly on the 68000, 68010 and possibly the 68060.*

	This fix became obsolete with the SetPatch in Os 3.9.1.

------------------------------------------------------------------------------

Extract:

	This is a Un*x like dd program for copying portions of a file. It is
	in fact unrelated to the DEV: handler, but might be a useful tool
	for purposes the DEV: handler has been written for.
	
Synopsis:

Extract FROM=IF,TO=OF,BLOCKSIZE=IBS/N,DESTBLOCKSIZE=OBS/N,SEEK=IS/N,
	DESTSEEK=OS/N,COUNT=BC/N/A: 

FROM=IF:		Input file, the data source. If this parameter is
			missing, Extract will run as a "filter" and will read
			from the standard input.

TO=OF:			Output file, the data destination. If this file does
			not exist, it is created, but an existing file will
			not be deleted, but modified.
			If this parameter is missing, Extract will run as a
			"filter" and will write to the standard output.

			Useful for "piping" the output to "type" to make
			single blocks of a harddisk readable.

BLOCKSIZE=IBS:		Input block size in bytes. "Extract" will always read
			single blocks of this (fixed) size from the input,
			and the "COUNT" field measures the data length in
			multiplies of this size.
			Neither the FFS nor DEV: require reading with fixed
			block sizes, but it might be useful for some
			purposes.

			If no block size is given, this parameter defaults to
			512 bytes.

			NOTE THAT Extract IS NOT ABLE TO DETERMINATE THE TRUE
			BLOCK SIZE OF A "DEV:" FILE IT IS TALKING TO. Extract
			is unrelated to DEV: at all.

			Hence, in case your HD uses 2048 bytes blocks, you
			MUST specify a IBS of 2048.

DESTBLOCKSIZE=OBS	Output block size in bytes. "Extract" will always
			write single blocks of this size to the output, one at
			a time.
		
			If no block size is given, this parameter defaults to
			512 bytes.

			READ THE WARNING ABOVE CONCERNING THE BLOCK SIZE.

			Extract is able to handle situations where the IBS is
			different from the OBS, or not even a multiple of the
			IBS. However, if this happens, the last block written
			is no longer guaranteed to be OBS bytes long. It might
			be shorter. In case the destination stream cannot
			handle this situation, it is up to you to avoid this.

SEEK=IS			Input seek. The number of blocks to be skipped in the
			input file before starting reading. The number of
			bytes to be skipped is therefore IS*IBS.

			Extract and DEV: are able to handle situations where
			IS*IBS is larger than 4GB by performing multiple Seeks
			to get to the desired file position. 

			The FFS 45.xx *should* support this correctly, too,
			but maybe the handler you are using is not! 
			Be aware of this problem.

DESTSEEK=OS		Output seek. The number of blocks, measured in OBS,
			to be skipped in the output stream before writing.

			See also the warnings concerning IS above.

COUNT=BC		Block count. The number of blocks, measured in IBS,
			to be read from the source. The same number of bytes
			is then written back to the output file, but the
			number of output blocks might be different if OBS is
			not equal to IBS.

------------------------------------------------------------------------------

Improvements over the 37.xx releases (note that this is a re-design):

- Keeps care about popular device bugs including the standard-workarounds the
  FFS offers as well, including a MASK, MAXTRANSFER and BUFMEMTYPE.
- Allows concurrent reading and writing to the same stream.
- Implements ACTION_SEEK, i.e. seeking in device streams is possible.
- Automatically turns off the drive motors after a fixed delay like the FFS.
- Handles large devices correctly using the TD64 and/or the TD64 standard.
- Handles errors on Read/Write correctly, unlike the V37 edition.

------------------------------------------------------------------------------

                         The THOR-Software Licence (v2, 24th June 1998)


This License applies to the computer programs known as "Device-Handler" and
"Extract". The "Program", below, refers to such program. The "Archive" refers
to the the original and unmodified package of distribution, as prepared by the 
author of the Program. Each licensee is addressed as "you".



The Program and the data in the archive are freely distributable
under the restrictions stated below, but are also Copyright (c)
Thomas Richter.

Distribution of the Program, the Archive and the data in the Archive by a
commercial organization without written permission from the author to any
third party is prohibited if any payment is made in connection with such
distribution, whether directly (as in payment for a copy of the Program) or
indirectly (as in payment for some service related to the Program, or
payment for some product or service that includes a copy of the Program
"without charge"; these are only examples, and not an exhaustive enumeration
of prohibited activities).


However, the following methods of distribution
involving payment shall not in and of themselves be a violation of this
restriction:


(i) Posting the Program on a public access information storage and
retrieval service for which a fee is received for retrieving information
(such as an on-line service), provided that the fee is not
content-dependent (i.e., the fee would be the same for retrieving the same
volume of information consisting of random data).


(ii) Distributing the Program on a CD-ROM, provided that

a) the Archive is reproduced entirely and verbatim on such CD-ROM, including
especially this licence agreement;

b) the CD-ROM is made available to the public for a nominal fee only,

c) a copy of the CD is made available to the author for free except for
shipment costs, and

d) provided further that all information on such CD-ROM is redistributable
for non-commercial purposes without charge.


Redistribution of a modified version of the Archive, the Program or the
contents of the Archive is prohibited in any way, by any organization,
regardless whether commercial or non-commercial. Everything must be kept
together, in original and unmodified form.




Limitations.


THE PROGRAM IS PROVIDED TO YOU "AS IS", WITHOUT WARRANTY. THERE IS NO
WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING, REPAIR OR CORRECTION.


IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE THE PROGRAM, THE ARCHIVE
AND ALL DATA OF THIS ARCHIVE FROM YOUR STORAGE SYSTEM. YOU ACCEPT THIS
LICENCE BY USING OR REDISTRIBUTING THE PROGRAM.


                                                        Thomas Richter

------------------------------------------------------------------------------

Thomas Richter,
		December 2017


Contents of util/sys/Dev-Handler.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[unknown]                  267     454  58.8% -lh5- f3f9 Dec 21 00:37 Dev-Handler/DEV
[unknown]                 7112   17919  39.7% -lh5- 0f32 Dec 21 22:40 Dev-Handler/Dev-Handler.readme
[unknown]                  265     481  55.1% -lh5- 3f1b Jul  9  2000 Dev-Handler/DEV.info
[unknown]                 4568    7680  59.5% -lh5- 0bd6 Dec 21 22:33 Dev-Handler/Device-Handler
[unknown]                  779    1012  77.0% -lh5- 2941 Jul 22  2000 Dev-Handler/Extract
[unknown]                  309     396  78.0% -lh5- 7106 Sep 16  2000 Dev-Handler/FixLongMult
[unknown]                 9310   14688  63.4% -lh5- 842a Jul 22  2000 Dev-Handler/spatch
[unknown]                  135     144  93.8% -lh5- 3794 Jul 22  2000 Dev-Handler/statram.pch
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         8 files   22745   42774  53.2%            Dec 21 19:52

Aminet © 1992-2018 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>