public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2011-11-23 1:34 agk
0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2011-11-23 1:34 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2011-11-23 01:34:38
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
(Note that in a future release we might make this stricter and insist
on exactly 'y' or 'n'.)
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2195&r2=1.2196
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122
--- LVM2/WHATS_NEW 2011/11/21 12:44:38 1.2195
+++ LVM2/WHATS_NEW 2011/11/23 01:34:38 1.2196
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Move y/n prompts to stderr and repeat if response has both 'n' and 'y'.
Replace the unit testing framework with CUnit (--enable-testing).
Fix dmeventd snapshot monitoring when multiple extensions were involved.
Don't ignore configure --mandir and --infodir.
--- LVM2/lib/display/display.c 2011/10/04 12:39:59 1.121
+++ LVM2/lib/display/display.c 2011/11/23 01:34:38 1.122
@@ -850,9 +850,10 @@
do {
if (c == '\n' || !c) {
va_start(ap, prompt);
- vprintf(prompt, ap);
+ vfprintf(stderr, prompt, ap);
va_end(ap);
- fflush(stdout);
+ fflush(stderr);
+ ret = 0;
}
if ((c = getchar()) == EOF) {
@@ -861,9 +862,14 @@
}
c = tolower(c);
- if ((c == 'y') || (c == 'n'))
- ret = c;
- } while (!ret || c != '\n');
+ if ((c == 'y') || (c == 'n')) {
+ /* If both 'y' and 'n' given, begin again. */
+ if (ret && c != ret)
+ ret = -1;
+ else
+ ret = c;
+ }
+ } while (ret < 1 || c != '\n');
sigint_restore();
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2012-02-13 14:23 zkabelac
0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2012-02-13 14:23 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-02-13 14:23:42
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Never try to test character past given buffer
In case units[0] would be already '\0', do not check units[1].
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2291&r2=1.2292
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.128&r2=1.129
--- LVM2/WHATS_NEW 2012/02/13 13:02:47 1.2291
+++ LVM2/WHATS_NEW 2012/02/13 14:23:40 1.2292
@@ -1,5 +1,6 @@
Version 2.02.92 -
====================================
+ Properly test buffer for unit check in units_to_bytes().
Add configure --with-systemdsystemunitdir.
Add check for allocation failure in _build_matcher().
Add check for rimage name allocation failure in _raid_add_images().
--- LVM2/lib/display/display.c 2012/01/26 14:02:43 1.128
+++ LVM2/lib/display/display.c 2012/02/13 14:23:41 1.129
@@ -60,7 +60,7 @@
v = 1;
/* Only one units char permitted. */
- if (*(units + 1))
+ if (units[0] && units[1])
return 0;
if (v == 1)
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2009-11-03 10:50 zkabelac
0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2009-11-03 10:50 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2009-11-03 10:50:57
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Add fflush for the case the log is redirected to the buffered file.
Without this patch it have not been obvious, why the application
waits on the stdin as the prompt might be still buffered in memory.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1310&r2=1.1311
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.106&r2=1.107
--- LVM2/WHATS_NEW 2009/10/31 17:43:57 1.1310
+++ LVM2/WHATS_NEW 2009/11/03 10:50:57 1.1311
@@ -1,5 +1,6 @@
Version 2.02.55 -
===================================
+ Flush stdout after yes/no prompt.
Update vgsplit and vgcreate to use vg_set_clustered.
Add vg_mda_count and vg_set_clustered library function.
Add more vgcreate and vgsplit nightly tests.
--- LVM2/lib/display/display.c 2009/10/26 10:01:57 1.106
+++ LVM2/lib/display/display.c 2009/11/03 10:50:57 1.107
@@ -824,6 +824,7 @@
va_start(ap, prompt);
vprintf(prompt, ap);
va_end(ap);
+ fflush(stdout);
}
if ((c = getchar()) == EOF) {
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2009-09-30 14:19 agk
0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2009-09-30 14:19 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2009-09-30 14:19:01
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Distinguish between powers of 1000 and powers of 1024 in unit suffixes.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1282&r2=1.1283
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.103&r2=1.104
--- LVM2/WHATS_NEW 2009/09/29 20:33:49 1.1282
+++ LVM2/WHATS_NEW 2009/09/30 14:19:00 1.1283
@@ -1,5 +1,6 @@
Version 2.02.54 -
=====================================
+ Distinguish between powers of 1000 and powers of 1024 in unit suffixes.
Restart lvconverts in vgchange by sharing lv_spawn_background_polling.
Generalise polldaemon code by changing mirror-specific variable names.
Don't attempt to deactivate an LV if any of its snapshots are in use.
--- LVM2/lib/display/display.c 2009/09/28 16:36:03 1.103
+++ LVM2/lib/display/display.c 2009/09/30 14:19:01 1.104
@@ -147,27 +147,56 @@
return ALLOC_INVALID;
}
+#define BASE_UNKNOWN 0
+#define BASE_SHARED 1
+#define BASE_1024 7
+#define BASE_1000 13
+#define BASE_SPECIAL 19
+#define NUM_UNIT_PREFIXES 6
+#define NUM_SPECIAL 3
+
/* Size supplied in sectors */
static const char *_display_size(const struct cmd_context *cmd,
uint64_t size, size_len_t sl)
{
- int s;
+ unsigned base = BASE_UNKNOWN;
+ unsigned s;
int suffix = 1, precision;
uint64_t byte = UINT64_C(0);
uint64_t units = UINT64_C(1024);
char *size_buf = NULL;
const char * const size_str[][3] = {
- {" Exabyte", " EB", "E"},
- {" Petabyte", " PB", "P"},
- {" Terabyte", " TB", "T"},
- {" Gigabyte", " GB", "G"},
- {" Megabyte", " MB", "M"},
- {" Kilobyte", " KB", "K"},
- {"", "", ""},
- {" Byte ", " B ", "B"},
- {" Units ", " Un", "U"},
- {" Sectors ", " Se", "S"},
- {" ", " ", " "},
+ /* BASE_UNKNOWN */
+ {" ", " ", " "}, /* [0] */
+
+ /* BASE_SHARED - Used if cmd->si_unit_consistency = 0 */
+ {" Exabyte", " EB", "E"}, /* [1] */
+ {" Petabyte", " PB", "P"}, /* [2] */
+ {" Terabyte", " TB", "T"}, /* [3] */
+ {" Gigabyte", " GB", "G"}, /* [4] */
+ {" Megabyte", " MB", "M"}, /* [5] */
+ {" Kilobyte", " KB", "K"}, /* [6] */
+
+ /* BASE_1024 - Used if cmd->si_unit_consistency = 1 */
+ {" Exbibyte", " EiB", "e"}, /* [7] */
+ {" Pebibyte", " PiB", "p"}, /* [8] */
+ {" Tebibyte", " TiB", "t"}, /* [9] */
+ {" Gibibyte", " GiB", "g"}, /* [10] */
+ {" Mebibyte", " MiB", "m"}, /* [11] */
+ {" Kibibyte", " KiB", "k"}, /* [12] */
+
+ /* BASE_1000 - Used if cmd->si_unit_consistency = 1 */
+ {" Exabyte", " EB", "E"}, /* [13] */
+ {" Petabyte", " PB", "P"}, /* [14] */
+ {" Terabyte", " TB", "T"}, /* [15] */
+ {" Gigabyte", " GB", "G"}, /* [16] */
+ {" Megabyte", " MB", "M"}, /* [17] */
+ {" Kilobyte", " kB", "K"}, /* [18] */
+
+ /* BASE_SPECIAL */
+ {" Byte ", " B ", "B"}, /* [19] */
+ {" Units ", " Un", "U"}, /* [20] */
+ {" Sectors ", " Se", "S"}, /* [21] */
};
if (!(size_buf = dm_pool_alloc(cmd->mem, SIZE_BUF))) {
@@ -177,30 +206,72 @@
suffix = cmd->current_settings.suffix;
- for (s = 0; s < 10; s++)
- if (toupper((int) cmd->current_settings.unit_type) ==
- *size_str[s][2])
- break;
+ if (!cmd->si_unit_consistency) {
+ /* Case-independent match */
+ for (s = 0; s < NUM_UNIT_PREFIXES; s++)
+ if (toupper((int) cmd->current_settings.unit_type) ==
+ *size_str[BASE_SHARED + s][2]) {
+ base = BASE_SHARED;
+ break;
+ }
+ } else {
+ /* Case-dependent match for powers of 1000 */
+ for (s = 0; s < NUM_UNIT_PREFIXES; s++)
+ if (cmd->current_settings.unit_type ==
+ *size_str[BASE_1000 + s][2]) {
+ base = BASE_1000;
+ break;
+ }
+
+ /* Case-dependent match for powers of 1024 */
+ if (base == BASE_UNKNOWN)
+ for (s = 0; s < NUM_UNIT_PREFIXES; s++)
+ if (cmd->current_settings.unit_type ==
+ *size_str[BASE_1024 + s][2]) {
+ base = BASE_1024;
+ break;
+ }
+ }
+
+ if (base == BASE_UNKNOWN)
+ /* Check for special units - s, b or u */
+ for (s = 0; s < NUM_SPECIAL; s++)
+ if (toupper((int) cmd->current_settings.unit_type) ==
+ *size_str[BASE_SPECIAL + s][2]) {
+ base = BASE_SPECIAL;
+ break;
+ }
if (size == UINT64_C(0)) {
- sprintf(size_buf, "0%s", suffix ? size_str[s][sl] : "");
+ if (base == BASE_UNKNOWN)
+ s = 0;
+ sprintf(size_buf, "0%s", suffix ? size_str[base + s][sl] : "");
return size_buf;
}
size *= UINT64_C(512);
- if (s < 10)
+ if (base != BASE_UNKNOWN)
byte = cmd->current_settings.unit_factor;
else {
- suffix = 1;
- if (cmd->current_settings.unit_type == 'H')
+ /* Human-readable style */
+ if (cmd->current_settings.unit_type == 'H') {
units = UINT64_C(1000);
- else
+ base = BASE_1000;
+ } else {
units = UINT64_C(1024);
+ base = BASE_1024;
+ }
+
+ if (!cmd->si_unit_consistency)
+ base = BASE_SHARED;
+
byte = units * units * units * units * units * units;
- s = 0;
- while (size_str[s] && size < byte)
- s++, byte /= units;
+
+ for (s = 0; s < NUM_UNIT_PREFIXES && size < byte; s++)
+ byte /= units;
+
+ suffix = 1;
}
/* FIXME Make precision configurable */
@@ -214,7 +285,7 @@
}
snprintf(size_buf, SIZE_BUF - 1, "%.*f%s", precision,
- (double) size / byte, suffix ? size_str[s][sl] : "");
+ (double) size / byte, suffix ? size_str[base + s][sl] : "");
return size_buf;
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2009-09-28 16:36 agk
0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2009-09-28 16:36 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2009-09-28 16:36:03
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Treat input units of both 's' and 'S' as 512-byte sectors. (2.02.49)
's' and 'S' are special suffixes representing sectors and are always 512 bytes,
regardless of whether you're using powers of 1000 or 1024.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1274&r2=1.1275
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.102&r2=1.103
--- LVM2/WHATS_NEW 2009/09/28 16:23:44 1.1274
+++ LVM2/WHATS_NEW 2009/09/28 16:36:03 1.1275
@@ -1,5 +1,6 @@
Version 2.02.54 -
=====================================
+ Treat input units of both 's' and 'S' as 512-byte sectors. (2.02.49)
Use standard output units for 'PE Size' and 'Stripe size' in pv/lvdisplay.
Add configure --enable-units-compat to set si_unit_consistency off by default.
Add global/si_unit_consistency to enable cleaned-up use of units in output.
--- LVM2/lib/display/display.c 2009/09/28 16:23:46 1.102
+++ LVM2/lib/display/display.c 2009/09/28 16:36:03 1.103
@@ -68,6 +68,7 @@
break;
#define KILO UINT64_C(1024)
case 's':
+ case 'S':
v *= (KILO/2);
break;
case 'k':
@@ -90,9 +91,6 @@
break;
#undef KILO
#define KILO UINT64_C(1000)
- case 'S':
- v *= (KILO/2);
- break;
case 'K':
v *= KILO;
break;
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2007-05-31 14:19 wysochanski
0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2007-05-31 14:19 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski@sourceware.org 2007-05-31 14:19:57
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Small fixes to pvdisplay --maps: 1) rename struct pv_segment vars from 'seg' to 'pvseg', 2) Change heading
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.622&r2=1.623
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
--- LVM2/WHATS_NEW 2007/05/30 20:43:08 1.622
+++ LVM2/WHATS_NEW 2007/05/31 14:19:57 1.623
@@ -1,6 +1,6 @@
Version 2.02.26 -
=================================
- Add --maps feature to pvdisplay, showing PE to LE mappings.
+ Add pvdisplay --maps implementation.
Fix vgcfgrestore man pg to show mandatory VG name and remove LVM1 options.
Fix vgrename man page to include UUID and be consistent with lvrename.
Add (experimental) OpenAIS support to clvmd.
--- LVM2/lib/display/display.c 2007/05/30 20:43:09 1.71
+++ LVM2/lib/display/display.c 2007/05/31 14:19:57 1.72
@@ -260,26 +260,26 @@
void pvdisplay_segments(struct physical_volume *pv)
{
- struct pv_segment *seg;
+ struct pv_segment *pvseg;
- log_print("--- Segments ---");
+ log_print("--- Physical Segments ---");
- list_iterate_items(seg, &pv->segments) {
- if (seg->len == pv->pe_count)
+ list_iterate_items(pvseg, &pv->segments) {
+ if (pvseg->len == pv->pe_count)
continue;
log_print("Physical extent %u to %u:",
- seg->pe, seg->pe + seg->len - 1);
+ pvseg->pe, pvseg->pe + pvseg->len - 1);
- if (seg->lvseg) {
+ if (pvseg->lvseg) {
log_print(" Type\t\t%s",
- seg->lvseg->segtype->ops->name(seg->lvseg));
+ pvseg->lvseg->segtype->ops->name(pvseg->lvseg));
log_print(" Logical volume\t%s%s/%s",
- seg->lvseg->lv->vg->cmd->dev_dir,
- seg->lvseg->lv->vg->name,
- seg->lvseg->lv->name);
+ pvseg->lvseg->lv->vg->cmd->dev_dir,
+ pvseg->lvseg->lv->vg->name,
+ pvseg->lvseg->lv->name);
log_print(" Logical extents\t%d to %d",
- seg->lvseg->le, seg->lvseg->le +
- seg->lvseg->len - 1);
+ pvseg->lvseg->le, pvseg->lvseg->le +
+ pvseg->lvseg->len - 1);
} else
log_print(" FREE");
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* LVM2 ./WHATS_NEW lib/display/display.c
@ 2004-05-28 12:47 agk
0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2004-05-28 12:47 UTC (permalink / raw)
To: lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2004-05-28 12:47:57
Modified files:
. : WHATS_NEW
lib/display : display.c
Log message:
Suppress decimal point when using units of sectors/bytes.
Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.54&r2=1.55
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-02-13 14:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 1:34 LVM2 ./WHATS_NEW lib/display/display.c agk
-- strict thread matches above, loose matches on Subject: below --
2012-02-13 14:23 zkabelac
2009-11-03 10:50 zkabelac
2009-09-30 14:19 agk
2009-09-28 16:36 agk
2007-05-31 14:19 wysochanski
2004-05-28 12:47 agk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).