tree-wide: replace 'unsigned int' with 'unsigned'
This commit is contained in:
parent
347a19343c
commit
14cb109d45
|
@ -808,9 +808,9 @@ static int analyze_plot(int argc, char *argv[], void *userdata) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int list_dependencies_print(const char *name, unsigned int level, unsigned int branches,
|
static int list_dependencies_print(const char *name, unsigned level, unsigned branches,
|
||||||
bool last, struct unit_times *times, struct boot_times *boot) {
|
bool last, struct unit_times *times, struct boot_times *boot) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
char ts[FORMAT_TIMESPAN_MAX], ts2[FORMAT_TIMESPAN_MAX];
|
char ts[FORMAT_TIMESPAN_MAX], ts2[FORMAT_TIMESPAN_MAX];
|
||||||
|
|
||||||
for (i = level; i != 0; i--)
|
for (i = level; i != 0; i--)
|
||||||
|
@ -869,8 +869,8 @@ static bool times_in_range(const struct unit_times *times, const struct boot_tim
|
||||||
times->activated > 0 && times->activated <= boot->finish_time;
|
times->activated > 0 && times->activated <= boot->finish_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int list_dependencies_one(sd_bus *bus, const char *name, unsigned int level, char ***units,
|
static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level, char ***units,
|
||||||
unsigned int branches) {
|
unsigned branches) {
|
||||||
_cleanup_strv_free_ char **deps = NULL;
|
_cleanup_strv_free_ char **deps = NULL;
|
||||||
char **c;
|
char **c;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
|
@ -150,7 +150,7 @@ void barrier_destroy(Barrier *b) {
|
||||||
* Note that barriers could be supported without fork() or clone(). However,
|
* Note that barriers could be supported without fork() or clone(). However,
|
||||||
* this is currently not needed so it hasn't been implemented.
|
* this is currently not needed so it hasn't been implemented.
|
||||||
*/
|
*/
|
||||||
void barrier_set_role(Barrier *b, unsigned int role) {
|
void barrier_set_role(Barrier *b, unsigned role) {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
assert(b);
|
assert(b);
|
||||||
|
|
|
@ -41,7 +41,7 @@ void barrier_destroy(Barrier *b);
|
||||||
|
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Barrier*, barrier_destroy);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(Barrier*, barrier_destroy);
|
||||||
|
|
||||||
void barrier_set_role(Barrier *b, unsigned int role);
|
void barrier_set_role(Barrier *b, unsigned role);
|
||||||
|
|
||||||
bool barrier_place(Barrier *b);
|
bool barrier_place(Barrier *b);
|
||||||
bool barrier_abort(Barrier *b);
|
bool barrier_abort(Barrier *b);
|
||||||
|
|
|
@ -43,7 +43,7 @@ static ssize_t try_copy_file_range(
|
||||||
int fd_in, loff_t *off_in,
|
int fd_in, loff_t *off_in,
|
||||||
int fd_out, loff_t *off_out,
|
int fd_out, loff_t *off_out,
|
||||||
size_t len,
|
size_t len,
|
||||||
unsigned int flags) {
|
unsigned flags) {
|
||||||
|
|
||||||
static int have = -1;
|
static int have = -1;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
|
|
|
@ -335,7 +335,7 @@ static inline int __coverity_check__(int condition) {
|
||||||
|
|
||||||
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
|
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
|
||||||
#define INT_TO_PTR(u) ((void *) ((intptr_t) (u)))
|
#define INT_TO_PTR(u) ((void *) ((intptr_t) (u)))
|
||||||
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
|
#define PTR_TO_UINT(p) ((unsigned) ((uintptr_t) (p)))
|
||||||
#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u)))
|
#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u)))
|
||||||
|
|
||||||
#define PTR_TO_LONG(p) ((long) ((intptr_t) (p)))
|
#define PTR_TO_LONG(p) ((long) ((intptr_t) (p)))
|
||||||
|
|
|
@ -95,7 +95,7 @@ int kmod_setup(void) {
|
||||||
{ "virtio_rng", NULL, false, false, has_virtio_rng },
|
{ "virtio_rng", NULL, false, false, has_virtio_rng },
|
||||||
};
|
};
|
||||||
_cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
|
_cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (have_effective_cap(CAP_SYS_MODULE) == 0)
|
if (have_effective_cap(CAP_SYS_MODULE) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct sd_dhcp_client {
|
||||||
uint32_t mtu;
|
uint32_t mtu;
|
||||||
uint32_t xid;
|
uint32_t xid;
|
||||||
usec_t start_time;
|
usec_t start_time;
|
||||||
unsigned int attempt;
|
unsigned attempt;
|
||||||
usec_t request_sent;
|
usec_t request_sent;
|
||||||
sd_event_source *timeout_t1;
|
sd_event_source *timeout_t1;
|
||||||
sd_event_source *timeout_t2;
|
sd_event_source *timeout_t2;
|
||||||
|
|
|
@ -293,7 +293,7 @@ static void test_ra(void) {
|
||||||
sd_event *e;
|
sd_event *e;
|
||||||
sd_radv *ra;
|
sd_radv *ra;
|
||||||
usec_t time_now = now(clock_boottime_or_monotonic());
|
usec_t time_now = now(clock_boottime_or_monotonic());
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
printf("* %s\n", __FUNCTION__);
|
printf("* %s\n", __FUNCTION__);
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ static int add_subtree_to_set(
|
||||||
sd_bus *bus,
|
sd_bus *bus,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct node *n,
|
struct node *n,
|
||||||
unsigned int flags,
|
unsigned flags,
|
||||||
Set *s,
|
Set *s,
|
||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ static int get_child_nodes(
|
||||||
sd_bus *bus,
|
sd_bus *bus,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
struct node *n,
|
struct node *n,
|
||||||
unsigned int flags,
|
unsigned flags,
|
||||||
Set **_s,
|
Set **_s,
|
||||||
sd_bus_error *error) {
|
sd_bus_error *error) {
|
||||||
|
|
||||||
|
|
|
@ -752,7 +752,7 @@ static int netlink_container_parse(sd_netlink_message *m,
|
||||||
struct netlink_container *container,
|
struct netlink_container *container,
|
||||||
int count,
|
int count,
|
||||||
struct rtattr *rta,
|
struct rtattr *rta,
|
||||||
unsigned int rt_len) {
|
unsigned rt_len) {
|
||||||
_cleanup_free_ struct netlink_attribute *attributes = NULL;
|
_cleanup_free_ struct netlink_attribute *attributes = NULL;
|
||||||
|
|
||||||
attributes = new0(struct netlink_attribute, count);
|
attributes = new0(struct netlink_attribute, count);
|
||||||
|
|
|
@ -100,7 +100,7 @@ DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(struct udev_hwdb, udev_hwdb, udev_hwdb_free
|
||||||
*
|
*
|
||||||
* Returns: a udev_list_entry.
|
* Returns: a udev_list_entry.
|
||||||
*/
|
*/
|
||||||
_public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) {
|
_public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned flags) {
|
||||||
const char *key, *value;
|
const char *key, *value;
|
||||||
struct udev_list_entry *e;
|
struct udev_list_entry *e;
|
||||||
|
|
||||||
|
|
|
@ -100,12 +100,12 @@ static void udev_list_entry_insert_before(struct udev_list_entry *new, struct ud
|
||||||
/* binary search in sorted array */
|
/* binary search in sorted array */
|
||||||
static int list_search(struct udev_list *list, const char *name)
|
static int list_search(struct udev_list *list, const char *name)
|
||||||
{
|
{
|
||||||
unsigned int first, last;
|
unsigned first, last;
|
||||||
|
|
||||||
first = 0;
|
first = 0;
|
||||||
last = list->entries_cur;
|
last = list->entries_cur;
|
||||||
while (first < last) {
|
while (first < last) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
i = (first + last)/2;
|
i = (first + last)/2;
|
||||||
|
@ -165,7 +165,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
|
||||||
/* allocate or enlarge sorted array if needed */
|
/* allocate or enlarge sorted array if needed */
|
||||||
if (list->entries_cur >= list->entries_max) {
|
if (list->entries_cur >= list->entries_max) {
|
||||||
struct udev_list_entry **entries;
|
struct udev_list_entry **entries;
|
||||||
unsigned int add;
|
unsigned add;
|
||||||
|
|
||||||
add = list->entries_max;
|
add = list->entries_max;
|
||||||
if (add < 1)
|
if (add < 1)
|
||||||
|
@ -184,7 +184,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
|
||||||
i = (-i)-1;
|
i = (-i)-1;
|
||||||
|
|
||||||
/* insert into sorted list */
|
/* insert into sorted list */
|
||||||
if ((unsigned int)i < list->entries_cur)
|
if ((unsigned)i < list->entries_cur)
|
||||||
udev_list_entry_insert_before(entry, list->entries[i]);
|
udev_list_entry_insert_before(entry, list->entries[i]);
|
||||||
else
|
else
|
||||||
udev_list_entry_append(entry, list);
|
udev_list_entry_append(entry, list);
|
||||||
|
|
|
@ -66,8 +66,8 @@ struct udev_list {
|
||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
struct udev_list_node node;
|
struct udev_list_node node;
|
||||||
struct udev_list_entry **entries;
|
struct udev_list_entry **entries;
|
||||||
unsigned int entries_cur;
|
unsigned entries_cur;
|
||||||
unsigned int entries_max;
|
unsigned entries_max;
|
||||||
bool unique;
|
bool unique;
|
||||||
};
|
};
|
||||||
void udev_list_node_init(struct udev_list_node *list);
|
void udev_list_node_init(struct udev_list_node *list);
|
||||||
|
|
|
@ -173,7 +173,7 @@ struct udev_hwdb;
|
||||||
struct udev_hwdb *udev_hwdb_new(struct udev *udev);
|
struct udev_hwdb *udev_hwdb_new(struct udev *udev);
|
||||||
struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb);
|
struct udev_hwdb *udev_hwdb_ref(struct udev_hwdb *hwdb);
|
||||||
struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb);
|
struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb);
|
||||||
struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags);
|
struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* udev_util
|
* udev_util
|
||||||
|
|
|
@ -347,7 +347,7 @@ typedef struct SessionStatusInfo {
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
const char *name;
|
const char *name;
|
||||||
struct dual_timestamp timestamp;
|
struct dual_timestamp timestamp;
|
||||||
unsigned int vtnr;
|
unsigned vtnr;
|
||||||
const char *seat;
|
const char *seat;
|
||||||
const char *tty;
|
const char *tty;
|
||||||
const char *display;
|
const char *display;
|
||||||
|
|
|
@ -498,7 +498,7 @@ int config_parse_n_autovts(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vt_is_busy(unsigned int vtnr) {
|
static int vt_is_busy(unsigned vtnr) {
|
||||||
struct vt_stat vt_stat;
|
struct vt_stat vt_stat;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
_cleanup_close_ int fd;
|
_cleanup_close_ int fd;
|
||||||
|
@ -526,9 +526,9 @@ static int vt_is_busy(unsigned int vtnr) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int manager_spawn_autovt(Manager *m, unsigned int vtnr) {
|
int manager_spawn_autovt(Manager *m, unsigned vtnr) {
|
||||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||||
char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned int)];
|
char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned)];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
|
@ -183,7 +183,7 @@ static int method_activate_session(sd_bus_message *message, void *userdata, sd_b
|
||||||
|
|
||||||
static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||||
Seat *s = userdata;
|
Seat *s = userdata;
|
||||||
unsigned int to;
|
unsigned to;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(message);
|
assert(message);
|
||||||
|
|
|
@ -166,8 +166,8 @@ int seat_load(Seat *s) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vt_allocate(unsigned int vtnr) {
|
static int vt_allocate(unsigned vtnr) {
|
||||||
char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
|
char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned)];
|
||||||
_cleanup_close_ int fd = -1;
|
_cleanup_close_ int fd = -1;
|
||||||
|
|
||||||
assert(vtnr >= 1);
|
assert(vtnr >= 1);
|
||||||
|
@ -265,7 +265,7 @@ int seat_set_active(Seat *s, Session *session) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int seat_switch_to(Seat *s, unsigned int num) {
|
int seat_switch_to(Seat *s, unsigned num) {
|
||||||
/* Public session positions skip 0 (there is only F1-F12). Maybe it
|
/* Public session positions skip 0 (there is only F1-F12). Maybe it
|
||||||
* will get reassigned in the future, so return error for now. */
|
* will get reassigned in the future, so return error for now. */
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
|
@ -283,7 +283,7 @@ int seat_switch_to(Seat *s, unsigned int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int seat_switch_to_next(Seat *s) {
|
int seat_switch_to_next(Seat *s) {
|
||||||
unsigned int start, i;
|
unsigned start, i;
|
||||||
|
|
||||||
if (s->position_count == 0)
|
if (s->position_count == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -304,7 +304,7 @@ int seat_switch_to_next(Seat *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int seat_switch_to_previous(Seat *s) {
|
int seat_switch_to_previous(Seat *s) {
|
||||||
unsigned int start, i;
|
unsigned start, i;
|
||||||
|
|
||||||
if (s->position_count == 0)
|
if (s->position_count == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -324,7 +324,7 @@ int seat_switch_to_previous(Seat *s) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int seat_active_vt_changed(Seat *s, unsigned int vtnr) {
|
int seat_active_vt_changed(Seat *s, unsigned vtnr) {
|
||||||
Session *i, *new_active = NULL;
|
Session *i, *new_active = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ int seat_stop_sessions(Seat *s, bool force) {
|
||||||
|
|
||||||
void seat_evict_position(Seat *s, Session *session) {
|
void seat_evict_position(Seat *s, Session *session) {
|
||||||
Session *iter;
|
Session *iter;
|
||||||
unsigned int pos = session->position;
|
unsigned pos = session->position;
|
||||||
|
|
||||||
session->position = 0;
|
session->position = 0;
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ void seat_evict_position(Seat *s, Session *session) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
|
void seat_claim_position(Seat *s, Session *session, unsigned pos) {
|
||||||
/* with VTs, the position is always the same as the VTnr */
|
/* with VTs, the position is always the same as the VTnr */
|
||||||
if (seat_has_vts(s))
|
if (seat_has_vts(s))
|
||||||
pos = session->vtnr;
|
pos = session->vtnr;
|
||||||
|
@ -497,7 +497,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void seat_assign_position(Seat *s, Session *session) {
|
static void seat_assign_position(Seat *s, Session *session) {
|
||||||
unsigned int pos;
|
unsigned pos;
|
||||||
|
|
||||||
if (session->position > 0)
|
if (session->position > 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,17 +37,17 @@ int seat_load(Seat *s);
|
||||||
|
|
||||||
int seat_apply_acls(Seat *s, Session *old_active);
|
int seat_apply_acls(Seat *s, Session *old_active);
|
||||||
int seat_set_active(Seat *s, Session *session);
|
int seat_set_active(Seat *s, Session *session);
|
||||||
int seat_switch_to(Seat *s, unsigned int num);
|
int seat_switch_to(Seat *s, unsigned num);
|
||||||
int seat_switch_to_next(Seat *s);
|
int seat_switch_to_next(Seat *s);
|
||||||
int seat_switch_to_previous(Seat *s);
|
int seat_switch_to_previous(Seat *s);
|
||||||
int seat_active_vt_changed(Seat *s, unsigned int vtnr);
|
int seat_active_vt_changed(Seat *s, unsigned vtnr);
|
||||||
int seat_read_active_vt(Seat *s);
|
int seat_read_active_vt(Seat *s);
|
||||||
int seat_preallocate_vts(Seat *s);
|
int seat_preallocate_vts(Seat *s);
|
||||||
|
|
||||||
int seat_attach_session(Seat *s, Session *session);
|
int seat_attach_session(Seat *s, Session *session);
|
||||||
void seat_complete_switch(Seat *s);
|
void seat_complete_switch(Seat *s);
|
||||||
void seat_evict_position(Seat *s, Session *session);
|
void seat_evict_position(Seat *s, Session *session);
|
||||||
void seat_claim_position(Seat *s, Session *session, unsigned int pos);
|
void seat_claim_position(Seat *s, Session *session, unsigned pos);
|
||||||
|
|
||||||
bool seat_has_vts(Seat *s);
|
bool seat_has_vts(Seat *s);
|
||||||
bool seat_is_seat0(Seat *s);
|
bool seat_is_seat0(Seat *s);
|
||||||
|
|
|
@ -468,7 +468,7 @@ void session_device_pause_all(Session *s) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int session_device_try_pause_all(Session *s) {
|
unsigned session_device_try_pause_all(Session *s) {
|
||||||
unsigned num_pending = 0;
|
unsigned num_pending = 0;
|
||||||
SessionDevice *sd;
|
SessionDevice *sd;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
|
|
|
@ -33,7 +33,7 @@ void session_device_complete_pause(SessionDevice *sd);
|
||||||
|
|
||||||
void session_device_resume_all(Session *s);
|
void session_device_resume_all(Session *s);
|
||||||
void session_device_pause_all(Session *s);
|
void session_device_pause_all(Session *s);
|
||||||
unsigned int session_device_try_pause_all(Session *s);
|
unsigned session_device_try_pause_all(Session *s);
|
||||||
|
|
||||||
int session_device_save(SessionDevice *sd);
|
int session_device_save(SessionDevice *sd);
|
||||||
void session_device_attach_fd(SessionDevice *sd, int fd, bool active);
|
void session_device_attach_fd(SessionDevice *sd, int fd, bool active);
|
||||||
|
|
|
@ -483,7 +483,7 @@ int session_load(Session *s) {
|
||||||
s->vtnr = 0;
|
s->vtnr = 0;
|
||||||
|
|
||||||
if (position && s->seat) {
|
if (position && s->seat) {
|
||||||
unsigned int npos;
|
unsigned npos;
|
||||||
|
|
||||||
safe_atou(position, &npos);
|
safe_atou(position, &npos);
|
||||||
seat_claim_position(s->seat, s, npos);
|
seat_claim_position(s->seat, s, npos);
|
||||||
|
@ -580,7 +580,7 @@ int session_load(Session *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int session_activate(Session *s) {
|
int session_activate(Session *s) {
|
||||||
unsigned int num_pending;
|
unsigned num_pending;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
assert(s->user);
|
assert(s->user);
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct Session {
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
|
||||||
const char *id;
|
const char *id;
|
||||||
unsigned int position;
|
unsigned position;
|
||||||
SessionType type;
|
SessionType type;
|
||||||
SessionClass class;
|
SessionClass class;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ struct Session {
|
||||||
char *scope_job;
|
char *scope_job;
|
||||||
|
|
||||||
Seat *seat;
|
Seat *seat;
|
||||||
unsigned int vtnr;
|
unsigned vtnr;
|
||||||
int vtfd;
|
int vtfd;
|
||||||
|
|
||||||
pid_t leader;
|
pid_t leader;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
_const_ static usec_t when_wall(usec_t n, usec_t elapse) {
|
_const_ static usec_t when_wall(usec_t n, usec_t elapse) {
|
||||||
|
|
||||||
usec_t left;
|
usec_t left;
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
static const int wall_timers[] = {
|
static const int wall_timers[] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||||
25, 40, 55, 70, 100, 130, 150, 180,
|
25, 40, 55, 70, 100, 130, 150, 180,
|
||||||
|
|
|
@ -343,7 +343,7 @@ static int manager_enumerate_users(Manager *m) {
|
||||||
static int parse_fdname(const char *fdname, char **session_id, dev_t *dev) {
|
static int parse_fdname(const char *fdname, char **session_id, dev_t *dev) {
|
||||||
_cleanup_strv_free_ char **parts = NULL;
|
_cleanup_strv_free_ char **parts = NULL;
|
||||||
_cleanup_free_ char *id = NULL;
|
_cleanup_free_ char *id = NULL;
|
||||||
unsigned int major, minor;
|
unsigned major, minor;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
parts = strv_split(fdname, "-");
|
parts = strv_split(fdname, "-");
|
||||||
|
|
|
@ -137,7 +137,7 @@ int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **_inhibitor);
|
||||||
int manager_process_seat_device(Manager *m, sd_device *d);
|
int manager_process_seat_device(Manager *m, sd_device *d);
|
||||||
int manager_process_button_device(Manager *m, sd_device *d);
|
int manager_process_button_device(Manager *m, sd_device *d);
|
||||||
|
|
||||||
int manager_spawn_autovt(Manager *m, unsigned int vtnr);
|
int manager_spawn_autovt(Manager *m, unsigned vtnr);
|
||||||
|
|
||||||
bool manager_shall_kill(Manager *m, const char *user);
|
bool manager_shall_kill(Manager *m, const char *user);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static WireguardPeer *wireguard_peer_new(Wireguard *w, unsigned section) {
|
||||||
|
|
||||||
static int set_wireguard_interface(NetDev *netdev) {
|
static int set_wireguard_interface(NetDev *netdev) {
|
||||||
int r;
|
int r;
|
||||||
unsigned int i, j;
|
unsigned i, j;
|
||||||
WireguardPeer *peer, *peer_start;
|
WireguardPeer *peer, *peer_start;
|
||||||
WireguardIPmask *mask, *mask_start = NULL;
|
WireguardIPmask *mask, *mask_start = NULL;
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||||
|
|
|
@ -897,7 +897,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (all || n > 0) {
|
if (all || n > 0) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
printf("%s=", name);
|
printf("%s=", name);
|
||||||
|
@ -919,7 +919,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (all || n > 0) {
|
if (all || n > 0) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
printf("%s=", name);
|
printf("%s=", name);
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ int seccomp_restrict_realtime(void) {
|
||||||
static int add_seccomp_syscall_filter(scmp_filter_ctx seccomp,
|
static int add_seccomp_syscall_filter(scmp_filter_ctx seccomp,
|
||||||
uint32_t arch,
|
uint32_t arch,
|
||||||
int nr,
|
int nr,
|
||||||
unsigned int arg_cnt,
|
unsigned arg_cnt,
|
||||||
const struct scmp_arg_cmp arg) {
|
const struct scmp_arg_cmp arg) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
@ -1563,7 +1563,7 @@ static int list_unit_files(int argc, char *argv[], void *userdata) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int list_dependencies_print(const char *name, int level, unsigned int branches, bool last) {
|
static int list_dependencies_print(const char *name, int level, unsigned branches, bool last) {
|
||||||
_cleanup_free_ char *n = NULL;
|
_cleanup_free_ char *n = NULL;
|
||||||
size_t max_len = MAX(columns(),20u);
|
size_t max_len = MAX(columns(),20u);
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
@ -1689,7 +1689,7 @@ static int list_dependencies_one(
|
||||||
const char *name,
|
const char *name,
|
||||||
int level,
|
int level,
|
||||||
char ***units,
|
char ***units,
|
||||||
unsigned int branches) {
|
unsigned branches) {
|
||||||
|
|
||||||
_cleanup_strv_free_ char **deps = NULL;
|
_cleanup_strv_free_ char **deps = NULL;
|
||||||
char **c;
|
char **c;
|
||||||
|
|
|
@ -16,7 +16,7 @@ static const struct af_name* lookup_af(register const char *str, register GPERF_
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(af_names); i++) {
|
for (i = 0; i < ELEMENTSOF(af_names); i++) {
|
||||||
if (af_names[i]) {
|
if (af_names[i]) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ static const struct arphrd_name* lookup_arphrd(register const char *str, registe
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
|
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
|
for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
|
||||||
if (arphrd_names[i]) {
|
if (arphrd_names[i]) {
|
||||||
|
|
|
@ -320,7 +320,7 @@ static int manager_adjust_clock(Manager *m, double offset, int leap_sec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool manager_sample_spike_detection(Manager *m, double offset, double delay) {
|
static bool manager_sample_spike_detection(Manager *m, double offset, double delay) {
|
||||||
unsigned int i, idx_cur, idx_new, idx_min;
|
unsigned i, idx_cur, idx_new, idx_min;
|
||||||
double jitter;
|
double jitter;
|
||||||
double j;
|
double j;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct Manager {
|
||||||
double offset;
|
double offset;
|
||||||
double delay;
|
double delay;
|
||||||
} samples[8];
|
} samples[8];
|
||||||
unsigned int samples_idx;
|
unsigned samples_idx;
|
||||||
double samples_jitter;
|
double samples_jitter;
|
||||||
usec_t max_root_distance_usec;
|
usec_t max_root_distance_usec;
|
||||||
|
|
||||||
|
|
|
@ -257,12 +257,12 @@ static int disk_identify_packet_device_command(
|
||||||
*/
|
*/
|
||||||
static void disk_identify_get_string(
|
static void disk_identify_get_string(
|
||||||
uint8_t identify[512],
|
uint8_t identify[512],
|
||||||
unsigned int offset_words,
|
unsigned offset_words,
|
||||||
char *dest,
|
char *dest,
|
||||||
size_t dest_len) {
|
size_t dest_len) {
|
||||||
|
|
||||||
unsigned int c1;
|
unsigned c1;
|
||||||
unsigned int c2;
|
unsigned c2;
|
||||||
|
|
||||||
while (dest_len > 0) {
|
while (dest_len > 0) {
|
||||||
c1 = identify[offset_words * 2 + 1];
|
c1 = identify[offset_words * 2 + 1];
|
||||||
|
@ -278,13 +278,13 @@ static void disk_identify_get_string(
|
||||||
|
|
||||||
static void disk_identify_fixup_string(
|
static void disk_identify_fixup_string(
|
||||||
uint8_t identify[512],
|
uint8_t identify[512],
|
||||||
unsigned int offset_words,
|
unsigned offset_words,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
disk_identify_get_string(identify, offset_words,
|
disk_identify_get_string(identify, offset_words,
|
||||||
(char *) identify + offset_words * 2, len);
|
(char *) identify + offset_words * 2, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) {
|
static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned offset_words) {
|
||||||
uint16_t *p;
|
uint16_t *p;
|
||||||
|
|
||||||
p = (uint16_t *) identify;
|
p = (uint16_t *) identify;
|
||||||
|
|
|
@ -26,58 +26,58 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* device info */
|
/* device info */
|
||||||
static unsigned int cd_cd_rom;
|
static unsigned cd_cd_rom;
|
||||||
static unsigned int cd_cd_r;
|
static unsigned cd_cd_r;
|
||||||
static unsigned int cd_cd_rw;
|
static unsigned cd_cd_rw;
|
||||||
static unsigned int cd_dvd_rom;
|
static unsigned cd_dvd_rom;
|
||||||
static unsigned int cd_dvd_r;
|
static unsigned cd_dvd_r;
|
||||||
static unsigned int cd_dvd_rw;
|
static unsigned cd_dvd_rw;
|
||||||
static unsigned int cd_dvd_ram;
|
static unsigned cd_dvd_ram;
|
||||||
static unsigned int cd_dvd_plus_r;
|
static unsigned cd_dvd_plus_r;
|
||||||
static unsigned int cd_dvd_plus_rw;
|
static unsigned cd_dvd_plus_rw;
|
||||||
static unsigned int cd_dvd_plus_r_dl;
|
static unsigned cd_dvd_plus_r_dl;
|
||||||
static unsigned int cd_dvd_plus_rw_dl;
|
static unsigned cd_dvd_plus_rw_dl;
|
||||||
static unsigned int cd_bd;
|
static unsigned cd_bd;
|
||||||
static unsigned int cd_bd_r;
|
static unsigned cd_bd_r;
|
||||||
static unsigned int cd_bd_re;
|
static unsigned cd_bd_re;
|
||||||
static unsigned int cd_hddvd;
|
static unsigned cd_hddvd;
|
||||||
static unsigned int cd_hddvd_r;
|
static unsigned cd_hddvd_r;
|
||||||
static unsigned int cd_hddvd_rw;
|
static unsigned cd_hddvd_rw;
|
||||||
static unsigned int cd_mo;
|
static unsigned cd_mo;
|
||||||
static unsigned int cd_mrw;
|
static unsigned cd_mrw;
|
||||||
static unsigned int cd_mrw_w;
|
static unsigned cd_mrw_w;
|
||||||
|
|
||||||
/* media info */
|
/* media info */
|
||||||
static unsigned int cd_media;
|
static unsigned cd_media;
|
||||||
static unsigned int cd_media_cd_rom;
|
static unsigned cd_media_cd_rom;
|
||||||
static unsigned int cd_media_cd_r;
|
static unsigned cd_media_cd_r;
|
||||||
static unsigned int cd_media_cd_rw;
|
static unsigned cd_media_cd_rw;
|
||||||
static unsigned int cd_media_dvd_rom;
|
static unsigned cd_media_dvd_rom;
|
||||||
static unsigned int cd_media_dvd_r;
|
static unsigned cd_media_dvd_r;
|
||||||
static unsigned int cd_media_dvd_rw;
|
static unsigned cd_media_dvd_rw;
|
||||||
static unsigned int cd_media_dvd_rw_ro; /* restricted overwrite mode */
|
static unsigned cd_media_dvd_rw_ro; /* restricted overwrite mode */
|
||||||
static unsigned int cd_media_dvd_rw_seq; /* sequential mode */
|
static unsigned cd_media_dvd_rw_seq; /* sequential mode */
|
||||||
static unsigned int cd_media_dvd_ram;
|
static unsigned cd_media_dvd_ram;
|
||||||
static unsigned int cd_media_dvd_plus_r;
|
static unsigned cd_media_dvd_plus_r;
|
||||||
static unsigned int cd_media_dvd_plus_rw;
|
static unsigned cd_media_dvd_plus_rw;
|
||||||
static unsigned int cd_media_dvd_plus_r_dl;
|
static unsigned cd_media_dvd_plus_r_dl;
|
||||||
static unsigned int cd_media_dvd_plus_rw_dl;
|
static unsigned cd_media_dvd_plus_rw_dl;
|
||||||
static unsigned int cd_media_bd;
|
static unsigned cd_media_bd;
|
||||||
static unsigned int cd_media_bd_r;
|
static unsigned cd_media_bd_r;
|
||||||
static unsigned int cd_media_bd_re;
|
static unsigned cd_media_bd_re;
|
||||||
static unsigned int cd_media_hddvd;
|
static unsigned cd_media_hddvd;
|
||||||
static unsigned int cd_media_hddvd_r;
|
static unsigned cd_media_hddvd_r;
|
||||||
static unsigned int cd_media_hddvd_rw;
|
static unsigned cd_media_hddvd_rw;
|
||||||
static unsigned int cd_media_mo;
|
static unsigned cd_media_mo;
|
||||||
static unsigned int cd_media_mrw;
|
static unsigned cd_media_mrw;
|
||||||
static unsigned int cd_media_mrw_w;
|
static unsigned cd_media_mrw_w;
|
||||||
|
|
||||||
static const char *cd_media_state = NULL;
|
static const char *cd_media_state = NULL;
|
||||||
static unsigned int cd_media_session_next;
|
static unsigned cd_media_session_next;
|
||||||
static unsigned int cd_media_session_count;
|
static unsigned cd_media_session_count;
|
||||||
static unsigned int cd_media_track_count;
|
static unsigned cd_media_track_count;
|
||||||
static unsigned int cd_media_track_count_data;
|
static unsigned cd_media_track_count_data;
|
||||||
static unsigned int cd_media_track_count_audio;
|
static unsigned cd_media_track_count_audio;
|
||||||
static unsigned long long int cd_media_session_last_offset;
|
static unsigned long long int cd_media_session_last_offset;
|
||||||
|
|
||||||
#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13]))
|
#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13]))
|
||||||
|
@ -366,7 +366,7 @@ static void feature_profile_media(int cur_profile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int feature_profiles(const unsigned char *profiles, size_t size) {
|
static int feature_profiles(const unsigned char *profiles, size_t size) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i+4 <= size; i += 4) {
|
for (i = 0; i+4 <= size; i += 4) {
|
||||||
int profile;
|
int profile;
|
||||||
|
@ -498,9 +498,9 @@ static int cd_profiles_old_mmc(int fd) {
|
||||||
static int cd_profiles(int fd) {
|
static int cd_profiles(int fd) {
|
||||||
struct scsi_cmd sc;
|
struct scsi_cmd sc;
|
||||||
unsigned char features[65530];
|
unsigned char features[65530];
|
||||||
unsigned int cur_profile = 0;
|
unsigned cur_profile = 0;
|
||||||
unsigned int len;
|
unsigned len;
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
int err;
|
int err;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ static int cd_profiles(int fd) {
|
||||||
|
|
||||||
/* device features */
|
/* device features */
|
||||||
for (i = 8; i+4 < len; i += (4 + features[i+3])) {
|
for (i = 8; i+4 < len; i += (4 + features[i+3])) {
|
||||||
unsigned int feature;
|
unsigned feature;
|
||||||
|
|
||||||
feature = features[i] << 8 | features[i+1];
|
feature = features[i] << 8 | features[i+1];
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ static int cd_media_toc(int fd) {
|
||||||
struct scsi_cmd sc;
|
struct scsi_cmd sc;
|
||||||
unsigned char header[12];
|
unsigned char header[12];
|
||||||
unsigned char toc[65536];
|
unsigned char toc[65536];
|
||||||
unsigned int len, i, num_tracks;
|
unsigned len, i, num_tracks;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
@ -782,8 +782,8 @@ static int cd_media_toc(int fd) {
|
||||||
* the TOC, but also avoid going beyond the TOC length, just in case
|
* the TOC, but also avoid going beyond the TOC length, just in case
|
||||||
* the last track number is invalidly large */
|
* the last track number is invalidly large */
|
||||||
for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) {
|
for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) {
|
||||||
unsigned int block;
|
unsigned block;
|
||||||
unsigned int is_data_track;
|
unsigned is_data_track;
|
||||||
|
|
||||||
is_data_track = (p[1] & 0x04) != 0;
|
is_data_track = (p[1] & 0x04) != 0;
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ int ethtool_get_driver(int *fd, const char *ifname, char **ret) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ethtool_set_speed(int *fd, const char *ifname, unsigned int speed, Duplex duplex) {
|
int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex) {
|
||||||
struct ethtool_cmd ecmd = {
|
struct ethtool_cmd ecmd = {
|
||||||
.cmd = ETHTOOL_GSET
|
.cmd = ETHTOOL_GSET
|
||||||
};
|
};
|
||||||
|
@ -474,7 +474,7 @@ static int set_slinksettings(int fd, struct ifreq *ifr, const struct ethtool_lin
|
||||||
struct ethtool_link_settings req;
|
struct ethtool_link_settings req;
|
||||||
__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
|
__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
|
||||||
} ecmd = {};
|
} ecmd = {};
|
||||||
unsigned int offset;
|
unsigned offset;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)
|
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)
|
||||||
|
|
|
@ -101,7 +101,7 @@ typedef struct netdev_channels {
|
||||||
int ethtool_connect(int *ret);
|
int ethtool_connect(int *ret);
|
||||||
|
|
||||||
int ethtool_get_driver(int *fd, const char *ifname, char **ret);
|
int ethtool_get_driver(int *fd, const char *ifname, char **ret);
|
||||||
int ethtool_set_speed(int *fd, const char *ifname, unsigned int speed, Duplex duplex);
|
int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex);
|
||||||
int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol);
|
int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol);
|
||||||
int ethtool_set_features(int *fd, const char *ifname, int *features);
|
int ethtool_set_features(int *fd, const char *ifname, int *features);
|
||||||
int ethtool_set_glinksettings(int *fd, const char *ifname, struct link_config *link);
|
int ethtool_set_glinksettings(int *fd, const char *ifname, struct link_config *link);
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include <scsi/scsi.h>
|
#include <scsi/scsi.h>
|
||||||
|
|
||||||
struct scsi_ioctl_command {
|
struct scsi_ioctl_command {
|
||||||
unsigned int inlen; /* excluding scsi command length */
|
unsigned inlen; /* excluding scsi command length */
|
||||||
unsigned int outlen;
|
unsigned outlen;
|
||||||
unsigned char data[1];
|
unsigned char data[1];
|
||||||
/* on input, scsi command starts here then opt. data */
|
/* on input, scsi command starts here then opt. data */
|
||||||
};
|
};
|
||||||
|
|
|
@ -268,7 +268,7 @@ static int scsi_dump_v4(struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) {
|
||||||
|
|
||||||
static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
||||||
unsigned char evpd, unsigned char page,
|
unsigned char evpd, unsigned char page,
|
||||||
unsigned char *buf, unsigned int buflen) {
|
unsigned char *buf, unsigned buflen) {
|
||||||
unsigned char inq_cmd[INQUIRY_CMDLEN] =
|
unsigned char inq_cmd[INQUIRY_CMDLEN] =
|
||||||
{ INQUIRY_CMD, evpd, page, 0, buflen, 0 };
|
{ INQUIRY_CMD, evpd, page, 0, buflen, 0 };
|
||||||
unsigned char sense[SENSE_BUFF_LEN];
|
unsigned char sense[SENSE_BUFF_LEN];
|
||||||
|
@ -359,7 +359,7 @@ error:
|
||||||
|
|
||||||
/* Get list of supported EVPD pages */
|
/* Get list of supported EVPD pages */
|
||||||
static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
||||||
unsigned char *buffer, unsigned int len) {
|
unsigned char *buffer, unsigned len) {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
memzero(buffer, len);
|
memzero(buffer, len);
|
||||||
|
@ -481,9 +481,9 @@ static int check_fill_0x83_id(struct scsi_id_device *dev_scsi,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) {
|
if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) {
|
||||||
unsigned int group;
|
unsigned group;
|
||||||
|
|
||||||
group = ((unsigned int)page_83[6] << 8) | page_83[7];
|
group = ((unsigned)page_83[6] << 8) | page_83[7];
|
||||||
sprintf(tgpt_group,"%x", group);
|
sprintf(tgpt_group,"%x", group);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
||||||
char *unit_serial_number, char *wwn,
|
char *unit_serial_number, char *wwn,
|
||||||
char *wwn_vendor_extension, char *tgpt_group) {
|
char *wwn_vendor_extension, char *tgpt_group) {
|
||||||
int retval;
|
int retval;
|
||||||
unsigned int id_ind, j;
|
unsigned id_ind, j;
|
||||||
unsigned char page_83[SCSI_INQ_BUFF_LEN];
|
unsigned char page_83[SCSI_INQ_BUFF_LEN];
|
||||||
|
|
||||||
/* also pick up the page 80 serial number */
|
/* also pick up the page 80 serial number */
|
||||||
|
@ -618,7 +618,7 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd,
|
||||||
* Examine each descriptor returned. There is normally only
|
* Examine each descriptor returned. There is normally only
|
||||||
* one or a small number of descriptors.
|
* one or a small number of descriptors.
|
||||||
*/
|
*/
|
||||||
for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) {
|
for (j = 4; j <= (unsigned)page_83[3] + 3; j += page_83[j + 3] + 4) {
|
||||||
retval = check_fill_0x83_id(dev_scsi, &page_83[j],
|
retval = check_fill_0x83_id(dev_scsi, &page_83[j],
|
||||||
&id_search_list[id_ind],
|
&id_search_list[id_ind],
|
||||||
serial, serial_short, len,
|
serial, serial_short, len,
|
||||||
|
|
|
@ -601,7 +601,7 @@ static int names_usb(struct udev_device *dev, struct netnames *names) {
|
||||||
|
|
||||||
static int names_bcma(struct udev_device *dev, struct netnames *names) {
|
static int names_bcma(struct udev_device *dev, struct netnames *names) {
|
||||||
struct udev_device *bcmadev;
|
struct udev_device *bcmadev;
|
||||||
unsigned int core;
|
unsigned core;
|
||||||
|
|
||||||
assert(dev);
|
assert(dev);
|
||||||
assert(names);
|
assert(names);
|
||||||
|
@ -676,7 +676,7 @@ static int names_ccw(struct udev_device *dev, struct netnames *names) {
|
||||||
static int names_mac(struct udev_device *dev, struct netnames *names) {
|
static int names_mac(struct udev_device *dev, struct netnames *names) {
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
unsigned int a1, a2, a3, a4, a5, a6;
|
unsigned a1, a2, a3, a4, a5, a6;
|
||||||
|
|
||||||
/* Some kinds of devices tend to have hardware addresses
|
/* Some kinds of devices tend to have hardware addresses
|
||||||
* that are impossible to use in an iface name.
|
* that are impossible to use in an iface name.
|
||||||
|
|
|
@ -452,7 +452,7 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path,
|
||||||
|
|
||||||
static struct udev_device *handle_cciss(struct udev_device *parent, char **path) {
|
static struct udev_device *handle_cciss(struct udev_device *parent, char **path) {
|
||||||
const char *str;
|
const char *str;
|
||||||
unsigned int controller, disk;
|
unsigned controller, disk;
|
||||||
|
|
||||||
str = udev_device_get_sysname(parent);
|
str = udev_device_get_sysname(parent);
|
||||||
if (sscanf(str, "c%ud%u%*s", &controller, &disk) != 2)
|
if (sscanf(str, "c%ud%u%*s", &controller, &disk) != 2)
|
||||||
|
@ -497,7 +497,7 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) {
|
||||||
|
|
||||||
static struct udev_device *handle_bcma(struct udev_device *parent, char **path) {
|
static struct udev_device *handle_bcma(struct udev_device *parent, char **path) {
|
||||||
const char *sysname;
|
const char *sysname;
|
||||||
unsigned int core;
|
unsigned core;
|
||||||
|
|
||||||
sysname = udev_device_get_sysname(parent);
|
sysname = udev_device_get_sysname(parent);
|
||||||
if (sscanf(sysname, "bcma%*u:%u", &core) != 1)
|
if (sscanf(sysname, "bcma%*u:%u", &core) != 1)
|
||||||
|
|
|
@ -31,7 +31,7 @@ static const struct udev_builtin *builtins[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void udev_builtin_init(void) {
|
void udev_builtin_init(void) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return;
|
return;
|
||||||
|
@ -44,7 +44,7 @@ void udev_builtin_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void udev_builtin_exit(void) {
|
void udev_builtin_exit(void) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
return;
|
return;
|
||||||
|
@ -57,7 +57,7 @@ void udev_builtin_exit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool udev_builtin_validate(void) {
|
bool udev_builtin_validate(void) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(builtins); i++)
|
for (i = 0; i < ELEMENTSOF(builtins); i++)
|
||||||
if (builtins[i] && builtins[i]->validate && builtins[i]->validate())
|
if (builtins[i] && builtins[i]->validate && builtins[i]->validate())
|
||||||
|
@ -66,7 +66,7 @@ bool udev_builtin_validate(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void udev_builtin_list(void) {
|
void udev_builtin_list(void) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(builtins); i++)
|
for (i = 0; i < ELEMENTSOF(builtins); i++)
|
||||||
if (builtins[i])
|
if (builtins[i])
|
||||||
|
|
|
@ -41,7 +41,7 @@ enum udev_ctrl_msg_type {
|
||||||
|
|
||||||
struct udev_ctrl_msg_wire {
|
struct udev_ctrl_msg_wire {
|
||||||
char version[16];
|
char version[16];
|
||||||
unsigned int magic;
|
unsigned magic;
|
||||||
enum udev_ctrl_msg_type type;
|
enum udev_ctrl_msg_type type;
|
||||||
union {
|
union {
|
||||||
int intval;
|
int intval;
|
||||||
|
|
|
@ -322,7 +322,7 @@ size_t udev_event_apply_format(struct udev_event *event,
|
||||||
while (from[0] != '\0') {
|
while (from[0] != '\0') {
|
||||||
if (from[0] == '$') {
|
if (from[0] == '$') {
|
||||||
/* substitute named variable */
|
/* substitute named variable */
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (from[1] == '$') {
|
if (from[1] == '$') {
|
||||||
from++;
|
from++;
|
||||||
|
@ -338,7 +338,7 @@ size_t udev_event_apply_format(struct udev_event *event,
|
||||||
}
|
}
|
||||||
} else if (from[0] == '%') {
|
} else if (from[0] == '%') {
|
||||||
/* substitute format char */
|
/* substitute format char */
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
if (from[1] == '%') {
|
if (from[1] == '%') {
|
||||||
from++;
|
from++;
|
||||||
|
@ -367,7 +367,7 @@ copy:
|
||||||
subst:
|
subst:
|
||||||
/* extract possible $format{attr} */
|
/* extract possible $format{attr} */
|
||||||
if (from[0] == '{') {
|
if (from[0] == '{') {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
from++;
|
from++;
|
||||||
for (i = 0; from[i] != '}'; i++)
|
for (i = 0; from[i] != '}'; i++)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#define PREALLOC_TOKEN 2048
|
#define PREALLOC_TOKEN 2048
|
||||||
|
|
||||||
struct uid_gid {
|
struct uid_gid {
|
||||||
unsigned int name_off;
|
unsigned name_off;
|
||||||
union {
|
union {
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
@ -58,26 +58,26 @@ struct udev_rules {
|
||||||
|
|
||||||
/* every key in the rules file becomes a token */
|
/* every key in the rules file becomes a token */
|
||||||
struct token *tokens;
|
struct token *tokens;
|
||||||
unsigned int token_cur;
|
unsigned token_cur;
|
||||||
unsigned int token_max;
|
unsigned token_max;
|
||||||
|
|
||||||
/* all key strings are copied and de-duplicated in a single continuous string buffer */
|
/* all key strings are copied and de-duplicated in a single continuous string buffer */
|
||||||
struct strbuf *strbuf;
|
struct strbuf *strbuf;
|
||||||
|
|
||||||
/* during rule parsing, uid/gid lookup results are cached */
|
/* during rule parsing, uid/gid lookup results are cached */
|
||||||
struct uid_gid *uids;
|
struct uid_gid *uids;
|
||||||
unsigned int uids_cur;
|
unsigned uids_cur;
|
||||||
unsigned int uids_max;
|
unsigned uids_max;
|
||||||
struct uid_gid *gids;
|
struct uid_gid *gids;
|
||||||
unsigned int gids_cur;
|
unsigned gids_cur;
|
||||||
unsigned int gids_max;
|
unsigned gids_max;
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *rules_str(struct udev_rules *rules, unsigned int off) {
|
static char *rules_str(struct udev_rules *rules, unsigned off) {
|
||||||
return rules->strbuf->buf + off;
|
return rules->strbuf->buf + off;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int rules_add_string(struct udev_rules *rules, const char *s) {
|
static unsigned rules_add_string(struct udev_rules *rules, const char *s) {
|
||||||
return strbuf_add_string(rules->strbuf, s, strlen(s));
|
return strbuf_add_string(rules->strbuf, s, strlen(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,9 +182,9 @@ struct token {
|
||||||
enum token_type type:8;
|
enum token_type type:8;
|
||||||
bool can_set_name:1;
|
bool can_set_name:1;
|
||||||
bool has_static_node:1;
|
bool has_static_node:1;
|
||||||
unsigned int unused:6;
|
unsigned unused:6;
|
||||||
unsigned short token_count;
|
unsigned short token_count;
|
||||||
unsigned int label_off;
|
unsigned label_off;
|
||||||
unsigned short filename_off;
|
unsigned short filename_off;
|
||||||
unsigned short filename_line;
|
unsigned short filename_line;
|
||||||
} rule;
|
} rule;
|
||||||
|
@ -194,10 +194,10 @@ struct token {
|
||||||
enum string_glob_type glob:8;
|
enum string_glob_type glob:8;
|
||||||
enum string_subst_type subst:4;
|
enum string_subst_type subst:4;
|
||||||
enum string_subst_type attrsubst:4;
|
enum string_subst_type attrsubst:4;
|
||||||
unsigned int value_off;
|
unsigned value_off;
|
||||||
union {
|
union {
|
||||||
unsigned int attr_off;
|
unsigned attr_off;
|
||||||
unsigned int rule_goto;
|
unsigned rule_goto;
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
|
@ -214,7 +214,7 @@ struct rule_tmp {
|
||||||
struct udev_rules *rules;
|
struct udev_rules *rules;
|
||||||
struct token rule;
|
struct token rule;
|
||||||
struct token token[MAX_TK];
|
struct token token[MAX_TK];
|
||||||
unsigned int token_cur;
|
unsigned token_cur;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -325,7 +325,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) {
|
||||||
{
|
{
|
||||||
const char *tks_ptr = (char *)rules->tokens;
|
const char *tks_ptr = (char *)rules->tokens;
|
||||||
const char *tk_ptr = (char *)token;
|
const char *tk_ptr = (char *)token;
|
||||||
unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token);
|
unsigned idx = (tk_ptr - tks_ptr) / sizeof(struct token);
|
||||||
|
|
||||||
log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'",
|
log_debug("* RULE %s:%u, token: %u, count: %u, label: '%s'",
|
||||||
&rules->strbuf->buf[token->rule.filename_off], token->rule.filename_line,
|
&rules->strbuf->buf[token->rule.filename_off], token->rule.filename_line,
|
||||||
|
@ -425,7 +425,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_rules(struct udev_rules *rules) {
|
static void dump_rules(struct udev_rules *rules) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
log_debug("dumping %u (%zu bytes) tokens, %zu (%zu bytes) strings",
|
log_debug("dumping %u (%zu bytes) tokens, %zu (%zu bytes) strings",
|
||||||
rules->token_cur,
|
rules->token_cur,
|
||||||
|
@ -444,7 +444,7 @@ static int add_token(struct udev_rules *rules, struct token *token) {
|
||||||
/* grow buffer if needed */
|
/* grow buffer if needed */
|
||||||
if (rules->token_cur+1 >= rules->token_max) {
|
if (rules->token_cur+1 >= rules->token_max) {
|
||||||
struct token *tokens;
|
struct token *tokens;
|
||||||
unsigned int add;
|
unsigned add;
|
||||||
|
|
||||||
/* double the buffer size */
|
/* double the buffer size */
|
||||||
add = rules->token_max;
|
add = rules->token_max;
|
||||||
|
@ -470,9 +470,9 @@ static void log_unknown_owner(int error, const char *entity, const char *owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
static uid_t add_uid(struct udev_rules *rules, const char *owner) {
|
static uid_t add_uid(struct udev_rules *rules, const char *owner) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
uid_t uid = 0;
|
uid_t uid = 0;
|
||||||
unsigned int off;
|
unsigned off;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* lookup, if we know it already */
|
/* lookup, if we know it already */
|
||||||
|
@ -490,7 +490,7 @@ static uid_t add_uid(struct udev_rules *rules, const char *owner) {
|
||||||
/* grow buffer if needed */
|
/* grow buffer if needed */
|
||||||
if (rules->uids_cur+1 >= rules->uids_max) {
|
if (rules->uids_cur+1 >= rules->uids_max) {
|
||||||
struct uid_gid *uids;
|
struct uid_gid *uids;
|
||||||
unsigned int add;
|
unsigned add;
|
||||||
|
|
||||||
/* double the buffer size */
|
/* double the buffer size */
|
||||||
add = rules->uids_max;
|
add = rules->uids_max;
|
||||||
|
@ -513,9 +513,9 @@ static uid_t add_uid(struct udev_rules *rules, const char *owner) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static gid_t add_gid(struct udev_rules *rules, const char *group) {
|
static gid_t add_gid(struct udev_rules *rules, const char *group) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
gid_t gid = 0;
|
gid_t gid = 0;
|
||||||
unsigned int off;
|
unsigned off;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* lookup, if we know it already */
|
/* lookup, if we know it already */
|
||||||
|
@ -533,7 +533,7 @@ static gid_t add_gid(struct udev_rules *rules, const char *group) {
|
||||||
/* grow buffer if needed */
|
/* grow buffer if needed */
|
||||||
if (rules->gids_cur+1 >= rules->gids_max) {
|
if (rules->gids_cur+1 >= rules->gids_max) {
|
||||||
struct uid_gid *gids;
|
struct uid_gid *gids;
|
||||||
unsigned int add;
|
unsigned add;
|
||||||
|
|
||||||
/* double the buffer size */
|
/* double the buffer size */
|
||||||
add = rules->gids_max;
|
add = rules->gids_max;
|
||||||
|
@ -973,14 +973,14 @@ static void rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) {
|
static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) {
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
unsigned int start = 0;
|
unsigned start = 0;
|
||||||
unsigned int end = rule_tmp->token_cur;
|
unsigned end = rule_tmp->token_cur;
|
||||||
|
|
||||||
for (i = 0; i < rule_tmp->token_cur; i++) {
|
for (i = 0; i < rule_tmp->token_cur; i++) {
|
||||||
enum token_type next_val = TK_UNSET;
|
enum token_type next_val = TK_UNSET;
|
||||||
unsigned int next_idx = 0;
|
unsigned next_idx = 0;
|
||||||
unsigned int j;
|
unsigned j;
|
||||||
|
|
||||||
/* find smallest value */
|
/* find smallest value */
|
||||||
for (j = start; j < end; j++) {
|
for (j = start; j < end; j++) {
|
||||||
|
@ -1012,7 +1012,7 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) {
|
||||||
#define LOG_AND_RETURN(fmt, ...) { LOG_RULE_ERROR(fmt, __VA_ARGS__); return; }
|
#define LOG_AND_RETURN(fmt, ...) { LOG_RULE_ERROR(fmt, __VA_ARGS__); return; }
|
||||||
|
|
||||||
static void add_rule(struct udev_rules *rules, char *line,
|
static void add_rule(struct udev_rules *rules, char *line,
|
||||||
const char *filename, unsigned int filename_off, unsigned int lineno) {
|
const char *filename, unsigned filename_off, unsigned lineno) {
|
||||||
char *linepos;
|
char *linepos;
|
||||||
const char *attr;
|
const char *attr;
|
||||||
struct rule_tmp rule_tmp = {
|
struct rule_tmp rule_tmp = {
|
||||||
|
@ -1433,11 +1433,11 @@ static void add_rule(struct udev_rules *rules, char *line,
|
||||||
|
|
||||||
static int parse_file(struct udev_rules *rules, const char *filename) {
|
static int parse_file(struct udev_rules *rules, const char *filename) {
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
unsigned int first_token;
|
unsigned first_token;
|
||||||
unsigned int filename_off;
|
unsigned filename_off;
|
||||||
char line[UTIL_LINE_SIZE];
|
char line[UTIL_LINE_SIZE];
|
||||||
int line_nr = 0;
|
int line_nr = 0;
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
f = fopen(filename, "re");
|
f = fopen(filename, "re");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
@ -1495,7 +1495,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) {
|
||||||
for (i = first_token+1; i < rules->token_cur; i++) {
|
for (i = first_token+1; i < rules->token_cur; i++) {
|
||||||
if (rules->tokens[i].type == TK_A_GOTO) {
|
if (rules->tokens[i].type == TK_A_GOTO) {
|
||||||
char *label = rules_str(rules, rules->tokens[i].key.value_off);
|
char *label = rules_str(rules, rules->tokens[i].key.value_off);
|
||||||
unsigned int j;
|
unsigned j;
|
||||||
|
|
||||||
for (j = i+1; j < rules->token_cur; j++) {
|
for (j = i+1; j < rules->token_cur; j++) {
|
||||||
if (rules->tokens[j].type != TK_RULE)
|
if (rules->tokens[j].type != TK_RULE)
|
||||||
|
|
|
@ -34,8 +34,8 @@ struct udev_event {
|
||||||
int exec_delay;
|
int exec_delay;
|
||||||
usec_t birth_usec;
|
usec_t birth_usec;
|
||||||
sd_netlink *rtnl;
|
sd_netlink *rtnl;
|
||||||
unsigned int builtin_run;
|
unsigned builtin_run;
|
||||||
unsigned int builtin_ret;
|
unsigned builtin_ret;
|
||||||
bool inotify_watch;
|
bool inotify_watch;
|
||||||
bool inotify_watch_final;
|
bool inotify_watch_final;
|
||||||
bool group_set;
|
bool group_set;
|
||||||
|
|
|
@ -32,7 +32,7 @@ static bool skip_attribute(const char *name) {
|
||||||
"subsystem",
|
"subsystem",
|
||||||
"module",
|
"module",
|
||||||
};
|
};
|
||||||
unsigned int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(skip); i++)
|
for (i = 0; i < ELEMENTSOF(skip); i++)
|
||||||
if (streq(name, skip[i]))
|
if (streq(name, skip[i]))
|
||||||
|
|
Loading…
Reference in New Issue