summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog/src/changelog-encoders.c
diff options
context:
space:
mode:
authorAjeet Jha <ajha@redhat.com>2013-12-02 13:04:51 +0530
committerAnand Avati <avati@redhat.com>2013-12-12 00:15:45 -0800
commit8f2fc6fb3a63ca87d82b6fa933f94fb1e3283a26 (patch)
treec0efe5adc7fa78b5b11e4929999d8f9e459d39e1 /xlators/features/changelog/src/changelog-encoders.c
parent493008a299cd1197df0caee72eacd12c1a54606b (diff)
features/changelog: more changelog fixes.
-> log additional records. -> include FOP number for metadata. -> prevent crash if inode is not found in a fop. Change-Id: I9edd4b71819ebd68c6a2b4150ae279c471d129da BUG: 1036536 Signed-off-by: Ajeet Jha <ajha@redhat.com> Reviewed-on: http://review.gluster.org/6403 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@gmail.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog/src/changelog-encoders.c')
-rw-r--r--xlators/features/changelog/src/changelog-encoders.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/features/changelog/src/changelog-encoders.c b/xlators/features/changelog/src/changelog-encoders.c
index 553eec85c30..08626ee2f22 100644
--- a/xlators/features/changelog/src/changelog-encoders.c
+++ b/xlators/features/changelog/src/changelog-encoders.c
@@ -56,6 +56,24 @@ fop_fn (void *data, char *buffer, gf_boolean_t encode)
return bufsz;
}
+size_t
+number_fn (void *data, char *buffer, gf_boolean_t encode)
+{
+ size_t bufsz = 0;
+ unsigned int nr = 0;
+ char buf[20] = {0,};
+
+ nr = *(unsigned int *) data;
+
+ if (encode) {
+ (void) snprintf (buf, sizeof (buf), "%u", nr);
+ CHANGELOG_FILL_BUFFER (buffer, bufsz, buf, strlen (buf));
+ } else
+ CHANGELOG_FILL_BUFFER (buffer, bufsz, &nr, sizeof (unsigned int));
+
+ return bufsz;
+}
+
void
entry_free_fn (void *data)
{
@@ -94,6 +112,9 @@ changelog_encode_write_xtra (changelog_log_data_t *cld,
case CHANGELOG_OPT_REC_ENTRY:
data = &co->co_entry;
break;
+ case CHANGELOG_OPT_REC_UINT32:
+ data = &co->co_uint32;
+ break;
}
if (co->co_convert)