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