Home · Articles · Downloads · Hobby Wear · Forums · Web Links · News CategoriesThursday, April 25, 2024
Navigation
Home
Articles
Downloads
Hobby Wear
FAQ
Forums
Web Links
News Categories
Contact Us
Photo Gallery
OpenVMS Bigot
Search
Users Online
Guests Online: 2
No Members Online

Registered Members: 7,708
Newest Member: nifseg
Sponsors
Island Computer
View Thread
OpenVMS Hobbyist Program | Alpha Systems Forums | FreeAXP
Author Importing raw files by faking as disk images
Hein
Member

Posts: 15
Joined: 02.02.07
Posted on March 09 2011 18:03
Ever wondered how to get some fresh files accessible by FreeAXP without a network connection like FTP, NFS or Samba ?

Using a disk image, is a somewhat cumbersome but effective method it seems.
I tried successfully with a backup container, a zip file and en executable (self extracting zip).
Startup FreeEXP in the configuration screen; point a free device to the file to be imported; Boot FreeAXP; mount/foreign the new device; and copy blocks into a file!

A tricky part was that best I know there is no native OpenVMS tool to copy using Logical Block IO. So I wrote a tool. See below.
(sorry, the
...


tags still drop spaces. Sent Email!)

The cumbersome part is that a config/reboot is needed.
I don't suppose we can dynamically alter the mapping.

The buggy part was that the image is presented as truncated down to 512 bytes blocks. Fine for EXE and BCK files, not so good for ZIP.

Would it be desirable for FreeAXP to round up to the next full 512 rather then truncate? I don't know. It may cause an IO error when the last block is tried to be read. Physically add null bytes to round up?

The workaround I used for this was to APPEND some bytes to the file to fill out the last block, using ECHO or PERL. For example:

# echo "nou, eens ff kijken of we er een blockje bij kunnen toveren" >> test.zip

or

# perl -e "print q(*)x511" >> test.zip

This made it all work for me.

Now if only we had a simple ODS2 & ODS5 non-shared file manipulation tool on Windoze! Just delete and copy in and out to start with. No directory create or growth for starters. INDEXF, BITMAP...

The inverse, export process would be harder as one would need to sufficiently pre-allocate the target. Still, it coudl be a viable method to get for example a somewhat predictable SYSDUMP.DMP file of the system.

Comments?
Hein



$ type COPY_LBN_SIMPLE.C

// copy_lbn_simple.c Hein van den Heuvel, March 2011,
// HvdH Performance Consulting
// A more complete version with statistics, selectable buffers sizes
// and more feature is available. Working on double buffering.

# define DEFAULT_BLOCKS 128

#define __NEW_STARLET
#include rms
#include iodef
#include dvidef
#include prvdef
#include syidef
#include string
#include stdio

__align (8) char io_buffer [ DEFAULT_BLOCKS * 512 ];

int sys$create(), sys$connect(), sys$write(), sys$close();
int sys$assign(), sys$getdviw(), sys$qiow(), sys$setprv();

struct RAB64 rab;
struct FAB fab;

main(int argc, char *argv[]) {


unsigned int privs[] = { PRV$M_LOG_IO, 0}, prvprv[2],
status, mounted, blocks_left, channel = 0, lbn = 0,
io_size = DEFAULT_BLOCKS*512,
blocks_per_io = DEFAULT_BLOCKS;

struct { short status, byte_count_low, byte_count_hi, mbz; } iosb;
struct { long count; void *address; } devnam_desc;
struct { short len, cod; void *address; int *retlen; }
getdvi_items[] = { 4, DVI$_MAXBLOCK, &blocks_left, 0,
4, DVI$_MNT, &mounted, 0, 0,0,0,0};

// Set up FAB and RAB for FIXED Length 512 Byte output file and large buffers

fab = cc$rms_fab;
rab = cc$rms_rab64;

fab.fab$b_fac = FAB$M_PUT | FAB$M_BIO ;
fab.fab$w_mrs = 512;
fab.fab$b_rfm = FAB$C_FIX;

rab.rab64$l_fab = (void *) &fab;
rab.rab64$l_rop = RAB$M_BIO;
rab.rab64$l_rbf = (char *) -1;
rab.rab64$l_ubf = (char *) -1;
rab.rab64$pq_rbf = (void *) io_buffer;
rab.rab64$q_rsz = io_size;

// Check for arguments and grab privs.

if (argc < 3 ) {
fprintf (stderr, "Usage: %s <input_device:> <output_file>\n", argv[0]);
return 268435472;
}

status = sys$setprv ( 1, privs, 0, prvprv);
if (!(status == 1) &&
((privs[0] & prvprv[0]) != privs[0])) { // SS$_NOTALLPRIV = 1665
fprintf (stderr, "Sorry, could not get required LOG_IO privilege.\n");
return status;
}

// Get a channel for QIO access, and obtain target size

devnam_desc.address = argv[1];
devnam_desc.count = strlen (argv[1]);
status=sys$assign(&devnam_desc,&channel,0,0,0);
if (status&1) status = sys$getdviw(0, channel,
0, getdvi_items, &iosb, 0,0 ,0 ,0);
if (!(status & 1)) return (status);
if ( !blocks_left || !mounted ) { // Needs, to be at least FOREIGN mounted.
fprintf (stderr, "%d blocks, device is %s mounted.\n",
blocks_left, (mounted)? "" : "NOT" );
return 124; // %SYSTEM-F-DEVNOTMOUNT, device is not mounted
}

// Create output file with initial size

fab.fab$l_fna = argv[2];
fab.fab$b_fns = strlen( argv[2] );
fab.fab$l_alq = blocks_left;
status = sys$create ( &fab);
if (status & 1) status = sys$connect ( &rab);

// Loop reading and writing while all is well and something left to copy

while (blocks_left && status & 1) {

if (blocks_left < blocks_per_io) {
blocks_per_io = blocks_left;
io_size = blocks_per_io * 512;
rab.rab64$q_rsz = io_size;
}


// Read and write IO

status = sys$qiow(0, channel, IO$_READLBLK, &iosb,
0,0, io_buffer, io_size, lbn, 0,0,0);

if (status & 1) status = iosb.status;
if (status & 1) {
status = sys$write ( &rab );
if (status & 1) {
lbn += blocks_per_io;
blocks_left -= blocks_per_io;

// Read and Write Error handling

} else {
printf ("SYS$WRITE error %d after %d blocks read at LBN %d\n",
status, blocks_per_io, lbn);
}
} else {
printf ("QIO LBN READ error %d for %d blocks read at LBN %d\n",
status, blocks_per_io, lbn);
}
}

// All done

if (status & 1) status = sys$close (&fab);
return (status);
}






Hein van den Heuvel
HvdH Performance Consulting
firstnamelastname.gmail.com
Author RE: Importing raw files by faking as disk images
Hein
Member

Posts: 15
Joined: 02.02.07
Posted on March 09 2011 18:07
that was kinda stupid of me...

I tried to write a comment line with the tags for code |code| and un-code |\code| in there topic. I used the boxes, not bars, and of course they took effect.

Oh well... Hein



Hein van den Heuvel
HvdH Performance Consulting
firstnamelastname.gmail.com
Author RE: Importing raw files by faking as disk images
malmberg
Moderator

Posts: 530
Joined: 15.04.08
Posted on March 10 2011 12:36
There is a tool on the freeware to read ODS-2 disks on Microsoft Windows.

Could this be modified to create a simple ODS-2 volume populated with a single file?
Author RE: Importing raw files by faking as disk images
Hein
Member

Posts: 15
Joined: 02.02.07
Posted on March 10 2011 18:57
Along the same lines I was thinking of checking out whether DFU code could be re-used. It knows ODS and knows to find files. That would be useful to grab files from you FreeAXP drives without booting it.

To get a single file there, I suspect that my hokey method is only slight more cumbersome than an full OpenVMS - ODS 2/5 writer on windows.

In order to write you would need access to the container file which you can not, nor should not, get while FreeAXP is running.
So to push a file there you need to shutdown, copy with special tool and reboot.
My method is to shutdown, point to target, reboot, and copy with other special tool.

A tool to truly manipulate files between windows and an ODS image would be neato.

Hein


Hein van den Heuvel
HvdH Performance Consulting
firstnamelastname.gmail.com
Author RE: Importing raw files by faking as disk images
iamcamiel
Moderator

User Avatar

Posts: 25
Location: Wageningen, The Netherlands
Joined: 06.04.08
Posted on March 11 2011 02:21
Hi Hein,

Interesting approach...

We're rounding down the filesize, because if the image file contains a filesystem, or if you'd like to create a filesystem on it, the OS expects every byte of every block to be there (readable and writeable).

While I can see that rounding up would be helpful in your situation, I wouldn't want to change the current default behavior. What we could do is add a configuration file parameter that will let the emulator do that.
http://sourceforge.net/projects/es40
Jump to Forum:
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Are you going to OpenVMS Boot Camp 2016?

Yes

No

You must login to vote.
Shoutbox
You must login to post a message.

malmberg
August 04 2022
No more VAX hobbyist licenses. Community licenses for Alpha/IA64/X86_64 VMS Software Inc. Commercial VMS software licenses for VAX available from HPE.

ozboomer
July 20 2022
Just re-visiting.. No more hobbyist licenses? Is that from vmssoftware.com, no 'community' licenses?

valdirfranco
July 01 2022
No more hobbyist license...sad

mister_wavey
February 12 2022
I recall that the disks failed on the public access VMS systems that included Fafner

parwezw
January 03 2022
Anyone know what happened to FAFNER.DYNDS.ORG? I had a hobbyist account here but can longer access the site.

gtackett
October 27 2021
Make that DECdfs _2.1A_ for Vax

gtackett
October 27 2021
I'm looking for DECdfs V2.4A kit for VAX. Asking here just in case anyone is still listening.

MarkRLV
September 17 2021
At one time, didn't this web site have a job board? I would love to use my legacy skills one last time in my career.

malmberg
January 18 2021
New Hobbyist PAKs for VAX/VMS are no longer available according to reports. Only commercial licenses are reported to be for sale from HPE

dfilip
January 16 2021
Can someone please point me to hobbyist license pak? I'm looking for VAX/VMS 7.1, DECnet Phase IV, and UCX/TCPIP ... have the 7.1 media, need the license paks ... thanks!

Bart
October 16 2020
OpenVMS, and this website!

malmberg
September 05 2020
VSI community non-commercial licenses for AXP/IA64 are available now.

malmberg
September 05 2020
See the forum about licensing. Don't know if HPE hobby licenses still being issued. Commercial licenses still being sold.

silfox70
September 01 2020
I need the license for OpenVMS7.3. Where can I find them?

malmberg
August 29 2020
Eisner, which is currently being moved, got an SSH update and the keys were updated to more modern encryption standards.

Shoutbox Archive