} mess_vfs_fs_ftrunc;
_ASSERT_MSG_SIZE(mess_vfs_fs_ftrunc);
+typedef struct {
+ ino_t inode;
+ off_t seek_pos;
+
+ cp_grant_id_t grant;
+ size_t mem_size;
+
+ uint8_t data[32];
+} mess_vfs_fs_getdents;
+_ASSERT_MSG_SIZE(mess_vfs_fs_getdents);
+
+typedef struct {
+ off_t seek_pos;
+
+ size_t nbytes;
+
+ uint8_t data[44];
+} mess_fs_vfs_getdents;
+_ASSERT_MSG_SIZE(mess_fs_vfs_getdents);
+
typedef struct {
ino_t dir_ino;
ino_t root_ino;
mess_fs_vfs_create m_fs_vfs_create;
mess_vfs_fs_flush m_vfs_fs_flush;
mess_vfs_fs_ftrunc m_vfs_fs_ftrunc;
+ mess_vfs_fs_getdents m_vfs_fs_getdents;
+ mess_fs_vfs_getdents m_fs_vfs_getdents;
mess_vfs_fs_lookup m_vfs_fs_lookup;
mess_fs_vfs_lookup m_fs_vfs_lookup;
mess_vfs_fs_mountpoint m_vfs_fs_mountpoint;
{
int r;
register struct puffs_node *pn;
- pino_t ino;
+ ino_t ino;
cp_grant_id_t gid;
size_t size, buf_left;
off_t pos;
size_t written;
PUFFS_MAKECRED(pcr, &global_kcred);
- 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;
+ ino = fs_m_in.m_vfs_fs_getdents.inode;
+ gid = fs_m_in.m_vfs_fs_getdents.grant;
+ size = buf_left = fs_m_in.m_vfs_fs_getdents.mem_size;
+ pos = fs_m_in.m_vfs_fs_getdents.seek_pos;
if ((pn = puffs_pn_nodewalk(global_pu, 0, &ino)) == NULL) {
lpuffs_debug("walk failed...\n");
update_timens(pn, ATIME, NULL);
- fs_m_out.RES_NBYTES = written;
- fs_m_out.RES_SEEK_POS = pos;
+ fs_m_out.m_fs_vfs_getdents.nbytes = written;
+ fs_m_out.m_fs_vfs_getdents.seek_pos = pos;
return(OK);
}
attr.a_mask = SFFS_ATTR_MODE;
- if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL)
+ if ((ino = find_inode(m_in.m_vfs_fs_getdents.inode)) == NULL)
return EINVAL;
- if(m_in.REQ_SEEK_POS >= ULONG_MAX) return EINVAL;
+ if(m_in.m_vfs_fs_getdents.seek_pos >= ULONG_MAX) return EINVAL;
if (!IS_DIR(ino)) return ENOTDIR;
off = 0;
user_off = 0;
- user_left = m_in.REQ_MEM_SIZE;
+ user_left = m_in.m_vfs_fs_getdents.mem_size;
/* We use the seek position as file index number. The first position is for
* 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; ; pos++) {
+ for (pos = m_in.m_vfs_fs_getdents.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.
/* If our own buffer cannot contain the new record, copy out first. */
if (off + len > sizeof(buf)) {
- r = sys_safecopyto(m_in.m_source, m_in.REQ_GRANT,
+ r = sys_safecopyto(m_in.m_source, m_in.m_vfs_fs_getdents.grant,
user_off, (vir_bytes) buf, off);
if (r != OK) {
/* If there is anything left in our own buffer, copy that out now. */
if (off > 0) {
- r = sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, user_off,
+ r = sys_safecopyto(m_in.m_source, m_in.m_vfs_fs_getdents.grant, user_off,
(vir_bytes) buf, off);
if (r != OK)
user_off += off;
}
- m_out.RES_SEEK_POS = pos;
- m_out.RES_NBYTES = user_off;
+ m_out.m_fs_vfs_getdents.seek_pos = pos;
+ m_out.m_fs_vfs_getdents.nbytes = user_off;
return OK;
}
int r, skip, get_next, indexed;
static char buf[GETDENTS_BUFSIZ];
- if (fs_m_in.REQ_SEEK_POS >= ULONG_MAX)
+ if (fs_m_in.m_vfs_fs_getdents.seek_pos >= ULONG_MAX)
return EIO;
- if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL)
+ if ((node = find_inode(fs_m_in.m_vfs_fs_getdents.inode)) == NULL)
return EINVAL;
off = 0;
user_off = 0;
- user_left = fs_m_in.REQ_MEM_SIZE;
+ user_left = fs_m_in.m_vfs_fs_getdents.mem_size;
indexed = node->i_indexed;
get_next = FALSE;
child = NULL;
if (r != OK) return r;
}
- for (pos = fs_m_in.REQ_SEEK_POS; ; pos++) {
+ for (pos = fs_m_in.m_vfs_fs_getdents.seek_pos; ; pos++) {
/* Determine which inode and name to use for this entry. */
if (pos == 0) {
/* The "." entry. */
* first.
*/
if (off + len > sizeof(buf)) {
- r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT,
+ r = sys_safecopyto(fs_m_in.m_source, fs_m_in.m_vfs_fs_getdents.grant,
user_off, (vir_bytes) buf, off);
if (r != OK) return r;
/* If there is anything left in our own buffer, copy that out now. */
if (off > 0) {
- r = sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT,
+ r = sys_safecopyto(fs_m_in.m_source, fs_m_in.m_vfs_fs_getdents.grant,
user_off, (vir_bytes) buf, off);
if (r != OK)
return r;
user_off += off;
}
- fs_m_out.RES_SEEK_POS = pos;
- fs_m_out.RES_NBYTES = user_off;
+ fs_m_out.m_fs_vfs_getdents.seek_pos = pos;
+ fs_m_out.m_fs_vfs_getdents.nbytes = user_off;
return OK;
}
struct inode *rip;
int r, done;
unsigned int block_size, len, reclen;
- pino_t ino;
+ ino_t ino;
cp_grant_id_t gid;
size_t size, tmpbuf_off, userbuf_off;
off_t pos, off, block_pos, new_pos, ent_pos;
struct ext2_disk_dir_desc *d_desc;
struct dirent *dep;
- 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;
+ ino = fs_m_in.m_vfs_fs_getdents.inode;
+ gid = fs_m_in.m_vfs_fs_getdents.grant;
+ size = fs_m_in.m_vfs_fs_getdents.mem_size;
+ pos = fs_m_in.m_vfs_fs_getdents.seek_pos;
/* Check whether the position is properly aligned */
if ((unsigned int) pos % DIR_ENTRY_ALIGN)
if (done && userbuf_off == 0)
r = EINVAL; /* The user's buffer is too small */
else {
- fs_m_out.RES_NBYTES = userbuf_off;
- fs_m_out.RES_SEEK_POS = new_pos;
+ fs_m_out.m_fs_vfs_getdents.nbytes = userbuf_off;
+ fs_m_out.m_fs_vfs_getdents.seek_pos = new_pos;
rip->i_update |= ATIME;
rip->i_dirt = IN_DIRTY;
r = OK;
memset(name_old,'\0',NAME_MAX);
/* Get input parameters */
- ino = fs_m_in.REQ_INODE_NR;
- gid = fs_m_in.REQ_GRANT;
- pos = fs_m_in.REQ_SEEK_POS;
+ ino = fs_m_in.m_vfs_fs_getdents.inode;
+ gid = fs_m_in.m_vfs_fs_getdents.grant;
+ pos = fs_m_in.m_vfs_fs_getdents.seek_pos;
block_size = v_pri.logical_block_size_l;
cur_pos = pos; /* The current position */
userbuf_off += tmpbuf_offset;
}
- fs_m_out.RES_NBYTES = userbuf_off;
- fs_m_out.RES_SEEK_POS = cur_pos;
+ fs_m_out.m_fs_vfs_getdents.nbytes = userbuf_off;
+ fs_m_out.m_fs_vfs_getdents.seek_pos = cur_pos;
release_dir_record(dir); /* release the inode */
return(OK);
struct dirent *dep;
char *cp;
- 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;
+ ino = fs_m_in.m_vfs_fs_getdents.inode;
+ gid = fs_m_in.m_vfs_fs_getdents.grant;
+ size = fs_m_in.m_vfs_fs_getdents.mem_size;
+ pos = fs_m_in.m_vfs_fs_getdents.seek_pos;
/* Check whether the position is properly aligned */
if( (unsigned int) pos % DIR_ENTRY_SIZE)
if (done && userbuf_off == 0)
r = EINVAL; /* The user's buffer is too small */
else {
- fs_m_out.RES_NBYTES = userbuf_off;
- fs_m_out.RES_SEEK_POS = new_pos;
+ fs_m_out.m_fs_vfs_getdents.nbytes = userbuf_off;
+ fs_m_out.m_fs_vfs_getdents.seek_pos = new_pos;
if(!rip->i_sp->s_rd_only) {
rip->i_update |= ATIME;
IN_MARKDIRTY(rip);
grant_id);
m.m_type = REQ_GETDENTS;
- m.REQ_INODE_NR = (pino_t) inode_nr;
- m.REQ_GRANT = grant_id;
- m.REQ_MEM_SIZE = size;
- m.REQ_SEEK_POS = pos;
+ m.m_vfs_fs_getdents.inode = inode_nr;
+ m.m_vfs_fs_getdents.grant = grant_id;
+ m.m_vfs_fs_getdents.mem_size = size;
+ m.m_vfs_fs_getdents.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;
cpf_revoke(grant_id);
if (r == OK) {
- *new_pos = m.RES_SEEK_POS;
- r = m.RES_NBYTES;
+ *new_pos = m.m_fs_vfs_getdents.seek_pos;
+ r = m.m_fs_vfs_getdents.nbytes;
}
return(r);