Re: SYSFS "errors"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2013 at 02:06:26PM +0100, Borislav Petkov wrote:
> 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

what's the problem with that ?

$ cat /path/to/file/that/doesnt/exist.txt
cat: /path/to/file/that/doesnt/exist.txt: No such file or directory

Didn't see any gates to hell opening here...

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux