Message types for VFS ftrunc
Change-Id: I593a4d91b1d974f632f6cb4eb23aabee5b65df7b
This commit is contained in:
parent
a725c62a66
commit
135346dfc3
7 changed files with 28 additions and 18 deletions
|
@ -178,6 +178,15 @@ typedef struct {
|
|||
} mess_vfs_fs_flush;
|
||||
_ASSERT_MSG_SIZE(mess_vfs_fs_flush);
|
||||
|
||||
typedef struct {
|
||||
ino_t inode;
|
||||
off_t trc_start;
|
||||
off_t trc_end;
|
||||
|
||||
uint8_t data[32];
|
||||
} mess_vfs_fs_ftrunc;
|
||||
_ASSERT_MSG_SIZE(mess_vfs_fs_ftrunc);
|
||||
|
||||
typedef struct {
|
||||
ino_t dir_ino;
|
||||
ino_t root_ino;
|
||||
|
@ -356,6 +365,7 @@ typedef struct {
|
|||
mess_vfs_fs_create m_vfs_fs_create;
|
||||
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_lookup m_vfs_fs_lookup;
|
||||
mess_fs_vfs_lookup m_fs_vfs_lookup;
|
||||
mess_vfs_fs_mountpoint m_vfs_fs_mountpoint;
|
||||
|
|
|
@ -19,11 +19,11 @@ int fs_ftrunc(void)
|
|||
off_t start, end;
|
||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||
|
||||
if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_INODE_NR)) == NULL)
|
||||
if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_ftrunc.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
start = fs_m_in.REQ_TRC_START;
|
||||
end = fs_m_in.REQ_TRC_END;
|
||||
start = fs_m_in.m_vfs_fs_ftrunc.trc_start;
|
||||
end = fs_m_in.m_vfs_fs_ftrunc.trc_end;
|
||||
|
||||
if (end == 0) {
|
||||
struct vattr va;
|
||||
|
|
|
@ -126,13 +126,13 @@ int do_ftrunc(void)
|
|||
if (state.s_read_only)
|
||||
return EROFS;
|
||||
|
||||
if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL)
|
||||
if ((ino = find_inode(m_in.m_vfs_fs_ftrunc.inode)) == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if (IS_DIR(ino)) return EISDIR;
|
||||
|
||||
start = m_in.REQ_TRC_START;
|
||||
end = m_in.REQ_TRC_END;
|
||||
start = m_in.m_vfs_fs_ftrunc.trc_start;
|
||||
end = m_in.m_vfs_fs_ftrunc.trc_end;
|
||||
|
||||
if (end == 0) {
|
||||
/* Truncate or expand the file. */
|
||||
|
|
|
@ -520,11 +520,11 @@ int fs_ftrunc(void)
|
|||
off_t start, end;
|
||||
int r;
|
||||
|
||||
if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||
if( (rip = find_inode(fs_dev, fs_m_in.m_vfs_fs_ftrunc.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
start = fs_m_in.REQ_TRC_START;
|
||||
end = fs_m_in.REQ_TRC_END;
|
||||
start = fs_m_in.m_vfs_fs_ftrunc.trc_start;
|
||||
end = fs_m_in.m_vfs_fs_ftrunc.trc_end;
|
||||
|
||||
if (end == 0)
|
||||
r = truncate_inode(rip, start);
|
||||
|
|
|
@ -492,14 +492,14 @@ int fs_ftrunc(void)
|
|||
off_t start, end;
|
||||
int r;
|
||||
|
||||
if( (rip = find_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
|
||||
if( (rip = find_inode(fs_dev, fs_m_in.m_vfs_fs_ftrunc.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
if(rip->i_sp->s_rd_only) {
|
||||
r = EROFS;
|
||||
} else {
|
||||
start = fs_m_in.REQ_TRC_START;
|
||||
end = fs_m_in.REQ_TRC_END;
|
||||
start = fs_m_in.m_vfs_fs_ftrunc.trc_start;
|
||||
end = fs_m_in.m_vfs_fs_ftrunc.trc_end;
|
||||
|
||||
if (end == 0)
|
||||
r = truncate_inode(rip, start);
|
||||
|
|
|
@ -10,13 +10,13 @@ int fs_ftrunc(message *fs_m_in, message *fs_m_out)
|
|||
{
|
||||
struct inode *rip;
|
||||
off_t start;
|
||||
pino_t inumb;
|
||||
ino_t inumb;
|
||||
|
||||
inumb = (pino_t) fs_m_in->REQ_INODE_NR;
|
||||
inumb = fs_m_in->m_vfs_fs_ftrunc.inode;
|
||||
|
||||
if( (rip = find_inode(inumb)) == NULL) return(EINVAL);
|
||||
|
||||
start = fs_m_in->REQ_TRC_START;
|
||||
start = fs_m_in->m_vfs_fs_ftrunc.trc_start;
|
||||
|
||||
return truncate_inode(rip, start);
|
||||
}
|
||||
|
|
|
@ -265,9 +265,9 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
|
|||
|
||||
/* Fill in request message */
|
||||
m.m_type = REQ_FTRUNC;
|
||||
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||
m.REQ_TRC_START = start;
|
||||
m.REQ_TRC_END = end;
|
||||
m.m_vfs_fs_ftrunc.inode = inode_nr;
|
||||
m.m_vfs_fs_ftrunc.trc_start = start;
|
||||
m.m_vfs_fs_ftrunc.trc_end = end;
|
||||
|
||||
if (!(vmp->m_fs_flags & RES_64BIT) &&
|
||||
((start > INT_MAX) || (end > INT_MAX))) {
|
||||
|
|
Loading…
Reference in a new issue