X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnodemap_lproc.c;h=e6f109cb145e7fd6a98cbfdb5226d3cefabcd595;hb=5d8f6742e65d588d907b77ffc6fcdb2552d855b9;hp=81678836a28c25ddd1bdca6f5ee31e191f72b505;hpb=bb0a1075285076567bf9c3c406116682f0997579;p=fs%2Flustre-release.git diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c index 8167883..e6f109c 100644 --- a/lustre/ptlrpc/nodemap_lproc.c +++ b/lustre/ptlrpc/nodemap_lproc.c @@ -118,7 +118,6 @@ static int nodemap_ranges_show(struct seq_file *m, void *data) { struct lu_nodemap *nodemap; struct lu_nid_range *range; - struct interval_node_extent ext; char start_nidstr[LNET_NIDSTR_SIZE]; char end_nidstr[LNET_NIDSTR_SIZE]; bool cont = false; @@ -140,9 +139,8 @@ static int nodemap_ranges_show(struct seq_file *m, void *data) if (cont) seq_printf(m, ",\n"); cont = 1; - ext = range->rn_node.in_extent; - libcfs_nid2str_r(ext.start, start_nidstr, sizeof(start_nidstr)); - libcfs_nid2str_r(ext.end, end_nidstr, sizeof(end_nidstr)); + libcfs_nid2str_r(range->rn_start, start_nidstr, sizeof(start_nidstr)); + libcfs_nid2str_r(range->rn_end, end_nidstr, sizeof(end_nidstr)); seq_printf(m, " { id: %u, start_nid: %s, end_nid: %s }", range->rn_id, start_nidstr, end_nidstr); } @@ -286,7 +284,8 @@ nodemap_sepol_seq_write(struct file *file, char sepol[LUSTRE_NODEMAP_SEPOL_LENGTH + 1]; int rc = 0; - CLASSERT(sizeof(sepol) == sizeof(((struct lu_nodemap *)0)->nm_sepol)); + BUILD_BUG_ON(sizeof(sepol) != + sizeof(((struct lu_nodemap *)0)->nm_sepol)); if (count > 0) { if (count >= sizeof(sepol)) @@ -636,6 +635,33 @@ static int nodemap_audit_mode_seq_show(struct seq_file *m, void *data) return 0; } +/** + * Reads and prints the forbid_encryption flag for the given nodemap. + * + * \param m seq file in proc fs + * \param data unused + * \retval 0 success + */ +static int nodemap_forbid_encryption_seq_show(struct seq_file *m, void *data) +{ + struct lu_nodemap *nodemap; + int rc; + + mutex_lock(&active_config_lock); + nodemap = nodemap_lookup(m->private); + mutex_unlock(&active_config_lock); + if (IS_ERR(nodemap)) { + rc = PTR_ERR(nodemap); + CERROR("cannot find nodemap '%s': rc = %d\n", + (char *)m->private, rc); + return rc; + } + + seq_printf(m, "%d\n", (int)nodemap->nmf_forbid_encryption); + nodemap_putref(nodemap); + return 0; +} + static struct lprocfs_vars lprocfs_nm_module_vars[] = { { .name = "active", @@ -654,26 +680,27 @@ LPROC_SEQ_FOPS_RO(nodemap_squash_gid); LPROC_SEQ_FOPS_RO(nodemap_deny_unknown); LPROC_SEQ_FOPS_RO(nodemap_map_mode); LPROC_SEQ_FOPS_RO(nodemap_audit_mode); +LPROC_SEQ_FOPS_RO(nodemap_forbid_encryption); -const struct file_operations nodemap_ranges_fops = { - .open = nodemap_ranges_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release +static const struct proc_ops nodemap_ranges_fops = { + .proc_open = nodemap_ranges_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release }; -const struct file_operations nodemap_idmap_fops = { - .open = nodemap_idmap_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release +static const struct proc_ops nodemap_idmap_fops = { + .proc_open = nodemap_idmap_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release }; -const struct file_operations nodemap_exports_fops = { - .open = nodemap_exports_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release +static const struct proc_ops nodemap_exports_fops = { + .proc_open = nodemap_exports_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release }; static struct lprocfs_vars lprocfs_nodemap_vars[] = { @@ -702,6 +729,10 @@ static struct lprocfs_vars lprocfs_nodemap_vars[] = { .fops = &nodemap_audit_mode_fops, }, { + .name = "forbid_encryption", + .fops = &nodemap_forbid_encryption_fops, + }, + { .name = "squash_uid", .fops = &nodemap_squash_uid_fops, }, @@ -772,6 +803,10 @@ static struct lprocfs_vars lprocfs_default_nodemap_vars[] = { .fops = &nodemap_audit_mode_fops, }, { + .name = "forbid_encryption", + .fops = &nodemap_forbid_encryption_fops, + }, + { NULL } };