.title AUTOMOUNT Mount ALL disks systemwide .sbttl Documentation .ident /V1.12/ ; ; This program MOUNTS all disks available on the system systemwide. ; This is for use in the system startup procedure on a system where ; acutal volumes and physical drive names will vary from startup to ; startup. ; ; Eric F. Richards ; 06-Mar-86 ; Gould OSD VAXcluster VAX/VMS V4.2 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; There is a check here to turn off mounting of certain classes ; of devices. To turn this off, comment out the next line. ; select = 0 ; ; Comment out this line if you want to know about drives that ; are already mounted. ; quiet = 0 ; ; Comment out the next line if you want to know about drives that ; are ignored by the automount IGNORE lines at the bottom of the ; program ; noignor = 0 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; .sbttl Macros and other constants .enabl suppression ; clean up the listings .dsabl traceback, debug ; hands off w/ debugger $ssdef ; define system service codes bufsiz = 1020 ; initial main buffer size dsksiz = 16 ; single disk buffer maxbuf = 65535 ; max char buffer (limited by arch) assume bufsiz le maxbuf ; if not, it'll not work right .sbttl Main Code .page .psect $code, long, exe, nowrt, pic, shr .entry automount, ^m movl #bufsiz, r9 ; set initial buffer size clrl -(sp) ; build a zeroed buffer for the context movl sp, r5 ; ...save a pointer to it subl #dsksiz, sp ; make room for a single name movl sp, r8 ; save ptr to it pushl sp ; build descr for it as well pushl #dsksiz ; size of the buffer movl sp, r7 ; save a ptr to it ; ; We loop back here if our buffer is too small to hold all the disks ; retry: subl3 r9, r7, sp ; make room for all the disks pushl sp ; build descr for it pushl r9 ; size of the buffer movl sp, r4 ; save a ptr to the descr ; ; Call GETDISKS to get the drives. This is the main loop. ; loop: movl #dsksiz, (r7) ; init disk name descriptor pushl r7 ; the disk length pushl r7 ; the disk name descr pushl r5 ; the usrbuf context pushl r4 ; the usrbuf descr calls #4, w^getdisks ; get the disk name cmpw #ss$_normal, r0 ; did we get it? beql 10$ ; if so, continue cmpw #ss$_ivbuflen, r0 ; buffer size problems? bnequ done ; if not, get out ashl #1, r9, r9 ; if so, double buffer size cmpl #maxbuf, r9 ; did we go too far? bgtr retry ; if so, error out brb done ; otherwise, reconstruct the buffers 10$: .if df select ; check for floppies on the system movl s^#namcnt-1, r6 ; set up loop counter 20$: moval b^devs[r6], r0 ; get a usable address matchc s^#namlen,(r0),(r7),(r8) ; check for match of bad devnames .if df noignor ; do we want to know about errors? beql notmnt ; don't mount on a match, gen error .endc ; .... .if ndf noignor ; else, beql loop ; loop back without a word .endc ; end of that condition sobgeq r6, 20$ ; loop until done .endc ; end of conditional assembly pushl r7 ; disk name descr calls #1, w^mountdev ; mount the disk blbs r0, loop ; on success, skip error section .sbttl Pseudo-error handler .page ; ; This prints out the error message (fatal or otherwise) ; and continues execution. This will print a generic message ; that will have an extra parameter: the device name. ; .if df quiet ; if quite-mounts are specified cmpw #ss$_devmount, r0 ; is the error because it's mounted? beql loop ; if so, go on quietly .endc ; end confitional assembly pushl r0 ; error message status pushl r7 ; argument to FAO pushl #1 ; number of args pushl #am_cantmount ; push generic error message header calls #4, b^error ; signal the error brw loop ; loop until done .if df select ; if we're ignoring certain drives, .if df noignor ; and we want to know about them, ; ; Then, generate an error for drives that are ignored. ; notmnt: pushl r7 ; this is the FAO arg pushl #1 ; 1 FAO arg for this message pushl #am_ignored ; error code is ignore the disks calls #3, b^error ; signal the error brw loop ; go back for the next disk .endc ; end if 2 .endc ; end if 1 done: cmpw #ss$_nosuchdev, r0 ; is this a normal exit? bneq 30$ ; if not, return with error movzwl #ss$_normal, r0 ; else, set success 30$: ret ; all done, go home! .sbttl Poor man's LIB$SIGNAL ; ; This is a handy little subroutine that lets the VAX procedure ; calling standard build the message vector for $putmsg and then ; get rid of it on return. Why use this instead of LIB$SIGNAL? I ; want to keep going, even after a "fatal" error. ; .align long ; be nice to the code error: .word 0 ; entry point, no reg's saved $putmsg_s msgvec=(ap) ; print error that CALLS built for us! ret ; and go back to the caller! .sbttl Drives to ignore .page .if df select ; do we ignore some drives? ; ; Each entry for the IGNORE macro must be just the two ; character prefix of the device type to ignore. ; .align long namcnt = 0 ; number of names namlen = 3 ; length of search string .macro ignore devnam ; macro for devices to ignore namcnt = namcnt + 2 ; increment NAMCNT .asciz /$'devnam'/ ; cluster form .asciz /_'devnam'/ ; local form .endm ignore ; that's it! devs: ignore DX ; RX01s ignore DY ; RX02s ignore DD ; TU58s 10$: assume <10$-devs> eq <4*namcnt>; worry check .endc ; end of ignorance! .end automount ; this is it!