File System Maintenance Utilities
%CONSTSTRING (21) VSN= "MAINT27 Vsn 1 Jun 88"
%CONSTSTRING (15) HELPFILE= "MANAGR.MAINT18S"
This document describes utilities for the maintenance and
repair of EMAS file systems.
Colin McCallum.
Tony Gibbons
Allusers
BADPAGES
Operation: Prompts for <Fsys (or -1)>
Effect: Generates a table giving details of the bad pages on
<fsys>
CCKOUT
Operation: Prompts for <fsys>.
Effect: Copies the data recording progress of file system
consistency checks, from the circular file maintained by
the DIRECT process into T#OUT. The maximum filesize
generated is 256K.
CHECKDAS
Operation: Prompts for <low page no:> and <Fsys (or -1)>
Effect: Calls 'TO DO ALL FILES' and for each file for each user for
each fsys calls DGETDA and, if the disc address of a section
is less than (low page no>, prints
user.file
CLEARNNT
Operation: Prompts for <fsys>
Effect: Zeros a NNT. It will be re-created automatically
and optimally at the next CCK.
COMMANDER
%EXTERNALROUTINE Commander %alias "C#COMMANDER"
%STRING(255)INLINE
%RECORDFORMAT PARMF(%INTEGER DEST, SRCE, P1, P2, P3, P4, P5, P6)
%EXTERNALINTEGERFNSPEC DPON(%RECORD(PARMF)%NAME P)
%EXTERNALINTEGERFNSPEC DTOFF(%RECORD(PARMF)%NAME P)
%CONSTINTEGER COMM AD = 31 << 20; ! COMMUNICATIONS AREA ADDRESS.
%ROUTINE PREC(%RECORD(PARMF)%NAME P)
PRINTSTRING("??? ")
PRINTSTRING(HTOS(P_DEST, 8)); SPACE
PRINTSTRING(HTOS(P_SRCE, 8)); SPACE
PRINTSTRING(HTOS(P_P1, 8)); SPACE
PRINTSTRING(HTOS(P_P2, 8)); SPACE
PRINTSTRING(HTOS(P_P3, 8)); SPACE
PRINTSTRING(HTOS(P_P4, 8)); SPACE
PRINTSTRING(HTOS(P_P5, 8)); SPACE
PRINTSTRING(HTOS(P_P6, 8)); NEWLINE
%END
%ROUTINE RSTRG(%STRINGNAME S)
%INTEGER I
S = ""
%CYCLE
READSYMBOL(I)
%RETURN %IF I = NL
I = I - 32 %IF 'a' <= I <= 'z'; ! uc translate
S = S.TOSTRING(I)
%REPEAT
%END; ! RSTRG
%ROUTINE PRINT PICTURE(%INTEGER PICTURE)
%CONSTSTRING (1) SNL = "
"
%STRING (40) LINE, machine
%INTEGERARRAYNAME TABLE
%INTEGERARRAYFORMAT TABLEF(0 : 43)
%INTEGER LINE AD, PIC AD, LENGTH, N, L
%INTEGERFN PROCESS
%RESULT = 0 %IF BYTEINTEGER(LINE AD+4) = ' ' %C
%AND BYTEINTEGER(LINE AD+17) = ' ' %C
%AND BYTEINTEGER(LINE AD+30) = ' ' %C
%AND N > 3
%RESULT = 1
%END; ! PROCESS.
TABLE == ARRAY(INTEGER(COMM AD+32),TABLEF); ! GPC TABLE.
PIC AD = 0
PIC AD = TABLE(3) %IF PICTURE = 'L'
PIC AD = TABLE(2) %IF PICTURE = 'P'
PRINTline(TOSTRING(PICTURE)."?") %AND %RETURN %IF PIC AD = 0
N = 0
LINE AD = ADDR(LINE)+1
LENGTH = INTEGER(PICAD)
PICAD = PICAD+8
PRINTSTRING(SNL)
%IF PICTURE = 'L' %START
LENGTH = LENGTH - 800
PIC AD = PIC AD + 800
%finish %else %start
machine = uinfs(16)
machine -> (".") . machine
machine = machine." "
%FINISH
%WHILE LENGTH > 0 %CYCLE
MOVE(40,PICAD,LINE AD)
L = 40
ETOI(LINE AD,L)
L = L - 1 %WHILE L > 0 %AND BYTEINTEGER(LINE AD + L - 1) = ' '
BYTEINTEGER(LINE AD - 1) = L
%if n = 0 %and picture = 'P' %start
move(8, addr(machine)+1, linead+2)
%finish
PRINTline(LINE) %UNLESS LINE = %C
" " %C
%OR (PICTURE = 'P' %AND PROCESS = 0)
LENGTH = LENGTH-40
PIC AD = PIC AD+40
N = N + 1
%REPEAT
%END; ! PRINT PICTURE
%STRINGFN FROM(%INTEGER SRCE)
%STRING(6)USER
%INTEGER P, Q, R
P = SRCE>>16-INTEGER(COMM AD + 132 {sync1dest})
%RESULT = "" %UNLESS 0 < p < 127
USER = " "
Q = (P-1)//3
R = P - 1 - 3 * Q
MOVE(6, INTEGER(INTEGER(COMM AD + 32)+4*2)+40*(Q+5)+13*R+12, ADDR(USER)+1)
ETOI(ADDR(USER)+1, 6)
UCTRANSLATE(ADDR(USER)+1, 6)
%RESULT = USER
%END; ! FROM
%ROUTINE PAGED PICTURE(%record(parmf)%name p)
%INTEGER SEG, GAP, J, ADR, LEN, MAX
%STRING(40)LINE
%string(6)user
%string(11)file
%integer fsys
user = from(p_srce)
file = string(addr(p_p4))
fsys = p_p2
SEG = 0
GAP = 0
J = DCONNECT(USER, FILE, FSYS, 9, SEG, GAP)
%IF J = 0 %OR J = 34 %START
ADR = SEG << 20 + 24
LEN = INTEGER(ADR)
ADR = ADR + 8
MAX = ADR + LEN
%WHILE ADR < MAX %CYCLE
MOVE(40, ADR, ADDR(LINE)+1)
LENGTH(LINE) = 40
PRINTline(LINE)
ADR = ADR + 40
%REPEAT
J = DDISCONNECT(USER, FILE, FSYS, 0) %IF J = 0
p_dest = p_srce
j = dpon(p)
%FINISH %ELSE %START
PRINTSTRING("Connect " . USER . ":" . FILE)
WRITE(J, 1)
NEWLINE
%FINISH
%END; ! PAGED PICTURE
%INTEGER J
%STRING(255) WS
%STRING(255)USER
%SWITCH ACT(1 : 31)
%RECORD(PARMF) P
%CYCLE
P_DEST = 0
J = DTOFF(P)
PREC(P)
USER = FROM(P_SRCE)
%UNLESS P_DEST = 0 %START
-> ACT(P_DEST&31)
%FINISH
PROMPT("Commander:")
RSTRG(IN LINE)
INLINE -> (" ") . INLINE %WHILE INLINE # "" %AND CHARNO(INLINE, 1) = ' '
%CONTINUE %IF IN LINE = ""
%RETURN %IF INLINE = "STOP"
%RETURN %IF INLINE = "QUIT"
%RETURN %IF INLINE = "Q"
%RETURN %IF INLINE = "END"
%RETURN %IF INLINE = "E"
%IF LENGTH(IN LINE) > 23 %START
PRINTSTRING("SORRY, ONLY 23 CHS")
NEWLINE
%CONTINUE
%FINISH
P_DEST = X'0032000E'
P_SRCE = 7
STRING(ADDR(P_P1)) = IN LINE
J = DPON(P)
%CONTINUE
ACT(1):
PRINTSTRING(STRING(ADDR(P_P1)))
%CONTINUE
ACT(6): ! DISPLAY A PAGED PICTURE
PAGED PICTURE(p)
%CONTINUE
ACT(7):
WS = STRING(ADDR(P_P1))
LENGTH(WS) = LENGTH(WS) & 127
PRINTSTRING(WS)
NEWLINE %UNLESS LENGTH(STRING(ADDR(P_P1))) > 127
P_DEST = X'320007'
P_SRCE = 0
J = DPON(P); ! UPDATE OPERLOG
%CONTINUE
ACT(8): ! PROMPT
WS = STRING(ADDR(P_P1))
PROMPT(WS)
RSTRG(IN LINE)
P_DEST = P_SRCE
P_SRCE = 7
LENGTH(IN LINE) = 22 %if length(in line) = 23
STRING(ADDR(P_P1)) = IN LINE . "
"
J = DPON(P)
%CONTINUE
ACT(19):
%IF P_P1 < 0 %C
%THEN PRINT PICTURE(BYTEINTEGER(ADDR(P_P3)+1)) %C
%ELSE PRINTSTRING("DISPLAY PICTURE ") %AND WRITE(P_P1,1)
NEWLINE
%CONTINUE
ACT(*):
PREC(P)
%CONTINUE
%REPEAT
%END; ! C
-----------------------------------------------------------------------
-----------------------------------------------------------------------
COPYINDEX
Operation: Prompts for <user>, <fsys>, <new user>, <new fsys>,
<new index size (Kbytes)>.
Effect: Creates a new index for <new user> on <new fsys>, unless
one already exists. Index attributes (delivery, basefile,
file limits etc.) are copied from the old to the new
index. For each file in the original index, the
corresponding file in the new index is destroyed (if it
exists), a file of the same name and of the same size is
created in the new index, and data are copied in from the
original file. The file is given the same attributes as
the original file.
Purpose: To run some important file system utilities (e.g. MOVE
INDEX) following corruption on a file system, it is
generally necessary to complete the file system
consistency check first. In the case where corruption has
occurred on the disc containing MANAGR (and hence the
utilities also), this can be difficult. If COPY INDEX is
used (say once per week, or after updates) to copy the
contents of MANAGR's index to a second disc, then the
utilities should be available to deal with the original
disc, even if the original MANAGR index is inaccessible.
In addition, the copied index forms an on-line backup of
the original.
CREATELOGFILE
Operation: Prompts for <user>, <fsys> and <logfile>
Effect: Creates <logfile>, permits it to MANAGR, initialises
<logfile> as a circular file and calls DSFI to set
the LOGFILE field in <user>s index. The contents
of the file are made available by LOGOUT (q.v.)
DELUSER
Operation: Prompts for <user> and <fsys>
Effect: Deletes the file index for <user> on <fsys>, hence
removing <user> from the System. This routine requires
the user to confirm the username to be deleted before actually
doing so. If <fsys> is given as -1 then all occurrences
of the given username will be deleted automatically.
If not then all other fsys's will be searched for
other occurrences of the username. Any found will be reported
and the user asked if they should also be deleted.
DEREGISTERCLASS
Operation: Prompts for a "base" username, e.g. ERCC01 (in which the
last two characters are decimal digits), <fsys> and a
number, N, of usernames to be deleted.
Effect: The "base" username and N-1 consecutive usernames (last
two digits being incremented) are deleted from the System.
(Equivalent to repeated calls of DELUSER, q.v.)
DIRLOG
Operation: No parameters
Effect: Copies the information from DIRECTORS
monitoring file VOLUMS.#DIRLOG into a character file T#OUT
which can then be further edited if desired.
DOALLINDEXES
Skeleton routine a copy of which can be used to surround
code which is meant to be executed for all indexes on an fsys.
DUMPNNT
Operation: Prompts for <fsys>
Effect: Lists the entries that are in use
ENV
Operation: No parameters
Effect: Prints the current Supervisor and Director versions, the
process number of the calling user and the discs currently
on-line. (N.B. The first disc specified is the SLOAD disc.)
FIRSTPAGES
FSYSSTART
Operation: Prompts for <fsys>
Effect: Prints the range of pages available for files on <fsys>
GET
Operation: Prompts for <what>, <user> and <fsys>
Reports the value or values of the index attribute specified
(Some have multiple values associated).
For the significance of the index attribute, current Director
documentation on the function DSFI should be consulted for
all except PRIVILEGES. See SET for a full description of
available PRIVILEGES.
GETDA
Operation: Prompts for <user>, <fsys> and <file>
Effect: Prints the address of each disc section
GETS
Operation: Prompts for the name of a DSFI field and a username
which may include ?s
Effect: Prints any interesting values found
HOLESHIST
Operation: Prompts for <fsys>
Effect: Generates a histogram showing how many free areas there
are of each size (1 to 32 Epages) on <fsys> and how
many sections
HOWFRAG
Operation: Prompts for <fsys> (or -1)
Effect: Calculates the degree of fragmentation on specified <fsys>
The degree of fragmentation is defined to be the percentage
of the total disc space available for user files which
is occupied by sections which have sizes less than a full
section. (i.e. 1 to 31 Epages)
HOWFULL
Operation: Prompts for <fsys>.
Effect: Reports the current fullness (%) of the specified <fsys>.
(The figure reported when the System is open to users is
not strictly comparable with the corresponding figures
given by the FCHECK process at System start-up, in that a
considerable quantity of temporary file-space will be
included in the figure for a running System.)
INACTIVEUSERS
Operation: Prompts for <trigger date> in the format DD/MM/YY and
<op file/dev>
Effect: Produces a sorted table (oldest to youngest) of entries
of the form date process last used, user, fsys,
surname and delivery info of those users who have not
accessed their process since the trigger date.
J
Operation: If called without a parameter, analyses JOURNL:JJ#PD
thereby giving a list of members. If called with a
parameter <m>, LOOKs at JOURNL:JJ#PD_<m>
LISTNNT
Operation: Prompts for <FSYS>, <SORT TYPE>, <USERNAMES> - if all
FSYS option selected - and <FILE/DEV>.
Effect: A list of usernames accredited on <fsys> (if specified -
otherwise all on-line file systems), together with leading
file index attributes (file limits, process concurrency
limits, file space etc.) is placed in <file or device>.
If the single FSYS option is selected then the
sorting can be by index no or by username. If on the other hand
all on line file systems are selected the sorting may be alphabetic
by username or surname or both. Optionally in this case a file
called USERNAMES may be created or updated in the calling
process. This file contains a directory of usernames sorted by
surname.
LOGOUT
Operation: Prompts for <user> and <fsys>
Effect: Connects <user>s logfile, if it exists, and copies
it to T#OUT (see 'CREATE LOG FILE')
LOSTFILES
Operation: Prompts for <fsys>
Effect: Lists the contents of VOLUMS.LOSTFILES on <fsys>
MOVEINDEX
Operation: Prompts for <user>, <fsys>, <new fsys>,
<new index size (Kbytes)>.
Effect: The program first checks <fsys> and <new fsys>. If these
are different then the routine will operate in COPY mode
when copies are made of the files on <fsys> to <new fsys>.
When <fsys> and <new fsys> are the same then the program
can potentially operate in two modes COPY or TRANSFER. In
TRANSFER mode the files are not copied, ownership is merely
transferred. This route is faster but less safe in that
a crash occurring during file transfer will leave two
partial indexes and possibly result in the loss of files.
In practice the TRANSFER route is only obligatory if there
is not sufficient space on the disc to hold a copy of
all the <user>'s files. The routine checks whether this
is possible given the current state of the disc and if so
offers <C/T?> to the caller otherwise the move can only
proceed via the TRANSFER route.
After mode has been decided a new index of <new index size>
named NEWZZZ is first created on <new fsys> and <user>'s index
is renamed to OLDZZZ. The <user>'s index attributes are
then copied to the new index, and all the files are
transferred or copied from the old to the new index.
If the mode was COPY then at this point a final chance
is offered to the caller to abandon the move with no side
effects. If the response is to continue or mode is TRANSFER
then finally the OLDZZZ index is deleted and the NEWZZZ index is
renamed to belong to <user>. Note that if the original
index was corrupted, or if some files are marked as being
in use (either because the owner's process had terminated
in disorder or because the owner or other users are
actually using the files), then the program reports the
number of files it is unable to transfer and prompts
"Continue?", before commencing the index move.
If the reply is "N" or "NO" the move is abandoned, with no
side-effects. If the reply is "Y" or "YES" those files
which cannot be transferred are lost when the original
index is deleted. In general it is preferable not to
proceed with the operation if it is likely that one or
more files are actually in use by a currently existing
process. The file pages which are actually in use will
not be re-used before the next IPL, but the process(es)
using the file(s) will be unable to disconnect the files.
Purposes: One or more of the following:
1) To transfer as many files as possible from a corrupted
index into a new index.
2) To move an index onto a different disc.
3) To change the size of an index.
Apart from possible software errors, indexes become
corrupt mainly when a hardware error or machine stop
occurs during updating of an index. Corruption is often
first noticed during the file system consistency check at
System start-up, when the message
<user> CORRUPT? FSYS <fsys> or
<user> CELLS? FSYS <fsys>
is given at the main OPER. In the former case the System
remains closed to users until explicity opened, preferably
following a move (or re-creation) of the affected
index(es). The latter message indicates that some
list-cells are not attached to any list, correction is not
normally urgent.
If the System is inadvertently or otherwise opened and
processes are started following a "CORRUPT?" message, the
affected indexes should be destroyed, and the users
re-accreditted, corruption of other users' files could
otherwise occur.
MOVEINDEXES
Operation: Prompts for <from fsys> and <to fsys>
Effect: Moves each users index on <from fsys> to <to fsys>
with the exception of SPOOLR and VOLUMS
MULTIMOVE
Operation: Prompts for a full filename, <from fsys> and <to fsys>
Effect: Connects the file which should contain a simple list
of user names, one per line, terminated by ZZZZZZ.
Calls MOVE INDEX for each user. Can be interrupted
with Int: STOP
MYLOG
Operation: No params
Effect: Copies ones own circular logfile to T#OUT
NEWUSER
Operation: The program prompts for the following data:
Username
File system
Index size (Kbytes) (reply 4 or 8, for about 70 or 140
files respectively)
Mark (reply 0 for OLD index, 1 for NEW)
Initials and surname
Delivery information
Foreground password (4 chars)
Background password (4 chars).
Maximum total filespace (Kbytes)
Maximum single filesize (Kbytes)
Maximum process concurrencies allowed for the user, for
interactive, batch and total numbers of processes.
Effect: A new user with the specified attributes is created.
REFRESHFILE
Operation: Prompts for <user>, <fsys> and <file>
Effect: Forces a resiting of <file> owned by <user> on <fsys>.
REFRESHFILES
Operation: Prompts for <low page no> and <fsys>
Effect: Will resite all files on <fsys> which have sections whose
disc addresses are less than <low page no>.
Used ,for example, in reformatting a disc as a system disc.
REFRESHINDEX
Operation: Prompts for <user> and <fsys>.
Effect: Equivalent to MOVE INDEX with oldfsys = newfsys, old index
size = new index size and MODE = TRANSFER.
Resites an index on the same <fsys> with the same attributes.
See MOVE INDEX.
N.B. Should not be done on the same <fsys> as the routine
is running from.
REFRESHINDEXES
Operation: Prompts for <fsys>.
Effect: Does a REFRESH INDEX for each user on the <fsys> specified.
REGISTERCLASS
Operation: Prompts for a "base" username (in which the last two
characters are decimal digits), e.g. ERCC01, <fsys> and a
number N of usernames to be accreditted. The program
further prompts for
File system
Index size (Kbytes) (reply 4 or 8, for about 70 or 140
files respectively)
Initials and Surname
Delivery information
Password (sets the 4 characters input as both
foreground and background passwords)
Maximum total filespace (Kbytes)
Maximum single filesize (Kbytes)
Maximum process concurrencies allowed for the user, for
interactive, batch and total numbers of processes.
Effect: The "base" username and N-1 consecutive usernames (last
two digits being incremented) are accreditted to the
System, all with the same process details as input
initially. The program reports each username successfully
accreditted, if any username cannot be accreditted (e.g.
because the file system index area is full, or because the
username already exists) the program terminates at that
point.
RELOCATE
Operation: Prompts for <fsys>
Effect: 'Relocates' last sections of files which are 'badly'
placed on disc, ie has the effect of compacting the
disc.
RENAMEINDEX
Operation: Prompts for <user>, <fsys> and <newname>
Effect: Calls 'DRENAME INDEX'
RESTORENNT
Operation: Prompts for <fsys>
Effect: Replaces the NNT with the contents of file N#NT<fsys>,
presumably saved from an earlier call of OPTNNT
RETELL
%EXTERNALROUTINE RETELL %alias "C#RETELL"
Transcribes a #MSG file to T#OUT
SECURE
%EXTERNALROUTINE SECURE %alias "C#SECURE"
Scans for users with privileges
SET
Operation: Prompts for <what>, <user>, <fsys> and <new value>
(or <new values> as appropriate to the fields)
Effect: <what> is one of
ACR ADDRTELE AFILES
ARCHINDUSE BASEFILE BATCHSS
CODES CONNECTT CONTROLFILE
CUMINSTRS CUMMSECS CUMPTRNS
CURRPROCS DEFAULTLP DELIVERY
DINSTRS DIRMON DIRVSN
FILES FUNDS GPFSYS
GPHOLDR INDEXUSE ISESSM
LASTLOGON LOGFILE MAXFILE
MAXKB MAXPROCS NKBIN
NKBOUT PRIVILEGES SESSINSTRS
SESSMSECS SESSPTRNS SIGMON
SPECIALSS STKKB SURNAME
Sets the new value or values of the index attribute specified
Some have multiple values associated and will prompt appropriately.
For the significance of the index attribute, current Director
documentation on the function DSFI should be consulted for
all except PRIVILEGES which are described below.
Note that in some cases it is not sensible and in other cases
not permitted to SET certain attributes. See current DSFI
documentation.
PRIVILEGES.
It is possible to SET or GET PRIVILEGES. If the operation
is GET then the individual PRIVILEGES enjoyed by <user> will
either be listed in the form PRIVxx where 0 <= xx <= 31 or
if none are enjoyed, given as *NONE*.
If the operation is SET then the current PRIVILEGES are first
given as for GET then the caller is prompted <PRIV:>. This
should be responded to by a reply of the form PRIVxx where
0 <= xx <= 31 (spaces are not significant). The caller is then
prompted <G/R:> and the appropriate reply should be given
depending on whether the PRIVILEGE is to be given or removed.
This sequence continues until the reply .END is received to
<PRIV:> when the new set of PRIVILEGES is reported.
PRIVILEGES currently available are as follows:
PRIV 04 DPRINTSTRING, DDUMP
PRIV 06 Use of chargeable FTP
PRIV 07 DSFI 7
PRIV 08 DPERMISSION, DFINFO, DFSTATUS, DFILENAMES on other
users' files
PRIV 09 DCHECKBPASS
PRIV 10 DSFI for privileged calls and DSETPASSWORD other users
PRIV 12 Ability to set BASEFILE, CONTROLFILE, TESTBASEFILE
and BATCHBASEFILE
PRIV 14 Use of DDAP
PRIV 15 Interactive use of magnetic tapes (DMAGCLAIM)
PRIV 17 DSFI 38
PRIV 18 DPON, DPON3, DOUT, DOUT11, DOUT18, DTOFF, DLOCK
PRIV 20 BADPAGE, DSYSAD, FBASE, GETAVFSYS
PRIV 22 ACREATE2, DMODARCH, DNEWARCHINDEX
PRIV 24 DCONNECT, DDISCONNECT on # files
PRIV 25 DPRG, DUNPRG, DTRANSFER, DOFFER
PRIV 26 DEMPTYI, DRENAMEINDEX, DNEWUSER, DDELUSER,
VALIND, DDUMPI, DXDUMPI, GETUSNAMES
PRIV 31 Allows ADESTROY, DCHSIZE, DCREATE, DDESTROY,
DNEWGEN, DRENAME to be used on someone else's file
without full index permission
SETDIR
Operation: Prompts for <n> in the range 0-3
Effect: Sets ones own process to run on that Director at the
next process start
SETHNOARCH
Operation: Prompts for <fsys> (or -1).
Effect: For each user on <fsys> sets the NOARCH bit in file
descriptor of file #ARCH.
SETMSGEEP
Operation: Prompts for <fsys> (or -1).
Effect: For each user on <fsys> sets EEP to 11 in file descriptors
of files #ARCH and #MSG.
SS
%externalroutine SS %alias "C#SS"
STATUSNNT
Operation: Prompts for <fsys>
Effect: Analyses the NNT on <fsys> and prints a histogram of
the path lengths required to reach each user
UINFRECORD
Operation: No parameters
Effect: Prints a selection of fields from ones UINF record
WHATFILE
Operation: The program prompts for <disc address> and <fsys>.
Effect: File system <fsys> is searched for the file(s), if any, to
which epage number <disc address> belongs. If <fsys> is
specified as -1 then all file systems are searched. The
filenames, if any, are reported.