Staging: Pohmelfs: Added ->show_stats() callback.
authorEvgeniy Polyakov <zbr@ioremap.net>
Fri, 27 Mar 2009 12:04:28 +0000 (15:04 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 17 Apr 2009 18:06:30 +0000 (11:06 -0700)
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/pohmelfs/inode.c
drivers/staging/pohmelfs/netfs.h

index a12fcc6c72b530545da866bb0dc0aa622a49ee0a..b2eaf90472660d6a0c95d5ffa138f5fc046a5f53 100644 (file)
@@ -1759,6 +1759,45 @@ err_out_exit:
        return err;
 }
 
+static int pohmelfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
+{
+       struct netfs_state *st;
+       struct pohmelfs_ctl *ctl;
+       struct pohmelfs_sb *psb = POHMELFS_SB(mnt->mnt_sb);
+       struct pohmelfs_config *c;
+
+       mutex_lock(&psb->state_lock);
+
+       seq_printf(m, "\nidx addr(:port) socket_type protocol active priority permissions\n");
+
+       list_for_each_entry(c, &psb->state_list, config_entry) {
+               st = &c->state;
+               ctl = &st->ctl;
+
+               seq_printf(m, "%u ", ctl->idx);
+               if (ctl->addr.sa_family == AF_INET) {
+                       struct sockaddr_in *sin = (struct sockaddr_in *)&st->ctl.addr;
+                       //seq_printf(m, "%pi4:%u", &sin->sin_addr.s_addr, ntohs(sin->sin_port));
+                       seq_printf(m, "%u.%u.%u.%u:%u", NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
+               } else if (ctl->addr.sa_family == AF_INET6) {
+                       struct sockaddr_in6 *sin = (struct sockaddr_in6 *)&st->ctl.addr;
+                       seq_printf(m, "%pi6:%u", &sin->sin6_addr, ntohs(sin->sin6_port));
+               } else {
+                       unsigned int i;
+                       for (i=0; i<ctl->addrlen; ++i)
+                               seq_printf(m, "%02x.", ctl->addr.addr[i]);
+               }
+
+               seq_printf(m, " %u %u %d %u %x\n",
+                               ctl->type, ctl->proto,
+                               st->socket != NULL,
+                               ctl->prio, ctl->perm);
+       }
+       mutex_unlock(&psb->state_lock);
+
+       return 0;
+}
+
 static const struct super_operations pohmelfs_sb_ops = {
        .alloc_inode    = pohmelfs_alloc_inode,
        .destroy_inode  = pohmelfs_destroy_inode,
@@ -1768,6 +1807,7 @@ static const struct super_operations pohmelfs_sb_ops = {
        .remount_fs     = pohmelfs_remount,
        .statfs         = pohmelfs_statfs,
        .show_options   = pohmelfs_show_options,
+       .show_stats     = pohmelfs_show_stats,
 };
 
 /*
index 59f81cbf388cc7c01e96f70ee9e6c41edbcb8ef9..7700e2bf3cc78158197caf6859987e8ae7a67ca4 100644 (file)
@@ -116,16 +116,20 @@ struct pohmelfs_crypto
        unsigned char           data[0];        /* Algorithm string, key and IV */
 };
 
+#define POHMELFS_IO_PERM_READ          (1<<0)
+#define POHMELFS_IO_PERM_WRITE         (1<<1)
+
 /*
  * Configuration command used to create table of different remote servers.
  */
 struct pohmelfs_ctl
 {
-       unsigned int            idx;            /* Config index */
-       unsigned int            type;           /* Socket type */
-       unsigned int            proto;          /* Socket protocol */
-       unsigned int            addrlen;        /* Size of the address */
-       unsigned short          unused;         /* Align structure by 4 bytes */
+       __u32                   idx;            /* Config index */
+       __u32                   type;           /* Socket type */
+       __u32                   proto;          /* Socket protocol */
+       __u16                   addrlen;        /* Size of the address */
+       __u16                   perm;           /* IO permission */
+       __u16                   prio;           /* IO priority */
        struct saddr            addr;           /* Remote server address */
 };