Whamcloud - gitweb
LU-3866 hsm: permission checks on HSM operations
[fs/lustre-release.git] / lustre / fld / lproc_fld.c
index ab3fa11..80710f6 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 # include <liblustre.h>
 #endif
 
-#include <obd.h>
-#include <obd_class.h>
 #include <dt_object.h>
-#include <md_object.h>
 #include <obd_support.h>
-#include <lustre_req_layout.h>
 #include <lustre_fld.h>
 #include <lustre_fid.h>
 #include "fld_internal.h"
+#include <md_object.h>
 
 #ifdef LPROCFS
 static int
@@ -158,9 +155,17 @@ struct fld_seq_param {
        struct lu_env           fsp_env;
        struct dt_it            *fsp_it;
        struct lu_server_fld    *fsp_fld;
-       int                     fsp_stop:1;
+       unsigned int            fsp_stop:1;
+};
+
+struct lprocfs_vars fld_client_proc_list[] = {
+       { "targets", fld_proc_read_targets, NULL, NULL },
+       { "hash", fld_proc_read_hash, fld_proc_write_hash, NULL },
+       { "cache_flush", NULL, fld_proc_write_cache_flush, NULL },
+       { NULL }
 };
 
+# ifdef HAVE_SERVER_SUPPORT
 static void *fldb_seq_start(struct seq_file *p, loff_t *pos)
 {
        struct fld_seq_param    *param = p->private;
@@ -189,13 +194,15 @@ static void fldb_seq_stop(struct seq_file *p, void *v)
        struct lu_server_fld    *fld;
        struct dt_object        *obj;
 
+       if (param == NULL)
+               return;
+
        fld = param->fsp_fld;
        obj = fld->lsf_obj;
        LASSERT(obj != NULL);
        iops = &obj->do_index_ops->dio_it;
 
        iops->put(&param->fsp_env, param->fsp_it);
-       return;
 }
 
 static void *fldb_seq_next(struct seq_file *p, void *v, loff_t *pos)
@@ -276,7 +283,7 @@ static int fldb_seq_open(struct inode *inode, struct file *file)
        int                     env_init = 0;
        int                     rc;
 
-       LPROCFS_ENTRY_AND_CHECK(dp);
+       LPROCFS_ENTRY_CHECK(dp);
        rc = seq_open(file, &fldb_sops);
        if (rc)
                GOTO(out, rc);
@@ -313,7 +320,6 @@ out:
                        lu_env_fini(&param->fsp_env);
                if (param != NULL)
                        OBD_FREE_PTR(param);
-               LPROCFS_EXIT();
        }
        return rc;
 }
@@ -338,7 +344,6 @@ static int fldb_seq_release(struct inode *inode, struct file *file)
        iops = &obj->do_index_ops->dio_it;
 
        LASSERT(iops != NULL);
-       LASSERT(obj != NULL);
        LASSERT(param->fsp_it != NULL);
        iops->fini(&param->fsp_env, param->fsp_it);
        lu_env_fini(&param->fsp_env);
@@ -348,20 +353,17 @@ static int fldb_seq_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-struct lprocfs_vars fld_server_proc_list[] = {
-       { NULL }};
-
-struct lprocfs_vars fld_client_proc_list[] = {
-       { "targets",     fld_proc_read_targets, NULL, NULL },
-       { "hash",        fld_proc_read_hash, fld_proc_write_hash, NULL },
-       { "cache_flush", NULL, fld_proc_write_cache_flush, NULL },
-       { NULL }};
-
-struct file_operations fld_proc_seq_fops = {
+const struct file_operations fld_proc_seq_fops = {
        .owner   = THIS_MODULE,
        .open    = fldb_seq_open,
        .read    = seq_read,
        .release = fldb_seq_release,
 };
 
-#endif
+struct lprocfs_vars fld_server_proc_list[] = {
+       { NULL }
+};
+
+# endif /* HAVE_SERVER_SUPPORT */
+
+#endif /* LPROCFS */