• Patrick Mochel's avatar
    sysfs: add initial support for binary files. · 21c8dcc7
    Patrick Mochel authored
    Yes, binary files. But before you scream in angst, please realize that they
    do have a marked purpose for exporting certain types of data from the kernel.
    
    Basically, they are for exporting blobs of data that likely have some structure,
    but that the kernel has no control over. This includes VPD data from device
    headers, EDD data, or CPU microcode. Instead of parsing the data, then
    formatting in a certain way, only so userspace can parse the data again, we
    just shove it out in a binary blob to userspace, and let them deal with it.
    
    Anyway, it defines a struct bin_attribute, with read() and write() methods
    for the data. A read call should set the pointer in the sysfs_bin_buffer
    object that is passed in. 
    
    A write call receives a buffer ptr, too, and must obey the count/offset 
    fields for correct data. 
    21c8dcc7
bin.c 4.81 KB