Whamcloud - gitweb
LU-1718 client: Restore NFS export for Lustre on 3.X kernels
[fs/lustre-release.git] / lustre / mgs / mgs_internal.h
index 84fe7d2..9ad6174 100644 (file)
@@ -38,7 +38,9 @@
 #define _MGS_INTERNAL_H
 
 #include <libcfs/libcfs.h>
+#include <lustre_log.h>
 #include <lustre_export.h>
+#include <dt_object.h>
 
 #define MGSSELF_NAME    "_mgs"
 
@@ -141,7 +143,6 @@ struct fs_db {
         struct mgs_nidtbl    fsdb_nidtbl;
 
         /* async thread to notify clients */
-        struct obd_device   *fsdb_obd;
        struct mgs_device   *fsdb_mgs;
         cfs_waitq_t          fsdb_notify_waitq;
         cfs_completion_t     fsdb_notify_comp;
@@ -155,26 +156,20 @@ struct fs_db {
         unsigned int         fsdb_notify_count;
 };
 
-/* mgs_llog.c */
-int class_dentry_readdir(const struct lu_env *env,
-                        struct mgs_device *mgs, cfs_list_t *list);
-
 struct mgs_device {
        struct dt_device                 mgs_dt_dev;
        struct ptlrpc_service           *mgs_service;
        struct dt_device                *mgs_bottom;
        struct obd_export               *mgs_bottom_exp;
        struct dt_object                *mgs_configs_dir;
-       struct dentry                   *mgs_configs_dir_old;
        struct dt_object                *mgs_nidtbl_dir;
        cfs_list_t                       mgs_fs_db_list;
        cfs_spinlock_t                   mgs_lock; /* covers mgs_fs_db_list */
        cfs_proc_dir_entry_t            *mgs_proc_live;
+       cfs_proc_dir_entry_t            *mgs_proc_mntdev;
        cfs_time_t                       mgs_start_time;
        struct obd_device               *mgs_obd;
        struct local_oid_storage        *mgs_los;
-       struct vfsmount                 *mgs_vfsmnt;
-       struct super_block              *mgs_sb;
        cfs_mutex_t                      mgs_mutex;
 };
 
@@ -243,19 +238,19 @@ int mgs_fs_cleanup(const struct lu_env *env, struct mgs_device *m);
 
 #define strsuf(buf, suffix) (strcmp((buf)+strlen(buf)-strlen(suffix), (suffix)))
 #ifdef LPROCFS
-int lproc_mgs_setup(struct mgs_device *mgs);
+int lproc_mgs_setup(struct mgs_device *mgs, char *osd_name);
 int lproc_mgs_cleanup(struct mgs_device *mgs);
 int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb);
 int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb);
 void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars);
 #else
-static inline int lproc_mgs_setup(struct obd_device *dev)
+static inline int lproc_mgs_setup(struct mgs_device *mgs)
 {return 0;}
-static inline int lproc_mgs_cleanup(struct obd_device *obd)
+static inline int lproc_mgs_cleanup(struct mgs_device *mgs)
 {return 0;}
-static inline int lproc_mgs_add_live(struct mgs_device *obd, struct fs_db *fsdb)
+static inline int lproc_mgs_add_live(struct mgs_device *mgs, struct fs_db *fsdb)
 {return 0;}
-static inline int lproc_mgs_del_live(struct mgs_device *obd, struct fs_db *fsdb)
+static inline int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
 {return 0;}
 static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars)
 {
@@ -275,13 +270,11 @@ enum {
 void mgs_counter_incr(struct obd_export *exp, int opcode);
 void mgs_stats_counter_init(struct lprocfs_stats *stats);
 
-struct temp_comp
-{
+struct temp_comp {
        struct mgs_target_info  *comp_tmti;
        struct mgs_target_info  *comp_mti;
        struct fs_db            *comp_fsdb;
-       struct mgs_device       *comp_mgs;
-       const struct lu_env     *comp_env;
+       struct obd_device       *comp_obd;
 };
 
 struct mgs_thread_info {
@@ -364,5 +357,42 @@ static inline struct dt_object *dt_object_child(struct dt_object *o)
        return container_of0(lu_object_next(&(o)->do_lu),
                             struct dt_object, do_lu);
 }
+struct mgs_direntry {
+       cfs_list_t  list;
+       char       *name;
+       int         len;
+};
+
+static inline void mgs_direntry_free(struct mgs_direntry *de)
+{
+       if (de) {
+               LASSERT(de->len);
+               OBD_FREE(de->name, de->len);
+               OBD_FREE_PTR(de);
+       }
+}
+
+static inline struct mgs_direntry *mgs_direntry_alloc(int len)
+{
+       struct mgs_direntry *de;
+
+       OBD_ALLOC_PTR(de);
+       if (de == NULL)
+               return NULL;
+
+       OBD_ALLOC(de->name, len);
+       if (de->name == NULL) {
+               OBD_FREE_PTR(de);
+               return NULL;
+       }
+
+       de->len = len;
+
+       return de;
+}
+
+/* mgs_llog.c */
+int class_dentry_readdir(const struct lu_env *env, struct mgs_device *mgs,
+                        cfs_list_t *list);
 
 #endif /* _MGS_INTERNAL_H */