[lkml]   [2005]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: 2.6: how do I this in sysfs?

> This is after my minimal sas transport class, please also
> read the thread about it on linux-scsi
In the referenced code for using sysfs, there only appear to be methods
for reading attributes. How about if we want to cause a command to
get written out to the hardware? Do we do something like this?

/* get a semaphore keep everyone else out while we're working,
and hope like hell that all the other processes are playing
nice and using the semaphore too, or else we're hosed. */


fd = open("/sys/blah/blah/attribute1", O_RDWR);
write(fd, SOME_JUNK1, sizeof(SOME_JUNK1));
fd = open("/sys/blah/blah/attribute2", O_RDWR);
write(fd, SOME_JUNK2, sizeof(SOME_JUNK2));
fd = open("/sys/blah/blah/attribute3", O_RDWR);
write(fd, SOME_JUNK3, sizeof(SOME_JUNK3));
fd = open("/sys/blah/blah/attribute4", O_RDWR);
write(fd, SOME_JUNK4, sizeof(SOME_JUNK4));
fd = open("/sys/blah/blah/attribute5", O_RDWR);
write(fd, SOME_JUNK5, sizeof(SOME_JUNK5));
fd = open("/sys/blah/blah/attribute6", O_RDWR);
write(fd, SOME_JUNK6, sizeof(SOME_JUNK6));
fd = open("/sys/blah/blah/attribute7", O_RDWR);
write(fd, SOME_JUNK7, sizeof(SOME_JUNK7));

/* When the attribute write_doorbell is written to, by
of this particular device "/sys/blah/blah", it acts as a
doorbell which causes all the values which were "latched" by
the above writes to be consolidated into one command and
written to the hardware. */

fd = open("/sys/blah/blah/write_doorbell", O_RDWR);
write(fd, "ding dong", 9);


I'm not suggesting that the above is a good idea. I don't have a good
idea about how to do this.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-08-29 19:27    [W:0.034 / U:28.508 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site