All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: "Gareth Bult (Encryptec)" <Gareth@Encryptec.net>
Cc: Linux MTD <linux-mtd@lists.infradead.org>
Subject: [PATCH 3/22] Remove read-only option
Date: Tue, 21 Dec 2004 14:42:58 +0100	[thread overview]
Message-ID: <20041221134258.GI22636@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20041221134120.GH22636@wohnheim.fh-wedel.de>

Read-only devices are an inherintly stupid idea.  Get rid of them.

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
---

 blockmtd.c |   51 +++++++++++++--------------------------------------
 1 files changed, 13 insertions(+), 38 deletions(-)

--- linux-2.6.9cow/drivers/mtd/devices/blockmtd.c~blockmtd_readonly	2004-12-20 18:34:22.000000000 +0100
+++ linux-2.6.9cow/drivers/mtd/devices/blockmtd.c	2004-12-20 18:37:15.000000000 +0100
@@ -62,7 +62,6 @@
 /* Module parameters passed by insmod/modprobe */
 char *device[MAX_DEVICES];    /* the block device to use */
 int erasesz[MAX_DEVICES];     /* optional default erase size */
-int ro[MAX_DEVICES];          /* optional read only flag */
 int sync;
 
 
@@ -73,8 +72,6 @@
 MODULE_PARM_DESC(device, "block device to use");
 MODULE_PARM(erasesz, "1-4i");
 MODULE_PARM_DESC(erasesz, "optional erase size to use in KiB. eg 4=4KiB.");
-MODULE_PARM(ro, "1-4i");
-MODULE_PARM_DESC(ro, "1=Read only, writes and erases cause errors");
 MODULE_PARM(sync, "i");
 MODULE_PARM_DESC(sync, "1=Synchronous writes");
 
@@ -445,7 +442,7 @@
 
 extern dev_t __init name_to_dev_t(const char *line);
 
-static struct blkmtd_dev *add_device(char *devname, int readonly, int erase_size)
+static struct blkmtd_dev *add_device(char *devname, int erase_size)
 {
 	struct block_device *bdev;
 	int mode;
@@ -458,10 +455,10 @@
 
 
 #ifdef MODULE
-	mode = (readonly) ? O_RDONLY : O_RDWR;
+	mode = O_RDWR;
 	bdev = open_bdev_excl(devname, mode, NULL);
 #else
-	mode = (readonly) ? FMODE_READ : FMODE_WRITE;
+	mode = FMODE_WRITE;
 	bdev = open_by_devnum(name_to_dev_t(devname), mode);
 #endif
 	if(IS_ERR(bdev)) {
@@ -488,9 +485,7 @@
 	memset(dev, 0, sizeof(struct blkmtd_dev));
 	dev->blkdev = bdev;
 	atomic_set(&(dev->blkdev->bd_inode->i_mapping->truncate_count), 0);
-	if(!readonly) {
-		init_MUTEX(&dev->wrbuf_mutex);
-	}
+	init_MUTEX(&dev->wrbuf_mutex);
 
 	dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
 
@@ -510,17 +505,12 @@
 	DEBUG(1, "blkmtd: init: found %d erase regions\n",
 	      dev->mtd_info.numeraseregions);
 
-	if(readonly) {
-		dev->mtd_info.type = MTD_ROM;
-		dev->mtd_info.flags = MTD_CAP_ROM;
-	} else {
-		dev->mtd_info.type = MTD_RAM;
-		dev->mtd_info.flags = MTD_CAP_RAM;
-		dev->mtd_info.erase = blkmtd_erase;
-		dev->mtd_info.write = blkmtd_write;
-		dev->mtd_info.writev = default_mtd_writev;
-		dev->mtd_info.sync = blkmtd_sync;
-	}
+	dev->mtd_info.type = MTD_RAM;
+	dev->mtd_info.flags = MTD_CAP_RAM;
+	dev->mtd_info.erase = blkmtd_erase;
+	dev->mtd_info.write = blkmtd_write;
+	dev->mtd_info.writev = default_mtd_writev;
+	dev->mtd_info.sync = blkmtd_sync;
 	dev->mtd_info.read = blkmtd_read;
 	dev->mtd_info.readv = default_mtd_readv;
 	dev->mtd_info.priv = dev;
@@ -532,10 +522,10 @@
 		list_del(&dev->list);
 		goto devinit_err;
 	} else {
-		info("mtd%d: [%s] erase_size = %dKiB %s [%ld]",
+		info("mtd%d: [%s] erase_size = %dKiB [%ld]",
 		     dev->mtd_info.index, dev->mtd_info.name + strlen("blkmtd: "),
 		     dev->mtd_info.erasesize >> 10,
-		     readonly ? "(read-only)" : "", PAGE_SIZE);
+		     PAGE_SIZE);
 	}
 	return dev;
 
@@ -595,20 +585,6 @@
 }
 
 
-static int __init param_blkmtd_ro(char *str)
-{
-	int i;
-	for(i = 0; i < MAX_DEVICES; i++) {
-		char *val = strsep(&str, ",");
-		if(val)
-			ro[i] = simple_strtoul(val, NULL, 0);
-		DEBUG(2, "blkmtd: ro setup: %d = %d\n", i, ro[i]);
-	}
-
-	return 1;
-}
-
-
 static int __init param_blkmtd_sync(char *str)
 {
 	if(str[0] == '1')
@@ -618,7 +594,6 @@
 
 __setup("blkmtd_device=", param_blkmtd_device);
 __setup("blkmtd_erasesz=", param_blkmtd_erasesz);
-__setup("blkmtd_ro=", param_blkmtd_ro);
 __setup("blkmtd_sync=", param_blkmtd_sync);
 
 #endif
@@ -637,7 +612,7 @@
 	}
 
 	for(i = 0; i < MAX_DEVICES; i++)
-		add_device(device[i], ro[i], erasesz[i] << 10);
+		add_device(device[i], erasesz[i] << 10);
 
 	if(list_empty(&blkmtd_device_list))
 		return -EINVAL;

  reply	other threads:[~2004-12-21 13:43 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-15 23:19 JFFS2 mount time Gareth Bult (Encryptec)
2004-12-16  0:15 ` Josh Boyer
2004-12-16  1:02   ` Gareth Bult (Encryptec)
2004-12-16 12:53     ` Josh Boyer
2004-12-16 21:22       ` Gareth Bult (Encryptec)
2004-12-16 21:28         ` Josh Boyer
2004-12-16 21:47           ` Gareth Bult (Encryptec)
2004-12-17 12:54             ` Josh Boyer
2004-12-17 15:33               ` Gareth Bult (Encryptec)
2004-12-17 16:02                 ` Josh Boyer
2004-12-17 16:46                   ` Gareth Bult (Encryptec)
2004-12-17 17:08                     ` Artem B. Bityuckiy
2004-12-17 17:10                     ` Josh Boyer
2004-12-17 17:26                       ` Gareth Bult (Encryptec)
2004-12-17 17:35                         ` Josh Boyer
2004-12-17 18:09                           ` Gareth Bult (Encryptec)
2004-12-17 19:14                             ` jasmine
2004-12-17 20:55                               ` Gareth Bult (Encryptec)
2004-12-18 16:02                           ` Jörn Engel
2004-12-20 16:34                             ` Josh Boyer
2004-12-20 17:12                               ` Gareth Bult (Encryptec)
2004-12-21 13:09                                 ` Jörn Engel
2004-12-21 13:24                                   ` Gareth Bult (Encryptec)
2004-12-21 13:34                                     ` Jörn Engel
2004-12-18 16:19             ` Jörn Engel
2004-12-18 17:32               ` Gareth Bult (Encryptec)
2004-12-18 17:52                 ` Jörn Engel
2004-12-18 18:11                   ` Jörn Engel
2004-12-18 20:48                     ` Gareth Bult (Encryptec)
2004-12-19  2:44                       ` Jörn Engel
2004-12-21 13:30                       ` Jörn Engel
2004-12-21 13:39                         ` [PATCH 1/22] Add drivers/mtd/devices/blockmtd.c Jörn Engel
2004-12-21 13:41                           ` [PATCH 2/22] Add copyrights Jörn Engel
2004-12-21 13:42                             ` Jörn Engel [this message]
2004-12-21 13:44                               ` [PATCH 4/22] Change init/exit functions Jörn Engel
2004-12-21 13:45                                 ` [PATCH 5/22] Remove gcc warnings Jörn Engel
2004-12-21 13:47                                   ` [PATCH 6/22] Remove debug macros Jörn Engel
2004-12-21 13:48                                     ` [PATCH 7/22] Lindent Jörn Engel
2004-12-21 13:49                                       ` [PATCH 8/22] Remove sync interface Jörn Engel
2004-12-21 13:51                                         ` [PATCH 9/22] Change parameter interface to phram-style Jörn Engel
2004-12-21 13:53                                           ` [PATCH 10/22] Cleanup macro usage Jörn Engel
2004-12-21 13:54                                             ` [PATCH 11/22] kfree simplifications Jörn Engel
2004-12-21 13:55                                               ` [PATCH 12/22] change blockmtd_sync Jörn Engel
2004-12-21 13:57                                                 ` [PATCH 13/22] remove erase regions Jörn Engel
2004-12-21 14:01                                                   ` [PATCH 14/22] Change add_device Jörn Engel
2004-12-21 14:02                                                     ` [PATCH 15/22] Rename unreadable mutex Jörn Engel
2004-12-21 14:03                                                       ` [PATCH 16/22] list changes Jörn Engel
2004-12-21 14:04                                                         ` [PATCH 17/22] Rename central struct Jörn Engel
2004-12-21 14:06                                                           ` [PATCH 18/22] Function renaming Jörn Engel
2004-12-21 14:09                                                             ` [PATCH 19/22] Fold various erase functions Jörn Engel
2004-12-21 14:10                                                               ` [PATCH 20/22] Fold various write functions Jörn Engel
2004-12-21 14:11                                                                 ` [PATCH 21/22] Default erase size Jörn Engel
2004-12-21 14:13                                                                   ` [PATCH 22/22] Readahead Jörn Engel
2004-12-21 18:42                                                   ` [PATCH 13/22] remove erase regions Christopher Hoover
2004-12-21 18:49                                                     ` Jörn Engel
2004-12-21 21:09                                                       ` Christopher Hoover
2004-12-22  2:47                                                         ` Eric W. Biederman
2004-12-22  8:59                                                           ` Jörn Engel
2004-12-22 10:05                                                             ` Eric W. Biederman
2004-12-22 10:41                                                               ` Jörn Engel
2004-12-21 13:42                           ` [PATCH 1/22] Add drivers/mtd/devices/blockmtd.c Gareth Bult (Encryptec)
2004-12-21 14:15                             ` Jörn Engel
2004-12-21 13:40                         ` JFFS2 mount time Gareth Bult (Encryptec)
2004-12-21 15:00                           ` David Woodhouse
     [not found]                             ` <1103644945.10792.175.camel@squizzey.bult.co.uk>
2004-12-21 16:04                               ` Jörn Engel
2004-12-16 13:43 ` Ferenc Havasi
2004-12-20 16:01   ` Gareth Bult (Encryptec)
2004-12-20 16:09     ` Ferenc Havasi
2004-12-20 16:39       ` Gareth Bult (Encryptec)
2004-12-20 17:48       ` Gareth Bult (Encryptec)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041221134258.GI22636@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=Gareth@Encryptec.net \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.