File: udisks2-Utilities.html

package info (click to toggle)
udisks2 2.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,612 kB
  • sloc: ansic: 49,035; python: 8,537; sh: 5,574; xml: 1,490; makefile: 1,232; sed: 85
file content (1133 lines) | stat: -rw-r--r-- 57,838 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Utilities: UDisks Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="UDisks Reference Manual">
<link rel="up" href="ref-daemon-core.html" title="Core">
<link rel="prev" href="ref-daemon-core.html" title="Core">
<link rel="next" href="udisks2-Logging.html" title="Logging">
<meta name="generator" content="GTK-Doc V1.35.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#udisks2-Utilities.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ref-daemon-core.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ref-daemon-core.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="udisks2-Logging.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="udisks2-Utilities"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="udisks2-Utilities.top_of_page"></a>Utilities</span></h2>
<p>Utilities — Various utility routines</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="udisks2-Utilities.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-decode-udev-string" title="udisks_decode_udev_string ()">udisks_decode_udev_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-safe-append-to-object-path" title="udisks_safe_append_to_object_path ()">udisks_safe_append_to_object_path</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint64</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-block-get-size" title="udisks_daemon_util_block_get_size ()">udisks_daemon_util_block_get_size</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-resolve-link" title="udisks_daemon_util_resolve_link ()">udisks_daemon_util_resolve_link</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> **
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-resolve-links" title="udisks_daemon_util_resolve_links ()">udisks_daemon_util_resolve_links</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-check-authorization-sync" title="udisks_daemon_util_check_authorization_sync ()">udisks_daemon_util_check_authorization_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-get-caller-uid-sync" title="udisks_daemon_util_get_caller_uid_sync ()">udisks_daemon_util_get_caller_uid_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-get-caller-pid-sync" title="udisks_daemon_util_get_caller_pid_sync ()">udisks_daemon_util_get_caller_pid_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-setup-by-user" title="udisks_daemon_util_setup_by_user ()">udisks_daemon_util_setup_by_user</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gpointer</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-dup-object" title="udisks_daemon_util_dup_object ()">udisks_daemon_util_dup_object</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="udisks2-Utilities.html#UDisksInhibitCookie" title="UDisksInhibitCookie"><span class="returnvalue">UDisksInhibitCookie</span></a> *
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-inhibit-system-sync" title="udisks_daemon_util_inhibit_system_sync ()">udisks_daemon_util_inhibit_system_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-uninhibit-system-sync" title="udisks_daemon_util_uninhibit_system_sync ()">udisks_daemon_util_uninhibit_system_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-hexdump" title="udisks_daemon_util_hexdump ()">udisks_daemon_util_hexdump</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-hexdump-debug" title="udisks_daemon_util_hexdump_debug ()">udisks_daemon_util_hexdump_debug</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-file-set-contents" title="udisks_daemon_util_file_set_contents ()">udisks_daemon_util_file_set_contents</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-on-user-seat" title="udisks_daemon_util_on_user_seat ()">udisks_daemon_util_on_user_seat</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-get-free-mdraid-device" title="udisks_daemon_util_get_free_mdraid_device ()">udisks_daemon_util_get_free_mdraid_device</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint16</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-ata-identify-get-word" title="udisks_ata_identify_get_word ()">udisks_ata_identify_get_word</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-trigger-uevent" title="udisks_daemon_util_trigger_uevent ()">udisks_daemon_util_trigger_uevent</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-trigger-uevent-sync" title="udisks_daemon_util_trigger_uevent_sync ()">udisks_daemon_util_trigger_uevent_sync</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="udisks2-Utilities.html#udisks-module-validate-name" title="udisks_module_validate_name ()">udisks_module_validate_name</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="udisks2-Utilities.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody><tr>
<td class="typedef_keyword">typedef</td>
<td class="function_name"><a class="link" href="udisks2-Utilities.html#UDisksInhibitCookie" title="UDisksInhibitCookie">UDisksInhibitCookie</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="udisks2-Utilities.description"></a><h2>Description</h2>
<p>Various utility routines.</p>
</div>
<div class="refsect1">
<a name="udisks2-Utilities.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="udisks-decode-udev-string"></a><h3>udisks_decode_udev_string ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
udisks_decode_udev_string (<em class="parameter"><code>const <span class="type">gchar</span> *str</code></em>,
                           <em class="parameter"><code>const <span class="type">gchar</span> *fallback_str</code></em>);</pre>
<p>Unescapes sequences like \x20 to " " and ensures the returned string is valid UTF-8.</p>
<p>If the string is not valid UTF-8, try as hard as possible to convert to UTF-8.</p>
<p>If <code class="literal">NULL</code> is passed, then <code class="literal">NULL</code> is returned.</p>
<p>See <code class="function">udev_util_encode_string()</code> in libudev/libudev-util.c in the udev
tree for what kinds of strings can be used.</p>
<div class="refsect3">
<a name="udisks-decode-udev-string.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>An udev-encoded string or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>fallback_str</p></td>
<td class="parameter_description"><p>String to use when <em class="parameter"><code>str</code></em>
can't be converted to a valid UTF-8 string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-decode-udev-string.returns"></a><h4>Returns</h4>
<p> A valid UTF-8 string that must be freed with <code class="function">g_free()</code>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-safe-append-to-object-path"></a><h3>udisks_safe_append_to_object_path ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
udisks_safe_append_to_object_path (<em class="parameter"><code><span class="type">GString</span> *str</code></em>,
                                   <em class="parameter"><code>const <span class="type">gchar</span> *s</code></em>);</pre>
<p>Appends <em class="parameter"><code>s</code></em>
 to <em class="parameter"><code>str</code></em>
 in a way such that only characters that can be
used in a D-Bus object path will be used. E.g. a character not in
<code class="literal">A-Z[0-9]_</code> will be escaped as _HEX where
HEX is a two-digit hexadecimal number.</p>
<p>Note that his mapping is not bijective - e.g. you cannot go back
to the original string.</p>
<div class="refsect3">
<a name="udisks-safe-append-to-object-path.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>str</p></td>
<td class="parameter_description"><p>A <span class="type">GString</span> to append to.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>s</p></td>
<td class="parameter_description"><p>A UTF-8 string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-block-get-size"></a><h3>udisks_daemon_util_block_get_size ()</h3>
<pre class="programlisting"><span class="returnvalue">guint64</span>
udisks_daemon_util_block_get_size (<em class="parameter"><code><a href="https://gnome.pages.gitlab.gnome.org/libgudev/libgudev/GUdevDevice.html#GUdevDevice-struct"><span class="type">GUdevDevice</span></a> *device</code></em>,
                                   <em class="parameter"><code><span class="type">gboolean</span> *out_media_available</code></em>,
                                   <em class="parameter"><code><span class="type">gboolean</span> *out_media_change_detected</code></em>);</pre>
<p>Gets the size of the <em class="parameter"><code>device</code></em>
 top-level block device, checking for media in the process</p>
<div class="refsect3">
<a name="udisks-daemon-util-block-get-size.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>device</p></td>
<td class="parameter_description"><p>A <a href="https://gnome.pages.gitlab.gnome.org/libgudev/libgudev/GUdevDevice.html#GUdevDevice-struct"><span class="type">GUdevDevice</span></a> for a top-level block device.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out_media_available</p></td>
<td class="parameter_description"><p>Return location for whether media is available or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_media_change_detected</p></td>
<td class="parameter_description"><p>Return location for whether media change is detected or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-block-get-size.returns"></a><h4>Returns</h4>
<p> The size of <em class="parameter"><code>device</code></em>
or 0 if no media is available or if unknown.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-resolve-link"></a><h3>udisks_daemon_util_resolve_link ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
udisks_daemon_util_resolve_link (<em class="parameter"><code>const <span class="type">gchar</span> *path</code></em>,
                                 <em class="parameter"><code>const <span class="type">gchar</span> *name</code></em>);</pre>
<p>Resolves the symlink <em class="parameter"><code>path</code></em>
/<em class="parameter"><code>name</code></em>
.</p>
<div class="refsect3">
<a name="udisks-daemon-util-resolve-link.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A path</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>Name of a symlink in <em class="parameter"><code>path</code></em>
.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-resolve-link.returns"></a><h4>Returns</h4>
<p> A canonicalized absolute pathname or <code class="literal">NULL</code> if the symlink
could not be resolved. Free with <code class="function">g_free()</code>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-resolve-links"></a><h3>udisks_daemon_util_resolve_links ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> **
udisks_daemon_util_resolve_links (<em class="parameter"><code>const <span class="type">gchar</span> *path</code></em>,
                                  <em class="parameter"><code>const <span class="type">gchar</span> *dir_name</code></em>);</pre>
<p>Resolves all symlinks in <em class="parameter"><code>path</code></em>
/<em class="parameter"><code>dir_name</code></em>
. This can be used to
easily walk e.g. holders or slaves of block devices.</p>
<div class="refsect3">
<a name="udisks-daemon-util-resolve-links.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>A path</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dir_name</p></td>
<td class="parameter_description"><p>Name of a directory in <em class="parameter"><code>path</code></em>
holding symlinks.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-resolve-links.returns"></a><h4>Returns</h4>
<p> An array of canonicalized absolute pathnames. Free with <code class="function">g_strfreev()</code>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-check-authorization-sync"></a><h3>udisks_daemon_util_check_authorization_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_check_authorization_sync
                               (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                <em class="parameter"><code><a class="link" href="UDisksObject.html" title="UDisksObject"><span class="type">UDisksObject</span></a> *object</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *action_id</code></em>,
                                <em class="parameter"><code><span class="type">GVariant</span> *options</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *message</code></em>,
                                <em class="parameter"><code><span class="type">GDBusMethodInvocation</span> *invocation</code></em>);</pre>
<p>Checks if the caller represented by <em class="parameter"><code>invocation</code></em>
 is authorized for
the action identified by <em class="parameter"><code>action_id</code></em>
, optionally displaying <em class="parameter"><code>message</code></em>

if authentication is needed. Additionally, if the caller is not
authorized, the appropriate error is already returned to the caller
via <em class="parameter"><code>invocation</code></em>
.</p>
<p>The calling thread is blocked for the duration of the authorization
check which could be a very long time since it may involve
presenting an authentication dialog and having a human user use
it. If <span class="quote">“<span class="quote">auth.no_user_interaction</span>”</span> in <em class="parameter"><code>options</code></em>
 is <code class="literal">TRUE</code>
no authentication dialog will be presented and the check is not
expected to take a long time.</p>
<p>See <a class="xref" href="udisks-polkit-actions.html#udisks-polkit-details" title="Table 1. Known polkit variables">Table 1, “Known polkit variables”</a> for the variables that
can be used in <em class="parameter"><code>message</code></em>
 but note that not all variables can be used
in all checks. For example, any check involving a <a class="link" href="UDisksDrive.html" title="UDisksDrive"><span class="type">UDisksDrive</span></a> or a
<a class="link" href="UDisksBlock.html" title="UDisksBlock"><span class="type">UDisksBlock</span></a> object can safely include the fragment</p>
<span class="quote">“<span class="quote">$(drive)</span>”</span> since it will always expand to the name of
<p>the drive, e.g. <span class="quote">“<span class="quote">INTEL SSDSA2MH080G1GC (/dev/sda1)</span>”</span> or
the block device file e.g. <span class="quote">“<span class="quote">/dev/vg_lucifer/lv_root</span>”</span>
or <span class="quote">“<span class="quote">/dev/sda1</span>”</span>. However this won't work for operations
that isn't on a drive or block device, for example calls on the</p>
<a class="link" href="gdbus-org.freedesktop.UDisks2.Manager.html#gdbus-interface-org-freedesktop-UDisks2-Manager.top_of_page">Manager</a><p>object.</p>
<div class="refsect3">
<a name="udisks-daemon-util-check-authorization-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>object</p></td>
<td class="parameter_description"><p>The <span class="type">GDBusObject</span> that the call is on or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>action_id</p></td>
<td class="parameter_description"><p>The action id to check for.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>options</p></td>
<td class="parameter_description"><p>A <span class="type">GVariant</span> to check for the <span class="quote">“<span class="quote">auth.no_user_interaction</span>”</span> option or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>message</p></td>
<td class="parameter_description"><p>The message to convey (use N_).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>invocation</p></td>
<td class="parameter_description"><p>The invocation to check for.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-check-authorization-sync.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if caller is authorized, <code class="literal">FALSE</code> if not.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-get-caller-uid-sync"></a><h3>udisks_daemon_util_get_caller_uid_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_get_caller_uid_sync
                               (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                <em class="parameter"><code><span class="type">GDBusMethodInvocation</span> *invocation</code></em>,
                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
                                <em class="parameter"><code><span class="type">uid_t</span> *out_uid</code></em>,
                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Gets the UNIX user id of the peer represented by <em class="parameter"><code>invocation</code></em>
.</p>
<div class="refsect3">
<a name="udisks-daemon-util-get-caller-uid-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>invocation</p></td>
<td class="parameter_description"><p>A <span class="type">GDBusMethodInvocation</span>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>A <span class="type">GCancellable</span> or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_uid</p></td>
<td class="parameter_description"><p>Return location for resolved uid or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Return location for error.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-get-caller-uid-sync.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the user id (and possibly group id) was obtained, <code class="literal">FALSE</code> otherwise</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-get-caller-pid-sync"></a><h3>udisks_daemon_util_get_caller_pid_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_get_caller_pid_sync
                               (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                <em class="parameter"><code><span class="type">GDBusMethodInvocation</span> *invocation</code></em>,
                                <em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
                                <em class="parameter"><code><span class="type">pid_t</span> *out_pid</code></em>,
                                <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Gets the UNIX process id of the peer represented by <em class="parameter"><code>invocation</code></em>
.</p>
<div class="refsect3">
<a name="udisks-daemon-util-get-caller-pid-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>invocation</p></td>
<td class="parameter_description"><p>A <span class="type">GDBusMethodInvocation</span>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>A <span class="type">GCancellable</span> or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>out_pid</p></td>
<td class="parameter_description"><p>Return location for resolved pid or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Return location for error.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-get-caller-pid-sync.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the process id was obtained, <code class="literal">FALSE</code> otherwise</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-setup-by-user"></a><h3>udisks_daemon_util_setup_by_user ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_setup_by_user (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                  <em class="parameter"><code><a class="link" href="UDisksObject.html" title="UDisksObject"><span class="type">UDisksObject</span></a> *object</code></em>,
                                  <em class="parameter"><code><span class="type">uid_t</span> user</code></em>);</pre>
<p>Checks whether the device represented by <em class="parameter"><code>object</code></em>
 (if any) has been
setup by <em class="parameter"><code>user</code></em>
.</p>
<div class="refsect3">
<a name="udisks-daemon-util-setup-by-user.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>object</p></td>
<td class="parameter_description"><p>The <span class="type">GDBusObject</span> that the call is on or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user</p></td>
<td class="parameter_description"><p>The user in question.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-setup-by-user.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if <em class="parameter"><code>object</code></em>
has been set-up by <em class="parameter"><code>user</code></em>
, <code class="literal">FALSE</code> if not.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-dup-object"></a><h3>udisks_daemon_util_dup_object ()</h3>
<pre class="programlisting"><span class="returnvalue">gpointer</span>
udisks_daemon_util_dup_object (<em class="parameter"><code><span class="type">gpointer</span> interface_</code></em>,
                               <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Gets the enclosing <a class="link" href="UDisksObject.html" title="UDisksObject"><span class="type">UDisksObject</span></a> for <em class="parameter"><code>interface</code></em>
, if any.</p>
<div class="refsect3">
<a name="udisks-daemon-util-dup-object.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>interface_</p></td>
<td class="parameter_description"><p>A <span class="type">GDBusInterface</span>-derived instance. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> GDBusInterface]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>, or an unset <span class="type">GError</span> to set if the return value is <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-dup-object.returns"></a><h4>Returns</h4>
<p>Either <code class="literal">NULL</code> or a
<a class="link" href="UDisksObject.html" title="UDisksObject"><span class="type">UDisksObject</span></a>-derived instance that must be released with
<code class="function">g_object_unref()</code>. </p>
<p><span class="annotation">[<acronym title="The caller owns the data, and is responsible for free it."><span class="acronym">transfer full</span></acronym>][<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> UDisksObject]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-inhibit-system-sync"></a><h3>udisks_daemon_util_inhibit_system_sync ()</h3>
<pre class="programlisting"><a class="link" href="udisks2-Utilities.html#UDisksInhibitCookie" title="UDisksInhibitCookie"><span class="returnvalue">UDisksInhibitCookie</span></a> *
udisks_daemon_util_inhibit_system_sync
                               (<em class="parameter"><code>const <span class="type">gchar</span> *reason</code></em>);</pre>
<p>Tries to inhibit the system.</p>
<p>Right now only</p>
<a class="ulink" href="http://www.freedesktop.org/wiki/Software/systemd/inhibit" target="_top">systemd</a><p>inhibitors are supported but other inhibitors can be added in the future.</p>
<div class="refsect3">
<a name="udisks-daemon-util-inhibit-system-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>reason</p></td>
<td class="parameter_description"><p>A human readable explanation of why the system is being inhibited.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-inhibit-system-sync.returns"></a><h4>Returns</h4>
<p> A cookie that can be used with <a class="link" href="udisks2-Utilities.html#udisks-daemon-util-uninhibit-system-sync" title="udisks_daemon_util_uninhibit_system_sync ()"><code class="function">udisks_daemon_util_uninhibit_system_sync()</code></a>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-uninhibit-system-sync"></a><h3>udisks_daemon_util_uninhibit_system_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
udisks_daemon_util_uninhibit_system_sync
                               (<em class="parameter"><code><a class="link" href="udisks2-Utilities.html#UDisksInhibitCookie" title="UDisksInhibitCookie"><span class="type">UDisksInhibitCookie</span></a> *cookie</code></em>);</pre>
<p>Does nothing if <em class="parameter"><code>cookie</code></em>
 is <code class="literal">NULL</code>, otherwise uninhibits.</p>
<div class="refsect3">
<a name="udisks-daemon-util-uninhibit-system-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>cookie</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code> or a cookie obtained from <a class="link" href="udisks2-Utilities.html#udisks-daemon-util-inhibit-system-sync" title="udisks_daemon_util_inhibit_system_sync ()"><code class="function">udisks_daemon_util_inhibit_system_sync()</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-hexdump"></a><h3>udisks_daemon_util_hexdump ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
udisks_daemon_util_hexdump (<em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                            <em class="parameter"><code><span class="type">gsize</span> len</code></em>);</pre>
<p>Utility function to generate a hexadecimal representation of <em class="parameter"><code>len</code></em>

bytes of <em class="parameter"><code>data</code></em>
.</p>
<div class="refsect3">
<a name="udisks-daemon-util-hexdump.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>Pointer to data.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>len</p></td>
<td class="parameter_description"><p>Length of data.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-hexdump.returns"></a><h4>Returns</h4>
<p> A multi-line string. Free with <code class="function">g_free()</code> when done using it.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-hexdump-debug"></a><h3>udisks_daemon_util_hexdump_debug ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
udisks_daemon_util_hexdump_debug (<em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                                  <em class="parameter"><code><span class="type">gsize</span> len</code></em>);</pre>
<p>Utility function to dumps the hexadecimal representation of <em class="parameter"><code>len</code></em>

bytes of <em class="parameter"><code>data</code></em>
 generated with <a class="link" href="udisks2-Utilities.html#udisks-daemon-util-hexdump" title="udisks_daemon_util_hexdump ()"><code class="function">udisks_daemon_util_hexdump()</code></a> using
<a class="link" href="udisks2-Logging.html#udisks-debug" title="udisks_debug()"><code class="function">udisks_debug()</code></a>.</p>
<div class="refsect3">
<a name="udisks-daemon-util-hexdump-debug.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>Pointer to data.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>len</p></td>
<td class="parameter_description"><p>Length of data.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-file-set-contents"></a><h3>udisks_daemon_util_file_set_contents ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_file_set_contents (<em class="parameter"><code>const <span class="type">gchar</span> *filename</code></em>,
                                      <em class="parameter"><code>const <span class="type">gchar</span> *contents</code></em>,
                                      <em class="parameter"><code><span class="type">gssize</span> contents_len</code></em>,
                                      <em class="parameter"><code><span class="type">gint</span> mode_for_new_file</code></em>,
                                      <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Like <code class="function">g_file_set_contents()</code> but preserves the mode of the file if it
already exists and sets it to <em class="parameter"><code>mode_for_new_file</code></em>
 otherwise.</p>
<div class="refsect3">
<a name="udisks-daemon-util-file-set-contents.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>filename</p></td>
<td class="parameter_description"><p>Name of a file to write <em class="parameter"><code>contents</code></em>
to, in the GLib file name encoding. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Override the parsed C type with given type."><span class="acronym">type</span></acronym> filename]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>contents</p></td>
<td class="parameter_description"><p>String to write to the file. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=length][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>contents_len</p></td>
<td class="parameter_description"><p>Length of <em class="parameter"><code>contents</code></em>
, or -1 if <em class="parameter"><code>contents</code></em>
is a NUL-terminated string.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mode_for_new_file</p></td>
<td class="parameter_description"><p>Mode for new file.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-file-set-contents.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> on success, <code class="literal">FALSE</code> if an error occurred</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-on-user-seat"></a><h3>udisks_daemon_util_on_user_seat ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_on_user_seat (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                 <em class="parameter"><code><a class="link" href="UDisksObject.html" title="UDisksObject"><span class="type">UDisksObject</span></a> *object</code></em>,
                                 <em class="parameter"><code><span class="type">uid_t</span> user</code></em>);</pre>
<p>Checks whether the device represented by <em class="parameter"><code>object</code></em>
 (if any) is plugged into
a seat where the caller represented by <em class="parameter"><code>user</code></em>
 is logged in and active.</p>
<p>This works if <em class="parameter"><code>object</code></em>
 is a drive or a block object.</p>
<div class="refsect3">
<a name="udisks-daemon-util-on-user-seat.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>object</p></td>
<td class="parameter_description"><p>The <span class="type">GDBusObject</span> that the call is on or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user</p></td>
<td class="parameter_description"><p>The user to check for.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-on-user-seat.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if <em class="parameter"><code>object</code></em>
is on the same seat as one of <em class="parameter"><code>user</code></em>
's
active sessions, <code class="literal">FALSE</code> otherwise.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-get-free-mdraid-device"></a><h3>udisks_daemon_util_get_free_mdraid_device ()</h3>
<pre class="programlisting"><span class="returnvalue">gchar</span> *
udisks_daemon_util_get_free_mdraid_device
                               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Gets a free MD RAID device.</p>
<div class="refsect3">
<a name="udisks-daemon-util-get-free-mdraid-device.returns"></a><h4>Returns</h4>
<p> A string of the form "/dev/mdNNN" that should be freed
with <code class="function">g_free()</code> or <code class="literal">NULL</code> if no free device is available.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-ata-identify-get-word"></a><h3>udisks_ata_identify_get_word ()</h3>
<pre class="programlisting"><span class="returnvalue">guint16</span>
udisks_ata_identify_get_word (<em class="parameter"><code>const <span class="type">guchar</span> *identify_data</code></em>,
                              <em class="parameter"><code><span class="type">guint</span> word_number</code></em>);</pre>
<p>Gets a <span class="quote">“<span class="quote">word</span>”</span> from position <em class="parameter"><code>word_number</code></em>
 from
<em class="parameter"><code>identify_data</code></em>
.</p>
<div class="refsect3">
<a name="udisks-ata-identify-get-word.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>identify_data</p></td>
<td class="parameter_description"><p>A 512-byte array containing ATA IDENTIFY or ATA IDENTIFY PACKET DEVICE data or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>word_number</p></td>
<td class="parameter_description"><p>The word number to get - must be less than 256.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-ata-identify-get-word.returns"></a><h4>Returns</h4>
<p> The word at the specified position or 0 if <em class="parameter"><code>identify_data</code></em>
is <code class="literal">NULL</code>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-trigger-uevent"></a><h3>udisks_daemon_util_trigger_uevent ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
udisks_daemon_util_trigger_uevent (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                   <em class="parameter"><code>const <span class="type">gchar</span> *device_file</code></em>,
                                   <em class="parameter"><code>const <span class="type">gchar</span> *sysfs_path</code></em>);</pre>
<p>Triggers a 'change' uevent in the kernel.</p>
<p>The <em class="parameter"><code>sysfs_path</code></em>
 takes precedence if non-NULL over a <em class="parameter"><code>device_file</code></em>
.
In case of using <em class="parameter"><code>device_file</code></em>
 any symlinks are resolved, this expects
the block device has been processed by udev already.</p>
<p>The triggered event will bubble up from the kernel through the udev
stack and will eventually be received by the udisks daemon process
itself. This method does not wait for the event to be received.</p>
<div class="refsect3">
<a name="udisks-daemon-util-trigger-uevent.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>device_file</p></td>
<td class="parameter_description"><p>Block device file (/dev/xxx) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sysfs_path</p></td>
<td class="parameter_description"><p>Device path in /sys or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-daemon-util-trigger-uevent-sync"></a><h3>udisks_daemon_util_trigger_uevent_sync ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_daemon_util_trigger_uevent_sync
                               (<em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *device_file</code></em>,
                                <em class="parameter"><code>const <span class="type">gchar</span> *sysfs_path</code></em>,
                                <em class="parameter"><code><span class="type">guint</span> timeout_seconds</code></em>);</pre>
<p>Triggers a 'change' uevent in the kernel and waits until it's received and
processed by udisks.</p>
<p>The <em class="parameter"><code>sysfs_path</code></em>
 takes precedence if non-NULL over a <em class="parameter"><code>device_file</code></em>
.
In case of using <em class="parameter"><code>device_file</code></em>
 any symlinks are resolved, this expects
the block device has been processed by udev already.</p>
<p>Unlike <a class="link" href="udisks2-Utilities.html#udisks-daemon-util-trigger-uevent" title="udisks_daemon_util_trigger_uevent ()"><code class="function">udisks_daemon_util_trigger_uevent()</code></a> that just triggers
a synthetic uevent to the kernel, this call will actually block and wait until
the <a class="link" href="UDisksLinuxProvider.html" title="UDisksLinuxProvider"><span class="type">UDisksLinuxProvider</span></a> receives the uevent, performs probing and processes
the uevent further down the UDisks object stack. Upon returning from this
function call the caller may assume the event has been fully processed, all
D-Bus objects are updated and settled. Typically used in busy wait for
a particular D-Bus interface.</p>
<p>Note that this uses synthetic uevent tagging and only works on linux kernel
4.13 and higher. In case an older kernel is detected this acts like the classic
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-trigger-uevent" title="udisks_daemon_util_trigger_uevent ()"><code class="function">udisks_daemon_util_trigger_uevent()</code></a> call and <code class="literal">FALSE</code> is returned.</p>
<div class="refsect3">
<a name="udisks-daemon-util-trigger-uevent-sync.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>device_file</p></td>
<td class="parameter_description"><p>Block device file (/dev/xxx) or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sysfs_path</p></td>
<td class="parameter_description"><p>Device path in /sys or <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>timeout_seconds</p></td>
<td class="parameter_description"><p>Maximum time to wait for the uevent (in seconds).</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-daemon-util-trigger-uevent-sync.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the uevent has been successfully received, <code class="literal">FALSE</code> otherwise
or when the kernel version is too old.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-module-validate-name"></a><h3>udisks_module_validate_name ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
udisks_module_validate_name (<em class="parameter"><code>const <span class="type">gchar</span> *module_name</code></em>);</pre>
<p>Checks the string for a valid udisks2 module name. Only alphanumeric characters
along with the '-' and '_' separators are permitted.</p>
<div class="refsect3">
<a name="udisks-module-validate-name.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>module_name</p></td>
<td class="parameter_description"><p>A udisks2 module name.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-module-validate-name.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the string is a valid udisks2 module name, <code class="literal">FALSE</code> otherwise.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="udisks2-Utilities.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="UDisksInhibitCookie"></a><h3>UDisksInhibitCookie</h3>
<pre class="programlisting">typedef struct UDisksInhibitCookie UDisksInhibitCookie;
</pre>
<p>Opaque data structure used in <a class="link" href="udisks2-Utilities.html#udisks-daemon-util-inhibit-system-sync" title="udisks_daemon_util_inhibit_system_sync ()"><code class="function">udisks_daemon_util_inhibit_system_sync()</code></a> and
<a class="link" href="udisks2-Utilities.html#udisks-daemon-util-uninhibit-system-sync" title="udisks_daemon_util_uninhibit_system_sync ()"><code class="function">udisks_daemon_util_uninhibit_system_sync()</code></a>.</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.35.1</div>
</body>
</html>