1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix corelog segment line.

Suppress some compiler warnings.
This commit is contained in:
Alasdair Kergon 2006-05-16 16:20:29 +00:00
parent 20b4c02b89
commit 311d6d811b
3 changed files with 36 additions and 32 deletions

View File

@ -1,5 +1,7 @@
Version 1.02.08 - Version 1.02.08 -
============================= =============================
Fix corelog segment line.
Suppress some compiler warnings.
Version 1.02.07 - 11 May 2006 Version 1.02.07 - 11 May 2006
============================= =============================

View File

@ -1242,9 +1242,12 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin
log_parm_count = 1; /* Region size */ log_parm_count = 1; /* Region size */
log_parm_count += hweight32(seg->flags); /* [no]sync, block_on_error etc. */ log_parm_count += hweight32(seg->flags); /* [no]sync, block_on_error etc. */
if (seg->flags & DM_CORELOG)
log_parm_count--; /* DM_CORELOG does not count in the param list */
if (seg->clustered) { if (seg->clustered) {
if (seg->uuid && !(seg->flags & DM_CORELOG)) if (seg->uuid)
log_parm_count++; /* uuid (already counted for core log) */ log_parm_count++;
if ((tw = _dm_snprintf(params + pos, paramsize - pos, "clustered_")) < 0) { if ((tw = _dm_snprintf(params + pos, paramsize - pos, "clustered_")) < 0) {
stack; /* Out of space */ stack; /* Out of space */
return -1; return -1;

View File

@ -143,7 +143,7 @@ static int _parse_file(struct dm_task *dmt, const char *file)
return 0; return 0;
} }
while (fgets(buffer, buffer_size, fp)) { while (fgets(buffer, (int) buffer_size, fp)) {
#else #else
while (getline(&buffer, &buffer_size, fp) > 0) { while (getline(&buffer, &buffer_size, fp) > 0) {
#endif #endif
@ -321,7 +321,7 @@ static int _set_task_device(struct dm_task *dmt, const char *name, int optional)
return 1; return 1;
} }
static int _load(int argc, char **argv, void *data) static int _load(int argc, char **argv, void *data __attribute((unused)))
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
@ -378,7 +378,7 @@ static int _load(int argc, char **argv, void *data)
return r; return r;
} }
static int _create(int argc, char **argv, void *data) static int _create(int argc, char **argv, void *data __attribute((unused)))
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
@ -434,7 +434,7 @@ static int _create(int argc, char **argv, void *data)
return r; return r;
} }
static int _rename(int argc, char **argv, void *data) static int _rename(int argc, char **argv, void *data __attribute((unused)))
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
@ -463,7 +463,7 @@ static int _rename(int argc, char **argv, void *data)
return r; return r;
} }
static int _message(int argc, char **argv, void *data) static int _message(int argc, char **argv, void *data __attribute((unused)))
{ {
int r = 0, i; int r = 0, i;
size_t sz = 1; size_t sz = 1;
@ -523,7 +523,7 @@ static int _message(int argc, char **argv, void *data)
return r; return r;
} }
static int _setgeometry(int argc, char **argv, void *data) static int _setgeometry(int argc, char **argv, void *data __attribute((unused)))
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
@ -556,7 +556,7 @@ static int _setgeometry(int argc, char **argv, void *data)
return r; return r;
} }
static int _version(int argc, char **argv, void *data) static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{ {
char version[80]; char version[80];
@ -602,32 +602,32 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
return r; return r;
} }
static int _remove_all(int argc, char **argv, void *data) static int _remove_all(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{ {
return _simple(DM_DEVICE_REMOVE_ALL, "", 0, 0); return _simple(DM_DEVICE_REMOVE_ALL, "", 0, 0);
} }
static int _remove(int argc, char **argv, void *data) static int _remove(int argc, char **argv, void *data __attribute((unused)))
{ {
return _simple(DM_DEVICE_REMOVE, argc > 1 ? argv[1] : NULL, 0, 0); return _simple(DM_DEVICE_REMOVE, argc > 1 ? argv[1] : NULL, 0, 0);
} }
static int _suspend(int argc, char **argv, void *data) static int _suspend(int argc, char **argv, void *data __attribute((unused)))
{ {
return _simple(DM_DEVICE_SUSPEND, argc > 1 ? argv[1] : NULL, 0, 1); return _simple(DM_DEVICE_SUSPEND, argc > 1 ? argv[1] : NULL, 0, 1);
} }
static int _resume(int argc, char **argv, void *data) static int _resume(int argc, char **argv, void *data __attribute((unused)))
{ {
return _simple(DM_DEVICE_RESUME, argc > 1 ? argv[1] : NULL, 0, 1); return _simple(DM_DEVICE_RESUME, argc > 1 ? argv[1] : NULL, 0, 1);
} }
static int _clear(int argc, char **argv, void *data) static int _clear(int argc, char **argv, void *data __attribute((unused)))
{ {
return _simple(DM_DEVICE_CLEAR, argc > 1 ? argv[1] : NULL, 0, 1); return _simple(DM_DEVICE_CLEAR, argc > 1 ? argv[1] : NULL, 0, 1);
} }
static int _wait(int argc, char **argv, void *data) static int _wait(int argc, char **argv, void *data __attribute((unused)))
{ {
const char *name = NULL; const char *name = NULL;
@ -691,7 +691,7 @@ static void _display_dev(struct dm_task *dmt, const char *name)
printf("%s\t(%u, %u)\n", name, info.major, info.minor); printf("%s\t(%u, %u)\n", name, info.major, info.minor);
} }
static int _mknodes(int argc, char **argv, void *data) static int _mknodes(int argc, char **argv, void *data __attribute((unused)))
{ {
return dm_mknodes(argc > 1 ? argv[1] : NULL); return dm_mknodes(argc > 1 ? argv[1] : NULL);
} }
@ -847,7 +847,7 @@ static int _status(int argc, char **argv, void *data)
} }
/* Show target names and their version numbers */ /* Show target names and their version numbers */
static int _targets(int argc, char **argv, void *data) static int _targets(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{ {
int r = 0; int r = 0;
struct dm_task *dmt; struct dm_task *dmt;
@ -877,7 +877,6 @@ static int _targets(int argc, char **argv, void *data)
out: out:
dm_task_destroy(dmt); dm_task_destroy(dmt);
return r; return r;
} }
static int _info(int argc, char **argv, void *data) static int _info(int argc, char **argv, void *data)
@ -982,7 +981,7 @@ static int _deps(int argc, char **argv, void *data)
return r; return r;
} }
static int _display_name(int argc, char **argv, void *data) static int _display_name(int argc __attribute((unused)), char **argv __attribute((unused)), void *data)
{ {
struct dm_names *names = (struct dm_names *) data; struct dm_names *names = (struct dm_names *) data;
@ -1088,19 +1087,19 @@ static int _termwidth = 80; /* Maximum output width */
static int _cur_x = 1; /* Current horizontal output position */ static int _cur_x = 1; /* Current horizontal output position */
static char _last_char = 0; static char _last_char = 0;
static void _out_char(char c) static void _out_char(const unsigned c)
{ {
/* Only first UTF-8 char counts */ /* Only first UTF-8 char counts */
_cur_x += ((c & 0xc0) != 0x80); _cur_x += ((c & 0xc0) != 0x80);
if (!_tree_switches[TR_TRUNCATE]) { if (!_tree_switches[TR_TRUNCATE]) {
putchar(c); putchar((int) c);
return; return;
} }
/* Truncation? */ /* Truncation? */
if (_cur_x <= _termwidth) if (_cur_x <= _termwidth)
putchar(c); putchar((int) c);
if (_cur_x == _termwidth + 1 && ((c & 0xc0) != 0x80)) { if (_cur_x == _termwidth + 1 && ((c & 0xc0) != 0x80)) {
if (_last_char || (c & 0x80)) { if (_last_char || (c & 0x80)) {
@ -1114,7 +1113,7 @@ static void _out_char(char c)
} }
} }
static void _out_string(const char *str) static void _out_string(const unsigned char *str)
{ {
while (*str) while (*str)
_out_char(*str++); _out_char(*str++);
@ -1150,9 +1149,9 @@ static void _out_newline(void)
_cur_x = 1; _cur_x = 1;
} }
static void _out_prefix(int depth) static void _out_prefix(unsigned depth)
{ {
int x, d; unsigned x, d;
for (d = 0; d < depth; d++) { for (d = 0; d < depth; d++) {
for (x = _tree_width[d] + 1; x > 0; x--) for (x = _tree_width[d] + 1; x > 0; x--)
@ -1192,7 +1191,7 @@ static void _display_tree_attributes(struct dm_tree_node *node)
if (_tree_switches[TR_OPENCOUNT]) { if (_tree_switches[TR_OPENCOUNT]) {
_out_string(attr++ ? ", " : " ["); _out_string(attr++ ? ", " : " [");
(void) _out_int(info->open_count); (void) _out_int((unsigned) info->open_count);
} }
if (_tree_switches[TR_UUID]) { if (_tree_switches[TR_UUID]) {
@ -1205,8 +1204,8 @@ static void _display_tree_attributes(struct dm_tree_node *node)
} }
static void _display_tree_node(struct dm_tree_node *node, unsigned depth, static void _display_tree_node(struct dm_tree_node *node, unsigned depth,
unsigned first_child, unsigned last_child, unsigned first_child __attribute((unused)),
unsigned has_children) unsigned last_child, unsigned has_children)
{ {
int offset; int offset;
const char *name; const char *name;
@ -1287,7 +1286,7 @@ static void _tree_walk_children(struct dm_tree_node *node, unsigned depth)
dm_tree_node_num_children(child, inverted) ? 1 : 0; dm_tree_node_num_children(child, inverted) ? 1 : 0;
_display_tree_node(child, depth, first_child, _display_tree_node(child, depth, first_child,
next_child ? 0 : 1, has_children); next_child ? 0U : 1U, has_children);
if (has_children) if (has_children)
_tree_walk_children(child, depth + 1); _tree_walk_children(child, depth + 1);
@ -1296,11 +1295,11 @@ static void _tree_walk_children(struct dm_tree_node *node, unsigned depth)
} }
} }
static int _add_dep(int argc, char **argv, void *data) static int _add_dep(int argc __attribute((unused)), char **argv __attribute((unused)), void *data)
{ {
struct dm_names *names = (struct dm_names *) data; struct dm_names *names = (struct dm_names *) data;
if (!dm_tree_add_dev(_dtree, MAJOR(names->dev), MINOR(names->dev))) if (!dm_tree_add_dev(_dtree, (unsigned) MAJOR(names->dev), (unsigned) MINOR(names->dev)))
return 0; return 0;
return 1; return 1;
@ -1309,7 +1308,7 @@ static int _add_dep(int argc, char **argv, void *data)
/* /*
* Create and walk dependency tree * Create and walk dependency tree
*/ */
static int _tree(int argc, char **argv, void *data) static int _tree(int argc, char **argv, void *data __attribute((unused)))
{ {
if (!(_dtree = dm_tree_create())) if (!(_dtree = dm_tree_create()))
return 0; return 0;