ia64/linux-2.6.18-xen.hg

annotate crypto/proc.c @ 749:2892ca2b9c17

linux/x86: cleanup IO-APIC code

- get 32-bit code in sync with 64-bit wrt ExtINT pin detection being
unnecessary
- eliminate build warnings resulting from c/s 725

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 28 13:31:21 2008 +0000 (2008-11-28)
parents 831230e53067
children
rev   line source
ian@0 1 /*
ian@0 2 * Scatterlist Cryptographic API.
ian@0 3 *
ian@0 4 * Procfs information.
ian@0 5 *
ian@0 6 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
ian@0 7 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
ian@0 8 *
ian@0 9 * This program is free software; you can redistribute it and/or modify it
ian@0 10 * under the terms of the GNU General Public License as published by the Free
ian@0 11 * Software Foundation; either version 2 of the License, or (at your option)
ian@0 12 * any later version.
ian@0 13 *
ian@0 14 */
ian@0 15 #include <linux/init.h>
ian@0 16 #include <linux/crypto.h>
ian@0 17 #include <linux/rwsem.h>
ian@0 18 #include <linux/proc_fs.h>
ian@0 19 #include <linux/seq_file.h>
ian@0 20 #include "internal.h"
ian@0 21
ian@0 22 static void *c_start(struct seq_file *m, loff_t *pos)
ian@0 23 {
ian@0 24 struct list_head *v;
ian@0 25 loff_t n = *pos;
ian@0 26
ian@0 27 down_read(&crypto_alg_sem);
ian@0 28 list_for_each(v, &crypto_alg_list)
ian@0 29 if (!n--)
ian@0 30 return list_entry(v, struct crypto_alg, cra_list);
ian@0 31 return NULL;
ian@0 32 }
ian@0 33
ian@0 34 static void *c_next(struct seq_file *m, void *p, loff_t *pos)
ian@0 35 {
ian@0 36 struct list_head *v = p;
ian@0 37
ian@0 38 (*pos)++;
ian@0 39 v = v->next;
ian@0 40 return (v == &crypto_alg_list) ?
ian@0 41 NULL : list_entry(v, struct crypto_alg, cra_list);
ian@0 42 }
ian@0 43
ian@0 44 static void c_stop(struct seq_file *m, void *p)
ian@0 45 {
ian@0 46 up_read(&crypto_alg_sem);
ian@0 47 }
ian@0 48
ian@0 49 static int c_show(struct seq_file *m, void *p)
ian@0 50 {
ian@0 51 struct crypto_alg *alg = (struct crypto_alg *)p;
ian@0 52
ian@0 53 seq_printf(m, "name : %s\n", alg->cra_name);
ian@0 54 seq_printf(m, "driver : %s\n", alg->cra_driver_name);
ian@0 55 seq_printf(m, "module : %s\n", module_name(alg->cra_module));
ian@0 56 seq_printf(m, "priority : %d\n", alg->cra_priority);
ian@0 57
ian@0 58 switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
ian@0 59 case CRYPTO_ALG_TYPE_CIPHER:
ian@0 60 seq_printf(m, "type : cipher\n");
ian@0 61 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
ian@0 62 seq_printf(m, "min keysize : %u\n",
ian@0 63 alg->cra_cipher.cia_min_keysize);
ian@0 64 seq_printf(m, "max keysize : %u\n",
ian@0 65 alg->cra_cipher.cia_max_keysize);
ian@0 66 break;
ian@0 67
ian@0 68 case CRYPTO_ALG_TYPE_DIGEST:
ian@0 69 seq_printf(m, "type : digest\n");
ian@0 70 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
ian@0 71 seq_printf(m, "digestsize : %u\n",
ian@0 72 alg->cra_digest.dia_digestsize);
ian@0 73 break;
ian@0 74 case CRYPTO_ALG_TYPE_COMPRESS:
ian@0 75 seq_printf(m, "type : compression\n");
ian@0 76 break;
ian@0 77 default:
ian@0 78 seq_printf(m, "type : unknown\n");
ian@0 79 break;
ian@0 80 }
ian@0 81
ian@0 82 seq_putc(m, '\n');
ian@0 83 return 0;
ian@0 84 }
ian@0 85
ian@0 86 static struct seq_operations crypto_seq_ops = {
ian@0 87 .start = c_start,
ian@0 88 .next = c_next,
ian@0 89 .stop = c_stop,
ian@0 90 .show = c_show
ian@0 91 };
ian@0 92
ian@0 93 static int crypto_info_open(struct inode *inode, struct file *file)
ian@0 94 {
ian@0 95 return seq_open(file, &crypto_seq_ops);
ian@0 96 }
ian@0 97
ian@0 98 static struct file_operations proc_crypto_ops = {
ian@0 99 .open = crypto_info_open,
ian@0 100 .read = seq_read,
ian@0 101 .llseek = seq_lseek,
ian@0 102 .release = seq_release
ian@0 103 };
ian@0 104
ian@0 105 void __init crypto_init_proc(void)
ian@0 106 {
ian@0 107 struct proc_dir_entry *proc;
ian@0 108
ian@0 109 proc = create_proc_entry("crypto", 0, NULL);
ian@0 110 if (proc)
ian@0 111 proc->proc_fops = &proc_crypto_ops;
ian@0 112 }