mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
o fix get_word
o capy name in when registering targets o change _line_splitter so it expects the process functions to return zero on success
This commit is contained in:
parent
9d4aaf49c1
commit
a548e9cc40
@ -258,7 +258,7 @@ static int _get_word(const char *b, const char *e,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*wb = b;
|
*wb = b;
|
||||||
while(b != e && !isspace((int) b))
|
while(b != e && !isspace((int) *b))
|
||||||
b++;
|
b++;
|
||||||
*we = b;
|
*we = b;
|
||||||
return 1;
|
return 1;
|
||||||
@ -267,6 +267,7 @@ static int _get_word(const char *b, const char *e,
|
|||||||
static int _line_splitter(struct file *file, const char *buffer,
|
static int _line_splitter(struct file *file, const char *buffer,
|
||||||
unsigned long count, void *data)
|
unsigned long count, void *data)
|
||||||
{
|
{
|
||||||
|
int r;
|
||||||
const char *b = buffer, *e = buffer + count, *lb;
|
const char *b = buffer, *e = buffer + count, *lb;
|
||||||
struct pf_data *pfd = (struct pf_data *) data;
|
struct pf_data *pfd = (struct pf_data *) data;
|
||||||
|
|
||||||
@ -279,8 +280,8 @@ static int _line_splitter(struct file *file, const char *buffer,
|
|||||||
while((b != e) && *b != '\n')
|
while((b != e) && *b != '\n')
|
||||||
b++;
|
b++;
|
||||||
|
|
||||||
if (!pfd->fn(lb, b, pfd->minor))
|
if ((r = pfd->fn(lb, b, pfd->minor)))
|
||||||
return lb - buffer;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -61,7 +61,9 @@ int register_map_target(const char *name, dm_ctr_fn ctr,
|
|||||||
return -1; /* FIXME: what's a good return value ? */
|
return -1; /* FIXME: what's a good return value ? */
|
||||||
}
|
}
|
||||||
|
|
||||||
t->name = name;
|
t->name = (char *) t + 1;
|
||||||
|
strcpy(t->name, name);
|
||||||
|
|
||||||
t->ctr = ctr;
|
t->ctr = ctr;
|
||||||
t->dtr = dtr;
|
t->dtr = dtr;
|
||||||
t->map = map;
|
t->map = map;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user