Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6219415imm; Mon, 27 Aug 2018 11:46:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYWHraWUtMChf95XBFmp0IMH69Gp7o/3x2lUdKWZn8guc257TqwQ1TK17cup7BceuJPFNai X-Received: by 2002:a65:5288:: with SMTP id y8-v6mr13419022pgp.284.1535395601936; Mon, 27 Aug 2018 11:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535395601; cv=none; d=google.com; s=arc-20160816; b=Dkl5MjiaYusAp+hwsNeQvV8ge0INPAkF4WyVbTPQ/6uLyzPY7Gl+AXJbINoWgxEbJk mBlBAP85ZPTxYouZL2fnUPmg1Yhv2GLrckM9UvyD3KVDvimZAAAxsyve+3Ou+OUzKhfI ld/eOaTItpji4mo/iWy3HJJOOQH6UWOIYdM4LliZE60ygfZgoTAjyoy6Uatiq3aPcbyq nh8ytu26Ojv92sSGcxNXkTVEfCWbryKw2yVRP6MN9Tuz3kAeBv+wX1mxyICIRr0QVvrM lI7Ik2LHd/AYRW36MOXUBJhohtnYmca3QzLZEvGULAAfbjPf55sTXZoAWtaAQJBwL/qI s8Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:cc:to :subject:from:dkim-signature:arc-authentication-results; bh=BHfHQ2zP7db8AoAbqdF7OnoruUP4qI6BRvNgInJR0HA=; b=a3UzBnQ3Ap+Q/NcZdgEXosiPi2bp7nwN/LF9EgkeUpwmTYDZH1Ij40p/5Kz0+nt95I 4NHFLr14ZkriofSp4UuQufMyI7JT2Zz04DutUsH1VAbLEJ2SY6Ygky05WAKSeTOJhb1x nNXwpK/o1HM4MVjd2Z8q6WdjPK8CtYWKVuuu6bQWBzCUqfR1CAH72ZXCusOjZm1vXfKH BqeHsrofB+CyhLfJ38LMr+ZLH1dxMqChGuA2NpxMqYQqaH0THZRpXEtXvHzL0WJhyNj+ 97Zc7pIqNrWzRRsyftBQVU+7NBWzHLv3lg3kq2dUx+4m2lBQHUTBcHcgT+Nm/qRgH3Mr AnBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=0+uWJ7jE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si14633478pgo.606.2018.08.27.11.46.25; Mon, 27 Aug 2018 11:46:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=0+uWJ7jE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbeH0Wcl (ORCPT + 99 others); Mon, 27 Aug 2018 18:32:41 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:49504 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbeH0Wcl (ORCPT ); Mon, 27 Aug 2018 18:32:41 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7RIdCkn123670; Mon, 27 Aug 2018 18:44:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : subject : to : cc : message-id : date : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=BHfHQ2zP7db8AoAbqdF7OnoruUP4qI6BRvNgInJR0HA=; b=0+uWJ7jEdoMG9RZ0IK8oDR0rc+QZjziD1lF4ASVRgp8UZ/nffXNlw27/cCJYIHD1pVQu hATzxcBpJJ1nVSKWcNKOJOCSQ8+AOdRKhRmiNvqHNOJG5RPSK13bMhM6yhT1SfbZPagC G7vvI0242QMbiUhGe8mdYRPEYOOEJGBDbWC+ZeMRU2CcRs16ityHkgI/8hiIk+GgBk4d GJ01/O/pAMF9VOcDA8OKJZ6WiXN1C0GlCxNagerRj6KgLW40AXnppzH0R18qUvIdmkag mwNy2kvEhAK8bQej59BwsnZLh070tz74/apUf/Bt6U754zgLHctsXxvQRR5bcwVhA+Ka BQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2m2y2p7pph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Aug 2018 18:44:50 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7RIiiJE003769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Aug 2018 18:44:45 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w7RIihIS009590; Mon, 27 Aug 2018 18:44:44 GMT Received: from [10.211.202.81] (/10.211.202.81) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Aug 2018 11:44:43 -0700 From: Joe Jin Subject: [PATCH] xen: export device state to sysfs To: Boris Ostrovsky , Juergen Gross Cc: "linux-kernel@vger.kernel.org" , "xen-devel@lists.xenproject.org" , Joe Jin Message-ID: <030d112d-991f-4591-7eeb-94432a277c71@oracle.com> Date: Mon, 27 Aug 2018 11:44:41 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8998 signatures=668708 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808270193 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export device state to sysfs to allow for easier get device state. Signed-off-by: Joe Jin Boris Ostrovsky Juergen Gross --- drivers/xen/xenbus/xenbus_probe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 74888cacd0b0..52f99b80a1c0 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -402,10 +402,19 @@ static ssize_t modalias_show(struct device *dev, } static DEVICE_ATTR_RO(modalias); +static ssize_t state_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%s\n", + xenbus_strstate(to_xenbus_device(dev)->state)); +} +static DEVICE_ATTR_RO(state); + static struct attribute *xenbus_dev_attrs[] = { &dev_attr_nodename.attr, &dev_attr_devtype.attr, &dev_attr_modalias.attr, + &dev_attr_state.attr, NULL, }; -- 2.15.2 (Apple Git-101.1)