From: Christoph Egger Subject: [PATCH][TOOLS] fs-back: build fixes Date: Mon, 28 Jul 2008 10:21:03 +0200 Message-ID: <200807281021.03630.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_vFYjIRpCRR2KOkq" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_vFYjIRpCRR2KOkq Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! Compiling tools/fs-back/fs-ops.c fails. Build error messages are below. Attached patch fixes these by: =2D using sys/statvfs.h =2D renaming struct mount to struct fs_mount =2D making functions w/o a prototype static Signed-of-by: Christoph Egger fs-ops.c:13:21: error: sys/vfs.h: No such file or directory In file included from fs-ops.c:16: fs-backend.h:35: error: redefinition of 'struct mount' cc1: warnings being treated as errors fs-ops.c: In function 'get_request': fs-ops.c:28: error: 'struct mount' has no member named 'freelist' fs-ops.c:31: error: 'struct mount' has no member named 'requests' fs-ops.c:32: error: 'struct mount' has no member named 'requests' fs-ops.c: In function 'get_fd': fs-ops.c:42: error: 'struct mount' has no member named 'fds' fs-ops.c: In function 'dispatch_file_open': fs-ops.c:59: error: 'struct mount' has no member named 'gnth' fs-ops.c:60: error: 'struct mount' has no member named 'dom_id' fs-ops.c:66: error: 'struct mount' has no member named 'export' fs-ops.c:69: error: 'struct mount' has no member named 'export' fs-ops.c:70: error: 'struct mount' has no member named 'gnth' fs-ops.c:79: error: 'struct mount' has no member named 'fds' fs-ops.c:85: error: 'struct mount' has no member named 'ring' fs-ops.c:89: error: 'struct mount' has no member named 'ring' fs-ops.c:91: error: 'struct mount' has no member named 'ring' fs-ops.c:91: error: 'struct mount' has no member named 'ring' fs-ops.c: In function 'dispatch_file_close': fs-ops.c:107: error: 'struct mount' has no member named 'fds' fs-ops.c:109: error: 'struct mount' has no member named 'fds' fs-ops.c:115: error: 'struct mount' has no member named 'ring' fs-ops.c:119: error: 'struct mount' has no member named 'ring' fs-ops.c:121: error: 'struct mount' has no member named 'ring' fs-ops.c:121: error: 'struct mount' has no member named 'ring' fs-ops.c: In function 'dispatch_file_read': fs-ops.c:134: error: 'struct mount' has no member named 'gnth' fs-ops.c:135: error: 'struct mount' has no member named 'dom_id' fs-ops.c:144: error: 'struct mount' has no member named 'fds' fs-ops.c:150: error: 'struct mount' has no member named 'requests' =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_vFYjIRpCRR2KOkq Content-Type: text/x-diff; charset="iso-8859-1"; name="tools_fsback.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tools_fsback.diff" diff -r 37fae02cc335 tools/fs-back/fs-backend.c --- a/tools/fs-back/fs-backend.c Fri Jul 25 15:03:03 2008 +0100 +++ b/tools/fs-back/fs-backend.c Mon Jul 28 10:12:07 2008 +0200 @@ -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 37fae02cc335 tools/fs-back/fs-backend.h --- a/tools/fs-back/fs-backend.h Fri Jul 25 15:03:03 2008 +0100 +++ b/tools/fs-back/fs-backend.h Mon Jul 28 10:12:07 2008 +0200 @@ -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 37fae02cc335 tools/fs-back/fs-ops.c --- a/tools/fs-back/fs-ops.c Fri Jul 25 15:03:03 2008 +0100 +++ b/tools/fs-back/fs-ops.c Mon Jul 28 10:12:07 2008 +0200 @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #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 37fae02cc335 tools/fs-back/fs-xenbus.c --- a/tools/fs-back/fs-xenbus.c Fri Jul 25 15:03:03 2008 +0100 +++ b/tools/fs-back/fs-xenbus.c Mon Jul 28 10:12:07 2008 +0200 @@ -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; --Boundary-00=_vFYjIRpCRR2KOkq Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_vFYjIRpCRR2KOkq--