sysfs: bugfix: shorten too long file names
* In old kernels (e.g: 2.6.18) sysfs file names must be shorter
then KOBJ_NAME_LEN.
* Longer names are truncated and this leads to duplicate names
which fails device_register()
Examples: "dahdi!channels!10!10" is truncated to "dahdi!channels!10!1"
* The fix shorten the names and make them fixed length. Example:
"dahdi!chan!010!010"
* It seems no current userspace tools rely on that name or on
/dev/dahdi/channels .
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
committed by
Tzafrir Cohen
parent
431571b5fc
commit
8ea23535dc
@@ -247,7 +247,7 @@ int chan_sysfs_create(struct dahdi_chan *chan)
|
||||
/*
|
||||
* FIXME: the name cannot be longer than KOBJ_NAME_LEN
|
||||
*/
|
||||
dev_set_name(dev, "dahdi!channels!%d!%d", span->spanno, chan->chanpos);
|
||||
dev_set_name(dev, "dahdi!chan!%03d!%03d", span->spanno, chan->chanpos);
|
||||
dev_set_drvdata(dev, chan);
|
||||
dev->release = chan_release;
|
||||
res = device_register(dev);
|
||||
|
||||
Reference in New Issue
Block a user