changeset 496:bcfae5afa971

cp: the config loading code should not use the schedule() The scheduler is initialized, but since we are technically executing the idle task, things get a bit weird. Added a 'nosched' argument to the bdev->read code to select between looping and sleeping. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Fri, 22 Apr 2011 12:58:46 -0400
parents 894e54642999
children 2f86694a2129
files cp/drivers/dasd.c cp/fs/bdev.c cp/fs/edf.c cp/include/bdev.h cp/include/device.h cp/include/edf.h cp/nucleus/config.c
diffstat 7 files changed, 31 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/cp/drivers/dasd.c	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/drivers/dasd.c	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -106,7 +106,7 @@
 	return 0;
 }
 
-static int d3390_read(struct device *dev, u8 *buf, int lba)
+static int d3390_read(struct device *dev, u8 *buf, int lba, int nosched)
 {
 	struct io_op ioop;
 	struct ccw ccw[4];
@@ -180,7 +180,7 @@
 	/*
 	 * issue IO
 	 */
-	ret = submit_io(dev, &ioop, CAN_SLEEP);
+	ret = submit_io(dev, &ioop, nosched ? CAN_LOOP : CAN_SLEEP);
 	return ret;
 }
 
--- a/cp/fs/bdev.c	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/fs/bdev.c	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -8,10 +8,10 @@
 #include <device.h>
 #include <bdev.h>
 
-int bdev_read_block(struct device *dev, void *buf, int lba)
+int bdev_read_block(struct device *dev, void *buf, int lba, int nosched)
 {
 	if (!dev->dev->read)
 		return -EINVAL;
 
-	return dev->dev->read(dev, buf, lba);
+	return dev->dev->read(dev, buf, lba, nosched);
 }
--- a/cp/fs/edf.c	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/fs/edf.c	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -13,7 +13,7 @@
 #include <ebcdic.h>
 #include <edf.h>
 
-struct fs *edf_mount(struct device *dev)
+struct fs *edf_mount(struct device *dev, int nosched)
 {
 	struct page *page;
 	void *tmp;
@@ -30,8 +30,10 @@
 	if (!fs)
 		goto out_free;
 
+	fs->nosched = nosched;
+
 	/* First, read & verify the label */
-	ret = bdev_read_block(dev, tmp, EDF_LABEL_BLOCK_NO);
+	ret = bdev_read_block(dev, tmp, EDF_LABEL_BLOCK_NO, nosched);
 	if (ret)
 		goto out_free;
 
@@ -102,7 +104,8 @@
 	file->buf = page_to_addr(page);
 
 	/* oh well, must do it the hard way ... read from disk */
-	ret = bdev_read_block(fs->dev, fs->tmp_buf, fs->ADT.ADTDOP);
+	ret = bdev_read_block(fs->dev, fs->tmp_buf, fs->ADT.ADTDOP,
+			      fs->nosched);
 	if (ret)
 		goto out_unlock;
 
@@ -154,7 +157,7 @@
 	fop = file->FST.FSTFOP;
 	lrecl = file->FST.FSTLRECL;
 
-	ret = bdev_read_block(fs->dev, file->buf, fop);
+	ret = bdev_read_block(fs->dev, file->buf, fop, fs->nosched);
 	if (ret)
 		goto out;
 
--- a/cp/include/bdev.h	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/include/bdev.h	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -8,6 +8,7 @@
 #ifndef __BDEV_H
 #define __BDEV_H
 
-extern int bdev_read_block(struct device *dev, void *buf, int lba);
+extern int bdev_read_block(struct device *dev, void *buf, int lba,
+			   int cansched);
 
 #endif
--- a/cp/include/device.h	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/include/device.h	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -23,7 +23,7 @@
 	int (*snprintf)(struct device *dev, char *buf, int len);
 
 	/* the following ops are for the bdev wrapper layer */
-	int (*read)(struct device *dev, u8 *buf, int len);
+	int (*read)(struct device *dev, u8 *buf, int len, int nosched);
 
 	u16 type;
 	u8 model;
--- a/cp/include/edf.h	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/include/edf.h	Fri Apr 22 12:58:46 2011 -0400
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007-2010  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * This file is released under the GPLv2.  See the COPYING file for more
  * details.
@@ -90,6 +90,8 @@
 	mutex_t lock;
 	struct device *dev;
 	void *tmp_buf;
+
+	int nosched;
 };
 
 struct file {
@@ -100,7 +102,7 @@
 	char *buf;
 };
 
-extern struct fs *edf_mount(struct device *dev);
+extern struct fs *edf_mount(struct device *dev, int nosched);
 extern struct file *edf_lookup(struct fs *fs, char *fn, char *ft);
 extern int edf_read_rec(struct file *file, char *buf, u32 recno);
 
--- a/cp/nucleus/config.c	Thu Apr 21 18:01:46 2011 -0400
+++ b/cp/nucleus/config.c	Fri Apr 22 12:58:46 2011 -0400
@@ -1,3 +1,10 @@
+/*
+ * (C) Copyright 2007-2011  Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ *
+ * This file is released under the GPLv2.  See the COPYING file for more
+ * details.
+ */
+
 #include <device.h>
 #include <bdev.h>
 #include <edf.h>
@@ -26,7 +33,7 @@
 		return PTR_ERR(dev);
 
 	/* mount the fs */
-	fs = edf_mount(dev);
+	fs = edf_mount(dev, 1);
 	if (IS_ERR(fs))
 		return PTR_ERR(fs);