1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
6 * This file is part of Portals
7 * http://sourceforge.net/projects/sandiaportals/
9 * Portals is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU General Public
11 * License as published by the Free Software Foundation.
13 * Portals is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Portals; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #define KPR_PROC_ROUTER "sys/portals/router"
29 kpr_proc_read (char *page, char **start, off_t off, int count, int *eof, void *data)
31 unsigned long long bytes = kpr_fwd_bytes;
32 unsigned long packets = kpr_fwd_packets;
33 unsigned long errors = kpr_fwd_errors;
34 unsigned int qdepth = atomic_read (&kpr_queue_depth);
41 len = sprintf (page, "%Ld %ld %ld %d\n", bytes, packets, errors, qdepth);
48 kpr_proc_write (struct file *file, const char *ubuffer, unsigned long count, void *data)
50 /* Ignore what we've been asked to write, and just zero the stats counters */
61 struct proc_dir_entry *entry = create_proc_entry (KPR_PROC_ROUTER, S_IFREG | S_IRUGO | S_IWUSR, NULL);
65 CERROR("couldn't create proc entry %s\n", KPR_PROC_ROUTER);
70 entry->read_proc = kpr_proc_read;
71 entry->write_proc = kpr_proc_write;
77 remove_proc_entry(KPR_PROC_ROUTER, 0);