1 /* SPDX-License-Identifier: LGPL-2.1+ */
6 #include "device-private.h"
18 OrderedHashmap
*properties
;
19 Iterator properties_iterator
;
20 uint64_t properties_generation
; /* changes whenever the properties are changed */
21 uint64_t properties_iterator_generation
; /* generation when iteration was started */
23 /* the subset of the properties that should be written to the db */
24 OrderedHashmap
*properties_db
;
26 Hashmap
*sysattr_values
; /* cached sysattr values */
28 Set
*sysattrs
; /* names of sysattrs */
29 Iterator sysattrs_iterator
;
32 Iterator tags_iterator
;
33 uint64_t tags_generation
; /* changes whenever the tags are changed */
34 uint64_t tags_iterator_generation
; /* generation when iteration was started */
37 Iterator devlinks_iterator
;
38 uint64_t devlinks_generation
; /* changes whenever the devlinks are changed */
39 uint64_t devlinks_iterator_generation
; /* generation when iteration was started */
47 char **properties_strv
; /* the properties hashmap as a strv */
48 uint8_t *properties_nulstr
; /* the same as a nulstr */
49 size_t properties_nulstr_len
;
57 char *driver_subsystem
; /* only set for the 'drivers' subsystem */
62 uint64_t usec_initialized
;
68 /* only set when device is passed through netlink */
72 bool parent_set
:1; /* no need to try to reload parent */
73 bool sysattrs_read
:1; /* don't try to re-read sysattrs once read */
74 bool property_tags_outdated
:1; /* need to update TAGS= property */
75 bool property_devlinks_outdated
:1; /* need to update DEVLINKS= property */
76 bool properties_buf_outdated
:1; /* need to reread hashmap */
77 bool sysname_set
:1; /* don't reread sysname */
78 bool subsystem_set
:1; /* don't reread subsystem */
79 bool driver_subsystem_set
:1; /* don't reread subsystem */
80 bool driver_set
:1; /* don't reread driver */
81 bool uevent_loaded
:1; /* don't reread uevent */
82 bool db_loaded
; /* don't reread db */
84 bool is_initialized
:1;
85 bool sealed
:1; /* don't read more information from uevent/db */
86 bool db_persist
:1; /* don't clean up the db when switching from initrd to real root */
89 int device_new_aux(sd_device
**ret
);
90 int device_add_property_aux(sd_device
*device
, const char *key
, const char *value
, bool db
);
91 int device_add_property_internal(sd_device
*device
, const char *key
, const char *value
);
92 int device_read_uevent_file(sd_device
*device
);
94 int device_set_syspath(sd_device
*device
, const char *_syspath
, bool verify
);
95 int device_set_ifindex(sd_device
*device
, const char *ifindex
);
96 int device_set_devmode(sd_device
*device
, const char *devmode
);
97 int device_set_devname(sd_device
*device
, const char *_devname
);
98 int device_set_devtype(sd_device
*device
, const char *_devtype
);
99 int device_set_devnum(sd_device
*device
, const char *major
, const char *minor
);
100 int device_set_subsystem(sd_device
*device
, const char *_subsystem
);
101 int device_set_driver(sd_device
*device
, const char *_driver
);
102 int device_set_usec_initialized(sd_device
*device
, usec_t when
);