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 Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #define DEBUG_SUBSYSTEM S_CLASS
24 #include <linux/lustre_lite.h>
25 #include <linux/lprocfs_status.h>
28 * Common STATUS namespace
31 static int rd_uuid (char *page, char **start, off_t off, int count,
34 struct obd_device* dev = (struct obd_device*)data;
36 return (snprintf(page, count, "%s\n", dev->obd_uuid));
39 static int rd_target (char *page, char **start, off_t off, int count,
42 struct obd_device *dev = (struct obd_device*)data;
43 struct cache_obd *cobd = &dev->u.cobd;
44 struct lustre_handle *conn = &cobd->cobd_target;
45 struct obd_export *exp;
48 if ((dev->obd_flags & OBD_SET_UP) == 0)
49 rc = snprintf (page, count, "not set up\n");
51 exp = class_conn2export (conn);
52 LASSERT (exp != NULL);
53 rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid);
58 static int rd_cache(char *page, char **start, off_t off, int count,
61 struct obd_device *dev = (struct obd_device*)data;
62 struct cache_obd *cobd = &dev->u.cobd;
63 struct lustre_handle *conn = &cobd->cobd_cache;
64 struct obd_export *exp;
67 if ((dev->obd_flags & OBD_SET_UP) == 0)
68 rc = snprintf (page, count, "not set up\n");
70 exp = class_conn2export (conn);
71 LASSERT (exp != NULL);
72 rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid);
77 struct lprocfs_vars status_var_nm_1[] = {
78 {"status/uuid", rd_uuid, 0, 0},
79 {"status/target_uuid", rd_target, 0, 0},
80 {"status/cache_uuid", rd_cache, 0, 0},
84 int rd_numrefs(char *page, char **start, off_t off, int count,
87 struct obd_type* class = (struct obd_type*)data;
89 return (snprintf(page, count, "%d\n", class->typ_refcnt));
92 struct lprocfs_vars status_class_var[] = {
93 {"status/num_refs", rd_numrefs, 0, 0},