All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs-backend: fix compile problems
@ 2009-03-18 12:03 Stefano Stabellini
  2009-03-18 14:03 ` Boris Derzhavets
  0 siblings, 1 reply; 14+ messages in thread
From: Stefano Stabellini @ 2009-03-18 12:03 UTC (permalink / raw)
  To: xen-devel

Hi all,
this patch removes some unused variables and replaces read and write
to the pipe with read_exact and write_exact (these two functions are
implemented in libxc, that we have to link anyway).

This allows fs-backed to be compiled with -D_FORTIFY_SOURCE=2, hence
should fix the problems reported by Boris.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

diff -r 9fc957e63f8d tools/fs-back/fs-backend.c
--- a/tools/fs-back/fs-backend.c	Tue Mar 17 15:40:25 2009 +0000
+++ b/tools/fs-back/fs-backend.c	Wed Mar 18 12:00:10 2009 +0000
@@ -9,6 +9,7 @@
 #include <sys/select.h>
 #include <sys/socket.h>
 #include <xen/io/ring.h>
+#include <xc_private.h>
 #include <err.h>
 #include "sys-queue.h"
 #include "fs-backend.h"
@@ -181,7 +182,6 @@
 {
     struct fs_mount *mount;
     struct fs_export *export;
-    int evt_port;
     struct fsif_sring *sring;
     uint32_t dom_ids[MAX_RING_SIZE];
     int i;
@@ -335,12 +335,8 @@
         }
         if (FD_ISSET(pipefds[0], &fds)) {
             struct fs_request *request;
-            int ret;
-            ret = read(pipefds[0], &request, sizeof(struct fs_request *));
-            if (ret != sizeof(struct fs_request *)) {
-                fprintf(stderr, "read request failed\n");
-                continue;
-            }
+            if (read_exact(pipefds[0], &request, sizeof(struct fs_request *)) < 0)
+                err(1, "read request failed\n");
             handle_aio_event(request); 
         }
         LIST_FOREACH(pointer, &mount_requests_head, entries) {
@@ -379,7 +375,8 @@
 {
     struct fs_request *request = (struct fs_request*) info->si_value.sival_ptr;
     int saved_errno = errno;
-    write(pipefds[1], &request, sizeof(struct fs_request *));
+    if (write_exact(pipefds[1], &request, sizeof(struct fs_request *)) < 0)
+        err(1, "write request filed\n");
     errno = saved_errno;
 }
 
diff -r 9fc957e63f8d tools/fs-back/fs-ops.c
--- a/tools/fs-back/fs-ops.c	Tue Mar 17 15:40:25 2009 +0000
+++ b/tools/fs-back/fs-ops.c	Wed Mar 18 12:00:10 2009 +0000
@@ -49,7 +49,6 @@
 {
     char *file_name, full_path[BUFFER_SIZE];
     int fd;
-    struct timeval tv1, tv2;
     RING_IDX rsp_idx;
     fsif_response_t *rsp;
     uint16_t req_id;
@@ -127,7 +126,7 @@
 static void dispatch_file_read(struct fs_mount *mount, struct fsif_request *req)
 {
     void *buf;
-    int fd, i, count;
+    int fd, count;
     uint16_t req_id;
     unsigned short priv_id;
     struct fs_request *priv_req;
@@ -169,7 +168,6 @@
     priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
     assert(aio_read(&priv_req->aiocb) >= 0);
 
-out: 
     /* We can advance the request consumer index, from here on, the request
      * should not be used (it may be overrinden by a response) */
     mount->ring.req_cons++;
@@ -198,7 +196,7 @@
 static void dispatch_file_write(struct fs_mount *mount, struct fsif_request *req)
 {
     void *buf;
-    int fd, count, i;
+    int fd, count;
     uint16_t req_id;
     unsigned short priv_id;
     struct fs_request *priv_req;
@@ -268,7 +266,6 @@
 
 static void dispatch_stat(struct fs_mount *mount, struct fsif_request *req)
 {
-    struct fsif_stat_response *buf;
     struct stat stat;
     int fd, ret;
     uint16_t req_id;

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH] fs-backend: fix compile problems
@ 2009-03-18 16:24 Boris Derzhavets
  2009-03-18 16:41 ` Boris Derzhavets
  0 siblings, 1 reply; 14+ messages in thread
From: Boris Derzhavets @ 2009-03-18 16:24 UTC (permalink / raw)
  To: Stefano Stabellini, Keir Fraser; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 6897 bytes --]

Most probably changeset 19382 brought it up

Boris

--- On Wed, 3/18/09, Boris Derzhavets <bderzhavets@yahoo.com> wrote:
From: Boris Derzhavets <bderzhavets@yahoo.com>
Subject: Re: [Xen-devel] [PATCH] fs-backend: fix compile problems
To: "Stefano Stabellini" <Stefano.Stabellini@eu.citrix.com>, "Keir Fraser" <keir.fraser@eu.citrix.com>
Cc: "xen-devel" <xen-devel@lists.xensource.com>
Date: Wednesday, March 18, 2009, 12:13 PM

The most recent Xen Unstable installed:-
make xen OK
make install-xen OK
make tools 


gcc  -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF .xc_domain_restore.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -I../../xen/common/libelf -Werror -Wmissing-prototypes  -I. -I../xenstore -I../include -c -o xc_domain_restore.o xc_domain_restore.c
gcc  -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF .xc_domain_save.o.d  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -I../../xen/common/libelf -Werror
 -Wmissing-prototypes  -I. -I../xenstore -I../include -c -o xc_domain_save.o xc_domain_save.c
cc1: warnings being treated as errors
xc_domain_save.c: In function ‘lock_suspend_event’:
xc_domain_save.c:764: error: ignoring return value of ‘write’, declared with attribute warn_unused_result
make[4]: *** [xc_domain_save.o] Error 1
make[4]: Leaving directory `/usr/src/xen-unstable.hg/tools/libxc'
make[3]: *** [build] Error 2
make[3]: Leaving directory `/usr/src/xen-unstable.hg/tools/libxc'
make[2]: *** [subdir-install-libxc] Error 2
make[2]: Leaving directory `/usr/src/xen-unstable.hg/tools'
make[1]: *** [subdirs-install] Error 2
make[1]: Leaving directory `/usr/src/xen-unstable.hg/tools'
make: *** [install-tools] Error 2

I belive requires same patch as fs-backend.c


Boris



--- On Wed, 3/18/09, Keir Fraser <keir.fraser@eu.citrix.com> wrote:
From: Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: [Xen-devel] [PATCH] fs-backend: fix compile problems
To: "bderzhavets@yahoo.com" <bderzhavets@yahoo.com>, "Stefano Stabellini" <Stefano.Stabellini@eu.citrix.com>
Cc: "xen-devel" <xen-devel@lists.xensource.com>
Date: Wednesday, March 18, 2009, 11:00 AM



Re: [Xen-devel] [PATCH] fs-backend: fix compile problems
Upgrade to latest xen-unstable. It’s fixed there.



 -- Keir



On 18/03/2009 14:53, "Boris Derzhavets" <bderzhavets@yahoo.com> wrote:



Now "make install-xen" fails :-



make[6]: Entering directory `/usr/src/xen-unstable.hg/xen/arch/x86/cpu/mcheck'

gcc -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement  -nostdinc -fno-builtin -fno-common -iwithprefix include -Werror -Wno-pointer-arith -pipe -I/usr/src/xen-unstable.hg/xen/include  -I/usr/src/xen-unstable.hg/xen/include/asm-x86/mach-generic -I/usr/src/xen-unstable.hg/xen/include/asm-x86/mach-default -msoft-float -fno-stack-protector -mno-red-zone -fpic -fno-reorder-blocks -fno-asynchronous-unwind-tables -DGCC_HAS_VISIBILITY_ATTRIBUTE -g -D__XEN__ -DVERBOSE -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER -MMD -MF .mce_intel.o.d -c mce_intel.c -o mce_intel.o

mce_intel.c:17: error: static declaration of ‘firstbank’ follows non-static declaration

x86_mca.h:95: error: previous declaration of ‘firstbank’ was here

make[6]: *** [mce_intel.o] Error 1

make[6]: Leaving directory `/usr/src/xen-unstable.hg/xen/arch/x86/cpu/mcheck'

make[5]: *** [mcheck/built_in.o] Error 2

make[5]: Leaving directory `/usr/src/xen-unstable.hg/xen/arch/x86/cpu'

make[4]: *** [cpu/built_in.o] Error 2

make[4]: Leaving directory `/usr/src/xen-unstable.hg/xen/arch/x86'

make[3]: *** [/usr/src/xen-unstable.hg/xen/arch/x86/built_in.o] Error 2

make[3]: Leaving directory `/usr/src/xen-unstable.hg/xen/arch/x86'

make[2]: *** [/usr/src/xen-unstable.hg/xen/xen] Error 2

make[2]: Leaving directory `/usr/src/xen-unstable.hg/xen'

make[1]: *** [install] Error 2

make[1]: Leaving directory `/usr/src/xen-unstable.hg/xen'

make: *** [install-xen] Error 2





--- On Wed, 3/18/09, Boris Derzhavets <bderzhavets@yahoo.com> wrote:

From: Boris Derzhavets <bderzhavets@yahoo.com>

Subject: Re: [Xen-devel] [PATCH] fs-backend: fix compile problems

To: "Stefano Stabellini" <stefano.stabellini@eu.citrix.com>

Cc: "xen-devel" <xen-devel@lists.xensource.com>

Date: Wednesday, March 18, 2009, 10:48 AM



Thank you. It's done

Boris



--- On Wed, 3/18/09, Stefano Stabellini <stefano.stabellini@eu.citrix.com> wrote:

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Subject: Re: [Xen-devel] [PATCH] fs-backend: fix compile problems

To: "bderzhavets@yahoo.com" <bderzhavets@yahoo.com>

Cc: "xen-devel" <xen-devel@lists.xensource.com>

Date: Wednesday, March 18, 2009, 10:19 AM



Boris Derzhavets wrote:



> Removed unresolved reference in

> /usr/src/xen-unstable.hg/tools/ioemu-dir/vl.c:5898: undefined reference

> to `pci_emulation_add'

> 

> /*    for (i = 0; i < nb_pci_emulation; i++) {

>         if(pci_emulation_add(pci_emulation_config_text[i]) < 0)

 {

>             fprintf(stderr, "Warning: could not add PCI device

%s\n",

>                     pci_emulation_config_text[i]);

>         }

>     }

> */

> 

> "make tools" completed OK.

> Is it acceptable ?

> 







I think we are missing an ifdef

 CONFIG_PASSTHROUGH





diff --git a/vl.c b/vl.c

index 9b9f7d5..6c0ffb3 100644

--- a/vl.c

+++ b/vl.c

@@ -5894,12 +5894,14 @@ int main(int argc, char **argv, char **envp)

         }

     }

 

+#ifdef CONFIG_PASSTHROUGH

     for (i = 0; i < nb_pci_emulation; i++) {

         if(pci_emulation_add(pci_emulation_config_text[i]) < 0) {

             fprintf(stderr, "Warning: could not add PCI device

%s\n",

                     pci_emulation_config_text[i]);

         }

     }

+#endif

 

     if (strlen(direct_pci_str) > 0)

         direct_pci =

 direct_pci_str;



_______________________________________________

Xen-devel mailing list

Xen-devel@lists.xensource.com

http://lists.xensource.com/xen-devel



 

_______________________________________________

Xen-devel mailing list

Xen-devel@lists.xensource.com

http://lists.xensource.com/xen-devel



 


 



      


      

[-- Attachment #1.2: Type: text/html, Size: 9869 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-03-18 21:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 12:03 [PATCH] fs-backend: fix compile problems Stefano Stabellini
2009-03-18 14:03 ` Boris Derzhavets
2009-03-18 14:12   ` Stefano Stabellini
2009-03-18 14:18   ` Boris Derzhavets
2009-03-18 14:19     ` Stefano Stabellini
2009-03-18 14:48       ` Boris Derzhavets
2009-03-18 14:53         ` Boris Derzhavets
2009-03-18 15:00           ` Keir Fraser
2009-03-18 16:13             ` Boris Derzhavets
2009-03-18 17:26               ` Keir Fraser
2009-03-18 21:21                 ` Karthik G Balaji
2009-03-18 15:01           ` Jiang, Yunhong
  -- strict thread matches above, loose matches on Subject: below --
2009-03-18 16:24 Boris Derzhavets
2009-03-18 16:41 ` Boris Derzhavets

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.