Skip to main content

libscf_sys/
stubs.rs

1/*
2 * Copyright 2024 Oxide Computer Company
3 */
4
5/*
6 * The Service Management Facility (SMF) is available on illumos systems.  This
7 * module contains unimplemented stubs for libscf routines to ease the process
8 * of building higher-level crates on other platforms while using tools like
9 * rust-analyzer.  If a true testing mock for SMF is wanted, that should not
10 * happen at this level.
11 */
12
13#[cfg(not(target_os = "illumos"))]
14mod stubs {
15    #![allow(
16        unused_variables,
17        clippy::missing_safety_doc,
18        clippy::module_inception
19    )]
20
21    use crate::*;
22    use libc::{c_void, size_t, ssize_t};
23
24    pub unsafe fn scf_handle_create(
25        version: scf_version_t,
26    ) -> *mut scf_handle_t {
27        unimplemented!()
28    }
29    pub unsafe fn scf_handle_destroy(handle: *mut scf_handle_t) {
30        unimplemented!()
31    }
32    pub unsafe fn scf_handle_bind(handle: *mut scf_handle_t) -> c_int {
33        unimplemented!()
34    }
35    pub unsafe fn scf_handle_unbind(handle: *mut scf_handle_t) -> c_int {
36        unimplemented!()
37    }
38
39    pub unsafe fn scf_handle_decorate(
40        handle: *mut scf_handle_t,
41        param: *const c_char,
42        value: *mut scf_value_t,
43    ) -> c_int {
44        unimplemented!()
45    }
46
47    pub unsafe fn scf_myname(
48        handle: *mut scf_handle_t,
49        out: *mut c_char,
50        sz: size_t,
51    ) -> ssize_t {
52        unimplemented!()
53    }
54
55    pub unsafe fn scf_error() -> u32 {
56        unimplemented!()
57    }
58    pub unsafe fn scf_strerror(error: scf_error_t) -> *const c_char {
59        unimplemented!()
60    }
61
62    pub unsafe fn scf_limit(name: u32) -> ssize_t {
63        unimplemented!()
64    }
65
66    pub unsafe fn scf_iter_create(
67        handle: *mut scf_handle_t,
68    ) -> *mut scf_iter_t {
69        unimplemented!()
70    }
71    pub unsafe fn scf_iter_destroy(iter: *mut scf_iter_t) {
72        unimplemented!()
73    }
74    pub unsafe fn scf_iter_reset(iter: *mut scf_iter_t) {
75        unimplemented!()
76    }
77
78    pub unsafe fn scf_scope_create(
79        handle: *mut scf_handle_t,
80    ) -> *mut scf_scope_t {
81        unimplemented!()
82    }
83    pub unsafe fn scf_scope_destroy(scope: *mut scf_scope_t) {
84        unimplemented!()
85    }
86    pub unsafe fn scf_scope_get_name(
87        scope: *const scf_scope_t,
88        buf: *mut c_char,
89        size: size_t,
90    ) -> ssize_t {
91        unimplemented!()
92    }
93    pub unsafe fn scf_handle_get_scope(
94        handle: *mut scf_handle_t,
95        name: *const c_char,
96        out: *mut scf_scope_t,
97    ) -> c_int {
98        unimplemented!()
99    }
100
101    pub unsafe fn scf_scope_get_service(
102        scope: *const scf_scope_t,
103        name: *const c_char,
104        out: *mut scf_service_t,
105    ) -> c_int {
106        unimplemented!()
107    }
108    pub unsafe fn scf_scope_add_service(
109        scope: *mut scf_scope_t,
110        name: *const c_char,
111        out: *mut scf_service_t,
112    ) -> c_int {
113        unimplemented!()
114    }
115
116    pub unsafe fn scf_iter_handle_scopes(
117        iter: *mut scf_iter_t,
118        handle: *const scf_handle_t,
119    ) -> c_int {
120        unimplemented!()
121    }
122    pub unsafe fn scf_iter_next_scope(
123        iter: *mut scf_iter_t,
124        out: *mut scf_scope_t,
125    ) -> c_int {
126        unimplemented!()
127    }
128
129    pub unsafe fn scf_service_create(
130        handle: *mut scf_handle_t,
131    ) -> *mut scf_service_t {
132        unimplemented!()
133    }
134    pub unsafe fn scf_service_destroy(service: *mut scf_service_t) {
135        unimplemented!()
136    }
137    pub unsafe fn scf_service_delete(service: *mut scf_service_t) -> c_int {
138        unimplemented!()
139    }
140
141    pub unsafe fn scf_service_get_name(
142        service: *const scf_service_t,
143        buf: *mut c_char,
144        size: size_t,
145    ) -> ssize_t {
146        unimplemented!()
147    }
148    pub unsafe fn scf_service_get_instance(
149        service: *const scf_service_t,
150        name: *const c_char,
151        out: *mut scf_instance_t,
152    ) -> c_int {
153        unimplemented!()
154    }
155    pub unsafe fn scf_service_add_instance(
156        service: *mut scf_service_t,
157        name: *const c_char,
158        out: *mut scf_instance_t,
159    ) -> c_int {
160        unimplemented!()
161    }
162
163    pub unsafe fn scf_iter_scope_services(
164        iter: *mut scf_iter_t,
165        scope: *const scf_scope_t,
166    ) -> c_int {
167        unimplemented!()
168    }
169    pub unsafe fn scf_iter_next_service(
170        iter: *mut scf_iter_t,
171        out: *mut scf_service_t,
172    ) -> c_int {
173        unimplemented!()
174    }
175
176    pub unsafe fn scf_instance_create(
177        handle: *mut scf_handle_t,
178    ) -> *mut scf_instance_t {
179        unimplemented!()
180    }
181    pub unsafe fn scf_instance_destroy(instance: *mut scf_instance_t) {
182        unimplemented!()
183    }
184    pub unsafe fn scf_instance_delete(instance: *mut scf_instance_t) -> c_int {
185        unimplemented!()
186    }
187
188    pub unsafe fn scf_instance_get_name(
189        instance: *const scf_instance_t,
190        buf: *mut c_char,
191        size: size_t,
192    ) -> ssize_t {
193        unimplemented!()
194    }
195    pub unsafe fn scf_instance_get_pg(
196        instance: *const scf_instance_t,
197        name: *const c_char,
198        out: *mut scf_propertygroup_t,
199    ) -> c_int {
200        unimplemented!()
201    }
202    pub unsafe fn scf_instance_add_pg(
203        instance: *mut scf_instance_t,
204        name: *const c_char,
205        pgtype: *const c_char,
206        flags: u32,
207        out: *mut scf_propertygroup_t,
208    ) -> c_int {
209        unimplemented!()
210    }
211    pub unsafe fn scf_instance_get_pg_composed(
212        instance: *const scf_instance_t,
213        snapshot: *const scf_snapshot_t,
214        name: *const c_char,
215        out: *mut scf_propertygroup_t,
216    ) -> c_int {
217        unimplemented!()
218    }
219    pub unsafe fn scf_instance_get_snapshot(
220        instance: *const scf_instance_t,
221        name: *const c_char,
222        out: *mut scf_snapshot_t,
223    ) -> c_int {
224        unimplemented!()
225    }
226    pub unsafe fn scf_instance_to_fmri(
227        instance: *const scf_instance_t,
228        buf: *mut c_char,
229        size: size_t,
230    ) -> ssize_t {
231        unimplemented!()
232    }
233
234    pub unsafe fn scf_iter_service_instances(
235        iter: *mut scf_iter_t,
236        service: *const scf_service_t,
237    ) -> c_int {
238        unimplemented!()
239    }
240    pub unsafe fn scf_iter_next_instance(
241        iter: *mut scf_iter_t,
242        out: *mut scf_instance_t,
243    ) -> c_int {
244        unimplemented!()
245    }
246
247    pub unsafe fn scf_snapshot_create(
248        handle: *mut scf_handle_t,
249    ) -> *mut scf_snapshot_t {
250        unimplemented!()
251    }
252    pub unsafe fn scf_snapshot_destroy(snapshot: *mut scf_snapshot_t) {
253        unimplemented!()
254    }
255
256    pub unsafe fn scf_snapshot_get_name(
257        snapshot: *const scf_snapshot_t,
258        buf: *mut c_char,
259        size: size_t,
260    ) -> ssize_t {
261        unimplemented!()
262    }
263    pub unsafe fn scf_snapshot_get_parent(
264        snapshot: *const scf_snapshot_t,
265        inst: *mut scf_instance_t,
266    ) -> c_int {
267        unimplemented!()
268    }
269
270    pub unsafe fn scf_iter_instance_snapshots(
271        iter: *mut scf_iter_t,
272        instance: *const scf_instance_t,
273    ) -> c_int {
274        unimplemented!()
275    }
276    pub unsafe fn scf_iter_next_snapshot(
277        iter: *mut scf_iter_t,
278        out: *mut scf_snapshot_t,
279    ) -> c_int {
280        unimplemented!()
281    }
282
283    pub unsafe fn scf_iter_instance_pgs(
284        iter: *mut scf_iter_t,
285        instance: *const scf_instance_t,
286    ) -> c_int {
287        unimplemented!()
288    }
289    pub unsafe fn scf_iter_instance_pgs_composed(
290        iter: *mut scf_iter_t,
291        instance: *const scf_instance_t,
292        snapshot: *const scf_snapshot_t,
293    ) -> c_int {
294        unimplemented!()
295    }
296    pub unsafe fn scf_iter_service_pgs(
297        iter: *mut scf_iter_t,
298        service: *const scf_service_t,
299    ) -> c_int {
300        unimplemented!()
301    }
302    pub unsafe fn scf_iter_next_pg(
303        iter: *mut scf_iter_t,
304        out: *mut scf_propertygroup_t,
305    ) -> c_int {
306        unimplemented!()
307    }
308
309    pub unsafe fn scf_pg_create(
310        handle: *mut scf_handle_t,
311    ) -> *mut scf_propertygroup_t {
312        unimplemented!()
313    }
314    pub unsafe fn scf_pg_destroy(pg: *mut scf_propertygroup_t) {
315        unimplemented!()
316    }
317    pub unsafe fn scf_pg_delete(pg: *mut scf_propertygroup_t) -> c_int {
318        unimplemented!()
319    }
320
321    pub unsafe fn scf_pg_get_name(
322        pg: *const scf_propertygroup_t,
323        buf: *mut c_char,
324        size: size_t,
325    ) -> ssize_t {
326        unimplemented!()
327    }
328    pub unsafe fn scf_pg_get_type(
329        pg: *const scf_propertygroup_t,
330        buf: *mut c_char,
331        size: size_t,
332    ) -> ssize_t {
333        unimplemented!()
334    }
335    pub unsafe fn scf_pg_get_flags(
336        pg: *const scf_propertygroup_t,
337        out: *mut u32,
338    ) -> c_int {
339        unimplemented!()
340    }
341    pub unsafe fn scf_pg_update(pg: *mut scf_propertygroup_t) -> c_int {
342        unimplemented!()
343    }
344    pub unsafe fn scf_pg_get_property(
345        pg: *const scf_propertygroup_t,
346        name: *const c_char,
347        out: *mut scf_property_t,
348    ) -> c_int {
349        unimplemented!()
350    }
351
352    pub unsafe fn scf_iter_pg_properties(
353        iter: *mut scf_iter_t,
354        pg: *const scf_propertygroup_t,
355    ) -> c_int {
356        unimplemented!()
357    }
358    pub unsafe fn scf_iter_next_property(
359        iter: *mut scf_iter_t,
360        out: *mut scf_property_t,
361    ) -> c_int {
362        unimplemented!()
363    }
364
365    pub unsafe fn scf_property_create(
366        handle: *mut scf_handle_t,
367    ) -> *mut scf_property_t {
368        unimplemented!()
369    }
370    pub unsafe fn scf_property_destroy(prop: *mut scf_property_t) {
371        unimplemented!()
372    }
373
374    pub unsafe fn scf_property_get_name(
375        prop: *const scf_property_t,
376        buf: *mut c_char,
377        size: size_t,
378    ) -> ssize_t {
379        unimplemented!()
380    }
381    pub unsafe fn scf_property_type(
382        prop: *const scf_property_t,
383        typ: *mut scf_type_t,
384    ) -> ssize_t {
385        unimplemented!()
386    }
387
388    pub unsafe fn scf_iter_property_values(
389        iter: *mut scf_iter_t,
390        prop: *const scf_property_t,
391    ) -> c_int {
392        unimplemented!()
393    }
394    pub unsafe fn scf_iter_next_value(
395        iter: *mut scf_iter_t,
396        out: *mut scf_value_t,
397    ) -> c_int {
398        unimplemented!()
399    }
400
401    pub unsafe fn scf_value_create(
402        handle: *mut scf_handle_t,
403    ) -> *mut scf_value_t {
404        unimplemented!()
405    }
406    pub unsafe fn scf_value_destroy(val: *mut scf_value_t) {
407        unimplemented!()
408    }
409    pub unsafe fn scf_value_reset(val: *mut scf_value_t) {
410        unimplemented!()
411    }
412
413    pub unsafe fn scf_value_type(val: *const scf_value_t) -> c_int {
414        unimplemented!()
415    }
416    pub unsafe fn scf_value_base_type(val: *const scf_value_t) -> c_int {
417        unimplemented!()
418    }
419
420    pub unsafe fn scf_value_get_as_string(
421        val: *const scf_value_t,
422        buf: *mut c_char,
423        size: size_t,
424    ) -> ssize_t {
425        unimplemented!()
426    }
427    pub unsafe fn scf_value_get_as_string_typed(
428        val: *const scf_value_t,
429        type_: scf_type_t,
430        buf: *mut c_char,
431        size: size_t,
432    ) -> ssize_t {
433        unimplemented!()
434    }
435    pub unsafe fn scf_value_set_from_string(
436        val: *mut scf_value_t,
437        valtype: scf_type_t,
438        valstr: *const c_char,
439    ) -> c_int {
440        unimplemented!()
441    }
442
443    pub unsafe fn scf_value_get_boolean(
444        val: *const scf_value_t,
445        out: *mut u8,
446    ) -> c_int {
447        unimplemented!()
448    }
449    pub unsafe fn scf_value_get_count(
450        val: *const scf_value_t,
451        out: *mut u64,
452    ) -> c_int {
453        unimplemented!()
454    }
455    pub unsafe fn scf_value_get_integer(
456        val: *const scf_value_t,
457        out: *mut i64,
458    ) -> c_int {
459        unimplemented!()
460    }
461    pub unsafe fn scf_value_get_time(
462        val: *const scf_value_t,
463        seconds: *mut i64,
464        ns: *mut i32,
465    ) -> c_int {
466        unimplemented!()
467    }
468    pub unsafe fn scf_value_get_astring(
469        val: *const scf_value_t,
470        buf: *mut c_char,
471        size: size_t,
472    ) -> ssize_t {
473        unimplemented!()
474    }
475    pub unsafe fn scf_value_get_ustring(
476        val: *const scf_value_t,
477        buf: *mut c_char,
478        size: size_t,
479    ) -> ssize_t {
480        unimplemented!()
481    }
482    pub unsafe fn scf_value_get_opaque(
483        val: *const scf_value_t,
484        buf: *mut c_void,
485        size: size_t,
486    ) -> ssize_t {
487        unimplemented!()
488    }
489
490    pub unsafe fn scf_value_set_boolean(val: *mut scf_value_t, new: u8) {
491        unimplemented!()
492    }
493    pub unsafe fn scf_value_set_count(val: *mut scf_value_t, new: u64) {
494        unimplemented!()
495    }
496    pub unsafe fn scf_value_set_integer(val: *mut scf_value_t, new: i64) {
497        unimplemented!()
498    }
499    pub unsafe fn scf_value_set_time(
500        val: *mut scf_value_t,
501        seconds: i64,
502        ns: i32,
503    ) -> c_int {
504        unimplemented!()
505    }
506    pub unsafe fn scf_value_set_astring(
507        val: *mut scf_value_t,
508        new: *const c_char,
509    ) -> c_int {
510        unimplemented!()
511    }
512    pub unsafe fn scf_value_set_ustring(
513        val: *mut scf_value_t,
514        new: *const c_char,
515    ) -> c_int {
516        unimplemented!()
517    }
518    pub unsafe fn scf_value_set_opaque(
519        val: *mut scf_value_t,
520        new: *const c_void,
521        size: size_t,
522    ) -> c_int {
523        unimplemented!()
524    }
525
526    pub unsafe fn scf_type_base_type(
527        typ: scf_type_t,
528        out: *mut scf_type_t,
529    ) -> c_int {
530        unimplemented!()
531    }
532
533    pub unsafe fn scf_transaction_create(
534        handle: *mut scf_handle_t,
535    ) -> *mut scf_transaction_t {
536        unimplemented!()
537    }
538    pub unsafe fn scf_transaction_destroy(tran: *mut scf_transaction_t) {
539        unimplemented!()
540    }
541    pub unsafe fn scf_transaction_reset(tran: *mut scf_transaction_t) {
542        unimplemented!()
543    }
544    pub unsafe fn scf_transaction_reset_all(tran: *mut scf_transaction_t) {
545        unimplemented!()
546    }
547
548    pub unsafe fn scf_transaction_start(
549        tran: *mut scf_transaction_t,
550        pg: *mut scf_propertygroup_t,
551    ) -> c_int {
552        unimplemented!()
553    }
554    pub unsafe fn scf_transaction_commit(
555        tran: *mut scf_transaction_t,
556    ) -> c_int {
557        unimplemented!()
558    }
559
560    pub unsafe fn scf_transaction_property_delete(
561        tran: *mut scf_transaction_t,
562        entry: *mut scf_transaction_entry_t,
563        name: *const c_char,
564    ) -> c_int {
565        unimplemented!()
566    }
567    pub unsafe fn scf_transaction_property_new(
568        tran: *mut scf_transaction_t,
569        entry: *mut scf_transaction_entry_t,
570        name: *const c_char,
571        proptype: scf_type_t,
572    ) -> c_int {
573        unimplemented!()
574    }
575    pub unsafe fn scf_transaction_property_change(
576        tran: *mut scf_transaction_t,
577        entry: *mut scf_transaction_entry_t,
578        name: *const c_char,
579        proptype: scf_type_t,
580    ) -> c_int {
581        unimplemented!()
582    }
583    pub unsafe fn scf_transaction_property_change_type(
584        tran: *mut scf_transaction_t,
585        entry: *mut scf_transaction_entry_t,
586        name: *const c_char,
587        proptype: scf_type_t,
588    ) -> c_int {
589        unimplemented!()
590    }
591
592    pub unsafe fn scf_entry_create(
593        handle: *mut scf_handle_t,
594    ) -> *mut scf_transaction_entry_t {
595        unimplemented!()
596    }
597    pub unsafe fn scf_entry_destroy(tran: *mut scf_transaction_entry_t) {
598        unimplemented!()
599    }
600    pub unsafe fn scf_entry_destroy_children(
601        tran: *mut scf_transaction_entry_t,
602    ) {
603        unimplemented!()
604    }
605    pub unsafe fn scf_entry_reset(tran: *mut scf_transaction_entry_t) {
606        unimplemented!()
607    }
608
609    pub unsafe fn scf_entry_add_value(
610        tran: *mut scf_transaction_entry_t,
611        value: *mut scf_value_t,
612    ) -> c_int {
613        unimplemented!()
614    }
615
616    pub unsafe fn smf_disable_instance(
617        instance: *const c_char,
618        flags: c_int,
619    ) -> c_int {
620        unimplemented!()
621    }
622    pub unsafe fn smf_enable_instance(
623        instance: *const c_char,
624        flags: c_int,
625    ) -> c_int {
626        unimplemented!()
627    }
628    pub unsafe fn smf_refresh_instance(instance: *const c_char) -> c_int {
629        unimplemented!()
630    }
631
632    #[allow(clippy::too_many_arguments)]
633    pub unsafe fn scf_handle_decode_fmri(
634        handle: *mut scf_handle_t,
635        fmri: *const c_char,
636        out_scope: *mut scf_scope_t,
637        out_service: *mut scf_service_t,
638        out_instance: *mut scf_instance_t,
639        out_pg: *mut scf_propertygroup_t,
640        out_prop: *mut scf_property_t,
641        flags: c_int,
642    ) -> c_int {
643        unimplemented!()
644    }
645}
646
647pub use stubs::*;