[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] fs-back: build fixes for BSD and cleanups.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1217241572 -3600
# Node ID 7a35ab9dba8a9331494a8147512505bf73f434ff
# Parent  3769051151ae780706add1ab483a06eb5a36a85e
fs-back: build fixes for BSD and cleanups.

Signed-of-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 tools/fs-back/fs-backend.c |   16 ++++++++--------
 tools/fs-back/fs-backend.h |   12 ++++++------
 tools/fs-back/fs-ops.c     |   45 +++++++++++++++++++++++----------------------
 tools/fs-back/fs-xenbus.c  |    6 +++---
 4 files changed, 40 insertions(+), 39 deletions(-)

diff -r 3769051151ae -r 7a35ab9dba8a tools/fs-back/fs-backend.c
--- a/tools/fs-back/fs-backend.c        Mon Jul 28 11:36:39 2008 +0100
+++ b/tools/fs-back/fs-backend.c        Mon Jul 28 11:39:32 2008 +0100
@@ -16,7 +16,7 @@ static int export_id = 0;
 static int export_id = 0;
 static int mount_id = 0;
 
-void dispatch_response(struct mount *mount, int priv_req_id)
+static void dispatch_response(struct fs_mount *mount, int priv_req_id)
 {
     int i;
     struct fs_op *op;
@@ -41,7 +41,7 @@ void dispatch_response(struct mount *mou
     add_id_to_freelist(priv_req_id, mount->freelist);
 }
 
-static void handle_aio_events(struct mount *mount)
+static void handle_aio_events(struct fs_mount *mount)
 {
     int fd, ret, count, i, notify;
     evtchn_port_t port;
@@ -103,7 +103,7 @@ read_event_channel:
 }
 
 
-void allocate_request_array(struct mount *mount)
+static void allocate_request_array(struct fs_mount *mount)
 {
     int i, nr_entries = mount->nr_entries;
     struct fs_request *requests;
@@ -123,10 +123,10 @@ void allocate_request_array(struct mount
 }
 
 
-void* handle_mount(void *data)
+static void *handle_mount(void *data)
 {
     int more, notify;
-    struct mount *mount = (struct mount *)data;
+    struct fs_mount *mount = (struct fs_mount *)data;
     
     printf("Starting a thread for mount: %d\n", mount->mount_id);
     allocate_request_array(mount);
@@ -193,7 +193,7 @@ moretodo:
 
 static void handle_connection(int frontend_dom_id, int export_id, char 
*frontend)
 {
-    struct mount *mount;
+    struct fs_mount *mount;
     struct fs_export *export;
     int evt_port;
     pthread_t handling_thread;
@@ -216,7 +216,7 @@ static void handle_connection(int fronte
         return;
     }
 
-    mount = (struct mount*)malloc(sizeof(struct mount));
+    mount = (struct fs_mount*)malloc(sizeof(struct fs_mount));
     mount->dom_id = frontend_dom_id;
     mount->export = export;
     mount->mount_id = mount_id++;
@@ -287,7 +287,7 @@ next_select:
     } while (1);
 }
 
-struct fs_export* create_export(char *name, char *export_path)
+static struct fs_export* create_export(char *name, char *export_path)
 {
     struct fs_export *curr_export, **last_export;
 
diff -r 3769051151ae -r 7a35ab9dba8a tools/fs-back/fs-backend.h
--- a/tools/fs-back/fs-backend.h        Mon Jul 28 11:36:39 2008 +0100
+++ b/tools/fs-back/fs-backend.h        Mon Jul 28 11:39:32 2008 +0100
@@ -31,7 +31,7 @@ struct fs_request
 };
 
 
-struct mount
+struct fs_mount
 {
     struct fs_export *export;
     int dom_id;
@@ -56,17 +56,17 @@ bool xenbus_create_request_node(void);
 bool xenbus_create_request_node(void);
 int xenbus_register_export(struct fs_export *export);
 int xenbus_get_watch_fd(void);
-void xenbus_read_mount_request(struct mount *mount, char *frontend);
-void xenbus_write_backend_node(struct mount *mount);
-void xenbus_write_backend_ready(struct mount *mount);
+void xenbus_read_mount_request(struct fs_mount *mount, char *frontend);
+void xenbus_write_backend_node(struct fs_mount *mount);
+void xenbus_write_backend_ready(struct fs_mount *mount);
 
 /* File operations, implemented in fs-ops.c */
 struct fs_op
 {
     int type;       /* Type of request (from fsif.h) this handlers 
                        are responsible for */
-    void (*dispatch_handler)(struct mount *mount, struct fsif_request *req);
-    void (*response_handler)(struct mount *mount, struct fs_request *req);
+    void (*dispatch_handler)(struct fs_mount *mount, struct fsif_request *req);
+    void (*response_handler)(struct fs_mount *mount, struct fs_request *req);
 };
 
 /* This NULL terminated array of all file requests handlers */
diff -r 3769051151ae -r 7a35ab9dba8a tools/fs-back/fs-ops.c
--- a/tools/fs-back/fs-ops.c    Mon Jul 28 11:36:39 2008 +0100
+++ b/tools/fs-back/fs-ops.c    Mon Jul 28 11:39:32 2008 +0100
@@ -10,7 +10,7 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/vfs.h>
+#include <sys/statvfs.h>
 #include <sys/mount.h>
 #include <unistd.h>
 #include "fs-backend.h"
@@ -23,7 +23,7 @@
 #define BUFFER_SIZE 1024
 
 
-unsigned short get_request(struct mount *mount, struct fsif_request *req)
+static unsigned short get_request(struct fs_mount *mount, struct fsif_request 
*req)
 {
     unsigned short id = get_id_from_freelist(mount->freelist); 
 
@@ -34,7 +34,7 @@ unsigned short get_request(struct mount 
     return id;
 }
 
-int get_fd(struct mount *mount)
+static int get_fd(struct fs_mount *mount)
 {
     int i;
 
@@ -45,7 +45,7 @@ int get_fd(struct mount *mount)
 }
 
 
-void dispatch_file_open(struct mount *mount, struct fsif_request *req)
+static void dispatch_file_open(struct fs_mount *mount, struct fsif_request 
*req)
 {
     char *file_name, full_path[BUFFER_SIZE];
     int fd;
@@ -93,7 +93,7 @@ void dispatch_file_open(struct mount *mo
     rsp->ret_val = (uint64_t)fd;
 }
 
-void dispatch_file_close(struct mount *mount, struct fsif_request *req)
+static void dispatch_file_close(struct fs_mount *mount, struct fsif_request 
*req)
 {
     int ret;
     RING_IDX rsp_idx;
@@ -122,7 +122,8 @@ void dispatch_file_close(struct mount *m
     rsp->id = req_id; 
     rsp->ret_val = (uint64_t)ret;
 }
-void dispatch_file_read(struct mount *mount, struct fsif_request *req)
+
+static void dispatch_file_read(struct fs_mount *mount, struct fsif_request 
*req)
 {
     void *buf;
     int fd;
@@ -164,7 +165,7 @@ out:
     mount->ring.req_cons++;
 }
 
-void end_file_read(struct mount *mount, struct fs_request *priv_req)
+static void end_file_read(struct fs_mount *mount, struct fs_request *priv_req)
 {
     RING_IDX rsp_idx;
     fsif_response_t *rsp;
@@ -182,7 +183,7 @@ void end_file_read(struct mount *mount, 
     rsp->ret_val = (uint64_t)aio_return(&priv_req->aiocb);
 }
 
-void dispatch_file_write(struct mount *mount, struct fsif_request *req)
+static void dispatch_file_write(struct fs_mount *mount, struct fsif_request 
*req)
 {
     void *buf;
     int fd;
@@ -224,7 +225,7 @@ void dispatch_file_write(struct mount *m
     mount->ring.req_cons++;
 }
 
-void end_file_write(struct mount *mount, struct fs_request *priv_req)
+static void end_file_write(struct fs_mount *mount, struct fs_request *priv_req)
 {
     RING_IDX rsp_idx;
     fsif_response_t *rsp;
@@ -242,7 +243,7 @@ void end_file_write(struct mount *mount,
     rsp->ret_val = (uint64_t)aio_return(&priv_req->aiocb);
 }
 
-void dispatch_stat(struct mount *mount, struct fsif_request *req)
+static void dispatch_stat(struct fs_mount *mount, struct fsif_request *req)
 {
     struct fsif_stat_response *buf;
     struct stat stat;
@@ -272,7 +273,7 @@ void dispatch_stat(struct mount *mount, 
     /* Stat, and create the response */ 
     ret = fstat(fd, &stat);
     printf("Mode=%o, uid=%d, a_time=%ld\n",
-            stat.st_mode, stat.st_uid, stat.st_atime);
+            stat.st_mode, stat.st_uid, (long)stat.st_atime);
     buf->stat_mode  = stat.st_mode;
     buf->stat_uid   = stat.st_uid;
     buf->stat_gid   = stat.st_gid;
@@ -303,7 +304,7 @@ void dispatch_stat(struct mount *mount, 
 }
 
 
-void dispatch_truncate(struct mount *mount, struct fsif_request *req)
+static void dispatch_truncate(struct fs_mount *mount, struct fsif_request *req)
 {
     int fd, ret;
     uint16_t req_id;
@@ -335,7 +336,7 @@ void dispatch_truncate(struct mount *mou
     rsp->ret_val = (uint64_t)ret;
 }
 
-void dispatch_remove(struct mount *mount, struct fsif_request *req)
+static void dispatch_remove(struct fs_mount *mount, struct fsif_request *req)
 {
     char *file_name, full_path[BUFFER_SIZE];
     int ret;
@@ -374,7 +375,7 @@ void dispatch_remove(struct mount *mount
 }
 
 
-void dispatch_rename(struct mount *mount, struct fsif_request *req)
+static void dispatch_rename(struct fs_mount *mount, struct fsif_request *req)
 {
     char *buf, *old_file_name, *new_file_name;
     char old_full_path[BUFFER_SIZE], new_full_path[BUFFER_SIZE];
@@ -421,7 +422,7 @@ void dispatch_rename(struct mount *mount
 }
 
 
-void dispatch_create(struct mount *mount, struct fsif_request *req)
+static void dispatch_create(struct fs_mount *mount, struct fsif_request *req)
 {
     char *file_name, full_path[BUFFER_SIZE];
     int ret;
@@ -481,7 +482,7 @@ void dispatch_create(struct mount *mount
     rsp->ret_val = (uint64_t)ret;
 }
 
-void dispatch_list(struct mount *mount, struct fsif_request *req)
+static void dispatch_list(struct fs_mount *mount, struct fsif_request *req)
 {
     char *file_name, *buf, full_path[BUFFER_SIZE];
     uint32_t offset, nr_files, error_code; 
@@ -551,7 +552,7 @@ error_out:
     rsp->ret_val = ret_val;
 }
 
-void dispatch_chmod(struct mount *mount, struct fsif_request *req)
+static void dispatch_chmod(struct fs_mount *mount, struct fsif_request *req)
 {
     int fd, ret;
     RING_IDX rsp_idx;
@@ -582,13 +583,13 @@ void dispatch_chmod(struct mount *mount,
     rsp->ret_val = (uint64_t)ret;
 }
 
-void dispatch_fs_space(struct mount *mount, struct fsif_request *req)
+static void dispatch_fs_space(struct fs_mount *mount, struct fsif_request *req)
 {
     char *file_name, full_path[BUFFER_SIZE];
     RING_IDX rsp_idx;
     fsif_response_t *rsp;
     uint16_t req_id;
-    struct statfs stat;
+    struct statvfs stat;
     int64_t ret;
 
     printf("Dispatching fs space operation (gref=%d).\n", req->u.fspace.gref);
@@ -606,7 +607,7 @@ void dispatch_fs_space(struct mount *mou
            mount->export->export_path, file_name);
     assert(xc_gnttab_munmap(mount->gnth, file_name, 1) == 0);
     printf("Issuing fs space for %s\n", full_path);
-    ret = statfs(full_path, &stat);
+    ret = statvfs(full_path, &stat);
     if(ret >= 0)
         ret = stat.f_bsize * stat.f_bfree;
 
@@ -623,7 +624,7 @@ void dispatch_fs_space(struct mount *mou
     rsp->ret_val = (uint64_t)ret;
 }
 
-void dispatch_file_sync(struct mount *mount, struct fsif_request *req)
+static void dispatch_file_sync(struct fs_mount *mount, struct fsif_request 
*req)
 {
     int fd;
     uint16_t req_id;
@@ -653,7 +654,7 @@ void dispatch_file_sync(struct mount *mo
     mount->ring.req_cons++;
 }
 
-void end_file_sync(struct mount *mount, struct fs_request *priv_req)
+static void end_file_sync(struct fs_mount *mount, struct fs_request *priv_req)
 {
     RING_IDX rsp_idx;
     fsif_response_t *rsp;
diff -r 3769051151ae -r 7a35ab9dba8a tools/fs-back/fs-xenbus.c
--- a/tools/fs-back/fs-xenbus.c Mon Jul 28 11:36:39 2008 +0100
+++ b/tools/fs-back/fs-xenbus.c Mon Jul 28 11:39:32 2008 +0100
@@ -109,7 +109,7 @@ int xenbus_get_watch_fd(void)
     return xs_fileno(xsh); 
 }
 
-void xenbus_read_mount_request(struct mount *mount, char *frontend)
+void xenbus_read_mount_request(struct fs_mount *mount, char *frontend)
 {
     char node[1024];
     char *s;
@@ -150,7 +150,7 @@ static int get_self_id(void)
 } 
 
 
-void xenbus_write_backend_node(struct mount *mount)
+void xenbus_write_backend_node(struct fs_mount *mount)
 {
     char node[1024], backend_node[1024];
     int self_id;
@@ -167,7 +167,7 @@ void xenbus_write_backend_node(struct mo
     xs_write(xsh, XBT_NULL, node, STATE_INITIALISED, 
strlen(STATE_INITIALISED));
 }
 
-void xenbus_write_backend_ready(struct mount *mount)
+void xenbus_write_backend_ready(struct fs_mount *mount)
 {
     char node[1024];
     int self_id;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.