Fix compilation warnings
authorFilippos Giannakos <philipgian@grnet.gr>
Mon, 4 Feb 2013 14:29:32 +0000 (16:29 +0200)
committerFilippos Giannakos <philipgian@grnet.gr>
Fri, 8 Feb 2013 13:44:12 +0000 (15:44 +0200)
xseg/drivers/kernel/xseg_posix.c
xseg/drivers/kernel/xseg_segdev.c
xseg/drivers/user/xseg_pthread.c
xseg/peers/kernel/xsegbd.c
xseg/peers/user/mt-sosd.c
xseg/peers/user/peer.h
xseg/peers/user/xseg-tool.c
xseg/sys/user/xseg_user.c
xseg/xtypes/xheap.c
xseg/xtypes/xobj.c

index 35f1f35..379ccaa 100644 (file)
@@ -84,6 +84,7 @@ static int posix_wait_signal(struct xseg *xseg, uint32_t timeout)
 
 static int posix_signal(struct xseg *xseg, uint32_t portno)
 {
 
 static int posix_signal(struct xseg *xseg, uint32_t portno)
 {
+       struct posix_signal_desc *psd;
        struct pid *pid;
        struct task_struct *task;
        int ret = -ENOENT;
        struct pid *pid;
        struct task_struct *task;
        int ret = -ENOENT;
@@ -92,7 +93,7 @@ static int posix_signal(struct xseg *xseg, uint32_t portno)
        if (!port) 
                return -1;
 
        if (!port) 
                return -1;
 
-       struct posix_signal_desc *psd = xseg_get_signal_desc(xseg, port);
+       psd = xseg_get_signal_desc(xseg, port);
        if (!psd)
                return -1;
 
        if (!psd)
                return -1;
 
index 585349d..1471807 100644 (file)
@@ -235,6 +235,7 @@ static int segdev_local_signal_init(struct xseg *xseg, xport portno)
 {
        //assert xsegments[portno] == NULL;
        xsegments[portno] = xseg;
 {
        //assert xsegments[portno] == NULL;
        xsegments[portno] = xseg;
+       return 0;
 }
 
 static void segdev_local_signal_quit(struct xseg *xseg, xport portno)
 }
 
 static void segdev_local_signal_quit(struct xseg *xseg, xport portno)
@@ -311,10 +312,11 @@ static void segdev_free_data(struct xseg *xseg, void *data)
 
 static void *segdev_alloc_signal_desc(struct xseg *xseg, void *data)
 {
 
 static void *segdev_alloc_signal_desc(struct xseg *xseg, void *data)
 {
+       struct segdev_signal_desc *ssd;
        struct xobject_h *sd_h = (struct xobject_h *) data;
        if (!sd_h)
                return NULL;
        struct xobject_h *sd_h = (struct xobject_h *) data;
        if (!sd_h)
                return NULL;
-       struct segdev_signal_desc *ssd = xobj_get_obj(sd_h, X_ALLOC);
+       ssd = xobj_get_obj(sd_h, X_ALLOC);
        if (!ssd)
                return NULL;
        ssd->waitcue = 0;
        if (!ssd)
                return NULL;
        ssd->waitcue = 0;
index 9fa0840..55168bc 100644 (file)
@@ -396,19 +396,19 @@ static struct xseg_type xseg_pthread = {
 };
 
 int pthread_init_signal_desc(struct xseg *xseg, void *sd)
 };
 
 int pthread_init_signal_desc(struct xseg *xseg, void *sd)
-{       
+{
        struct pthread_signal_desc *psd = (struct pthread_signal_desc *)sd;
        struct pthread_signal_desc *psd = (struct pthread_signal_desc *)sd;
-       xpool_init(&psd->waiters, MAX_WAITERS, &psd->bufs);
+       xpool_init(&psd->waiters, MAX_WAITERS, psd->bufs);
        xpool_clear(&psd->waiters, 1);
        return 0;
        xpool_clear(&psd->waiters, 1);
        return 0;
-}       
+}
 
 void pthread_quit_signal_desc(struct xseg *xseg, void *sd)
 
 void pthread_quit_signal_desc(struct xseg *xseg, void *sd)
-{       
+{
        struct pthread_signal_desc *psd = (struct pthread_signal_desc *)sd;
        xpool_clear(&psd->waiters, 1);
        return;
        struct pthread_signal_desc *psd = (struct pthread_signal_desc *)sd;
        xpool_clear(&psd->waiters, 1);
        return;
-}           
+}
 
 void * pthread_alloc_data(struct xseg *xseg)
 {
 
 void * pthread_alloc_data(struct xseg *xseg)
 {
index fede453..5060a1f 100644 (file)
@@ -531,6 +531,7 @@ int update_dev_sectors_from_request(        struct xsegbd_device *xsegbd_dev,
                                        struct xseg_request *xreq       )
 {
        void *data;
                                        struct xseg_request *xreq       )
 {
        void *data;
+       struct xseg_reply_info *xreply;
        if (!xreq) {
                XSEGLOG("Invalid xreq");
                return -EIO;
        if (!xreq) {
                XSEGLOG("Invalid xreq");
                return -EIO;
@@ -551,7 +552,7 @@ int update_dev_sectors_from_request(        struct xsegbd_device *xsegbd_dev,
                XSEGLOG("Invalid xsegbd_dev");
                return -ENOENT;
        }
                XSEGLOG("Invalid xsegbd_dev");
                return -ENOENT;
        }
-       struct xseg_reply_info *xreply = (struct xseg_reply_info *)data;
+       xreply = (struct xseg_reply_info *)data;
        xsegbd_dev->sectors = xreply->size / 512ULL;
        return 0;
 }
        xsegbd_dev->sectors = xreply->size / 512ULL;
        return 0;
 }
index b86b6b1..3bad72c 100644 (file)
@@ -41,6 +41,7 @@
 #include <xseg/protocol.h>
 #include <pthread.h>
 #include <openssl/sha.h>
 #include <xseg/protocol.h>
 #include <pthread.h>
 #include <openssl/sha.h>
+#include <ctype.h>
 
 #ifndef SHA256_DIGEST_SIZE
 #define SHA256_DIGEST_SIZE 32
 
 #ifndef SHA256_DIGEST_SIZE
 #define SHA256_DIGEST_SIZE 32
@@ -74,7 +75,7 @@ static void hexlify(unsigned char *data, char *hex)
         for (i=0; i<SHA256_DIGEST_LENGTH; i++)
                 sprintf(hex+2*i, "%02x", data[i]);
 }
         for (i=0; i<SHA256_DIGEST_LENGTH; i++)
                 sprintf(hex+2*i, "%02x", data[i]);
 }
-
+/*
 static void unhexlify(char *hex, unsigned char *data)
 {
         int i;
 static void unhexlify(char *hex, unsigned char *data)
 {
         int i;
@@ -111,7 +112,7 @@ static void unhexlify(char *hex, unsigned char *data)
                 data[i] |= c & 0x0F;
         }
 }
                 data[i] |= c & 0x0F;
         }
 }
-
+*/
 
 enum rados_state {
        ACCEPTED = 0,
 
 enum rados_state {
        ACCEPTED = 0,
index 2750dc7..efaf051 100644 (file)
@@ -120,7 +120,7 @@ void free_peer_req(struct peerd *peer, struct peer_req *pr);
 void get_submits_stats();
 void get_responds_stats();
 void usage();
 void get_submits_stats();
 void get_responds_stats();
 void usage();
-
+void print_req(struct xseg *xseg, struct xseg_request *req);
 #ifdef MT
 int thread_execute(struct peerd *peer, void (*func)(void *arg), void *arg);
 #endif
 #ifdef MT
 int thread_execute(struct peerd *peer, void (*func)(void *arg), void *arg);
 #endif
index 94e1e6c..1b0e502 100644 (file)
@@ -1070,7 +1070,7 @@ int cmd_submit_reqs(long loops, long concurrent_reqs, int op)
 
        struct xseg_request *submitted = NULL, *received;
        long nr_submitted = 0, nr_received = 0, nr_failed = 0, nr_mismatch = 0, nr_flying = 0;
 
        struct xseg_request *submitted = NULL, *received;
        long nr_submitted = 0, nr_received = 0, nr_failed = 0, nr_mismatch = 0, nr_flying = 0;
-       int reported = 0, r;
+       int r;
        uint64_t offset;
        uint32_t targetlen = 10, chunksize = 4096;
        struct timeval tv1, tv2;
        uint64_t offset;
        uint32_t targetlen = 10, chunksize = 4096;
        struct timeval tv1, tv2;
@@ -1097,7 +1097,6 @@ int cmd_submit_reqs(long loops, long concurrent_reqs, int op)
                        //FIXME
                        ++nr_flying;
                        nr_submitted += 1;
                        //FIXME
                        ++nr_flying;
                        nr_submitted += 1;
-                       reported = 0;
                        offset = 0;//pick(size);
 
                        submitted->offset = offset;
                        offset = 0;//pick(size);
 
                        submitted->offset = offset;
@@ -1886,7 +1885,7 @@ int main(int argc, char **argv)
 
                if (!strcmp(argv[i], "failreq") && (i + 1 < argc)) {
                        struct xseg_request *req;
 
                if (!strcmp(argv[i], "failreq") && (i + 1 < argc)) {
                        struct xseg_request *req;
-                       sscanf(argv[i+1], "%lx", &req);
+                       sscanf(argv[i+1], "%lx", (unsigned long *)&req);
                        ret = cmd_request(req, FAIL);
                        i += 1;
                        continue;
                        ret = cmd_request(req, FAIL);
                        i += 1;
                        continue;
index 155122f..cfc45b5 100644 (file)
@@ -44,7 +44,7 @@
 #include <errno.h>
 #include <sys/util.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <sys/util.h>
 #include <sys/time.h>
-
+#include <execinfo.h>
 #include <sys/domain.h>
 #include <xtypes/domain.h>
 #include <xseg/domain.h>
 #include <sys/domain.h>
 #include <xtypes/domain.h>
 #include <xseg/domain.h>
index 325c313..cbb2863 100644 (file)
@@ -180,13 +180,17 @@ void xheap_free(void *ptr)
 {
        struct xheap_header *h = __get_header(ptr);
        struct xheap *heap = XPTR(&h->heap);
 {
        struct xheap_header *h = __get_header(ptr);
        struct xheap *heap = XPTR(&h->heap);
+       void *mem;
+       uint64_t size;
+       int r;
+       xptr *free_list;
        if (h->magic != 0xdeadbeaf) {
                XSEGLOG("for ptr: %lx, magic %lx != 0xdeadbeaf", ptr, h->magic);
        }
        if (h->magic != 0xdeadbeaf) {
                XSEGLOG("for ptr: %lx, magic %lx != 0xdeadbeaf", ptr, h->magic);
        }
-       void *mem = XPTR(&heap->mem);
-       uint64_t size = xheap_get_chunk_size(ptr);
-       xptr *free_list = (xptr *) mem;
-       int r = __get_index(heap, size);
+       mem = XPTR(&heap->mem);
+       size = xheap_get_chunk_size(ptr);
+       free_list = (xptr *) mem;
+       r = __get_index(heap, size);
        //printf("size: %llu, r: %d\n", size, r);
        __add_in_free_list(heap, &free_list[r], ptr);
 //     printf("freed %lx (size: %llu)\n", ptr, __get_header(ptr)->size);
        //printf("size: %llu, r: %d\n", size, r);
        __add_in_free_list(heap, &free_list[r], ptr);
 //     printf("freed %lx (size: %llu)\n", ptr, __get_header(ptr)->size);
index 0857aea..51e768e 100644 (file)
@@ -229,15 +229,16 @@ int xobj_iterate(struct xobject_h *obj_h, struct xobject_iter *it, void **obj)
 //consistent wit obj_size
 int __xobj_check(struct xobject_h *obj_h, void *ptr)
 {
 //consistent wit obj_size
 int __xobj_check(struct xobject_h *obj_h, void *ptr)
 {
-       void *container = XPTR(&obj_h->container);
        xhash_iter_t it;
        uint64_t i, nr_objs;
        xhash_iter_t it;
        uint64_t i, nr_objs;
+       xhashidx key, val;
+       void *mem;
+       void *obj;
+       void *container = XPTR(&obj_h->container);
        xhash_t *allocated = XPTR_TAKE(obj_h->allocated, container);
        xhash_iter_init(allocated, &it);
        xhash_t *allocated = XPTR_TAKE(obj_h->allocated, container);
        xhash_iter_init(allocated, &it);
-       xhashidx key, val;
        while (xhash_iterate(allocated, &it, &key, &val)){
        while (xhash_iterate(allocated, &it, &key, &val)){
-               void *mem = XPTR_TAKE(key, container);
-               void *obj;
+               mem = XPTR_TAKE(key, container);
                nr_objs = xheap_get_chunk_size(mem)/obj_h->obj_size;
                for (i = 0; i < nr_objs; i++) {
                        obj = (void *) ((unsigned long) mem +
                nr_objs = xheap_get_chunk_size(mem)/obj_h->obj_size;
                for (i = 0; i < nr_objs; i++) {
                        obj = (void *) ((unsigned long) mem +
@@ -261,7 +262,6 @@ int xobj_check(struct xobject_h *obj_h, void *ptr)
 
 int __xobj_isFree(struct xobject_h *obj_h, void *ptr)
 {
 
 int __xobj_isFree(struct xobject_h *obj_h, void *ptr)
 {
-       int r = 0;
        void *container = XPTR(&obj_h->container);
        xptr node;
        struct xobject *obj;
        void *container = XPTR(&obj_h->container);
        xptr node;
        struct xobject *obj;