summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/changelog/lib/examples/c/get-changes.c6
-rw-r--r--xlators/features/changelog/lib/examples/c/get-history.c6
-rw-r--r--xlators/features/changelog/lib/examples/python/changes.py3
-rw-r--r--xlators/features/changelog/lib/examples/python/libgfchangelog.py8
4 files changed, 21 insertions, 2 deletions
diff --git a/xlators/features/changelog/lib/examples/c/get-changes.c b/xlators/features/changelog/lib/examples/c/get-changes.c
index 0b2808c7e35..ef766c566b6 100644
--- a/xlators/features/changelog/lib/examples/c/get-changes.c
+++ b/xlators/features/changelog/lib/examples/c/get-changes.c
@@ -39,6 +39,12 @@ main (int argc, char ** argv)
ssize_t changes = 0;
char fbuf[PATH_MAX] = {0,};
+ ret = gf_changelog_init (NULL);
+ if (ret) {
+ handle_error ("Init failed");
+ goto out;
+ }
+
/* get changes for brick "/home/vshankar/export/yow/yow-1" */
ret = gf_changelog_register ("/export/z1/zwoop",
"/tmp/scratch", "/tmp/change.log", 9, 5);
diff --git a/xlators/features/changelog/lib/examples/c/get-history.c b/xlators/features/changelog/lib/examples/c/get-history.c
index 2e1ff3c767f..ee3ec0ad100 100644
--- a/xlators/features/changelog/lib/examples/c/get-history.c
+++ b/xlators/features/changelog/lib/examples/c/get-history.c
@@ -40,6 +40,12 @@ main (int argc, char ** argv)
char fbuf[PATH_MAX] = {0,};
unsigned long end_ts = 0;
+ ret = gf_changelog_init (NULL);
+ if (ret) {
+ handle_error ("init failed");
+ goto out;
+ }
+
ret = gf_changelog_register ("/export/z1/zwoop",
"/tmp/scratch_v1", "/tmp/changes.log",
9, 5);
diff --git a/xlators/features/changelog/lib/examples/python/changes.py b/xlators/features/changelog/lib/examples/python/changes.py
index d21db8eab2e..221df642a36 100644
--- a/xlators/features/changelog/lib/examples/python/changes.py
+++ b/xlators/features/changelog/lib/examples/python/changes.py
@@ -10,6 +10,7 @@ cl = libgfchangelog.Changes()
def get_changes(brick, scratch_dir, log_file, log_level, interval):
change_list = []
try:
+ cl.cl_init()
cl.cl_register(brick, scratch_dir, log_file, log_level)
while True:
cl.cl_scan()
@@ -25,7 +26,7 @@ def get_changes(brick, scratch_dir, log_file, log_level, interval):
print ex
if __name__ == '__main__':
- if len(sys.argv) != 5:
+ if len(sys.argv) != 6:
print("usage: %s <brick> <scratch-dir> <log-file> <fetch-interval>"
% (sys.argv[0]))
sys.exit(1)
diff --git a/xlators/features/changelog/lib/examples/python/libgfchangelog.py b/xlators/features/changelog/lib/examples/python/libgfchangelog.py
index 68ec3baf144..10e73c02b34 100644
--- a/xlators/features/changelog/lib/examples/python/libgfchangelog.py
+++ b/xlators/features/changelog/lib/examples/python/libgfchangelog.py
@@ -3,7 +3,7 @@ from ctypes import *
from ctypes.util import find_library
class Changes(object):
- libgfc = CDLL(find_library("gfchangelog"), use_errno=True)
+ libgfc = CDLL(find_library("gfchangelog"), mode=RTLD_GLOBAL, use_errno=True)
@classmethod
def geterrno(cls):
@@ -19,6 +19,12 @@ class Changes(object):
return getattr(cls.libgfc, call)
@classmethod
+ def cl_init(cls):
+ ret = cls._get_api('gf_changelog_init')(None)
+ if ret == -1:
+ cls.raise_changelog_err()
+
+ @classmethod
def cl_register(cls, brick, path, log_file, log_level, retries = 0):
ret = cls._get_api('gf_changelog_register')(brick, path,
log_file, log_level, retries)