1afc15efbSpendry /*
2afc15efbSpendry  * Copyright (c) 1989 Jan-Simon Pendry
3afc15efbSpendry  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
4*ff516eb5Sbostic  * Copyright (c) 1989, 1993
5*ff516eb5Sbostic  *	The Regents of the University of California.  All rights reserved.
6afc15efbSpendry  *
7afc15efbSpendry  * This code is derived from software contributed to Berkeley by
8afc15efbSpendry  * Jan-Simon Pendry at Imperial College, London.
9afc15efbSpendry  *
1040bce266Spendry  * %sccs.include.redist.c%
11afc15efbSpendry  *
12*ff516eb5Sbostic  *	@(#)wr_dumpset.c	8.1 (Berkeley) 06/06/93
13278f1af9Spendry  *
1485d0f232Spendry  * $Id: wr_dumpset.c,v 5.2.2.1 1992/02/09 15:09:47 jsp beta $
15278f1af9Spendry  *
16afc15efbSpendry  */
17afc15efbSpendry 
18afc15efbSpendry #include "../fsinfo/fsinfo.h"
19afc15efbSpendry 
write_dumpset_info(ef,q)20afc15efbSpendry static int write_dumpset_info(ef, q)
21afc15efbSpendry FILE *ef;
22afc15efbSpendry qelem *q;
23afc15efbSpendry {
24afc15efbSpendry 	int errors = 0;
25afc15efbSpendry 	disk_fs *dp;
26afc15efbSpendry 
27afc15efbSpendry 	ITER(dp, disk_fs, q) {
28afc15efbSpendry 		if (dp->d_dumpset) {
29afc15efbSpendry 			fprintf(ef, "%s\t%s:%-30s\t# %s\n",
30afc15efbSpendry 				dp->d_dumpset,
31afc15efbSpendry 				dp->d_host->h_lochost ?
32afc15efbSpendry 				dp->d_host->h_lochost :
33afc15efbSpendry 				dp->d_host->h_hostname,
34afc15efbSpendry 				dp->d_mountpt,
35afc15efbSpendry 				dp->d_dev);
36afc15efbSpendry 		}
37afc15efbSpendry 	}
38afc15efbSpendry 	return errors;
39afc15efbSpendry }
40afc15efbSpendry 
write_dumpset(q)41afc15efbSpendry int write_dumpset(q)
42afc15efbSpendry qelem *q;
43afc15efbSpendry {
44afc15efbSpendry 	int errors = 0;
45afc15efbSpendry 
46afc15efbSpendry 	if (dumpset_pref) {
47afc15efbSpendry 		FILE *ef = pref_open(dumpset_pref, "dumpsets", info_hdr, "exabyte dumpset");
48afc15efbSpendry 		if (ef) {
49afc15efbSpendry 			host *hp;
50afc15efbSpendry 			ITER(hp, host, q) {
51afc15efbSpendry 				if (hp->h_disk_fs) {
52afc15efbSpendry 					errors += write_dumpset_info(ef, hp->h_disk_fs);
53afc15efbSpendry 				}
54afc15efbSpendry 			}
55afc15efbSpendry 			errors += pref_close(ef);
56afc15efbSpendry 		} else {
57afc15efbSpendry 			errors++;
58afc15efbSpendry 		}
59afc15efbSpendry 	}
60afc15efbSpendry 
61afc15efbSpendry 	return errors;
62afc15efbSpendry }
63