Lines Matching refs:attr
822 struct simple_attr *attr; in simple_attr_open() local
824 attr = kmalloc(sizeof(*attr), GFP_KERNEL); in simple_attr_open()
825 if (!attr) in simple_attr_open()
828 attr->get = get; in simple_attr_open()
829 attr->set = set; in simple_attr_open()
830 attr->data = inode->i_private; in simple_attr_open()
831 attr->fmt = fmt; in simple_attr_open()
832 mutex_init(&attr->mutex); in simple_attr_open()
834 file->private_data = attr; in simple_attr_open()
851 struct simple_attr *attr; in simple_attr_read() local
855 attr = file->private_data; in simple_attr_read()
857 if (!attr->get) in simple_attr_read()
860 ret = mutex_lock_interruptible(&attr->mutex); in simple_attr_read()
865 size = strlen(attr->get_buf); in simple_attr_read()
868 ret = attr->get(attr->data, &val); in simple_attr_read()
872 size = scnprintf(attr->get_buf, sizeof(attr->get_buf), in simple_attr_read()
873 attr->fmt, (unsigned long long)val); in simple_attr_read()
876 ret = simple_read_from_buffer(buf, len, ppos, attr->get_buf, size); in simple_attr_read()
878 mutex_unlock(&attr->mutex); in simple_attr_read()
887 struct simple_attr *attr; in simple_attr_write() local
892 attr = file->private_data; in simple_attr_write()
893 if (!attr->set) in simple_attr_write()
896 ret = mutex_lock_interruptible(&attr->mutex); in simple_attr_write()
901 size = min(sizeof(attr->set_buf) - 1, len); in simple_attr_write()
902 if (copy_from_user(attr->set_buf, buf, size)) in simple_attr_write()
905 attr->set_buf[size] = '\0'; in simple_attr_write()
906 val = simple_strtoll(attr->set_buf, NULL, 0); in simple_attr_write()
907 ret = attr->set(attr->data, val); in simple_attr_write()
911 mutex_unlock(&attr->mutex); in simple_attr_write()
1235 static int empty_dir_setattr(struct dentry *dentry, struct iattr *attr) in empty_dir_setattr() argument