diff options
author | Tomáš Mózes <tomas.mozes@gmail.com> | 2024-08-01 15:02:58 +0200 |
---|---|---|
committer | Tomáš Mózes <tomas.mozes@gmail.com> | 2024-08-01 15:02:58 +0200 |
commit | 212febf72900c12405591dcc5902d4cfa11173bf (patch) | |
tree | 7a093fae6f723d02b6c4a573669615024fe65e4d /0059-tools-oxenstored-Make-Quota.t-pure.patch | |
parent | Xen 4.17.4-pre-patchset-1 (diff) | |
download | xen-upstream-patches-212febf72900c12405591dcc5902d4cfa11173bf.tar.gz xen-upstream-patches-212febf72900c12405591dcc5902d4cfa11173bf.tar.bz2 xen-upstream-patches-212febf72900c12405591dcc5902d4cfa11173bf.zip |
Xen 4.18.3-pre-patchset-04.18.3-pre-patchset-0
Signed-off-by: Tomáš Mózes <tomas.mozes@gmail.com>
Diffstat (limited to '0059-tools-oxenstored-Make-Quota.t-pure.patch')
-rw-r--r-- | 0059-tools-oxenstored-Make-Quota.t-pure.patch | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/0059-tools-oxenstored-Make-Quota.t-pure.patch b/0059-tools-oxenstored-Make-Quota.t-pure.patch deleted file mode 100644 index 7616b90..0000000 --- a/0059-tools-oxenstored-Make-Quota.t-pure.patch +++ /dev/null @@ -1,121 +0,0 @@ -From f38a815a54000ca51ff5165b2863d60b6bbea49c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= <edwin.torok@cloud.com> -Date: Wed, 31 Jan 2024 10:52:56 +0000 -Subject: [PATCH 59/67] tools/oxenstored: Make Quota.t pure -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Now that we no longer have a hashtable inside we can make Quota.t pure, and -push the mutable update to its callers. Store.t already had a mutable Quota.t -field. - -No functional change. - -Signed-off-by: Edwin Török <edwin.torok@cloud.com> -Acked-by: Christian Lindig <christian.lindig@cloud.com> -(cherry picked from commit 098d868e52ac0165b7f36e22b767ea70cef70054) ---- - tools/ocaml/xenstored/quota.ml | 8 ++++---- - tools/ocaml/xenstored/store.ml | 17 ++++++++++------- - 2 files changed, 14 insertions(+), 11 deletions(-) - -diff --git a/tools/ocaml/xenstored/quota.ml b/tools/ocaml/xenstored/quota.ml -index ee8dd22581..b3ab678c72 100644 ---- a/tools/ocaml/xenstored/quota.ml -+++ b/tools/ocaml/xenstored/quota.ml -@@ -33,7 +33,7 @@ module DomidMap = Map.Make(Domid) - type t = { - maxent: int; (* max entities per domU *) - maxsize: int; (* max size of data store in one node *) -- mutable cur: int DomidMap.t; (* current domains quota *) -+ cur: int DomidMap.t; (* current domains quota *) - } - - let to_string quota domid = -@@ -76,10 +76,10 @@ let update_entry quota_cur id diff = - else DomidMap.add id nb quota_cur - - let del_entry quota id = -- quota.cur <- update_entry quota.cur id (-1) -+ {quota with cur = update_entry quota.cur id (-1)} - - let add_entry quota id = -- quota.cur <- update_entry quota.cur id (+1) -+ {quota with cur = update_entry quota.cur id (+1)} - - let merge orig_quota mod_quota dest_quota = - let fold_merge id nb dest = -@@ -87,5 +87,5 @@ let merge orig_quota mod_quota dest_quota = - | 0 -> dest (* not modified *) - | diff -> update_entry dest id diff (* update with [x=x+diff] *) - in -- dest_quota.cur <- DomidMap.fold fold_merge mod_quota.cur dest_quota.cur -+ {dest_quota with cur = DomidMap.fold fold_merge mod_quota.cur dest_quota.cur} - (* dest_quota = dest_quota + (mod_quota - orig_quota) *) -diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml -index c94dbf3a62..5dd965db15 100644 ---- a/tools/ocaml/xenstored/store.ml -+++ b/tools/ocaml/xenstored/store.ml -@@ -85,7 +85,9 @@ let check_owner node connection = - raise Define.Permission_denied; - end - --let rec recurse fct node = fct node; SymbolMap.iter (fun _ -> recurse fct) node.children -+let rec recurse fct node acc = -+ let acc = fct node acc in -+ SymbolMap.fold (fun _ -> recurse fct) node.children acc - - (** [recurse_filter_map f tree] applies [f] on each node in the tree recursively, - possibly removing some nodes. -@@ -408,7 +410,7 @@ let dump_buffer store = dump_store_buf store.root - let set_node store path node orig_quota mod_quota = - let root = Path.set_node store.root path node in - store.root <- root; -- Quota.merge orig_quota mod_quota store.quota -+ store.quota <- Quota.merge orig_quota mod_quota store.quota - - let write store perm path value = - let node, existing = get_deepest_existing_node store path in -@@ -422,7 +424,7 @@ let write store perm path value = - let root, node_created = path_write store perm path value in - store.root <- root; - if node_created -- then Quota.add_entry store.quota owner -+ then store.quota <- Quota.add_entry store.quota owner - - let mkdir store perm path = - let node, existing = get_deepest_existing_node store path in -@@ -431,7 +433,7 @@ let mkdir store perm path = - if not (existing || (Perms.Connection.is_dom0 perm)) then Quota.check store.quota owner 0; - store.root <- path_mkdir store perm path; - if not existing then -- Quota.add_entry store.quota owner -+ store.quota <- Quota.add_entry store.quota owner - - let rm store perm path = - let rmed_node = Path.get_node store.root path in -@@ -439,7 +441,7 @@ let rm store perm path = - | None -> raise Define.Doesnt_exist - | Some rmed_node -> - store.root <- path_rm store perm path; -- Node.recurse (fun node -> Quota.del_entry store.quota (Node.get_owner node)) rmed_node -+ store.quota <- Node.recurse (fun node quota -> Quota.del_entry quota (Node.get_owner node)) rmed_node store.quota - - let setperms store perm path nperms = - match Path.get_node store.root path with -@@ -450,8 +452,9 @@ let setperms store perm path nperms = - if not ((old_owner = new_owner) || (Perms.Connection.is_dom0 perm)) then - raise Define.Permission_denied; - store.root <- path_setperms store perm path nperms; -- Quota.del_entry store.quota old_owner; -- Quota.add_entry store.quota new_owner -+ store.quota <- -+ let quota = Quota.del_entry store.quota old_owner in -+ Quota.add_entry quota new_owner - - let reset_permissions store domid = - Logging.info "store|node" "Cleaning up xenstore ACLs for domid %d" domid; --- -2.44.0 - |