aboutsummaryrefslogtreecommitdiff
path: root/sys/fmio/fmrebuild.x
blob: 9eb55656f3e4479c110f601248503e86cd438a0a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# FM_REBUILD -- Rebuild a datafile.  This has no affect on the logical content
# of a datafile, but is desirable for efficiency reasons to eliminate waste
# space (e.g., from deleted lfiles), and render the file structures logically
# contiguous within the file, increasing i/o access efficiency.

procedure fm_rebuild (dfname)

char	dfname[ARB]		#I datafile name

pointer	sp, tfname
errchk	fm_copy, fm_delete, fm_rename

begin
	call smark (sp)
	call salloc (tfname, SZ_PATHNAME, TY_CHAR)

	# The copy operation rebuilds a datafile.
	call mktemp (dfname, Memc[tfname], SZ_PATHNAME)
	call fm_copy (dfname, Memc[tfname])
	call fm_delete (dfname)
	call fm_rename (Memc[tfname], dfname)

	call sfree (sp)
end