aboutsummaryrefslogtreecommitdiffstats
path: root/tools/fs-back
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-18 13:25:25 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-18 13:25:25 +0000
commitb832b2b46c085ac4f3cf7983277a9f77e7614167 (patch)
tree573d18db3c7f9f77508456c3bb523781e68540f2 /tools/fs-back
parent0629adfd80e38fc3637690ffe08a0ac73c2a9064 (diff)
downloadxen-b832b2b46c085ac4f3cf7983277a9f77e7614167.tar.gz
xen-b832b2b46c085ac4f3cf7983277a9f77e7614167.tar.bz2
xen-b832b2b46c085ac4f3cf7983277a9f77e7614167.zip
fs-back: build fixes
Remove 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>
Diffstat (limited to 'tools/fs-back')
-rw-r--r--tools/fs-back/fs-backend.c13
-rw-r--r--tools/fs-back/fs-ops.c7
2 files changed, 7 insertions, 13 deletions
diff --git a/tools/fs-back/fs-backend.c b/tools/fs-back/fs-backend.c
index 9ae791b692..7dc36f2699 100644
--- a/tools/fs-back/fs-backend.c
+++ b/tools/fs-back/fs-backend.c
@@ -10,6 +10,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"
@@ -182,7 +183,6 @@ static void handle_connection(int frontend_dom_id, int export_id, char *frontend
{
struct fs_mount *mount;
struct fs_export *export;
- int evt_port;
struct fsif_sring *sring;
uint32_t dom_ids[MAX_RING_SIZE];
int i;
@@ -336,12 +336,8 @@ static void await_connections(void)
}
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) {
@@ -380,7 +376,8 @@ static void aio_signal_handler(int signo, siginfo_t *info, void *context)
{
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 --git a/tools/fs-back/fs-ops.c b/tools/fs-back/fs-ops.c
index 9cb83e75f8..6abd3543ba 100644
--- a/tools/fs-back/fs-ops.c
+++ b/tools/fs-back/fs-ops.c
@@ -49,7 +49,6 @@ static void dispatch_file_open(struct fs_mount *mount, struct fsif_request *req)
{
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_close(struct fs_mount *mount, struct fsif_request *req
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 @@ static void dispatch_file_read(struct fs_mount *mount, struct fsif_request *req)
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 end_file_read(struct fs_mount *mount, struct fs_request *priv_req)
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 end_file_write(struct fs_mount *mount, struct fs_request *priv_req)
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;