From: Ben Gras Date: Mon, 24 Feb 2014 13:50:01 +0000 (+0100) Subject: 64-bit REQ_SEEK_POS X-Git-Tag: v3.3.0~428 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch07.html?a=commitdiff_plain;h=978082bb0d60b8225a0f631cff0542e84cc6a43d;p=minix.git 64-bit REQ_SEEK_POS Change-Id: I2e51a188b171af0f0a02349e4eccbe78e7cc2e0c --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 1eee45247..11282305d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -81,10 +81,10 @@ typedef struct { _ASSERT_MSG_SIZE(mess_8); typedef struct { - uint64_t m9ull1; + uint64_t m9ull1, m9ull2; long m9l1, m9l2, m9l3, m9l4, m9l5; short m9s1, m9s2, m9s3, m9s4; - uint8_t padding[20]; + uint8_t padding[12]; } mess_9; _ASSERT_MSG_SIZE(mess_9); @@ -288,6 +288,7 @@ typedef int _ASSERT_message[/* CONSTCOND */sizeof(message) == 64 ? 1 : -1]; #define m9_s3 m_m9.m9s3 #define m9_s4 m_m9.m9s4 #define m9_ull1 m_m9.m9ull1 +#define m9_ull2 m_m9.m9ull2 #define m10_i1 m_m10.m10i1 #define m10_i2 m_m10.m10i2 diff --git a/include/minix/vfsif.h b/include/minix/vfsif.h index e12837676..71ae426c4 100644 --- a/include/minix/vfsif.h +++ b/include/minix/vfsif.h @@ -30,8 +30,7 @@ #define REQ_REN_NEW_DIR m9_l4 #define REQ_REN_OLD_DIR m9_l3 #define REQ_ROOT_INO m9_l4 -#define REQ_SEEK_POS_HI m9_l3 -#define REQ_SEEK_POS_LO m9_l4 +#define REQ_SEEK_POS m9_ull2 #define REQ_TRC_END_HI m9_l4 #define REQ_TRC_END_LO m9_l5 #define REQ_TRC_START_HI m9_l2 diff --git a/lib/libminixfs/cache.c b/lib/libminixfs/cache.c index bcef04592..d61e7a427 100644 --- a/lib/libminixfs/cache.c +++ b/lib/libminixfs/cache.c @@ -937,7 +937,7 @@ int lmfs_do_bpeek(message *m) { block_t startblock, b, limitblock; dev_t dev = m->REQ_DEV; - off_t extra, pos = make64(m->REQ_SEEK_POS_LO, m->REQ_SEEK_POS_HI); + off_t extra, pos = m->REQ_SEEK_POS; size_t len = m->REQ_NBYTES; struct buf *bp; diff --git a/lib/libpuffs/read.c b/lib/libpuffs/read.c index f3de5ed51..299517fb8 100644 --- a/lib/libpuffs/read.c +++ b/lib/libpuffs/read.c @@ -45,7 +45,7 @@ int fs_readwrite(void) /* Get the values from the request message */ rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING); gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - pos = (off_t) fs_m_in.REQ_SEEK_POS_LO; + pos = (off_t) fs_m_in.REQ_SEEK_POS; nrbytes = bytes_left = (size_t) fs_m_in.REQ_NBYTES; if (nrbytes > RW_BUFSIZ) @@ -135,7 +135,7 @@ int fs_getdents(void) ino = (pino_t) fs_m_in.REQ_INODE_NR; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; size = buf_left = (size_t) fs_m_in.REQ_MEM_SIZE; - pos = (off_t) fs_m_in.REQ_SEEK_POS_LO; + pos = (off_t) fs_m_in.REQ_SEEK_POS; if ((pn = puffs_pn_nodewalk(global_pu, 0, &ino)) == NULL) { lpuffs_debug("walk failed...\n"); diff --git a/lib/libsffs/read.c b/lib/libsffs/read.c index aaec41e46..ef9acc374 100644 --- a/lib/libsffs/read.c +++ b/lib/libsffs/read.c @@ -36,7 +36,7 @@ int do_read(void) if ((r = get_handle(ino)) != OK) return r; - pos = make64(m_in.REQ_SEEK_POS_LO, m_in.REQ_SEEK_POS_HI); + pos = m_in.REQ_SEEK_POS; count = m_in.REQ_NBYTES; assert(count > 0); @@ -96,7 +96,7 @@ int do_getdents(void) if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL) return EINVAL; - if (m_in.REQ_SEEK_POS_HI != 0) return EINVAL; + if(m_in.REQ_SEEK_POS >= ULONG_MAX) return EINVAL; if (!IS_DIR(ino)) return ENOTDIR; @@ -115,7 +115,7 @@ int do_getdents(void) * the "." entry, the second position is for the ".." entry, and the next * position numbers each represent a file in the directory. */ - for (pos = m_in.REQ_SEEK_POS_LO; ; pos++) { + for (pos = m_in.REQ_SEEK_POS; ; pos++) { /* Determine which inode and name to use for this entry. * We have no idea whether the host will give us "." and/or "..", * so generate our own and skip those from the host. diff --git a/lib/libsffs/write.c b/lib/libsffs/write.c index 7f403455e..ce6282a72 100644 --- a/lib/libsffs/write.c +++ b/lib/libsffs/write.c @@ -94,7 +94,7 @@ int do_write(void) if (IS_DIR(ino)) return EISDIR; - pos = make64(m_in.REQ_SEEK_POS_LO, m_in.REQ_SEEK_POS_HI); + pos = m_in.REQ_SEEK_POS; count = m_in.REQ_NBYTES; grant = m_in.REQ_GRANT; diff --git a/lib/libvtreefs/read.c b/lib/libvtreefs/read.c index 00c88813d..ca8a50cda 100644 --- a/lib/libvtreefs/read.c +++ b/lib/libvtreefs/read.c @@ -21,9 +21,6 @@ int fs_read(void) char *ptr; int r; - if (fs_m_in.REQ_SEEK_POS_HI != 0) - return EIO; - /* Try to get inode by to its inode number. */ if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) return EINVAL; @@ -34,7 +31,7 @@ int fs_read(void) /* Get the values from the request message. */ gid = fs_m_in.REQ_GRANT; - pos = fs_m_in.REQ_SEEK_POS_LO; + pos = fs_m_in.REQ_SEEK_POS; /* Call the read hook, if any. */ if (!is_inode_deleted(node) && vtreefs_hooks->read_hook != NULL) { @@ -83,7 +80,7 @@ int fs_getdents(void) int r, skip, get_next, indexed; static char buf[GETDENTS_BUFSIZ]; - if (fs_m_in.REQ_SEEK_POS_HI != 0) + if (fs_m_in.REQ_SEEK_POS >= ULONG_MAX) return EIO; if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) @@ -102,7 +99,7 @@ int fs_getdents(void) if (r != OK) return r; } - for (pos = fs_m_in.REQ_SEEK_POS_LO; ; pos++) { + for (pos = fs_m_in.REQ_SEEK_POS; ; pos++) { /* Determine which inode and name to use for this entry. */ if (pos == 0) { /* The "." entry. */ diff --git a/servers/ext2/read.c b/servers/ext2/read.c index b78ef32e8..c1cb257c5 100644 --- a/servers/ext2/read.c +++ b/servers/ext2/read.c @@ -70,7 +70,7 @@ int fs_readwrite(void) default: panic("odd request"); } gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - position = (off_t) fs_m_in.REQ_SEEK_POS_LO; + position = (off_t) fs_m_in.REQ_SEEK_POS; nrbytes = (size_t) fs_m_in.REQ_NBYTES; rdwt_err = OK; /* set to EIO if disk error occurs */ @@ -160,8 +160,7 @@ int fs_breadwrite(void) /* Get the values from the request message */ rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING); gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO, - (unsigned long) fs_m_in.REQ_SEEK_POS_HI); + position = fs_m_in.REQ_SEEK_POS; nrbytes = (size_t) fs_m_in.REQ_NBYTES; block_size = get_block_size(fs_m_in.REQ_DEV); @@ -633,7 +632,7 @@ int fs_getdents(void) ino = (pino_t) fs_m_in.REQ_INODE_NR; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; size = (size_t) fs_m_in.REQ_MEM_SIZE; - pos = (off_t) fs_m_in.REQ_SEEK_POS_LO; + pos = (off_t) fs_m_in.REQ_SEEK_POS; /* Check whether the position is properly aligned */ if ((unsigned int) pos % DIR_ENTRY_ALIGN) diff --git a/servers/iso9660fs/read.c b/servers/iso9660fs/read.c index add98724b..36b0dfea4 100644 --- a/servers/iso9660fs/read.c +++ b/servers/iso9660fs/read.c @@ -34,7 +34,7 @@ int fs_read(void) { dir = get_dir_record(fs_m_in.REQ_INODE_NR); if (dir == NULL) return(EINVAL); /* no inode found */ - position = fs_m_in.REQ_SEEK_POS_LO; + position = fs_m_in.REQ_SEEK_POS; nrbytes = (unsigned) fs_m_in.REQ_NBYTES; /* number of bytes to read */ block_size = v_pri.logical_block_size_l; gid = fs_m_in.REQ_GRANT; @@ -96,7 +96,7 @@ int fs_bread(void) rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING); gid = fs_m_in.REQ_GRANT; - position = make64(fs_m_in.REQ_SEEK_POS_LO, fs_m_in.REQ_SEEK_POS_HI); + position = fs_m_in.REQ_SEEK_POS; nrbytes = (unsigned) fs_m_in.REQ_NBYTES; block_size = v_pri.logical_block_size_l; dir = v_pri.dir_rec_root; @@ -162,7 +162,7 @@ int fs_getdents(void) /* Get input parameters */ ino = fs_m_in.REQ_INODE_NR; gid = fs_m_in.REQ_GRANT; - pos = fs_m_in.REQ_SEEK_POS_LO; + pos = fs_m_in.REQ_SEEK_POS; block_size = v_pri.logical_block_size_l; cur_pos = pos; /* The current position */ diff --git a/servers/mfs/read.c b/servers/mfs/read.c index 1f818ccea..f38e157dc 100644 --- a/servers/mfs/read.c +++ b/servers/mfs/read.c @@ -62,7 +62,7 @@ int fs_readwrite(void) default: panic("odd request"); } gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - position = (off_t) fs_m_in.REQ_SEEK_POS_LO; + position = (off_t) fs_m_in.REQ_SEEK_POS; nrbytes = (size_t) fs_m_in.REQ_NBYTES; lmfs_reset_rdwt_err(); @@ -165,8 +165,7 @@ int fs_breadwrite(void) /* Get the values from the request message */ rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING); gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; - position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO, - (unsigned long) fs_m_in.REQ_SEEK_POS_HI); + position = fs_m_in.REQ_SEEK_POS; nrbytes = (size_t) fs_m_in.REQ_NBYTES; block_size = get_block_size(target_dev); @@ -621,7 +620,7 @@ int fs_getdents(void) ino = (pino_t) fs_m_in.REQ_INODE_NR; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; size = (size_t) fs_m_in.REQ_MEM_SIZE; - pos = (off_t) fs_m_in.REQ_SEEK_POS_LO; + pos = (off_t) fs_m_in.REQ_SEEK_POS; /* Check whether the position is properly aligned */ if( (unsigned int) pos % DIR_ENTRY_SIZE) diff --git a/servers/vfs/request.c b/servers/vfs/request.c index df0aedf8f..106f2b267 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -52,8 +52,7 @@ int req_breadwrite( m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE; m.REQ_DEV = dev; m.REQ_GRANT = grant_id; - m.REQ_SEEK_POS_LO = ex64lo(pos); - m.REQ_SEEK_POS_HI = ex64hi(pos); + m.REQ_SEEK_POS = pos; m.REQ_NBYTES = num_of_bytes; /* Send/rec request */ @@ -80,8 +79,7 @@ int req_bpeek(endpoint_t fs_e, dev_t dev, off_t pos, unsigned int num_of_bytes) /* Fill in request message */ m.m_type = REQ_BPEEK; m.REQ_DEV = dev; - m.REQ_SEEK_POS_LO = ex64lo(pos); - m.REQ_SEEK_POS_HI = ex64hi(pos); + m.REQ_SEEK_POS = pos; m.REQ_NBYTES = num_of_bytes; /* Send/rec request */ @@ -320,14 +318,10 @@ int req_getdents( m.REQ_INODE_NR = (pino_t) inode_nr; m.REQ_GRANT = grant_id; m.REQ_MEM_SIZE = size; - m.REQ_SEEK_POS_LO = ex64lo(pos); - if (vmp->m_fs_flags & RES_64BIT) { - m.REQ_SEEK_POS_HI = ex64hi(pos); - } else if (pos > INT_MAX) { + m.REQ_SEEK_POS = pos; + if (!(vmp->m_fs_flags & RES_64BIT) && (pos > INT_MAX)) { /* FS does not support 64-bit off_t and 32 bits is not enough */ return EINVAL; - } else { - m.REQ_SEEK_POS_HI = 0; } r = fs_sendrec(fs_e, &m); @@ -825,13 +819,9 @@ unsigned int *cum_iop) m.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE; m.REQ_INODE_NR = (pino_t) inode_nr; m.REQ_GRANT = grant_id; - m.REQ_SEEK_POS_LO = ex64lo(pos); - if (vmp->m_fs_flags & RES_64BIT) { - m.REQ_SEEK_POS_HI = ex64hi(pos); - } else if (pos > INT_MAX) { + m.REQ_SEEK_POS = pos; + if ((!(vmp->m_fs_flags & RES_64BIT)) && (pos > INT_MAX)) { return EINVAL; - } else { - m.REQ_SEEK_POS_HI = 0; } m.REQ_NBYTES = num_of_bytes; @@ -868,8 +858,7 @@ int req_peek(endpoint_t fs_e, ino_t inode_nr, off_t pos, unsigned int bytes) m.m_type = REQ_PEEK; m.REQ_INODE_NR = inode_nr; m.REQ_GRANT = -1; - m.REQ_SEEK_POS_LO = ex64lo(pos); - m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */ + m.REQ_SEEK_POS = pos; m.REQ_NBYTES = bytes; /* Send/rec request */