64-bit REQ_SEEK_POS

Change-Id: I2e51a188b171af0f0a02349e4eccbe78e7cc2e0c
This commit is contained in:
Ben Gras 2014-02-24 14:50:01 +01:00 committed by Lionel Sambuc
parent 3c7f4e462e
commit 978082bb0d
11 changed files with 30 additions and 46 deletions

View file

@ -81,10 +81,10 @@ typedef struct {
_ASSERT_MSG_SIZE(mess_8); _ASSERT_MSG_SIZE(mess_8);
typedef struct { typedef struct {
uint64_t m9ull1; uint64_t m9ull1, m9ull2;
long m9l1, m9l2, m9l3, m9l4, m9l5; long m9l1, m9l2, m9l3, m9l4, m9l5;
short m9s1, m9s2, m9s3, m9s4; short m9s1, m9s2, m9s3, m9s4;
uint8_t padding[20]; uint8_t padding[12];
} mess_9; } mess_9;
_ASSERT_MSG_SIZE(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_s3 m_m9.m9s3
#define m9_s4 m_m9.m9s4 #define m9_s4 m_m9.m9s4
#define m9_ull1 m_m9.m9ull1 #define m9_ull1 m_m9.m9ull1
#define m9_ull2 m_m9.m9ull2
#define m10_i1 m_m10.m10i1 #define m10_i1 m_m10.m10i1
#define m10_i2 m_m10.m10i2 #define m10_i2 m_m10.m10i2

View file

@ -30,8 +30,7 @@
#define REQ_REN_NEW_DIR m9_l4 #define REQ_REN_NEW_DIR m9_l4
#define REQ_REN_OLD_DIR m9_l3 #define REQ_REN_OLD_DIR m9_l3
#define REQ_ROOT_INO m9_l4 #define REQ_ROOT_INO m9_l4
#define REQ_SEEK_POS_HI m9_l3 #define REQ_SEEK_POS m9_ull2
#define REQ_SEEK_POS_LO m9_l4
#define REQ_TRC_END_HI m9_l4 #define REQ_TRC_END_HI m9_l4
#define REQ_TRC_END_LO m9_l5 #define REQ_TRC_END_LO m9_l5
#define REQ_TRC_START_HI m9_l2 #define REQ_TRC_START_HI m9_l2

View file

@ -937,7 +937,7 @@ int lmfs_do_bpeek(message *m)
{ {
block_t startblock, b, limitblock; block_t startblock, b, limitblock;
dev_t dev = m->REQ_DEV; 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; size_t len = m->REQ_NBYTES;
struct buf *bp; struct buf *bp;

View file

@ -45,7 +45,7 @@ int fs_readwrite(void)
/* Get the values from the request message */ /* Get the values from the request message */
rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING); rw_flag = (fs_m_in.m_type == REQ_READ ? READING : WRITING);
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; 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; nrbytes = bytes_left = (size_t) fs_m_in.REQ_NBYTES;
if (nrbytes > RW_BUFSIZ) if (nrbytes > RW_BUFSIZ)
@ -135,7 +135,7 @@ int fs_getdents(void)
ino = (pino_t) fs_m_in.REQ_INODE_NR; ino = (pino_t) fs_m_in.REQ_INODE_NR;
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
size = buf_left = (size_t) fs_m_in.REQ_MEM_SIZE; 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) { if ((pn = puffs_pn_nodewalk(global_pu, 0, &ino)) == NULL) {
lpuffs_debug("walk failed...\n"); lpuffs_debug("walk failed...\n");

View file

@ -36,7 +36,7 @@ int do_read(void)
if ((r = get_handle(ino)) != OK) if ((r = get_handle(ino)) != OK)
return r; 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; count = m_in.REQ_NBYTES;
assert(count > 0); assert(count > 0);
@ -96,7 +96,7 @@ int do_getdents(void)
if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL) if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL)
return EINVAL; 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; 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 * the "." entry, the second position is for the ".." entry, and the next
* position numbers each represent a file in the directory. * 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. /* Determine which inode and name to use for this entry.
* We have no idea whether the host will give us "." and/or "..", * We have no idea whether the host will give us "." and/or "..",
* so generate our own and skip those from the host. * so generate our own and skip those from the host.

View file

@ -94,7 +94,7 @@ int do_write(void)
if (IS_DIR(ino)) return EISDIR; 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; count = m_in.REQ_NBYTES;
grant = m_in.REQ_GRANT; grant = m_in.REQ_GRANT;

View file

@ -21,9 +21,6 @@ int fs_read(void)
char *ptr; char *ptr;
int r; int r;
if (fs_m_in.REQ_SEEK_POS_HI != 0)
return EIO;
/* Try to get inode by to its inode number. */ /* Try to get inode by to its inode number. */
if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL)
return EINVAL; return EINVAL;
@ -34,7 +31,7 @@ int fs_read(void)
/* Get the values from the request message. */ /* Get the values from the request message. */
gid = fs_m_in.REQ_GRANT; 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. */ /* Call the read hook, if any. */
if (!is_inode_deleted(node) && vtreefs_hooks->read_hook != NULL) { if (!is_inode_deleted(node) && vtreefs_hooks->read_hook != NULL) {
@ -83,7 +80,7 @@ int fs_getdents(void)
int r, skip, get_next, indexed; int r, skip, get_next, indexed;
static char buf[GETDENTS_BUFSIZ]; 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; return EIO;
if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL) if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL)
@ -102,7 +99,7 @@ int fs_getdents(void)
if (r != OK) return r; 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. */ /* Determine which inode and name to use for this entry. */
if (pos == 0) { if (pos == 0) {
/* The "." entry. */ /* The "." entry. */

View file

@ -70,7 +70,7 @@ int fs_readwrite(void)
default: panic("odd request"); default: panic("odd request");
} }
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; 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; nrbytes = (size_t) fs_m_in.REQ_NBYTES;
rdwt_err = OK; /* set to EIO if disk error occurs */ 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 */ /* Get the values from the request message */
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING); rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO, position = fs_m_in.REQ_SEEK_POS;
(unsigned long) fs_m_in.REQ_SEEK_POS_HI);
nrbytes = (size_t) fs_m_in.REQ_NBYTES; nrbytes = (size_t) fs_m_in.REQ_NBYTES;
block_size = get_block_size(fs_m_in.REQ_DEV); 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; ino = (pino_t) fs_m_in.REQ_INODE_NR;
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
size = (size_t) fs_m_in.REQ_MEM_SIZE; 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 */ /* Check whether the position is properly aligned */
if ((unsigned int) pos % DIR_ENTRY_ALIGN) if ((unsigned int) pos % DIR_ENTRY_ALIGN)

View file

@ -34,7 +34,7 @@ int fs_read(void) {
dir = get_dir_record(fs_m_in.REQ_INODE_NR); dir = get_dir_record(fs_m_in.REQ_INODE_NR);
if (dir == NULL) return(EINVAL); /* no inode found */ 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 */ nrbytes = (unsigned) fs_m_in.REQ_NBYTES; /* number of bytes to read */
block_size = v_pri.logical_block_size_l; block_size = v_pri.logical_block_size_l;
gid = fs_m_in.REQ_GRANT; 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); rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
gid = fs_m_in.REQ_GRANT; 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; nrbytes = (unsigned) fs_m_in.REQ_NBYTES;
block_size = v_pri.logical_block_size_l; block_size = v_pri.logical_block_size_l;
dir = v_pri.dir_rec_root; dir = v_pri.dir_rec_root;
@ -162,7 +162,7 @@ int fs_getdents(void)
/* Get input parameters */ /* Get input parameters */
ino = fs_m_in.REQ_INODE_NR; ino = fs_m_in.REQ_INODE_NR;
gid = fs_m_in.REQ_GRANT; 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; block_size = v_pri.logical_block_size_l;
cur_pos = pos; /* The current position */ cur_pos = pos; /* The current position */

View file

@ -62,7 +62,7 @@ int fs_readwrite(void)
default: panic("odd request"); default: panic("odd request");
} }
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; 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; nrbytes = (size_t) fs_m_in.REQ_NBYTES;
lmfs_reset_rdwt_err(); lmfs_reset_rdwt_err();
@ -165,8 +165,7 @@ int fs_breadwrite(void)
/* Get the values from the request message */ /* Get the values from the request message */
rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING); rw_flag = (fs_m_in.m_type == REQ_BREAD ? READING : WRITING);
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
position = make64((unsigned long) fs_m_in.REQ_SEEK_POS_LO, position = fs_m_in.REQ_SEEK_POS;
(unsigned long) fs_m_in.REQ_SEEK_POS_HI);
nrbytes = (size_t) fs_m_in.REQ_NBYTES; nrbytes = (size_t) fs_m_in.REQ_NBYTES;
block_size = get_block_size(target_dev); block_size = get_block_size(target_dev);
@ -621,7 +620,7 @@ int fs_getdents(void)
ino = (pino_t) fs_m_in.REQ_INODE_NR; ino = (pino_t) fs_m_in.REQ_INODE_NR;
gid = (cp_grant_id_t) fs_m_in.REQ_GRANT; gid = (cp_grant_id_t) fs_m_in.REQ_GRANT;
size = (size_t) fs_m_in.REQ_MEM_SIZE; 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 */ /* Check whether the position is properly aligned */
if( (unsigned int) pos % DIR_ENTRY_SIZE) if( (unsigned int) pos % DIR_ENTRY_SIZE)

View file

@ -52,8 +52,7 @@ int req_breadwrite(
m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE; m.m_type = rw_flag == READING ? REQ_BREAD : REQ_BWRITE;
m.REQ_DEV = dev; m.REQ_DEV = dev;
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS = pos;
m.REQ_SEEK_POS_HI = ex64hi(pos);
m.REQ_NBYTES = num_of_bytes; m.REQ_NBYTES = num_of_bytes;
/* Send/rec request */ /* 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 */ /* Fill in request message */
m.m_type = REQ_BPEEK; m.m_type = REQ_BPEEK;
m.REQ_DEV = dev; m.REQ_DEV = dev;
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS = pos;
m.REQ_SEEK_POS_HI = ex64hi(pos);
m.REQ_NBYTES = num_of_bytes; m.REQ_NBYTES = num_of_bytes;
/* Send/rec request */ /* Send/rec request */
@ -320,14 +318,10 @@ int req_getdents(
m.REQ_INODE_NR = (pino_t) inode_nr; m.REQ_INODE_NR = (pino_t) inode_nr;
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
m.REQ_MEM_SIZE = size; m.REQ_MEM_SIZE = size;
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS = pos;
if (vmp->m_fs_flags & RES_64BIT) { if (!(vmp->m_fs_flags & RES_64BIT) && (pos > INT_MAX)) {
m.REQ_SEEK_POS_HI = ex64hi(pos);
} else if (pos > INT_MAX) {
/* FS does not support 64-bit off_t and 32 bits is not enough */ /* FS does not support 64-bit off_t and 32 bits is not enough */
return EINVAL; return EINVAL;
} else {
m.REQ_SEEK_POS_HI = 0;
} }
r = fs_sendrec(fs_e, &m); 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.m_type = rw_flag == READING ? REQ_READ : REQ_WRITE;
m.REQ_INODE_NR = (pino_t) inode_nr; m.REQ_INODE_NR = (pino_t) inode_nr;
m.REQ_GRANT = grant_id; m.REQ_GRANT = grant_id;
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS = pos;
if (vmp->m_fs_flags & RES_64BIT) { if ((!(vmp->m_fs_flags & RES_64BIT)) && (pos > INT_MAX)) {
m.REQ_SEEK_POS_HI = ex64hi(pos);
} else if (pos > INT_MAX) {
return EINVAL; return EINVAL;
} else {
m.REQ_SEEK_POS_HI = 0;
} }
m.REQ_NBYTES = num_of_bytes; 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.m_type = REQ_PEEK;
m.REQ_INODE_NR = inode_nr; m.REQ_INODE_NR = inode_nr;
m.REQ_GRANT = -1; m.REQ_GRANT = -1;
m.REQ_SEEK_POS_LO = ex64lo(pos); m.REQ_SEEK_POS = pos;
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
m.REQ_NBYTES = bytes; m.REQ_NBYTES = bytes;
/* Send/rec request */ /* Send/rec request */