Ejemplo n.º 1
0
void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns)
{
        struct proc_dir_entry *dir;

        dir = lprocfs_srch(ldlm_ns_proc_dir, ldlm_ns_name(ns));
        if (dir == NULL) {
                CERROR("dlm namespace %s has no procfs dir?\n",
                       ldlm_ns_name(ns));
        } else {
                lprocfs_remove(&dir);
        }

        if (ns->ns_stats != NULL)
                lprocfs_free_stats(&ns->ns_stats);
}
Ejemplo n.º 2
0
void osp_lprocfs_init(struct osp_device *osp)
{
	struct obd_device	*obd = osp->opd_obd;
	struct proc_dir_entry	*osc_proc_dir;
	int			 rc;

	obd->obd_proc_entry = lprocfs_register(obd->obd_name,
					       obd->obd_type->typ_procroot,
					       lprocfs_osp_osd_vars,
					       &osp->opd_dt_dev);
	if (IS_ERR(obd->obd_proc_entry)) {
		CERROR("%s: can't register in lprocfs: %ld\n",
		       obd->obd_name, PTR_ERR(obd->obd_proc_entry));
		obd->obd_proc_entry = NULL;
		return;
	}

	rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_obd_vars, obd);
	if (rc) {
		CERROR("%s: can't register in lprocfs: %ld\n",
		       obd->obd_name, PTR_ERR(obd->obd_proc_entry));
		return;
	}

	ptlrpc_lprocfs_register_obd(obd);

	/* for compatibility we link old procfs's OSC entries to osp ones */
	if (!osp->opd_connect_mdt) {
		osc_proc_dir = lprocfs_srch(proc_lustre_root, "osc");
		if (osc_proc_dir) {
			cfs_proc_dir_entry_t	*symlink = NULL;
			char			*name;

			OBD_ALLOC(name, strlen(obd->obd_name) + 1);
			if (name == NULL)
				return;

			strcpy(name, obd->obd_name);
			if (strstr(name, "osc"))
				symlink = lprocfs_add_symlink(name,
						osc_proc_dir, "../osp/%s",
						obd->obd_name);
			OBD_FREE(name, strlen(obd->obd_name) + 1);
			osp->opd_symlink = symlink;
		}
	}
}