mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
dm snapshot: use DMEMIT macro for status
Use DMEMIT in place of snprintf. This makes it easier later when other modules are helping to populate our status output. Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
ccc45ea8ae
commit
2e4a31df2b
1 changed files with 10 additions and 9 deletions
|
@ -1214,24 +1214,25 @@ static void snapshot_resume(struct dm_target *ti)
|
||||||
static int snapshot_status(struct dm_target *ti, status_type_t type,
|
static int snapshot_status(struct dm_target *ti, status_type_t type,
|
||||||
char *result, unsigned int maxlen)
|
char *result, unsigned int maxlen)
|
||||||
{
|
{
|
||||||
|
unsigned sz = 0;
|
||||||
struct dm_snapshot *snap = ti->private;
|
struct dm_snapshot *snap = ti->private;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case STATUSTYPE_INFO:
|
case STATUSTYPE_INFO:
|
||||||
if (!snap->valid)
|
if (!snap->valid)
|
||||||
snprintf(result, maxlen, "Invalid");
|
DMEMIT("Invalid");
|
||||||
else {
|
else {
|
||||||
if (snap->store->type->fraction_full) {
|
if (snap->store->type->fraction_full) {
|
||||||
sector_t numerator, denominator;
|
sector_t numerator, denominator;
|
||||||
snap->store->type->fraction_full(snap->store,
|
snap->store->type->fraction_full(snap->store,
|
||||||
&numerator,
|
&numerator,
|
||||||
&denominator);
|
&denominator);
|
||||||
snprintf(result, maxlen, "%llu/%llu",
|
DMEMIT("%llu/%llu",
|
||||||
(unsigned long long)numerator,
|
(unsigned long long)numerator,
|
||||||
(unsigned long long)denominator);
|
(unsigned long long)denominator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snprintf(result, maxlen, "Unknown");
|
DMEMIT("Unknown");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1241,10 +1242,10 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
|
||||||
* to make private copies if the output is to
|
* to make private copies if the output is to
|
||||||
* make sense.
|
* make sense.
|
||||||
*/
|
*/
|
||||||
snprintf(result, maxlen, "%s %s %s %llu",
|
DMEMIT("%s", snap->origin->name);
|
||||||
snap->origin->name, snap->store->cow->name,
|
DMEMIT(" %s %s %llu", snap->store->cow->name,
|
||||||
snap->store->type->name,
|
snap->store->type->name,
|
||||||
(unsigned long long)snap->store->chunk_size);
|
(unsigned long long)snap->store->chunk_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue