]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
[dbus_server] support immutable properties
authorPrashanth Mundkur <prashanth.mundkur@citrix.com>
Fri, 31 Jul 2009 04:17:05 +0000 (21:17 -0700)
committerVincent Hanquez <vincent.hanquez@eu.citrix.com>
Tue, 11 Aug 2009 12:45:29 +0000 (13:45 +0100)
common/dbus_server.ml

index b02396e3a2262bcc081ac894b09fb6ff3544b813..85bbacc64a628b3e8ec8a817ef4c7c9070f47065 100644 (file)
@@ -142,6 +142,7 @@ module Property = struct
                | Set_Double of (float  -> bool) * (float  -> unit)
                | Set_String of (string -> bool) * (string -> unit)
                | Set_ObjectPath of (string -> bool) * (string -> unit)
+               | Set_Immutable
 
        (* common utility predicate *)
        let true_predicate _ = true
@@ -178,6 +179,7 @@ module Property = struct
                | Set_Double _  -> "double"
                | Set_String _  -> "string"
                | Set_ObjectPath _  -> "objectpath"
+               | Set_Immutable -> "immutable"
 
        type t = getter * setter
 
@@ -257,6 +259,10 @@ module Property = struct
                | Some (Set_ObjectPath (p, f)), DBus.ObjectPath v ->
                        if p v then begin f v; Right [] end
                        else invalid_error
+               | Some Set_Immutable, _ ->
+                       Left (DBus.ERR_FAILED, "immutable property",
+                             [ DBus.String (Printf.sprintf "Property \"%s\" is immutable" pname) ]
+                            )
                | Some g, _ ->
                        Left (DBus.ERR_INVALID_ARGS, "invalid arg(s)",
                              [ DBus.String (