+
+struct ll_rpc_opcode {
+ __u32 opcode;
+ const char *opname;
+} ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = {
+ { OST_REPLY, "ost_reply" },
+ { OST_GETATTR, "ost_getattr" },
+ { OST_SETATTR, "ost_setattr" },
+ { OST_READ, "ost_read" },
+ { OST_WRITE, "ost_write" },
+ { OST_CREATE , "ost_create" },
+ { OST_DESTROY, "ost_destroy" },
+ { OST_GET_INFO, "ost_get_info" },
+ { OST_CONNECT, "ost_connect" },
+ { OST_DISCONNECT, "ost_disconnect" },
+ { OST_PUNCH, "ost_punch" },
+ { OST_OPEN, "ost_open" },
+ { OST_CLOSE, "ost_close" },
+ { OST_STATFS, "ost_statfs" },
+ { OST_SAN_READ, "ost_san_read" },
+ { OST_SAN_WRITE, "ost_san_write" },
+ { OST_SYNC, "ost_sync" },
+ { OST_SET_INFO, "ost_set_info" },
+ { MDS_GETATTR, "mds_getattr" },
+ { MDS_GETATTR_NAME, "mds_getattr_name" },
+ { MDS_CLOSE, "mds_close" },
+ { MDS_REINT, "mds_reint" },
+ { MDS_READPAGE, "mds_readpage" },
+ { MDS_CONNECT, "mds_connect" },
+ { MDS_DISCONNECT, "mds_disconnect" },
+ { MDS_GETSTATUS, "mds_getstatus" },
+ { MDS_STATFS, "mds_statfs" },
+ { MDS_PIN, "mds_pin" },
+ { MDS_UNPIN, "mds_unpin" },
+ { MDS_SYNC, "mds_sync" },
+ { MDS_DONE_WRITING, "mds_done_writing" },
+ { LDLM_ENQUEUE, "ldlm_enqueue" },
+ { LDLM_CONVERT, "ldlm_convert" },
+ { LDLM_CANCEL, "ldlm_cancel" },
+ { LDLM_BL_CALLBACK, "ldlm_bl_callback" },
+ { LDLM_CP_CALLBACK, "ldlm_cp_callback" },
+ { LDLM_GL_CALLBACK, "ldlm_gl_callback" },
+ { PTLBD_QUERY, "ptlbd_query" },
+ { PTLBD_READ, "ptlbd_read" },
+ { PTLBD_WRITE, "ptlbd_write" },
+ { PTLBD_FLUSH, "ptlbd_flush" },
+ { PTLBD_CONNECT, "ptlbd_connect" },
+ { PTLBD_DISCONNECT, "ptlbd_disconnect" },
+ { OBD_PING, "obd_ping" },
+ { OBD_LOG_CANCEL, "llog_origin_handle_cancel"},
+};
+
+const char* ll_opcode2str(__u32 opcode)
+{
+ /* When one of the assertions below fail, chances are that:
+ * 1) A new opcode was added in lustre_idl.h, but was
+ * is missing from the table above.
+ * or 2) The opcode space was renumbered or rearranged,
+ * and the opcode_offset() function in
+ * ptlrpc_internals.h needs to be modified.
+ */
+ __u32 offset = opcode_offset(opcode);
+ LASSERT(offset < LUSTRE_MAX_OPCODES);
+ LASSERT(ll_rpc_opcode_table[offset].opcode == opcode);
+ return ll_rpc_opcode_table[offset].opname;
+}
+
+#ifndef LPROCFS
+void ptlrpc_lprocfs_register_service(struct obd_device *obddev,
+ struct ptlrpc_service *svc) { return ; }
+void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc) { return; }
+#else
+
+void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir,
+ char *name, struct proc_dir_entry **procroot_ret,
+ struct lprocfs_stats **stats_ret)