diff options
author | Greg Lehey <grog@FreeBSD.org> | 1999-03-02 07:01:26 +0000 |
---|---|---|
committer | Greg Lehey <grog@FreeBSD.org> | 1999-03-02 07:01:26 +0000 |
commit | 04898b56e9a630deb87c570e55c330d4f293c8da (patch) | |
tree | 50171ca1e54b12e030d3c02d99741a24c8978369 /sbin/vinum/list.c | |
parent | 5e2b0861ec6f182f953afabe8015482a3add2c5f (diff) | |
download | src-04898b56e9a630deb87c570e55c330d4f293c8da.tar.gz src-04898b56e9a630deb87c570e55c330d4f293c8da.zip |
Change the format of the lists to reflect loss of pid field.
Show open state as a flag.
vinum_ldi: Show available space in short form listing.
Notes
Notes:
svn path=/head/; revision=44415
Diffstat (limited to 'sbin/vinum/list.c')
-rw-r--r-- | sbin/vinum/list.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/sbin/vinum/list.c b/sbin/vinum/list.c index 94f117cfbf60..20046244358d 100644 --- a/sbin/vinum/list.c +++ b/sbin/vinum/list.c @@ -175,11 +175,19 @@ vinum_ldi(int driveno, int recurse) printf("\t\t%9qd\t%9ld\n", freelist.offset, freelist.sectors); } } - } else - printf("D %-21s State: %s\tDevice %s\n", + } else { + printf("D %-21s State: %s\tDevice %s\tAvail: %qd/%qd MB", drive.label.name, drive_state(drive.state), - drive.devicename); + drive.devicename, + drive.sectors_available * DEV_BSIZE / MEGABYTE, + (drive.label.drive_size / MEGABYTE)); + if (drive.label.drive_size == 0) + printf("\n"); /* can't print percentages */ + else + printf(" (%d%%)\n", + (int) ((drive.sectors_available * 100 * DEV_BSIZE) / drive.label.drive_size)); + } if (stats) { printf("\t\tReads: \t%16qd\n\t\tBytes read:\t%16qd (%s)\n", drive.reads, @@ -230,12 +238,12 @@ vinum_lvi(int volno, int recurse) if (vol.state != volume_unallocated) { if (verbose) { printf("Volume %s:\tSize: %qd bytes (%qd MB)\n" - "\t\tState: %s\n\t\tOpen by PID: %d\n\t\tFlags: %s%s\n", + "\t\tState: %s\n\t\tFlags: %s%s%s\n", vol.name, ((long long) vol.size) * DEV_BSIZE, ((long long) vol.size) * DEV_BSIZE / MEGABYTE, volume_state(vol.state), - vol.pid, + vol.flags & VF_OPEN ? "open " : "", (vol.flags & VF_WRITETHROUGH ? "writethrough " : ""), (vol.flags & VF_RAW ? "raw" : "")); printf("\t\t%d plexes\n\t\tRead policy: ", vol.plexes); @@ -727,7 +735,6 @@ vinum_printconfig(int argc, char *argv[], char *argv0[]) struct utsname uname_s; time_t now; int i; - int j; struct volume vol; struct plex plex; struct sd sd; @@ -737,6 +744,10 @@ vinum_printconfig(int argc, char *argv[], char *argv0[]) fprintf(stderr, "Usage: \tprintconfig <outfile>\n"); return; } + if (ioctl(superdev, VINUM_GETCONFIG, &vinum_conf) < 0) { + perror("Can't get vinum config"); + return; + } of = fopen(argv[0], "w"); if (of == NULL) { fprintf(stderr, "Can't open %s: %s\n", argv[0], strerror(errno)); @@ -764,21 +775,20 @@ vinum_printconfig(int argc, char *argv[], char *argv0[]) if (vol.state != volume_unallocated) { if (vol.preferred_plex >= 0) /* preferences, */ fprintf(of, - "volume %s readpol prefer %s", + "volume %s readpol prefer %s\n", vol.name, vinum_conf.plex[vol.preferred_plex].name); else /* default round-robin */ - fprintf(of, "volume %s", vol.name); + fprintf(of, "volume %s\n", vol.name); } } /* Then the plex configuration */ for (i = 0; i < vinum_conf.plexes_used; i++) { - get_volume_info(&vol, i); + get_plex_info(&plex, i); if (plex.state != plex_unallocated) { - fprintf(of, "plex name %s state %s org %s ", + fprintf(of, "plex name %s org %s ", plex.name, - plex_state(plex.state), plex_org(plex.organization)); if ((plex.organization == plex_striped) || (plex.organization == plex_raid5)) { @@ -788,10 +798,6 @@ vinum_printconfig(int argc, char *argv[], char *argv0[]) get_volume_info(&vol, plex.volno); fprintf(of, "vol %s ", vol.name); } - for (j = 0; j < plex.subdisks; j++) { - get_plex_sd_info(&sd, i, j); - fprintf(of, " sd %s", sd.name); - } fprintf(of, "\n"); } } |