From: Andre Puschmann <andre.puschmann@stud.tu-ilmenau.de>
To: linux-mtd@lists.infradead.org
Subject: register mtdchar devices in sysfs
Date: Thu, 27 Apr 2006 19:55:41 +0200 [thread overview]
Message-ID: <e2qvnp$jgi$1@sea.gmane.org> (raw)
hi folks,
i am trying to get mtdchar devices to work with sysfs + udev.
my goal is that every mtd-partition gets a device attribute called
partname which i can use in my udev-rules to give them explicit names
like /dev/filesystem or /dev/kernel (instead of /dev/mtd0 and /dev/mtd1
in case that they change their order on the flash device).
to do so i modified mdrchar.c a little bit to add a attribute "partname"
in every specific sysfs-folder.
well, this is working so far with a dummy entry "partname" but how can i
get the specific partition name stored in "struct mtd_info*" out of
"struct class_device" to set it correctly in read_partname()???
thank you in advance
regards
andré
my code looks like this:
<code>
static ssize_t read_partname( struct class_device *cd, char *buf)
{
return snprintf(buf, 265, "%s\n", "partname");
}
static CLASS_DEVICE_ATTR( partname, S_IRUGO, read_partname, NULL );
static void mtd_notify_add(struct mtd_info* mtd)
{
struct class_device *class_dev;
if (!mtd)
return;
class_dev = class_device_create(mtd_class, NULL,
MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
NULL, "mtd%d", mtd->index);
if (!class_dev)
return;
class_device_create_file(class_dev,&class_device_attr_partname);
class_device_create(mtd_class, NULL,
MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
NULL, "mtd%dro", mtd->index);
}
</code>
next reply other threads:[~2006-04-27 18:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 17:55 Andre Puschmann [this message]
2006-04-28 5:40 ` register mtdchar devices in sysfs Artem B. Bityutskiy
2006-04-28 5:48 ` Artem B. Bityutskiy
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='e2qvnp$jgi$1@sea.gmane.org' \
--to=andre.puschmann@stud.tu-ilmenau.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox