[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] fs-front: cope with a missing fs-backend
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1248335822 -3600 # Node ID 5719af68e43e1b11331a25b4dc4c9ffb3571184c # Parent e7c6a258be0dbc9987a28b313348bd2f806a8432 fs-front: cope with a missing fs-backend Obviously save\restore is not going to work if fs-backend is missing, but at least the stubdom will be able to work correctly in all the other cases. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> --- extras/mini-os/fs-front.c | 53 +++++++++++++++++++++++++++++++++++++++------- extras/mini-os/main.c | 5 ---- 2 files changed, 46 insertions(+), 12 deletions(-) diff -r e7c6a258be0d -r 5719af68e43e extras/mini-os/fs-front.c --- a/extras/mini-os/fs-front.c Thu Jul 23 08:56:15 2009 +0100 +++ b/extras/mini-os/fs-front.c Thu Jul 23 08:57:02 2009 +0100 @@ -193,6 +193,9 @@ int fs_open(struct fs_import *import, ch struct fsif_request *req; int fd; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -234,6 +237,9 @@ int fs_close(struct fs_import *import, i struct fsif_request *req; int ret; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -273,6 +279,9 @@ ssize_t fs_read(struct fs_import *import struct fsif_request *req; ssize_t ret; int i; + + if (!import) + return -1; BUG_ON(len > PAGE_SIZE * FSIF_NR_READ_GNTS); @@ -344,6 +353,9 @@ ssize_t fs_write(struct fs_import *impor struct fsif_request *req; ssize_t ret, to_copy; int i; + + if (!import) + return -1; BUG_ON(len > PAGE_SIZE * FSIF_NR_WRITE_GNTS); @@ -413,6 +425,9 @@ int fs_stat(struct fs_import *import, struct fsif_request *req; int ret; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -455,6 +470,9 @@ int fs_truncate(struct fs_import *import struct fsif_request *req; int ret; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -494,6 +512,9 @@ int fs_remove(struct fs_import *import, RING_IDX back_req_id; struct fsif_request *req; int ret; + + if (!import) + return -1; /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); @@ -542,6 +563,9 @@ int fs_rename(struct fs_import *import, int ret; char old_header[] = "old: "; char new_header[] = "new: "; + + if (!import) + return -1; /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); @@ -594,6 +618,9 @@ int fs_create(struct fs_import *import, struct fsif_request *req; int ret; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -640,6 +667,9 @@ char** fs_list(struct fs_import *import, struct fsif_request *req; char **files, *current_file; int i; + + if (!import) + return NULL; DEBUG("Different masks: NR_FILES=(%llx, %d), ERROR=(%llx, %d), HAS_MORE(%llx, %d)\n", NR_FILES_MASK, NR_FILES_SHIFT, ERROR_MASK, ERROR_SHIFT, HAS_MORE_FLAG, HAS_MORE_SHIFT); @@ -696,6 +726,9 @@ int fs_chmod(struct fs_import *import, i struct fsif_request *req; int ret; + if (!import) + return -1; + /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); DEBUG("Backend request id=%d\n", back_req_id); @@ -735,6 +768,9 @@ int64_t fs_space(struct fs_import *impor RING_IDX back_req_id; struct fsif_request *req; int64_t ret; + + if (!import) + return -1; /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); @@ -776,6 +812,9 @@ int fs_sync(struct fs_import *import, in RING_IDX back_req_id; struct fsif_request *req; int ret; + + if (!import) + return -1; /* Prepare request for the backend */ back_req_id = reserve_fsif_request(import); @@ -1231,19 +1270,19 @@ void init_fs_frontend(void) { struct minios_list_head *entry; struct fs_import *import = NULL; - printk("Initing FS fronend(s).\n"); - - //exports = probe_exports(); + printk("Initing FS frontend(s).\n"); + add_export(&exports, 0); minios_list_for_each(entry, &exports) { import = minios_list_entry(entry, struct fs_import, list); printk("FS export [dom=%d, id=%d] found\n", import->dom_id, import->export_id); - init_fs_import(import); - } - - fs_import = import; + if (init_fs_import(import) != 0) { + fs_import = import; + break; + } + } if (!fs_import) printk("No FS import\n"); diff -r e7c6a258be0d -r 5719af68e43e extras/mini-os/main.c --- a/extras/mini-os/main.c Thu Jul 23 08:56:15 2009 +0100 +++ b/extras/mini-os/main.c Thu Jul 23 08:57:02 2009 +0100 @@ -69,11 +69,6 @@ static void call_main(void *p) #endif #ifdef CONFIG_QEMU - if (!fs_import) { - printk("No FS backend found, is it running?\n"); - do_exit(); - } - /* Fetch argc, argv from XenStore */ domid = xenbus_read_integer("target"); if (domid == -1) { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |