Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bbonev committed Apr 6, 2022
1 parent db3e14b commit dce2732
Show file tree
Hide file tree
Showing 33 changed files with 105 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/ata_id/ata_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs
* Returns: 0 if the data was successfully obtained, otherwise
* non-zero with errno set.
*/
static int disk_identify(struct udev *udev,
static int disk_identify(struct udev *udev __attribute__((unused)),
int fd,
uint8_t out_identify[512],
int *out_is_packet_device)
Expand Down
18 changes: 9 additions & 9 deletions src/cdrom_id/cdrom_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static bool is_mounted(const char *device)
return mounted;
}

static void info_scsi_cmd_err(struct udev *udev, const char *cmd, int err)
static void info_scsi_cmd_err(struct udev *udev __attribute__((unused)), const char *cmd, int err)
{
if (err == -1) {
log_debug("%s failed", cmd);
Expand All @@ -144,7 +144,7 @@ struct scsi_cmd {
struct sg_io_hdr sg_io;
};

static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd)
static void scsi_cmd_init(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd)
{
memzero(cmd, sizeof(struct scsi_cmd));
cmd->cgc.quiet = 1;
Expand All @@ -156,15 +156,15 @@ static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd)
cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO;
}

static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg)
static void scsi_cmd_set(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd, size_t i, unsigned char arg)
{
cmd->sg_io.cmd_len = i + 1;
cmd->cgc.cmd[i] = arg;
}

#define CHECK_CONDITION 0x01

static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize)
static int scsi_cmd_run(struct udev *udev __attribute__((unused)), struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize)
{
int ret = 0;

Expand All @@ -190,7 +190,7 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne
return ret;
}

static int media_lock(struct udev *udev, int fd, bool lock)
static int media_lock(struct udev *udev __attribute__((unused)), int fd, bool lock)
{
int err;

Expand Down Expand Up @@ -223,7 +223,7 @@ static int media_eject(struct udev *udev, int fd)
return 0;
}

static int cd_capability_compat(struct udev *udev, int fd)
static int cd_capability_compat(struct udev *udev __attribute__((unused)), int fd)
{
int capability;

Expand All @@ -250,7 +250,7 @@ static int cd_capability_compat(struct udev *udev, int fd)
return 0;
}

static int cd_media_compat(struct udev *udev, int fd)
static int cd_media_compat(struct udev *udev __attribute__((unused)), int fd)
{
if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) {
log_debug("CDROM_DRIVE_STATUS != CDS_DISC_OK");
Expand Down Expand Up @@ -285,7 +285,7 @@ static int cd_inquiry(struct udev *udev, int fd)
return 0;
}

static void feature_profile_media(struct udev *udev, int cur_profile)
static void feature_profile_media(struct udev *udev __attribute__((unused)), int cur_profile)
{
switch (cur_profile) {
case 0x03:
Expand Down Expand Up @@ -394,7 +394,7 @@ static void feature_profile_media(struct udev *udev, int cur_profile)
}
}

static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size)
static int feature_profiles(struct udev *udev __attribute__((unused)), const unsigned char *profiles, size_t size)
{
unsigned int i;

Expand Down
2 changes: 1 addition & 1 deletion src/collect/collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *node)
return container_of(node, struct _mate, node);
}

noreturn static void sig_alrm(int signo)
noreturn static void sig_alrm(int signo __attribute__((unused)))
{
exit(4);
}
Expand Down
4 changes: 2 additions & 2 deletions src/libudev/libudev-enumerate.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static int syspath_cmp(const void *p1, const void *p2)
}

/* For devices that should be moved to the absolute end of the list */
static bool devices_delay_end(struct udev *udev, const char *syspath)
static bool devices_delay_end(struct udev *udev __attribute__((unused)), const char *syspath)
{
static const char *delay_device_list[] = {
"/block/md",
Expand All @@ -234,7 +234,7 @@ static bool devices_delay_end(struct udev *udev, const char *syspath)
/* For devices that should just be moved a little bit later, just
* before the point where some common path prefix changes. Returns the
* number of characters that make up that common prefix */
static size_t devices_delay_later(struct udev *udev, const char *syspath)
static size_t devices_delay_later(struct udev *udev __attribute__((unused)), const char *syspath)
{
const char *c;

Expand Down
2 changes: 1 addition & 1 deletion src/libudev/libudev-hwdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
*
* 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 int flags __attribute__((unused))) {
int err;

if (!hwdb || !hwdb->f) {
Expand Down
2 changes: 1 addition & 1 deletion src/libudev/libudev-monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev)
}

/* we consider udev running when /dev is on devtmpfs */
static bool udev_has_devtmpfs(struct udev *udev) {
__attribute__((unused)) static bool udev_has_devtmpfs(struct udev *udev __attribute__((unused))) {

union file_handle_union h = FILE_HANDLE_INIT;
_cleanup_fclose_ FILE *f = NULL;
Expand Down
14 changes: 7 additions & 7 deletions src/libudev/libudev-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ _public_ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue)
*
* Returns: 0.
**/
_public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue)
_public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue __attribute__((unused)))
{
return 0;
}
Expand All @@ -152,7 +152,7 @@ _public_ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *
*
* Returns: 0.
**/
_public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue)
_public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue __attribute__((unused)))
{
return 0;
}
Expand All @@ -165,7 +165,7 @@ _public_ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *ud
*
* Returns: a flag indicating if udev is active.
**/
_public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
_public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue __attribute__((unused)))
{
return access(UDEV_ROOT_RUN "/udev/control", F_OK) >= 0;
}
Expand All @@ -178,7 +178,7 @@ _public_ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue)
*
* Returns: a flag indicating if udev is currently handling events.
**/
_public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
_public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue __attribute__((unused)))
{
return access(UDEV_ROOT_RUN "/udev/queue", F_OK) < 0;
}
Expand All @@ -195,7 +195,7 @@ _public_ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue)
* Returns: a flag indicating if udev is currently handling events.
**/
_public_ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
unsigned long long int start, unsigned long long int end)
unsigned long long int start __attribute__((unused)), unsigned long long int end __attribute__((unused)))
{
return udev_queue_get_queue_is_empty(udev_queue);
}
Expand All @@ -210,7 +210,7 @@ _public_ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_
*
* Returns: a flag indicating if udev is currently handling events.
**/
_public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum)
_public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum __attribute__((unused)))
{
return udev_queue_get_queue_is_empty(udev_queue);
}
Expand All @@ -223,7 +223,7 @@ _public_ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, un
*
* Returns: NULL.
**/
_public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue)
_public_ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue __attribute__((unused)))
{
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libudev/libudev-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
return 0;
}

ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size)
ssize_t util_get_sys_core_link_value(struct udev *udev __attribute__((unused)), const char *slink, const char *syspath, char *value, size_t size)
{
char path[UTIL_PATH_SIZE];
char target[UTIL_PATH_SIZE];
Expand All @@ -130,7 +130,7 @@ ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const
return strscpy(value, size, pos);
}

int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
int util_resolve_sys_link(struct udev *udev __attribute__((unused)), char *syspath, size_t size)
{
char link_target[UTIL_PATH_SIZE];

Expand Down
8 changes: 4 additions & 4 deletions src/libudev/libudev.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ _public_ struct udev *udev_unref(struct udev *udev) {
* This function is deprecated.
*
**/
_public_ void udev_set_log_fn(struct udev *udev,
_public_ void udev_set_log_fn(struct udev *udev __attribute__((unused)),
void (*log_fn)(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, va_list args)) {
const char *format, va_list args) __attribute__((unused))) {
return;
}

Expand All @@ -235,7 +235,7 @@ _public_ void udev_set_log_fn(struct udev *udev,
* This function is deprecated.
*
**/
_public_ int udev_get_log_priority(struct udev *udev) {
_public_ int udev_get_log_priority(struct udev *udev __attribute__((unused))) {
return log_get_max_level();
}

Expand All @@ -247,6 +247,6 @@ _public_ int udev_get_log_priority(struct udev *udev) {
* This function is deprecated.
*
**/
_public_ void udev_set_log_priority(struct udev *udev, int priority) {
_public_ void udev_set_log_priority(struct udev *udev __attribute__((unused)), int priority) {
log_set_max_level(priority);
}
6 changes: 3 additions & 3 deletions src/scsi_id/scsi_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static int argc_count(char *opts)
*
* vendor and model can end in '\n'.
*/
static int get_file_options(struct udev *udev,
static int get_file_options(struct udev *udev __attribute__((unused)),
const char *vendor, const char *model,
int *argc, char ***newargv)
{
Expand Down Expand Up @@ -320,7 +320,7 @@ static void help(void) {

}

static int set_options(struct udev *udev,
static int set_options(struct udev *udev __attribute__((unused)),
int argc, char **argv,
char *maj_min_dev)
{
Expand Down Expand Up @@ -410,7 +410,7 @@ static int set_options(struct udev *udev,
}

static int per_dev_options(struct udev *udev,
struct scsi_id_device *dev_scsi, int *good_bad, int *page_code)
struct scsi_id_device *dev_scsi __attribute__((unused)), int *good_bad, int *page_code)
{
int retval;
int newargc;
Expand Down
16 changes: 8 additions & 8 deletions src/scsi_id/scsi_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ static int do_scsi_page80_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd,
char *serial, char *serial_short, int max_len);

static int sg_err_category_new(struct udev *udev,
int scsi_status, int msg_status, int
static int sg_err_category_new(struct udev *udev __attribute__((unused)),
int scsi_status, int msg_status __attribute__((unused)), int
host_status, int driver_status, const
unsigned char *sense_buffer, int sb_len)
{
Expand Down Expand Up @@ -169,7 +169,7 @@ static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) {
hp->response_len);
}

static int scsi_dump_sense(struct udev *udev,
static int scsi_dump_sense(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi,
unsigned char *sense_buffer, int sb_len) {
int s;
Expand Down Expand Up @@ -449,7 +449,7 @@ static int append_vendor_model(
* check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill
* serial number.
*/
static int check_fill_0x83_id(struct udev *udev,
static int check_fill_0x83_id(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi,
unsigned char *page_83,
const struct scsi_id_search_values
Expand Down Expand Up @@ -560,11 +560,11 @@ static int check_fill_0x83_id(struct udev *udev,
}

/* Extract the raw binary from VPD 0x83 pre-SPC devices */
static int check_fill_0x83_prespc3(struct udev *udev,
struct scsi_id_device *dev_scsi,
static int check_fill_0x83_prespc3(struct udev *udev __attribute__((unused)),
struct scsi_id_device *dev_scsi __attribute__((unused)),
unsigned char *page_83,
const struct scsi_id_search_values
*id_search, char *serial, char *serial_short, int max_len) {
*id_search __attribute__((unused)), char *serial, char *serial_short, int max_len) {
int i, j;

serial[0] = hex_str[SCSI_ID_NAA];
Expand Down Expand Up @@ -674,7 +674,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
*/
static int do_scsi_page83_prespc3_inquiry(struct udev *udev,
struct scsi_id_device *dev_scsi, int fd,
char *serial, char *serial_short, int len) {
char *serial, char *serial_short __attribute__((unused)), int len __attribute__((unused))) {
int retval;
int i, j;
unsigned char page_83[SCSI_INQ_BUFF_LEN];
Expand Down
2 changes: 2 additions & 0 deletions src/shared/MurmurHash2.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ uint32_t MurmurHash2 ( const void * key, int len, uint32_t seed )
switch(len)
{
case 3: h ^= data[2] << 16;
// fall through
case 2: h ^= data[1] << 8;
// fall through
case 1: h ^= data[0];
h *= m;
};
Expand Down
32 changes: 16 additions & 16 deletions src/shared/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ void log_set_max_level(int level) {

static int write_to_console(
int level,
int error,
int error __attribute__((unused)),
const char *file,
int line,
const char *func,
const char *object_field,
const char *object,
const char *func __attribute__((unused)),
const char *object_field __attribute__((unused)),
const char *object __attribute__((unused)),
const char *buffer) {

char location[64], prefix[1 + DECIMAL_STR_MAX(int) + 2];
Expand Down Expand Up @@ -299,12 +299,12 @@ static int write_to_console(

static int write_to_syslog(
int level,
int error,
const char *file,
int line,
const char *func,
const char *object_field,
const char *object,
int error __attribute__((unused)),
const char *file __attribute__((unused)),
int line __attribute__((unused)),
const char *func __attribute__((unused)),
const char *object_field __attribute__((unused)),
const char *object __attribute__((unused)),
const char *buffer) {

char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_time[64], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];
Expand Down Expand Up @@ -362,12 +362,12 @@ static int write_to_syslog(

static int write_to_kmsg(
int level,
int error,
const char*file,
int line,
const char *func,
const char *object_field,
const char *object,
int error __attribute__((unused)),
const char *file __attribute__((unused)),
int line __attribute__((unused)),
const char *func __attribute__((unused)),
const char *object_field __attribute__((unused)),
const char *object __attribute__((unused)),
const char *buffer) {

char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];
Expand Down
2 changes: 1 addition & 1 deletion src/shared/mkdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mk

char buf[PATH_MAX + 1];
p = buf;
assert(e-path < sizeof(buf));
assert(e-path < (ssize_t)sizeof(buf));
memcpy(buf, path, e-path);
buf[e-path] = 0;

Expand Down
Loading

0 comments on commit dce2732

Please sign in to comment.