Resolve more warnings

Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
This commit is contained in:
David van Moolenbroek 2015-09-21 17:14:39 +00:00
parent 9488aa4c04
commit 7c48de6cc4
73 changed files with 264 additions and 296 deletions

View File

@ -526,7 +526,7 @@ connectlog_r(struct syslog_data *data)
}
if (!data->log_connected) {
#if defined(__minix)
if(ioctl(data->log_file, NWIOSUDSTADDR, (void *) &sun) < 0)
if(ioctl(data->log_file, NWIOSUDSTADDR, __UNCONST(&sun)) < 0)
#else
if (connect(data->log_file,

View File

@ -82,7 +82,7 @@ int fs_putnode(ino_t ino_nr, unsigned int count)
lpuffs_debug("%"PRIu64": %d %s %u %u\n",
ino,
pn_cur->pn_count,
pn_cur->pn_po.po_path,
(char *)pn_cur->pn_po.po_path,
pn_cur->pn_po.po_len,
pn_cur->pn_po.po_hash);
}

View File

@ -161,7 +161,7 @@ ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes)
r = fsdriver_copyout(data, 0, path, bytes);
return (r == OK) ? bytes : r;
return (r == OK) ? (ssize_t)bytes : r;
}

View File

@ -258,7 +258,8 @@ int fs_slink(ino_t dir_nr, char *name, uid_t uid, gid_t gid,
/* Copy the link name's last component */
pcn.pcn_namelen = strlen(name);
if (pcn.pcn_namelen <= NAME_MAX);
if (pcn.pcn_namelen > NAME_MAX)
return(ENAMETOOLONG);
strcpy(pcn.pcn_name, name);
if (bytes >= PATH_MAX)

View File

@ -1,6 +1,3 @@
# LSC For nwo
NOGCCERROR:= yes
PROG= backup
MAN=

View File

@ -33,9 +33,6 @@
# malloc() and its relatives (most do).
#
#DEFS = -DUNIX -DMALLOCH
#LSC For now...
NOGCCERROR:= yes
DEFS= -DUNIX -DUSG -DSTDLIB
CPPFLAGS+= ${DEFS}

View File

@ -1,5 +1,3 @@
# LSC For now
NOGCCERROR:= yes
PROG= cleantmp
MAN=

View File

@ -1,5 +1,3 @@
# LSC For Now...
NOGCCERROR:= yes
PROG= compress
MAN=

View File

@ -1,7 +1,4 @@
# Makefile for cron.
# LSC For Now...
NOGCCERROR:=yes
PROG= cron
SRCS= cron.c tab.c misc.c
MAN=

View File

@ -2,9 +2,6 @@
.include <bsd.own.mk>
# LSC For now...
NOGCCERROR:= yes
PROG= crontab
SRCS= crontab.c tab.c misc.c
CPPFLAGS+= -I${.CURDIR} -I${NETBSDSRCDIR}/minix/commands/cron

View File

@ -13,6 +13,7 @@
#include <sys/ioctl.h>
#include <limits.h>
#include <stdint.h>
#include <inttypes.h>
#include <assert.h>
#ifdef __minix
@ -191,7 +192,8 @@ void show_part(struct part_entry *p)
printf("%3d ", (n-1) / 2);
show_chs(p->lowsec);
show_chs(p->lowsec + p->size - 1);
printf(" %8u %8u %7u\n", p->lowsec, p->size, p->size / 2);
printf(" %8"PRIu32" %8"PRIu32" %7"PRIu32"\n",
p->lowsec, p->size, p->size / 2);
}
void usage(void)

View File

@ -16,6 +16,7 @@
#include <assert.h>
#include <ctype.h>
#include <partition.h>
#include <inttypes.h>
#include <sys/stat.h>
@ -309,7 +310,7 @@ maketree(struct node *thisdir, char *name, int level)
}
if(!(dirnodes = malloc(sizeof(*dirnodes)*reserved_dirnodes))) {
fprintf(stderr, "couldn't allocate dirnodes (%d bytes)\n",
fprintf(stderr, "couldn't allocate dirnodes (%zu bytes)\n",
sizeof(*dirnodes)*reserved_dirnodes);
exit(1);
}
@ -508,7 +509,7 @@ makepathtables(struct node *root, int littleendian, int *bytes, int fd)
if(*bytes % ISO_SECTOR) {
ssize_t x;
x = ISO_SECTOR-(*bytes % ISO_SECTOR);
write(fd, block, x);
Write(fd, block, x);
*bytes += x;
}
@ -595,7 +596,7 @@ write_direntry(struct node * n, char *origname, int fd)
if(total != entry.recordsize || (total % 2) != 0) {
printf("%2d, %2d! ", total, entry.recordsize);
printf("%3d = %3d - %2d + %2d\n",
printf("%3d = %3zu - %2zu + %2d\n",
entry.recordsize, sizeof(entry), sizeof(entry.name), namelen);
}
@ -833,7 +834,8 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector,
exit(1);
}
fprintf(stderr, " * appended sector info: 0x%llx len 0x%x\n",
fprintf(stderr,
" * appended sector info: 0x%"PRIx64" len 0x%x\n",
bap[0].sector, bap[0].length);
addr = buf;
@ -891,7 +893,8 @@ writebootrecord(int fd, int *currentsector, int bootcatalogsector)
w += Writefield(fd, bootrecord.zero2);
if(w != ISO_SECTOR) {
fprintf(stderr, "WARNING: something went wrong - boot record (%d) isn't a sector size (%d)\n",
fprintf(stderr, "WARNING: something went wrong - "
"boot record (%zd) isn't a sector size (%d)\n",
w, ISO_SECTOR);
}
@ -926,8 +929,8 @@ main(int argc, char *argv[])
if(sizeof(struct pvd) != ISO_SECTOR) {
fprintf(stderr, "Something confusing happened at\n"
"compile-time; pvd should be a sector size. %d != %d\n",
sizeof(struct pvd), ISO_SECTOR);
"compile-time; pvd should be a sector size. "
"%zd != %d\n", sizeof(struct pvd), ISO_SECTOR);
return 1;
}

View File

@ -7,6 +7,4 @@ LDADD+= -li2cdriver -lchardriver -lsys -ltimers
CPPFLAGS+= -I${NETBSDSRCDIR}
NOCLANGERROR=yes
.include <minix.service.mk>

View File

@ -113,7 +113,7 @@ struct calibration
#define CAL_COEF_FIRST AC1_MSB_REG
#define CAL_COEF_LAST MD_LSB_REG
#define CAL_COEF_IS_VALID(x) (x != 0x0000 && x != 0xffff)
#define CAL_COEF_IS_VALID(x) (x != 0x0000 && (uint16_t)x != 0xffff)
#define SENSOR_VAL_MSB_REG 0xf6
#define SENSOR_VAL_LSB_REG 0xf7

View File

@ -17,7 +17,7 @@ int get_mtab_entry(char dev[PATH_MAX], char mount_point[PATH_MAX],
char type[MNTNAMELEN], char flags[MNTFLAGLEN]);
int servxcheck(unsigned long peer, const char *service,
void (*logf)(int pass, const char *name));
char *servxfile(const char *file);
const char *servxfile(const char *file);
/* read_tsc() and friends */
void read_tsc(u32_t *hi, u32_t *lo);

View File

@ -1,7 +1,5 @@
# Makefile for the common audio framework
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= audiodriver

View File

@ -47,8 +47,10 @@ static int init_buffers(sub_dev_t *sub_dev_ptr);
static int get_started(sub_dev_t *sub_dev_ptr);
static int io_ctl_length(int io_request);
static special_file_t* get_special_file(int minor_dev_nr);
#if defined(__i386__)
static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
int pci_dev, int pci_func);
#endif
static char io_ctl_buf[IOCPARM_MASK];
static int irq_hook_id = 0; /* id of irq hook at the kernel */
@ -822,6 +824,7 @@ static special_file_t* get_special_file(int minor_dev_nr) {
return NULL;
}
#if defined(__i386__)
static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
int pci_dev, int pci_func)
{
@ -858,3 +861,4 @@ static void tell_dev(vir_bytes buf, size_t size, int pci_bus,
return;
}
}
#endif

View File

@ -1,8 +1,6 @@
# Makefile for libbdev
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= bdev

View File

@ -58,7 +58,7 @@ static int bdev_retry(int *driver_tries, int *transfer_tries, int *result)
return FALSE;
}
static int bdev_opcl(int req, dev_t dev, int access)
static int bdev_opcl(int req, dev_t dev, int bits)
{
/* Open or close the given minor device.
*/
@ -69,7 +69,7 @@ static int bdev_opcl(int req, dev_t dev, int access)
memset(&m, 0, sizeof(m));
m.m_type = req;
m.m_lbdev_lblockdriver_msg.minor = minor(dev);
m.m_lbdev_lblockdriver_msg.access = access;
m.m_lbdev_lblockdriver_msg.access = bits;
r = bdev_sendrec(dev, &m);
} while (bdev_retry(&driver_tries, NULL, &r));
@ -77,17 +77,17 @@ static int bdev_opcl(int req, dev_t dev, int access)
return r;
}
int bdev_open(dev_t dev, int access)
int bdev_open(dev_t dev, int bits)
{
/* Open the given minor device.
* File system usage note: typically called from mount, after bdev_driver.
*/
int r;
r = bdev_opcl(BDEV_OPEN, dev, access);
r = bdev_opcl(BDEV_OPEN, dev, bits);
if (r == OK)
bdev_minor_add(dev, access);
bdev_minor_add(dev, bits);
return r;
}
@ -116,16 +116,16 @@ static int bdev_rdwt_setup(int req, dev_t dev, u64_t pos, char *buf,
*/
endpoint_t endpt;
cp_grant_id_t grant;
int access;
int perm;
assert((ssize_t) count >= 0);
if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST;
access = (req == BDEV_READ) ? CPF_WRITE : CPF_READ;
perm = (req == BDEV_READ) ? CPF_WRITE : CPF_READ;
grant = cpf_grant_direct(endpt, (vir_bytes) buf, count, access);
grant = cpf_grant_direct(endpt, (vir_bytes) buf, count, perm);
if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n");
@ -179,19 +179,19 @@ static int bdev_vrdwt_setup(int req, dev_t dev, u64_t pos, iovec_t *vec,
ssize_t size;
endpoint_t endpt;
cp_grant_id_t grant;
int i, access;
int i, perm;
assert(count <= NR_IOREQS);
if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST;
access = (req == BDEV_GATHER) ? CPF_WRITE : CPF_READ;
perm = (req == BDEV_GATHER) ? CPF_WRITE : CPF_READ;
size = 0;
for (i = 0; i < count; i++) {
grant = cpf_grant_direct(endpt, vec[i].iov_addr, vec[i].iov_size,
access);
perm);
if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n");
@ -311,7 +311,7 @@ static int bdev_ioctl_setup(dev_t dev, unsigned long request, void *buf,
endpoint_t endpt;
size_t size;
cp_grant_id_t grant;
int access;
int perm;
if ((endpt = bdev_driver_get(dev)) == NONE)
return EDEADSRCDST;
@ -321,12 +321,12 @@ static int bdev_ioctl_setup(dev_t dev, unsigned long request, void *buf,
else
size = _MINIX_IOCTL_SIZE(request);
access = 0;
if (_MINIX_IOCTL_IOR(request)) access |= CPF_WRITE;
if (_MINIX_IOCTL_IOW(request)) access |= CPF_READ;
perm = 0;
if (_MINIX_IOCTL_IOR(request)) perm |= CPF_WRITE;
if (_MINIX_IOCTL_IOW(request)) perm |= CPF_READ;
/* The size may be 0, in which case 'buf' need not be a valid pointer. */
grant = cpf_grant_direct(endpt, (vir_bytes) buf, size, access);
grant = cpf_grant_direct(endpt, (vir_bytes) buf, size, perm);
if (!GRANT_VALID(grant)) {
printf("bdev: unable to allocate grant!\n");

View File

@ -75,32 +75,32 @@ int bdev_minor_reopen(dev_t dev)
return OK;
}
void bdev_minor_add(dev_t dev, int access)
void bdev_minor_add(dev_t dev, int bits)
{
/* Increase the reference count of the given minor device.
*/
int i, free = -1;
int i, ifree = -1;
for (i = 0; i < NR_OPEN_DEVS; i++) {
if (open_dev[i].dev == dev) {
open_dev[i].count++;
open_dev[i].access |= access;
open_dev[i].access |= bits;
return;
}
if (free < 0 && open_dev[i].dev == NO_DEV)
free = i;
if (ifree < 0 && open_dev[i].dev == NO_DEV)
ifree = i;
}
if (free < 0) {
if (ifree < 0) {
printf("bdev: too many open devices, increase NR_OPEN_DEVS\n");
return;
}
open_dev[free].dev = dev;
open_dev[free].count = 1;
open_dev[free].access = access;
open_dev[ifree].dev = dev;
open_dev[ifree].count = 1;
open_dev[ifree].access = bits;
}
void bdev_minor_del(dev_t dev)

View File

@ -1,8 +1,6 @@
# Makefile for libblockdriver
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= blockdriver

View File

@ -488,7 +488,7 @@ void blockdriver_mt_wakeup(thread_id_t id)
worker_id = TID_WORKER(id);
assert(device_id >= 0 && device_id < MAX_DEVICES);
assert(worker_id >= 0 && worker_id < MAX_WORKERS);
assert(worker_id < MAX_WORKERS);
wp = &device[device_id].worker[worker_id];

View File

@ -275,12 +275,12 @@ int servxcheck(unsigned long peer, const char *service,
return state == PASS;
}
char *servxfile(const char *file)
const char *servxfile(const char *file)
/* Specify a file to use for the access checks other than the default. Return
* the old path.
*/
{
const char *oldpath= path_servacces;
path_servacces= file;
return (char *) oldpath; /* (avoid const poisoning) */
return oldpath;
}

View File

@ -77,9 +77,11 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags,
{
ip_hdr_t *ip_hdr;
struct sockaddr_in *sinp;
const struct sockaddr_in *sinp;
ssize_t retval;
int saved_errno;
sinp = (struct sockaddr_in *) __UNCONST(dest_addr);
sinp = (const struct sockaddr_in *)dest_addr;
if (sinp->sin_family != AF_INET)
{
errno= EAFNOSUPPORT;
@ -87,10 +89,21 @@ ssize_t sendto(int sock, const void *message, size_t length, int flags,
}
/* raw */
ip_hdr= (ip_hdr_t *)message;
/* XXX this is horrible: we have to copy the entire buffer
* because we have to change one header field. Obviously we
* can't modify the user buffer directly..
*/
if ((ip_hdr = malloc(length)) == NULL)
return -1; /* errno is ENOMEM */
memcpy(ip_hdr, message, length);
ip_hdr->ih_dst= sinp->sin_addr.s_addr;
return write(sock, message, length);
retval = write(sock, ip_hdr, length);
saved_errno = errno;
free(ip_hdr);
errno = saved_errno;
return retval;
}
#if DEBUG

View File

@ -1,8 +1,6 @@
# Makefile for libchardriver
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= chardriver

View File

@ -281,7 +281,7 @@ static int do_open(struct chardriver *cdp, message *m_ptr)
/* Open a minor device. */
endpoint_t user_endpt;
devminor_t minor;
int r, access;
int r, bits;
/* Default action if no open hook is in place. */
if (cdp->cdr_open == NULL)
@ -289,10 +289,10 @@ static int do_open(struct chardriver *cdp, message *m_ptr)
/* Call the open hook. */
minor = m_ptr->m_vfs_lchardriver_openclose.minor;
access = m_ptr->m_vfs_lchardriver_openclose.access;
bits = m_ptr->m_vfs_lchardriver_openclose.access;
user_endpt = m_ptr->m_vfs_lchardriver_openclose.user;
r = cdp->cdr_open(minor, access, user_endpt);
r = cdp->cdr_open(minor, bits, user_endpt);
/* If the device has been cloned, mark the new minor as open too. */
if (r >= 0 && (r & CDEV_CLONED)) {

View File

@ -1,8 +1,6 @@
#
# Makefile for libclkconf
NOGCCERROR=yes
CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM
LIB= clkconf

View File

@ -20,7 +20,7 @@
#include <assert.h>
/* used for logging */
static struct log log = {
static struct log clk_log = {
.name = "omap_clkconf",
.log_level = LEVEL_INFO,
.log_func = default_log
@ -44,7 +44,7 @@ clkconf_init()
if (base != 0) {
/* when used in a library we can't guaranty we only call this
* method once */
log_trace(&log, "Called %d times\n", use_count);
log_trace(&clk_log, "Called %d times\n", use_count);
return OK;
}
@ -58,14 +58,15 @@ clkconf_init()
mr.mr_limit = cm_base + 0x1000;
if (sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr) != 0) {
log_warn(&log, "Unable to request permission to map memory\n");
log_warn(&clk_log,
"Unable to request permission to map memory\n");
return EPERM;
}
base = (uint32_t) vm_map_phys(SELF, (void *) cm_base, 0x1000);
if (base == (uint32_t) MAP_FAILED) {
log_warn(&log, "Unable to map GPIO memory\n");
log_warn(&clk_log, "Unable to map GPIO memory\n");
return EPERM;
}
return OK;

View File

@ -1,5 +1,3 @@
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB = devman

View File

@ -106,6 +106,9 @@ int devman_add_device(struct devman_dev *dev)
size_t grant_size;
void *buf = serialize_dev(dev, &grant_size);
if (buf == NULL)
panic("out of memory");
cp_grant_id_t gid =
cpf_grant_direct(devman_ep,(vir_bytes) buf,
grant_size, CPF_READ);

View File

@ -1,8 +1,5 @@
# Makefile for libexec
# LSC For now
NOGCCERROR:= yes
LIB= exec
INCS= libexec.h
SRCS= exec_elf.c exec_general.c

View File

@ -1,7 +1,5 @@
# Makefile for libi2cdriver
NOGCCERROR=yes
CPPFLAGS+=-D_MINIX_SYSTEM
LIB= i2cdriver

View File

@ -1,8 +1,6 @@
# Makefile for libminixfs
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= minixfs

View File

@ -122,13 +122,13 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
size_t block_size, off, block_off, last_size, size, chunk;
unsigned int blocks_left;
struct buf *bp;
int r, write, how;
int r, do_write, how;
if (dev == NO_DEV)
return EINVAL;
block_size = lmfs_fs_block_size();
write = (call == FSC_WRITE);
do_write = (call == FSC_WRITE);
assert(block_size > 0);
@ -183,7 +183,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
* For read requests, help the block driver form larger I/O
* requests.
*/
if (!write)
if (!do_write)
block_prefetch(dev, block, blocks_left, block_size,
last_size);
@ -191,7 +191,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
* Do not read the block from disk if we will end up
* overwriting all of its contents.
*/
how = (write && chunk == size) ? NO_READ : NORMAL;
how = (do_write && chunk == size) ? NO_READ : NORMAL;
if (size < block_size)
r = lmfs_get_partial_block(&bp, dev, block, how, size);
@ -207,7 +207,7 @@ lmfs_bio(dev_t dev, struct fsdriver_data * data, size_t bytes, off_t pos,
/* Perform the actual copy. */
if (r == OK && data != NULL) {
if (write) {
if (do_write) {
r = fsdriver_copyin(data, off,
(char *)bp->data + block_off, chunk);

View File

@ -239,8 +239,7 @@ static void munmap_t(void *a, int len)
static void raisecount(struct buf *bp)
{
assert(bufs_in_use >= 0);
ASSERT(bp->lmfs_count >= 0);
ASSERT(bp->lmfs_count < CHAR_MAX);
bp->lmfs_count++;
if(bp->lmfs_count == 1) bufs_in_use++;
assert(bufs_in_use > 0);
@ -252,7 +251,6 @@ static void lowercount(struct buf *bp)
ASSERT(bp->lmfs_count > 0);
bp->lmfs_count--;
if(bp->lmfs_count == 0) bufs_in_use--;
assert(bufs_in_use >= 0);
}
static void freeblock(struct buf *bp)

View File

@ -1,7 +1,5 @@
# Makefile for libnetdriver
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= netdriver

View File

@ -323,14 +323,14 @@ netdriver_send(void)
*/
static void
do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
cp_grant_id_t grant, unsigned int count, int write)
cp_grant_id_t grant, unsigned int count, int do_write)
{
struct netdriver_data *data;
unsigned int i;
int r;
/* Copy in the I/O vector. */
data = (write) ? &pending_send : &pending_recv;
data = (do_write) ? &pending_send : &pending_recv;
if (data->size != 0)
panic("netdriver: multiple concurrent requests");
@ -349,7 +349,7 @@ do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
data->size += data->iovec[i].iov_size;
if (data->size < ETH_MIN_PACK_SIZE ||
(!write && data->size < ETH_MAX_PACK_SIZE_TAGGED))
(!do_write && data->size < ETH_MAX_PACK_SIZE_TAGGED))
panic("netdriver: invalid I/O vector size: %zu\n", data->size);
/* Save the endpoint to which we should reply. */
@ -360,7 +360,7 @@ do_readwrite(const struct netdriver * __restrict ndp, endpoint_t endpt,
/* Resume sending or receiving. */
defer_replies();
if (write)
if (do_write)
netdriver_send();
else
netdriver_recv();
@ -400,17 +400,17 @@ do_getstat(const struct netdriver * __restrict ndp,
const message * __restrict m_ptr)
{
message m_reply;
eth_stat_t stat;
eth_stat_t st;
int r;
memset(&stat, 0, sizeof(stat));
memset(&st, 0, sizeof(st));
if (ndp->ndr_stat != NULL)
ndp->ndr_stat(&stat);
ndp->ndr_stat(&st);
if ((r = sys_safecopyto(m_ptr->m_source,
m_ptr->m_net_netdrv_dl_getstat_s.grant, 0, (vir_bytes)&stat,
sizeof(stat))) != OK)
m_ptr->m_net_netdrv_dl_getstat_s.grant, 0, (vir_bytes)&st,
sizeof(st))) != OK)
panic("netdriver: unable to copy out statistics: %d", r);
memset(&m_reply, 0, sizeof(m_reply));
@ -485,13 +485,13 @@ netdriver_process(const struct netdriver * __restrict ndp,
case DL_READV_S:
do_readwrite(ndp, m_ptr->m_source,
m_ptr->m_net_netdrv_dl_readv_s.grant,
m_ptr->m_net_netdrv_dl_readv_s.count, FALSE /*write*/);
m_ptr->m_net_netdrv_dl_readv_s.count, FALSE /*do_write*/);
break;
case DL_WRITEV_S:
do_readwrite(ndp, m_ptr->m_source,
m_ptr->m_net_netdrv_dl_writev_s.grant,
m_ptr->m_net_netdrv_dl_writev_s.count, TRUE /*write*/);
m_ptr->m_net_netdrv_dl_writev_s.count, TRUE /*do_write*/);
break;
default:

View File

@ -68,7 +68,7 @@ void
netdriver_portinw(struct netdriver_data * data, size_t off, long port,
size_t size)
{
uint8_t buf[2];
uint16_t buf;
uint32_t value;
size_t chunk;
unsigned int i;
@ -85,8 +85,8 @@ netdriver_portinw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) {
if ((r = sys_safecopyto(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[1],
1)) != OK)
data->iovec[i].iov_grant, off,
(vir_bytes)&((char *)&buf)[1], 1)) != OK)
panic("netdriver: unable to copy data: %d", r);
off++;
@ -109,11 +109,11 @@ netdriver_portinw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) {
if ((r = sys_inw(port, &value)) != OK)
panic("netdriver: port input failed: %d", r);
*(uint16_t *)buf = (uint16_t)value;
buf = (uint16_t)value;
if ((r = sys_safecopyto(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[0],
1)) != OK)
data->iovec[i].iov_grant, off,
(vir_bytes)&((char *)&buf)[0], 1)) != OK)
panic("netdriver: unable to copy data: %d", r);
size--;
@ -131,7 +131,7 @@ void
netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
size_t size)
{
uint8_t buf[2];
uint16_t buf;
size_t chunk;
unsigned int i;
int r, odd_byte;
@ -147,11 +147,11 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) {
if ((r = sys_safecopyfrom(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[1],
1)) != OK)
data->iovec[i].iov_grant, off,
(vir_bytes)&((char *)&buf)[1], 1)) != OK)
panic("netdriver: unable to copy data: %d", r);
if ((r = sys_outw(port, *(uint16_t *)buf)) != OK)
if ((r = sys_outw(port, buf)) != OK)
panic("netdriver: port output failed: %d", r);
off++;
@ -173,8 +173,8 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
if (odd_byte) {
if ((r = sys_safecopyfrom(data->endpt,
data->iovec[i].iov_grant, off, (vir_bytes)&buf[0],
1)) != OK)
data->iovec[i].iov_grant, off,
(vir_bytes)&((char *)&buf)[0], 1)) != OK)
panic("netdriver: unable to copy data: %d", r);
size--;
@ -185,9 +185,9 @@ netdriver_portoutw(struct netdriver_data * data, size_t off, long port,
}
if (odd_byte) {
buf[1] = 0;
((char *)&buf)[1] = 0;
if ((r = sys_outw(port, *(uint16_t *)buf)) != OK)
if ((r = sys_outw(port, buf)) != OK)
panic("netdriver: port output failed: %d", r);
}
}

View File

@ -1,5 +1,3 @@
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB = netsock

View File

@ -1,8 +1,6 @@
# Makefile for libsffs
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= sffs

View File

@ -30,7 +30,7 @@ struct inode *init_inode(void)
/* Initialize inode table. Return the root inode.
*/
struct inode *ino;
unsigned int index;
unsigned int i;
TAILQ_INIT(&free_list);
@ -38,11 +38,11 @@ struct inode *init_inode(void)
sffs_name, NUM_INODES, sizeof(struct inode), sizeof(inodes)));
/* Mark all inodes except the root inode as free. */
for (index = 1; index < NUM_INODES; index++) {
ino = &inodes[index];
for (i = 1; i < NUM_INODES; i++) {
ino = &inodes[i];
ino->i_parent = NULL;
LIST_INIT(&ino->i_child);
ino->i_num = index + 1;
ino->i_num = i + 1;
ino->i_gen = (unsigned short)-1; /* aesthetics */
ino->i_ref = 0;
ino->i_flags = 0;
@ -70,19 +70,19 @@ struct inode *find_inode(ino_t ino_nr)
/* Get an inode based on its inode number. Do not increase its reference count.
*/
struct inode *ino;
int index;
int i;
/* Inode 0 (= index -1) is not a valid inode number. */
index = INODE_INDEX(ino_nr);
if (index < 0) {
i = INODE_INDEX(ino_nr);
if (i < 0) {
printf("%s: VFS passed invalid inode number!\n", sffs_name);
return NULL;
}
assert(index < NUM_INODES);
assert(i < NUM_INODES);
ino = &inodes[index];
ino = &inodes[i];
/* Make sure the generation number matches. */
if (INODE_GEN(ino_nr) != ino->i_gen) {
@ -261,10 +261,10 @@ int have_used_inode(void)
/* Check whether any inodes are still in use, that is, any of the inodes have
* a reference count larger than zero.
*/
unsigned int index;
unsigned int i;
for (index = 0; index < NUM_INODES; index++)
if (inodes[index].i_ref > 0)
for (i = 0; i < NUM_INODES; i++)
if (inodes[i].i_ref > 0)
return TRUE;
return FALSE;

View File

@ -14,13 +14,13 @@
/*===========================================================================*
* do_statvfs *
*===========================================================================*/
int do_statvfs(struct statvfs *statvfs)
int do_statvfs(struct statvfs *st)
{
/* Retrieve file system statistics.
*/
struct inode *ino;
char path[PATH_MAX];
u64_t free, total;
u64_t bfree, btotal;
int r;
/* Unfortunately, we cannot be any more specific than this, because we are
@ -34,20 +34,20 @@ int do_statvfs(struct statvfs *statvfs)
if ((r = verify_inode(ino, path, NULL)) != OK)
return r;
if ((r = sffs_table->t_queryvol(path, &free, &total)) != OK)
if ((r = sffs_table->t_queryvol(path, &bfree, &btotal)) != OK)
return r;
/* Returning zero for unknown values seems to be the convention. However, we
* do have to use a nonzero block size, even though it is entirely arbitrary.
*/
statvfs->f_flag = ST_NOTRUNC;
statvfs->f_bsize = BLOCK_SIZE;
statvfs->f_frsize = BLOCK_SIZE;
statvfs->f_iosize = BLOCK_SIZE;
statvfs->f_blocks = (fsblkcnt_t)(total / BLOCK_SIZE);
statvfs->f_bfree = (fsblkcnt_t)(free / BLOCK_SIZE);
statvfs->f_bavail = statvfs->f_bfree;
statvfs->f_namemax = NAME_MAX;
st->f_flag = ST_NOTRUNC;
st->f_bsize = BLOCK_SIZE;
st->f_frsize = BLOCK_SIZE;
st->f_iosize = BLOCK_SIZE;
st->f_blocks = (fsblkcnt_t)(btotal / BLOCK_SIZE);
st->f_bfree = (fsblkcnt_t)(bfree / BLOCK_SIZE);
st->f_bavail = st->f_bfree;
st->f_namemax = NAME_MAX;
return OK;
}

View File

@ -37,7 +37,7 @@ mode_t get_mode(struct inode *ino, int mode)
/*===========================================================================*
* do_stat *
*===========================================================================*/
int do_stat(ino_t ino_nr, struct stat *stat)
int do_stat(ino_t ino_nr, struct stat *st)
{
/* Retrieve inode status.
*/
@ -56,31 +56,31 @@ int do_stat(ino_t ino_nr, struct stat *stat)
if ((r = verify_inode(ino, path, &attr)) != OK)
return r;
stat->st_mode = get_mode(ino, attr.a_mode);
stat->st_uid = sffs_params->p_uid;
stat->st_gid = sffs_params->p_gid;
stat->st_rdev = NO_DEV;
stat->st_size = attr.a_size;
stat->st_atimespec = attr.a_atime;
stat->st_mtimespec = attr.a_mtime;
stat->st_ctimespec = attr.a_ctime;
stat->st_birthtimespec = attr.a_crtime;
st->st_mode = get_mode(ino, attr.a_mode);
st->st_uid = sffs_params->p_uid;
st->st_gid = sffs_params->p_gid;
st->st_rdev = NO_DEV;
st->st_size = attr.a_size;
st->st_atimespec = attr.a_atime;
st->st_mtimespec = attr.a_mtime;
st->st_ctimespec = attr.a_ctime;
st->st_birthtimespec = attr.a_crtime;
stat->st_blocks = stat->st_size / S_BLKSIZE;
if (stat->st_size % S_BLKSIZE != 0)
stat->st_blocks += 1;
st->st_blocks = st->st_size / S_BLKSIZE;
if (st->st_size % S_BLKSIZE != 0)
st->st_blocks += 1;
stat->st_blksize = BLOCK_SIZE;
st->st_blksize = BLOCK_SIZE;
/* We could make this more accurate by iterating over directory inodes'
* children, counting how many of those are directories as well.
* It's just not worth it.
*/
stat->st_nlink = 0;
if (ino->i_parent != NULL) stat->st_nlink++;
st->st_nlink = 0;
if (ino->i_parent != NULL) st->st_nlink++;
if (IS_DIR(ino)) {
stat->st_nlink++;
if (HAS_CHILDREN(ino)) stat->st_nlink++;
st->st_nlink++;
if (HAS_CHILDREN(ino)) st->st_nlink++;
}
return OK;

View File

@ -1,8 +1,6 @@
# Makefile for libsys
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
LIB= sys

View File

@ -4,7 +4,7 @@
int env_argc = 0;
char **env_argv = NULL;
static char *find_key(const char *params, const char *key);
static const char *find_key(const char *params, const char *key);
/*===========================================================================*
* env_setargs *
@ -22,7 +22,7 @@ int env_get_param(const char *key, char *value, int max_len)
{
message m;
static char mon_params[MULTIBOOT_PARAM_BUF_SIZE]; /* copy parameters here */
char *key_value;
const char *key_value;
int i, s;
size_t keylen;
@ -73,14 +73,13 @@ int env_get_param(const char *key, char *value, int max_len)
/*==========================================================================*
* find_key *
* find_key *
*==========================================================================*/
static char *find_key(const char *params, const char *name)
static const char *find_key(const char *params, const char *name)
{
const char *namep;
char *envp;
const char *namep, *envp;
for (envp = (char *) params; *envp != 0;) {
for (envp = params; *envp != 0;) {
for (namep = name; *namep != 0 && *namep == *envp; namep++, envp++)
;
if (*namep == '\0' && *envp == '=')

View File

@ -15,9 +15,9 @@ extern int env_argc;
/*===========================================================================*
* sef_llvm_magic_enabled *
*===========================================================================*/
int sef_llvm_magic_enabled()
int sef_llvm_magic_enabled(void)
{
extern void __attribute__((weak)) magic_init();
extern void __attribute__((weak)) magic_init(void);
if (!magic_init)
return 0;
return 1;
@ -37,7 +37,7 @@ int sef_llvm_real_brk(char *newbrk)
/*===========================================================================*
* sef_llvm_state_cleanup *
*===========================================================================*/
int sef_llvm_state_cleanup()
int sef_llvm_state_cleanup(void)
{
return OK;
}
@ -67,7 +67,7 @@ int sef_llvm_eval_bool(char *expr, char *result)
/*===========================================================================*
* sef_llvm_state_table_addr *
*===========================================================================*/
void *sef_llvm_state_table_addr()
void *sef_llvm_state_table_addr(void)
{
extern void* __attribute__((weak)) _magic_vars_addr(void);
if (!_magic_vars_addr)
@ -78,7 +78,7 @@ void *sef_llvm_state_table_addr()
/*===========================================================================*
* sef_llvm_state_table_size *
*===========================================================================*/
size_t sef_llvm_state_table_size()
size_t sef_llvm_state_table_size(void)
{
extern size_t __attribute__((weak)) _magic_vars_size(void);
if (!_magic_vars_size)
@ -135,10 +135,10 @@ int sef_llvm_state_transfer(sef_init_info_t *info)
int sef_llvm_add_special_mem_region(void *addr, size_t len, const char* name)
{
extern int __attribute__((weak)) st_add_special_mmapped_region(void *addr,
size_t len, char* name);
size_t len, const char* name);
if (!st_add_special_mmapped_region)
return 0;
return st_add_special_mmapped_region(addr, len, (char*) name);
return st_add_special_mmapped_region(addr, len, name);
}
/*===========================================================================*
@ -207,7 +207,7 @@ int sef_llvm_ac_munmap(void *buf, size_t len)
/*===========================================================================*
* sef_llvm_ltckpt_enabled *
*===========================================================================*/
int sef_llvm_ltckpt_enabled()
int sef_llvm_ltckpt_enabled(void)
{
extern int __attribute__((weak)) ltckpt_mechanism_enabled(void);
if (!sef_llvm_get_ltckpt_offset() || !ltckpt_mechanism_enabled())
@ -218,9 +218,9 @@ int sef_llvm_ltckpt_enabled()
/*===========================================================================*
* sef_llvm_ltckpt_get_offset *
*===========================================================================*/
int sef_llvm_get_ltckpt_offset()
int sef_llvm_get_ltckpt_offset(void)
{
extern int __attribute__((weak)) ltckpt_get_offset();
extern int __attribute__((weak)) ltckpt_get_offset(void);
if (!ltckpt_get_offset)
return 0;
return ltckpt_get_offset();
@ -239,4 +239,3 @@ int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info)
assert(ltckpt_restart);
return ltckpt_restart(info);
}

View File

@ -28,12 +28,12 @@ static void process_sigmgr_signals(void)
{
/* A signal manager has pending signals in the kernel. Process them. */
endpoint_t target;
sigset_t sigset;
sigset_t set;
int signo, r;
while (TRUE) {
/* Get an arbitrary pending signal. */
if((r=sys_getksig(&target, &sigset)) != OK)
if((r=sys_getksig(&target, &set)) != OK)
panic("SEF: sys_getksig failed: %d", r);
if (target == NONE) {
@ -43,7 +43,7 @@ static void process_sigmgr_signals(void)
/* Process every signal in the signal set. */
r = OK;
for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) {
int s = sigismember(&sigset, signo);
int s = sigismember(&set, signo);
assert(s >= 0);
if(s) {
/* Let the callback code process the signal. */
@ -67,13 +67,13 @@ static void process_sigmgr_signals(void)
/*===========================================================================*
* process_sigmgr_self_signals *
*===========================================================================*/
static void process_sigmgr_self_signals(sigset_t sigset)
static void process_sigmgr_self_signals(sigset_t set)
{
/* A signal manager has pending signals for itself. Process them. */
int signo;
for (signo = SIGS_FIRST; signo <= SIGS_LAST; signo++) {
int s = sigismember(&sigset, signo);
int s = sigismember(&set, signo);
assert(s >= 0);
if(s) {
/* Let the callback code process the signal. */
@ -89,13 +89,13 @@ int do_sef_signal_request(message *m_ptr)
{
/* Handle a SEF Signal request. */
int signo;
sigset_t sigset;
sigset_t set;
if(m_ptr->m_source == SYSTEM) {
/* Handle kernel signals. */
sigset = m_ptr->m_notify.sigset;
set = m_ptr->m_notify.sigset;
for (signo = SIGK_FIRST; signo <= SIGK_LAST; signo++) {
int s = sigismember(&sigset, signo);
int s = sigismember(&set, signo);
assert(s >= 0);
if (s) {
/* Let the callback code handle the kernel signal. */
@ -107,7 +107,7 @@ int do_sef_signal_request(message *m_ptr)
}
/* Handle SIGKSIGSM for a signal manager. */
else if(signo == SIGKSIGSM) {
process_sigmgr_self_signals(sigset);
process_sigmgr_self_signals(set);
}
}
}

View File

@ -1,7 +1,5 @@
# Makefile for libdriver
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB = usb

View File

@ -1,7 +1,5 @@
# Makefile for libvassert library
NOGCCERROR=yes
MKPIC?= no
LIB= vassert
SRCS= backdoor.S vassert.c

View File

@ -1,8 +1,6 @@
# Makefile for libvirtio
.include <bsd.own.mk>
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= virtio

View File

@ -1,7 +1,5 @@
# Makefile for libvtreefs
NOGCCERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= vtreefs

View File

@ -90,7 +90,7 @@ fs_read(ino_t ino_nr, struct fsdriver_data * data, size_t bytes,
* return a partial result. Otherwise return the error.
*/
if (r < 0)
return (off > 0) ? off : r;
return (off > 0) ? (ssize_t)off : r;
off += len;
pos += len;
@ -151,7 +151,7 @@ fs_write(ino_t ino_nr, struct fsdriver_data * data, size_t bytes, off_t pos,
* return a partial result. Otherwise return the error.
*/
if (r < 0)
return (off > 0) ? off : r;
return (off > 0) ? (ssize_t)off : r;
off += r;
pos += r;

View File

@ -28,7 +28,7 @@ static LIST_HEAD(index_head, inode) *parent_index_head;
* Initialize the inode-related state.
*/
int
init_inodes(unsigned int inodes, struct inode_stat * stat,
init_inodes(unsigned int inodes, struct inode_stat * istat,
index_t nr_indexed_entries)
{
struct inode *node;
@ -91,7 +91,7 @@ init_inodes(unsigned int inodes, struct inode_stat * stat,
TAILQ_INIT(&node->i_children);
node->i_flags = 0;
node->i_index = NO_INDEX;
set_inode_stat(node, stat);
set_inode_stat(node, istat);
node->i_indexed = nr_indexed_entries;
node->i_cbdata = NULL;
@ -130,10 +130,10 @@ parent_name_hash(const struct inode * parent, const char *name)
* Return the hash value of a <parent,index> tuple.
*/
static int
parent_index_hash(const struct inode * parent, index_t index)
parent_index_hash(const struct inode * parent, index_t idx)
{
return (parent->i_num ^ index) % nr_inodes;
return (parent->i_num ^ idx) % nr_inodes;
}
/*
@ -182,8 +182,8 @@ purge_inode(struct inode * parent)
* Add an inode.
*/
struct inode *
add_inode(struct inode * parent, const char * name, index_t index,
const struct inode_stat * stat, index_t nr_indexed_entries,
add_inode(struct inode * parent, const char * name, index_t idx,
const struct inode_stat * istat, index_t nr_indexed_entries,
cbdata_t cbdata)
{
struct inode *newnode;
@ -194,8 +194,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
assert(S_ISDIR(parent->i_stat.mode));
assert(!(parent->i_flags & I_DELETED));
assert(strlen(name) <= NAME_MAX);
assert(index >= 0 || index == NO_INDEX);
assert(stat != NULL);
assert(idx >= 0 || idx == NO_INDEX);
assert(istat != NULL);
assert(nr_indexed_entries >= 0);
assert(get_inode_by_name(parent, name) == NULL);
@ -223,8 +223,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
newnode->i_parent = parent;
newnode->i_name = newname;
newnode->i_flags = 0;
newnode->i_index = index;
newnode->i_stat = *stat;
newnode->i_index = idx;
newnode->i_stat = *istat;
newnode->i_indexed = nr_indexed_entries;
newnode->i_cbdata = cbdata;
strcpy(newnode->i_name, name);
@ -240,8 +240,8 @@ add_inode(struct inode * parent, const char * name, index_t index,
LIST_INSERT_HEAD(&parent_name_head[slot], newnode, i_hname);
/* Add the inode to the <parent,index> hash table. */
if (index != NO_INDEX) {
slot = parent_index_hash(parent, index);
if (idx != NO_INDEX) {
slot = parent_index_hash(parent, idx);
LIST_INSERT_HEAD(&parent_index_head[slot], newnode, i_hindex);
}
@ -378,24 +378,24 @@ get_inode_number(const struct inode * node)
* Retrieve an inode's status.
*/
void
get_inode_stat(const struct inode * node, struct inode_stat * stat)
get_inode_stat(const struct inode * node, struct inode_stat * istat)
{
CHECK_INODE(node);
*stat = node->i_stat;
*istat = node->i_stat;
}
/*
* Set an inode's status.
*/
void
set_inode_stat(struct inode * node, struct inode_stat * stat)
set_inode_stat(struct inode * node, struct inode_stat * istat)
{
CHECK_INODE(node);
node->i_stat = *stat;
node->i_stat = *istat;
}
/*
@ -425,22 +425,22 @@ get_inode_by_name(const struct inode * parent, const char * name)
* Look up an inode using a <parent,index> tuple.
*/
struct inode *
get_inode_by_index(const struct inode * parent, index_t index)
get_inode_by_index(const struct inode * parent, index_t idx)
{
struct inode *node;
int slot;
CHECK_INODE(parent);
assert(S_ISDIR(parent->i_stat.mode));
assert(index >= 0);
assert(idx >= 0);
if (index >= parent->i_indexed)
if (idx >= parent->i_indexed)
return NULL;
/* Get the hash value, and search for the inode. */
slot = parent_index_hash(parent, index);
slot = parent_index_hash(parent, idx);
LIST_FOREACH(node, &parent_index_head[slot], i_hindex) {
if (parent == node->i_parent && index == node->i_index)
if (parent == node->i_parent && idx == node->i_index)
return node; /* found */
}

View File

@ -48,7 +48,7 @@ fs_slink(ino_t dir_nr, char * name, uid_t uid, gid_t gid,
{
char path[PATH_MAX];
struct inode *node;
struct inode_stat stat;
struct inode_stat istat;
int r;
if ((node = find_inode(dir_nr)) == NULL)
@ -67,14 +67,14 @@ fs_slink(ino_t dir_nr, char * name, uid_t uid, gid_t gid,
return r;
path[bytes] = 0;
memset(&stat, 0, sizeof(stat));
stat.mode = S_IFLNK | RWX_MODES;
stat.uid = uid;
stat.gid = gid;
stat.size = strlen(path);
stat.dev = 0;
memset(&istat, 0, sizeof(istat));
istat.mode = S_IFLNK | RWX_MODES;
istat.uid = uid;
istat.gid = gid;
istat.size = strlen(path);
istat.dev = 0;
return vtreefs_hooks->slink_hook(node, name, &stat, path,
return vtreefs_hooks->slink_hook(node, name, &istat, path,
get_inode_cbdata(node));
}
@ -86,7 +86,7 @@ fs_mknod(ino_t dir_nr, char * name, mode_t mode, uid_t uid, gid_t gid,
dev_t rdev)
{
struct inode *node;
struct inode_stat stat;
struct inode_stat istat;
if ((node = find_inode(dir_nr)) == NULL)
return EINVAL;
@ -97,14 +97,14 @@ fs_mknod(ino_t dir_nr, char * name, mode_t mode, uid_t uid, gid_t gid,
if (vtreefs_hooks->mknod_hook == NULL)
return ENOSYS;
memset(&stat, 0, sizeof(stat));
stat.mode = mode;
stat.uid = uid;
stat.gid = gid;
stat.size = 0;
stat.dev = rdev;
memset(&istat, 0, sizeof(istat));
istat.mode = mode;
istat.uid = uid;
istat.gid = gid;
istat.size = 0;
istat.dev = rdev;
return vtreefs_hooks->mknod_hook(node, name, &stat,
return vtreefs_hooks->mknod_hook(node, name, &istat,
get_inode_cbdata(node));
}

View File

@ -49,7 +49,7 @@ int
fs_chmod(ino_t ino_nr, mode_t * mode)
{
struct inode *node;
struct inode_stat stat;
struct inode_stat istat;
int r;
if ((node = find_inode(ino_nr)) == NULL)
@ -58,18 +58,18 @@ fs_chmod(ino_t ino_nr, mode_t * mode)
if (vtreefs_hooks->chstat_hook == NULL)
return ENOSYS;
get_inode_stat(node, &stat);
get_inode_stat(node, &istat);
stat.mode = (stat.mode & ~ALL_MODES) | (*mode & ALL_MODES);
istat.mode = (istat.mode & ~ALL_MODES) | (*mode & ALL_MODES);
r = vtreefs_hooks->chstat_hook(node, &stat, get_inode_cbdata(node));
r = vtreefs_hooks->chstat_hook(node, &istat, get_inode_cbdata(node));
if (r != OK)
return r;
get_inode_stat(node, &stat);
get_inode_stat(node, &istat);
*mode = stat.mode;
*mode = istat.mode;
return OK;
}
@ -81,7 +81,7 @@ int
fs_chown(ino_t ino_nr, uid_t uid, gid_t gid, mode_t * mode)
{
struct inode *node;
struct inode_stat stat;
struct inode_stat istat;
int r;
if ((node = find_inode(ino_nr)) == NULL)
@ -90,20 +90,20 @@ fs_chown(ino_t ino_nr, uid_t uid, gid_t gid, mode_t * mode)
if (vtreefs_hooks->chstat_hook == NULL)
return ENOSYS;
get_inode_stat(node, &stat);
get_inode_stat(node, &istat);
stat.uid = uid;
stat.gid = gid;
stat.mode &= ~(S_ISUID | S_ISGID);
istat.uid = uid;
istat.gid = gid;
istat.mode &= ~(S_ISUID | S_ISGID);
r = vtreefs_hooks->chstat_hook(node, &stat, get_inode_cbdata(node));
r = vtreefs_hooks->chstat_hook(node, &istat, get_inode_cbdata(node));
if (r != OK)
return r;
get_inode_stat(node, &stat);
get_inode_stat(node, &istat);
*mode = stat.mode;
*mode = istat.mode;
return OK;
}

View File

@ -36,10 +36,10 @@ init_server(int __unused type, sef_init_info_t * __unused info)
* We received a signal.
*/
static void
got_signal(int signal)
got_signal(int sig)
{
if (signal != SIGTERM)
if (sig != SIGTERM)
return;
fsdriver_terminate();
@ -86,7 +86,7 @@ fs_other(const message * m_ptr, int ipc_status)
*/
void
run_vtreefs(struct fs_hooks * hooks, unsigned int nr_inodes,
size_t inode_extra, struct inode_stat * stat,
size_t inode_extra, struct inode_stat * istat,
index_t nr_indexed_entries, size_t bufsize)
{
@ -97,7 +97,7 @@ run_vtreefs(struct fs_hooks * hooks, unsigned int nr_inodes,
vtreefs_hooks = hooks;
inodes = nr_inodes;
extra_size = inode_extra;
root_stat = stat;
root_stat = istat;
root_entries = nr_indexed_entries;
buf_size = bufsize;

View File

@ -27,7 +27,7 @@ PUBLIC int magic_create_dsentry(struct _magic_dsentry *dsentry,
char *name, char *parent_name);
PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr,
struct _magic_type *type, size_t size, int flags,
char *name, char *parent_name);
const char *name, char *parent_name);
PUBLIC int magic_update_dsentry_state(struct _magic_dsentry *dsentry,
unsigned long mstate);
PUBLIC void magic_free_dead_dsentries();

View File

@ -4,7 +4,8 @@
/* Public functions for special types and regions. */
PUBLIC void st_register_typename_key(char *key);
PUBLIC void st_register_typename_keys(char **keys);
PUBLIC int st_add_special_mmapped_region(void *address, size_t size, char* name);
PUBLIC int st_add_special_mmapped_region(void *address, size_t size,
const char* name);
PUBLIC int st_del_special_mmapped_region_by_addr(void *address);
#endif /* ST_SPECIAL_H */

View File

@ -540,7 +540,7 @@ PUBLIC int magic_create_dsentry(struct _magic_dsentry *dsentry,
*===========================================================================*/
PUBLIC struct _magic_obdsentry* magic_create_obdsentry(void *data_ptr,
struct _magic_type *type, size_t size, int flags,
char *name, char *parent_name)
const char *name, char *parent_name)
{
struct _magic_obdsentry *obdsentry = NULL;
int i, ret;

View File

@ -437,7 +437,7 @@ PUBLIC void st_stack_refs_save_restore(char* stack_buff, int is_save)
/* Metadata management. */
PUBLIC int st_add_special_mmapped_region(void *address, size_t size,
char* name)
const char* name)
{
struct _magic_obdsentry* obdsentry;
char addr_name[24];

View File

@ -12,10 +12,6 @@ SRCS= buf.c clock.c inet.c inet_config.c \
.PATH: ${.CURDIR}/generic
WARNS=
NOCLANGERROR=yes
DPADD+= ${LIBCHARDRIVER} ${LIBSYS}
LDADD+= -lchardriver -lsys

View File

@ -759,7 +759,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return;
}
if (rc < strlen(buf)) {
if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes");
}
@ -787,7 +787,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return;
}
if (rc < strlen(buf)) {
if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes");
}
@ -815,7 +815,7 @@ static void test_xfer_server(const struct socket_test_info *info, pid_t pid)
return;
}
if (rc < strlen(buf)) {
if (rc < strlen((char *)buf)) {
test_fail("[server] write didn't write all the bytes");
}

View File

@ -597,8 +597,8 @@ gid_t * r_gid;
perror(PASSWD_FILE);
}
while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) {
p = strchr(line, ':');
if (p != NULL) p = strchr(p + 1, ':');
p = (unsigned char *)strchr(line, ':');
if (p != NULL) p = (unsigned char *)strchr((char *)p + 1, ':');
if (p != NULL) {
p++;
uid = 0;

View File

@ -337,8 +337,8 @@ gid_t *r_gid;
perror(PASSWD_FILE);
}
while (fp != NULL && fgets(line, sizeof(line), fp) != NULL) {
p = strchr(line, ':');
if (p != NULL) p = strchr(p + 1, ':');
p = (unsigned char *)strchr(line, ':');
if (p != NULL) p = (unsigned char *)strchr((char *)p + 1, ':');
if (p != NULL) {
p++;
uid = 0;

View File

@ -172,7 +172,7 @@ void timed_test_func(const char *s, void (* func)(void))
}
pid_t traced_fork(c)
void(*c) (void);
void (*c)(void);
{
pid_t pid;
int r, status;
@ -333,6 +333,9 @@ void(*c) (void);
detach_running(ppid);
break;
default:
abort();
}
return pid;

View File

@ -1224,7 +1224,7 @@ static void test_fd_passing(void) {
}
}
static void test_select()
static void test_select(void)
{
int nfds = -1;
int socks[2];
@ -1344,7 +1344,7 @@ static void test_select_close(void)
close(socks[0]);
}
static void test_fchmod()
static void test_fchmod(void)
{
int socks[2];
struct stat st1, st2;

View File

@ -25,13 +25,13 @@ int subtest = 1;
int main(void);
void quit(void);
static void test_clock_getres();
static void test_clock_gettime();
static void test_clock_settime();
static void test_adjtime();
static void test_clock_getres(void);
static void test_clock_gettime(void);
static void test_clock_settime(void);
static void test_adjtime(void);
static void show_timespec(char *msg, struct timespec *ts);
static void test_clock_getres()
static void test_clock_getres(void)
{
struct timespec res;
@ -47,7 +47,7 @@ static void test_clock_getres()
if (clock_getres(-1, &res) == 0) e(14);
}
static void test_clock_gettime()
static void test_clock_gettime(void)
{
struct timespec ts, ts2;
@ -148,7 +148,7 @@ static void show_timespec(char *msg, struct timespec *ts)
#endif /* DEBUG == 1 */
}
int main()
int main(void)
{
start(69);
struct timespec starttime, endtime;

View File

@ -62,7 +62,7 @@ doseeks(int seekbase)
}
int
main()
main(void)
{
start(70);
pid_t f;

View File

@ -187,7 +187,7 @@ static void do_readlink2(void *buf, int fd, int writable)
((char *) buf)[rl] = '\0';
if(strcmp(buf, TARGETNAME)) {
fprintf(stderr, "readlink: expected %s, got %s\n",
TARGETNAME, buf);
TARGETNAME, (char *)buf);
e(3);
}
return;

View File

@ -733,6 +733,8 @@ static void send_packet_ip(
fragsize = payloadsize;
fragstep = 0;
break;
default:
abort();
}
while (fragcount > 0) {

View File

@ -10,6 +10,5 @@ MAN?=
CPPFLAGS+= -I${.CURDIR}
NOGCCERROR?= yes
NOCLANGERROR?= yes
.include <bsd.prog.mk>

View File

@ -430,7 +430,7 @@ main(int argc, char *argv[])
(int)next_inode-1, next_zone);
}
if(insertmode) printf("%llu\n", written_fs_size);
if(insertmode) printf("%"PRIu64"\n", written_fs_size);
return(0);

View File

@ -1,7 +1,4 @@
PROG= mkproto
MAN=
NOGCCERROR?= yes
NOCLANGERROR?= yes
.include <bsd.prog.mk>