tree-wide: replace 'unsigned int' with 'unsigned'

This commit is contained in:
Yu Watanabe 2018-10-20 03:00:46 +09:00 committed by Lennart Poettering
parent 347a19343c
commit 14cb109d45
48 changed files with 179 additions and 179 deletions

View File

@ -808,9 +808,9 @@ static int analyze_plot(int argc, char *argv[], void *userdata) {
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) {
unsigned int i;
unsigned i;
char ts[FORMAT_TIMESPAN_MAX], ts2[FORMAT_TIMESPAN_MAX];
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;
}
static int list_dependencies_one(sd_bus *bus, const char *name, unsigned int level, char ***units,
unsigned int branches) {
static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level, char ***units,
unsigned branches) {
_cleanup_strv_free_ char **deps = NULL;
char **c;
int r = 0;

View File

@ -150,7 +150,7 @@ void barrier_destroy(Barrier *b) {
* Note that barriers could be supported without fork() or clone(). However,
* 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;
assert(b);

View File

@ -41,7 +41,7 @@ void barrier_destroy(Barrier *b);
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_abort(Barrier *b);

View File

@ -43,7 +43,7 @@ static ssize_t try_copy_file_range(
int fd_in, loff_t *off_in,
int fd_out, loff_t *off_out,
size_t len,
unsigned int flags) {
unsigned flags) {
static int have = -1;
ssize_t r;

View File

@ -335,7 +335,7 @@ static inline int __coverity_check__(int condition) {
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#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 PTR_TO_LONG(p) ((long) ((intptr_t) (p)))

View File

@ -95,7 +95,7 @@ int kmod_setup(void) {
{ "virtio_rng", NULL, false, false, has_virtio_rng },
};
_cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
unsigned int i;
unsigned i;
if (have_effective_cap(CAP_SYS_MODULE) == 0)
return 0;

View File

@ -86,7 +86,7 @@ struct sd_dhcp_client {
uint32_t mtu;
uint32_t xid;
usec_t start_time;
unsigned int attempt;
unsigned attempt;
usec_t request_sent;
sd_event_source *timeout_t1;
sd_event_source *timeout_t2;

View File

@ -293,7 +293,7 @@ static void test_ra(void) {
sd_event *e;
sd_radv *ra;
usec_t time_now = now(clock_boottime_or_monotonic());
unsigned int i;
unsigned i;
printf("* %s\n", __FUNCTION__);

View File

@ -164,7 +164,7 @@ static int add_subtree_to_set(
sd_bus *bus,
const char *prefix,
struct node *n,
unsigned int flags,
unsigned flags,
Set *s,
sd_bus_error *error) {
@ -213,7 +213,7 @@ static int get_child_nodes(
sd_bus *bus,
const char *prefix,
struct node *n,
unsigned int flags,
unsigned flags,
Set **_s,
sd_bus_error *error) {

View File

@ -752,7 +752,7 @@ static int netlink_container_parse(sd_netlink_message *m,
struct netlink_container *container,
int count,
struct rtattr *rta,
unsigned int rt_len) {
unsigned rt_len) {
_cleanup_free_ struct netlink_attribute *attributes = NULL;
attributes = new0(struct netlink_attribute, count);

View File

@ -100,7 +100,7 @@ DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(struct udev_hwdb, udev_hwdb, udev_hwdb_free
*
* 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;
struct udev_list_entry *e;

View File

@ -100,12 +100,12 @@ static void udev_list_entry_insert_before(struct udev_list_entry *new, struct ud
/* binary search in sorted array */
static int list_search(struct udev_list *list, const char *name)
{
unsigned int first, last;
unsigned first, last;
first = 0;
last = list->entries_cur;
while (first < last) {
unsigned int i;
unsigned i;
int cmp;
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 */
if (list->entries_cur >= list->entries_max) {
struct udev_list_entry **entries;
unsigned int add;
unsigned add;
add = list->entries_max;
if (add < 1)
@ -184,7 +184,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
i = (-i)-1;
/* 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]);
else
udev_list_entry_append(entry, list);

View File

@ -66,8 +66,8 @@ struct udev_list {
struct udev *udev;
struct udev_list_node node;
struct udev_list_entry **entries;
unsigned int entries_cur;
unsigned int entries_max;
unsigned entries_cur;
unsigned entries_max;
bool unique;
};
void udev_list_node_init(struct udev_list_node *list);

View File

@ -173,7 +173,7 @@ struct udev_hwdb;
struct udev_hwdb *udev_hwdb_new(struct udev *udev);
struct udev_hwdb *udev_hwdb_ref(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

View File

@ -347,7 +347,7 @@ typedef struct SessionStatusInfo {
uid_t uid;
const char *name;
struct dual_timestamp timestamp;
unsigned int vtnr;
unsigned vtnr;
const char *seat;
const char *tty;
const char *display;

View File

@ -498,7 +498,7 @@ int config_parse_n_autovts(
return 0;
}
static int vt_is_busy(unsigned int vtnr) {
static int vt_is_busy(unsigned vtnr) {
struct vt_stat vt_stat;
int r = 0;
_cleanup_close_ int fd;
@ -526,9 +526,9 @@ static int vt_is_busy(unsigned int vtnr) {
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;
char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned int)];
char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned)];
int r;
assert(m);

View File

@ -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) {
Seat *s = userdata;
unsigned int to;
unsigned to;
int r;
assert(message);

View File

@ -166,8 +166,8 @@ int seat_load(Seat *s) {
return 0;
}
static int vt_allocate(unsigned int vtnr) {
char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
static int vt_allocate(unsigned vtnr) {
char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned)];
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
@ -265,7 +265,7 @@ int seat_set_active(Seat *s, Session *session) {
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
* will get reassigned in the future, so return error for now. */
if (num == 0)
@ -283,7 +283,7 @@ int seat_switch_to(Seat *s, unsigned int num) {
}
int seat_switch_to_next(Seat *s) {
unsigned int start, i;
unsigned start, i;
if (s->position_count == 0)
return -EINVAL;
@ -304,7 +304,7 @@ int seat_switch_to_next(Seat *s) {
}
int seat_switch_to_previous(Seat *s) {
unsigned int start, i;
unsigned start, i;
if (s->position_count == 0)
return -EINVAL;
@ -324,7 +324,7 @@ int seat_switch_to_previous(Seat *s) {
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;
int r;
@ -459,7 +459,7 @@ int seat_stop_sessions(Seat *s, bool force) {
void seat_evict_position(Seat *s, Session *session) {
Session *iter;
unsigned int pos = session->position;
unsigned pos = session->position;
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 */
if (seat_has_vts(s))
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) {
unsigned int pos;
unsigned pos;
if (session->position > 0)
return;

View File

@ -37,17 +37,17 @@ int seat_load(Seat *s);
int seat_apply_acls(Seat *s, Session *old_active);
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_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_preallocate_vts(Seat *s);
int seat_attach_session(Seat *s, Session *session);
void seat_complete_switch(Seat *s);
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_is_seat0(Seat *s);

View File

@ -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;
SessionDevice *sd;
Iterator i;

View File

@ -33,7 +33,7 @@ void session_device_complete_pause(SessionDevice *sd);
void session_device_resume_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);
void session_device_attach_fd(SessionDevice *sd, int fd, bool active);

View File

@ -483,7 +483,7 @@ int session_load(Session *s) {
s->vtnr = 0;
if (position && s->seat) {
unsigned int npos;
unsigned npos;
safe_atou(position, &npos);
seat_claim_position(s->seat, s, npos);
@ -580,7 +580,7 @@ int session_load(Session *s) {
}
int session_activate(Session *s) {
unsigned int num_pending;
unsigned num_pending;
assert(s);
assert(s->user);

View File

@ -58,7 +58,7 @@ struct Session {
Manager *manager;
const char *id;
unsigned int position;
unsigned position;
SessionType type;
SessionClass class;
@ -82,7 +82,7 @@ struct Session {
char *scope_job;
Seat *seat;
unsigned int vtnr;
unsigned vtnr;
int vtfd;
pid_t leader;

View File

@ -24,7 +24,7 @@
_const_ static usec_t when_wall(usec_t n, usec_t elapse) {
usec_t left;
unsigned int i;
unsigned i;
static const int wall_timers[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
25, 40, 55, 70, 100, 130, 150, 180,

View File

@ -343,7 +343,7 @@ static int manager_enumerate_users(Manager *m) {
static int parse_fdname(const char *fdname, char **session_id, dev_t *dev) {
_cleanup_strv_free_ char **parts = NULL;
_cleanup_free_ char *id = NULL;
unsigned int major, minor;
unsigned major, minor;
int r;
parts = strv_split(fdname, "-");

View File

@ -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_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);

View File

@ -41,7 +41,7 @@ static WireguardPeer *wireguard_peer_new(Wireguard *w, unsigned section) {
static int set_wireguard_interface(NetDev *netdev) {
int r;
unsigned int i, j;
unsigned i, j;
WireguardPeer *peer, *peer_start;
WireguardIPmask *mask, *mask_start = NULL;
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;

View File

@ -897,7 +897,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
return r;
if (all || n > 0) {
unsigned int i;
unsigned i;
if (!value)
printf("%s=", name);
@ -919,7 +919,7 @@ static int bus_print_property(const char *name, const char *expected_value, sd_b
return r;
if (all || n > 0) {
unsigned int i;
unsigned i;
if (!value)
printf("%s=", name);

View File

@ -1480,7 +1480,7 @@ int seccomp_restrict_realtime(void) {
static int add_seccomp_syscall_filter(scmp_filter_ctx seccomp,
uint32_t arch,
int nr,
unsigned int arg_cnt,
unsigned arg_cnt,
const struct scmp_arg_cmp arg) {
int r;

View File

@ -1563,7 +1563,7 @@ static int list_unit_files(int argc, char *argv[], void *userdata) {
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;
size_t max_len = MAX(columns(),20u);
size_t len = 0;
@ -1689,7 +1689,7 @@ static int list_dependencies_one(
const char *name,
int level,
char ***units,
unsigned int branches) {
unsigned branches) {
_cleanup_strv_free_ char **deps = NULL;
char **c;

View File

@ -16,7 +16,7 @@ static const struct af_name* lookup_af(register const char *str, register GPERF_
int main(int argc, const char *argv[]) {
unsigned int i;
unsigned i;
for (i = 0; i < ELEMENTSOF(af_names); i++) {
if (af_names[i]) {

View File

@ -16,7 +16,7 @@ static const struct arphrd_name* lookup_arphrd(register const char *str, registe
int main(int argc, const char *argv[]) {
unsigned int i;
unsigned i;
for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
if (arphrd_names[i]) {

View File

@ -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) {
unsigned int i, idx_cur, idx_new, idx_min;
unsigned i, idx_cur, idx_new, idx_min;
double jitter;
double j;

View File

@ -71,7 +71,7 @@ struct Manager {
double offset;
double delay;
} samples[8];
unsigned int samples_idx;
unsigned samples_idx;
double samples_jitter;
usec_t max_root_distance_usec;

View File

@ -257,12 +257,12 @@ static int disk_identify_packet_device_command(
*/
static void disk_identify_get_string(
uint8_t identify[512],
unsigned int offset_words,
unsigned offset_words,
char *dest,
size_t dest_len) {
unsigned int c1;
unsigned int c2;
unsigned c1;
unsigned c2;
while (dest_len > 0) {
c1 = identify[offset_words * 2 + 1];
@ -278,13 +278,13 @@ static void disk_identify_get_string(
static void disk_identify_fixup_string(
uint8_t identify[512],
unsigned int offset_words,
unsigned offset_words,
size_t len) {
disk_identify_get_string(identify, offset_words,
(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;
p = (uint16_t *) identify;

View File

@ -26,58 +26,58 @@
#include "util.h"
/* device info */
static unsigned int cd_cd_rom;
static unsigned int cd_cd_r;
static unsigned int cd_cd_rw;
static unsigned int cd_dvd_rom;
static unsigned int cd_dvd_r;
static unsigned int cd_dvd_rw;
static unsigned int cd_dvd_ram;
static unsigned int cd_dvd_plus_r;
static unsigned int cd_dvd_plus_rw;
static unsigned int cd_dvd_plus_r_dl;
static unsigned int cd_dvd_plus_rw_dl;
static unsigned int cd_bd;
static unsigned int cd_bd_r;
static unsigned int cd_bd_re;
static unsigned int cd_hddvd;
static unsigned int cd_hddvd_r;
static unsigned int cd_hddvd_rw;
static unsigned int cd_mo;
static unsigned int cd_mrw;
static unsigned int cd_mrw_w;
static unsigned cd_cd_rom;
static unsigned cd_cd_r;
static unsigned cd_cd_rw;
static unsigned cd_dvd_rom;
static unsigned cd_dvd_r;
static unsigned cd_dvd_rw;
static unsigned cd_dvd_ram;
static unsigned cd_dvd_plus_r;
static unsigned cd_dvd_plus_rw;
static unsigned cd_dvd_plus_r_dl;
static unsigned cd_dvd_plus_rw_dl;
static unsigned cd_bd;
static unsigned cd_bd_r;
static unsigned cd_bd_re;
static unsigned cd_hddvd;
static unsigned cd_hddvd_r;
static unsigned cd_hddvd_rw;
static unsigned cd_mo;
static unsigned cd_mrw;
static unsigned cd_mrw_w;
/* media info */
static unsigned int cd_media;
static unsigned int cd_media_cd_rom;
static unsigned int cd_media_cd_r;
static unsigned int cd_media_cd_rw;
static unsigned int cd_media_dvd_rom;
static unsigned int cd_media_dvd_r;
static unsigned int cd_media_dvd_rw;
static unsigned int cd_media_dvd_rw_ro; /* restricted overwrite mode */
static unsigned int cd_media_dvd_rw_seq; /* sequential mode */
static unsigned int cd_media_dvd_ram;
static unsigned int cd_media_dvd_plus_r;
static unsigned int cd_media_dvd_plus_rw;
static unsigned int cd_media_dvd_plus_r_dl;
static unsigned int cd_media_dvd_plus_rw_dl;
static unsigned int cd_media_bd;
static unsigned int cd_media_bd_r;
static unsigned int cd_media_bd_re;
static unsigned int cd_media_hddvd;
static unsigned int cd_media_hddvd_r;
static unsigned int cd_media_hddvd_rw;
static unsigned int cd_media_mo;
static unsigned int cd_media_mrw;
static unsigned int cd_media_mrw_w;
static unsigned cd_media;
static unsigned cd_media_cd_rom;
static unsigned cd_media_cd_r;
static unsigned cd_media_cd_rw;
static unsigned cd_media_dvd_rom;
static unsigned cd_media_dvd_r;
static unsigned cd_media_dvd_rw;
static unsigned cd_media_dvd_rw_ro; /* restricted overwrite mode */
static unsigned cd_media_dvd_rw_seq; /* sequential mode */
static unsigned cd_media_dvd_ram;
static unsigned cd_media_dvd_plus_r;
static unsigned cd_media_dvd_plus_rw;
static unsigned cd_media_dvd_plus_r_dl;
static unsigned cd_media_dvd_plus_rw_dl;
static unsigned cd_media_bd;
static unsigned cd_media_bd_r;
static unsigned cd_media_bd_re;
static unsigned cd_media_hddvd;
static unsigned cd_media_hddvd_r;
static unsigned cd_media_hddvd_rw;
static unsigned cd_media_mo;
static unsigned cd_media_mrw;
static unsigned cd_media_mrw_w;
static const char *cd_media_state = NULL;
static unsigned int cd_media_session_next;
static unsigned int cd_media_session_count;
static unsigned int cd_media_track_count;
static unsigned int cd_media_track_count_data;
static unsigned int cd_media_track_count_audio;
static unsigned cd_media_session_next;
static unsigned cd_media_session_count;
static unsigned cd_media_track_count;
static unsigned cd_media_track_count_data;
static unsigned cd_media_track_count_audio;
static unsigned long long int cd_media_session_last_offset;
#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) {
unsigned int i;
unsigned i;
for (i = 0; i+4 <= size; i += 4) {
int profile;
@ -498,9 +498,9 @@ static int cd_profiles_old_mmc(int fd) {
static int cd_profiles(int fd) {
struct scsi_cmd sc;
unsigned char features[65530];
unsigned int cur_profile = 0;
unsigned int len;
unsigned int i;
unsigned cur_profile = 0;
unsigned len;
unsigned i;
int err;
int ret;
@ -564,7 +564,7 @@ static int cd_profiles(int fd) {
/* device features */
for (i = 8; i+4 < len; i += (4 + features[i+3])) {
unsigned int feature;
unsigned feature;
feature = features[i] << 8 | features[i+1];
@ -738,7 +738,7 @@ static int cd_media_toc(int fd) {
struct scsi_cmd sc;
unsigned char header[12];
unsigned char toc[65536];
unsigned int len, i, num_tracks;
unsigned len, i, num_tracks;
unsigned char *p;
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 last track number is invalidly large */
for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) {
unsigned int block;
unsigned int is_data_track;
unsigned block;
unsigned is_data_track;
is_data_track = (p[1] & 0x04) != 0;

View File

@ -119,7 +119,7 @@ int ethtool_get_driver(int *fd, const char *ifname, char **ret) {
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 = {
.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;
__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
} ecmd = {};
unsigned int offset;
unsigned offset;
int r;
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)

View File

@ -101,7 +101,7 @@ typedef struct netdev_channels {
int ethtool_connect(int *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_features(int *fd, const char *ifname, int *features);
int ethtool_set_glinksettings(int *fd, const char *ifname, struct link_config *link);

View File

@ -16,8 +16,8 @@
#include <scsi/scsi.h>
struct scsi_ioctl_command {
unsigned int inlen; /* excluding scsi command length */
unsigned int outlen;
unsigned inlen; /* excluding scsi command length */
unsigned outlen;
unsigned char data[1];
/* on input, scsi command starts here then opt. data */
};

View File

@ -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,
unsigned char evpd, unsigned char page,
unsigned char *buf, unsigned int buflen) {
unsigned char *buf, unsigned buflen) {
unsigned char inq_cmd[INQUIRY_CMDLEN] =
{ INQUIRY_CMD, evpd, page, 0, buflen, 0 };
unsigned char sense[SENSE_BUFF_LEN];
@ -359,7 +359,7 @@ error:
/* Get list of supported EVPD pages */
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;
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) {
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);
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 *wwn_vendor_extension, char *tgpt_group) {
int retval;
unsigned int id_ind, j;
unsigned id_ind, j;
unsigned char page_83[SCSI_INQ_BUFF_LEN];
/* 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
* 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],
&id_search_list[id_ind],
serial, serial_short, len,

View File

@ -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) {
struct udev_device *bcmadev;
unsigned int core;
unsigned core;
assert(dev);
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) {
const char *s;
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
* that are impossible to use in an iface name.

View File

@ -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) {
const char *str;
unsigned int controller, disk;
unsigned controller, disk;
str = udev_device_get_sysname(parent);
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) {
const char *sysname;
unsigned int core;
unsigned core;
sysname = udev_device_get_sysname(parent);
if (sscanf(sysname, "bcma%*u:%u", &core) != 1)

View File

@ -31,7 +31,7 @@ static const struct udev_builtin *builtins[] = {
};
void udev_builtin_init(void) {
unsigned int i;
unsigned i;
if (initialized)
return;
@ -44,7 +44,7 @@ void udev_builtin_init(void) {
}
void udev_builtin_exit(void) {
unsigned int i;
unsigned i;
if (!initialized)
return;
@ -57,7 +57,7 @@ void udev_builtin_exit(void) {
}
bool udev_builtin_validate(void) {
unsigned int i;
unsigned i;
for (i = 0; i < ELEMENTSOF(builtins); i++)
if (builtins[i] && builtins[i]->validate && builtins[i]->validate())
@ -66,7 +66,7 @@ bool udev_builtin_validate(void) {
}
void udev_builtin_list(void) {
unsigned int i;
unsigned i;
for (i = 0; i < ELEMENTSOF(builtins); i++)
if (builtins[i])

View File

@ -41,7 +41,7 @@ enum udev_ctrl_msg_type {
struct udev_ctrl_msg_wire {
char version[16];
unsigned int magic;
unsigned magic;
enum udev_ctrl_msg_type type;
union {
int intval;

View File

@ -322,7 +322,7 @@ size_t udev_event_apply_format(struct udev_event *event,
while (from[0] != '\0') {
if (from[0] == '$') {
/* substitute named variable */
unsigned int i;
unsigned i;
if (from[1] == '$') {
from++;
@ -338,7 +338,7 @@ size_t udev_event_apply_format(struct udev_event *event,
}
} else if (from[0] == '%') {
/* substitute format char */
unsigned int i;
unsigned i;
if (from[1] == '%') {
from++;
@ -367,7 +367,7 @@ copy:
subst:
/* extract possible $format{attr} */
if (from[0] == '{') {
unsigned int i;
unsigned i;
from++;
for (i = 0; from[i] != '}'; i++)

View File

@ -38,7 +38,7 @@
#define PREALLOC_TOKEN 2048
struct uid_gid {
unsigned int name_off;
unsigned name_off;
union {
uid_t uid;
gid_t gid;
@ -58,26 +58,26 @@ struct udev_rules {
/* every key in the rules file becomes a token */
struct token *tokens;
unsigned int token_cur;
unsigned int token_max;
unsigned token_cur;
unsigned token_max;
/* all key strings are copied and de-duplicated in a single continuous string buffer */
struct strbuf *strbuf;
/* during rule parsing, uid/gid lookup results are cached */
struct uid_gid *uids;
unsigned int uids_cur;
unsigned int uids_max;
unsigned uids_cur;
unsigned uids_max;
struct uid_gid *gids;
unsigned int gids_cur;
unsigned int gids_max;
unsigned gids_cur;
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;
}
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));
}
@ -182,9 +182,9 @@ struct token {
enum token_type type:8;
bool can_set_name:1;
bool has_static_node:1;
unsigned int unused:6;
unsigned unused:6;
unsigned short token_count;
unsigned int label_off;
unsigned label_off;
unsigned short filename_off;
unsigned short filename_line;
} rule;
@ -194,10 +194,10 @@ struct token {
enum string_glob_type glob:8;
enum string_subst_type subst:4;
enum string_subst_type attrsubst:4;
unsigned int value_off;
unsigned value_off;
union {
unsigned int attr_off;
unsigned int rule_goto;
unsigned attr_off;
unsigned rule_goto;
mode_t mode;
uid_t uid;
gid_t gid;
@ -214,7 +214,7 @@ struct rule_tmp {
struct udev_rules *rules;
struct token rule;
struct token token[MAX_TK];
unsigned int token_cur;
unsigned token_cur;
};
#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 *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'",
&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) {
unsigned int i;
unsigned i;
log_debug("dumping %u (%zu bytes) tokens, %zu (%zu bytes) strings",
rules->token_cur,
@ -444,7 +444,7 @@ static int add_token(struct udev_rules *rules, struct token *token) {
/* grow buffer if needed */
if (rules->token_cur+1 >= rules->token_max) {
struct token *tokens;
unsigned int add;
unsigned add;
/* double the buffer size */
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) {
unsigned int i;
unsigned i;
uid_t uid = 0;
unsigned int off;
unsigned off;
int r;
/* 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 */
if (rules->uids_cur+1 >= rules->uids_max) {
struct uid_gid *uids;
unsigned int add;
unsigned add;
/* double the buffer size */
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) {
unsigned int i;
unsigned i;
gid_t gid = 0;
unsigned int off;
unsigned off;
int r;
/* 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 */
if (rules->gids_cur+1 >= rules->gids_max) {
struct uid_gid *gids;
unsigned int add;
unsigned add;
/* double the buffer size */
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) {
unsigned int i;
unsigned int start = 0;
unsigned int end = rule_tmp->token_cur;
unsigned i;
unsigned start = 0;
unsigned end = rule_tmp->token_cur;
for (i = 0; i < rule_tmp->token_cur; i++) {
enum token_type next_val = TK_UNSET;
unsigned int next_idx = 0;
unsigned int j;
unsigned next_idx = 0;
unsigned j;
/* find smallest value */
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; }
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;
const char *attr;
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) {
_cleanup_fclose_ FILE *f = NULL;
unsigned int first_token;
unsigned int filename_off;
unsigned first_token;
unsigned filename_off;
char line[UTIL_LINE_SIZE];
int line_nr = 0;
unsigned int i;
unsigned i;
f = fopen(filename, "re");
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++) {
if (rules->tokens[i].type == TK_A_GOTO) {
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++) {
if (rules->tokens[j].type != TK_RULE)

View File

@ -34,8 +34,8 @@ struct udev_event {
int exec_delay;
usec_t birth_usec;
sd_netlink *rtnl;
unsigned int builtin_run;
unsigned int builtin_ret;
unsigned builtin_run;
unsigned builtin_ret;
bool inotify_watch;
bool inotify_watch_final;
bool group_set;

View File

@ -32,7 +32,7 @@ static bool skip_attribute(const char *name) {
"subsystem",
"module",
};
unsigned int i;
unsigned i;
for (i = 0; i < ELEMENTSOF(skip); i++)
if (streq(name, skip[i]))