Chen Hanxiao
2015-May-18 08:17 UTC
[Libguestfs] [PATCH] resize: add sector size in debug_partition
This patch will add fields of sector size for: - partition sector data size - target partition sector data size Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- resize/resize.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 4e58e84..21bba63 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -81,10 +81,11 @@ let rec debug_partition ?(sectsize=512L) p printf "\tpartition data: %ld %Ld-%Ld (%Ld bytes)\n" p.p_part.G.part_num p.p_part.G.part_start p.p_part.G.part_end p.p_part.G.part_size; - printf "\tpartition sector data: %Ld-%Ld\n" - (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize); - printf "\ttarget partition sector data: %Ld-%Ld \n" - p.p_target_start p.p_target_end; + printf "\tpartition sector data: %Ld-%Ld (%Ld sectors)\n" + (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize) + ((p.p_part.G.part_end -^ p.p_part.G.part_start) /^ sectsize +^ 1L); + printf "\ttarget partition sector data: %Ld-%Ld (%Ld sectors)\n" + p.p_target_start p.p_target_end (p.p_target_end -^ p.p_target_start +^ 1L); printf "\tbootable: %b\n" p.p_bootable; printf "\tpartition ID: %s\n" (match p.p_id with -- 2.1.0
Richard W.M. Jones
2015-May-18 09:50 UTC
Re: [Libguestfs] [PATCH] resize: add sector size in debug_partition
On Mon, May 18, 2015 at 04:17:28AM -0400, Chen Hanxiao wrote:> This patch will add fields of sector size for: > - partition sector data size > - target partition sector data size > > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> > --- > resize/resize.ml | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/resize/resize.ml b/resize/resize.ml > index 4e58e84..21bba63 100644 > --- a/resize/resize.ml > +++ b/resize/resize.ml > @@ -81,10 +81,11 @@ let rec debug_partition ?(sectsize=512L) p > printf "\tpartition data: %ld %Ld-%Ld (%Ld bytes)\n" > p.p_part.G.part_num p.p_part.G.part_start p.p_part.G.part_end > p.p_part.G.part_size; > - printf "\tpartition sector data: %Ld-%Ld\n" > - (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize); > - printf "\ttarget partition sector data: %Ld-%Ld \n" > - p.p_target_start p.p_target_end; > + printf "\tpartition sector data: %Ld-%Ld (%Ld sectors)\n" > + (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize) > + ((p.p_part.G.part_end -^ p.p_part.G.part_start) /^ sectsize +^ 1L);Although I think this gives the right answer, I think it's better to use: ((p.p_part.G.part_end +^ 1L -^ p.p_part.G.part_start) /^ sectsize)> + printf "\ttarget partition sector data: %Ld-%Ld (%Ld sectors)\n" > + p.p_target_start p.p_target_end (p.p_target_end -^ p.p_target_start +^ 1L);and the same here. With those changes, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Chen, Hanxiao
2015-May-18 10:21 UTC
Re: [Libguestfs] [PATCH] resize: add sector size in debug_partition
> -----Original Message----- > From: Richard W.M. Jones [mailto:rjones@redhat.com] > Sent: Monday, May 18, 2015 5:51 PM > To: Chen, Hanxiao/陈 晗霄 > Cc: libguestfs@redhat.com > Subject: Re: [Libguestfs] [PATCH] resize: add sector size in debug_partition > > On Mon, May 18, 2015 at 04:17:28AM -0400, Chen Hanxiao wrote: > > This patch will add fields of sector size for: > > - partition sector data size > > - target partition sector data size > > > > Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> > > --- > > resize/resize.ml | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/resize/resize.ml b/resize/resize.ml > > index 4e58e84..21bba63 100644 > > --- a/resize/resize.ml > > +++ b/resize/resize.ml > > @@ -81,10 +81,11 @@ let rec debug_partition ?(sectsize=512L) p > > printf "\tpartition data: %ld %Ld-%Ld (%Ld bytes)\n" > > p.p_part.G.part_num p.p_part.G.part_start p.p_part.G.part_end > > p.p_part.G.part_size; > > - printf "\tpartition sector data: %Ld-%Ld\n" > > - (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize); > > - printf "\ttarget partition sector data: %Ld-%Ld \n" > > - p.p_target_start p.p_target_end; > > + printf "\tpartition sector data: %Ld-%Ld (%Ld sectors)\n" > > + (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize) > > + ((p.p_part.G.part_end -^ p.p_part.G.part_start) /^ sectsize +^ 1L); > > Although I think this gives the right answer, I think it's better > to use: > > ((p.p_part.G.part_end +^ 1L -^ p.p_part.G.part_start) /^ sectsize) > > > + printf "\ttarget partition sector data: %Ld-%Ld (%Ld sectors)\n" > > + p.p_target_start p.p_target_end (p.p_target_end -^ p.p_target_start +^ 1L); > > and the same here. > > With those changes, ACK. >Thanks for the comments, v2 will fix this. Regards, - Chen
Reasonably Related Threads
- [PATCH v2] resize: add sector size in debug_partition
- Re: [PATCH] resize: add sector size in debug_partition
- [PATCH] resize: show sector infor in debug_partition
- Re: virt-resize: support to MBR logical partitions and some question
- [PATCH v3 0/7] add support to resize MBR logical partitions