1*47489Spendry /*
2*47489Spendry  * $Id: wr_dumpset.c,v 5.2.1.2 90/12/21 16:46:50 jsp Alpha $
3*47489Spendry  *
4*47489Spendry  * Copyright (c) 1989 Jan-Simon Pendry
5*47489Spendry  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
6*47489Spendry  * Copyright (c) 1989 The Regents of the University of California.
7*47489Spendry  * All rights reserved.
8*47489Spendry  *
9*47489Spendry  * This code is derived from software contributed to Berkeley by
10*47489Spendry  * Jan-Simon Pendry at Imperial College, London.
11*47489Spendry  *
12*47489Spendry  * Redistribution and use in source and binary forms are permitted provided
13*47489Spendry  * that: (1) source distributions retain this entire copyright notice and
14*47489Spendry  * comment, and (2) distributions including binaries display the following
15*47489Spendry  * acknowledgement:  ``This product includes software developed by the
16*47489Spendry  * University of California, Berkeley and its contributors'' in the
17*47489Spendry  * documentation or other materials provided with the distribution and in
18*47489Spendry  * all advertising materials mentioning features or use of this software.
19*47489Spendry  * Neither the name of the University nor the names of its contributors may
20*47489Spendry  * be used to endorse or promote products derived from this software without
21*47489Spendry  * specific prior written permission.
22*47489Spendry  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
23*47489Spendry  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
24*47489Spendry  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25*47489Spendry  *
26*47489Spendry  *	@(#)wr_dumpset.c	5.1 (Berkeley) 03/17/91
27*47489Spendry  */
28*47489Spendry 
29*47489Spendry #include "../fsinfo/fsinfo.h"
30*47489Spendry 
31*47489Spendry static int write_dumpset_info(ef, q)
32*47489Spendry FILE *ef;
33*47489Spendry qelem *q;
34*47489Spendry {
35*47489Spendry 	int errors = 0;
36*47489Spendry 	disk_fs *dp;
37*47489Spendry 
38*47489Spendry 	ITER(dp, disk_fs, q) {
39*47489Spendry 		if (dp->d_dumpset) {
40*47489Spendry 			fprintf(ef, "%s\t%s:%-30s\t# %s\n",
41*47489Spendry 				dp->d_dumpset,
42*47489Spendry 				dp->d_host->h_lochost ?
43*47489Spendry 				dp->d_host->h_lochost :
44*47489Spendry 				dp->d_host->h_hostname,
45*47489Spendry 				dp->d_mountpt,
46*47489Spendry 				dp->d_dev);
47*47489Spendry 		}
48*47489Spendry 	}
49*47489Spendry 	return errors;
50*47489Spendry }
51*47489Spendry 
52*47489Spendry int write_dumpset(q)
53*47489Spendry qelem *q;
54*47489Spendry {
55*47489Spendry 	int errors = 0;
56*47489Spendry 
57*47489Spendry 	if (dumpset_pref) {
58*47489Spendry 		FILE *ef = pref_open(dumpset_pref, "dumpsets", info_hdr, "exabyte dumpset");
59*47489Spendry 		if (ef) {
60*47489Spendry 			host *hp;
61*47489Spendry 			ITER(hp, host, q) {
62*47489Spendry 				if (hp->h_disk_fs) {
63*47489Spendry 					errors += write_dumpset_info(ef, hp->h_disk_fs);
64*47489Spendry 				}
65*47489Spendry 			}
66*47489Spendry 			errors += pref_close(ef);
67*47489Spendry 		} else {
68*47489Spendry 			errors++;
69*47489Spendry 		}
70*47489Spendry 	}
71*47489Spendry 
72*47489Spendry 	return errors;
73*47489Spendry }
74