I want to create a binary file in /sys/class/mydev/bitmap to indicate the absence of my device. But it seems that there is no Linux kernel API (like create_device_bin_file) to create a binary file in the class directory. How can I get that?
I have already created a character attribute file in the mydev class. The code is as follows
static int __init module_init(void) { attr.show = pciex_devshow; attr.store = pciex_devstore; attr.attr.name = "state"; attr.attr.mode = S_IRUSR | S_IWUSR; class_create_file(pciex_class, &attr); } static ssize_t pciex_devshow(struct device *dev, struct device_attribute *attr, char *buf) { struct dev_private *pdev; return snprintf(buf, PAGE_SIZE, "%c\r\n", dev_bitmap); } dev_bitmap is a hex format variable, how can I explore it to userspace?