X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fsysfs%2Ffile.c;h=c9e4e5091da14c24b185b67419f3207188150f96;hb=99fcd77d15357e8ba51005c25cc750b9c28b2688;hp=ade9a7e6a75763cd11304a638113f86e18f09d01;hpb=135cedad7457be6a96d5e151dfd48f7888a75e94;p=linux-2.6-omap-h63xx.git diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index ade9a7e6a75..c9e4e5091da 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -135,7 +136,7 @@ sysfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos) goto out; } pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n", - __FUNCTION__, count, *ppos, buffer->page); + __func__, count, *ppos, buffer->page); retval = simple_read_from_buffer(buf, count, ppos, buffer->page, buffer->count); out: @@ -336,9 +337,8 @@ static int sysfs_open_file(struct inode *inode, struct file *file) if (kobj->ktype && kobj->ktype->sysfs_ops) ops = kobj->ktype->sysfs_ops; else { - printk(KERN_ERR "missing sysfs attribute operations for " + WARN(1, KERN_ERR "missing sysfs attribute operations for " "kobject: %s\n", kobject_name(kobj)); - WARN_ON(1); goto err_out; } @@ -477,11 +477,10 @@ const struct file_operations sysfs_file_operations = { .poll = sysfs_poll, }; - -int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr, - int type) +int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, + const struct attribute *attr, int type, mode_t amode) { - umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; + umode_t mode = (amode & S_IALLUGO) | S_IFREG; struct sysfs_addrm_cxt acxt; struct sysfs_dirent *sd; int rc; @@ -502,6 +501,13 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr, } +int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr, + int type) +{ + return sysfs_add_file_mode(dir_sd, attr, type, attr->mode); +} + + /** * sysfs_create_file - create an attribute file for an object. * @kobj: object we're creating for. @@ -579,9 +585,11 @@ int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; - rc = notify_change(victim, &newattrs); + newattrs.ia_ctime = current_fs_time(inode->i_sb); + rc = sysfs_setattr(victim, &newattrs); if (rc == 0) { + fsnotify_change(victim, newattrs.ia_valid); mutex_lock(&sysfs_mutex); victim_sd->s_mode = newattrs.ia_mode; mutex_unlock(&sysfs_mutex);