aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/file.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-03-20 21:47:52 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-22 16:16:31 -0400
commit0f4238958d28044b335644b69df6071cdb04b5ce (patch)
tree159b82f8eb9479cdc10f861d682309b4c0c8c411 /fs/sysfs/file.c
parentbbd1ae412c9eb09ae7bb11cfaf7018a2367d493f (diff)
[SCSI] sysfs: make group is_valid return a mode_t
We have a problem in scsi_transport_spi in that we need to customise not only the visibility of the attributes, but also their mode. Fix this by making the is_visible() callback return a mode, with 0 indicating is not visible. Also add a sysfs_update_group() API to allow us to change either the visibility or mode of the files at any time on the fly. Acked-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r--fs/sysfs/file.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index ade9a7e6a757..dbdfabbfd609 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -477,11 +477,10 @@ const struct file_operations sysfs_file_operations = {
477 .poll = sysfs_poll, 477 .poll = sysfs_poll,
478}; 478};
479 479
480 480int sysfs_add_file_mode(struct sysfs_dirent *dir_sd,
481int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr, 481 const struct attribute *attr, int type, mode_t amode)
482 int type)
483{ 482{
484 umode_t mode = (attr->mode & S_IALLUGO) | S_IFREG; 483 umode_t mode = (amode & S_IALLUGO) | S_IFREG;
485 struct sysfs_addrm_cxt acxt; 484 struct sysfs_addrm_cxt acxt;
486 struct sysfs_dirent *sd; 485 struct sysfs_dirent *sd;
487 int rc; 486 int rc;
@@ -502,6 +501,13 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
502} 501}
503 502
504 503
504int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
505 int type)
506{
507 return sysfs_add_file_mode(dir_sd, attr, type, attr->mode);
508}
509
510
505/** 511/**
506 * sysfs_create_file - create an attribute file for an object. 512 * sysfs_create_file - create an attribute file for an object.
507 * @kobj: object we're creating for. 513 * @kobj: object we're creating for.