aboutsummaryrefslogtreecommitdiff
path: root/sys/mtio/mtdealloc.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/mtio/mtdealloc.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mtio/mtdealloc.x')
-rw-r--r--sys/mtio/mtdealloc.x35
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/mtio/mtdealloc.x b/sys/mtio/mtdealloc.x
new file mode 100644
index 00000000..2f98a972
--- /dev/null
+++ b/sys/mtio/mtdealloc.x
@@ -0,0 +1,35 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <error.h>
+
+# MTDEALLOCATE -- Deallocate a previously allocated tape drive. To deallocate
+# a drive we try to rewind (any errors, such as drive offline, will result in a
+# warning message), and then delete the lockfile. We do not call up the OS to
+# deallocate the drive; that is done at a higher level, usually XDEALLOCATE
+# (in etc$xalloc.x).
+
+procedure mtdeallocate (mtname, rewind_tape)
+
+char mtname[ARB] #I magtape specification
+int rewind_tape #I rewind before deallocating drive
+
+pointer sp, lockfile
+errchk mt_glock, syserrs
+
+begin
+ call smark (sp)
+ call salloc (lockfile, SZ_FNAME, TY_CHAR)
+
+ if (rewind_tape == YES)
+ iferr (call mtrewind (mtname, NO))
+ call erract (EA_WARN)
+
+ call mt_sync (OK)
+
+ call mt_glock (mtname, Memc[lockfile], SZ_FNAME)
+ iferr (call delete (Memc[lockfile]))
+ ;
+
+ call mt_clrcache()
+ call sfree (sp)
+end