#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 */
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 */
#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
# Makefile for the common audio framework
+
NOGCCERROR=yes
-NOCLANGERROR=yes
+
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= audiodriver
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 */
int main(void)
{
- int r, caller;
- message mess, repl_mess;
- int ipc_status;
/* SEF local startup. */
sef_local_startup();
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;
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++) {
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];
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 */
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;
}
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;
-NOGCCERROR=yes
-NOCLANGERROR=yes
-CPPFLAGS+= -D_MINIX_SYSTEM
-
# Makefile for libbdev
.include <bsd.own.mk>
+NOGCCERROR=yes
+
+CPPFLAGS+= -D_MINIX_SYSTEM
+
LIB= bdev
SRCS= bdev.c driver.c call.c ipc.c minor.c
}
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;
}
-NOGCCERROR=yes
-NOCLANGERROR=yes
-CPPFLAGS+= -D_MINIX_SYSTEM
-
# Makefile for libblockdriver
.include <bsd.own.mk>
+NOGCCERROR=yes
+
+CPPFLAGS+= -D_MINIX_SYSTEM
+
LIB= blockdriver
SRCS= driver.c drvlib.c driver_st.c driver_mt.c mq.c trace.c
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.
{
/* 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. */
/*===========================================================================*
* 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. */
* 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;
#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,
device_t *dp;
thread_id_t tid;
message m;
- int ipc_status, r;
+ int ipc_status;
wp = (worker_t *) param;
assert(wp != NULL);
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
/*===========================================================================*
* 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.
*/
#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;
/*===========================================================================*
* 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.
#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);
-NOGCCERROR=yes
-NOCLANGERROR=yes
-CPPFLAGS+= -D_MINIX_SYSTEM
-
# Makefile for libchardriver
.include <bsd.own.mk>
+NOGCCERROR=yes
+
+CPPFLAGS+= -D_MINIX_SYSTEM
+
LIB= chardriver
SRCS= chardriver.c
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.
/* 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)) {
-NOGCCERROR=yes
-NOCLANGERROR=yes
#
# Makefile for libclkconf
+NOGCCERROR=yes
+
CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM
LIB= clkconf
NOGCCERROR=yes
-NOCLANGERROR=yes
+
+CPPFLAGS+= -D_MINIX_SYSTEM
LIB = devman
/****************************************************************************
* 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;
}
-/****************************************************************************
- * devman_get_ep *
- ***************************************************************************/
-endpoint_t devman_get_ep(void)
-{
- return devman_ep;
-}
-
/****************************************************************************
* devman_init *
***************************************************************************/
***************************************************************************/
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));
}
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;
* 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;
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);
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 *);
/*
* 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, ...)
/*
* 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, ...)
+# Makefile for libi2cdriver
+
NOGCCERROR=yes
-NOCLANGERROR=yes
CPPFLAGS+=-D_MINIX_SYSTEM
-# Makefile for libi2cdriver
-
LIB= i2cdriver
SRCS= i2cdriver.c
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.
{
/* 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;
__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);
NOGCCERROR=yes
-NOCLANGERROR=yes
LIB = lwip
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) {
#include <minix/sysutil.h>
#include <errno.h>
+#include "lwip/sys.h"
+
u32_t sys_jiffies(void)
{
clock_t ticks;
+# Makefile for libminixfs
+.include <bsd.own.mk>
+
NOGCCERROR=yes
-NOCLANGERROR=yes
+
CPPFLAGS+= -D_MINIX_SYSTEM
-# Makefile for libminixfs
-.include <bsd.own.mk>
LIB= minixfs
SRCS= cache.c bio.c
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;
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;
}
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);
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;
+# Makefile for libnetdriver
+
NOGCCERROR=yes
-NOCLANGERROR=yes
-CPPFLAGS+= -D_MINIX_SYSTEM
-# Makefile for libnetdriver
+CPPFLAGS+= -D_MINIX_SYSTEM
LIB= netdriver
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());
NOGCCERROR=yes
-NOCLANGERROR=yes
+
CPPFLAGS+= -D_MINIX_SYSTEM
LIB = netsock
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;
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
+# Makefile for libdriver
+
NOGCCERROR=yes
-NOCLANGERROR=yes
-# Makefile for libdriver
+CPPFLAGS+= -D_MINIX_SYSTEM
LIB = usb
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 *
/*****************************************************************************
* _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;
#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);
}
}
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);
-NOGCCERROR=yes
-NOCLANGERROR=yes
-
# Makefile for libvassert library
+NOGCCERROR=yes
+
MKPIC?= no
LIB= vassert
SRCS= backdoor.S vassert.c
*---------------------------------------------------------------------
*/
-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);
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;
}
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;
}
/*
* 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);
-NOGCCERROR=yes
-NOCLANGERROR=yes
-CPPFLAGS+= -D_MINIX_SYSTEM
-
# Makefile for libvirtio
.include <bsd.own.mk>
+NOGCCERROR=yes
+
+CPPFLAGS+= -D_MINIX_SYSTEM
+
LIB= virtio
SRCS= virtio.c
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]);
{
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));
}
LIB= vtreefs
-CPPFLAGS+= -I${NETBSDSRCDIR}/include
-
SRCS= \
inode.c \
link.c \