Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233970 > unrolled thread
| Started by | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| First post | 2015-09-28 11:30 +0200 |
| Last post | 2015-09-28 11:40 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[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
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2015-09-28 11:30 +0200 |
| Subject | [PATCH] block: cmdline-parser: add support for hidden disk space |
| Message-ID | <qdCUW-1DD-9@gated-at.bofh.it> |
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/
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-09-28 11:40 +0200 |
| Message-ID | <qdD4C-1Mi-19@gated-at.bofh.it> |
| In reply to | #1233970 |
[Multipart message — attachments visible in raw view] — view raw
Hi Shawn,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: i386-randconfig-x005-201539 (attached as .config)
reproduce:
git checkout 937e3ebb4c7763e6120eda4a7e5b8c96bd710a9f
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
block/cmdline-parser.c: In function 'parse_parts':
>> block/cmdline-parser.c:136:9: error: 'subpart' undeclared (first use in this function)
if (!(subpart->flags & PF_HIDDEN))
^
block/cmdline-parser.c:136:9: note: each undeclared identifier is reported only once for each function it appears in
vim +/subpart +136 block/cmdline-parser.c
130 buf[length] = '\0';
131
132 ret = parse_subpart(next_subpart, buf);
133 if (ret)
134 goto fail;
135
> 136 if (!(subpart->flags & PF_HIDDEN))
137 newparts->nr_subparts++;
138
139 next_subpart = &(*next_subpart)->next_subpart;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-09-28 11:40 +0200 |
| Message-ID | <qdD4C-1Mi-21@gated-at.bofh.it> |
| In reply to | #1233970 |
[Multipart message — attachments visible in raw view] — view raw
Hi Shawn,
[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]
config: x86_64-randconfig-x005-201539 (attached as .config)
reproduce:
git checkout 937e3ebb4c7763e6120eda4a7e5b8c96bd710a9f
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/uapi/linux/capability.h:16,
from include/linux/capability.h:15,
from include/linux/sched.h:15,
from include/linux/blkdev.h:4,
from include/linux/cmdline-parser.h:10,
from block/cmdline-parser.c:8:
block/cmdline-parser.c: In function 'parse_parts':
block/cmdline-parser.c:136:9: error: 'subpart' undeclared (first use in this function)
if (!(subpart->flags & PF_HIDDEN))
^
include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
if (__builtin_constant_p((cond)) ? !!(cond) : \
^
>> block/cmdline-parser.c:136:3: note: in expansion of macro 'if'
if (!(subpart->flags & PF_HIDDEN))
^
block/cmdline-parser.c:136:9: note: each undeclared identifier is reported only once for each function it appears in
if (!(subpart->flags & PF_HIDDEN))
^
include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
if (__builtin_constant_p((cond)) ? !!(cond) : \
^
>> block/cmdline-parser.c:136:3: note: in expansion of macro 'if'
if (!(subpart->flags & PF_HIDDEN))
^
vim +/if +136 block/cmdline-parser.c
2 * Parse command line, get partition information
3 *
4 * Written by Cai Zhiyong <caizhiyong@huawei.com>
5 *
6 */
7 #include <linux/export.h>
> 8 #include <linux/cmdline-parser.h>
9
10 static int parse_subpart(struct cmdline_subpart **subpart, char *partdef)
11 {
12 int ret = 0;
13 struct cmdline_subpart *new_subpart;
14
15 *subpart = NULL;
16
17 new_subpart = kzalloc(sizeof(struct cmdline_subpart), GFP_KERNEL);
18 if (!new_subpart)
19 return -ENOMEM;
20
21 if (*partdef == '-') {
22 new_subpart->size = (sector_t)(~0ULL);
23 partdef++;
24 } else {
25 new_subpart->size = (sector_t)memparse(partdef, &partdef);
26 if (new_subpart->size < (sector_t)PAGE_SIZE) {
27 pr_warn("cmdline partition size is invalid.");
28 ret = -EINVAL;
29 goto fail;
30 }
31 }
32
33 if (*partdef == '@') {
34 partdef++;
35 new_subpart->from = (sector_t)memparse(partdef, &partdef);
36 } else {
37 new_subpart->from = (sector_t)(~0ULL);
38 }
39
40 if (*partdef == '(') {
41 int length;
42 char *next = strchr(++partdef, ')');
43
44 if (!next) {
45 pr_warn("cmdline partition format is invalid.");
46 ret = -EINVAL;
47 goto fail;
48 }
49
50 length = min_t(int, next - partdef,
51 sizeof(new_subpart->name) - 1);
52 strncpy(new_subpart->name, partdef, length);
53 new_subpart->name[length] = '\0';
54
55 partdef = ++next;
56 } else
57 new_subpart->name[0] = '\0';
58
59 new_subpart->flags = 0;
60
61 if (!strncmp(partdef, "ro", 2)) {
62 new_subpart->flags |= PF_RDONLY;
63 partdef += 2;
64 }
65
66 if (!strncmp(partdef, "lk", 2)) {
67 new_subpart->flags |= PF_POWERUP_LOCK;
68 partdef += 2;
69 }
70
71 if (!strncmp(partdef, "hidden", 6)) {
72 new_subpart->flags |= PF_HIDDEN;
73 partdef += 6;
74 }
75
76 *subpart = new_subpart;
77 return 0;
78 fail:
79 kfree(new_subpart);
80 return ret;
81 }
82
83 static void free_subpart(struct cmdline_parts *parts)
84 {
85 struct cmdline_subpart *subpart;
86
87 while (parts->subpart) {
88 subpart = parts->subpart;
89 parts->subpart = subpart->next_subpart;
90 kfree(subpart);
91 }
92 }
93
94 static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)
95 {
96 int ret = -EINVAL;
97 char *next;
98 int length;
99 struct cmdline_subpart **next_subpart;
100 struct cmdline_parts *newparts;
101 char buf[BDEVNAME_SIZE + 32 + 4];
102
103 *parts = NULL;
104
105 newparts = kzalloc(sizeof(struct cmdline_parts), GFP_KERNEL);
106 if (!newparts)
107 return -ENOMEM;
108
109 next = strchr(bdevdef, ':');
110 if (!next) {
111 pr_warn("cmdline partition has no block device.");
112 goto fail;
113 }
114
115 length = min_t(int, next - bdevdef, sizeof(newparts->name) - 1);
116 strncpy(newparts->name, bdevdef, length);
117 newparts->name[length] = '\0';
118 newparts->nr_subparts = 0;
119
120 next_subpart = &newparts->subpart;
121
122 while (next && *(++next)) {
123 bdevdef = next;
124 next = strchr(bdevdef, ',');
125
126 length = (!next) ? (sizeof(buf) - 1) :
127 min_t(int, next - bdevdef, sizeof(buf) - 1);
128
129 strncpy(buf, bdevdef, length);
130 buf[length] = '\0';
131
132 ret = parse_subpart(next_subpart, buf);
133 if (ret)
134 goto fail;
135
> 136 if (!(subpart->flags & PF_HIDDEN))
137 newparts->nr_subparts++;
138
139 next_subpart = &(*next_subpart)->next_subpart;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web