From 9df7c5fcecfa1a0fb844232e3b12d2b4c690741c Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 20 Dec 2004 18:37:07 -0800 Subject: [PATCH] sysfs: add mmap support to struct bin_attribute files This patch adds an mmap method and some more error checking to struct bin_attribute--good for things like exporting PCI resources directly. I wasn't sure about the return values for the case where an attribute is missing a given method, and it looks like mm.h can't be included in sysfs.h, so I had to forward declare struct vm_area_struct. Other than that, it works fine for my test cases. Signed-off-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- include/linux/sysfs.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/linux/sysfs.h') diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index d12ee2b1eaef..6f502ff7902a 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -2,6 +2,7 @@ * sysfs.h - definitions for the device driver filesystem * * Copyright (c) 2001,2002 Patrick Mochel + * Copyright (c) 2004 Silicon Graphics, Inc. * * Please see Documentation/filesystems/sysfs.txt for more information. */ @@ -47,11 +48,16 @@ struct attribute_group { #define attr_name(_attr) (_attr).attr.name +struct vm_area_struct; + struct bin_attribute { struct attribute attr; size_t size; + void *private; ssize_t (*read)(struct kobject *, char *, loff_t, size_t); ssize_t (*write)(struct kobject *, char *, loff_t, size_t); + int (*mmap)(struct kobject *, struct bin_attribute *attr, + struct vm_area_struct *vma); }; struct sysfs_ops { -- cgit v1.2.3