Thread (32 messages) flat view 32 messages, 6 authors, 2013-02-19

Re: SYSFS "errors"

From: Borislav Petkov <bp@alien8.de>
Date: 2013-02-19 13:06:34
Also in: linux-pm, linux-scsi, lkml

Possibly related (same subject, not in this thread)

On Tue, Feb 19, 2013 at 09:46:40AM -0300, Mauro Carvalho Chehab wrote:
Ah, now I see what you're meaning. That would require to dynamically
create a per-mci DEVICE_ATTR().
Dude, look at the code, we do that already. And you're using it with
dev_attr_sdram_scrub_rate.

Simply change the permissions of the attribute before calling
device_create_file.

pseudo:

	umode_t mode = 0;

	if (mci->set...)
		mode |= S_IWUSR;

	if (mci->get...)
		mode |= S_IRUGO;


	dev_attr_sdram_scrub_rate.attr.mode = mode;

	device_create_file(&mci->dev, &dev_attr_sdram_scrub_rate);
No, on both cases, open() will return an error (-ENOENT against -EPERM).
What if it is a shell script doing:

cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate

or similar?

Simply fixing the permissions fixes *all* possible cases.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help