diff options
author | Evgeniy Polyakov <zbr@ioremap.net> | 2009-03-27 08:04:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-17 14:06:30 -0400 |
commit | f2739de19176009b14475207d5418cd79e7f0ba3 (patch) | |
tree | 5895a24190aed6b0a8499b4e8b68a67eb5d09ecb | |
parent | 50e4babfb0c36f1665ffcdc9a1826021aedb173f (diff) |
Staging: Pohmelfs: Added ->show_stats() callback.
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/pohmelfs/inode.c | 40 | ||||
-rw-r--r-- | drivers/staging/pohmelfs/netfs.h | 14 |
2 files changed, 49 insertions, 5 deletions
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c index a12fcc6c72b5..b2eaf9047266 100644 --- a/drivers/staging/pohmelfs/inode.c +++ b/drivers/staging/pohmelfs/inode.c | |||
@@ -1759,6 +1759,45 @@ err_out_exit: | |||
1759 | return err; | 1759 | return err; |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | static int pohmelfs_show_stats(struct seq_file *m, struct vfsmount *mnt) | ||
1763 | { | ||
1764 | struct netfs_state *st; | ||
1765 | struct pohmelfs_ctl *ctl; | ||
1766 | struct pohmelfs_sb *psb = POHMELFS_SB(mnt->mnt_sb); | ||
1767 | struct pohmelfs_config *c; | ||
1768 | |||
1769 | mutex_lock(&psb->state_lock); | ||
1770 | |||
1771 | seq_printf(m, "\nidx addr(:port) socket_type protocol active priority permissions\n"); | ||
1772 | |||
1773 | list_for_each_entry(c, &psb->state_list, config_entry) { | ||
1774 | st = &c->state; | ||
1775 | ctl = &st->ctl; | ||
1776 | |||
1777 | seq_printf(m, "%u ", ctl->idx); | ||
1778 | if (ctl->addr.sa_family == AF_INET) { | ||
1779 | struct sockaddr_in *sin = (struct sockaddr_in *)&st->ctl.addr; | ||
1780 | //seq_printf(m, "%pi4:%u", &sin->sin_addr.s_addr, ntohs(sin->sin_port)); | ||
1781 | seq_printf(m, "%u.%u.%u.%u:%u", NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port)); | ||
1782 | } else if (ctl->addr.sa_family == AF_INET6) { | ||
1783 | struct sockaddr_in6 *sin = (struct sockaddr_in6 *)&st->ctl.addr; | ||
1784 | seq_printf(m, "%pi6:%u", &sin->sin6_addr, ntohs(sin->sin6_port)); | ||
1785 | } else { | ||
1786 | unsigned int i; | ||
1787 | for (i=0; i<ctl->addrlen; ++i) | ||
1788 | seq_printf(m, "%02x.", ctl->addr.addr[i]); | ||
1789 | } | ||
1790 | |||
1791 | seq_printf(m, " %u %u %d %u %x\n", | ||
1792 | ctl->type, ctl->proto, | ||
1793 | st->socket != NULL, | ||
1794 | ctl->prio, ctl->perm); | ||
1795 | } | ||
1796 | mutex_unlock(&psb->state_lock); | ||
1797 | |||
1798 | return 0; | ||
1799 | } | ||
1800 | |||
1762 | static const struct super_operations pohmelfs_sb_ops = { | 1801 | static const struct super_operations pohmelfs_sb_ops = { |
1763 | .alloc_inode = pohmelfs_alloc_inode, | 1802 | .alloc_inode = pohmelfs_alloc_inode, |
1764 | .destroy_inode = pohmelfs_destroy_inode, | 1803 | .destroy_inode = pohmelfs_destroy_inode, |
@@ -1768,6 +1807,7 @@ static const struct super_operations pohmelfs_sb_ops = { | |||
1768 | .remount_fs = pohmelfs_remount, | 1807 | .remount_fs = pohmelfs_remount, |
1769 | .statfs = pohmelfs_statfs, | 1808 | .statfs = pohmelfs_statfs, |
1770 | .show_options = pohmelfs_show_options, | 1809 | .show_options = pohmelfs_show_options, |
1810 | .show_stats = pohmelfs_show_stats, | ||
1771 | }; | 1811 | }; |
1772 | 1812 | ||
1773 | /* | 1813 | /* |
diff --git a/drivers/staging/pohmelfs/netfs.h b/drivers/staging/pohmelfs/netfs.h index 59f81cbf388c..7700e2bf3cc7 100644 --- a/drivers/staging/pohmelfs/netfs.h +++ b/drivers/staging/pohmelfs/netfs.h | |||
@@ -116,16 +116,20 @@ struct pohmelfs_crypto | |||
116 | unsigned char data[0]; /* Algorithm string, key and IV */ | 116 | unsigned char data[0]; /* Algorithm string, key and IV */ |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #define POHMELFS_IO_PERM_READ (1<<0) | ||
120 | #define POHMELFS_IO_PERM_WRITE (1<<1) | ||
121 | |||
119 | /* | 122 | /* |
120 | * Configuration command used to create table of different remote servers. | 123 | * Configuration command used to create table of different remote servers. |
121 | */ | 124 | */ |
122 | struct pohmelfs_ctl | 125 | struct pohmelfs_ctl |
123 | { | 126 | { |
124 | unsigned int idx; /* Config index */ | 127 | __u32 idx; /* Config index */ |
125 | unsigned int type; /* Socket type */ | 128 | __u32 type; /* Socket type */ |
126 | unsigned int proto; /* Socket protocol */ | 129 | __u32 proto; /* Socket protocol */ |
127 | unsigned int addrlen; /* Size of the address */ | 130 | __u16 addrlen; /* Size of the address */ |
128 | unsigned short unused; /* Align structure by 4 bytes */ | 131 | __u16 perm; /* IO permission */ |
132 | __u16 prio; /* IO priority */ | ||
129 | struct saddr addr; /* Remote server address */ | 133 | struct saddr addr; /* Remote server address */ |
130 | }; | 134 | }; |
131 | 135 | ||