diff --git a/commands/partition/partition.c b/commands/partition/partition.c index a2d555b7e..8a456efe4 100644 --- a/commands/partition/partition.c +++ b/commands/partition/partition.c @@ -296,8 +296,8 @@ void geometry(void) /* Use the same fake geometry as part. */ if (fstat(fd, &sb) < 0) fatal(device); - geometry.base= cvul64(0); - geometry.size= cvul64(sb.st_size); + geometry.base= ((u64_t)(0)); + geometry.size= ((u64_t)(sb.st_size)); geometry.sectors= 32; geometry.heads= 64; geometry.cylinders= (sb.st_size-1)/SECTOR_SIZE/ diff --git a/commands/vol/vol.c b/commands/vol/vol.c index 43264912b..845c08a45 100644 --- a/commands/vol/vol.c +++ b/commands/vol/vol.c @@ -48,7 +48,7 @@ char *buffer = NULL; size_t block_size = 0, mult_max = 0; size_t buffer_size; -long volume_size; +u64_t volume_size; char *str_vol_size; int rflag = 0, wflag = 0, oneflag = 0, variable = 0; @@ -194,7 +194,7 @@ char *argv[]; if (ioctl(fd, DIOCGETP, &part) < 0) { autovolsize = 0; } else { - volume_size = cv64ul(part.size); + volume_size = part.size; } } diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index b859e1685..27ebb7966 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -380,8 +380,7 @@ static int atapi_read_capacity(struct port_state *ps, int cmd) /* Store the number of LBA blocks and sector size. */ buf = ps->tmp_base; - ps->lba_count = add64u(cvu64((buf[0] << 24) | (buf[1] << 16) | - (buf[2] << 8) | buf[3]), 1); + ps->lba_count = add64u(((u64_t)((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3])), 1); ps->sector_size = (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7]; @@ -395,7 +394,7 @@ static int atapi_read_capacity(struct port_state *ps, int cmd) dprintf(V_INFO, ("%s: medium detected (%u byte sectors, %lu MB size)\n", ahci_portname(ps), ps->sector_size, - div64u(mul64(ps->lba_count, cvu64(ps->sector_size)), + div64u(mul64(ps->lba_count, ((u64_t)(ps->sector_size))), 1024*1024))); return OK; @@ -1175,7 +1174,7 @@ static ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof, if (cmp64(add64ul(pos, size), eof) >= 0) size = (vir_bytes) diff64(eof, pos); - start_lba = div64(pos, cvu64(ps->sector_size)); + start_lba = div64(pos, ((u64_t)(ps->sector_size))); lead = rem64u(pos, ps->sector_size); count = (lead + size + ps->sector_size - 1) / ps->sector_size; @@ -1429,7 +1428,7 @@ static void port_id_check(struct port_state *ps, int success) if (ps->flags & FLAG_HAS_MEDIUM) printf(", %u byte sectors, %lu MB size", ps->sector_size, div64u(mul64(ps->lba_count, - cvu64(ps->sector_size)), 1024*1024)); + ((u64_t)(ps->sector_size))), 1024*1024)); printf("\n"); } @@ -2522,7 +2521,7 @@ static int ahci_open(dev_t minor, int access) memset(ps->subpart, 0, sizeof(ps->subpart)); ps->part[0].dv_size = - mul64(ps->lba_count, cvu64(ps->sector_size)); + mul64(ps->lba_count, ((u64_t)(ps->sector_size))); partition(&ahci_dtab, ps->device * DEV_PER_DRIVE, P_PRIMARY, !!(ps->flags & FLAG_ATAPI)); diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 5108cf6ad..c3148cc98 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -975,7 +975,7 @@ static int w_io_test(void) w_testing = 1; /* Try I/O on the actual drive (not any (sub)partition). */ - r = w_transfer(w_drive * DEV_PER_DRIVE, FALSE /*do_write*/, cvu64(0), + r = w_transfer(w_drive * DEV_PER_DRIVE, FALSE /*do_write*/, ((u64_t)(0)), SELF, &iov, 1, BDEV_NOFLAGS); /* Switch back. */ diff --git a/drivers/fbd/action.c b/drivers/fbd/action.c index dd7d93c1c..a4b985620 100644 --- a/drivers/fbd/action.c +++ b/drivers/fbd/action.c @@ -54,7 +54,7 @@ static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size, off = 0; } else { - if (skip != NULL) *skip = cvu64(0); + if (skip != NULL) *skip = ((u64_t)(0)); delta = sub64(rule->start, pos); diff --git a/drivers/floppy/floppy.c b/drivers/floppy/floppy.c index 1150837d2..43f15f402 100644 --- a/drivers/floppy/floppy.c +++ b/drivers/floppy/floppy.c @@ -461,7 +461,7 @@ static ssize_t f_transfer( iovec_t *iop, *iov_end = iov + nr_req; int s, r, errors, nr; unsigned block, nbytes, count, chunk, sector; - unsigned long dv_size; + u64_t dv_size; vir_bytes user_offset, iov_offset = 0, iop_offset; unsigned long position; signed long uoffsets[MAX_SECTORS], *up; @@ -472,11 +472,11 @@ static ssize_t f_transfer( if (f_prepare(minor) == NULL) return(ENXIO); fp = f_fp; - dv_size = cv64ul(f_dv->dv_size); + dv_size = f_dv->dv_size; if (ex64hi(pos64) != 0) return OK; /* Way beyond EOF */ - position= cv64ul(pos64); + position= pos64; total = 0; /* Record the direction of the last transfer performed. */ @@ -1338,7 +1338,7 @@ static int test_read(int density) position = (off_t) f_dp->test << SECTOR_SHIFT; iovec1.iov_addr = (vir_bytes) floppy_buf; iovec1.iov_size = SECTOR_SIZE; - result = f_transfer(device, FALSE /*do_write*/, cvul64(position), SELF, + result = f_transfer(device, FALSE /*do_write*/, position, SELF, &iovec1, 1, BDEV_NOFLAGS); if (result != SECTOR_SIZE) return(EIO); diff --git a/drivers/log/log.c b/drivers/log/log.c index 44f2d55cf..5de3d89df 100644 --- a/drivers/log/log.c +++ b/drivers/log/log.c @@ -101,8 +101,8 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) /* Initialize log devices. */ for(i = 0; i < NR_DEVS; i++) { - log_geom[i].dv_size = cvul64(LOG_SIZE); - log_geom[i].dv_base = cvul64((long)logdevices[i].log_buffer); + log_geom[i].dv_size = ((u64_t)(LOG_SIZE)); + log_geom[i].dv_base = ((u64_t)((long)logdevices[i].log_buffer)); logdevices[i].log_size = logdevices[i].log_read = logdevices[i].log_write = logdevices[i].log_select_alerted = diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 4e8df02fe..d42167864 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -167,16 +167,16 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) #endif /* Ramdisk image built into the memory driver */ - m_geom[IMGRD_DEV].dv_base= cvul64(0); - m_geom[IMGRD_DEV].dv_size= cvul64(imgrd_size); + m_geom[IMGRD_DEV].dv_base= ((u64_t)(0)); + m_geom[IMGRD_DEV].dv_size= ((u64_t)(imgrd_size)); m_vaddrs[IMGRD_DEV] = (vir_bytes) imgrd; for(i = 0; i < NR_DEVS; i++) openct[i] = 0; /* Set up memory range for /dev/mem. */ - m_geom[MEM_DEV].dv_base = cvul64(0); - m_geom[MEM_DEV].dv_size = cvul64(0xffffffff); + m_geom[MEM_DEV].dv_base = ((u64_t)(0)); + m_geom[MEM_DEV].dv_size = ((u64_t)(0xffffffff)); m_vaddrs[MEM_DEV] = (vir_bytes) MAP_FAILED; /* we are not mapping this in. */ @@ -231,20 +231,20 @@ static int m_transfer( unsigned count; vir_bytes vir_offset = 0; struct device *dv; - unsigned long dv_size; + u64_t dv_size; int s, r; - off_t position; + u64_t position; cp_grant_id_t grant; vir_bytes dev_vaddr; /* ZERO_DEV and NULL_DEV are infinite in size. */ if (m_device != ZERO_DEV && m_device != NULL_DEV && ex64hi(pos64) != 0) return OK; /* Beyond EOF */ - position= cv64ul(pos64); + position= pos64; /* Get minor device number and check for /dev/null. */ dv = &m_geom[m_device]; - dv_size = cv64ul(dv->dv_size); + dv_size = dv->dv_size; dev_vaddr = m_vaddrs[m_device]; while (nr_req > 0) { @@ -435,21 +435,21 @@ static int m_block_transfer( unsigned count; vir_bytes vir_offset = 0; struct device *dv; - unsigned long dv_size; + u64_t dv_size; int r; - off_t position; + u64_t position; vir_bytes dev_vaddr; cp_grant_id_t grant; ssize_t total = 0; /* Get minor device information. */ if ((dv = m_block_part(minor)) == NULL) return(ENXIO); - dv_size = cv64ul(dv->dv_size); + dv_size = dv->dv_size; dev_vaddr = m_vaddrs[minor]; if (ex64hi(pos64) != 0) return OK; /* Beyond EOF */ - position= cv64ul(pos64); + position= pos64; while (nr_req > 0) { @@ -554,7 +554,7 @@ static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, return s; if(is_imgrd) ramdev_size = 0; - if(m_vaddrs[minor] && !cmp64(dv->dv_size, cvul64(ramdev_size))) { + if(m_vaddrs[minor] && !cmp64(dv->dv_size, ((u64_t)(ramdev_size)))) { return(OK); } /* openct is 1 for the ioctl(). */ @@ -602,7 +602,7 @@ static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, m_vaddrs[minor] = (vir_bytes) mem; - dv->dv_size = cvul64(ramdev_size); + dv->dv_size = ((u64_t)(ramdev_size)); return(OK); } diff --git a/drivers/vbox/hgcm.c b/drivers/vbox/hgcm.c index 2955fe5a3..68d68a912 100644 --- a/drivers/vbox/hgcm.c +++ b/drivers/vbox/hgcm.c @@ -524,7 +524,7 @@ static int store_pages(int conn, int req, vbox_param_t *inp, size_t *offp) assert(!(pvec[j].vp_addr & (PAGE_SIZE - 1))); pagelist->addr[pagelist->count++] = - cvul64(pvec[j].vp_addr); + ((u64_t)(pvec[j].vp_addr)); if (pvec[j].vp_size > PAGE_SIZE) { pvec[j].vp_addr += PAGE_SIZE; diff --git a/include/minix/u64.h b/include/minix/u64.h index aa0059c15..807abfe7c 100644 --- a/include/minix/u64.h +++ b/include/minix/u64.h @@ -71,34 +71,6 @@ static inline int cmp64ul(u64_t i, unsigned long j) return 0; } -static inline unsigned cv64u(u64_t i) -{ -/* return ULONG_MAX if really big */ - if (i>>32) - return ULONG_MAX; - - return (unsigned)i; -} - -static inline unsigned long cv64ul(u64_t i) -{ -/* return ULONG_MAX if really big */ - if (i>>32) - return ULONG_MAX; - - return (unsigned long)i; -} - -static inline u64_t cvu64(unsigned i) -{ - return i; -} - -static inline u64_t cvul64(unsigned long i) -{ - return i; -} - static inline unsigned diff64(u64_t i, u64_t j) { return (unsigned)(i - j); diff --git a/lib/libblockdriver/trace.c b/lib/libblockdriver/trace.c index bf80cc836..395066847 100644 --- a/lib/libblockdriver/trace.c +++ b/lib/libblockdriver/trace.c @@ -195,7 +195,7 @@ void trace_start(thread_id_t id, message *m_ptr) switch (m_ptr->m_type) { case BDEV_OPEN: case BDEV_CLOSE: - pos = cvu64(0); + pos = ((u64_t)(0)); size = m_ptr->BDEV_ACCESS; flags = 0; @@ -212,7 +212,7 @@ void trace_start(thread_id_t id, message *m_ptr) break; case BDEV_IOCTL: - pos = cvu64(0); + pos = ((u64_t)(0)); size = m_ptr->BDEV_REQUEST; flags = 0; diff --git a/lib/libc/sys-minix/sizeup.c b/lib/libc/sys-minix/sizeup.c index abf5323d2..41c0245b1 100644 --- a/lib/libc/sys-minix/sizeup.c +++ b/lib/libc/sys-minix/sizeup.c @@ -41,9 +41,9 @@ u64_t *bytes; perror("sizeup ioctl"); if(fstat(fd, &st) < 0) { perror("fstat"); - entry.size = cvu64(0); + entry.size = ((u64_t)(0)); } else { - entry.size = cvu64(st.st_size); + entry.size = ((u64_t)(st.st_size)); } } close(fd); diff --git a/lib/libsys/arch/i386/profile.c b/lib/libsys/arch/i386/profile.c index 3acbbc8a7..51c90f711 100644 --- a/lib/libsys/arch/i386/profile.c +++ b/lib/libsys/arch/i386/profile.c @@ -197,7 +197,7 @@ void procexit (char *UNUSED(name)) sub64(spent, cprof_stk[cprof_stk_top].spent_deeper)); /* Clear spent_deeper for call level we're leaving. */ - cprof_stk[cprof_stk_top].spent_deeper = cvu64(0); + cprof_stk[cprof_stk_top].spent_deeper = ((u64_t)(0)); /* Adjust call path string and stack. */ cpath_len = cprof_stk[cprof_stk_top].cpath_len; @@ -242,9 +242,9 @@ static void cprof_init() for (i=0; i= 0); /* So we can safely cast it to unsigned below */ - bp = rahead(rip, b, cvul64((unsigned long) rdahedpos), block_size); + bp = rahead(rip, b, ((u64_t)((unsigned long)rdahedpos)), block_size); put_block(bp, PARTIAL_DATA_BLOCK); } diff --git a/servers/ext2/super.c b/servers/ext2/super.c index 27c455cde..5fb69c5f5 100644 --- a/servers/ext2/super.c +++ b/servers/ext2/super.c @@ -92,7 +92,7 @@ register struct super_block *sp; /* pointer to a superblock */ panic("can't allocate memory for super_block buffers"); assert(_MIN_BLOCK_SIZE <= sizeof(*ondisk_superblock)); - r = bdev_read(dev, cvu64(super_block_offset), (char*) ondisk_superblock, + r = bdev_read(dev, ((u64_t)(super_block_offset)), (char*) ondisk_superblock, _MIN_BLOCK_SIZE, BDEV_NOFLAGS); if (r != _MIN_BLOCK_SIZE) @@ -177,7 +177,7 @@ register struct super_block *sp; /* pointer to a superblock */ gdt_position = (opt.block_with_super + 1) * 1024; } - r = bdev_read(dev, cvu64(gdt_position), (char*) ondisk_group_descs, + r = bdev_read(dev, ((u64_t)(gdt_position)), (char*) ondisk_group_descs, gd_size, BDEV_NOFLAGS); if (r != (ssize_t) gd_size) { printf("Can not read group descriptors\n"); @@ -230,7 +230,7 @@ struct super_block *sp; /* pointer to a superblock */ super_copy(ondisk_superblock, sp); - r = bdev_write(sp->s_dev, cvu64(super_block_offset), (char *) sp, + r = bdev_write(sp->s_dev, ((u64_t)(super_block_offset)), (char *) sp, SUPER_SIZE_D, BDEV_NOFLAGS); if (r != SUPER_SIZE_D) printf("ext2: Warning, failed to write superblock to the disk!\n"); @@ -248,7 +248,7 @@ struct super_block *sp; /* pointer to a superblock */ copy_group_descriptors(ondisk_group_descs, sp->s_group_desc, sp->s_groups_count); - r = bdev_write(sp->s_dev, cvu64(gdt_position), + r = bdev_write(sp->s_dev, ((u64_t)(gdt_position)), (char*) ondisk_group_descs, gd_size, BDEV_NOFLAGS); if (r != (ssize_t) gd_size) { printf("Can not write group descriptors\n"); diff --git a/servers/iso9660fs/read.c b/servers/iso9660fs/read.c index 2e6073a6c..f43bd1c7c 100644 --- a/servers/iso9660fs/read.c +++ b/servers/iso9660fs/read.c @@ -54,7 +54,7 @@ int fs_read(void) { if (chunk > bytes_left) chunk = (int) bytes_left; /* Read or write 'chunk' bytes. */ - r = read_chunk(dir, cvul64(position), off, chunk, (unsigned) nrbytes, + r = read_chunk(dir, ((u64_t)(position)), off, chunk, (unsigned) nrbytes, gid, cum_io, block_size, &completed, rw); if (r != OK) break; /* EOF reached */ diff --git a/servers/iso9660fs/super.c b/servers/iso9660fs/super.c index 6d1381b0c..0df66b113 100644 --- a/servers/iso9660fs/super.c +++ b/servers/iso9660fs/super.c @@ -91,7 +91,7 @@ int read_vds( static char sbbuf[ISO9660_MIN_BLOCK_SIZE]; int i = 0; - offset = cvul64(ISO9660_SUPER_BLOCK_POSITION); + offset = ((u64_t)(ISO9660_SUPER_BLOCK_POSITION)); while (!vol_ok && i++s_dev, cvu64(SUPER_BLOCK_BYTES), sbbuf, _MIN_BLOCK_SIZE, + r = bdev_write(sp->s_dev, ((u64_t)(SUPER_BLOCK_BYTES)), sbbuf, _MIN_BLOCK_SIZE, BDEV_NOFLAGS); } else { - r = bdev_read(sp->s_dev, cvu64(SUPER_BLOCK_BYTES), sbbuf, _MIN_BLOCK_SIZE, + r = bdev_read(sp->s_dev, ((u64_t)(SUPER_BLOCK_BYTES)), sbbuf, _MIN_BLOCK_SIZE, BDEV_NOFLAGS); memset(sp, 0, sizeof(*sp)); memcpy(sp, sbbuf, ondisk_bytes); diff --git a/servers/vfs/device.c b/servers/vfs/device.c index b9984e18d..e52db1086 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -680,7 +680,7 @@ int do_ioctl(message *UNUSED(m_out)) if (S_ISBLK(vp->v_mode)) r = bdev_ioctl(dev, who_e, ioctlrequest, argx); else - r = dev_io(VFS_DEV_IOCTL, dev, who_e, argx, cvu64(0), + r = dev_io(VFS_DEV_IOCTL, dev, who_e, argx, ((u64_t)(0)), ioctlrequest, f->filp_flags, suspend_reopen); } diff --git a/servers/vfs/exec.c b/servers/vfs/exec.c index 9e9b6d096..8a58a77ee 100644 --- a/servers/vfs/exec.c +++ b/servers/vfs/exec.c @@ -567,7 +567,7 @@ char path[PATH_MAX]; /* path to script file */ pos = 0; /* Read from the start of the file */ /* Issue request */ - r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(pos), READING, + r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, ((u64_t)(pos)), READING, VFS_PROC_NR, buf, _MAX_BLOCK_SIZE, &new_pos, &cum_io); if (r != OK) return(r); @@ -692,7 +692,7 @@ static int read_seg(struct exec_info *execi, off_t off, off_t seg_addr, size_t s if (off + seg_bytes > LONG_MAX) return(EIO); if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO); - if ((r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(off), READING, + if ((r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, ((u64_t)(off)), READING, execi->proc_e, (char*)seg_addr, seg_bytes, &new_pos, &cum_io)) != OK) { printf("VFS: read_seg: req_readwrite failed (data)\n"); @@ -739,7 +739,7 @@ static int map_header(struct vfs_exec_info *execi) execi->args.hdr = hdr; r = req_readwrite(execi->vp->v_fs_e, execi->vp->v_inode_nr, - cvul64(pos), READING, VFS_PROC_NR, hdr, + ((u64_t)(pos)), READING, VFS_PROC_NR, hdr, execi->args.hdr_len, &new_pos, &cum_io); if (r != OK) { printf("VFS: exec: map_header: req_readwrite failed\n"); diff --git a/servers/vfs/filedes.c b/servers/vfs/filedes.c index c0328cdbc..51c057e75 100644 --- a/servers/vfs/filedes.c +++ b/servers/vfs/filedes.c @@ -177,7 +177,7 @@ int get_fd(struct fproc *rfp, int start, mode_t bits, int *k, struct filp **fpt) assert(f->filp_count >= 0); if (f->filp_count == 0 && mutex_trylock(&f->filp_lock) == 0) { f->filp_mode = bits; - f->filp_pos = cvu64(0); + f->filp_pos = ((u64_t)(0)); f->filp_selectors = 0; f->filp_select_ops = 0; f->filp_pipe_select_ops = 0; diff --git a/servers/vfs/open.c b/servers/vfs/open.c index 9e6f2ec67..71efa1dec 100644 --- a/servers/vfs/open.c +++ b/servers/vfs/open.c @@ -608,9 +608,9 @@ int actual_lseek(message *m_out, int seekfd, int seekwhence, off_t offset) /* The value of 'whence' determines the start position to use. */ switch(seekwhence) { - case SEEK_SET: pos = cvu64(0); break; + case SEEK_SET: pos = ((u64_t)(0)); break; case SEEK_CUR: pos = rfilp->filp_pos; break; - case SEEK_END: pos = cvul64(rfilp->filp_vno->v_size); break; + case SEEK_END: pos = ((u64_t)(rfilp->filp_vno->v_size)); break; default: unlock_filp(rfilp); return(EINVAL); } @@ -675,9 +675,9 @@ int actual_llseek(struct fproc *rfp, message *m_out, int seekfd, int seekwhence, /* The value of 'whence' determines the start position to use. */ switch(seekwhence) { - case SEEK_SET: pos = cvu64(0); break; + case SEEK_SET: pos = ((u64_t)(0)); break; case SEEK_CUR: pos = rfilp->filp_pos; break; - case SEEK_END: pos = cvul64(rfilp->filp_vno->v_size); break; + case SEEK_END: pos = ((u64_t)(rfilp->filp_vno->v_size)); break; default: unlock_filp(rfilp); return(EINVAL); } diff --git a/servers/vfs/read.c b/servers/vfs/read.c index 57bf38615..a96f07066 100644 --- a/servers/vfs/read.c +++ b/servers/vfs/read.c @@ -205,7 +205,7 @@ int read_write(struct fproc *rfp, int rw_flag, struct filp *f, } else { /* Regular files */ if (rw_flag == WRITING) { /* Check for O_APPEND flag. */ - if (f->filp_flags & O_APPEND) position = cvul64(vp->v_size); + if (f->filp_flags & O_APPEND) position = ((u64_t)(vp->v_size)); } /* Issue request */ @@ -315,7 +315,7 @@ size_t req_size; oflags = f->filp_flags; vp = f->filp_vno; - position = cvu64(0); /* Not actually used */ + position = ((u64_t)(0)); /* Not actually used */ assert(rw_flag == READING || rw_flag == WRITING); diff --git a/servers/vfs/request.c b/servers/vfs/request.c index d1cd0b02e..71ea86ae2 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -330,7 +330,7 @@ int req_getdents( cpf_revoke(grant_id); if (r == OK) { - *new_pos = cvul64(m.RES_SEEK_POS_LO); + *new_pos = ((u64_t)(m.RES_SEEK_POS_LO)); r = m.RES_NBYTES; } @@ -808,7 +808,7 @@ unsigned int *cum_iop; if (r == OK) { /* Fill in response structure */ - *new_posp = cvul64(m.RES_SEEK_POS_LO); + *new_posp = ((u64_t)(m.RES_SEEK_POS_LO)); *cum_iop = m.RES_NBYTES; } diff --git a/servers/vfs/select.c b/servers/vfs/select.c index 191b01ffc..53f183bf9 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -383,7 +383,7 @@ static int select_request_async(struct filp *f, int *ops, int block) f->filp_select_flags &= ~FSF_UPDATE; r = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL, - cvu64(0), 0, 0, FALSE); + ((u64_t)(0)), 0, 0, FALSE); if (r < 0 && r != SUSPEND) return(r); @@ -435,7 +435,7 @@ static int select_request_sync(struct filp *f, int *ops, int block) rops = *ops; if (block) rops |= SEL_NOTIFY; *ops = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL, - cvu64(0), 0, 0, FALSE); + ((u64_t)(0)), 0, 0, FALSE); if (*ops < 0) return(*ops); diff --git a/test/blocktest/blocktest.c b/test/blocktest/blocktest.c index 9804a1c17..8d5d12254 100644 --- a/test/blocktest/blocktest.c +++ b/test/blocktest/blocktest.c @@ -532,7 +532,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, buf_size + buf2_size + buf3_size, &res); test_sum(buf_ptr, buf_size, buf_sum, FALSE, &res); @@ -549,7 +549,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -561,7 +561,7 @@ static void bad_read2(void) memcpy(iov, iovt, sizeof(iovt)); iov[1].iov_size = (vir_bytes) LONG_MAX + 1; - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -574,7 +574,7 @@ static void bad_read2(void) iov[0].iov_size = LONG_MAX / 2 - 1; iov[1].iov_size = LONG_MAX / 2 - 1; - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -587,7 +587,7 @@ static void bad_read2(void) iov[0].iov_size = LONG_MAX - 1; iov[1].iov_size = LONG_MAX - 1; - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -604,7 +604,7 @@ static void bad_read2(void) buf3_sum = fill_rand(buf3_ptr, buf3_size); c1 = buf2_ptr[buf2_size - 1]; - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, BUF_SIZE * 3 - 1, + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, BUF_SIZE * 3 - 1, &res); if (accept_result(&res, RESULT_BADSTATUS, EINVAL)) { @@ -631,7 +631,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); /* Do not test the first buffer, as it may contain a partial result. */ test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -653,7 +653,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); accept_result(&res, RESULT_BADSTATUS, EPERM); @@ -675,7 +675,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, EINVAL, &res); accept_result(&res, RESULT_BADSTATUS, EPERM); @@ -702,7 +702,7 @@ static void bad_read2(void) c1 = buf2_ptr[0]; c2 = buf2_ptr[buf2_size - 1]; - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, BUF_SIZE * 3 - 2, + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, BUF_SIZE * 3 - 2, &res); if (accept_result(&res, RESULT_BADSTATUS, EINVAL)) { @@ -730,7 +730,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(1), iov, 3, FALSE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(1)), iov, 3, FALSE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -745,7 +745,7 @@ static void bad_read2(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, FALSE, + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, FALSE, buf_size + buf2_size + buf3_size, &res); test_sum(buf_ptr, buf_size, buf_sum, FALSE, &res); @@ -801,7 +801,7 @@ static void bad_write(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(SECTOR_UNALIGN), iov, 3, TRUE, EINVAL, + raw_xfer(driver_minor, ((u64_t)(SECTOR_UNALIGN)), iov, 3, TRUE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); @@ -818,7 +818,7 @@ static void bad_write(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, TRUE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, TRUE, EINVAL, &res); test_sum(buf_ptr, buf_size, buf_sum, TRUE, &res); test_sum(buf2_ptr, buf2_size, buf2_sum, TRUE, &res); @@ -838,7 +838,7 @@ static void bad_write(void) buf2_sum = fill_rand(buf2_ptr, buf2_size); buf3_sum = fill_rand(buf3_ptr, buf3_size); - raw_xfer(driver_minor, cvu64(0), iov, 3, TRUE, EINVAL, &res); + raw_xfer(driver_minor, ((u64_t)(0)), iov, 3, TRUE, EINVAL, &res); accept_result(&res, RESULT_BADSTATUS, EPERM); @@ -868,7 +868,7 @@ static void vector_and_large_sub(size_t small_size) result_t res; int i; - base_pos = cvu64(sector_size); + base_pos = ((u64_t)(sector_size)); large_size = small_size * NR_IOREQS; @@ -1185,7 +1185,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* Read one sector up to the partition limit. */ fill_rand(buf_ptr, buf_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, sector_size, FALSE, sector_size, &res); sum = get_sum(buf_ptr, sector_size); @@ -1195,7 +1195,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* Read three sectors up to the partition limit. */ fill_rand(buf_ptr, buf_size); - simple_xfer(sub0_minor, cvu64(sub_size - buf_size), buf_ptr, buf_size, + simple_xfer(sub0_minor, ((u64_t)(sub_size - buf_size)), buf_ptr, buf_size, FALSE, buf_size, &res); test_sum(buf_ptr + sector_size * 2, sector_size, sum, TRUE, &res); @@ -1208,7 +1208,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) fill_rand(buf_ptr, buf_size); sum3 = get_sum(buf_ptr + sector_size * 2, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size * 2), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr, buf_size, FALSE, sector_size * 2, &res); test_sum(buf_ptr, sector_size * 2, sum2, TRUE, &res); @@ -1220,7 +1220,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) fill_rand(buf_ptr, buf_size); sum2 = get_sum(buf_ptr + sector_size, sector_size * 2); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, buf_size, FALSE, sector_size, &res); test_sum(buf_ptr, sector_size, sum, TRUE, &res); @@ -1232,7 +1232,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) sum = fill_rand(buf_ptr, buf_size); sum2 = get_sum(buf_ptr, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size), buf_ptr, sector_size, FALSE, + simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, sector_size, FALSE, 0, &res); test_sum(buf_ptr, sector_size, sum2, TRUE, &res); @@ -1240,7 +1240,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) got_result(&res, "one sector read at partition end"); /* Read three sectors starting at the partition end. */ - simple_xfer(sub0_minor, cvu64(sub_size), buf_ptr, buf_size, FALSE, 0, + simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, buf_size, FALSE, 0, &res); test_sum(buf_ptr, buf_size, sum, TRUE, &res); @@ -1248,7 +1248,7 @@ static void read_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) got_result(&res, "multisector read at partition end"); /* Read one sector beyond the partition end. */ - simple_xfer(sub0_minor, cvu64(sub_size + sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size + sector_size)), buf_ptr, buf_size, FALSE, 0, &res); test_sum(buf_ptr, sector_size, sum2, TRUE, &res); @@ -1307,7 +1307,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) */ sub1_sum = fill_rand(buf_ptr, buf_size); - simple_xfer(sub1_minor, cvu64(0), buf_ptr, buf_size, TRUE, buf_size, + simple_xfer(sub1_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size, &res); got_result(&res, "write to second subpartition"); @@ -1315,7 +1315,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* Write one sector, up to the partition limit. */ sum = fill_rand(buf_ptr, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, sector_size, TRUE, sector_size, &res); got_result(&res, "write up to partition end"); @@ -1323,7 +1323,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* Read back to make sure the results have persisted. */ fill_rand(buf_ptr, sector_size * 2); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size * 2), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr, sector_size * 2, FALSE, sector_size * 2, &res); test_sum(buf_ptr + sector_size, sector_size, sum, TRUE, &res); @@ -1335,7 +1335,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) sum = get_sum(buf_ptr + sector_size, sector_size); sum3 = get_sum(buf_ptr, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size * 2), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr, buf_size, TRUE, sector_size * 2, &res); got_result(&res, "write somewhat across partition end"); @@ -1344,7 +1344,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) fill_rand(buf_ptr, buf_size); sum2 = get_sum(buf_ptr + sector_size, sector_size * 2); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, buf_size, FALSE, sector_size, &res); test_sum(buf_ptr, sector_size, sum, TRUE, &res); @@ -1356,7 +1356,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) fill_rand(buf_ptr, buf_size); sum = get_sum(buf_ptr, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, buf_size, TRUE, sector_size, &res); got_result(&res, "write mostly across partition end"); @@ -1364,7 +1364,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) fill_rand(buf_ptr, buf_size); sum2 = get_sum(buf_ptr + sector_size * 2, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size - sector_size * 2), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size * 2)), buf_ptr, buf_size, FALSE, sector_size * 2, &res); test_sum(buf_ptr, sector_size, sum3, TRUE, &res); @@ -1376,13 +1376,13 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* Write one sector at the end of the partition. */ fill_rand(buf_ptr, sector_size); - simple_xfer(sub0_minor, cvu64(sub_size), buf_ptr, sector_size, TRUE, 0, + simple_xfer(sub0_minor, ((u64_t)(sub_size)), buf_ptr, sector_size, TRUE, 0, &res); got_result(&res, "write at partition end"); /* Write one sector beyond the end of the partition. */ - simple_xfer(sub0_minor, cvu64(sub_size + sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size + sector_size)), buf_ptr, sector_size, TRUE, 0, &res); got_result(&res, "write beyond partition end"); @@ -1392,7 +1392,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) */ fill_rand(buf_ptr, buf_size); - simple_xfer(sub1_minor, cvu64(0), buf_ptr, buf_size, FALSE, buf_size, + simple_xfer(sub1_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE, buf_size, &res); test_sum(buf_ptr, buf_size, sub1_sum, TRUE, &res); @@ -1410,7 +1410,7 @@ static void write_limits(dev_t sub0_minor, dev_t sub1_minor, size_t sub_size) /* If the last request erroneously succeeded, it would have overwritten * the last sector of the first subpartition. */ - simple_xfer(sub0_minor, cvu64(sub_size - sector_size), buf_ptr, + simple_xfer(sub0_minor, ((u64_t)(sub_size - sector_size)), buf_ptr, sector_size, FALSE, sector_size, &res); test_sum(buf_ptr, sector_size, sum, TRUE, &res); @@ -1443,7 +1443,7 @@ static void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs) /* Set, and check, the size of the first subpartition. */ subpart = part; - subpart.size = cvu64(sub_size); + subpart.size = ((u64_t)(sub_size)); vir_ioctl(sub0_minor, DIOCSETP, &subpart, OK, &res); @@ -1462,7 +1462,7 @@ static void vir_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs) /* Set, and check, the base and size of the second subpartition. */ subpart = part; subpart.base = add64u(subpart.base, sub_size); - subpart.size = cvu64(sub_size); + subpart.size = ((u64_t)(sub_size)); vir_ioctl(sub1_minor, DIOCSETP, &subpart, OK, &res); @@ -1520,7 +1520,7 @@ static void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs) memset(buf_ptr, 0, buf_size); /* Write an invalid partition table. */ - simple_xfer(driver_minor, cvu64(0), buf_ptr, buf_size, TRUE, buf_size, + simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size, &res); got_result(&res, "write of invalid partition table"); @@ -1576,7 +1576,7 @@ static void real_limits(dev_t sub0_minor, dev_t sub1_minor, int part_secs) buf_ptr[510] = 0x55; buf_ptr[511] = 0xAA; - simple_xfer(driver_minor, cvu64(0), buf_ptr, buf_size, TRUE, buf_size, + simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size, &res); got_result(&res, "write of valid partition table"); @@ -1859,7 +1859,7 @@ static void unaligned_size(void) */ buf_size = sector_size * 5; - base_pos = cvu64(sector_size * 2); + base_pos = ((u64_t)(sector_size * 2)); if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL) panic("unable to allocate memory"); @@ -1964,7 +1964,7 @@ static void unaligned_pos1(void) */ buf_size = buf2_size = sector_size * 3; - base_pos = cvu64(sector_size * 3); + base_pos = ((u64_t)(sector_size * 3)); if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL) panic("unable to allocate memory"); @@ -2112,7 +2112,7 @@ static void unaligned_pos2(void) buf_size = buf2_size = max_size + sector_size; - base_pos = cvu64(sector_size * 3); + base_pos = ((u64_t)(sector_size * 3)); if ((buf_ptr = alloc_contig(buf_size, 0, NULL)) == NULL) panic("unable to allocate memory"); @@ -2344,7 +2344,7 @@ static void sweep_and_check(u64_t pos, int check_integ) if (may_write) { sum = fill_rand(buf_ptr, buf_size); - simple_xfer(driver_minor, cvu64(0), buf_ptr, buf_size, + simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, TRUE, buf_size, &res); got_result(&res, "write integrity zone"); @@ -2352,7 +2352,7 @@ static void sweep_and_check(u64_t pos, int check_integ) fill_rand(buf_ptr, buf_size); - simple_xfer(driver_minor, cvu64(0), buf_ptr, buf_size, FALSE, + simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE, buf_size, &res); if (may_write) @@ -2368,7 +2368,7 @@ static void sweep_and_check(u64_t pos, int check_integ) if (check_integ) { fill_rand(buf_ptr, buf_size); - simple_xfer(driver_minor, cvu64(0), buf_ptr, buf_size, FALSE, + simple_xfer(driver_minor, ((u64_t)(0)), buf_ptr, buf_size, FALSE, buf_size, &res); test_sum(buf_ptr, buf_size, sum, TRUE, &res); @@ -2386,7 +2386,7 @@ static void basic_sweep(void) test_group("basic area sweep", TRUE); - sweep_area(cvu64(sector_size)); + sweep_area(((u64_t)(sector_size))); } static void high_disk_pos(void)