From 656db3a8e0601ba0a6af303b971111fbbed29906 Mon Sep 17 00:00:00 2001 From: Lalatendu Mohanty Date: Sun, 13 Oct 2013 15:08:10 -0400 Subject: libgfapi: Fix to compilation failure/warnings for examples/glfsxmp.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comilation of glfsxmp.c i.e. "make glfsxmp" was failing with "undefined reference to `clock_gettime'" error. Fixed all compilation warnings for unused variables and wrong formart specifier in printf e.g. : "format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘__syscall_slong_t’ [-Wformat]" Also added the compilation steps for glfsxmp.c in the README file Change-Id: I399ec7c9ad7b6412463c89099d63922caef6749e Signed-off-by: Lalatendu Mohanty Reviewed-on: http://review.gluster.org/6085 Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Santosh Pradhan Tested-by: Shyamsundar Ranganathan Reviewed-by: Vijay Bellur --- api/examples/glfsxmp.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'api/examples/glfsxmp.c') diff --git a/api/examples/glfsxmp.c b/api/examples/glfsxmp.c index 8231a3949f0..8566183af1f 100644 --- a/api/examples/glfsxmp.c +++ b/api/examples/glfsxmp.c @@ -65,8 +65,6 @@ int test_chdir (glfs_t *fs) { int ret = -1; - ino_t ino = 0; - struct stat st; char *topdir = "/topdir"; char *linkdir = "/linkdir"; char *subdir = "./subdir"; @@ -342,7 +340,7 @@ out: void test_h_getsetattrs (void) { - char *my_dir = "attrdir", *full_dir_path="/testdir/attrdir"; + char *my_dir = "attrdir"; char *my_file = "attrfile.txt"; struct glfs_object *parent = NULL, *leaf = NULL, *dir = NULL; struct stat sb, retsb; @@ -440,7 +438,7 @@ test_h_truncate (void) char *my_dir = "truncatedir"; char *my_file = "file.txt"; struct glfs_object *root = NULL, *parent = NULL, *leaf = NULL; - struct stat sb, retsb; + struct stat sb; glfs_fd_t *fd = NULL; char buf[32]; off_t offset = 0; @@ -571,7 +569,7 @@ out: void test_h_links (void) { - char *my_dir = "linkdir", *full_dir_path="/testdir/linkdir"; + char *my_dir = "linkdir"; char *my_file = "file.txt"; char *my_symlnk = "slnk.txt"; char *my_lnk = "lnk.txt"; @@ -580,8 +578,8 @@ test_h_links (void) struct glfs_object *root = NULL, *parent = NULL, *leaf = NULL, *dirsrc = NULL, *dirtgt = NULL, *dleaf = NULL; struct glfs_object *ln1 = NULL; - struct stat sb, retsb; - int ret, valid; + struct stat sb; + int ret; char *buf = NULL; printf("glfs_h_link(s) tests: In Progress\n"); @@ -719,15 +717,14 @@ out: void test_h_rename (void) { - char *my_dir = "renamedir", - *full_dir_path="/testdir/renamedir"; + char *my_dir = "renamedir"; char *my_file = "file.txt"; char *src_dir = "dir1"; char *tgt_dir = "dir2"; struct glfs_object *root = NULL, *parent = NULL, *leaf = NULL, *dirsrc = NULL, *dirtgt = NULL, *dleaf = NULL; - struct stat sb, retsb; - int ret, valid; + struct stat sb; + int ret; printf("glfs_h_rename tests: In Progress\n"); @@ -898,8 +895,8 @@ test_h_performance (void) *full_dir_path="/testdir/perftest"; char *my_file = "file_", my_file_name[MAXPATHNAME]; struct glfs_object *parent = NULL, *leaf = NULL, *dir = NULL; - struct stat sb, retsb; - int ret, valid, i; + struct stat sb; + int ret, i; struct glfs_fd *fd; struct timespec c_ts = {0, 0}, c_ts_st, c_ts_ed; struct timespec o_ts = {0, 0}, o_ts_st, o_ts_ed; @@ -982,9 +979,9 @@ test_h_performance (void) printf ("Creation performance (handle based):\n\t# empty files:%d\n", MAX_FILES_CREATE); - printf ("\tOverall time:\n\t\tSecs:%d\n\t\tnSecs:%d\n", + printf ("\tOverall time:\n\t\tSecs:%ld\n\t\tnSecs:%ld\n", o_ts.tv_sec, o_ts.tv_nsec); - printf ("\tcreate call time time:\n\t\tSecs:%d\n\t\tnSecs:%d\n", + printf ("\tcreate call time time:\n\t\tSecs:%ld\n\t\tnSecs:%ld\n", c_ts.tv_sec, c_ts.tv_nsec); /* create using path */ @@ -1058,9 +1055,9 @@ test_h_performance (void) printf ("Creation performance (path based):\n\t# empty files:%d\n", MAX_FILES_CREATE); - printf ("\tOverall time:\n\t\tSecs:%d\n\t\tnSecs:%d\n", + printf ("\tOverall time:\n\t\tSecs:%ld\n\t\tnSecs:%ld\n", o_ts.tv_sec, o_ts.tv_nsec); - printf ("\tcreate call time time:\n\t\tSecs:%d\n\t\tnSecs:%d\n", + printf ("\tcreate call time time:\n\t\tSecs:%ld\n\t\tnSecs:%ld\n", c_ts.tv_sec, c_ts.tv_nsec); out: return; -- cgit