Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sysfs: add struct file* to bin_attr callbacks

This allows bin_attr->read,write,mmap callbacks to check file specific data
(such as inode owner) as part of any privilege validation.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Chris Wright and committed by
Greg Kroah-Hartman
2c3c8bea 68d75ed4

+220 -149
+5 -3
arch/alpha/kernel/pci-sysfs.c
··· 53 53 54 54 /** 55 55 * pci_mmap_resource - map a PCI resource into user memory space 56 + * @filp: open sysfs file 56 57 * @kobj: kobject for mapping 57 58 * @attr: struct bin_attribute for the file being mapped 58 59 * @vma: struct vm_area_struct passed into the mmap ··· 61 60 * 62 61 * Use the bus mapping routines to map a PCI resource into userspace. 63 62 */ 64 - static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, 63 + static int pci_mmap_resource(struct file *filp, struct kobject *kobj, 64 + struct bin_attribute *attr, 65 65 struct vm_area_struct *vma, int sparse) 66 66 { 67 67 struct pci_dev *pdev = to_pci_dev(container_of(kobj, ··· 91 89 return hose_mmap_page_range(pdev->sysdata, vma, mmap_type, sparse); 92 90 } 93 91 94 - static int pci_mmap_resource_sparse(struct kobject *kobj, 92 + static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj, 95 93 struct bin_attribute *attr, 96 94 struct vm_area_struct *vma) 97 95 { 98 96 return pci_mmap_resource(kobj, attr, vma, 1); 99 97 } 100 98 101 - static int pci_mmap_resource_dense(struct kobject *kobj, 99 + static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj, 102 100 struct bin_attribute *attr, 103 101 struct vm_area_struct *vma) 104 102 {
+2 -2
arch/mips/txx9/generic/setup.c
··· 905 905 void __iomem *base; 906 906 }; 907 907 908 - static ssize_t txx9_sram_read(struct kobject *kobj, 908 + static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj, 909 909 struct bin_attribute *bin_attr, 910 910 char *buf, loff_t pos, size_t size) 911 911 { ··· 920 920 return size; 921 921 } 922 922 923 - static ssize_t txx9_sram_write(struct kobject *kobj, 923 + static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj, 924 924 struct bin_attribute *bin_attr, 925 925 char *buf, loff_t pos, size_t size) 926 926 {
+2 -2
arch/powerpc/sysdev/mv64x60_pci.c
··· 24 24 #define MV64X60_VAL_LEN_MAX 11 25 25 #define MV64X60_PCICFG_CPCI_HOTSWAP 0x68 26 26 27 - static ssize_t mv64x60_hs_reg_read(struct kobject *kobj, 27 + static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj, 28 28 struct bin_attribute *attr, char *buf, 29 29 loff_t off, size_t count) 30 30 { ··· 45 45 return sprintf(buf, "0x%08x\n", v); 46 46 } 47 47 48 - static ssize_t mv64x60_hs_reg_write(struct kobject *kobj, 48 + static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj, 49 49 struct bin_attribute *attr, char *buf, 50 50 loff_t off, size_t count) 51 51 {
+8 -6
arch/s390/kernel/ipl.c
··· 403 403 static struct kobj_attribute sys_ipl_device_attr = 404 404 __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL); 405 405 406 - static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr, 407 - char *buf, loff_t off, size_t count) 406 + static ssize_t ipl_parameter_read(struct file *filp, struct kobject *kobj, 407 + struct bin_attribute *attr, char *buf, 408 + loff_t off, size_t count) 408 409 { 409 410 return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START, 410 411 IPL_PARMBLOCK_SIZE); ··· 420 419 .read = &ipl_parameter_read, 421 420 }; 422 421 423 - static ssize_t ipl_scp_data_read(struct kobject *kobj, struct bin_attribute *attr, 424 - char *buf, loff_t off, size_t count) 422 + static ssize_t ipl_scp_data_read(struct file *filp, struct kobject *kobj, 423 + struct bin_attribute *attr, char *buf, 424 + loff_t off, size_t count) 425 425 { 426 426 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len; 427 427 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data; ··· 696 694 697 695 /* FCP reipl device attributes */ 698 696 699 - static ssize_t reipl_fcp_scpdata_read(struct kobject *kobj, 697 + static ssize_t reipl_fcp_scpdata_read(struct file *filp, struct kobject *kobj, 700 698 struct bin_attribute *attr, 701 699 char *buf, loff_t off, size_t count) 702 700 { ··· 706 704 return memory_read_from_buffer(buf, count, &off, scp_data, size); 707 705 } 708 706 709 - static ssize_t reipl_fcp_scpdata_write(struct kobject *kobj, 707 + static ssize_t reipl_fcp_scpdata_write(struct file *filp, struct kobject *kobj, 710 708 struct bin_attribute *attr, 711 709 char *buf, loff_t off, size_t count) 712 710 {
+1 -1
drivers/acpi/system.c
··· 71 71 struct list_head node; 72 72 }; 73 73 74 - static ssize_t acpi_table_show(struct kobject *kobj, 74 + static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj, 75 75 struct bin_attribute *bin_attr, char *buf, 76 76 loff_t offset, size_t count) 77 77 {
+7 -4
drivers/base/firmware_class.c
··· 278 278 static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); 279 279 280 280 static ssize_t 281 - firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, 282 - char *buffer, loff_t offset, size_t count) 281 + firmware_data_read(struct file *filp, struct kobject *kobj, 282 + struct bin_attribute *bin_attr, char *buffer, loff_t offset, 283 + size_t count) 283 284 { 284 285 struct device *dev = to_dev(kobj); 285 286 struct firmware_priv *fw_priv = dev_get_drvdata(dev); ··· 363 362 364 363 /** 365 364 * firmware_data_write - write method for firmware 365 + * @filp: open sysfs file 366 366 * @kobj: kobject for the device 367 367 * @bin_attr: bin_attr structure 368 368 * @buffer: buffer being written ··· 374 372 * the driver as a firmware image. 375 373 **/ 376 374 static ssize_t 377 - firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr, 378 - char *buffer, loff_t offset, size_t count) 375 + firmware_data_write(struct file* filp, struct kobject *kobj, 376 + struct bin_attribute *bin_attr, char *buffer, 377 + loff_t offset, size_t count) 379 378 { 380 379 struct device *dev = to_dev(kobj); 381 380 struct firmware_priv *fw_priv = dev_get_drvdata(dev);
+2 -2
drivers/firmware/dcdbas.c
··· 149 149 return count; 150 150 } 151 151 152 - static ssize_t smi_data_read(struct kobject *kobj, 152 + static ssize_t smi_data_read(struct file *filp, struct kobject *kobj, 153 153 struct bin_attribute *bin_attr, 154 154 char *buf, loff_t pos, size_t count) 155 155 { ··· 162 162 return ret; 163 163 } 164 164 165 - static ssize_t smi_data_write(struct kobject *kobj, 165 + static ssize_t smi_data_write(struct file *filp, struct kobject *kobj, 166 166 struct bin_attribute *bin_attr, 167 167 char *buf, loff_t pos, size_t count) 168 168 {
+5 -5
drivers/firmware/dell_rbu.c
··· 522 522 rbu_data.image_update_buffer, rbu_data.bios_image_size); 523 523 } 524 524 525 - static ssize_t read_rbu_data(struct kobject *kobj, 525 + static ssize_t read_rbu_data(struct file *filp, struct kobject *kobj, 526 526 struct bin_attribute *bin_attr, 527 527 char *buffer, loff_t pos, size_t count) 528 528 { ··· 576 576 release_firmware(fw); 577 577 } 578 578 579 - static ssize_t read_rbu_image_type(struct kobject *kobj, 579 + static ssize_t read_rbu_image_type(struct file *filp, struct kobject *kobj, 580 580 struct bin_attribute *bin_attr, 581 581 char *buffer, loff_t pos, size_t count) 582 582 { ··· 586 586 return size; 587 587 } 588 588 589 - static ssize_t write_rbu_image_type(struct kobject *kobj, 589 + static ssize_t write_rbu_image_type(struct file *filp, struct kobject *kobj, 590 590 struct bin_attribute *bin_attr, 591 591 char *buffer, loff_t pos, size_t count) 592 592 { ··· 647 647 return rc; 648 648 } 649 649 650 - static ssize_t read_rbu_packet_size(struct kobject *kobj, 650 + static ssize_t read_rbu_packet_size(struct file *filp, struct kobject *kobj, 651 651 struct bin_attribute *bin_attr, 652 652 char *buffer, loff_t pos, size_t count) 653 653 { ··· 660 660 return size; 661 661 } 662 662 663 - static ssize_t write_rbu_packet_size(struct kobject *kobj, 663 + static ssize_t write_rbu_packet_size(struct file *filp, struct kobject *kobj, 664 664 struct bin_attribute *bin_attr, 665 665 char *buffer, loff_t pos, size_t count) 666 666 {
+2 -2
drivers/firmware/efivars.c
··· 402 402 } 403 403 404 404 405 - static ssize_t efivar_create(struct kobject *kobj, 405 + static ssize_t efivar_create(struct file *filp, struct kobject *kobj, 406 406 struct bin_attribute *bin_attr, 407 407 char *buf, loff_t pos, size_t count) 408 408 { ··· 461 461 return count; 462 462 } 463 463 464 - static ssize_t efivar_delete(struct kobject *kobj, 464 + static ssize_t efivar_delete(struct file *filp, struct kobject *kobj, 465 465 struct bin_attribute *bin_attr, 466 466 char *buf, loff_t pos, size_t count) 467 467 {
+3 -2
drivers/gpu/drm/drm_sysfs.c
··· 193 193 "disabled"); 194 194 } 195 195 196 - static ssize_t edid_show(struct kobject *kobj, struct bin_attribute *attr, 197 - char *buf, loff_t off, size_t count) 196 + static ssize_t edid_show(struct file *filp, struct kobject *kobj, 197 + struct bin_attribute *attr, char *buf, loff_t off, 198 + size_t count) 198 199 { 199 200 struct device *connector_dev = container_of(kobj, struct device, kobj); 200 201 struct drm_connector *connector = to_drm_connector(connector_dev);
+2 -2
drivers/misc/c2port/core.c
··· 707 707 return nread; 708 708 } 709 709 710 - static ssize_t c2port_read_flash_data(struct kobject *kobj, 710 + static ssize_t c2port_read_flash_data(struct file *filp, struct kobject *kobj, 711 711 struct bin_attribute *attr, 712 712 char *buffer, loff_t offset, size_t count) 713 713 { ··· 824 824 return nwrite; 825 825 } 826 826 827 - static ssize_t c2port_write_flash_data(struct kobject *kobj, 827 + static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj, 828 828 struct bin_attribute *attr, 829 829 char *buffer, loff_t offset, size_t count) 830 830 {
+4 -2
drivers/misc/ds1682.c
··· 140 140 /* 141 141 * User data attribute 142 142 */ 143 - static ssize_t ds1682_eeprom_read(struct kobject *kobj, struct bin_attribute *attr, 143 + static ssize_t ds1682_eeprom_read(struct file *filp, struct kobject *kobj, 144 + struct bin_attribute *attr, 144 145 char *buf, loff_t off, size_t count) 145 146 { 146 147 struct i2c_client *client = kobj_to_i2c_client(kobj); ··· 164 163 return count; 165 164 } 166 165 167 - static ssize_t ds1682_eeprom_write(struct kobject *kobj, struct bin_attribute *attr, 166 + static ssize_t ds1682_eeprom_write(struct file *filp, struct kobject *kobj, 167 + struct bin_attribute *attr, 168 168 char *buf, loff_t off, size_t count) 169 169 { 170 170 struct i2c_client *client = kobj_to_i2c_client(kobj);
+4 -2
drivers/misc/eeprom/at24.c
··· 274 274 return retval; 275 275 } 276 276 277 - static ssize_t at24_bin_read(struct kobject *kobj, struct bin_attribute *attr, 277 + static ssize_t at24_bin_read(struct file *filp, struct kobject *kobj, 278 + struct bin_attribute *attr, 278 279 char *buf, loff_t off, size_t count) 279 280 { 280 281 struct at24_data *at24; ··· 396 395 return retval; 397 396 } 398 397 399 - static ssize_t at24_bin_write(struct kobject *kobj, struct bin_attribute *attr, 398 + static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, 399 + struct bin_attribute *attr, 400 400 char *buf, loff_t off, size_t count) 401 401 { 402 402 struct at24_data *at24;
+4 -2
drivers/misc/eeprom/at25.c
··· 126 126 } 127 127 128 128 static ssize_t 129 - at25_bin_read(struct kobject *kobj, struct bin_attribute *bin_attr, 129 + at25_bin_read(struct file *filp, struct kobject *kobj, 130 + struct bin_attribute *bin_attr, 130 131 char *buf, loff_t off, size_t count) 131 132 { 132 133 struct device *dev; ··· 254 253 } 255 254 256 255 static ssize_t 257 - at25_bin_write(struct kobject *kobj, struct bin_attribute *bin_attr, 256 + at25_bin_write(struct file *filp, struct kobject *kobj, 257 + struct bin_attribute *bin_attr, 258 258 char *buf, loff_t off, size_t count) 259 259 { 260 260 struct device *dev;
+2 -1
drivers/misc/eeprom/eeprom.c
··· 81 81 mutex_unlock(&data->update_lock); 82 82 } 83 83 84 - static ssize_t eeprom_read(struct kobject *kobj, struct bin_attribute *bin_attr, 84 + static ssize_t eeprom_read(struct file *filp, struct kobject *kobj, 85 + struct bin_attribute *bin_attr, 85 86 char *buf, loff_t off, size_t count) 86 87 { 87 88 struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
+1 -1
drivers/misc/eeprom/max6875.c
··· 107 107 mutex_unlock(&data->update_lock); 108 108 } 109 109 110 - static ssize_t max6875_read(struct kobject *kobj, 110 + static ssize_t max6875_read(struct file *filp, struct kobject *kobj, 111 111 struct bin_attribute *bin_attr, 112 112 char *buf, loff_t off, size_t count) 113 113 {
+7 -4
drivers/net/netxen/netxen_nic_main.c
··· 2560 2560 } 2561 2561 2562 2562 static ssize_t 2563 - netxen_sysfs_read_crb(struct kobject *kobj, struct bin_attribute *attr, 2563 + netxen_sysfs_read_crb(struct file *filp, struct kobject *kobj, 2564 + struct bin_attribute *attr, 2564 2565 char *buf, loff_t offset, size_t size) 2565 2566 { 2566 2567 struct device *dev = container_of(kobj, struct device, kobj); ··· 2588 2587 } 2589 2588 2590 2589 static ssize_t 2591 - netxen_sysfs_write_crb(struct kobject *kobj, struct bin_attribute *attr, 2590 + netxen_sysfs_write_crb(struct file *filp, struct kobject *kobj, 2591 + struct bin_attribute *attr, 2592 2592 char *buf, loff_t offset, size_t size) 2593 2593 { 2594 2594 struct device *dev = container_of(kobj, struct device, kobj); ··· 2629 2627 } 2630 2628 2631 2629 static ssize_t 2632 - netxen_sysfs_read_mem(struct kobject *kobj, struct bin_attribute *attr, 2630 + netxen_sysfs_read_mem(struct file *filp, struct kobject *kobj, 2631 + struct bin_attribute *attr, 2633 2632 char *buf, loff_t offset, size_t size) 2634 2633 { 2635 2634 struct device *dev = container_of(kobj, struct device, kobj); ··· 2650 2647 return size; 2651 2648 } 2652 2649 2653 - static ssize_t netxen_sysfs_write_mem(struct kobject *kobj, 2650 + static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj, 2654 2651 struct bin_attribute *attr, char *buf, 2655 2652 loff_t offset, size_t size) 2656 2653 {
+8 -4
drivers/net/qlcnic/qlcnic_main.c
··· 2464 2464 } 2465 2465 2466 2466 static ssize_t 2467 - qlcnic_sysfs_read_crb(struct kobject *kobj, struct bin_attribute *attr, 2467 + qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj, 2468 + struct bin_attribute *attr, 2468 2469 char *buf, loff_t offset, size_t size) 2469 2470 { 2470 2471 struct device *dev = container_of(kobj, struct device, kobj); ··· 2489 2488 } 2490 2489 2491 2490 static ssize_t 2492 - qlcnic_sysfs_write_crb(struct kobject *kobj, struct bin_attribute *attr, 2491 + qlcnic_sysfs_write_crb(struct file *filp, struct kobject *kobj, 2492 + struct bin_attribute *attr, 2493 2493 char *buf, loff_t offset, size_t size) 2494 2494 { 2495 2495 struct device *dev = container_of(kobj, struct device, kobj); ··· 2527 2525 } 2528 2526 2529 2527 static ssize_t 2530 - qlcnic_sysfs_read_mem(struct kobject *kobj, struct bin_attribute *attr, 2528 + qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj, 2529 + struct bin_attribute *attr, 2531 2530 char *buf, loff_t offset, size_t size) 2532 2531 { 2533 2532 struct device *dev = container_of(kobj, struct device, kobj); ··· 2549 2546 } 2550 2547 2551 2548 static ssize_t 2552 - qlcnic_sysfs_write_mem(struct kobject *kobj, struct bin_attribute *attr, 2549 + qlcnic_sysfs_write_mem(struct file *filp, struct kobject *kobj, 2550 + struct bin_attribute *attr, 2553 2551 char *buf, loff_t offset, size_t size) 2554 2552 { 2555 2553 struct device *dev = container_of(kobj, struct device, kobj);
+3 -2
drivers/pci/hotplug/acpiphp_ibm.c
··· 108 108 static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status); 109 109 static void ibm_handle_events(acpi_handle handle, u32 event, void *context); 110 110 static int ibm_get_table_from_acpi(char **bufp); 111 - static ssize_t ibm_read_apci_table(struct kobject *kobj, 111 + static ssize_t ibm_read_apci_table(struct file *filp, struct kobject *kobj, 112 112 struct bin_attribute *bin_attr, 113 113 char *buffer, loff_t pos, size_t size); 114 114 static acpi_status __init ibm_find_acpi_device(acpi_handle handle, ··· 351 351 352 352 /** 353 353 * ibm_read_apci_table - callback for the sysfs apci_table file 354 + * @filp: the open sysfs file 354 355 * @kobj: the kobject this binary attribute is a part of 355 356 * @bin_attr: struct bin_attribute for this file 356 357 * @buffer: the kernel space buffer to fill ··· 365 364 * things get really tricky here... 366 365 * our solution is to only allow reading the table in all at once. 367 366 */ 368 - static ssize_t ibm_read_apci_table(struct kobject *kobj, 367 + static ssize_t ibm_read_apci_table(struct file *filp, struct kobject *kobj, 369 368 struct bin_attribute *bin_attr, 370 369 char *buffer, loff_t pos, size_t size) 371 370 {
+30 -12
drivers/pci/pci-sysfs.c
··· 357 357 struct device_attribute vga_attr = __ATTR_RO(boot_vga); 358 358 359 359 static ssize_t 360 - pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, 360 + pci_read_config(struct file *filp, struct kobject *kobj, 361 + struct bin_attribute *bin_attr, 361 362 char *buf, loff_t off, size_t count) 362 363 { 363 364 struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); ··· 431 430 } 432 431 433 432 static ssize_t 434 - pci_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, 433 + pci_write_config(struct file* filp, struct kobject *kobj, 434 + struct bin_attribute *bin_attr, 435 435 char *buf, loff_t off, size_t count) 436 436 { 437 437 struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); ··· 489 487 } 490 488 491 489 static ssize_t 492 - read_vpd_attr(struct kobject *kobj, struct bin_attribute *bin_attr, 490 + read_vpd_attr(struct file *filp, struct kobject *kobj, 491 + struct bin_attribute *bin_attr, 493 492 char *buf, loff_t off, size_t count) 494 493 { 495 494 struct pci_dev *dev = ··· 505 502 } 506 503 507 504 static ssize_t 508 - write_vpd_attr(struct kobject *kobj, struct bin_attribute *bin_attr, 505 + write_vpd_attr(struct file *filp, struct kobject *kobj, 506 + struct bin_attribute *bin_attr, 509 507 char *buf, loff_t off, size_t count) 510 508 { 511 509 struct pci_dev *dev = ··· 523 519 #ifdef HAVE_PCI_LEGACY 524 520 /** 525 521 * pci_read_legacy_io - read byte(s) from legacy I/O port space 522 + * @filp: open sysfs file 526 523 * @kobj: kobject corresponding to file to read from 527 524 * @bin_attr: struct bin_attribute for this file 528 525 * @buf: buffer to store results ··· 534 529 * callback routine (pci_legacy_read). 535 530 */ 536 531 static ssize_t 537 - pci_read_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, 532 + pci_read_legacy_io(struct file *filp, struct kobject *kobj, 533 + struct bin_attribute *bin_attr, 538 534 char *buf, loff_t off, size_t count) 539 535 { 540 536 struct pci_bus *bus = to_pci_bus(container_of(kobj, ··· 551 545 552 546 /** 553 547 * pci_write_legacy_io - write byte(s) to legacy I/O port space 548 + * @filp: open sysfs file 554 549 * @kobj: kobject corresponding to file to read from 555 550 * @bin_attr: struct bin_attribute for this file 556 551 * @buf: buffer containing value to be written ··· 562 555 * callback routine (pci_legacy_write). 563 556 */ 564 557 static ssize_t 565 - pci_write_legacy_io(struct kobject *kobj, struct bin_attribute *bin_attr, 558 + pci_write_legacy_io(struct file *filp, struct kobject *kobj, 559 + struct bin_attribute *bin_attr, 566 560 char *buf, loff_t off, size_t count) 567 561 { 568 562 struct pci_bus *bus = to_pci_bus(container_of(kobj, ··· 578 570 579 571 /** 580 572 * pci_mmap_legacy_mem - map legacy PCI memory into user memory space 573 + * @filp: open sysfs file 581 574 * @kobj: kobject corresponding to device to be mapped 582 575 * @attr: struct bin_attribute for this file 583 576 * @vma: struct vm_area_struct passed to mmap ··· 588 579 * memory space. 589 580 */ 590 581 static int 591 - pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr, 582 + pci_mmap_legacy_mem(struct file *filp, struct kobject *kobj, 583 + struct bin_attribute *attr, 592 584 struct vm_area_struct *vma) 593 585 { 594 586 struct pci_bus *bus = to_pci_bus(container_of(kobj, ··· 601 591 602 592 /** 603 593 * pci_mmap_legacy_io - map legacy PCI IO into user memory space 594 + * @filp: open sysfs file 604 595 * @kobj: kobject corresponding to device to be mapped 605 596 * @attr: struct bin_attribute for this file 606 597 * @vma: struct vm_area_struct passed to mmap ··· 611 600 * memory space. Returns -ENOSYS if the operation isn't supported 612 601 */ 613 602 static int 614 - pci_mmap_legacy_io(struct kobject *kobj, struct bin_attribute *attr, 603 + pci_mmap_legacy_io(struct file *filp, struct kobject *kobj, 604 + struct bin_attribute *attr, 615 605 struct vm_area_struct *vma) 616 606 { 617 607 struct pci_bus *bus = to_pci_bus(container_of(kobj, ··· 762 750 } 763 751 764 752 static int 765 - pci_mmap_resource_uc(struct kobject *kobj, struct bin_attribute *attr, 753 + pci_mmap_resource_uc(struct file *filp, struct kobject *kobj, 754 + struct bin_attribute *attr, 766 755 struct vm_area_struct *vma) 767 756 { 768 757 return pci_mmap_resource(kobj, attr, vma, 0); 769 758 } 770 759 771 760 static int 772 - pci_mmap_resource_wc(struct kobject *kobj, struct bin_attribute *attr, 761 + pci_mmap_resource_wc(struct file *filp, struct kobject *kobj, 762 + struct bin_attribute *attr, 773 763 struct vm_area_struct *vma) 774 764 { 775 765 return pci_mmap_resource(kobj, attr, vma, 1); ··· 875 861 876 862 /** 877 863 * pci_write_rom - used to enable access to the PCI ROM display 864 + * @filp: sysfs file 878 865 * @kobj: kernel object handle 879 866 * @bin_attr: struct bin_attribute for this file 880 867 * @buf: user input ··· 885 870 * writing anything except 0 enables it 886 871 */ 887 872 static ssize_t 888 - pci_write_rom(struct kobject *kobj, struct bin_attribute *bin_attr, 873 + pci_write_rom(struct file *filp, struct kobject *kobj, 874 + struct bin_attribute *bin_attr, 889 875 char *buf, loff_t off, size_t count) 890 876 { 891 877 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj)); ··· 901 885 902 886 /** 903 887 * pci_read_rom - read a PCI ROM 888 + * @filp: sysfs file 904 889 * @kobj: kernel object handle 905 890 * @bin_attr: struct bin_attribute for this file 906 891 * @buf: where to put the data we read from the ROM ··· 912 895 * device corresponding to @kobj. 913 896 */ 914 897 static ssize_t 915 - pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr, 898 + pci_read_rom(struct file *filp, struct kobject *kobj, 899 + struct bin_attribute *bin_attr, 916 900 char *buf, loff_t off, size_t count) 917 901 { 918 902 struct pci_dev *pdev = to_pci_dev(container_of(kobj, struct device, kobj));
+2 -2
drivers/pcmcia/cistpl.c
··· 1531 1531 } 1532 1532 1533 1533 1534 - static ssize_t pccard_show_cis(struct kobject *kobj, 1534 + static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj, 1535 1535 struct bin_attribute *bin_attr, 1536 1536 char *buf, loff_t off, size_t count) 1537 1537 { ··· 1562 1562 } 1563 1563 1564 1564 1565 - static ssize_t pccard_store_cis(struct kobject *kobj, 1565 + static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj, 1566 1566 struct bin_attribute *bin_attr, 1567 1567 char *buf, loff_t off, size_t count) 1568 1568 {
+1 -1
drivers/power/olpc_battery.c
··· 354 354 #define EEPROM_END 0x80 355 355 #define EEPROM_SIZE (EEPROM_END - EEPROM_START) 356 356 357 - static ssize_t olpc_bat_eeprom_read(struct kobject *kobj, 357 + static ssize_t olpc_bat_eeprom_read(struct file *filp, struct kobject *kobj, 358 358 struct bin_attribute *attr, char *buf, loff_t off, size_t count) 359 359 { 360 360 uint8_t ec_byte;
+4 -2
drivers/rapidio/rio-sysfs.c
··· 68 68 }; 69 69 70 70 static ssize_t 71 - rio_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, 71 + rio_read_config(struct file *filp, struct kobject *kobj, 72 + struct bin_attribute *bin_attr, 72 73 char *buf, loff_t off, size_t count) 73 74 { 74 75 struct rio_dev *dev = ··· 140 139 } 141 140 142 141 static ssize_t 143 - rio_write_config(struct kobject *kobj, struct bin_attribute *bin_attr, 142 + rio_write_config(struct file *filp, struct kobject *kobj, 143 + struct bin_attribute *bin_attr, 144 144 char *buf, loff_t off, size_t count) 145 145 { 146 146 struct rio_dev *dev =
+4 -2
drivers/rtc/rtc-cmos.c
··· 519 519 #define NVRAM_OFFSET (RTC_REG_D + 1) 520 520 521 521 static ssize_t 522 - cmos_nvram_read(struct kobject *kobj, struct bin_attribute *attr, 522 + cmos_nvram_read(struct file *filp, struct kobject *kobj, 523 + struct bin_attribute *attr, 523 524 char *buf, loff_t off, size_t count) 524 525 { 525 526 int retval; ··· 548 547 } 549 548 550 549 static ssize_t 551 - cmos_nvram_write(struct kobject *kobj, struct bin_attribute *attr, 550 + cmos_nvram_write(struct file *filp, struct kobject *kobj, 551 + struct bin_attribute *attr, 552 552 char *buf, loff_t off, size_t count) 553 553 { 554 554 struct cmos_rtc *cmos;
+4 -2
drivers/rtc/rtc-ds1305.c
··· 542 542 } 543 543 544 544 static ssize_t 545 - ds1305_nvram_read(struct kobject *kobj, struct bin_attribute *attr, 545 + ds1305_nvram_read(struct file *filp, struct kobject *kobj, 546 + struct bin_attribute *attr, 546 547 char *buf, loff_t off, size_t count) 547 548 { 548 549 struct spi_device *spi; ··· 573 572 } 574 573 575 574 static ssize_t 576 - ds1305_nvram_write(struct kobject *kobj, struct bin_attribute *attr, 575 + ds1305_nvram_write(struct file *filp, struct kobject *kobj, 576 + struct bin_attribute *attr, 577 577 char *buf, loff_t off, size_t count) 578 578 { 579 579 struct spi_device *spi;
+4 -2
drivers/rtc/rtc-ds1307.c
··· 556 556 #define NVRAM_SIZE 56 557 557 558 558 static ssize_t 559 - ds1307_nvram_read(struct kobject *kobj, struct bin_attribute *attr, 559 + ds1307_nvram_read(struct file *filp, struct kobject *kobj, 560 + struct bin_attribute *attr, 560 561 char *buf, loff_t off, size_t count) 561 562 { 562 563 struct i2c_client *client; ··· 581 580 } 582 581 583 582 static ssize_t 584 - ds1307_nvram_write(struct kobject *kobj, struct bin_attribute *attr, 583 + ds1307_nvram_write(struct file *filp, struct kobject *kobj, 584 + struct bin_attribute *attr, 585 585 char *buf, loff_t off, size_t count) 586 586 { 587 587 struct i2c_client *client;
+6 -4
drivers/rtc/rtc-ds1511.c
··· 423 423 }; 424 424 425 425 static ssize_t 426 - ds1511_nvram_read(struct kobject *kobj, struct bin_attribute *ba, 427 - char *buf, loff_t pos, size_t size) 426 + ds1511_nvram_read(struct file *filp, struct kobject *kobj, 427 + struct bin_attribute *ba, 428 + char *buf, loff_t pos, size_t size) 428 429 { 429 430 ssize_t count; 430 431 ··· 453 452 } 454 453 455 454 static ssize_t 456 - ds1511_nvram_write(struct kobject *kobj, struct bin_attribute *bin_attr, 457 - char *buf, loff_t pos, size_t size) 455 + ds1511_nvram_write(struct file *filp, struct kobject *kobj, 456 + struct bin_attribute *bin_attr, 457 + char *buf, loff_t pos, size_t size) 458 458 { 459 459 ssize_t count; 460 460
+2 -2
drivers/rtc/rtc-ds1553.c
··· 252 252 .update_irq_enable = ds1553_rtc_update_irq_enable, 253 253 }; 254 254 255 - static ssize_t ds1553_nvram_read(struct kobject *kobj, 255 + static ssize_t ds1553_nvram_read(struct file *filp, struct kobject *kobj, 256 256 struct bin_attribute *bin_attr, 257 257 char *buf, loff_t pos, size_t size) 258 258 { ··· 267 267 return count; 268 268 } 269 269 270 - static ssize_t ds1553_nvram_write(struct kobject *kobj, 270 + static ssize_t ds1553_nvram_write(struct file *filp, struct kobject *kobj, 271 271 struct bin_attribute *bin_attr, 272 272 char *buf, loff_t pos, size_t size) 273 273 {
+2 -2
drivers/rtc/rtc-ds1742.c
··· 128 128 .set_time = ds1742_rtc_set_time, 129 129 }; 130 130 131 - static ssize_t ds1742_nvram_read(struct kobject *kobj, 131 + static ssize_t ds1742_nvram_read(struct file *filp, struct kobject *kobj, 132 132 struct bin_attribute *bin_attr, 133 133 char *buf, loff_t pos, size_t size) 134 134 { ··· 143 143 return count; 144 144 } 145 145 146 - static ssize_t ds1742_nvram_write(struct kobject *kobj, 146 + static ssize_t ds1742_nvram_write(struct file *filp, struct kobject *kobj, 147 147 struct bin_attribute *bin_attr, 148 148 char *buf, loff_t pos, size_t size) 149 149 {
+2 -2
drivers/rtc/rtc-m48t59.c
··· 343 343 .set_time = m48t59_rtc_set_time, 344 344 }; 345 345 346 - static ssize_t m48t59_nvram_read(struct kobject *kobj, 346 + static ssize_t m48t59_nvram_read(struct file *filp, struct kobject *kobj, 347 347 struct bin_attribute *bin_attr, 348 348 char *buf, loff_t pos, size_t size) 349 349 { ··· 363 363 return cnt; 364 364 } 365 365 366 - static ssize_t m48t59_nvram_write(struct kobject *kobj, 366 + static ssize_t m48t59_nvram_write(struct file *filp, struct kobject *kobj, 367 367 struct bin_attribute *bin_attr, 368 368 char *buf, loff_t pos, size_t size) 369 369 {
+2 -2
drivers/rtc/rtc-stk17ta8.c
··· 244 244 .alarm_irq_enable = stk17ta8_rtc_alarm_irq_enable, 245 245 }; 246 246 247 - static ssize_t stk17ta8_nvram_read(struct kobject *kobj, 247 + static ssize_t stk17ta8_nvram_read(struct file *filp, struct kobject *kobj, 248 248 struct bin_attribute *attr, char *buf, 249 249 loff_t pos, size_t size) 250 250 { ··· 259 259 return count; 260 260 } 261 261 262 - static ssize_t stk17ta8_nvram_write(struct kobject *kobj, 262 + static ssize_t stk17ta8_nvram_write(struct file *filp, struct kobject *kobj, 263 263 struct bin_attribute *attr, char *buf, 264 264 loff_t pos, size_t size) 265 265 {
+2 -2
drivers/rtc/rtc-tx4939.c
··· 188 188 .alarm_irq_enable = tx4939_rtc_alarm_irq_enable, 189 189 }; 190 190 191 - static ssize_t tx4939_rtc_nvram_read(struct kobject *kobj, 191 + static ssize_t tx4939_rtc_nvram_read(struct file *filp, struct kobject *kobj, 192 192 struct bin_attribute *bin_attr, 193 193 char *buf, loff_t pos, size_t size) 194 194 { ··· 207 207 return count; 208 208 } 209 209 210 - static ssize_t tx4939_rtc_nvram_write(struct kobject *kobj, 210 + static ssize_t tx4939_rtc_nvram_write(struct file *filp, struct kobject *kobj, 211 211 struct bin_attribute *bin_attr, 212 212 char *buf, loff_t pos, size_t size) 213 213 {
+3 -2
drivers/s390/cio/chp.c
··· 135 135 /* 136 136 * Channel measurement related functions 137 137 */ 138 - static ssize_t chp_measurement_chars_read(struct kobject *kobj, 138 + static ssize_t chp_measurement_chars_read(struct file *filp, 139 + struct kobject *kobj, 139 140 struct bin_attribute *bin_attr, 140 141 char *buf, loff_t off, size_t count) 141 142 { ··· 183 182 } while (reference_buf.values[0] != buf->values[0]); 184 183 } 185 184 186 - static ssize_t chp_measurement_read(struct kobject *kobj, 185 + static ssize_t chp_measurement_read(struct file *filp, struct kobject *kobj, 187 186 struct bin_attribute *bin_attr, 188 187 char *buf, loff_t off, size_t count) 189 188 {
+2 -2
drivers/scsi/3w-sas.c
··· 98 98 /* Functions */ 99 99 100 100 /* This function returns AENs through sysfs */ 101 - static ssize_t twl_sysfs_aen_read(struct kobject *kobj, 101 + static ssize_t twl_sysfs_aen_read(struct file *filp, struct kobject *kobj, 102 102 struct bin_attribute *bin_attr, 103 103 char *outbuf, loff_t offset, size_t count) 104 104 { ··· 129 129 }; 130 130 131 131 /* This function returns driver compatibility info through sysfs */ 132 - static ssize_t twl_sysfs_compat_info(struct kobject *kobj, 132 + static ssize_t twl_sysfs_compat_info(struct file *filp, struct kobject *kobj, 133 133 struct bin_attribute *bin_attr, 134 134 char *outbuf, loff_t offset, size_t count) 135 135 {
+6 -3
drivers/scsi/arcmsr/arcmsr_attr.c
··· 59 59 60 60 struct device_attribute *arcmsr_host_attrs[]; 61 61 62 - static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, 62 + static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp, 63 + struct kobject *kobj, 63 64 struct bin_attribute *bin, 64 65 char *buf, loff_t off, 65 66 size_t count) ··· 106 105 return (allxfer_len); 107 106 } 108 107 109 - static ssize_t arcmsr_sysfs_iop_message_write(struct kobject *kobj, 108 + static ssize_t arcmsr_sysfs_iop_message_write(struct file *filp, 109 + struct kobject *kobj, 110 110 struct bin_attribute *bin, 111 111 char *buf, loff_t off, 112 112 size_t count) ··· 155 153 } 156 154 } 157 155 158 - static ssize_t arcmsr_sysfs_iop_message_clear(struct kobject *kobj, 156 + static ssize_t arcmsr_sysfs_iop_message_clear(struct file *filp, 157 + struct kobject *kobj, 159 158 struct bin_attribute *bin, 160 159 char *buf, loff_t off, 161 160 size_t count)
+2 -1
drivers/scsi/ibmvscsi/ibmvfc.c
··· 2919 2919 #ifdef CONFIG_SCSI_IBMVFC_TRACE 2920 2920 /** 2921 2921 * ibmvfc_read_trace - Dump the adapter trace 2922 + * @filp: open sysfs file 2922 2923 * @kobj: kobject struct 2923 2924 * @bin_attr: bin_attribute struct 2924 2925 * @buf: buffer ··· 2929 2928 * Return value: 2930 2929 * number of bytes printed to buffer 2931 2930 **/ 2932 - static ssize_t ibmvfc_read_trace(struct kobject *kobj, 2931 + static ssize_t ibmvfc_read_trace(struct file *filp, struct kobject *kobj, 2933 2932 struct bin_attribute *bin_attr, 2934 2933 char *buf, loff_t off, size_t count) 2935 2934 {
+6 -3
drivers/scsi/ipr.c
··· 3120 3120 #ifdef CONFIG_SCSI_IPR_TRACE 3121 3121 /** 3122 3122 * ipr_read_trace - Dump the adapter trace 3123 + * @filp: open sysfs file 3123 3124 * @kobj: kobject struct 3124 3125 * @bin_attr: bin_attribute struct 3125 3126 * @buf: buffer ··· 3130 3129 * Return value: 3131 3130 * number of bytes printed to buffer 3132 3131 **/ 3133 - static ssize_t ipr_read_trace(struct kobject *kobj, 3132 + static ssize_t ipr_read_trace(struct file *filp, struct kobject *kobj, 3134 3133 struct bin_attribute *bin_attr, 3135 3134 char *buf, loff_t off, size_t count) 3136 3135 { ··· 3765 3764 #ifdef CONFIG_SCSI_IPR_DUMP 3766 3765 /** 3767 3766 * ipr_read_dump - Dump the adapter 3767 + * @filp: open sysfs file 3768 3768 * @kobj: kobject struct 3769 3769 * @bin_attr: bin_attribute struct 3770 3770 * @buf: buffer ··· 3775 3773 * Return value: 3776 3774 * number of bytes printed to buffer 3777 3775 **/ 3778 - static ssize_t ipr_read_dump(struct kobject *kobj, 3776 + static ssize_t ipr_read_dump(struct file *filp, struct kobject *kobj, 3779 3777 struct bin_attribute *bin_attr, 3780 3778 char *buf, loff_t off, size_t count) 3781 3779 { ··· 3929 3927 3930 3928 /** 3931 3929 * ipr_write_dump - Setup dump state of adapter 3930 + * @filp: open sysfs file 3932 3931 * @kobj: kobject struct 3933 3932 * @bin_attr: bin_attribute struct 3934 3933 * @buf: buffer ··· 3939 3936 * Return value: 3940 3937 * number of bytes printed to buffer 3941 3938 **/ 3942 - static ssize_t ipr_write_dump(struct kobject *kobj, 3939 + static ssize_t ipr_write_dump(struct file *filp, struct kobject *kobj, 3943 3940 struct bin_attribute *bin_attr, 3944 3941 char *buf, loff_t off, size_t count) 3945 3942 {
+15 -5
drivers/scsi/lpfc/lpfc_attr.c
··· 2643 2643 2644 2644 /** 2645 2645 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute 2646 + * @filp: sysfs file 2646 2647 * @kobj: Pointer to the kernel object 2647 2648 * @bin_attr: Attribute object 2648 2649 * @buff: Buffer pointer ··· 2655 2654 * applications. 2656 2655 **/ 2657 2656 static ssize_t 2658 - sysfs_drvr_stat_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, 2657 + sysfs_drvr_stat_data_read(struct file *filp, struct kobject *kobj, 2658 + struct bin_attribute *bin_attr, 2659 2659 char *buf, loff_t off, size_t count) 2660 2660 { 2661 2661 struct device *dev = container_of(kobj, struct device, ··· 3364 3362 3365 3363 /** 3366 3364 * sysfs_ctlreg_write - Write method for writing to ctlreg 3365 + * @filp: open sysfs file 3367 3366 * @kobj: kernel kobject that contains the kernel class device. 3368 3367 * @bin_attr: kernel attributes passed to us. 3369 3368 * @buf: contains the data to be written to the adapter IOREG space. ··· 3382 3379 * value of count, buf contents written 3383 3380 **/ 3384 3381 static ssize_t 3385 - sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, 3382 + sysfs_ctlreg_write(struct file *filp, struct kobject *kobj, 3383 + struct bin_attribute *bin_attr, 3386 3384 char *buf, loff_t off, size_t count) 3387 3385 { 3388 3386 size_t buf_off; ··· 3419 3415 3420 3416 /** 3421 3417 * sysfs_ctlreg_read - Read method for reading from ctlreg 3418 + * @filp: open sysfs file 3422 3419 * @kobj: kernel kobject that contains the kernel class device. 3423 3420 * @bin_attr: kernel attributes passed to us. 3424 3421 * @buf: if successful contains the data from the adapter IOREG space. ··· 3436 3431 * value of count, buf contents read 3437 3432 **/ 3438 3433 static ssize_t 3439 - sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr, 3434 + sysfs_ctlreg_read(struct file *filp, struct kobject *kobj, 3435 + struct bin_attribute *bin_attr, 3440 3436 char *buf, loff_t off, size_t count) 3441 3437 { 3442 3438 size_t buf_off; ··· 3502 3496 3503 3497 /** 3504 3498 * sysfs_mbox_write - Write method for writing information via mbox 3499 + * @filp: open sysfs file 3505 3500 * @kobj: kernel kobject that contains the kernel class device. 3506 3501 * @bin_attr: kernel attributes passed to us. 3507 3502 * @buf: contains the data to be written to sysfs mbox. ··· 3523 3516 * count number of bytes transferred 3524 3517 **/ 3525 3518 static ssize_t 3526 - sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, 3519 + sysfs_mbox_write(struct file *filp, struct kobject *kobj, 3520 + struct bin_attribute *bin_attr, 3527 3521 char *buf, loff_t off, size_t count) 3528 3522 { 3529 3523 struct device *dev = container_of(kobj, struct device, kobj); ··· 3579 3571 3580 3572 /** 3581 3573 * sysfs_mbox_read - Read method for reading information via mbox 3574 + * @filp: open sysfs file 3582 3575 * @kobj: kernel kobject that contains the kernel class device. 3583 3576 * @bin_attr: kernel attributes passed to us. 3584 3577 * @buf: contains the data to be read from sysfs mbox. ··· 3602 3593 * count number of bytes transferred 3603 3594 **/ 3604 3595 static ssize_t 3605 - sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, 3596 + sysfs_mbox_read(struct file *filp, struct kobject *kobj, 3597 + struct bin_attribute *bin_attr, 3606 3598 char *buf, loff_t off, size_t count) 3607 3599 { 3608 3600 struct device *dev = container_of(kobj, struct device, kobj);
+16 -16
drivers/scsi/qla2xxx/qla_attr.c
··· 16 16 /* SYSFS attributes --------------------------------------------------------- */ 17 17 18 18 static ssize_t 19 - qla2x00_sysfs_read_fw_dump(struct kobject *kobj, 19 + qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj, 20 20 struct bin_attribute *bin_attr, 21 21 char *buf, loff_t off, size_t count) 22 22 { ··· 32 32 } 33 33 34 34 static ssize_t 35 - qla2x00_sysfs_write_fw_dump(struct kobject *kobj, 35 + qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj, 36 36 struct bin_attribute *bin_attr, 37 37 char *buf, loff_t off, size_t count) 38 38 { ··· 92 92 }; 93 93 94 94 static ssize_t 95 - qla2x00_sysfs_read_nvram(struct kobject *kobj, 95 + qla2x00_sysfs_read_nvram(struct file *filp, struct kobject *kobj, 96 96 struct bin_attribute *bin_attr, 97 97 char *buf, loff_t off, size_t count) 98 98 { ··· 111 111 } 112 112 113 113 static ssize_t 114 - qla2x00_sysfs_write_nvram(struct kobject *kobj, 114 + qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj, 115 115 struct bin_attribute *bin_attr, 116 116 char *buf, loff_t off, size_t count) 117 117 { ··· 177 177 }; 178 178 179 179 static ssize_t 180 - qla2x00_sysfs_read_optrom(struct kobject *kobj, 180 + qla2x00_sysfs_read_optrom(struct file *filp, struct kobject *kobj, 181 181 struct bin_attribute *bin_attr, 182 182 char *buf, loff_t off, size_t count) 183 183 { ··· 193 193 } 194 194 195 195 static ssize_t 196 - qla2x00_sysfs_write_optrom(struct kobject *kobj, 196 + qla2x00_sysfs_write_optrom(struct file *filp, struct kobject *kobj, 197 197 struct bin_attribute *bin_attr, 198 198 char *buf, loff_t off, size_t count) 199 199 { ··· 224 224 }; 225 225 226 226 static ssize_t 227 - qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj, 227 + qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj, 228 228 struct bin_attribute *bin_attr, 229 229 char *buf, loff_t off, size_t count) 230 230 { ··· 387 387 }; 388 388 389 389 static ssize_t 390 - qla2x00_sysfs_read_vpd(struct kobject *kobj, 390 + qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj, 391 391 struct bin_attribute *bin_attr, 392 392 char *buf, loff_t off, size_t count) 393 393 { ··· 408 408 } 409 409 410 410 static ssize_t 411 - qla2x00_sysfs_write_vpd(struct kobject *kobj, 411 + qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj, 412 412 struct bin_attribute *bin_attr, 413 413 char *buf, loff_t off, size_t count) 414 414 { ··· 461 461 }; 462 462 463 463 static ssize_t 464 - qla2x00_sysfs_read_sfp(struct kobject *kobj, 464 + qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj, 465 465 struct bin_attribute *bin_attr, 466 466 char *buf, loff_t off, size_t count) 467 467 { ··· 522 522 }; 523 523 524 524 static ssize_t 525 - qla2x00_sysfs_write_reset(struct kobject *kobj, 525 + qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj, 526 526 struct bin_attribute *bin_attr, 527 527 char *buf, loff_t off, size_t count) 528 528 { ··· 592 592 }; 593 593 594 594 static ssize_t 595 - qla2x00_sysfs_write_edc(struct kobject *kobj, 595 + qla2x00_sysfs_write_edc(struct file *filp, struct kobject *kobj, 596 596 struct bin_attribute *bin_attr, 597 597 char *buf, loff_t off, size_t count) 598 598 { ··· 650 650 }; 651 651 652 652 static ssize_t 653 - qla2x00_sysfs_write_edc_status(struct kobject *kobj, 653 + qla2x00_sysfs_write_edc_status(struct file *filp, struct kobject *kobj, 654 654 struct bin_attribute *bin_attr, 655 655 char *buf, loff_t off, size_t count) 656 656 { ··· 700 700 } 701 701 702 702 static ssize_t 703 - qla2x00_sysfs_read_edc_status(struct kobject *kobj, 703 + qla2x00_sysfs_read_edc_status(struct file *filp, struct kobject *kobj, 704 704 struct bin_attribute *bin_attr, 705 705 char *buf, loff_t off, size_t count) 706 706 { ··· 730 730 }; 731 731 732 732 static ssize_t 733 - qla2x00_sysfs_read_xgmac_stats(struct kobject *kobj, 733 + qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj, 734 734 struct bin_attribute *bin_attr, 735 735 char *buf, loff_t off, size_t count) 736 736 { ··· 782 782 }; 783 783 784 784 static ssize_t 785 - qla2x00_sysfs_read_dcbx_tlv(struct kobject *kobj, 785 + qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj, 786 786 struct bin_attribute *bin_attr, 787 787 char *buf, loff_t off, size_t count) 788 788 {
+2 -1
drivers/staging/udlfb/udlfb.c
··· 1063 1063 atomic_read(&dev->lost_pixels) ? "yes" : "no"); 1064 1064 } 1065 1065 1066 - static ssize_t edid_show(struct kobject *kobj, struct bin_attribute *a, 1066 + static ssize_t edid_show(struct file *filp, struct kobject *kobj, 1067 + struct bin_attribute *a, 1067 1068 char *buf, loff_t off, size_t count) { 1068 1069 struct device *fbdev = container_of(kobj, struct device, kobj); 1069 1070 struct fb_info *fb_info = dev_get_drvdata(fbdev);
+2 -1
drivers/usb/core/sysfs.c
··· 658 658 /* Binary descriptors */ 659 659 660 660 static ssize_t 661 - read_descriptors(struct kobject *kobj, struct bin_attribute *attr, 661 + read_descriptors(struct file *filp, struct kobject *kobj, 662 + struct bin_attribute *attr, 662 663 char *buf, loff_t off, size_t count) 663 664 { 664 665 struct device *dev = container_of(kobj, struct device, kobj);
+2 -2
drivers/video/aty/radeon_base.c
··· 2099 2099 } 2100 2100 2101 2101 2102 - static ssize_t radeon_show_edid1(struct kobject *kobj, 2102 + static ssize_t radeon_show_edid1(struct file *filp, struct kobject *kobj, 2103 2103 struct bin_attribute *bin_attr, 2104 2104 char *buf, loff_t off, size_t count) 2105 2105 { ··· 2112 2112 } 2113 2113 2114 2114 2115 - static ssize_t radeon_show_edid2(struct kobject *kobj, 2115 + static ssize_t radeon_show_edid2(struct file *filp, struct kobject *kobj, 2116 2116 struct bin_attribute *bin_attr, 2117 2117 char *buf, loff_t off, size_t count) 2118 2118 {
+2 -2
drivers/w1/slaves/w1_ds2431.c
··· 96 96 return -1; 97 97 } 98 98 99 - static ssize_t w1_f2d_read_bin(struct kobject *kobj, 99 + static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj, 100 100 struct bin_attribute *bin_attr, 101 101 char *buf, loff_t off, size_t count) 102 102 { ··· 202 202 return 0; 203 203 } 204 204 205 - static ssize_t w1_f2d_write_bin(struct kobject *kobj, 205 + static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj, 206 206 struct bin_attribute *bin_attr, 207 207 char *buf, loff_t off, size_t count) 208 208 {
+2 -2
drivers/w1/slaves/w1_ds2433.c
··· 92 92 } 93 93 #endif /* CONFIG_W1_SLAVE_DS2433_CRC */ 94 94 95 - static ssize_t w1_f23_read_bin(struct kobject *kobj, 95 + static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj, 96 96 struct bin_attribute *bin_attr, 97 97 char *buf, loff_t off, size_t count) 98 98 { ··· 206 206 return 0; 207 207 } 208 208 209 - static ssize_t w1_f23_write_bin(struct kobject *kobj, 209 + static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj, 210 210 struct bin_attribute *bin_attr, 211 211 char *buf, loff_t off, size_t count) 212 212 {
+1 -1
drivers/w1/slaves/w1_ds2760.c
··· 97 97 return w1_ds2760_eeprom_cmd(dev, addr, W1_DS2760_RECALL_DATA); 98 98 } 99 99 100 - static ssize_t w1_ds2760_read_bin(struct kobject *kobj, 100 + static ssize_t w1_ds2760_read_bin(struct file *filp, struct kobject *kobj, 101 101 struct bin_attribute *bin_attr, 102 102 char *buf, loff_t off, size_t count) 103 103 {
+2 -2
drivers/w1/w1.c
··· 120 120 121 121 /* Default family */ 122 122 123 - static ssize_t w1_default_write(struct kobject *kobj, 123 + static ssize_t w1_default_write(struct file *filp, struct kobject *kobj, 124 124 struct bin_attribute *bin_attr, 125 125 char *buf, loff_t off, size_t count) 126 126 { ··· 139 139 return count; 140 140 } 141 141 142 - static ssize_t w1_default_read(struct kobject *kobj, 142 + static ssize_t w1_default_read(struct file *filp, struct kobject *kobj, 143 143 struct bin_attribute *bin_attr, 144 144 char *buf, loff_t off, size_t count) 145 145 {
+1 -1
drivers/zorro/zorro-sysfs.c
··· 49 49 50 50 static DEVICE_ATTR(resource, S_IRUGO, zorro_show_resource, NULL); 51 51 52 - static ssize_t zorro_read_config(struct kobject *kobj, 52 + static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj, 53 53 struct bin_attribute *bin_attr, 54 54 char *buf, loff_t off, size_t count) 55 55 {
+11 -13
fs/sysfs/bin.c
··· 46 46 }; 47 47 48 48 static int 49 - fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) 49 + fill_read(struct file *file, char *buffer, loff_t off, size_t count) 50 50 { 51 - struct sysfs_dirent *attr_sd = dentry->d_fsdata; 51 + struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 52 52 struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; 53 53 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; 54 54 int rc; ··· 59 59 60 60 rc = -EIO; 61 61 if (attr->read) 62 - rc = attr->read(kobj, attr, buffer, off, count); 62 + rc = attr->read(file, kobj, attr, buffer, off, count); 63 63 64 64 sysfs_put_active(attr_sd); 65 65 ··· 70 70 read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off) 71 71 { 72 72 struct bin_buffer *bb = file->private_data; 73 - struct dentry *dentry = file->f_path.dentry; 74 - int size = dentry->d_inode->i_size; 73 + int size = file->f_path.dentry->d_inode->i_size; 75 74 loff_t offs = *off; 76 75 int count = min_t(size_t, bytes, PAGE_SIZE); 77 76 char *temp; ··· 91 92 92 93 mutex_lock(&bb->mutex); 93 94 94 - count = fill_read(dentry, bb->buffer, offs, count); 95 + count = fill_read(file, bb->buffer, offs, count); 95 96 if (count < 0) { 96 97 mutex_unlock(&bb->mutex); 97 98 goto out_free; ··· 116 117 } 117 118 118 119 static int 119 - flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) 120 + flush_write(struct file *file, char *buffer, loff_t offset, size_t count) 120 121 { 121 - struct sysfs_dirent *attr_sd = dentry->d_fsdata; 122 + struct sysfs_dirent *attr_sd = file->f_path.dentry->d_fsdata; 122 123 struct bin_attribute *attr = attr_sd->s_bin_attr.bin_attr; 123 124 struct kobject *kobj = attr_sd->s_parent->s_dir.kobj; 124 125 int rc; ··· 129 130 130 131 rc = -EIO; 131 132 if (attr->write) 132 - rc = attr->write(kobj, attr, buffer, offset, count); 133 + rc = attr->write(file, kobj, attr, buffer, offset, count); 133 134 134 135 sysfs_put_active(attr_sd); 135 136 ··· 140 141 size_t bytes, loff_t *off) 141 142 { 142 143 struct bin_buffer *bb = file->private_data; 143 - struct dentry *dentry = file->f_path.dentry; 144 - int size = dentry->d_inode->i_size; 144 + int size = file->f_path.dentry->d_inode->i_size; 145 145 loff_t offs = *off; 146 146 int count = min_t(size_t, bytes, PAGE_SIZE); 147 147 char *temp; ··· 163 165 164 166 memcpy(bb->buffer, temp, count); 165 167 166 - count = flush_write(dentry, bb->buffer, offs, count); 168 + count = flush_write(file, bb->buffer, offs, count); 167 169 mutex_unlock(&bb->mutex); 168 170 169 171 if (count > 0) ··· 361 363 if (!attr->mmap) 362 364 goto out_put; 363 365 364 - rc = attr->mmap(kobj, attr, vma); 366 + rc = attr->mmap(file, kobj, attr, vma); 365 367 if (rc) 366 368 goto out_put; 367 369
+4 -3
include/linux/sysfs.h
··· 87 87 88 88 #define attr_name(_attr) (_attr).attr.name 89 89 90 + struct file; 90 91 struct vm_area_struct; 91 92 92 93 struct bin_attribute { 93 94 struct attribute attr; 94 95 size_t size; 95 96 void *private; 96 - ssize_t (*read)(struct kobject *, struct bin_attribute *, 97 + ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, 97 98 char *, loff_t, size_t); 98 - ssize_t (*write)(struct kobject *, struct bin_attribute *, 99 + ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *, 99 100 char *, loff_t, size_t); 100 - int (*mmap)(struct kobject *, struct bin_attribute *attr, 101 + int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, 101 102 struct vm_area_struct *vma); 102 103 }; 103 104
+2 -1
kernel/ksysfs.c
··· 138 138 extern const void __stop_notes __attribute__((weak)); 139 139 #define notes_size (&__stop_notes - &__start_notes) 140 140 141 - static ssize_t notes_read(struct kobject *kobj, struct bin_attribute *bin_attr, 141 + static ssize_t notes_read(struct file *filp, struct kobject *kobj, 142 + struct bin_attribute *bin_attr, 142 143 char *buf, loff_t off, size_t count) 143 144 { 144 145 memcpy(buf, &__start_notes + off, count);
+1 -1
kernel/module.c
··· 1182 1182 struct bin_attribute attrs[0]; 1183 1183 }; 1184 1184 1185 - static ssize_t module_notes_read(struct kobject *kobj, 1185 + static ssize_t module_notes_read(struct file *filp, struct kobject *kobj, 1186 1186 struct bin_attribute *bin_attr, 1187 1187 char *buf, loff_t pos, size_t count) 1188 1188 {
+1 -1
net/bridge/br_sysfs_br.c
··· 659 659 * 660 660 * Returns the number of bytes read. 661 661 */ 662 - static ssize_t brforward_read(struct kobject *kobj, 662 + static ssize_t brforward_read(struct file *filp, struct kobject *kobj, 663 663 struct bin_attribute *bin_attr, 664 664 char *buf, loff_t off, size_t count) 665 665 {