diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-05-13 09:22:10 -0400 |
|---|---|---|
| committer | Dave Kleikamp <shaggy@linux.vnet.ibm.com> | 2008-05-13 09:22:10 -0400 |
| commit | b2e03ca7485cac033a0667d9e45e28d32fdee9a5 (patch) | |
| tree | c439fb22c543027143cebe17512b77964bd0ec20 | |
| parent | 88f85a55c0645c2b7e03bf34d2a90eddf6de34fa (diff) | |
JFS: switch to seq_files
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
| -rw-r--r-- | fs/jfs/jfs_debug.c | 62 | ||||
| -rw-r--r-- | fs/jfs/jfs_debug.h | 10 | ||||
| -rw-r--r-- | fs/jfs/jfs_logmgr.c | 35 | ||||
| -rw-r--r-- | fs/jfs/jfs_metapage.c | 36 | ||||
| -rw-r--r-- | fs/jfs/jfs_txnmgr.c | 68 | ||||
| -rw-r--r-- | fs/jfs/jfs_xtree.c | 36 |
6 files changed, 114 insertions, 133 deletions
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index bf6ab19b86ee..6a73de84bcef 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/ctype.h> | 21 | #include <linux/ctype.h> |
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/proc_fs.h> | 23 | #include <linux/proc_fs.h> |
| 24 | #include <linux/seq_file.h> | ||
| 24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| 25 | #include "jfs_incore.h" | 26 | #include "jfs_incore.h" |
| 26 | #include "jfs_filsys.h" | 27 | #include "jfs_filsys.h" |
| @@ -30,29 +31,19 @@ | |||
| 30 | 31 | ||
| 31 | static struct proc_dir_entry *base; | 32 | static struct proc_dir_entry *base; |
| 32 | #ifdef CONFIG_JFS_DEBUG | 33 | #ifdef CONFIG_JFS_DEBUG |
| 33 | static int loglevel_read(char *page, char **start, off_t off, | 34 | static int jfs_loglevel_proc_show(struct seq_file *m, void *v) |
| 34 | int count, int *eof, void *data) | ||
| 35 | { | 35 | { |
| 36 | int len; | 36 | seq_printf(m, "%d\n", jfsloglevel); |
| 37 | 37 | return 0; | |
| 38 | len = sprintf(page, "%d\n", jfsloglevel); | 38 | } |
| 39 | |||
| 40 | len -= off; | ||
| 41 | *start = page + off; | ||
| 42 | |||
| 43 | if (len > count) | ||
| 44 | len = count; | ||
| 45 | else | ||
| 46 | *eof = 1; | ||
| 47 | |||
| 48 | if (len < 0) | ||
| 49 | len = 0; | ||
| 50 | 39 | ||
| 51 | return len; | 40 | static int jfs_loglevel_proc_open(struct inode *inode, struct file *file) |
| 41 | { | ||
| 42 | return single_open(file, jfs_loglevel_proc_show, NULL); | ||
| 52 | } | 43 | } |
| 53 | 44 | ||
| 54 | static int loglevel_write(struct file *file, const char __user *buffer, | 45 | static ssize_t jfs_loglevel_proc_write(struct file *file, |
| 55 | unsigned long count, void *data) | 46 | const char __user *buffer, size_t count, loff_t *ppos) |
| 56 | { | 47 | { |
| 57 | char c; | 48 | char c; |
| 58 | 49 | ||
| @@ -65,22 +56,30 @@ static int loglevel_write(struct file *file, const char __user *buffer, | |||
| 65 | jfsloglevel = c - '0'; | 56 | jfsloglevel = c - '0'; |
| 66 | return count; | 57 | return count; |
| 67 | } | 58 | } |
| 59 | |||
| 60 | static const struct file_operations jfs_loglevel_proc_fops = { | ||
| 61 | .owner = THIS_MODULE, | ||
| 62 | .open = jfs_loglevel_proc_open, | ||
| 63 | .read = seq_read, | ||
| 64 | .llseek = seq_lseek, | ||
| 65 | .release = single_release, | ||
| 66 | .write = jfs_loglevel_proc_write, | ||
| 67 | }; | ||
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | static struct { | 70 | static struct { |
| 71 | const char *name; | 71 | const char *name; |
| 72 | read_proc_t *read_fn; | 72 | const struct file_operations *proc_fops; |
| 73 | write_proc_t *write_fn; | ||
| 74 | } Entries[] = { | 73 | } Entries[] = { |
| 75 | #ifdef CONFIG_JFS_STATISTICS | 74 | #ifdef CONFIG_JFS_STATISTICS |
| 76 | { "lmstats", jfs_lmstats_read, }, | 75 | { "lmstats", &jfs_lmstats_proc_fops, }, |
| 77 | { "txstats", jfs_txstats_read, }, | 76 | { "txstats", &jfs_txstats_proc_fops, }, |
| 78 | { "xtstat", jfs_xtstat_read, }, | 77 | { "xtstat", &jfs_xtstat_proc_fops, }, |
| 79 | { "mpstat", jfs_mpstat_read, }, | 78 | { "mpstat", &jfs_mpstat_proc_fops, }, |
| 80 | #endif | 79 | #endif |
| 81 | #ifdef CONFIG_JFS_DEBUG | 80 | #ifdef CONFIG_JFS_DEBUG |
| 82 | { "TxAnchor", jfs_txanchor_read, }, | 81 | { "TxAnchor", &jfs_txanchor_proc_fops, }, |
| 83 | { "loglevel", loglevel_read, loglevel_write } | 82 | { "loglevel", &jfs_loglevel_proc_fops } |
| 84 | #endif | 83 | #endif |
| 85 | }; | 84 | }; |
| 86 | #define NPROCENT ARRAY_SIZE(Entries) | 85 | #define NPROCENT ARRAY_SIZE(Entries) |
| @@ -93,13 +92,8 @@ void jfs_proc_init(void) | |||
| 93 | return; | 92 | return; |
| 94 | base->owner = THIS_MODULE; | 93 | base->owner = THIS_MODULE; |
| 95 | 94 | ||
| 96 | for (i = 0; i < NPROCENT; i++) { | 95 | for (i = 0; i < NPROCENT; i++) |
| 97 | struct proc_dir_entry *p; | 96 | proc_create(Entries[i].name, 0, base, Entries[i].proc_fops); |
| 98 | if ((p = create_proc_entry(Entries[i].name, 0, base))) { | ||
| 99 | p->read_proc = Entries[i].read_fn; | ||
| 100 | p->write_proc = Entries[i].write_fn; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | 97 | } |
| 104 | 98 | ||
| 105 | void jfs_proc_clean(void) | 99 | void jfs_proc_clean(void) |
diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h index 044c1e654cc0..eafd1300a00b 100644 --- a/fs/jfs/jfs_debug.h +++ b/fs/jfs/jfs_debug.h | |||
| @@ -62,7 +62,7 @@ extern void jfs_proc_clean(void); | |||
| 62 | 62 | ||
| 63 | extern int jfsloglevel; | 63 | extern int jfsloglevel; |
| 64 | 64 | ||
| 65 | extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *); | 65 | extern const struct file_operations jfs_txanchor_proc_fops; |
| 66 | 66 | ||
| 67 | /* information message: e.g., configuration, major event */ | 67 | /* information message: e.g., configuration, major event */ |
| 68 | #define jfs_info(fmt, arg...) do { \ | 68 | #define jfs_info(fmt, arg...) do { \ |
| @@ -105,10 +105,10 @@ extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *); | |||
| 105 | * ---------- | 105 | * ---------- |
| 106 | */ | 106 | */ |
| 107 | #ifdef CONFIG_JFS_STATISTICS | 107 | #ifdef CONFIG_JFS_STATISTICS |
| 108 | extern int jfs_lmstats_read(char *, char **, off_t, int, int *, void *); | 108 | extern const struct file_operations jfs_lmstats_proc_fops; |
| 109 | extern int jfs_txstats_read(char *, char **, off_t, int, int *, void *); | 109 | extern const struct file_operations jfs_txstats_proc_fops; |
| 110 | extern int jfs_mpstat_read(char *, char **, off_t, int, int *, void *); | 110 | extern const struct file_operations jfs_mpstat_proc_fops; |
| 111 | extern int jfs_xtstat_read(char *, char **, off_t, int, int *, void *); | 111 | extern const struct file_operations jfs_xtstat_proc_fops; |
| 112 | 112 | ||
| 113 | #define INCREMENT(x) ((x)++) | 113 | #define INCREMENT(x) ((x)++) |
| 114 | #define DECREMENT(x) ((x)--) | 114 | #define DECREMENT(x) ((x)--) |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 325a9679b95a..cd2ec2988b59 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
| @@ -69,6 +69,7 @@ | |||
| 69 | #include <linux/freezer.h> | 69 | #include <linux/freezer.h> |
| 70 | #include <linux/delay.h> | 70 | #include <linux/delay.h> |
| 71 | #include <linux/mutex.h> | 71 | #include <linux/mutex.h> |
| 72 | #include <linux/seq_file.h> | ||
| 72 | #include "jfs_incore.h" | 73 | #include "jfs_incore.h" |
| 73 | #include "jfs_filsys.h" | 74 | #include "jfs_filsys.h" |
| 74 | #include "jfs_metapage.h" | 75 | #include "jfs_metapage.h" |
| @@ -2503,13 +2504,9 @@ exit: | |||
| 2503 | } | 2504 | } |
| 2504 | 2505 | ||
| 2505 | #ifdef CONFIG_JFS_STATISTICS | 2506 | #ifdef CONFIG_JFS_STATISTICS |
| 2506 | int jfs_lmstats_read(char *buffer, char **start, off_t offset, int length, | 2507 | static int jfs_lmstats_proc_show(struct seq_file *m, void *v) |
| 2507 | int *eof, void *data) | ||
| 2508 | { | 2508 | { |
| 2509 | int len = 0; | 2509 | seq_printf(m, |
| 2510 | off_t begin; | ||
| 2511 | |||
| 2512 | len += sprintf(buffer, | ||
| 2513 | "JFS Logmgr stats\n" | 2510 | "JFS Logmgr stats\n" |
| 2514 | "================\n" | 2511 | "================\n" |
| 2515 | "commits = %d\n" | 2512 | "commits = %d\n" |
| @@ -2522,19 +2519,19 @@ int jfs_lmstats_read(char *buffer, char **start, off_t offset, int length, | |||
| 2522 | lmStat.pagedone, | 2519 | lmStat.pagedone, |
| 2523 | lmStat.full_page, | 2520 | lmStat.full_page, |
| 2524 | lmStat.partial_page); | 2521 | lmStat.partial_page); |
| 2522 | return 0; | ||
| 2523 | } | ||
| 2525 | 2524 | ||
| 2526 | begin = offset; | 2525 | static int jfs_lmstats_proc_open(struct inode *inode, struct file *file) |
| 2527 | *start = buffer + begin; | 2526 | { |
| 2528 | len -= begin; | 2527 | return single_open(file, jfs_lmstats_proc_show, NULL); |
| 2529 | |||
| 2530 | if (len > length) | ||
| 2531 | len = length; | ||
| 2532 | else | ||
| 2533 | *eof = 1; | ||
| 2534 | |||
| 2535 | if (len < 0) | ||
| 2536 | len = 0; | ||
| 2537 | |||
| 2538 | return len; | ||
| 2539 | } | 2528 | } |
| 2529 | |||
| 2530 | const struct file_operations jfs_lmstats_proc_fops = { | ||
| 2531 | .owner = THIS_MODULE, | ||
| 2532 | .open = jfs_lmstats_proc_open, | ||
| 2533 | .read = seq_read, | ||
| 2534 | .llseek = seq_lseek, | ||
| 2535 | .release = single_release, | ||
| 2536 | }; | ||
| 2540 | #endif /* CONFIG_JFS_STATISTICS */ | 2537 | #endif /* CONFIG_JFS_STATISTICS */ |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index d1e64f2f2fcd..854ff0ec574f 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
| @@ -19,10 +19,12 @@ | |||
| 19 | 19 | ||
| 20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
| 21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
| 22 | #include <linux/module.h> | ||
| 22 | #include <linux/bio.h> | 23 | #include <linux/bio.h> |
| 23 | #include <linux/init.h> | 24 | #include <linux/init.h> |
| 24 | #include <linux/buffer_head.h> | 25 | #include <linux/buffer_head.h> |
| 25 | #include <linux/mempool.h> | 26 | #include <linux/mempool.h> |
| 27 | #include <linux/seq_file.h> | ||
| 26 | #include "jfs_incore.h" | 28 | #include "jfs_incore.h" |
| 27 | #include "jfs_superblock.h" | 29 | #include "jfs_superblock.h" |
| 28 | #include "jfs_filsys.h" | 30 | #include "jfs_filsys.h" |
| @@ -804,13 +806,9 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len) | |||
| 804 | } | 806 | } |
| 805 | 807 | ||
| 806 | #ifdef CONFIG_JFS_STATISTICS | 808 | #ifdef CONFIG_JFS_STATISTICS |
| 807 | int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length, | 809 | static int jfs_mpstat_proc_show(struct seq_file *m, void *v) |
| 808 | int *eof, void *data) | ||
| 809 | { | 810 | { |
| 810 | int len = 0; | 811 | seq_printf(m, |
| 811 | off_t begin; | ||
| 812 | |||
| 813 | len += sprintf(buffer, | ||
| 814 | "JFS Metapage statistics\n" | 812 | "JFS Metapage statistics\n" |
| 815 | "=======================\n" | 813 | "=======================\n" |
| 816 | "page allocations = %d\n" | 814 | "page allocations = %d\n" |
| @@ -819,19 +817,19 @@ int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length, | |||
| 819 | mpStat.pagealloc, | 817 | mpStat.pagealloc, |
| 820 | mpStat.pagefree, | 818 | mpStat.pagefree, |
| 821 | mpStat.lockwait); | 819 | mpStat.lockwait); |
| 820 | return 0; | ||
| 821 | } | ||
| 822 | 822 | ||
| 823 | begin = offset; | 823 | static int jfs_mpstat_proc_open(struct inode *inode, struct file *file) |
| 824 | *start = buffer + begin; | 824 | { |
| 825 | len -= begin; | 825 | return single_open(file, jfs_mpstat_proc_show, NULL); |
| 826 | |||
| 827 | if (len > length) | ||
| 828 | len = length; | ||
| 829 | else | ||
| 830 | *eof = 1; | ||
| 831 | |||
| 832 | if (len < 0) | ||
| 833 | len = 0; | ||
| 834 | |||
| 835 | return len; | ||
| 836 | } | 826 | } |
| 827 | |||
| 828 | const struct file_operations jfs_mpstat_proc_fops = { | ||
| 829 | .owner = THIS_MODULE, | ||
| 830 | .open = jfs_mpstat_proc_open, | ||
| 831 | .read = seq_read, | ||
| 832 | .llseek = seq_lseek, | ||
| 833 | .release = single_release, | ||
| 834 | }; | ||
| 837 | #endif | 835 | #endif |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index e7c60ae6b5b2..f26e4d03ada5 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
| 50 | #include <linux/moduleparam.h> | 50 | #include <linux/moduleparam.h> |
| 51 | #include <linux/kthread.h> | 51 | #include <linux/kthread.h> |
| 52 | #include <linux/seq_file.h> | ||
| 52 | #include "jfs_incore.h" | 53 | #include "jfs_incore.h" |
| 53 | #include "jfs_inode.h" | 54 | #include "jfs_inode.h" |
| 54 | #include "jfs_filsys.h" | 55 | #include "jfs_filsys.h" |
| @@ -3009,11 +3010,8 @@ int jfs_sync(void *arg) | |||
| 3009 | } | 3010 | } |
| 3010 | 3011 | ||
| 3011 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG) | 3012 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG) |
| 3012 | int jfs_txanchor_read(char *buffer, char **start, off_t offset, int length, | 3013 | static int jfs_txanchor_proc_show(struct seq_file *m, void *v) |
| 3013 | int *eof, void *data) | ||
| 3014 | { | 3014 | { |
| 3015 | int len = 0; | ||
| 3016 | off_t begin; | ||
| 3017 | char *freewait; | 3015 | char *freewait; |
| 3018 | char *freelockwait; | 3016 | char *freelockwait; |
| 3019 | char *lowlockwait; | 3017 | char *lowlockwait; |
| @@ -3025,7 +3023,7 @@ int jfs_txanchor_read(char *buffer, char **start, off_t offset, int length, | |||
| 3025 | lowlockwait = | 3023 | lowlockwait = |
| 3026 | waitqueue_active(&TxAnchor.lowlockwait) ? "active" : "empty"; | 3024 | waitqueue_active(&TxAnchor.lowlockwait) ? "active" : "empty"; |
| 3027 | 3025 | ||
| 3028 | len += sprintf(buffer, | 3026 | seq_printf(m, |
| 3029 | "JFS TxAnchor\n" | 3027 | "JFS TxAnchor\n" |
| 3030 | "============\n" | 3028 | "============\n" |
| 3031 | "freetid = %d\n" | 3029 | "freetid = %d\n" |
| @@ -3044,31 +3042,27 @@ int jfs_txanchor_read(char *buffer, char **start, off_t offset, int length, | |||
| 3044 | TxAnchor.tlocksInUse, | 3042 | TxAnchor.tlocksInUse, |
| 3045 | jfs_tlocks_low, | 3043 | jfs_tlocks_low, |
| 3046 | list_empty(&TxAnchor.unlock_queue) ? "" : "not "); | 3044 | list_empty(&TxAnchor.unlock_queue) ? "" : "not "); |
| 3045 | return 0; | ||
| 3046 | } | ||
| 3047 | 3047 | ||
| 3048 | begin = offset; | 3048 | static int jfs_txanchor_proc_open(struct inode *inode, struct file *file) |
| 3049 | *start = buffer + begin; | 3049 | { |
| 3050 | len -= begin; | 3050 | return single_open(file, jfs_txanchor_proc_show, NULL); |
| 3051 | |||
| 3052 | if (len > length) | ||
| 3053 | len = length; | ||
| 3054 | else | ||
| 3055 | *eof = 1; | ||
| 3056 | |||
| 3057 | if (len < 0) | ||
| 3058 | len = 0; | ||
| 3059 | |||
| 3060 | return len; | ||
| 3061 | } | 3051 | } |
| 3052 | |||
| 3053 | const struct file_operations jfs_txanchor_proc_fops = { | ||
| 3054 | .owner = THIS_MODULE, | ||
| 3055 | .open = jfs_txanchor_proc_open, | ||
| 3056 | .read = seq_read, | ||
| 3057 | .llseek = seq_lseek, | ||
| 3058 | .release = single_release, | ||
| 3059 | }; | ||
| 3062 | #endif | 3060 | #endif |
| 3063 | 3061 | ||
| 3064 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_STATISTICS) | 3062 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_STATISTICS) |
| 3065 | int jfs_txstats_read(char *buffer, char **start, off_t offset, int length, | 3063 | static int jfs_txstats_proc_show(struct seq_file *m, void *v) |
| 3066 | int *eof, void *data) | ||
| 3067 | { | 3064 | { |
| 3068 | int len = 0; | 3065 | seq_printf(m, |
| 3069 | off_t begin; | ||
| 3070 | |||
| 3071 | len += sprintf(buffer, | ||
| 3072 | "JFS TxStats\n" | 3066 | "JFS TxStats\n" |
| 3073 | "===========\n" | 3067 | "===========\n" |
| 3074 | "calls to txBegin = %d\n" | 3068 | "calls to txBegin = %d\n" |
| @@ -3089,19 +3083,19 @@ int jfs_txstats_read(char *buffer, char **start, off_t offset, int length, | |||
| 3089 | TxStat.txBeginAnon_lockslow, | 3083 | TxStat.txBeginAnon_lockslow, |
| 3090 | TxStat.txLockAlloc, | 3084 | TxStat.txLockAlloc, |
| 3091 | TxStat.txLockAlloc_freelock); | 3085 | TxStat.txLockAlloc_freelock); |
| 3086 | return 0; | ||
| 3087 | } | ||
| 3092 | 3088 | ||
| 3093 | begin = offset; | 3089 | static int jfs_txstats_proc_open(struct inode *inode, struct file *file) |
| 3094 | *start = buffer + begin; | 3090 | { |
| 3095 | len -= begin; | 3091 | return single_open(file, jfs_txstats_proc_show, NULL); |
| 3096 | |||
| 3097 | if (len > length) | ||
| 3098 | len = length; | ||
| 3099 | else | ||
| 3100 | *eof = 1; | ||
| 3101 | |||
| 3102 | if (len < 0) | ||
| 3103 | len = 0; | ||
| 3104 | |||
| 3105 | return len; | ||
| 3106 | } | 3092 | } |
| 3093 | |||
| 3094 | const struct file_operations jfs_txstats_proc_fops = { | ||
| 3095 | .owner = THIS_MODULE, | ||
| 3096 | .open = jfs_txstats_proc_open, | ||
| 3097 | .read = seq_read, | ||
| 3098 | .llseek = seq_lseek, | ||
| 3099 | .release = single_release, | ||
| 3100 | }; | ||
| 3107 | #endif | 3101 | #endif |
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c index 5a61ebf2cbcc..ae3acafb447b 100644 --- a/fs/jfs/jfs_xtree.c +++ b/fs/jfs/jfs_xtree.c | |||
| @@ -20,7 +20,9 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
| 23 | #include <linux/module.h> | ||
| 23 | #include <linux/quotaops.h> | 24 | #include <linux/quotaops.h> |
| 25 | #include <linux/seq_file.h> | ||
| 24 | #include "jfs_incore.h" | 26 | #include "jfs_incore.h" |
| 25 | #include "jfs_filsys.h" | 27 | #include "jfs_filsys.h" |
| 26 | #include "jfs_metapage.h" | 28 | #include "jfs_metapage.h" |
| @@ -4134,13 +4136,9 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) | |||
| 4134 | } | 4136 | } |
| 4135 | 4137 | ||
| 4136 | #ifdef CONFIG_JFS_STATISTICS | 4138 | #ifdef CONFIG_JFS_STATISTICS |
| 4137 | int jfs_xtstat_read(char *buffer, char **start, off_t offset, int length, | 4139 | static int jfs_xtstat_proc_show(struct seq_file *m, void *v) |
| 4138 | int *eof, void *data) | ||
| 4139 | { | 4140 | { |
| 4140 | int len = 0; | 4141 | seq_printf(m, |
| 4141 | off_t begin; | ||
| 4142 | |||
| 4143 | len += sprintf(buffer, | ||
| 4144 | "JFS Xtree statistics\n" | 4142 | "JFS Xtree statistics\n" |
| 4145 | "====================\n" | 4143 | "====================\n" |
| 4146 | "searches = %d\n" | 4144 | "searches = %d\n" |
| @@ -4149,19 +4147,19 @@ int jfs_xtstat_read(char *buffer, char **start, off_t offset, int length, | |||
| 4149 | xtStat.search, | 4147 | xtStat.search, |
| 4150 | xtStat.fastSearch, | 4148 | xtStat.fastSearch, |
| 4151 | xtStat.split); | 4149 | xtStat.split); |
| 4150 | return 0; | ||
| 4151 | } | ||
| 4152 | 4152 | ||
| 4153 | begin = offset; | 4153 | static int jfs_xtstat_proc_open(struct inode *inode, struct file *file) |
| 4154 | *start = buffer + begin; | 4154 | { |
| 4155 | len -= begin; | 4155 | return single_open(file, jfs_xtstat_proc_show, NULL); |
| 4156 | |||
| 4157 | if (len > length) | ||
| 4158 | len = length; | ||
| 4159 | else | ||
| 4160 | *eof = 1; | ||
| 4161 | |||
| 4162 | if (len < 0) | ||
| 4163 | len = 0; | ||
| 4164 | |||
| 4165 | return len; | ||
| 4166 | } | 4156 | } |
| 4157 | |||
| 4158 | const struct file_operations jfs_xtstat_proc_fops = { | ||
| 4159 | .owner = THIS_MODULE, | ||
| 4160 | .open = jfs_xtstat_proc_open, | ||
| 4161 | .read = seq_read, | ||
| 4162 | .llseek = seq_lseek, | ||
| 4163 | .release = single_release, | ||
| 4164 | }; | ||
| 4167 | #endif | 4165 | #endif |
