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


Groups > linux.kernel > #1233996 > unrolled thread

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

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2015-09-28 12:00 +0200
Last post2015-09-28 15:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RESEND PATCH] block: cmdline-parser: add support for hidden disk space Shawn Lin <shawn.lin@rock-chips.com> - 2015-09-28 12:00 +0200
    RE: [RESEND PATCH] block: cmdline-parser: add support for hidden  disk space Caizhiyong <caizhiyong@hisilicon.com> - 2015-09-28 13:00 +0200
      Re: [RESEND PATCH] block: cmdline-parser: add support for hidden disk  space Shawn Lin <shawn.lin@rock-chips.com> - 2015-09-28 15:50 +0200

#1233996 — [RESEND PATCH] block: cmdline-parser: add support for hidden disk space

FromShawn Lin <shawn.lin@rock-chips.com>
Date2015-09-28 12:00 +0200
Subject[RESEND PATCH] block: cmdline-parser: add support for hidden disk space
Message-ID<qdDnX-28T-3@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..fcca57d 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 (!((*next_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]


#1234051 — RE: [RESEND PATCH] block: cmdline-parser: add support for hidden disk space

FromCaizhiyong <caizhiyong@hisilicon.com>
Date2015-09-28 13:00 +0200
SubjectRE: [RESEND PATCH] block: cmdline-parser: add support for hidden disk space
Message-ID<qdEk2-3tU-23@gated-at.bofh.it>
In reply to#1233996
Dear Shawn Lin:

     The cmdline-parser is support skip some reserve disk space, or hidden some disk space.
  
     See Documentation/block/cmdline-partition.txt

blkdevparts=<blkdev-def>[;<blkdev-def>]
  <blkdev-def> := <blkdev-id>:<partdef>[,<partdef>]
    <partdef> := <size>[@<offset>](part-name)

    The "offset" is next partition start address, If your bootargs is 'blkdevparts=mmcblk0:1G(data0),1G@2G(data1),-;', you will reserve 1G between mmcblk0p1 and mmcblk0p2;

Looking forward to your feedback.
Best regards.
Cai Zhiyong.
http://www.huawei.com

> -----Original Message-----
> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
> Sent: Monday, September 28, 2015 5:51 PM
> To: Jens Axboe
> Cc: Caizhiyong; linux-kernel@vger.kernel.org; Shawn Lin
> Subject: [RESEND PATCH] block: cmdline-parser: add support for hidden disk
> space
> 
> 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..fcca57d 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 (!((*next_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] | [prev] | [next] | [standalone]


#1234169 — Re: [RESEND PATCH] block: cmdline-parser: add support for hidden disk space

FromShawn Lin <shawn.lin@rock-chips.com>
Date2015-09-28 15:50 +0200
SubjectRe: [RESEND PATCH] block: cmdline-parser: add support for hidden disk space
Message-ID<qdGYy-12Y-23@gated-at.bofh.it>
In reply to#1234051
On 2015/9/28 18:48, Caizhiyong wrote:
> Dear Shawn Lin:
>
>       The cmdline-parser is support skip some reserve disk space, or hidden some disk space.
>
>       See Documentation/block/cmdline-partition.txt

Wow, that's just what I need. Thanks.

>
> blkdevparts=<blkdev-def>[;<blkdev-def>]
>    <blkdev-def> := <blkdev-id>:<partdef>[,<partdef>]
>      <partdef> := <size>[@<offset>](part-name)
>
>      The "offset" is next partition start address, If your bootargs is 'blkdevparts=mmcblk0:1G(data0),1G@2G(data1),-;', you will reserve 1G between mmcblk0p1 and mmcblk0p2;
>
> Looking forward to your feedback.
> Best regards.
> Cai Zhiyong.
> http://www.huawei.com
>
>> -----Original Message-----
>> From: Shawn Lin [mailto:shawn.lin@rock-chips.com]
>> Sent: Monday, September 28, 2015 5:51 PM
>> To: Jens Axboe
>> Cc: Caizhiyong; linux-kernel@vger.kernel.org; Shawn Lin
>> Subject: [RESEND PATCH] block: cmdline-parser: add support for hidden disk
>> space
>>
>> 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..fcca57d 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 (!((*next_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
>>
>
>
>
>


-- 
Best Regards
Shawn Lin

--
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] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web