Skip to content

Updates to converters/fsio #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions converters/fsio/Changes
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,36 @@ Changes Since Alpha Release:

- Merged change from tvrusso to fix compilation on FreeBSD

20-Aug-20

- Fixed bug in OS/8 file deletion which incorrectly reduced the directory
file count by 1

- Fix ASCII mode read in OS/8 where it would read an entire block into
memory rather than a single line. When copying to local:, this would
result in the destination file having unexpected <CR> characters.

15-Feb-21

- Added support Research Unix V7 file systems of RK05, RL01 and RL02 drives
using file system type "unixv7"

3-Mar-23

- Added support for RK06 and RK07 Unix V7 drives
- Added support for creating arbitrary sized Unix V7 file systems

26-Sep-24

- Fixed display of System ID during RT-11 mount if there is non-zero data
following the System ID on the disk

13-Nov-24

- Fixed OS/8 ASCII file read/write to to handle ^Z marking the end of file

28-Nov-24

- Fixed RT11 scan to find the size of the partition. The old code would
incorrectly terminate on an EMPTY marker rather than END-OF-SEGMENT.

17 changes: 14 additions & 3 deletions converters/fsio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ INSTALL=install
CC=gcc

EXECUTABLE=fsio
SOURCES=fsio.c declib.c tape.c dos11.c rt11.c dosmt.c local.c os8.c
INCLUDES=fsio.h declib.h tape.h dos11.h rt11.h dosmt.h os8.h
SOURCES=fsio.c declib.c tape.c dos11.c rt11.c dosmt.c local.c os8.c unixv7.c
INCLUDES=fsio.h declib.h tape.h dos11.h rt11.h dosmt.h os8.h unixv7.h
LIBS=-lreadline
MANPAGE=fsio.1
MANPAGE_DOS=fsio-dos11.1
MANPAGE_RT=fsio-rt11.1
MANPAGE_DOSMT=fsio-dosmt.1
MANPAGE_OS8=fsio-os8.1
MANPAGE_UNIXV7=fsio-unixv7.1
ARCHIVE=fsio.tgz

RELEASEFILES=$(BIN)/$(EXECUTABLE)
Expand All @@ -23,8 +24,16 @@ RELEASEFILES+=$(MAN)/$(MANPAGE_DOS)
RELEASEFILES+=$(MAN)/$(MANPAGE_RT)
RELEASEFILES+=$(MAN)/$(MANPAGE_DOSMT)
RELEASEFILES+=$(MAN)/$(MANPAGE_OS8)
RELEASEFILES+=$(MAN)/$(MANPAGE_UNIXV7)
RELEASEFILES+=./fsio.txt ./fsioSimh.txt

MANPAGES=$(MANPAGE)
MANPAGES+=$(MANPAGE_DOS)
MANPAGES+=$(MANPAGE_RT)
MANPAGES+=$(MANPAGE_DOSMT)
MANPAGES+=$(MANPAGE_OS8)
MANPAGES+=$(MANPAGE_UNIXV7)

$(EXECUTABLE): $(SOURCES) $(INCLUDES) Makefile
$(CC) $(CFLAGS) $(DEFINES) -o $(EXECUTABLE) $(SOURCES) $(LIBS)

Expand All @@ -33,14 +42,15 @@ $(EXECUTABLE): $(SOURCES) $(INCLUDES) Makefile
clean:
rm -f $(EXECUTABLE)

install: $(EXECUTABLE) $(MANPAGE) $(MANPAGE_DOS) $(MANPAGE_RT)
install: $(EXECUTABLE) $(MANPAGES)
$(INSTALL) -p -m u=rx,g=rx,o=rx $(EXECUTABLE) $(BIN)
mkdir -p $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE) $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE_DOS) $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE_RT) $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE_DOSMT) $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE_OS8) $(MAN)
$(INSTALL) -p -m u=r,g=r,o=r $(MANPAGE_UNIXV7) $(MAN)

uninstall:
rm -f $(BIN)/$(EXECUTABLE)
Expand All @@ -49,6 +59,7 @@ uninstall:
rm -f $(MAN)/$(MANPAGE_RT)
rm -f $(MAN)/$(MANPAGE_DOSMT)
rm -f $(MAN)/$(MANPAGE_OS8)
rm -f $(MAN)/$(MANPAGE_UNIXV7)

# This assumes that fsio has been "installed" on the current system
archive: $(RELEASEFILES)
Expand Down
3 changes: 2 additions & 1 deletion converters/fsio/dos11.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 John Forecast. All Rights Reserved.
* Copyright (C) 2018 - 2025 John Forecast. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -2473,6 +2473,7 @@ struct FSdef dos11FS = {
dos11Umount,
dos11Size,
dos11Newfs,
NULL,
dos11Set,
dos11Info,
dos11Dir,
Expand Down
36 changes: 29 additions & 7 deletions converters/fsio/dosmt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 John Forecast. All Rights Reserved.
* Copyright (C) 2018 - 2025 John Forecast. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -385,9 +385,21 @@ static int dosmtReadBytes(
break;
}
}
*buf++ = file->buf[file->nextb++];
len--;
count++;
if (SWISSET('a')) {
char ch = file->buf[file->nextb++] & 0177;

if ((ch != 0) && (ch != 0177)) {
*buf++ = ch;
count++;
}
len--;
if (ch == '\n')
break;
} else {
*buf++ = file->buf[file->nextb++];
len--;
count++;
}
}
return count;
}
Expand Down Expand Up @@ -982,6 +994,7 @@ static void *dosmtOpenFileW(
file->nextb = 0;
file->tm = 0;
file->error = 0;
memset(file->buf, 0, DOSMTRCLNT);
}
return file;
}
Expand Down Expand Up @@ -1015,8 +1028,8 @@ static off_t dosmtFileSize(
uint32_t length;

/*
* Compute the length of this file. The estimate may larger than the
* actual size of the file size don't know the actual EOF position
* Compute the length of this file. The estimate may be larger than the
* actual size of the file since we don't know the actual EOF position
* within the last block of the file.
*/
do {
Expand Down Expand Up @@ -1097,13 +1110,21 @@ static void dosmtCloseFile(

data->eot = tapeGetPosition(mount->container);

if (tapeWriteEOM(mount->container, 1) == 0)
/*
* Write 2 tape marks indicating the end of tape (DOS/BATCH requires
* 3 TM in a row, 1 for the EOF and the last 2 to indicate EOT) and then
* backup over the last 2 TMs.
*/
if ((tapeWriteTM(mount->container) == 0) ||
(tapeWriteTM(mount->container) == 0))
file->error = 1;

if (file->error != 0) {
ERROR("Panic: Error writing on \"%s\"\n", mount->name);
exit(3);
}

tapeSetPosition(mount->container, data->eot);
}

free(file);
Expand Down Expand Up @@ -1304,6 +1325,7 @@ struct FSdef dosmtFS = {
dosmtUmount,
NULL,
NULL,
NULL,
dosmtSet,
dosmtInfo,
dosmtDir,
Expand Down
6 changes: 5 additions & 1 deletion converters/fsio/fsio-dos11.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH FSIO-DOS11 1 "Jun 21,2019" "FFS I/O - DOS-11"
.TH FSIO-DOS11 1 "Feb 14,2021" "FFS I/O - DOS-11"
.SH NAME
fsio-dos11 \- Foreign File System I/O - DOS-11
.br
Expand All @@ -14,6 +14,9 @@ group number and user number. Wildcard characters are only valid with the
.SH NEWFS OPERATION
\fInewfs\fP creates a blank RK05 image (2.5MB, 4800 blocks) with no UFD
entries.
.SH COPY OPERATION
In ASCII mode ('-a'), characters will be converted to 7-bits and NULL and
delete characters will not be copied.
.SH SET OPERATION
The following \fIset\fP commands are supported:
.br
Expand Down Expand Up @@ -46,6 +49,7 @@ Creates an empty UFD and sets default UIC for file access.
.BR fsio-rt11 (1)
.BR fsio-dosmt (1)
.BR fsio-os8 (1)
.BR fsio-unixv7 (1)
.SH AUTHOR
John Forecast, <[email protected]>
.br
6 changes: 5 additions & 1 deletion converters/fsio/fsio-dosmt.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH FSIO-DOSMT 1 "Jun 25,2019" "FFS I/O - DOS-11 magtape"
.TH FSIO-DOSMT 1 "Feb 14,2021" "FFS I/O - DOS-11 magtape"
.SH NAME
fsio-dosmt \- Foreign File System I/O - DOS-11 magtape
.br
Expand Down Expand Up @@ -31,6 +31,9 @@ command, fsio will make use of the extra 3 characters on file lookup,
directory listing and file creation.
.SH NEWFS OPERATION
\fInewfs\fP creates an empty (zero length) file.
.SH COPY OPERATION
In ASCII mode ('-a'), characters will be converted to 7-bits and NULL and
delete characters will not be copied.
.SH SET OPERATION
The following \fIset\fP commands are supported:
.br
Expand Down Expand Up @@ -106,6 +109,7 @@ determine the current tape position).
.BR fsio-dos11 (1)
.BR fsio-rt11 (1)
.BR fsio-os8 (1)
.BR fsio-unixv7 (1)
.SH AUTHOR
John Forecast, <[email protected]>
.br
9 changes: 5 additions & 4 deletions converters/fsio/fsio-os8.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH FSIO-OS8 1 "Sep 218,2019" "FFS I/O - OS/8"
.TH FSIO-OS8 1 "Feb 14,2021" "FFS I/O - OS/8"
.SH NAME
fsio-os8 \- Foreign File System I/O - OS/8
.br
Expand All @@ -15,16 +15,16 @@ place multiple file systems on each physical device.
.br
OS/8 does not write any type of signature on the device and each device type
has it's own partitioning scheme so the \fImount\fP command must use the
"\fI-f type\fP switch so that \fBfsio\fP can determine the file system
"\fI-t type\fP switch so that \fBfsio\fP can determine the file system
layout. \fBfsio\fP uses a set of heuristics to verify the integrity of
the OS/8 file system(s) but it is quite possible for a random disk to pass
these tests and later crash \fBfsio\fP.
.SH MOUNT OPERATION
\fImount\fP requires the "\fI-f type\fP" switch so that it can determine the
\fImount\fP requires the "\fI-t type\fP" switch so that it can determine the
type of the underlying disk (See NEWFS OPERATION below for details).
.SH NEWFS OPERATION
\fInewfs\fP creates an RK05 disk image with 2 file systems. If the
"\fI-f type\fP" switch is present a different container file will be created
"\fI-t type\fP" switch is present a different container file will be created
depending on the type of the device specified:
.br
.RS
Expand Down Expand Up @@ -75,6 +75,7 @@ the default state after mount.
.BR fsio-dos11 (1)
.BR fsio-dosmt (1)
.BR fsio-rt11 (1)
.BR fsio-unixv7 (1)
.SH AUTHOR
John Forecast, <[email protected]>
.br
3 changes: 2 additions & 1 deletion converters/fsio/fsio-rt11.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH FSIO-RT11 1 "Jun 25,2019" "FFS I/O - RT-11"
.TH FSIO-RT11 1 "Feb 14,2021" "FFS I/O - RT-11"
.SH NAME
fsio-rt11 \- Foreign File System I/O - RT-11
.br
Expand Down Expand Up @@ -84,6 +84,7 @@ No \fIset\fP commands are currently supported.
.BR fsio-dos11 (1)
.BR fsio-dosmt (1)
.BR fsio-os8 (1)
.BR fsio-unixv7 (1)
.SH AUTHOR
John Forecast, <[email protected]>
.br
74 changes: 74 additions & 0 deletions converters/fsio/fsio-unixv7.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.TH FSIO-UNIXV7 1 "Mar 2,2023" "FFS I/O - UNIX V7"
.SH NAME
fsio-unixv7 \- Foreign File System I/O - Unix V7
.br
.SH DESCRIPTION
\fBfsio\fP allows access to Unix V7 file systems using the file system type
"\fIunixv7\fP". Note that you must use "\fI/etc/rawfs\fP" on Ultrix-11 3.0/3.1
to access files on disks created by \fBfsio\fP.
.br
.SH UNIX V7 PHYSICAL DISKS
UNIX V7 uses a logical block size of 512 bytes. \fBfsio\fP supports access to
disks which have their super block stored at block 2. Unix V7 does not write
any type of signature on the device so the \fImount\fP command uses a set of
heuristics to determine if the file system is valid.
.SH MOUNT OPERATION
\fImount\fP accepts the optional "\fI-t type\fP" switch to provide an additonal
check on the integrity of the file system (e.g. check for blocks addresses
larger than the specified disk) (See NEWFS OPERATION below for details).
.br

\fImount\fP also accepts the optional "\fI-o nnn\fP" switch where nnn is the
block offset of the start of the partition to be mounted. Since most, if not
all, UNIX V7 implementations hard code the partition layout for a specific
disk within the device driver, you will have to examine the device driver
code to calculate this offset.
.SH NEWFS OPERATION
\fInewfs\fP requires either the "\fI-b blocks\fP" or the "\fI-t type\fP" switch
to determine the size of the container file to be created:
.br
.RS
.TP
\fIrk05\fP \- RK05 image (2436 blocks, 776 inodes)
.br
.TP
\fIrl01\fP \- RL01 image (10240 blocks, 3272 inodes)
.br
.TP
\fIrl02\fP \- RL02 image (20480 blocks, 6552 inodes)
.br
.TP
\fIrk06\fP \- RK06 image (27126 blocks, 8680 inodes)
.br
.TP
\fIrk07\fP \- RK07 image (53790 blocks, 17208 inodes)
.br
.RE
.br

If neither switch is present, an RK05-sized disk will be created.
.br

By default, inodes occupy 4% of the disk space. This can be overridden by
using the "\fI-i num\fP" switch, where \fInum\fP can be in the range 8 - 65500
and the resulting inode space cannot occupy more than 50% of the disk space
(8 inodes consume 1 disk block).
.br
.SH SET OPERATION
The following \fIset\fP commands are supported:
.br
.TP
.B "\fIuid\fP n"
Sets the default UID for created files and directories (was 0 after mount).
.TP
.B "\fIgid\fP n"
Sets the default GID for created files and directories (was 0 after mount).
.SH SEE ALSO
.BR fsio (1)
.BR fsio-dos11 (1)
.BR fsio-dosmt (1)
.BR fsio-os8 (1)
.BR fsio-rt11 (1)
.SH AUTHOR
John Forecast, <[email protected]>
.br
Loading