Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!pcrat!rick From: rick@pcrat.uucp (Rick Richardson) Newsgroups: comp.unix.i386 Subject: Re: 6386 WGS Questions Keywords: Compatability Questions Message-ID: <1989Nov11.132424.2550@pcrat.uucp> Date: 11 Nov 89 13:24:24 GMT References: <6358@cbnewsm.ATT.COM> <4615@cbnewsc.ATT.COM> <16@zds-ux.UUCP> Reply-To: rick@pcrat.UUCP (Rick Richardson) Organization: PC Research, Inc., Tinton Falls, NJ Lines: 153 In article <16@zds-ux.UUCP> gerry@zds-ux.UUCP (Gerry Gleason) writes: >Wait a minute, if you can read the physical format, you should be able to >mount it. Isn't a System V file system a System V file system (with the >possible exception of version skews). > >What gives? Byte order isn't specified and structure padding in "struct filsys" (the superblock) will nail you. The following *GROSS HACK* I wrote to convert SVR2 floppy filesystems under Venix System V/286 to and from UNIX/386 Release 3.2 filesystems under 386/ix. I didn't have to contend with byte order, but I did have to deal with structure padding. Also note that the on disk free list of Venix is different, too. In my kludge I ignored it, since fsck will rebuild the freelist. People interested in converting filesystems can use this program to give them an idea of what the problem is. I urge you, however, to throw this one away and perhaps think of a cleaner method. My only excuse was that I was in a hurry -- I archive all comp.sources from the 286 unto mountable floppies, the 286 was down, and I needed to get some source code from the floppies onto the 386. -Rick #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # fs2s5.c # This archive created: Sat Nov 11 08:14:54 1989 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'fs2s5.c' then echo shar: "will not over-write existing file 'fs2s5.c'" else sed 's/^X//' << \SHAR_EOF > 'fs2s5.c' X#include X Xchar buf[512]; Xchar buf2[512]; Xlong zero = 0; Xlong clean = 0x7c269d38L; Xint fd; X Xmain() X{ X X fd = open("/dev/fh0", 2); X lseek(fd, 512L, 0); X read(fd, buf, 512); X if (buf[2] == 0 && buf[3] == 0) X { X printf("Converting to Venix Filesystem\n"); X memcpy(&buf2[0], &buf[0], 2); X X memcpy(&buf2[2], &buf[4], 4); X X memcpy(&buf2[6], &buf[8], 2); X X memcpy(&buf2[8], &buf[12], 200); X X memcpy(&buf2[208], &buf[212], 2); X X memcpy(&buf2[210], &buf[214], 200); X X memcpy(&buf2[410], &buf[414], 1); X X memcpy(&buf2[411], &buf[415], 1); X X memcpy(&buf2[412], &buf[416], 1); X X memcpy(&buf2[413], &buf[417], 1); X X memcpy(&buf2[414], &buf[420], 4); X X memcpy(&buf2[418], &buf[424], 8); X X memcpy(&buf2[426], &buf[432], 4); X X memcpy(&buf2[430], &buf[436], 2); X X memcpy(&buf2[432], &buf[438], 6); X X memcpy(&buf2[438], &buf[444], 6); X X memcpy(&buf2[504], &buf[504], 4); X memcpy(&buf2[508], &buf[508], 4); X } X else X { X printf("Converting to 386/ix Filesystem\n"); X memcpy(&buf2[0], &buf[0], 2); X memcpy(&buf2[2], &zero, 2); X X memcpy(&buf2[4], &buf[2], 4); X X memcpy(&buf2[8], &buf[6], 2); X memcpy(&buf2[10], &zero, 2); X X memcpy(&buf2[12], &buf[8], 200); X X memcpy(&buf2[212], &buf[208], 2); X X memcpy(&buf2[214], &buf[210], 200); X X memcpy(&buf2[414], &buf[410], 1); X X memcpy(&buf2[415], &buf[411], 1); X X memcpy(&buf2[416], &buf[412], 1); X X memcpy(&buf2[417], &buf[413], 1); X memcpy(&buf2[418], &zero, 2); X X memcpy(&buf2[420], &buf[414], 4); X X memcpy(&buf2[424], &buf[418], 8); X X memcpy(&buf2[432], &buf[426], 4); X X memcpy(&buf2[436], &buf[430], 2); X X memcpy(&buf2[438], &buf[432], 6); X X memcpy(&buf2[444], &buf[438], 6); X X memcpy(&buf2[500], &clean, 4); X memcpy(&buf2[504], &buf[504], 4); X memcpy(&buf2[508], &buf[508], 4); X } X lseek(fd, 512L, 0); X write(fd, buf2, 512); X X close(fd); X X exit(0); X} X Xfreelist(slen) X{ X} SHAR_EOF fi exit 0 # End of shell archive -- Rick Richardson | Looking for FAX software for UNIX/386 ?????? mention PC Research,Inc.| WE'RE SHIPPING your uunet!pcrat!rick| Ask about FaxiX - UNIX Facsimile System (tm) FAX # (201) 389-8963 | Or JetRoff - troff postprocessor for the HP {Laser,Desk}Jet