|
|
* | * |
* Generate an ASCII constructor string for a snapshot target. | * Generate an ASCII constructor string for a snapshot target. |
* A snapshot string has the form: | * A snapshot string has the form: |
* <org_major>:<org_minor> <snap_major>:<snap_minor> <p|n> <chunk_size> <org_parent_major>:<org_parent_minor> |
* <org_major>:<org_minor> <snap_major>:<snap_minor> <p|n> <chunk_size> |
**/ | **/ |
static int snapshot_build_params(dm_target_t *target) | static int snapshot_build_params(dm_target_t *target) |
{ | { |
dm_target_snapshot_t *snapshot = target->data.snapshot; | dm_target_snapshot_t *snapshot = target->data.snapshot; |
char *format = (dm_get_version() == 3) ? | char *format = (dm_get_version() == 3) ? |
"%x:%x %x:%x %c %u %x:%x" : |
"%x:%x %x:%x %c %u" : |
"%u:%u %u:%u %c %u %u:%u"; |
"%u:%u %u:%u %c %u" ; |
int rc = ENOMEM; | int rc = ENOMEM; |
| |
LOG_PROC_ENTRY(); | LOG_PROC_ENTRY(); |
|
|
snprintf(target->params, 50, format, | snprintf(target->params, 50, format, |
snapshot->origin.major, snapshot->origin.minor, | snapshot->origin.major, snapshot->origin.minor, |
snapshot->snapshot.major, snapshot->snapshot.minor, | snapshot->snapshot.major, snapshot->snapshot.minor, |
(snapshot->persistent) ? 'p' : 'n', snapshot->chunk_size, |
(snapshot->persistent) ? 'p' : 'n', snapshot->chunk_size); |
snapshot->origin_parent.major, |
|
snapshot->origin_parent.minor); |
|
rc = 0; | rc = 0; |
} | } |
| |