Print this page
5819 want dumpadm(1m) option to print estimated dump size

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/swap.h>

@@ -517,10 +518,27 @@
                 warn(gettext("kernel image uuid write failed"));
 
         return (err == 0);
 }
 
+int
+dconf_get_dumpsize(dumpconf_t *dcp)
+{
+        char buf[32];
+        uint64_t d;
+
+        if (ioctl(dcp->dc_dump_fd, DIOCGETDUMPSIZE, &d) == -1) {
+                warn(gettext("failed to get kernel dump size"));
+                return (-1);
+        }
+
+        zfs_nicenum(d, buf, sizeof (buf));
+
+        (void) printf(gettext("Estimated dump size: %s\n"), buf);
+        return (0);
+}
+
 void
 dconf_print(dumpconf_t *dcp, FILE *fp)
 {
         u_longlong_t min;
         char *content;