147489Spendry /* 247489Spendry * $Id: wr_dumpset.c,v 5.2.1.2 90/12/21 16:46:50 jsp Alpha $ 347489Spendry * 447489Spendry * Copyright (c) 1989 Jan-Simon Pendry 547489Spendry * Copyright (c) 1989 Imperial College of Science, Technology & Medicine 647489Spendry * Copyright (c) 1989 The Regents of the University of California. 747489Spendry * All rights reserved. 847489Spendry * 947489Spendry * This code is derived from software contributed to Berkeley by 1047489Spendry * Jan-Simon Pendry at Imperial College, London. 1147489Spendry * 12*47530Spendry * %sccs.include.redist.c% 1347489Spendry * 14*47530Spendry * @(#)wr_dumpset.c 5.2 (Berkeley) 03/17/91 1547489Spendry */ 1647489Spendry 1747489Spendry #include "../fsinfo/fsinfo.h" 1847489Spendry 1947489Spendry static int write_dumpset_info(ef, q) 2047489Spendry FILE *ef; 2147489Spendry qelem *q; 2247489Spendry { 2347489Spendry int errors = 0; 2447489Spendry disk_fs *dp; 2547489Spendry 2647489Spendry ITER(dp, disk_fs, q) { 2747489Spendry if (dp->d_dumpset) { 2847489Spendry fprintf(ef, "%s\t%s:%-30s\t# %s\n", 2947489Spendry dp->d_dumpset, 3047489Spendry dp->d_host->h_lochost ? 3147489Spendry dp->d_host->h_lochost : 3247489Spendry dp->d_host->h_hostname, 3347489Spendry dp->d_mountpt, 3447489Spendry dp->d_dev); 3547489Spendry } 3647489Spendry } 3747489Spendry return errors; 3847489Spendry } 3947489Spendry 4047489Spendry int write_dumpset(q) 4147489Spendry qelem *q; 4247489Spendry { 4347489Spendry int errors = 0; 4447489Spendry 4547489Spendry if (dumpset_pref) { 4647489Spendry FILE *ef = pref_open(dumpset_pref, "dumpsets", info_hdr, "exabyte dumpset"); 4747489Spendry if (ef) { 4847489Spendry host *hp; 4947489Spendry ITER(hp, host, q) { 5047489Spendry if (hp->h_disk_fs) { 5147489Spendry errors += write_dumpset_info(ef, hp->h_disk_fs); 5247489Spendry } 5347489Spendry } 5447489Spendry errors += pref_close(ef); 5547489Spendry } else { 5647489Spendry errors++; 5747489Spendry } 5847489Spendry } 5947489Spendry 6047489Spendry return errors; 6147489Spendry } 62