From patchwork Tue Dec 1 03:44:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 7732671 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A41A99F30B for ; Tue, 1 Dec 2015 03:45:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3AC220662 for ; Tue, 1 Dec 2015 03:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D316420648 for ; Tue, 1 Dec 2015 03:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754733AbbLADov (ORCPT ); Mon, 30 Nov 2015 22:44:51 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:32987 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753455AbbLADot (ORCPT ); Mon, 30 Nov 2015 22:44:49 -0500 Received: by pabfh17 with SMTP id fh17so212867282pab.0 for ; Mon, 30 Nov 2015 19:44:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=W2LNhv5FU8ZHhWasJCYVxUYXo71jTm56up73ov+buG0=; b=HsSzZpo9h3DgcKqjjGXQalEAsPDTjEsFRr3vY6yMWgQUwVvUV2BzMSWoWNey4bRCep d1RuU+4ZBDG39N9vA2hPNeBIUMmyBa7YfLLTEopBzXZYelVYRJNf6Cvz8vN14xyXEYRn QfK9AZFV2rTlcNn5c2YCUhjkMpzXJzikFYdfTulUw1s5COm7LPPlqJAmJhx0dblN/rFR iS6XC6hKYYrcNtyaw/d6zw/ArDZMP7+h+xqQZwVVG9wL36LNQUTNODAqBh2nuWicagCV FpQ/bfFg0Je2bVpw7trybKqyyFcfOPms18U0ZLVtTCM93DJ5lt6DnB2Rhy568pywp5Gd fVkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=W2LNhv5FU8ZHhWasJCYVxUYXo71jTm56up73ov+buG0=; b=SdK/3AWEZB9m2wjjkPtGIC/fUGu3kykrFOiURhf+xVoEfYdMAnG+Ry4FXOytUBotA5 eS7R0PDV6IINxn2YHnXsCAtT6EPMXPQY3MNOhavSYSqIKBRd4T53W/RN1bqDUuUEsHE+ ZlVR+oTuKDQVtOAx9p3Z3wpYLyvXEI+ZAyqotAMqTL2Z7Ed0frAdQ+aOxQKWi3zb9sVB UgS1jpXkqDie8hwsMqt88M3KOfu8hdWHrA2GRryc5EBFTGocdqNTJ+2iq8ErhBjtjmUv N8mJ3IfalPBZ2idIYDnigjPhcGyIgGs9083RUZoP4D5Pf5Hs8QXlA5A9Ce/Xceoj7k3g eiHQ== X-Gm-Message-State: ALoCoQn7fFn9C89B1rbWO2DoI8+WVO/9bJlh7cKsXU4cPbLKSr1tzdWWTTS3vhS83cNCTw0stJv2 X-Received: by 10.66.254.39 with SMTP id af7mr96896600pad.43.1448941489348; Mon, 30 Nov 2015 19:44:49 -0800 (PST) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id q70sm54130351pfa.12.2015.11.30.19.44.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Nov 2015 19:44:48 -0800 (PST) From: John Stultz To: linux-kernel@vger.kernel.org Cc: San Mehat , Jens Axboe , Rom Lemarchand , Android Kernel Team , Jeff Moyer , harald@redhat.com, kay@redhat.com, linux-block@vger.kernel.org, Dima Zavin , John Stultz Subject: [PATCH v2] block: partition: Add partition specific uevent callbacks for partition info Date: Mon, 30 Nov 2015 19:44:38 -0800 Message-Id: <1448941478-31411-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: San Mehat This patch has been carried in the Android tree for quite some time and is one of the few patches required to get a mainline kernel up and running with an exsiting Android userspace. So I wanted to submit it for review and consideration if it should be merged. For partitions, add new uevent parameters 'PARTN' which specifies the partitions index in the table, and 'PARTNAME', which specifies PARTNAME specifices the partition name of a partition device. Android's userspace uses this for creating device node links from the partition name and number: ie: /dev/block/platform/soc/by-name/system or /dev/block/platform/soc/by-num/p1 One can see its usage here: https://android.googlesource.com/platform/system/core/+/master/init/devices.cpp#355 and https://android.googlesource.com/platform/system/core/+/master/init/devices.cpp#494 Cc: Jens Axboe Cc: Rom Lemarchand Cc: Android Kernel Team Cc: Jeff Moyer Cc: harald@redhat.com Cc: kay@redhat.com Cc: linux-block@vger.kernel.org Signed-off-by: Dima Zavin [Dropped NPARTS and reworded commit message for context] Signed-off-by: John Stultz --- v2: Dropped NPARTS thanks to Jeff noticing it wasn't used. block/partition-generic.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/block/partition-generic.c b/block/partition-generic.c index 3b03015..d12489e 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -216,10 +216,21 @@ static void part_release(struct device *dev) kfree(p); } +static int part_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct hd_struct *part = dev_to_part(dev); + + add_uevent_var(env, "PARTN=%u", part->partno); + if (part->info && part->info->volname[0]) + add_uevent_var(env, "PARTNAME=%s", part->info->volname); + return 0; +} + struct device_type part_type = { .name = "partition", .groups = part_attr_groups, .release = part_release, + .uevent = part_uevent, }; static void delete_partition_rcu_cb(struct rcu_head *head)