#define VFS_MKNOD_NAME m1_p1 /* const char * */
#define VFS_MKNOD_LEN m1_i1 /* size_t */
#define VFS_MKNOD_MODE m1_i2 /* mode_t */
-#define VFS_MKNOD_DEV m1_i3 /* dev_t */
+#define VFS_MKNOD_DEV m1_ull1 /* dev_t */
/* Field names for the open(2), chdir(2), chmod(2), chroot(2), rmdir(2), and
* unlink(2) calls.
#define M3_LONG_STRING 44 /* current m3_ca1 size (may be increased) */
typedef struct {
+ uint64_t m1ull1;
int m1i1, m1i2, m1i3;
char *m1p1, *m1p2, *m1p3, *m1p4;
- uint8_t padding[28];
+ uint8_t padding[20];
} mess_1;
_ASSERT_MSG_SIZE(mess_1);
long m2l1, m2l2;
char *m2p1;
sigset_t sigset;
- short m2s1;
+ short m2s1;
uint8_t padding[14];
} mess_2;
_ASSERT_MSG_SIZE(mess_2);
_ASSERT_MSG_SIZE(mess_8);
typedef struct {
+ uint64_t m9ull1;
long m9l1, m9l2, m9l3, m9l4, m9l5;
short m9s1, m9s2, m9s3, m9s4;
- uint8_t padding[28];
+ uint8_t padding[20];
} mess_9;
_ASSERT_MSG_SIZE(mess_9);
_ASSERT_MSG_SIZE(mess_11);
typedef struct {
+ dev_t dev; /* 64bits long. */
void *block;
u32_t dev_offset_pages;
u32_t ino_offset_pages;
u32_t ino;
u32_t *flags_ptr;
- u32_t dev;
u8_t pages;
u8_t flags;
- uint8_t padding[30];
+ uint8_t padding[26];
} mess_vmmcp;
_ASSERT_MSG_SIZE(mess_vmmcp);
typedef struct {
endpoint_t who;
u32_t offset;
- u32_t dev;
+ dev_t dev;
u32_t ino;
u32_t vaddr;
u32_t len;
u16_t fd;
u16_t clearend_and_flags; /* low 12 bits are clearend, rest flags */
- uint8_t padding[28];
+ uint8_t padding[24];
} mess_vm_vfs_mmap;
_ASSERT_MSG_SIZE(mess_vm_vfs_mmap);
#define m1_p2 m_u.m_m1.m1p2
#define m1_p3 m_u.m_m1.m1p3
#define m1_p4 m_u.m_m1.m1p4
+#define m1_ull1 m_u.m_m1.m1ull1
#define m2_i1 m_u.m_m2.m2i1
#define m2_i2 m_u.m_m2.m2i2
#define m9_s2 m_u.m_m9.m9s2
#define m9_s3 m_u.m_m9.m9s3
#define m9_s4 m_u.m_m9.m9s4
+#define m9_ull1 m_u.m_m9.m9ull1
#define m10_i1 m_u.m_m10.m10i1
#define m10_i2 m_u.m_m10.m10i2
unsigned sys_flags; /* sys flags */
endpoint_t endpoint; /* process endpoint number */
- dev_t dev_nr; /* major device number or NO_DEV */
+ devmajor_t dev_nr; /* major device number or NO_DEV */
char label[RS_MAX_LABEL_LEN]; /* label of this service */
char proc_name[RS_MAX_LABEL_LEN]; /* process name of this service */
#define REQ_ACTIME m9_l2
#define REQ_ACNSEC m9_l4
#define REQ_COUNT m9_l2
-#define REQ_DEV m9_l5
-#define REQ_DEV2 m9_l1
+#define REQ_DEV m9_ull1
#define REQ_DIR_INO m9_l3
#define REQ_FLAGS m9_s3
#define REQ_GID m9_s1
#define REQ_UID m9_s4
/* VFS/FS reply fields */
-#define RES_DEV m9_l4
+#define RES_DEV m9_ull1
#define RES_GID m9_s1
#define RES_INODE_NR m9_l1
#define RES_FILE_SIZE_HI m9_l2
int vm_forgetblock(u64_t id);
void vm_forgetblocks(void);
int minix_vfs_mmap(endpoint_t who, u32_t offset, u32_t len,
- u32_t dev, u32_t ino, u16_t fd, u32_t vaddr, u16_t clearend, u16_t
+ dev_t dev, u32_t ino, u16_t fd, u32_t vaddr, u16_t clearend, u16_t
flags);
/* minix vfs mmap flags */
count, vir_bytes *next);
int vm_procctl(endpoint_t ep, int param);
-int vm_set_cacheblock(void *block, u32_t dev, u64_t dev_offset,
+int vm_set_cacheblock(void *block, dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize);
-void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,
+void *vm_map_cacheblock(dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize);
-int vm_clear_cache(u32_t dev);
+int vm_clear_cache(dev_t dev);
/* flags for vm cache functions */
#define VMMC_FLAGS_LOCKED 0x01 /* someone is updating the flags; don't read/write */
}
int minix_vfs_mmap(endpoint_t who, u32_t offset, u32_t len,
- u32_t dev, u32_t ino, u16_t fd, u32_t vaddr, u16_t clearend,
+ dev_t dev, u32_t ino, u16_t fd, u32_t vaddr, u16_t clearend,
u16_t flags)
{
message m;
printf("libminixfs: ENOSYS, disabling VM calls\n");
vmcache = 0;
} else {
- panic("libminixfs: setblock of %p dev 0x%x off "
+ panic("libminixfs: setblock of %p dev 0x%llx off "
"0x%llx failed\n", bp->data, dev, dev_off);
}
}
int lmfs_do_bpeek(message *m)
{
block_t startblock, b, limitblock;
- dev_t dev = m->REQ_DEV2;
+ dev_t dev = m->REQ_DEV;
u64_t extra, pos = make64(m->REQ_SEEK_POS_LO, m->REQ_SEEK_POS_HI);
size_t len = m->REQ_NBYTES;
struct buf *bp;
* to disk.
*/
#if 0
- dev_t dev = (dev_t) fs_m_in.REQ_DEV;
+ dev_t dev = fs_m_in.REQ_DEV;
if(dev == fs_dev) return(EBUSY);
va.va_mode = (mode_t) fs_m_in.REQ_MODE;
va.va_uid = caller_uid;
va.va_gid = caller_gid;
- va.va_rdev = (dev_t) fs_m_in.REQ_DEV;
+ va.va_rdev = fs_m_in.REQ_DEV;
va.va_atime = va.va_mtime = va.va_ctime = cur_time;
if (buildpath) {
int r;
dprintf(("%s: readsuper (dev %x, flags %x)\n",
- sffs_name, (dev_t) m_in.REQ_DEV, m_in.REQ_FLAGS));
+ sffs_name, m_in.REQ_DEV, m_in.REQ_FLAGS));
if (m_in.REQ_FLAGS & REQ_ISROOT) {
printf("%s: attempt to mount as root device\n", sffs_name);
#include <minix/sysutil.h>
#include <machine/vmparam.h>
-int vm_cachecall(message *m, int call, void *addr, u32_t dev, u64_t dev_offset,
+int vm_cachecall(message *m, int call, void *addr, dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize)
{
if(blocksize % PAGE_SIZE)
return _taskcall(VM_PROC_NR, call, m);
}
-void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,
+void *vm_map_cacheblock(dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize)
{
message m;
return m.m_u.m_vmmcp_reply.addr;
}
-int vm_set_cacheblock(void *block, u32_t dev, u64_t dev_offset,
+int vm_set_cacheblock(void *block, dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize)
{
message m;
}
int
-vm_clear_cache(u32_t dev)
+vm_clear_cache(dev_t dev)
{
message m;
rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR);
if (!rip) {
- printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
+ printf("%s:%d put_inode: inode #%u dev: %llx not found\n", __FILE__,
__LINE__, (pino_t) fs_m_in.REQ_INODE_NR, fs_dev);
panic("fs_putnode failed");
}
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
*/
- dev_t dev = (dev_t) fs_m_in.REQ_DEV;
+ dev_t dev = fs_m_in.REQ_DEV;
if(dev == fs_dev) return(EBUSY);
char label[sizeof(fs_dev_label)];
int r;
- dev = (dev_t) fs_m_in.REQ_DEV;
+ dev = fs_m_in.REQ_DEV;
label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
label_len = (size_t) fs_m_in.REQ_PATH_LEN;
(unsigned long) fs_m_in.REQ_SEEK_POS_HI);
nrbytes = (size_t) fs_m_in.REQ_NBYTES;
- block_size = get_block_size( (dev_t) fs_m_in.REQ_DEV2);
+ block_size = get_block_size(fs_m_in.REQ_DEV);
- rip.i_block[0] = (block_t) fs_m_in.REQ_DEV2;
+ rip.i_block[0] = (block_t) fs_m_in.REQ_DEV;
rip.i_mode = I_BLOCK_SPECIAL;
rip.i_size = 0;
statbuf.st_nlink = rip->i_links_count;
statbuf.st_uid = rip->i_uid;
statbuf.st_gid = rip->i_gid;
- statbuf.st_rdev = (s ? rip->i_block[0] : NO_DEV);
+ statbuf.st_rdev = (s ? (dev_t)rip->i_block[0] : NO_DEV);
statbuf.st_size = rip->i_size;
statbuf.st_atime = rip->i_atime;
statbuf.st_mtime = rip->i_mtime;
char label[sizeof(fs_dev_label)];
int r;
- dev = (dev_t) fs_m_in.REQ_DEV;
+ dev = fs_m_in.REQ_DEV;
label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
label_len = (size_t) fs_m_in.REQ_PATH_LEN;
{
dev_t dev;
- dev= (ip_dev & 0xFF00) | minor;
+ dev= makedev(major(ip_dev), minor);
unlink(device);
if (mknod(device, S_IFCHR | mode, dev) < 0) fatal(device);
- printf("mknod %s c %d %d\n", device, (ip_dev >> 8), minor);
+ printf("mknod %s c %d %d\n", device, major(ip_dev), minor);
}
static int cfg_fd;
rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR);
if(!rip) {
- printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
+ printf("%s:%d put_inode: inode #%u dev: %llx not found\n", __FILE__,
__LINE__, (pino_t) fs_m_in.REQ_INODE_NR, fs_dev);
panic("fs_putnode failed");
}
/* Flush the blocks of a device from the cache after writing any dirty blocks
* to disk.
*/
- dev_t dev = (dev_t) fs_m_in.REQ_DEV;
+ dev_t dev = fs_m_in.REQ_DEV;
if(dev == fs_dev) return(EBUSY);
lmfs_flushall();
char label[sizeof(fs_dev_label)];
int r;
- dev = (dev_t) fs_m_in.REQ_DEV;
+ dev = fs_m_in.REQ_DEV;
label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
label_len = (size_t) fs_m_in.REQ_PATH_LEN;
int r;
int readonly, isroot;
- fs_dev = (dev_t) fs_m_in.REQ_DEV;
+ fs_dev = fs_m_in.REQ_DEV;
label_gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
label_len = (size_t) fs_m_in.REQ_PATH_LEN;
readonly = (fs_m_in.REQ_FLAGS & REQ_RDONLY) ? 1 : 0;
panic("couldn't bdev_open after found unclean FS");
return(EINVAL);
}
- printf("MFS: WARNING: FS 0x%x unclean, mounting readonly\n", fs_dev);
+ printf("MFS: WARNING: FS 0x%llx unclean, mounting readonly\n", fs_dev);
}
lmfs_set_blocksize(superblock.s_block_size, major(fs_dev));
r = OK;
- target_dev = (dev_t) fs_m_in.REQ_DEV2;
+ target_dev = fs_m_in.REQ_DEV;
/* Get the values from the request message */
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
statbuf.st_nlink = (nlink_t) rip->i_nlinks;
statbuf.st_uid = rip->i_uid;
statbuf.st_gid = rip->i_gid;
- statbuf.st_rdev = (s ? (dev_t) rip->i_zone[0] : NO_DEV);
+ statbuf.st_rdev = (s ? (dev_t)rip->i_zone[0] : NO_DEV);
statbuf.st_size = rip->i_size;
statbuf.st_atime = rip->i_atime;
statbuf.st_mtime = rip->i_mtime;
rip = find_inode( (pino_t) fs_m_in->REQ_INODE_NR);
if(!rip) {
- printf("%s:%d put_inode: inode #%ld dev: %d not found\n", __FILE__,
- __LINE__, fs_m_in->REQ_INODE_NR, (dev_t) fs_m_in->REQ_DEV);
+ printf("%s:%d put_inode: inode #%ld dev: %llx not found\n", __FILE__,
+ __LINE__, fs_m_in->REQ_INODE_NR, fs_m_in->REQ_DEV);
panic("fs_putnode failed");
}
uid = (uid_t) fs_m_in->REQ_UID;
gid = (gid_t) fs_m_in->REQ_GID;
bits = (pmode_t) fs_m_in->REQ_MODE;
- dev = (dev_t) fs_m_in->REQ_DEV;
+ dev = fs_m_in->REQ_DEV;
/* Try to allocate the inode */
if( (rip = alloc_inode(dev, bits, uid, gid) ) == NULL) return(err_code);
statbuf.st_nlink = rip->i_nlinks;
statbuf.st_uid = rip->i_uid;
statbuf.st_gid = (short int) rip->i_gid;
- statbuf.st_rdev = (dev_t) (s ? rip->i_rdev : NO_DEV);
+ statbuf.st_rdev = (s ? rip->i_rdev : NO_DEV);
statbuf.st_size = rip->i_size;
if (!s) statbuf.st_mode &= ~I_REGULAR;/* wipe out I_REGULAR bit for pipes */
statbuf.st_atime = rip->i_atime;
}
if (r == OK) {
- dev = (dev_t) vp->v_sdev;
+ dev = vp->v_sdev;
if (S_ISBLK(vp->v_mode)) {
f->filp_ioctl_fp = fp;
/*===========================================================================*
* map_driver *
*===========================================================================*/
-static int map_driver(label, major, proc_nr_e)
-const char label[LABEL_MAX]; /* name of the driver */
-int major; /* major number of the device */
-endpoint_t proc_nr_e; /* process number of the driver */
+static int map_driver(const char label[LABEL_MAX], devmajor_t major,
+ endpoint_t proc_nr_e)
{
/* Add a new device driver mapping in the dmap table. If the proc_nr is set to
* NONE, we're supposed to unmap it.
if (f->filp_count - 1 == 0 && f->filp_mode != FILP_CLOSED) {
/* Check to see if the file is special. */
if (S_ISCHR(vp->v_mode) || S_ISBLK(vp->v_mode)) {
- dev = (dev_t) vp->v_sdev;
+ dev = vp->v_sdev;
if (S_ISBLK(vp->v_mode)) {
lock_bsf();
if (vp->v_bfs_e == ROOT_FS_E) {
f->filp_mode = FILP_CLOSED;
f->filp_count = 0;
} else if (f->filp_count < 0) {
- panic("VFS: invalid filp count: %d ino %d/%llu", f->filp_count,
+ panic("VFS: invalid filp count: %d ino %llx/%llu", f->filp_count,
vp->v_dev, vp->v_inode_nr);
} else {
unlock_vnode(f->filp_vno);
assert(f->filp_vno->v_vmnt);
if (!S_ISREG(f->filp_vno->v_mode) && !S_ISBLK(f->filp_vno->v_mode)) {
- printf("VFS: mmap regular/blockdev only; dev 0x%x ino %llu has mode 0%o\n",
+ printf("VFS: mmap regular/blockdev only; dev 0x%llx ino %llu has mode 0%o\n",
f->filp_vno->v_dev, f->filp_vno->v_inode_nr, f->filp_vno->v_mode);
unlock_filp(f);
return EINVAL;
if (rfilp->filp_mode == FILP_CLOSED) continue;
vp = rfilp->filp_vno;
if (!S_ISCHR(vp->v_mode)) continue;
- if ((dev_t) vp->v_sdev != dev) continue;
+ if (vp->v_sdev != dev) continue;
lock_filp(rfilp, VNODE_READ);
(void) cdev_close(dev); /* Ignore any errors. */
/* Get driver process' endpoint */
dp = &dmap[major(dev)];
if (dp->dmap_driver == NONE) {
- printf("VFS: no driver for dev %d\n", dev);
+ printf("VFS: no driver for dev %llx\n", dev);
return(EINVAL);
}
/* Find vmnt that is to be unmounted */
for (vmp_i = &vmnt[0]; vmp_i < &vmnt[NR_MNTS]; ++vmp_i) {
if (vmp_i->m_dev == dev) {
- if(vmp) panic("device mounted more than once: %d", dev);
+ if(vmp) panic("device mounted more than once: %llx", dev);
vmp = vmp_i;
}
}
/* Verify we succesfully unmounted all file systems */
for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; vmp++) {
if (vmp->m_dev != NO_DEV) {
- panic("vmp still mounted: %s %d %d\n", vmp->m_label,
+ panic("vmp still mounted: %s %d %llx\n", vmp->m_label,
vmp->m_fs_e, vmp->m_dev);
}
}
break;
case S_IFCHR:
/* Invoke the driver for special processing. */
- dev = (dev_t) vp->v_sdev;
+ dev = vp->v_sdev;
/* TTY needs to know about the O_NOCTTY flag. */
r = cdev_open(dev, bits | (oflags & O_NOCTTY));
vp = filp->filp_vno; /* Might be updated by
lock_bsf();
/* Invoke the driver for special processing. */
- dev = (dev_t) vp->v_sdev;
+ dev = vp->v_sdev;
r = bdev_open(dev, bits);
if (r != OK) {
unlock_bsf();
panic("process %d blocked on empty fd %d",
fp->fp_endpoint, fild);
}
- dev = (dev_t) f->filp_vno->v_sdev; /* device hung on */
+ dev = f->filp_vno->v_sdev; /* device hung on */
status = cdev_cancel(dev);
if (vp->v_sdev == NO_DEV)
panic("VFS: read_write tries to access char dev NO_DEV");
- dev = (dev_t) vp->v_sdev;
+ dev = vp->v_sdev;
r = cdev_io(op, dev, for_e, buf, position, size, f->filp_flags);
if (r >= 0) {
/* This should no longer happen: all calls are asynchronous. */
- printf("VFS: I/O to device %x succeeded immediately!?\n", dev);
+ printf("VFS: I/O to device %llx succeeded immediately!?\n", dev);
cum_io = r;
position += r;
r = OK;
/* Fill in request message */
m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
- m.REQ_DEV2 = dev;
+ m.REQ_DEV = dev;
m.REQ_GRANT = grant_id;
m.REQ_SEEK_POS_LO = ex64lo(pos);
m.REQ_SEEK_POS_HI = ex64hi(pos);
/* Fill in request message */
m.m_type = REQ_BPEEK;
- m.REQ_DEV2 = dev;
+ m.REQ_DEV = dev;
m.REQ_SEEK_POS_LO = ex64lo(pos);
m.REQ_SEEK_POS_HI = ex64hi(pos);
m.REQ_NBYTES = num_of_bytes;
/* This should never happen. The driver may be misbehaving.
* For now we assume that the reply we want will arrive later..
*/
- printf("VFS (%s:%d): expected reply from dev %d not %d\n",
+ printf("VFS (%s:%d): expected reply from dev %llx not %llx\n",
__FILE__, __LINE__, vp->v_sdev, dev);
return;
}
if (vmp->m_flags & VMNT_READONLY)
buf.f_flag |= ST_RDONLY;
- buf.f_fsid = vmp->m_dev;
- buf.f_fsidx.__fsid_val[0] = 0;
- buf.f_fsidx.__fsid_val[1] = vmp->m_dev;
+ buf.f_fsid = (unsigned long)vmp->m_dev;
+ buf.f_fsidx.__fsid_val[0] = (long)vmp->m_dev; /* This is what is done on NetBSD */
+ buf.f_fsidx.__fsid_val[1] = 0; /* Here they convert the FS type name into a number. */
strlcpy(buf.f_fstypename, vmp->m_fstype, sizeof(buf.f_fstypename));
strlcpy(buf.f_mntonname, vmp->m_mount_path, sizeof(buf.f_mntonname));
for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; vmp++)
if (is_vmnt_locked(vmp)) {
count++;
- printf("vmnt %p is %s, fs_e=%d dev=%d\n", vmp, (tll_islocked(&vmp->m_lock) ? "locked":"pending locked"), vmp->m_fs_e, vmp->m_dev);
+ printf("vmnt %p is %s, fs_e=%d dev=%llx\n", vmp, (tll_islocked(&vmp->m_lock) ? "locked":"pending locked"), vmp->m_fs_e, vmp->m_dev);
}
if (count) panic("%d locked vmnts\n", count);
typedef int64_t daddr_t; /* disk address */
#endif
-#if defined(__minix) /* LSC: Wait until bigger message to enlarge the data type. */
-typedef uint32_t dev_t; /* device number */
-#endif /* defined(__minix) */
+typedef uint64_t dev_t; /* device number */
typedef uint32_t fixpt_t; /* fixed point number */
#ifndef gid_t
} result_t;
static char driver_label[32] = ""; /* driver DS label */
-static dev_t driver_minor = -1; /* driver's partition minor to use */
+static devminor_t driver_minor = -1; /* driver's partition minor to use */
static endpoint_t driver_endpt; /* driver endpoint */
static int may_write = FALSE; /* may we write to the device? */
return (u32_t) sqrt(v);
}
-int vm_set_cacheblock(void *block, u32_t dev, u64_t dev_offset,
+int vm_set_cacheblock(void *block, dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize)
{
return ENOSYS;
}
-void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,
+void *vm_map_cacheblock(dev_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize)
{
return MAP_FAILED;
}
-int vm_clear_cache(u32_t dev)
+int vm_clear_cache(dev_t dev)
{
return 0;
}