summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLalatendu Mohanty <lmohanty@redhat.com>2013-10-13 15:08:10 -0400
committerVijay Bellur <vbellur@redhat.com>2013-10-16 00:55:50 -0700
commit656db3a8e0601ba0a6af303b971111fbbed29906 (patch)
treefc3089e5e0e98e62a662f1e721af7a2fe5016f9f
parent0c129ad25c007d574e9c7e45f47e6ba7075f4bfa (diff)
libgfapi: Fix to compilation failure/warnings for examples/glfsxmp.c
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 <lmohanty@redhat.com> Reviewed-on: http://review.gluster.org/6085 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Tested-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--api/examples/Makefile.am2
-rw-r--r--api/examples/README17
-rw-r--r--api/examples/glfsxmp.c31
3 files changed, 32 insertions, 18 deletions
diff --git a/api/examples/Makefile.am b/api/examples/Makefile.am
index cfb0d3dff84..05f40ff53ed 100644
--- a/api/examples/Makefile.am
+++ b/api/examples/Makefile.am
@@ -1,6 +1,6 @@
EXTRA_PROGRAMS = glfsxmp
glfsxmp_SOURCES = glfsxmp.c
glfsxmp_CFLAGS = $(GLFS_CFLAGS) -Wall
-glfsxmp_LDADD = $(GLFS_LIBS)
+glfsxmp_LDADD = $(GLFS_LIBS) -lrt
EXTRA_DIST = gfapi.py
diff --git a/api/examples/README b/api/examples/README
index 8f0bab697d3..4d2b521f779 100644
--- a/api/examples/README
+++ b/api/examples/README
@@ -17,3 +17,20 @@ install glusterfs-api RPM.
Make sure your LDFLAGS includes -L/path/to/lib where libgfapi.so is
installed and -I/path/to/include/glusterfs where the 'api' directory
containing the headers are available.
+
+glfsxmp.c
+=========
+
+glfsxmp.c is an example application which uses libgfapi
+
+Compilation Steps For glfsxmp.c
+===============================
+
+1. $./autogen.sh
+2. $./configure
+
+Note: Before running ./configure , as mentioned above, you need to
+ take care of #1 or #2 i.e. pkg-config path or LDFLAGS and
+ -I/<path> with correct values.
+
+3. $make glfsxmp
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;