linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* ===================
@ 2014-06-02 17:31 Amanda Clarke
  0 siblings, 0 replies; 6+ messages in thread
From: Amanda Clarke @ 2014-06-02 17:31 UTC (permalink / raw)




-- 
Are You Interested?  Business & Personal loans: At 3.0% Flexible Repayment period- 2 to 30 Years. 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: []
  2021-02-04 13:17 [] Joachim Wiberg
@ 2021-02-04 13:58 ` Joachim Wiberg
  0 siblings, 0 replies; 6+ messages in thread
From: Joachim Wiberg @ 2021-02-04 13:58 UTC (permalink / raw)
  To: linux-mtd

On Thu, Feb 04, 2021 at 14:17, Joachim Wiberg <troglobit@gmail.com> wrote:
>     mtd: mtd2block: add support for an optional custom MTD label

Ugh, sorry about the noise.  Managed to press send instead of abort.
An actual up-to-date patch for this is incoming though, as RFC.

Regards
 /Joachim

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* []
@ 2021-02-04 13:17 Joachim Wiberg
  2021-02-04 13:58 ` [] Joachim Wiberg
  0 siblings, 1 reply; 6+ messages in thread
From: Joachim Wiberg @ 2021-02-04 13:17 UTC (permalink / raw)
  To: linux-mtd


commit 72282e537222988d1dfa787e79554d136fd1fc56
Author: Joachim Wiberg <troglobit@gmail.com>
Date:   Wed Nov 18 16:38:13 2015 +0100

    mtd: mtd2block: add support for an optional custom MTD label
    
    This patch adds support for an optional MTD label for mtd2block emulated
    MTD devices.  Useful when, e.g. testing device images using Qemu.  The
    following /etc/fstab line in can then be used to mount a file system
    regardless of the actual MTD partition number:
    
        mtd:Config  /mnt    jffs2   noatime,nodiratime      0    0
    
    Kernel command line syntax:
    
        block2mtd.block2mtd=/dev/sda,,Config
    
    The ',,' is the optional erase_size, which like before this patch,
    defaults to PAGE_SIZE if left out.
    
    Signed-off-by: Joachim Wiberg <troglobit@gmail.com>

diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index c9e424993e37..f9c14146bf9c 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -214,7 +214,7 @@ static void block2mtd_free_device(struct block2mtd_dev *dev)
 
 
 static struct block2mtd_dev *add_device(char *devname, int erase_size,
-		int timeout)
+		char *label, int timeout)
 {
 #ifndef MODULE
 	int i;
@@ -278,7 +278,10 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size,
 
 	/* Setup the MTD structure */
 	/* make the name contain the block device in */
-	name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+	if (!label)
+		name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+	else
+		name = kstrdup(label, GFP_KERNEL);
 	if (!name)
 		goto err_destroy_mutex;
 
@@ -379,8 +382,8 @@ static int block2mtd_setup2(const char *val)
 	/* 80 for device, 12 for erase size, 80 for name, 8 for timeout */
 	char buf[80 + 12 + 80 + 8];
 	char *str = buf;
-	char *token[2];
-	char *name;
+	char *token[3];
+	char *name, *label = NULL;
 	size_t erase_size = PAGE_SIZE;
 	unsigned long timeout = MTD_DEFAULT_TIMEOUT;
 	int i, ret;
@@ -393,7 +396,7 @@ static int block2mtd_setup2(const char *val)
 	strcpy(str, val);
 	kill_final_newline(str);
 
-	for (i = 0; i < 2; i++)
+	for (i = 0; i < 3; i++)
 		token[i] = strsep(&str, ",");
 
 	if (str) {
@@ -412,7 +415,7 @@ static int block2mtd_setup2(const char *val)
 		return 0;
 	}
 
-	if (token[1]) {
+	if (token[1] && strlen(token[1])) {
 		ret = parse_num(&erase_size, token[1]);
 		if (ret) {
 			pr_err("illegal erase size\n");
@@ -420,7 +423,12 @@ static int block2mtd_setup2(const char *val)
 		}
 	}
 
-	add_device(name, erase_size, timeout);
+	if (token[2]) {
+		label = token[2];
+		pr_info("Using custom MTD label '%s' for dev %s\n", label, name);
+	}
+
+	add_device(name, erase_size, label, timeout);
 
 	return 0;
 }
@@ -454,7 +462,7 @@ static int block2mtd_setup(const char *val, const struct kernel_param *kp)
 
 
 module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,[<erasesize>][,<name>]]\"");
 
 static int __init block2mtd_init(void)
 {

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* 👆
@ 2019-08-30 18:30 nik_bin_nek_alwi
  0 siblings, 0 replies; 6+ messages in thread
From: nik_bin_nek_alwi @ 2019-08-30 18:30 UTC (permalink / raw)
  To: linux mtd, dedekind1, Pankaj DEV, David McCullough

Unglaublich! http://pqk.Lyndon295.xyz/index






___
Lass bald wieder von dir hören
nik_bin_nek_alwi@yahoo.com

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* !
@ 2013-10-19  7:26 Ana Flavia Maria
  0 siblings, 0 replies; 6+ messages in thread
From: Ana Flavia Maria @ 2013-10-19  7:26 UTC (permalink / raw)




-- 
                                     Loan at 3% interest rate Loan offer.. AreYou Interested>?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* $
@ 2012-08-25  6:42 Xli
  0 siblings, 0 replies; 6+ messages in thread
From: Xli @ 2012-08-25  6:42 UTC (permalink / raw)




My name is Sgt. Benny Brooker. I am in the Engineering military unit  
here in Ba'qubah in Iraq; we have some amount of funds that we want to  
move out of the country. REPLY VIA THIS EMAIL: (sgt.benny@w.cn)

-------------------------------------------------------------------------
  Sent via webmail for Chemistry & Biochemistry @ Florida State University
  https://webmail.chem.fsu.edu




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-04 14:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-02 17:31 =================== Amanda Clarke
  -- strict thread matches above, loose matches on Subject: below --
2021-02-04 13:17 [] Joachim Wiberg
2021-02-04 13:58 ` [] Joachim Wiberg
2019-08-30 18:30 👆 nik_bin_nek_alwi
2013-10-19  7:26 ! Ana Flavia Maria
2012-08-25  6:42 $ Xli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).