From patchwork Fri Mar 24 10:45:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 9642643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D42D76020B for ; Fri, 24 Mar 2017 10:48:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA89E26E81 for ; Fri, 24 Mar 2017 10:48:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF53C28236; Fri, 24 Mar 2017 10:48:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D0126E81 for ; Fri, 24 Mar 2017 10:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbdCXKsP (ORCPT ); Fri, 24 Mar 2017 06:48:15 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38130 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756955AbdCXKr4 (ORCPT ); Fri, 24 Mar 2017 06:47:56 -0400 Received: by mail-wm0-f51.google.com with SMTP id t189so9908268wmt.1 for ; Fri, 24 Mar 2017 03:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vCYMhTlenHhOUguDUH4AjQlzKK0AkA96DWsDyMp++Fg=; b=q2391RrxRoYSZc6eHY4XVXGW1tVLzvVIZUE0NHgOemmCuNXaAXsWl+Ih0kLmaxa0Sn aXjx6e6FBz9Uu5dyYzsnNcs4FufxcVpQTtPwxVtAmJFPs7iDcGN9kD/D7fCstXZ1NZCL iX/zj4VVkcsoUChiJer66ZApK1yzQmlhDkZ5qCdmIJPLsqnzxOM1t46T1DY0+mCymtRG ATSZ+eJdO4+AO0xuubrgNg/+p6ID/36UW23bKSCzalFU5Q3lbFcxe979lUWbbuaAwbX8 e1NduAE1Fy5Qboq+2mBp7IgVthCT6Uo6aF94TikiKoif84z6ykm6qSJ3mE+775kQe0Ws Cf+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vCYMhTlenHhOUguDUH4AjQlzKK0AkA96DWsDyMp++Fg=; b=kKNMrD6KJlKgBkbGpgDDw/PXm1u6hKwvsGrxArOm14RxZZ3KS56WYCFY3Rzt/XE6l6 dSbZETmgEYKHve2ZlDcPpiy6LBPEJKCOPi8HGGzIcgXvRURVoqAOOc3eORD0QfFBDsPX ZZUdiSwhIgXNjDqnAydI7Hfj08QhRAymud2kjOy/PMDByt+6L31gGo5Uy2AYcarnZ9yI 4bda/2ZrOOuSSNin2TUEG1Uy7BQO4F5RkrNe74m58427ytnrNhVgTT64PW5B7N8qsJLs qO+xNbJ3lzmuKtkhaU57RyoxVjzQwhJ1D4hNuWCUbYQfGUFoOIxCr82PTJrYMgnIGQXE oQOA== X-Gm-Message-State: AFeK/H2QbfiizgCcVCLyZF3olSxvtxlhMQ9HcfTZ7Iu9n79SUNoZqgcYT8maa8ZxoKDMtzGa X-Received: by 10.28.13.207 with SMTP id 198mr2389028wmn.76.1490352469161; Fri, 24 Mar 2017 03:47:49 -0700 (PDT) Received: from jinpu-GA-870A-USB3.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id s17sm2404458wrc.25.2017.03.24.03.47.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 03:47:48 -0700 (PDT) From: Jack Wang X-Google-Original-From: Jack Wang To: linux-block@vger.kernel.org, linux-rdma@vger.kernel.org Cc: dledford@redhat.com, axboe@kernel.dk, hch@lst.de, mail@fholler.de, Milind.dumbare@gmail.com, yun.wang@profitbricks.com, Jack Wang , Kleber Souza , Danil Kipnis , Roman Pen Subject: [PATCH 19/28] ibnbd_clt: add log helpers Date: Fri, 24 Mar 2017 11:45:34 +0100 Message-Id: <1490352343-20075-20-git-send-email-jinpu.wangl@profitbricks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490352343-20075-1-git-send-email-jinpu.wangl@profitbricks.com> References: <1490352343-20075-1-git-send-email-jinpu.wangl@profitbricks.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jack Wang Signed-off-by: Jack Wang Signed-off-by: Kleber Souza Signed-off-by: Danil Kipnis Signed-off-by: Roman Pen --- drivers/block/ibnbd_client/ibnbd_clt_log.h | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 drivers/block/ibnbd_client/ibnbd_clt_log.h diff --git a/drivers/block/ibnbd_client/ibnbd_clt_log.h b/drivers/block/ibnbd_client/ibnbd_clt_log.h new file mode 100644 index 0000000..b3184b7 --- /dev/null +++ b/drivers/block/ibnbd_client/ibnbd_clt_log.h @@ -0,0 +1,79 @@ +/* + * InfiniBand Network Block Driver + * + * Copyright (c) 2014 - 2017 ProfitBricks GmbH. All rights reserved. + * Authors: Fabian Holler < mail@fholler.de> + * Jack Wang + * Kleber Souza + * Danil Kipnis + * Roman Pen + * Milind Dumbare + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + */ + +#ifndef __IBNBD_CLT_LOG_H__ +#define __IBNBD_CLT_LOG_H__ + +#include "../ibnbd_inc/log.h" + +#define blkdev_name(dev) ((dev->gd == NULL) ? "" : dev->gd->disk_name) + +#define ERR(dev, fmt, ...) pr_err("ibnbd L%d <%s@%s> %s ERR: " fmt,\ + __LINE__, dev->pathname, ibnbd_prefix(dev),\ + blkdev_name(dev), ##__VA_ARGS__) + +#define ERR_RL(dev, fmt, ...) pr_err_ratelimited("ibnbd L%d <%s@%s> %s ERR: "\ + fmt, __LINE__, dev->pathname,\ + ibnbd_prefix(dev), blkdev_name(dev),\ + ##__VA_ARGS__) + +#define WRN(dev, fmt, ...) pr_warn("ibnbd L%d <%s@%s> %s WARN: " fmt,\ + __LINE__, dev->pathname, ibnbd_prefix(dev),\ + blkdev_name(dev), ##__VA_ARGS__) + +#define WRN_RL(dev, fmt, ...) pr_warn_ratelimited("ibnbd L%d <%s@%s> %s WARN: "\ + fmt, __LINE__, dev->pathname, ibnbd_prefix(dev),\ + blkdev_name(dev), ##__VA_ARGS__) + +#define INFO(dev, fmt, ...) pr_info("ibnbd <%s@%s> %s: " \ + fmt, dev->pathname, ibnbd_prefix(dev),\ + blkdev_name(dev), ##__VA_ARGS__) + +#define INFO_RL(dev, fmt, ...) pr_info_ratelimited("ibnbd <%s@%s> %s: " \ + fmt, dev->pathname, ibnbd_prefix(dev),\ + blkdev_name(dev), ##__VA_ARGS__) + +#endif /*__IBNBD_CLT_LOG_H__*/