static ssize_t sfi_table_show(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t offset, size_t count) { struct sfi_table_attr *tbl_attr = container_of(bin_attr, struct sfi_table_attr, attr); struct sfi_table_header *th = NULL; struct sfi_table_key key; ssize_t cnt; key.sig = tbl_attr->name; key.oem_id = NULL; key.oem_table_id = NULL; if (strncmp(SFI_SIG_SYST, tbl_attr->name, SFI_SIGNATURE_SIZE)) { th = sfi_get_table(&key); if (!th) return 0; cnt = memory_read_from_buffer(buf, count, &offset, th, th->len); sfi_put_table(th); } else cnt = memory_read_from_buffer(buf, count, &offset, syst_va, syst_va->header.len); return cnt; }
static ssize_t memconsole_read(struct file *filp, struct kobject *kobp, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t count) { return memory_read_from_buffer(buf, count, &pos, memconsole_baseaddr, memconsole_length); }
static ssize_t edid_show(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { return memory_read_from_buffer(buf, edid_count * 0x80, &off, hdmi_edid_buf, sizeof(edid_buf)); }
static ssize_t util_string_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { struct device *dev = kobj_to_dev(kobj); struct pci_dev *pdev = to_pci_dev(dev); struct zpci_dev *zdev = get_zdev(pdev); return memory_read_from_buffer(buf, count, &off, zdev->util_str, sizeof(zdev->util_str)); }
static ssize_t smi_data_read(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t count) { ssize_t ret; mutex_lock(&smi_data_lock); ret = memory_read_from_buffer(buf, count, &pos, smi_data_buf, smi_data_buf_size); mutex_unlock(&smi_data_lock); return ret; }
/* * Channel measurement related functions */ static ssize_t chp_measurement_chars_read(struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct channel_path *chp; struct device *device; device = container_of(kobj, struct device, kobj); chp = to_channelpath(device); if (!chp->cmg_chars) return 0; return memory_read_from_buffer(buf, count, &off, chp->cmg_chars, sizeof(struct cmg_chars)); }
static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) { /* check to see if we have something to return */ if ((rbu_data.image_update_buffer == NULL) || (rbu_data.bios_image_size == 0)) { pr_debug("read_rbu_data_mono: image_update_buffer %p ," "bios_image_size %lu\n", rbu_data.image_update_buffer, rbu_data.bios_image_size); return -ENOMEM; } return memory_read_from_buffer(buffer, count, &pos, rbu_data.image_update_buffer, rbu_data.bios_image_size); }
static ssize_t qla4_8xxx_sysfs_read_fw_dump(struct file *filep, struct kobject *kobj, struct bin_attribute *ba, char *buf, loff_t off, size_t count) { struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj, struct device, kobj))); if (is_qla40XX(ha)) return -EINVAL; if (!test_bit(AF_82XX_DUMP_READING, &ha->flags)) return 0; return memory_read_from_buffer(buf, count, &off, ha->fw_dump, ha->fw_dump_size); }
static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct zorro_dev *z = to_zorro_dev(kobj_to_dev(kobj)); struct ConfigDev cd; /* Construct a ConfigDev */ memset(&cd, 0, sizeof(cd)); cd.cd_Rom = z->rom; cd.cd_SlotAddr = cpu_to_be16(z->slotaddr); cd.cd_SlotSize = cpu_to_be16(z->slotsize); cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z)); cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z)); return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); }
static ssize_t memconsole_read(struct file *filp, struct kobject *kobp, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t count) { char *memconsole; ssize_t ret; memconsole = ioremap_cache(memconsole_baseaddr, memconsole_length); if (!memconsole) { pr_err("memconsole: ioremap_cache failed\n"); return -ENOMEM; } ret = memory_read_from_buffer(buf, count, &pos, memconsole, memconsole_length); iounmap(memconsole); return ret; }
static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count) { struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, kobj)); struct ConfigDev cd; memset(&cd, 0, sizeof(cd)); cd.cd_Rom = z->rom; cd.cd_SlotAddr = z->slotaddr; cd.cd_SlotSize = z->slotsize; cd.cd_BoardAddr = (void *)zorro_resource_start(z); cd.cd_BoardSize = zorro_resource_len(z); return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd)); }
static ssize_t sfi_acpi_table_show(struct file *filp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t offset, size_t count) { struct sfi_table_attr *tbl_attr = container_of(bin_attr, struct sfi_table_attr, attr); struct acpi_table_header *th = NULL; struct sfi_table_key key; ssize_t cnt; key.sig = tbl_attr->name; key.oem_id = NULL; key.oem_table_id = NULL; th = sfi_acpi_get_table(&key); if (!th) return 0; cnt = memory_read_from_buffer(buf, count, &offset, th, th->length); sfi_acpi_put_table(th); return cnt; }