Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233970

[PATCH] block: cmdline-parser: add support for hidden disk space

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH] block: cmdline-parser: add support for hidden disk space
Date Mon, 28 Sep 2015 11:30:02 +0200
Message-ID <qdCUW-1DD-9@gated-at.bofh.it> (permalink)
X-Original-To Jens Axboe <axboe@kernel.dk>
X-263anti-Spam KSV:0;
X-Mail-Gray 1
X-Abs-Checked 4
X-Rl-Sender shawn.lin@rock-chips.com
X-Fst-To axboe@kernel.dk
X-Sender-IP 58.22.7.114
X-Login-Name shawn.lin@rock-chips.com
X-Unique-Tag <41d5aab62166f9c9be7a1b51c0db3837>
X-Sender lintao@rock-chips.com
X-Mailer git-send-email 1.8.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 72
Organization linux.* mail to news gateway
X-Original-Cc Cai Zhiyong <caizhiyong@huawei.com>, linux-kernel@vger.kernel.org, Shawn Lin <shawn.lin@rock-chips.com>
X-Original-Date Mon, 28 Sep 2015 17:27:48 +0800
X-Original-Message-ID <1443432468-24265-1-git-send-email-shawn.lin@rock-chips.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1233970

Show key headers only | View raw


cmdline-partition now only support continuous disk space taken from
cmdline. When we need to reserve a disk space, for instance, 100m between
mmcblk0p1 and mmcblk0p2 for special use and wouldn't let kernel space
realize this "disk hole", we add this patch to ship adding this kind of
"disk hole" into the partition table. For any such cases, simply append
"hidden" to the end of subpart which is need to be reserved.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 block/cmdline-parser.c         | 12 +++++++++++-
 include/linux/cmdline-parser.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/block/cmdline-parser.c b/block/cmdline-parser.c
index 9dbc67e..feecbcc 100644
--- a/block/cmdline-parser.c
+++ b/block/cmdline-parser.c
@@ -68,6 +68,11 @@ static int parse_subpart(struct cmdline_subpart **subpart, char *partdef)
 		partdef += 2;
 	}
 
+	if (!strncmp(partdef, "hidden", 6)) {
+		new_subpart->flags |= PF_HIDDEN;
+		partdef += 6;
+	}
+
 	*subpart = new_subpart;
 	return 0;
 fail:
@@ -128,7 +133,9 @@ static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)
 		if (ret)
 			goto fail;
 
-		newparts->nr_subparts++;
+		if (!(subpart->flags & PF_HIDDEN))
+			newparts->nr_subparts++;
+
 		next_subpart = &(*next_subpart)->next_subpart;
 	}
 
@@ -245,6 +252,9 @@ int cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
 
 		from += subpart->size;
 
+		if (subpart->flags & PF_HIDDEN)
+			continue;
+
 		if (add_part(slot, subpart, param))
 			break;
 	}
diff --git a/include/linux/cmdline-parser.h b/include/linux/cmdline-parser.h
index 2e6dce6..7c1cb3c 100644
--- a/include/linux/cmdline-parser.h
+++ b/include/linux/cmdline-parser.h
@@ -14,6 +14,7 @@
 /* partition flags */
 #define PF_RDONLY                   0x01 /* Device is read only */
 #define PF_POWERUP_LOCK             0x02 /* Always locked after reset */
+#define PF_HIDDEN                   0x04 /* Hidden from partition table */
 
 struct cmdline_subpart {
 	char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
-- 
2.3.7


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] block: cmdline-parser: add support for hidden disk space Shawn Lin <shawn.lin@rock-chips.com> - 2015-09-28 11:30 +0200
  Re: [PATCH] block: cmdline-parser: add support for hidden disk space kbuild test robot <lkp@intel.com> - 2015-09-28 11:40 +0200
  Re: [PATCH] block: cmdline-parser: add support for hidden disk space kbuild test robot <lkp@intel.com> - 2015-09-28 11:40 +0200

csiph-web