@@ -76,29 +76,29 @@ and partition_id =
76
76
| GPT_Type of string (* GPT UUID. *)
77
77
78
78
let rec debug_partition ?(sectsize =512L ) p =
79
- printf " %s:\n " p.p_name;
80
- printf " \t partition data: %ld %Ld-%Ld (%Ld bytes)\n "
79
+ eprintf " %s:\n " p.p_name;
80
+ eprintf " \t partition data: %ld %Ld-%Ld (%Ld bytes)\n "
81
81
p.p_part.G. part_num p.p_part.G. part_start p.p_part.G. part_end
82
82
p.p_part.G. part_size;
83
- printf " \t partition sector data: %Ld-%Ld (%Ld sectors)\n "
83
+ eprintf " \t partition sector data: %Ld-%Ld (%Ld sectors)\n "
84
84
(p.p_part.G. part_start /^ sectsize) (p.p_part.G. part_end /^ sectsize)
85
85
((p.p_part.G. part_end +^ 1L -^ p.p_part.G. part_start) /^ sectsize);
86
- printf " \t target partition sector data: %Ld-%Ld (%Ld sectors)\n "
86
+ eprintf " \t target partition sector data: %Ld-%Ld (%Ld sectors)\n "
87
87
p.p_target_start p.p_target_end (p.p_target_end +^ 1L -^ p.p_target_start);
88
- printf " \t bootable: %b\n " p.p_bootable;
89
- printf " \t partition ID: %s\n "
88
+ eprintf " \t bootable: %b\n " p.p_bootable;
89
+ eprintf " \t partition ID: %s\n "
90
90
(match p.p_id with
91
91
| No_ID -> " (none)"
92
92
| MBR_ID i -> sprintf " 0x%x" i
93
93
| GPT_Type i -> i
94
94
);
95
- printf " \t content: %s\n " (string_of_partition_content p.p_type);
96
- printf " \t label: %s\n "
95
+ eprintf " \t content: %s\n " (string_of_partition_content p.p_type);
96
+ eprintf " \t label: %s\n "
97
97
(match p.p_label with
98
98
| Some label -> label
99
99
| None -> " (none)"
100
100
);
101
- printf " \t GUID: %s\n "
101
+ eprintf " \t GUID: %s\n "
102
102
(match p.p_guid with
103
103
| Some guid -> guid
104
104
| None -> " (none)"
@@ -131,8 +131,8 @@ and logvol_operation =
131
131
| LVOpExpand (* expand it *)
132
132
133
133
let debug_logvol lv =
134
- printf " %s:\n " lv.lv_name;
135
- printf " \t content: %s\n " (string_of_partition_content lv.lv_type)
134
+ eprintf " %s:\n " lv.lv_name;
135
+ eprintf " \t content: %s\n " (string_of_partition_content lv.lv_type)
136
136
137
137
type expand_content_method =
138
138
| PVResize | Resize2fs | NTFSResize | BtrfsFilesystemResize | XFSGrowFS
@@ -230,9 +230,9 @@ read the man page virt-resize(1).
230
230
Getopt. parse opthandle.getopt;
231
231
232
232
if verbose () then (
233
- printf " command line:" ;
234
- List. iter (printf " %s" ) (Array. to_list Sys. argv);
235
- print_newline ()
233
+ eprintf " command line:" ;
234
+ List. iter (eprintf " %s" ) (Array. to_list Sys. argv);
235
+ eprintf " \n %! " ;
236
236
);
237
237
238
238
(* Dereference the rest of the args. *)
@@ -530,7 +530,8 @@ read the man page virt-resize(1).
530
530
531
531
if verbose () then (
532
532
eprintf " %d partitions found\n " (List. length partitions);
533
- List. iter debug_partition partitions
533
+ List. iter debug_partition partitions;
534
+ flush stderr
534
535
);
535
536
536
537
(* Check content isn't larger than partitions. If it is then
@@ -581,8 +582,9 @@ read the man page virt-resize(1).
581
582
) lvs in
582
583
583
584
if verbose () then (
584
- printf " %d logical volumes found\n " (List. length lvs);
585
- List. iter debug_logvol lvs
585
+ eprintf " %d logical volumes found\n " (List. length lvs);
586
+ List. iter debug_logvol lvs;
587
+ flush stderr
586
588
);
587
589
588
590
lvs in
@@ -1246,8 +1248,9 @@ read the man page virt-resize(1).
1246
1248
loop 1 start partitions in
1247
1249
1248
1250
if verbose () then (
1249
- printf " After calculate target partitions:\n " ;
1250
- List. iter (debug_partition ~sectsize ) partitions
1251
+ eprintf " After calculate target partitions:\n " ;
1252
+ List. iter (debug_partition ~sectsize ) partitions;
1253
+ flush stderr
1251
1254
);
1252
1255
1253
1256
(* Now partition the target disk. *)
@@ -1349,7 +1352,7 @@ read the man page virt-resize(1).
1349
1352
1350
1353
if verbose () then (
1351
1354
let old_hidden = int_of_le32 (g#pread_device target 4 0x1c_L ) in
1352
- debug " old hidden sectors value: 0x%Lx" old_hidden
1355
+ eprintf " old hidden sectors value: 0x%Lx\n %! " old_hidden
1353
1356
);
1354
1357
1355
1358
let new_hidden = le32_of_int start in
0 commit comments