Whamcloud - gitweb
Merge b_md into HEAD
[fs/lustre-release.git] / lustre / cobd / lproc_cache.c
index 5adcaf8..5170829 100644 (file)
 #include <linux/lustre_lite.h>
 #include <linux/lprocfs_status.h>
 
-/*
- * Common STATUS namespace
- */
-
-static int rd_uuid (char *page, char **start, off_t off, int count,
-                    int *eof, void *data)
-{
-        struct obd_device* dev = (struct obd_device*)data;
-
-        return (snprintf(page, count, "%s\n", dev->obd_uuid));
-}
-
-static int rd_target (char *page, char **start, off_t off, int count,
-                      int *eof, void *data)
+#ifndef LPROCFS
+struct lprocfs_vars lprocfs_obd_vars[] = { {0} };
+struct lprocfs_vars lprocfs_module_vars[] = { {0} };
+#else
+/* Common STATUS namespace */
+static int rd_target(char *page, char **start, off_t off, int count,
+                     int *eof, void *data)
 {
         struct obd_device    *dev = (struct obd_device*)data;
-        struct cache_obd     *cobd = &dev->u.cobd;
-       struct lustre_handle *conn = &cobd->cobd_target;
+       struct lustre_handle *conn = &dev->u.cobd.cobd_target;
        struct obd_export    *exp;
        int    rc;
 
@@ -49,8 +41,8 @@ static int rd_target (char *page, char **start, off_t off, int count,
                rc = snprintf (page, count, "not set up\n");
        else {
                exp = class_conn2export (conn);
-               LASSERT (exp != NULL);
-               rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid);
+               LASSERT(exp != NULL);
+               rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid.uuid);
        }
        return (rc);
 }
@@ -59,8 +51,7 @@ static int rd_cache(char *page, char **start, off_t off, int count,
                     int *eof, void *data)
 {
         struct obd_device    *dev = (struct obd_device*)data;
-       struct cache_obd     *cobd = &dev->u.cobd;
-       struct lustre_handle *conn = &cobd->cobd_cache;
+       struct lustre_handle *conn = &dev->u.cobd.cobd_cache;
        struct obd_export    *exp;
        int    rc;
 
@@ -69,27 +60,22 @@ static int rd_cache(char *page, char **start, off_t off, int count,
        else {
                exp = class_conn2export (conn);
                LASSERT (exp != NULL);
-               rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid);
+               rc = snprintf(page, count, "%s\n", exp->exp_obd->obd_uuid.uuid);
        }
        return (rc);
 }
 
-struct lprocfs_vars status_var_nm_1[] = {
-        {"status/uuid", rd_uuid, 0, 0},
-        {"status/target_uuid", rd_target, 0, 0},
-        {"status/cache_uuid", rd_cache, 0, 0},
-        {0}
+struct lprocfs_vars lprocfs_obd_vars[] = {
+        { "uuid",        lprocfs_rd_uuid,    0, 0 },
+        { "target_uuid", rd_target,          0, 0 },
+        { "cache_uuid",  rd_cache,           0, 0 },
+        { 0 }
 };
 
-int rd_numrefs(char *page, char **start, off_t off, int count,
-               int *eof, void *data)
-{
-        struct obd_type* class = (struct obd_type*)data;
-
-        return (snprintf(page, count, "%d\n", class->typ_refcnt));
-}
-
-struct lprocfs_vars status_class_var[] = {
-        {"status/num_refs", rd_numrefs, 0, 0},
-        {0}
+struct lprocfs_vars lprocfs_module_vars[] = {
+        { "num_refs",    lprocfs_rd_numrefs, 0, 0 },
+        { 0 }
 };
+#endif /* LPROCFS */
+
+LPROCFS_INIT_VARS(lprocfs_module_vars, lprocfs_obd_vars)