From 0aa28f6d879e365b7691b96f2f0e58b0c0227fae Mon Sep 17 00:00:00 2001 From: bobijam Date: Wed, 10 Sep 2008 02:52:18 +0000 Subject: [PATCH] Branch b1_8_gate b=16643 o=Herb Wartens (hwartens@llnl.gov) i=adilger i=johann Description: Generic /proc file permissions Details : Set /Proc file permissions in a more generic way to enable non- root users operate on some /proc files. --- lustre/obdclass/lprocfs_status.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 32b0b26..9746b74 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -239,6 +239,17 @@ struct file_operations lprocfs_evict_client_fops = { }; EXPORT_SYMBOL(lprocfs_evict_client_fops); +/** + * Add /proc entrys. + * + * \param root [in] The parent proc entry on which new entry will be added. + * \param list [in] Array of proc entries to be added. + * \param data [in] The argument to be passed when entries read/write routines + * are called through /proc file. + * + * \retval 0 on success + * < 0 on error + */ int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, void *data) { @@ -278,10 +289,14 @@ int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, proc_mkdir(cur, cur_root)); } else if (proc == NULL) { mode_t mode = 0; - if (list->read_fptr) - mode = 0444; - if (list->write_fptr) - mode |= 0200; + if (list->proc_mode != 0000) { + mode = list->proc_mode; + } else { + if (list->read_fptr) + mode = 0444; + if (list->write_fptr) + mode |= 0200; + } proc = create_proc_entry(cur, mode, cur_root); } } -- 1.8.3.1