Skip to content

Commit 94fcd59

Browse files
authored
ocaml: prepare formatting for ocamlformat 0.27.0 (#6678)
Some comments have had its location changed because this version of ocamlformat got confused with them. Ignoring whitespace changes is highly recommended, there's a button with a square as its icon on top of each commit page to do enable this mode.
2 parents a2bef4c + 1596ea9 commit 94fcd59

30 files changed

+109
-103
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ d6ab15362548b8fe270bd14d5153b8d94e1b15c0
3232
b12cf444edea15da6274975e1b2ca6a7fce2a090
3333
364c27f5d18ab9dd31825e67a93efabecad06823
3434
d8b4de9076531dd13bdffa20cc10c72290a52356
35+
bdf06bca7534fbc0c4fc3cee3408a51a22615226
3536

3637
# ocp-indent
3738
d018d26d6acd4707a23288b327b49e44f732725e

ocaml/database/db_cache_impl.ml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -482,24 +482,24 @@ let spawn_db_flush_threads () =
482482
try
483483
Thread.delay Db_backend.db_FLUSH_TIMER ;
484484
(* If I have some writing capacity left in this write period then consider doing a write; or
485-
if the connection is not write-limited then consider doing a write too.
486-
We also have to consider doing a write if exit_on_next_flush is set: because when this is
487-
set (by a signal handler) we want to do a flush whether or not our write limit has been
488-
exceeded.
485+
if the connection is not write-limited then consider doing a write too.
486+
We also have to consider doing a write if exit_on_next_flush is set: because when this is
487+
set (by a signal handler) we want to do a flush whether or not our write limit has been
488+
exceeded.
489489
*)
490+
(* always flush straight away; this request is urgent
491+
otherwise, we only write if
492+
(i) "coalesscing period has come to an end"; and
493+
(ii) "write limiting requirements are met": *)
490494
( if
491495
!Db_connections.exit_on_next_flush
492-
(* always flush straight away; this request is urgent *)
493-
|| (* otherwise, we only write if (i) "coalesscing period has come to an end"; and (ii) "write limiting requirements are met": *)
494-
(not (in_coallescing_period ()))
495-
(* see (i) above *)
496-
&& (!my_writes_this_period
497-
< dbconn.Parse_db_conf.write_limit_write_cycles
498-
|| dbconn.Parse_db_conf.mode
499-
= Parse_db_conf.No_limit
500-
(* (ii) above *)
501-
)
502-
then (* debug "[%s] considering flush" db_path; *)
496+
|| (not (in_coallescing_period ()))
497+
&& (!my_writes_this_period
498+
< dbconn.Parse_db_conf.write_limit_write_cycles
499+
|| dbconn.Parse_db_conf.mode
500+
= Parse_db_conf.No_limit
501+
)
502+
then
503503
let was_anything_flushed =
504504
Xapi_stdext_threads.Threadext.Mutex.execute
505505
Db_lock.global_flush_mutex (fun () ->
@@ -509,7 +509,7 @@ let spawn_db_flush_threads () =
509509
if was_anything_flushed then (
510510
my_writes_this_period := !my_writes_this_period + 1 ;
511511
(* when we do a write, reset the coallesce_period_start to now -- recall that this
512-
variable tracks the time since last write *)
512+
variable tracks the time since last write *)
513513
coallesce_period_start := Unix.gettimeofday ()
514514
)
515515
) ;

ocaml/database/db_secret_string.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
*)
1414

1515
(* Prevent direct conversions to string to avoid accidental misuse.
16-
* It is still possible to convert it to Rpc.t and recover it that way,
17-
* it is not a protection against willfully recovering the protected string
18-
* (we do need to send these as parameters in RPCs).
19-
* *)
16+
It is still possible to convert it to Rpc.t and recover it that way,
17+
it is not a protection against willfully recovering the protected string
18+
(we do need to send these as parameters in RPCs).
19+
*)
2020

2121
(** a type with no direct conversions to string *)
2222
type t

ocaml/forkexecd/lib/fe_systemctl.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ let show ~service =
107107
let stop ~service =
108108
action ~service "stop" ;
109109
(* Stopping shouldn't fail because it should fall back to SIGKILL which should almost always work,
110-
* unless there is a kernel bug that keeps a process stuck.
111-
* In the unlikely scenario that this does fail we leave the transient service file behind
112-
* so that the failure can be investigated.
113-
* *)
110+
unless there is a kernel bug that keeps a process stuck.
111+
In the unlikely scenario that this does fail we leave the transient service file behind
112+
so that the failure can be investigated.
113+
*)
114114
let status = show ~service in
115115
(* allow systemd to garbage-collect the status and the unit, preventing leaks.
116116
* See CollectMode in systemd.unit(5) for details. *)
@@ -162,7 +162,7 @@ let start_transient ?env ?properties ?(exec_ty = Type.Simple) ~service cmd args
162162
(* If start failed we do not know what state the service is in:
163163
* try to stop it and clean up.
164164
* Stopping could fail as well, in which case report the original exception.
165-
* *)
165+
*)
166166
( try
167167
let (_ : status) = stop ~service in
168168
()

ocaml/forkexecd/src/child.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ let run state comms_sock fd_sock fd_sock_path =
274274
let (_ : int list) = Unix.sigprocmask Unix.SIG_BLOCK [Sys.sigchld] in
275275

276276
(* First test whether the child has exited - if it has then report this
277-
* via the socket and exit. *)
277+
* via the socket and exit. *)
278278
match Unix.waitpid [Unix.WNOHANG] result with
279279
| pid, status when pid = result ->
280280
report_child_exit comms_sock args result status ;

ocaml/libs/pciutil/pciutil.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ let parse_from file vendor device =
2525
let vendor_str = ref (unknown_vendor vendor)
2626
and device_str = ref (unknown_device device) in
2727
(* CA-26771: As we parse the file we keep track of the current vendor.
28-
When we find a device match we only accept it if it's from the right vendor; it doesn't make
29-
sense to pair vendor 2's device with vendor 1. *)
28+
When we find a device match we only accept it if it's from the right
29+
vendor; it doesn't make sense to pair vendor 2's device with vendor 1. *)
3030
let current_xvendor = ref "" in
3131
Unixext.readfile_line
3232
(fun line ->
33+
(* ignore subvendors/subdevices, blank lines and comments *)
3334
if line = "" || line.[0] = '#' || (line.[0] = '\t' && line.[1] = '\t')
34-
then (* ignore subvendors/subdevices, blank lines and comments *)
35+
then
3536
()
3637
else if line.[0] = '\t' then (
3738
if

ocaml/libs/tracing/tracing_export.mli

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
(*
2-
* Copyright (C) 2024 Cloud Software Group
3-
*
4-
* This program is free software; you can redistribute it and/or modify
5-
* it under the terms of the GNU Lesser General Public License as published
6-
* by the Free Software Foundation; version 2.1 only. with the special
7-
* exception on linking described in file LICENSE.
8-
*
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU Lesser General Public License for more details.
13-
*)
2+
* Copyright (C) 2024 Cloud Software Group
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published
6+
* by the Free Software Foundation; version 2.1 only. with the special
7+
* exception on linking described in file LICENSE.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*)
1414

1515
(** [Tracing_export] is a module dedicated for the creation and management of
1616
threads that export the tracing data.

ocaml/networkd/bin/network_monitor_thread.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ let get_link_stats () =
125125
in
126126
List.map (fun link -> standardise_name (Link.get_name link)) links
127127
|> (* Only keep interfaces with prefixes on the whitelist, and exclude VLAN
128-
devices (ethx.y). *)
128+
devices (ethx.y). *)
129129
List.filter (fun name -> is_whitelisted name && not (is_vlan name))
130130
in
131131
Cache.free cache ; Socket.close s ; Socket.free s ; links

ocaml/xapi-aux/kerberos_encryption_types.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
(* Kerberos support several different encrytion types
1616
* winbind support it as strong, legacy and all
1717
* details, https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html
18-
* *)
18+
*)
1919

2020
module Winbind = struct
2121
type t = Strong | Legacy | All
2222

2323
(*
24-
* [X] 0x00000001 DES-CBC-CRC
25-
* [X] 0x00000002 DES-CBC-MD5
26-
* [X] 0x00000004 RC4-HMAC
27-
* [X] 0x00000008 AES128-CTS-HMAC-SHA1-96
28-
* [X] 0x00000010 AES256-CTS-HMAC-SHA1-96
29-
* *)
24+
* [X] 0x00000001 DES-CBC-CRC
25+
* [X] 0x00000002 DES-CBC-MD5
26+
* [X] 0x00000004 RC4-HMAC
27+
* [X] 0x00000008 AES128-CTS-HMAC-SHA1-96
28+
* [X] 0x00000010 AES256-CTS-HMAC-SHA1-96
29+
*)
3030

3131
let des_cbc_crc = 0x1
3232

ocaml/xapi-idl/lib/coverage/enabled.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ module Dispatcher = struct
103103
|> (* filter out ourselves *)
104104
List.filter (fun q -> self <> q)
105105
|> (* best-effort: collect and return all non-failed results, log
106-
errors *)
106+
errors *)
107107
List.rev_map (rpc_ignore_err ~t ~body)
108108
|> (* multiple return values converted to a single string, suitable
109-
for use in a command like: mv $(message-cli call
110-
org.xen.xapi.coverage.dispatch --timeout 60 --body 'dump
111-
{jobid}') /tmp/coverage/ *)
109+
for use in a command like: mv $(message-cli call
110+
org.xen.xapi.coverage.dispatch --timeout 60 --body 'dump
111+
{jobid}') /tmp/coverage/ *)
112112
String.concat " "
113113
|> ok
114114
)

0 commit comments

Comments
 (0)