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--)
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;
* 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);
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);
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;
#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)))
{ "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;
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;
sd_event *e;
sd_radv *ra;
usec_t time_now = now(clock_boottime_or_monotonic());
- unsigned int i;
+ unsigned i;
printf("* %s\n", __FUNCTION__);
sd_bus *bus,
const char *prefix,
struct node *n,
- unsigned int flags,
+ unsigned flags,
Set *s,
sd_bus_error *error) {
sd_bus *bus,
const char *prefix,
struct node *n,
- unsigned int flags,
+ unsigned flags,
Set **_s,
sd_bus_error *error) {
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);
*
* 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;
/* 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;
/* 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)
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);
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);
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
uid_t uid;
const char *name;
struct dual_timestamp timestamp;
- unsigned int vtnr;
+ unsigned vtnr;
const char *seat;
const char *tty;
const char *display;
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;
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);
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);
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);
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)
}
int seat_switch_to_next(Seat *s) {
- unsigned int start, i;
+ unsigned start, i;
if (s->position_count == 0)
return -EINVAL;
}
int seat_switch_to_previous(Seat *s) {
- unsigned int start, i;
+ unsigned start, i;
if (s->position_count == 0)
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;
int r;
void seat_evict_position(Seat *s, Session *session) {
Session *iter;
- unsigned int pos = session->position;
+ unsigned pos = session->position;
session->position = 0;
}
}
-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;
}
static void seat_assign_position(Seat *s, Session *session) {
- unsigned int pos;
+ unsigned pos;
if (session->position > 0)
return;
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);
}
}
-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;
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);
s->vtnr = 0;
if (position && s->seat) {
- unsigned int npos;
+ unsigned npos;
safe_atou(position, &npos);
seat_claim_position(s->seat, s, npos);
}
int session_activate(Session *s) {
- unsigned int num_pending;
+ unsigned num_pending;
assert(s);
assert(s->user);
Manager *manager;
const char *id;
- unsigned int position;
+ unsigned position;
SessionType type;
SessionClass class;
char *scope_job;
Seat *seat;
- unsigned int vtnr;
+ unsigned vtnr;
int vtfd;
pid_t leader;
_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,
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, "-");
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);
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;
return r;
if (all || n > 0) {
- unsigned int i;
+ unsigned i;
if (!value)
printf("%s=", name);
return r;
if (all || n > 0) {
- unsigned int i;
+ unsigned i;
if (!value)
printf("%s=", name);
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;
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;
const char *name,
int level,
char ***units,
- unsigned int branches) {
+ unsigned branches) {
_cleanup_strv_free_ char **deps = NULL;
char **c;
int main(int argc, const char *argv[]) {
- unsigned int i;
+ unsigned i;
for (i = 0; i < ELEMENTSOF(af_names); i++) {
if (af_names[i]) {
int main(int argc, const char *argv[]) {
- unsigned int i;
+ unsigned i;
for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
if (arphrd_names[i]) {
}
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;
double offset;
double delay;
} samples[8];
- unsigned int samples_idx;
+ unsigned samples_idx;
double samples_jitter;
usec_t max_root_distance_usec;
*/
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];
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;
#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]))
}
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;
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;
/* 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];
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;
* 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;
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
};
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)
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);
#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 */
};
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];
/* 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);
}
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;
}
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 */
* 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,
static int names_bcma(struct udev_device *dev, struct netnames *names) {
struct udev_device *bcmadev;
- unsigned int core;
+ unsigned core;
assert(dev);
assert(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.
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)
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)
};
void udev_builtin_init(void) {
- unsigned int i;
+ unsigned i;
if (initialized)
return;
}
void udev_builtin_exit(void) {
- unsigned int i;
+ unsigned i;
if (!initialized)
return;
}
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())
}
void udev_builtin_list(void) {
- unsigned int i;
+ unsigned i;
for (i = 0; i < ELEMENTSOF(builtins); i++)
if (builtins[i])
struct udev_ctrl_msg_wire {
char version[16];
- unsigned int magic;
+ unsigned magic;
enum udev_ctrl_msg_type type;
union {
int intval;
while (from[0] != '\0') {
if (from[0] == '$') {
/* substitute named variable */
- unsigned int i;
+ unsigned i;
if (from[1] == '$') {
from++;
}
} else if (from[0] == '%') {
/* substitute format char */
- unsigned int i;
+ unsigned i;
if (from[1] == '%') {
from++;
subst:
/* extract possible $format{attr} */
if (from[0] == '{') {
- unsigned int i;
+ unsigned i;
from++;
for (i = 0; from[i] != '}'; i++)
#define PREALLOC_TOKEN 2048
struct uid_gid {
- unsigned int name_off;
+ unsigned name_off;
union {
uid_t uid;
gid_t gid;
/* 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));
}
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;
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;
struct udev_rules *rules;
struct token rule;
struct token token[MAX_TK];
- unsigned int token_cur;
+ unsigned token_cur;
};
#ifdef DEBUG
{
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,
}
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,
/* 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;
}
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 */
/* 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;
}
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 */
/* 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;
}
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++) {
#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 = {
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) {
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)
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;
"subsystem",
"module",
};
- unsigned int i;
+ unsigned i;
for (i = 0; i < ELEMENTSOF(skip); i++)
if (streq(name, skip[i]))