From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] fs-backend: fix compile problems
Date: Wed, 18 Mar 2009 12:03:05 +0000 [thread overview]
Message-ID: <49C0E2F9.2090406@eu.citrix.com> (raw)
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;
next reply other threads:[~2009-03-18 12:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 12:03 Stefano Stabellini [this message]
2009-03-18 14:03 ` [PATCH] fs-backend: fix compile problems 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49C0E2F9.2090406@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.