From 65f76edb8f568553a5b4386b0c4917803d47e97d Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Tue, 30 Sep 2014 21:04:09 +0000 Subject: [PATCH] minix libraries: resolve clang warnings Change-Id: I0f3425fb8838708c9848a006f1eee5ab1bad71d2 --- minix/include/minix/audio_fw.h | 4 ++++ minix/include/minix/blockdriver_mt.h | 2 +- minix/include/minix/clkconf.h | 4 ++-- minix/lib/libaudiodriver/Makefile | 3 ++- minix/lib/libaudiodriver/audio_fw.c | 15 +++------------ minix/lib/libbdev/Makefile | 8 ++++---- minix/lib/libbdev/minor.c | 2 +- minix/lib/libblockdriver/Makefile | 8 ++++---- minix/lib/libblockdriver/driver.c | 10 +++++----- minix/lib/libblockdriver/driver_mt.c | 9 +++++---- minix/lib/libblockdriver/trace.c | 6 +++--- minix/lib/libblockdriver/trace.h | 2 +- minix/lib/libchardriver/Makefile | 8 ++++---- minix/lib/libchardriver/chardriver.c | 4 ++-- minix/lib/libclkconf/Makefile | 4 ++-- minix/lib/libdevman/Makefile | 3 ++- minix/lib/libdevman/generic.c | 10 +--------- minix/lib/libdevman/usb.c | 2 +- minix/lib/libexec/exec_elf.c | 4 ++-- minix/lib/libexec/libexec.h | 5 +++-- minix/lib/libfetch/common.h | 3 ++- minix/lib/libfetch/ftp.c | 3 +++ minix/lib/libfetch/http.c | 3 +++ minix/lib/libi2cdriver/Makefile | 5 ++--- minix/lib/libi2cdriver/i2cdriver.c | 7 ++++--- minix/lib/liblwip/Makefile | 1 - minix/lib/liblwip/core/netif.c | 3 ++- minix/lib/liblwip/sys_arch.c | 2 ++ minix/lib/libminixfs/Makefile | 7 ++++--- minix/lib/libminixfs/cache.c | 10 +++++----- minix/lib/libnetdriver/Makefile | 6 +++--- minix/lib/libnetdriver/netdriver.c | 2 +- minix/lib/libnetsock/Makefile | 2 +- minix/lib/libnetsock/socket.c | 4 ++-- minix/lib/libusb/Makefile | 5 +++-- minix/lib/libusb/usb.c | 9 +++++---- minix/lib/libvassert/Makefile | 5 ++--- minix/lib/libvassert/vassert.c | 6 +++--- minix/lib/libvassert/vassert.h | 3 ++- minix/lib/libvirtio/Makefile | 8 ++++---- minix/lib/libvirtio/virtio.c | 2 +- minix/lib/libvirtio/virtio_ring.h | 2 +- minix/lib/libvtreefs/Makefile | 2 -- 43 files changed, 107 insertions(+), 106 deletions(-) diff --git a/minix/include/minix/audio_fw.h b/minix/include/minix/audio_fw.h index 324dbfe81..53c3ee57d 100644 --- a/minix/include/minix/audio_fw.h +++ b/minix/include/minix/audio_fw.h @@ -84,4 +84,8 @@ EXTERN special_file_t special_file[]; #define READ_DMA 1 #define WRITE_DMA 2 +EXTERN int sef_cb_lu_prepare(int state); +EXTERN int sef_cb_lu_state_isvalid(int state); +EXTERN void sef_cb_lu_state_dump(int state); + #endif /* AUDIO_FW_H */ diff --git a/minix/include/minix/blockdriver_mt.h b/minix/include/minix/blockdriver_mt.h index 2b96c505d..3c74515df 100644 --- a/minix/include/minix/blockdriver_mt.h +++ b/minix/include/minix/blockdriver_mt.h @@ -10,7 +10,7 @@ void blockdriver_mt_task(struct blockdriver *driver_tab); void blockdriver_mt_sleep(void); void blockdriver_mt_wakeup(thread_id_t id); void blockdriver_mt_terminate(void); -void blockdriver_mt_set_workers(device_id_t id, int workers); +void blockdriver_mt_set_workers(device_id_t id, unsigned int workers); thread_id_t blockdriver_mt_get_tid(void); #endif /* _MINIX_BLOCKDRIVER_MT_H */ diff --git a/minix/include/minix/clkconf.h b/minix/include/minix/clkconf.h index dc66f4aac..51645221c 100644 --- a/minix/include/minix/clkconf.h +++ b/minix/include/minix/clkconf.h @@ -11,8 +11,8 @@ #define CM_PER_I2C1_CLKCTRL 0x048 #define CM_WKUP_I2C0_CLKCTRL 0x4B8 -int clkconf_init(); +int clkconf_init(void); int clkconf_set(u32_t clk, u32_t mask, u32_t value); -int clkconf_release(); +int clkconf_release(void); #endif diff --git a/minix/lib/libaudiodriver/Makefile b/minix/lib/libaudiodriver/Makefile index c4d84ab0d..545fb7692 100644 --- a/minix/lib/libaudiodriver/Makefile +++ b/minix/lib/libaudiodriver/Makefile @@ -1,6 +1,7 @@ # Makefile for the common audio framework + NOGCCERROR=yes -NOCLANGERROR=yes + CPPFLAGS+= -D_MINIX_SYSTEM LIB= audiodriver diff --git a/minix/lib/libaudiodriver/audio_fw.c b/minix/lib/libaudiodriver/audio_fw.c index ab45e5bb0..39410c985 100644 --- a/minix/lib/libaudiodriver/audio_fw.c +++ b/minix/lib/libaudiodriver/audio_fw.c @@ -58,9 +58,6 @@ static int irq_hook_set = FALSE; static void sef_local_startup(void); static int sef_cb_init_fresh(int type, sef_init_info_t *info); static void sef_cb_signal_handler(int signo); -EXTERN int sef_cb_lu_prepare(int state); -EXTERN int sef_cb_lu_state_isvalid(int state); -EXTERN void sef_cb_lu_state_dump(int state); static struct chardriver audio_tab = { .cdr_open = msg_open, /* open the special file */ @@ -73,9 +70,6 @@ static struct chardriver audio_tab = { int main(void) { - int r, caller; - message mess, repl_mess; - int ipc_status; /* SEF local startup. */ sef_local_startup(); @@ -115,7 +109,7 @@ static void sef_local_startup(void) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) { /* Initialize the audio driver framework. */ - u32_t i; char irq; + int i; char irq; static int executed = 0; sub_dev_t* sub_dev_ptr; @@ -499,7 +493,7 @@ static ssize_t msg_read(devminor_t minor, u64_t UNUSED(position), static void msg_hardware(unsigned int UNUSED(mask)) { - u32_t i; + int i; /* loop over all sub devices */ for ( i = 0; i < drv.NrOfSubDevices; i++) { @@ -579,7 +573,6 @@ static void handle_int_write(int sub_dev_nr) static void handle_int_read(int sub_dev_nr) { sub_dev_t *sub_dev_ptr; - message m; sub_dev_ptr = &sub_dev[sub_dev_nr]; @@ -651,7 +644,6 @@ static int get_started(sub_dev_t *sub_dev_ptr) { static void data_from_user(sub_dev_t *subdev) { int r; - message m; if (subdev->DmaLength == subdev->NrOfDmaFragments && subdev->BufLength == subdev->NrOfExtraBuffers) return;/* no space */ @@ -710,7 +702,6 @@ static void data_from_user(sub_dev_t *subdev) static void data_to_user(sub_dev_t *sub_dev_ptr) { int r; - message m; if (!sub_dev_ptr->RevivePending) return; /* nobody is wating for data */ if (sub_dev_ptr->BufLength == 0 && sub_dev_ptr->DmaLength == 0) return; @@ -793,7 +784,7 @@ static int init_buffers(sub_dev_t *sub_dev_ptr) } if ((left = dma_bytes_left(sub_dev_ptr->DmaPhys)) < - sub_dev_ptr->DmaSize) { + (unsigned int)sub_dev_ptr->DmaSize) { /* First half of buffer crosses a 64K boundary, * can't DMA into that */ sub_dev_ptr->DmaPtr += left; diff --git a/minix/lib/libbdev/Makefile b/minix/lib/libbdev/Makefile index bf0e1c01c..f91e5cae7 100644 --- a/minix/lib/libbdev/Makefile +++ b/minix/lib/libbdev/Makefile @@ -1,10 +1,10 @@ -NOGCCERROR=yes -NOCLANGERROR=yes -CPPFLAGS+= -D_MINIX_SYSTEM - # Makefile for libbdev .include +NOGCCERROR=yes + +CPPFLAGS+= -D_MINIX_SYSTEM + LIB= bdev SRCS= bdev.c driver.c call.c ipc.c minor.c diff --git a/minix/lib/libbdev/minor.c b/minix/lib/libbdev/minor.c index ca827a7a8..ad4f96c43 100644 --- a/minix/lib/libbdev/minor.c +++ b/minix/lib/libbdev/minor.c @@ -59,7 +59,7 @@ int bdev_minor_reopen(dev_t dev) } if (m.m_lblockdriver_lbdev_reply.id != NO_ID) { - printf("bdev: driver (%d) sent invalid ID (%ld)\n", + printf("bdev: driver (%d) sent invalid ID (%d)\n", endpt, m.m_lblockdriver_lbdev_reply.id); return EINVAL; } diff --git a/minix/lib/libblockdriver/Makefile b/minix/lib/libblockdriver/Makefile index e61dc69bc..42b999280 100644 --- a/minix/lib/libblockdriver/Makefile +++ b/minix/lib/libblockdriver/Makefile @@ -1,10 +1,10 @@ -NOGCCERROR=yes -NOCLANGERROR=yes -CPPFLAGS+= -D_MINIX_SYSTEM - # Makefile for libblockdriver .include +NOGCCERROR=yes + +CPPFLAGS+= -D_MINIX_SYSTEM + LIB= blockdriver SRCS= driver.c drvlib.c driver_st.c driver_mt.c mq.c trace.c diff --git a/minix/lib/libblockdriver/driver.c b/minix/lib/libblockdriver/driver.c index a67c76669..0c16b9aeb 100644 --- a/minix/lib/libblockdriver/driver.c +++ b/minix/lib/libblockdriver/driver.c @@ -98,7 +98,7 @@ void blockdriver_announce(int type) int r; char key[DS_MAX_KEYLEN]; char label[DS_MAX_KEYLEN]; - char *driver_prefix = "drv.blk."; + const char *driver_prefix = "drv.blk."; /* Callers are allowed to use ipc_sendrec to communicate with drivers. * For this reason, there may blocked callers when a driver restarts. @@ -223,9 +223,9 @@ static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id) { /* Carry out an device read or write to/from a vector of buffers. */ iovec_t iovec[NR_IOREQS]; - unsigned int nr_req; + unsigned int i, nr_req; u64_t position; - int i, do_write; + int do_write; ssize_t r, size; /* Copy the vector from the caller to kernel space. */ @@ -260,7 +260,7 @@ static int do_vrdwt(struct blockdriver *bdp, message *mp, thread_id_t id) /*===========================================================================* * do_dioctl * *===========================================================================*/ -static int do_dioctl(struct blockdriver *bdp, dev_t minor, +static int do_dioctl(struct blockdriver *bdp, devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant) { /* Carry out a disk-specific I/O control request. */ @@ -316,7 +316,7 @@ static int do_ioctl(struct blockdriver *bdp, message *mp) * to the tracing module, and handle setting/getting partitions when the driver * has specified that it is a disk driver. */ - dev_t minor; + devminor_t minor; unsigned long request; cp_grant_id_t grant; endpoint_t user_endpt; diff --git a/minix/lib/libblockdriver/driver_mt.c b/minix/lib/libblockdriver/driver_mt.c index 66d694854..8d82876b1 100644 --- a/minix/lib/libblockdriver/driver_mt.c +++ b/minix/lib/libblockdriver/driver_mt.c @@ -26,7 +26,7 @@ #define TID_DEVICE(tid) ((tid) / MAX_WORKERS) #define TID_WORKER(tid) ((tid) % MAX_WORKERS) -typedef int worker_id_t; +typedef unsigned int worker_id_t; typedef enum { STATE_DEAD, @@ -150,7 +150,7 @@ static void *worker_thread(void *param) device_t *dp; thread_id_t tid; message m; - int ipc_status, r; + int ipc_status; wp = (worker_t *) param; assert(wp != NULL); @@ -284,7 +284,8 @@ static void master_handle_message(message *m_ptr, int ipc_status) device_id_t id; worker_t *wp; device_t *dp; - int r, wid; + unsigned int wid; + int r; /* If this is not a block driver request, we cannot get the minor device * associated with it, and thus we can not tell which thread should process @@ -488,7 +489,7 @@ void blockdriver_mt_wakeup(thread_id_t id) /*===========================================================================* * blockdriver_mt_set_workers * *===========================================================================*/ -void blockdriver_mt_set_workers(device_id_t id, int workers) +void blockdriver_mt_set_workers(device_id_t id, unsigned int workers) { /* Set the number of worker threads for the given device. */ diff --git a/minix/lib/libblockdriver/trace.c b/minix/lib/libblockdriver/trace.c index 63c2cec31..f1a048b19 100644 --- a/minix/lib/libblockdriver/trace.c +++ b/minix/lib/libblockdriver/trace.c @@ -10,11 +10,11 @@ #include "const.h" #include "trace.h" -#define NO_TRACEDEV ((dev_t) -1) +#define NO_TRACEDEV ((devminor_t) -1) #define NO_TIME ((u32_t) -1) static int trace_enabled = FALSE; -static dev_t trace_dev = NO_TRACEDEV; +static devminor_t trace_dev = NO_TRACEDEV; static btrace_entry *trace_buf = NULL; static size_t trace_size = 0; static size_t trace_pos; @@ -48,7 +48,7 @@ static u32_t trace_gettime(void) /*===========================================================================* * trace_ctl * *===========================================================================*/ -int trace_ctl(dev_t minor, unsigned long request, endpoint_t endpt, +int trace_ctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant) { /* Process a block trace control request. diff --git a/minix/lib/libblockdriver/trace.h b/minix/lib/libblockdriver/trace.h index bb15289d9..d3e175f90 100644 --- a/minix/lib/libblockdriver/trace.h +++ b/minix/lib/libblockdriver/trace.h @@ -1,7 +1,7 @@ #ifndef _BLOCKDRIVER_TRACE_H #define _BLOCKDRIVER_TRACE_H -int trace_ctl(dev_t minor, unsigned long request, endpoint_t endpt, +int trace_ctl(devminor_t minor, unsigned long request, endpoint_t endpt, cp_grant_id_t grant); void trace_start(thread_id_t thread_id, message *m_ptr); diff --git a/minix/lib/libchardriver/Makefile b/minix/lib/libchardriver/Makefile index b6997d01f..5c3a87a4f 100644 --- a/minix/lib/libchardriver/Makefile +++ b/minix/lib/libchardriver/Makefile @@ -1,10 +1,10 @@ -NOGCCERROR=yes -NOCLANGERROR=yes -CPPFLAGS+= -D_MINIX_SYSTEM - # Makefile for libchardriver .include +NOGCCERROR=yes + +CPPFLAGS+= -D_MINIX_SYSTEM + LIB= chardriver SRCS= chardriver.c diff --git a/minix/lib/libchardriver/chardriver.c b/minix/lib/libchardriver/chardriver.c index 407df37d2..7a5a3603c 100644 --- a/minix/lib/libchardriver/chardriver.c +++ b/minix/lib/libchardriver/chardriver.c @@ -102,7 +102,7 @@ void chardriver_announce(void) int r; char key[DS_MAX_KEYLEN]; char label[DS_MAX_KEYLEN]; - char *driver_prefix = "drv.chr."; + const char *driver_prefix = "drv.chr."; /* Callers are allowed to use ipc_sendrec to communicate with drivers. * For this reason, there may blocked callers when a driver restarts. @@ -456,7 +456,7 @@ void chardriver_process(struct chardriver *cdp, message *m_ptr, int ipc_status) /* Call the appropiate driver function, based on the type of request. Send a * reply to the caller if necessary. */ - int r, reply; + int r; /* Check for notifications first. We never reply to notifications. */ if (is_ipc_notify(ipc_status)) { diff --git a/minix/lib/libclkconf/Makefile b/minix/lib/libclkconf/Makefile index 49cb3c659..f9aa883d3 100644 --- a/minix/lib/libclkconf/Makefile +++ b/minix/lib/libclkconf/Makefile @@ -1,8 +1,8 @@ -NOGCCERROR=yes -NOCLANGERROR=yes # # Makefile for libclkconf +NOGCCERROR=yes + CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM LIB= clkconf diff --git a/minix/lib/libdevman/Makefile b/minix/lib/libdevman/Makefile index e2ec55bed..b4ff41d38 100644 --- a/minix/lib/libdevman/Makefile +++ b/minix/lib/libdevman/Makefile @@ -1,5 +1,6 @@ NOGCCERROR=yes -NOCLANGERROR=yes + +CPPFLAGS+= -D_MINIX_SYSTEM LIB = devman diff --git a/minix/lib/libdevman/generic.c b/minix/lib/libdevman/generic.c index 9e404e814..e900ca139 100644 --- a/minix/lib/libdevman/generic.c +++ b/minix/lib/libdevman/generic.c @@ -33,7 +33,7 @@ static int save_string(char *buffer, char *src, size_t *offset) /**************************************************************************** * serialize_dev * ***************************************************************************/ -void *serialize_dev(struct devman_dev *dev, size_t *overall_size) +static void *serialize_dev(struct devman_dev *dev, size_t *overall_size) { /* determine size of serialized version of dev */ char *buffer; @@ -179,14 +179,6 @@ int devman_del_device(struct devman_dev *dev) } -/**************************************************************************** - * devman_get_ep * - ***************************************************************************/ -endpoint_t devman_get_ep(void) -{ - return devman_ep; -} - /**************************************************************************** * devman_init * ***************************************************************************/ diff --git a/minix/lib/libdevman/usb.c b/minix/lib/libdevman/usb.c index 65d0ff347..9b984d36c 100644 --- a/minix/lib/libdevman/usb.c +++ b/minix/lib/libdevman/usb.c @@ -23,7 +23,7 @@ static int (*unbind_cb) (struct devman_usb_bind_cb_data *data, endpoint_t ep); ***************************************************************************/ static void devman_usb_add_attr -(struct devman_dev *dev, char *name, char *data) +(struct devman_dev *dev, const char *name, const char *data) { struct devman_static_attribute *attr = (struct devman_static_attribute *) malloc(sizeof(struct devman_static_attribute)); diff --git a/minix/lib/libexec/exec_elf.c b/minix/lib/libexec/exec_elf.c index fca784aeb..17dcf627a 100644 --- a/minix/lib/libexec/exec_elf.c +++ b/minix/lib/libexec/exec_elf.c @@ -56,7 +56,7 @@ static int elf_ph_sane(Elf_Phdr *phdr) } static int elf_unpack(char *exec_hdr, - int hdr_len, Elf_Ehdr **hdr, Elf_Phdr **phdr) + size_t hdr_len, Elf_Ehdr **hdr, Elf_Phdr **phdr) { if(hdr_len < sizeof(Elf_Ehdr)) return ENOEXEC; @@ -98,7 +98,7 @@ static int check_header(Elf_Ehdr *hdr) * Return <0 on error. */ int elf_has_interpreter(char *exec_hdr, /* executable header */ - int hdr_len, char *interp, int maxsz) + size_t hdr_len, char *interp, size_t maxsz) { Elf_Ehdr *hdr = NULL; Elf_Phdr *phdr = NULL; diff --git a/minix/lib/libexec/libexec.h b/minix/lib/libexec/libexec.h index f7e218fd1..eac0a8e8b 100644 --- a/minix/lib/libexec/libexec.h +++ b/minix/lib/libexec/libexec.h @@ -52,8 +52,9 @@ struct exec_info { vir_bytes stack_high; /* High stack addr */ }; -int elf_has_interpreter(char *exec_hdr, int hdr_len, char *interp, int maxsz); -int elf_phdr(char *exec_hdr, int hdr_len, vir_bytes *phdr); +int elf_has_interpreter(char *exec_hdr, size_t hdr_len, char *interp, + size_t maxsz); +int elf_phdr(char *exec_hdr, size_t hdr_len, vir_bytes *phdr); int libexec_pm_newexec(endpoint_t proc_e, struct exec_info *execi); diff --git a/minix/lib/libfetch/common.h b/minix/lib/libfetch/common.h index 3949253c7..42f2f80c5 100644 --- a/minix/lib/libfetch/common.h +++ b/minix/lib/libfetch/common.h @@ -92,7 +92,8 @@ struct fetcherr { void fetch_seterr(struct fetcherr *, int); void fetch_syserr(void); -void fetch_info(const char *, ...); +void fetch_info(const char *, ...) + __attribute__((__format__(__printf__, 1, 2))); int fetch_default_port(const char *); int fetch_default_proxy_port(const char *); int fetch_bind(int, int, const char *); diff --git a/minix/lib/libfetch/ftp.c b/minix/lib/libfetch/ftp.c index d3903b4fa..8fd4e0010 100644 --- a/minix/lib/libfetch/ftp.c +++ b/minix/lib/libfetch/ftp.c @@ -199,6 +199,9 @@ ftp_chkerr(conn_t *conn) /* * Send a command and check reply */ +static int ftp_cmd(conn_t *conn, const char *fmt, ...) + __attribute__((__format__(__printf__, 2, 3))); + #ifndef __minix static int ftp_cmd(conn_t *conn, const char *fmt, ...) diff --git a/minix/lib/libfetch/http.c b/minix/lib/libfetch/http.c index 5ff7da749..a374d2405 100644 --- a/minix/lib/libfetch/http.c +++ b/minix/lib/libfetch/http.c @@ -406,6 +406,9 @@ static struct { /* * Send a formatted line; optionally echo to terminal */ +static int http_cmd(conn_t *conn, const char *fmt, ...) + __attribute__((__format__(__printf__, 2, 3))); + #ifndef __minix static int http_cmd(conn_t *conn, const char *fmt, ...) diff --git a/minix/lib/libi2cdriver/Makefile b/minix/lib/libi2cdriver/Makefile index 066ecc8ab..0fb67e17a 100644 --- a/minix/lib/libi2cdriver/Makefile +++ b/minix/lib/libi2cdriver/Makefile @@ -1,10 +1,9 @@ +# Makefile for libi2cdriver + NOGCCERROR=yes -NOCLANGERROR=yes CPPFLAGS+=-D_MINIX_SYSTEM -# Makefile for libi2cdriver - LIB= i2cdriver SRCS= i2cdriver.c diff --git a/minix/lib/libi2cdriver/i2cdriver.c b/minix/lib/libi2cdriver/i2cdriver.c index 3112ebd5f..df631b225 100644 --- a/minix/lib/libi2cdriver/i2cdriver.c +++ b/minix/lib/libi2cdriver/i2cdriver.c @@ -15,7 +15,7 @@ i2cdriver_announce(uint32_t bus) int r; char key[DS_MAX_KEYLEN]; char label[DS_MAX_KEYLEN]; - char *driver_prefix = "drv.i2c."; + const char *driver_prefix = "drv.i2c."; /* Callers are allowed to use ipc_sendrec to communicate with drivers. * For this reason, there may blocked callers when a driver restarts. @@ -83,7 +83,7 @@ i2cdriver_bus_endpoint(uint32_t bus) { /* locate the driver for the i2c bus itself */ int r; - char *label_prefix = "i2c."; + const char *label_prefix = "i2c."; char label[DS_MAX_KEYLEN]; endpoint_t bus_endpoint; @@ -197,7 +197,8 @@ static int __i2creg_read(endpoint_t bus_endpoint, i2c_addr_t address, uint8_t raw, uint8_t reg, uint32_t * val, size_t vallen) { - int r, i; + uint32_t i; + int r; minix_i2c_ioctl_exec_t ioctl_exec; assert(val != NULL); diff --git a/minix/lib/liblwip/Makefile b/minix/lib/liblwip/Makefile index ac20901fd..fd576e565 100644 --- a/minix/lib/liblwip/Makefile +++ b/minix/lib/liblwip/Makefile @@ -1,5 +1,4 @@ NOGCCERROR=yes -NOCLANGERROR=yes LIB = lwip diff --git a/minix/lib/liblwip/core/netif.c b/minix/lib/liblwip/core/netif.c index f8133f76f..f4c6d5ea5 100644 --- a/minix/lib/liblwip/core/netif.c +++ b/minix/lib/liblwip/core/netif.c @@ -716,7 +716,8 @@ netif_loop_output(struct netif *netif, struct pbuf *p, netif_poll(). */ /* let last point to the last pbuf in chain r */ - for (last = r; last->next != NULL; last = last->next); + for (last = r; last->next != NULL; last = last->next) + ; SYS_ARCH_PROTECT(lev); if(netif->loop_first != NULL) { diff --git a/minix/lib/liblwip/sys_arch.c b/minix/lib/liblwip/sys_arch.c index 7d4fc49af..c197efc10 100644 --- a/minix/lib/liblwip/sys_arch.c +++ b/minix/lib/liblwip/sys_arch.c @@ -2,6 +2,8 @@ #include #include +#include "lwip/sys.h" + u32_t sys_jiffies(void) { clock_t ticks; diff --git a/minix/lib/libminixfs/Makefile b/minix/lib/libminixfs/Makefile index 0426137c7..bd41e9ebf 100644 --- a/minix/lib/libminixfs/Makefile +++ b/minix/lib/libminixfs/Makefile @@ -1,9 +1,10 @@ +# Makefile for libminixfs +.include + NOGCCERROR=yes -NOCLANGERROR=yes + CPPFLAGS+= -D_MINIX_SYSTEM -# Makefile for libminixfs -.include LIB= minixfs SRCS= cache.c bio.c diff --git a/minix/lib/libminixfs/cache.c b/minix/lib/libminixfs/cache.c index 8c410981a..697b360a9 100644 --- a/minix/lib/libminixfs/cache.c +++ b/minix/lib/libminixfs/cache.c @@ -39,7 +39,7 @@ static struct buf **buf_hash; /* the buffer hash table */ static unsigned int nr_bufs; static int may_use_vmcache; -static int fs_block_size = PAGE_SIZE; /* raw i/o block size */ +static size_t fs_block_size = PAGE_SIZE; /* raw i/o block size */ static int rdwt_err; @@ -106,8 +106,8 @@ void lmfs_blockschange(dev_t dev, int delta) static int bitdelta = 0; bitdelta += delta; #define BANDKB (10*1024) /* recheck cache every 10MB change */ - if(bitdelta*fs_block_size/1024 > BANDKB || - bitdelta*fs_block_size/1024 < -BANDKB) { + if(bitdelta*(int)fs_block_size/1024 > BANDKB || + bitdelta*(int)fs_block_size/1024 < -BANDKB) { lmfs_cache_reevaluate(dev); bitdelta = 0; } @@ -184,7 +184,7 @@ struct buf *lmfs_get_block(register dev_t dev, register block_t block, return lmfs_get_block_ino(dev, block, only_search, VMC_NO_INODE, 0); } -void munmap_t(void *a, int len) +static void munmap_t(void *a, int len) { vir_bytes av = (vir_bytes) a; assert(a); @@ -627,7 +627,7 @@ void lmfs_rw_scattered( static iovec_t iovec[NR_IOREQS]; off_t pos; int iov_per_block; - int start_in_use = bufs_in_use, start_bufqsize = bufqsize; + unsigned int start_in_use = bufs_in_use, start_bufqsize = bufqsize; assert(bufqsize >= 0); if(bufqsize == 0) return; diff --git a/minix/lib/libnetdriver/Makefile b/minix/lib/libnetdriver/Makefile index 00b142b1f..2c670a4ca 100644 --- a/minix/lib/libnetdriver/Makefile +++ b/minix/lib/libnetdriver/Makefile @@ -1,8 +1,8 @@ +# Makefile for libnetdriver + NOGCCERROR=yes -NOCLANGERROR=yes -CPPFLAGS+= -D_MINIX_SYSTEM -# Makefile for libnetdriver +CPPFLAGS+= -D_MINIX_SYSTEM LIB= netdriver diff --git a/minix/lib/libnetdriver/netdriver.c b/minix/lib/libnetdriver/netdriver.c index 2b6d0271b..51adcf2a5 100644 --- a/minix/lib/libnetdriver/netdriver.c +++ b/minix/lib/libnetdriver/netdriver.c @@ -25,7 +25,7 @@ void netdriver_announce() int r; char key[DS_MAX_KEYLEN]; char label[DS_MAX_KEYLEN]; - char *driver_prefix = "drv.net."; + const char *driver_prefix = "drv.net."; /* Publish a driver up event. */ r = ds_retrieve_label_name(label, sef_self()); diff --git a/minix/lib/libnetsock/Makefile b/minix/lib/libnetsock/Makefile index e55e699ad..bdf907649 100644 --- a/minix/lib/libnetsock/Makefile +++ b/minix/lib/libnetsock/Makefile @@ -1,5 +1,5 @@ NOGCCERROR=yes -NOCLANGERROR=yes + CPPFLAGS+= -D_MINIX_SYSTEM LIB = netsock diff --git a/minix/lib/libnetsock/socket.c b/minix/lib/libnetsock/socket.c index bef626ec7..eafaadac0 100644 --- a/minix/lib/libnetsock/socket.c +++ b/minix/lib/libnetsock/socket.c @@ -80,7 +80,7 @@ struct mq { static struct mq * mq_head, *mq_tail; -int mq_enqueue(struct sock_req * req) +static int mq_enqueue(struct sock_req * req) { struct mq * mq; @@ -317,7 +317,7 @@ static int netsock_close(devminor_t minor) static int netsock_request(struct socket *sock, struct sock_req *req) { - char *o; + const char *o; /* * If an operation is pending (blocking operation) or writing is diff --git a/minix/lib/libusb/Makefile b/minix/lib/libusb/Makefile index dc5a3c17c..9bc0782d8 100644 --- a/minix/lib/libusb/Makefile +++ b/minix/lib/libusb/Makefile @@ -1,7 +1,8 @@ +# Makefile for libdriver + NOGCCERROR=yes -NOCLANGERROR=yes -# Makefile for libdriver +CPPFLAGS+= -D_MINIX_SYSTEM LIB = usb diff --git a/minix/lib/libusb/usb.c b/minix/lib/libusb/usb.c index 772c58702..c7ec9b794 100644 --- a/minix/lib/libusb/usb.c +++ b/minix/lib/libusb/usb.c @@ -12,7 +12,7 @@ static struct usb_urb * pending_urbs = NULL; static endpoint_t hcd_ep; -static void _usb_urb_complete(struct usb_driver *ud, long urb_id); +static void _usb_urb_complete(struct usb_driver *ud, unsigned int urb_id); /***************************************************************************** * usb_send_urb * @@ -154,7 +154,7 @@ int usb_init(char *name) /***************************************************************************** * _usb_urb_complete * ****************************************************************************/ -static void _usb_urb_complete(struct usb_driver *ud, long urb_id) +static void _usb_urb_complete(struct usb_driver *ud, unsigned int urb_id) { /* find the corresponding URB in the urb_pending list. */ struct usb_urb * urb = NULL; @@ -186,7 +186,8 @@ static void _usb_urb_complete(struct usb_driver *ud, long urb_id) #endif ud->urb_completion(urb); } else { - printf("WARN: _usb_urb_complete: did not find URB with ID %ld", urb_id); + printf("WARN: _usb_urb_complete: did not find URB with ID %u", + urb_id); } } @@ -210,7 +211,7 @@ int usb_handle_msg(struct usb_driver *ud, message *msg) switch(msg->m_type) { case USB_COMPLETE_URB: - _usb_urb_complete(ud, msg->USB_URB_ID); + _usb_urb_complete(ud, (unsigned int)msg->USB_URB_ID); return 0; case USB_ANNOUCE_DEV: ud->connect_device(msg->USB_DEV_ID, msg->USB_INTERFACES); diff --git a/minix/lib/libvassert/Makefile b/minix/lib/libvassert/Makefile index 1f131df39..daf03bccd 100644 --- a/minix/lib/libvassert/Makefile +++ b/minix/lib/libvassert/Makefile @@ -1,8 +1,7 @@ -NOGCCERROR=yes -NOCLANGERROR=yes - # Makefile for libvassert library +NOGCCERROR=yes + MKPIC?= no LIB= vassert SRCS= backdoor.S vassert.c diff --git a/minix/lib/libvassert/vassert.c b/minix/lib/libvassert/vassert.c index d3d05a8b6..f0dde57ad 100644 --- a/minix/lib/libvassert/vassert.c +++ b/minix/lib/libvassert/vassert.c @@ -61,7 +61,7 @@ void libvassert_process_backdoor(uint32, uint32, uint32, reg_t *, reg_t *, *--------------------------------------------------------------------- */ -static void sig_segv(int sig_no) +static void __dead sig_segv(int sig_no) { /* jumping to error handling in VAssert_IsInVM. */ siglongjmp(segv_jmp, 1); @@ -144,7 +144,7 @@ char VAssert_Init(void) libvassert_process_backdoor(CMD_SET_ADDRESS, page_address, MAGIC_PORT|(1<<16), &eax, &ebx, &ecx, &edx); - return (eax != -1) ? 0 : -1; + return (eax != (uint32)-1) ? 0 : -1; } @@ -172,7 +172,7 @@ char VAssert_Uninit(void) return -1; } libvassert_process_backdoor(CMD_SET_ADDRESS, 0, MAGIC_PORT|(0<<16), &eax, &ebx, &ecx, &edx); - return (eax != -1) ? 0 : 1; + return (eax != (unsigned int)-1) ? 0 : 1; } diff --git a/minix/lib/libvassert/vassert.h b/minix/lib/libvassert/vassert.h index a18c56443..0eca9533d 100644 --- a/minix/lib/libvassert/vassert.h +++ b/minix/lib/libvassert/vassert.h @@ -72,7 +72,8 @@ extern char VAssert_Uninit(void); /* * These functions should not be called directly; they need to be wrapped. */ -extern void VAssert_LogMain(const char *format, ...); +extern void VAssert_LogMain(const char *format, ...) + __attribute__((__format__(__printf__, 1, 2))); extern void VAssert_GoLiveMain(void); extern void VAssert_ReturnToReplayMain(void); extern char VAssert_Trace(size_t max_size); diff --git a/minix/lib/libvirtio/Makefile b/minix/lib/libvirtio/Makefile index 1df3297dc..5a63e9173 100644 --- a/minix/lib/libvirtio/Makefile +++ b/minix/lib/libvirtio/Makefile @@ -1,10 +1,10 @@ -NOGCCERROR=yes -NOCLANGERROR=yes -CPPFLAGS+= -D_MINIX_SYSTEM - # Makefile for libvirtio .include +NOGCCERROR=yes + +CPPFLAGS+= -D_MINIX_SYSTEM + LIB= virtio SRCS= virtio.c diff --git a/minix/lib/libvirtio/virtio.c b/minix/lib/libvirtio/virtio.c index c7ae655f9..1ff715a04 100644 --- a/minix/lib/libvirtio/virtio.c +++ b/minix/lib/libvirtio/virtio.c @@ -549,7 +549,7 @@ set_indirect_descriptors(struct virtio_device *dev, struct virtio_queue *q, vd->len = num * sizeof(desc->descs[0]); /* Initialize the descriptors in the indirect descriptor table */ - for (i = 0; i < num; i++) { + for (i = 0; i < (int)num; i++) { ivd = &desc->descs[i]; use_vring_desc(ivd, &bufs[i]); diff --git a/minix/lib/libvirtio/virtio_ring.h b/minix/lib/libvirtio/virtio_ring.h index 114f98e37..fc29d445f 100644 --- a/minix/lib/libvirtio/virtio_ring.h +++ b/minix/lib/libvirtio/virtio_ring.h @@ -133,7 +133,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, { vr->num = num; vr->desc = p; - vr->avail = p + num*sizeof(struct vring_desc); + vr->avail = (void *)((char *)p + num*sizeof(struct vring_desc)); vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(u16_t) + align-1) & ~(align - 1)); } diff --git a/minix/lib/libvtreefs/Makefile b/minix/lib/libvtreefs/Makefile index 379d9b3cb..f885652fb 100644 --- a/minix/lib/libvtreefs/Makefile +++ b/minix/lib/libvtreefs/Makefile @@ -6,8 +6,6 @@ CPPFLAGS+= -D_MINIX_SYSTEM LIB= vtreefs -CPPFLAGS+= -I${NETBSDSRCDIR}/include - SRCS= \ inode.c \ link.c \ -- 2.44.0