Commit 86a54a48 authored by Jonathan Brassow's avatar Jonathan Brassow Committed by Alasdair G Kergon

dm log userspace: add version number to comms

This patch adds a 'version' field to the 'dm_ulog_request'
structure.

The 'version' field is taken from a portion of the unused
'padding' field in the 'dm_ulog_request' structure.  This
was done to avoid changing the size of the structure and
possibly disrupting backwards compatibility.

The version number will help notify user-space daemons
when a change has been made to the kernel/userspace
log API.
Signed-off-by: default avatarJonathan Brassow <jbrassow@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 085ae065
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "dm-log-userspace-transfer.h" #include "dm-log-userspace-transfer.h"
#define DM_LOG_USERSPACE_VSN "1.1.0"
struct flush_entry { struct flush_entry {
int type; int type;
region_t region; region_t region;
...@@ -765,7 +767,7 @@ static int __init userspace_dirty_log_init(void) ...@@ -765,7 +767,7 @@ static int __init userspace_dirty_log_init(void)
return r; return r;
} }
DMINFO("version 1.0.0 loaded"); DMINFO("version " DM_LOG_USERSPACE_VSN " loaded");
return 0; return 0;
} }
...@@ -775,7 +777,7 @@ static void __exit userspace_dirty_log_exit(void) ...@@ -775,7 +777,7 @@ static void __exit userspace_dirty_log_exit(void)
dm_ulog_tfr_exit(); dm_ulog_tfr_exit();
mempool_destroy(flush_entry_pool); mempool_destroy(flush_entry_pool);
DMINFO("version 1.0.0 unloaded"); DMINFO("version " DM_LOG_USERSPACE_VSN " unloaded");
return; return;
} }
......
...@@ -198,6 +198,7 @@ int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type, ...@@ -198,6 +198,7 @@ int dm_consult_userspace(const char *uuid, uint64_t luid, int request_type,
memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg)); memset(tfr, 0, DM_ULOG_PREALLOCED_SIZE - sizeof(struct cn_msg));
memcpy(tfr->uuid, uuid, DM_UUID_LEN); memcpy(tfr->uuid, uuid, DM_UUID_LEN);
tfr->version = DM_ULOG_REQUEST_VERSION;
tfr->luid = luid; tfr->luid = luid;
tfr->seq = dm_ulog_seq++; tfr->seq = dm_ulog_seq++;
......
...@@ -370,6 +370,16 @@ ...@@ -370,6 +370,16 @@
#define DM_ULOG_REQUEST_TYPE(request_type) \ #define DM_ULOG_REQUEST_TYPE(request_type) \
(DM_ULOG_REQUEST_MASK & (request_type)) (DM_ULOG_REQUEST_MASK & (request_type))
/*
* DM_ULOG_REQUEST_VERSION is incremented when there is a
* change to the way information is passed between kernel
* and userspace. This could be a structure change of
* dm_ulog_request or a change in the way requests are
* issued/handled. Changes are outlined here:
* version 1: Initial implementation
*/
#define DM_ULOG_REQUEST_VERSION 1
struct dm_ulog_request { struct dm_ulog_request {
/* /*
* The local unique identifier (luid) and the universally unique * The local unique identifier (luid) and the universally unique
...@@ -383,8 +393,9 @@ struct dm_ulog_request { ...@@ -383,8 +393,9 @@ struct dm_ulog_request {
*/ */
uint64_t luid; uint64_t luid;
char uuid[DM_UUID_LEN]; char uuid[DM_UUID_LEN];
char padding[7]; /* Padding because DM_UUID_LEN = 129 */ char padding[3]; /* Padding because DM_UUID_LEN = 129 */
uint32_t version; /* See DM_ULOG_REQUEST_VERSION */
int32_t error; /* Used to report back processing errors */ int32_t error; /* Used to report back processing errors */
uint32_t seq; /* Sequence number for request */ uint32_t seq; /* Sequence number for request */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment