VFS: use 64-bit file offsets in all requests
Change-Id: I07189d410094b193cb7bbd3f2507537bb1e7f96c
This commit is contained in:
parent
b58f2a6a00
commit
9be90ede0d
|
|
@ -56,12 +56,13 @@
|
||||||
|
|
||||||
#define RES_PROTO m9_s3
|
#define RES_PROTO m9_s3
|
||||||
/* RES_PROTO is defined as follows:
|
/* RES_PROTO is defined as follows:
|
||||||
* |----------------|
|
* |--------------------------------|
|
||||||
* 7V 4CR 0
|
* 8O7 V 4 CR 0
|
||||||
* 15 0
|
* 15 0
|
||||||
* mentioned bits are inclusive
|
* mentioned bits are inclusive
|
||||||
* CR: bits 4-0 encode no. concurrent requests are supported by FS
|
* CR: bits 4-0 encode no. concurrent requests are supported by FS
|
||||||
* V: bits 7-5 encode version of protocol
|
* V: bits 7-5 encode version of protocol
|
||||||
|
* O: bit 8 encodes support for 64-bit file offsets
|
||||||
*/
|
*/
|
||||||
#define RES_PROTO_CR_SHIFT 0
|
#define RES_PROTO_CR_SHIFT 0
|
||||||
#define RES_PROTO_CR_MASK 0x1F
|
#define RES_PROTO_CR_MASK 0x1F
|
||||||
|
|
@ -74,6 +75,8 @@
|
||||||
#define VFS_FS_PROTO_PUT_VERSION(b,v) \
|
#define VFS_FS_PROTO_PUT_VERSION(b,v) \
|
||||||
((b) |= (((v) << RES_PROTO_V_SHIFT) & RES_PROTO_V_MASK))
|
((b) |= (((v) << RES_PROTO_V_SHIFT) & RES_PROTO_V_MASK))
|
||||||
#define VFS_FS_CURRENT_VERSION 1 /* Current version */
|
#define VFS_FS_CURRENT_VERSION 1 /* Current version */
|
||||||
|
#define RES_PROTO_BIGOFFT_SHIFT 8
|
||||||
|
#define VFS_FS_PROTO_BIGOFFT(b) (b & RES_PROTO_BIGOFFT_SHIFT)
|
||||||
|
|
||||||
/* VFS/FS flags */
|
/* VFS/FS flags */
|
||||||
#define REQ_RDONLY 001
|
#define REQ_RDONLY 001
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ int dev_io(
|
||||||
dev_t dev, /* major-minor device number */
|
dev_t dev, /* major-minor device number */
|
||||||
int proc_e, /* in whose address space is buf? */
|
int proc_e, /* in whose address space is buf? */
|
||||||
void *buf, /* virtual address of the buffer */
|
void *buf, /* virtual address of the buffer */
|
||||||
u64_t pos, /* byte position */
|
off_t pos, /* byte position */
|
||||||
size_t bytes, /* how many bytes to transfer */
|
size_t bytes, /* how many bytes to transfer */
|
||||||
int flags, /* special flags, like O_NONBLOCK */
|
int flags, /* special flags, like O_NONBLOCK */
|
||||||
int suspend_reopen /* Just suspend the process */
|
int suspend_reopen /* Just suspend the process */
|
||||||
|
|
@ -680,7 +680,7 @@ int do_ioctl()
|
||||||
if (S_ISBLK(vp->v_mode))
|
if (S_ISBLK(vp->v_mode))
|
||||||
r = bdev_ioctl(dev, who_e, ioctlrequest, argx);
|
r = bdev_ioctl(dev, who_e, ioctlrequest, argx);
|
||||||
else
|
else
|
||||||
r = dev_io(VFS_DEV_IOCTL, dev, who_e, argx, cvu64(0),
|
r = dev_io(VFS_DEV_IOCTL, dev, who_e, argx, 0,
|
||||||
ioctlrequest, f->filp_flags, suspend_reopen);
|
ioctlrequest, f->filp_flags, suspend_reopen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -487,9 +487,8 @@ char path[PATH_MAX]; /* path to script file */
|
||||||
*/
|
*/
|
||||||
enum { INSERT=FALSE, REPLACE=TRUE };
|
enum { INSERT=FALSE, REPLACE=TRUE };
|
||||||
int n, r;
|
int n, r;
|
||||||
off_t pos;
|
off_t pos, new_pos;
|
||||||
char *sp, *interp = NULL;
|
char *sp, *interp = NULL;
|
||||||
u64_t new_pos;
|
|
||||||
unsigned int cum_io;
|
unsigned int cum_io;
|
||||||
char buf[_MAX_BLOCK_SIZE];
|
char buf[_MAX_BLOCK_SIZE];
|
||||||
|
|
||||||
|
|
@ -499,8 +498,8 @@ char path[PATH_MAX]; /* path to script file */
|
||||||
pos = 0; /* Read from the start of the file */
|
pos = 0; /* Read from the start of the file */
|
||||||
|
|
||||||
/* Issue request */
|
/* Issue request */
|
||||||
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(pos), READING,
|
r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, pos, READING, VFS_PROC_NR,
|
||||||
VFS_PROC_NR, (vir_bytes) buf, _MAX_BLOCK_SIZE, &new_pos, &cum_io);
|
(vir_bytes) buf, _MAX_BLOCK_SIZE, &new_pos, &cum_io);
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
|
|
||||||
n = vp->v_size;
|
n = vp->v_size;
|
||||||
|
|
@ -616,7 +615,7 @@ static int read_seg(struct exec_info *execi, off_t off, off_t seg_addr, size_t s
|
||||||
* partially initialized.
|
* partially initialized.
|
||||||
*/
|
*/
|
||||||
int r;
|
int r;
|
||||||
u64_t new_pos;
|
off_t new_pos;
|
||||||
unsigned int cum_io;
|
unsigned int cum_io;
|
||||||
struct vnode *vp = ((struct vfs_exec_info *) execi->opaque)->vp;
|
struct vnode *vp = ((struct vfs_exec_info *) execi->opaque)->vp;
|
||||||
|
|
||||||
|
|
@ -624,7 +623,7 @@ static int read_seg(struct exec_info *execi, off_t off, off_t seg_addr, size_t s
|
||||||
if (off + seg_bytes > LONG_MAX) return(EIO);
|
if (off + seg_bytes > LONG_MAX) return(EIO);
|
||||||
if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO);
|
if ((unsigned long) vp->v_size < off+seg_bytes) return(EIO);
|
||||||
|
|
||||||
if ((r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, cvul64(off), READING,
|
if ((r = req_readwrite(vp->v_fs_e, vp->v_inode_nr, off, READING,
|
||||||
execi->proc_e, (vir_bytes) seg_addr, seg_bytes,
|
execi->proc_e, (vir_bytes) seg_addr, seg_bytes,
|
||||||
&new_pos, &cum_io)) != OK) {
|
&new_pos, &cum_io)) != OK) {
|
||||||
printf("VFS: read_seg: req_readwrite failed (data)\n");
|
printf("VFS: read_seg: req_readwrite failed (data)\n");
|
||||||
|
|
@ -659,9 +658,8 @@ static void clo_exec(struct fproc *rfp)
|
||||||
static int map_header(struct vfs_exec_info *execi)
|
static int map_header(struct vfs_exec_info *execi)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
u64_t new_pos;
|
|
||||||
unsigned int cum_io;
|
unsigned int cum_io;
|
||||||
off_t pos;
|
off_t pos, new_pos;
|
||||||
static char hdr[PAGE_SIZE]; /* Assume that header is not larger than a page */
|
static char hdr[PAGE_SIZE]; /* Assume that header is not larger than a page */
|
||||||
|
|
||||||
pos = 0; /* Read from the start of the file */
|
pos = 0; /* Read from the start of the file */
|
||||||
|
|
@ -671,7 +669,7 @@ static int map_header(struct vfs_exec_info *execi)
|
||||||
execi->args.hdr = hdr;
|
execi->args.hdr = hdr;
|
||||||
|
|
||||||
r = req_readwrite(execi->vp->v_fs_e, execi->vp->v_inode_nr,
|
r = req_readwrite(execi->vp->v_fs_e, execi->vp->v_inode_nr,
|
||||||
cvul64(pos), READING, VFS_PROC_NR, (vir_bytes) hdr,
|
pos, READING, VFS_PROC_NR, (vir_bytes) hdr,
|
||||||
execi->args.hdr_len, &new_pos, &cum_io);
|
execi->args.hdr_len, &new_pos, &cum_io);
|
||||||
if (r != OK) {
|
if (r != OK) {
|
||||||
printf("VFS: exec: map_header: req_readwrite failed\n");
|
printf("VFS: exec: map_header: req_readwrite failed\n");
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ EXTERN struct filp {
|
||||||
int filp_state; /* state for crash recovery */
|
int filp_state; /* state for crash recovery */
|
||||||
int filp_count; /* how many file descriptors share this slot?*/
|
int filp_count; /* how many file descriptors share this slot?*/
|
||||||
struct vnode *filp_vno; /* vnode belonging to this file */
|
struct vnode *filp_vno; /* vnode belonging to this file */
|
||||||
u64_t filp_pos; /* file position */
|
off_t filp_pos; /* file position */
|
||||||
mutex_t filp_lock; /* lock to gain exclusive access */
|
mutex_t filp_lock; /* lock to gain exclusive access */
|
||||||
struct fproc *filp_softlock; /* if not NULL; this filp didn't lock the
|
struct fproc *filp_softlock; /* if not NULL; this filp didn't lock the
|
||||||
* vnode. Another filp already holds a lock
|
* vnode. Another filp already holds a lock
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ int get_fd(int start, mode_t bits, int *k, struct filp **fpt)
|
||||||
assert(f->filp_count >= 0);
|
assert(f->filp_count >= 0);
|
||||||
if (f->filp_count == 0 && mutex_trylock(&f->filp_lock) == 0) {
|
if (f->filp_count == 0 && mutex_trylock(&f->filp_lock) == 0) {
|
||||||
f->filp_mode = bits;
|
f->filp_mode = bits;
|
||||||
f->filp_pos = cvu64(0);
|
f->filp_pos = 0;
|
||||||
f->filp_selectors = 0;
|
f->filp_selectors = 0;
|
||||||
f->filp_select_ops = 0;
|
f->filp_select_ops = 0;
|
||||||
f->filp_pipe_select_ops = 0;
|
f->filp_pipe_select_ops = 0;
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,7 @@ int req; /* either F_SETLK or F_SETLKW */
|
||||||
/* Compute the first and last bytes in the lock region. */
|
/* Compute the first and last bytes in the lock region. */
|
||||||
switch (flock.l_whence) {
|
switch (flock.l_whence) {
|
||||||
case SEEK_SET: first = 0; break;
|
case SEEK_SET: first = 0; break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR: first = f->filp_pos; break;
|
||||||
if (ex64hi(f->filp_pos) != 0)
|
|
||||||
panic("lock_op: position in file too high");
|
|
||||||
first = ex64lo(f->filp_pos);
|
|
||||||
break;
|
|
||||||
case SEEK_END: first = f->filp_vno->v_size; break;
|
case SEEK_END: first = f->filp_vno->v_size; break;
|
||||||
default: return(EINVAL);
|
default: return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,11 +212,7 @@ int do_fcntl()
|
||||||
/* Figure out starting position base. */
|
/* Figure out starting position base. */
|
||||||
switch(flock_arg.l_whence) {
|
switch(flock_arg.l_whence) {
|
||||||
case SEEK_SET: start = 0; break;
|
case SEEK_SET: start = 0; break;
|
||||||
case SEEK_CUR:
|
case SEEK_CUR: start = f->filp_pos; break;
|
||||||
if (ex64hi(f->filp_pos) != 0)
|
|
||||||
panic("do_fcntl: position in file too high");
|
|
||||||
start = ex64lo(f->filp_pos);
|
|
||||||
break;
|
|
||||||
case SEEK_END: start = f->filp_vno->v_size; break;
|
case SEEK_END: start = f->filp_vno->v_size; break;
|
||||||
default: r = EINVAL;
|
default: r = EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -596,7 +596,7 @@ int do_lseek_321()
|
||||||
register struct filp *rfilp;
|
register struct filp *rfilp;
|
||||||
int r = OK, seekfd, seekwhence;
|
int r = OK, seekfd, seekwhence;
|
||||||
i32_t offset;
|
i32_t offset;
|
||||||
u64_t pos, newpos;
|
off_t pos, newpos;
|
||||||
|
|
||||||
seekfd = job_m_in.ls_fd;
|
seekfd = job_m_in.ls_fd;
|
||||||
seekwhence = job_m_in.whence;
|
seekwhence = job_m_in.whence;
|
||||||
|
|
@ -613,27 +613,24 @@ int do_lseek_321()
|
||||||
|
|
||||||
/* The value of 'whence' determines the start position to use. */
|
/* The value of 'whence' determines the start position to use. */
|
||||||
switch(seekwhence) {
|
switch(seekwhence) {
|
||||||
case SEEK_SET: pos = cvu64(0); break;
|
case SEEK_SET: pos = 0; break;
|
||||||
case SEEK_CUR: pos = rfilp->filp_pos; break;
|
case SEEK_CUR: pos = rfilp->filp_pos; break;
|
||||||
case SEEK_END: pos = cvul64(rfilp->filp_vno->v_size); break;
|
case SEEK_END: pos = rfilp->filp_vno->v_size; break;
|
||||||
default: unlock_filp(rfilp); return(EINVAL);
|
default: unlock_filp(rfilp); return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset >= 0)
|
newpos = pos + offset;
|
||||||
newpos = add64ul(pos, offset);
|
|
||||||
else
|
|
||||||
newpos = sub64ul(pos, -offset);
|
|
||||||
|
|
||||||
/* Check for overflow. */
|
/* Check for overflow. */
|
||||||
if (ex64hi(newpos) != 0) {
|
if (newpos > INT_MAX) { /* This is for backwards compatibility */
|
||||||
r = EOVERFLOW;
|
r = EOVERFLOW;
|
||||||
} else if ((i32_t) ex64lo(newpos) < 0) { /* no negative file size */
|
} else if (newpos < 0) { /* no negative file size */
|
||||||
r = EOVERFLOW;
|
r = EOVERFLOW;
|
||||||
} else {
|
} else {
|
||||||
/* insert the new position into the output message */
|
/* insert the new position into the output message */
|
||||||
m_out.reply_l1 = ex64lo(newpos);
|
m_out.reply_l1 = (long) newpos;
|
||||||
|
|
||||||
if (cmp64(newpos, rfilp->filp_pos) != 0) {
|
if (newpos != rfilp->filp_pos) {
|
||||||
rfilp->filp_pos = newpos;
|
rfilp->filp_pos = newpos;
|
||||||
|
|
||||||
/* Inhibit read ahead request */
|
/* Inhibit read ahead request */
|
||||||
|
|
@ -655,7 +652,7 @@ int do_lseek()
|
||||||
register struct filp *rfilp;
|
register struct filp *rfilp;
|
||||||
int r = OK, seekfd, seekwhence;
|
int r = OK, seekfd, seekwhence;
|
||||||
off_t offset;
|
off_t offset;
|
||||||
u64_t pos, newpos;
|
off_t pos, newpos;
|
||||||
|
|
||||||
seekfd = job_m_in.ls_fd;
|
seekfd = job_m_in.ls_fd;
|
||||||
seekwhence = job_m_in.whence;
|
seekwhence = job_m_in.whence;
|
||||||
|
|
@ -672,22 +669,23 @@ int do_lseek()
|
||||||
|
|
||||||
/* The value of 'whence' determines the start position to use. */
|
/* The value of 'whence' determines the start position to use. */
|
||||||
switch(seekwhence) {
|
switch(seekwhence) {
|
||||||
case SEEK_SET: pos = cvu64(0); break;
|
case SEEK_SET: pos = 0; break;
|
||||||
case SEEK_CUR: pos = rfilp->filp_pos; break;
|
case SEEK_CUR: pos = rfilp->filp_pos; break;
|
||||||
case SEEK_END: pos = cvul64(rfilp->filp_vno->v_size); break;
|
case SEEK_END: pos = rfilp->filp_vno->v_size; break;
|
||||||
default: unlock_filp(rfilp); return(EINVAL);
|
default: unlock_filp(rfilp); return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset < 0 && -offset > pos) { /* no negative file size */
|
|
||||||
r = EOVERFLOW;
|
|
||||||
} else {
|
|
||||||
newpos = pos + offset;
|
newpos = pos + offset;
|
||||||
|
|
||||||
|
if (newpos < 0) { /* no negative file size */
|
||||||
|
r = EOVERFLOW;
|
||||||
|
} else {
|
||||||
|
|
||||||
/* insert the new position into the output message */
|
/* insert the new position into the output message */
|
||||||
m_out.reply_l1 = ex64lo(newpos);
|
m_out.reply_l1 = ex64lo(newpos);
|
||||||
m_out.reply_l2 = ex64hi(newpos);
|
m_out.reply_l2 = ex64hi(newpos);
|
||||||
|
|
||||||
if (cmp64(newpos, rfilp->filp_pos) != 0) {
|
if (newpos != rfilp->filp_pos) {
|
||||||
rfilp->filp_pos = newpos;
|
rfilp->filp_pos = newpos;
|
||||||
|
|
||||||
/* Inhibit read ahead request */
|
/* Inhibit read ahead request */
|
||||||
|
|
@ -700,63 +698,6 @@ int do_lseek()
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_llseek *
|
|
||||||
*===========================================================================*/
|
|
||||||
int do_llseek()
|
|
||||||
{
|
|
||||||
/* Perform the llseek(ls_fd, offset, whence) system call. */
|
|
||||||
register struct filp *rfilp;
|
|
||||||
u64_t pos, newpos;
|
|
||||||
int r = OK, seekfd, seekwhence;
|
|
||||||
long off_hi, off_lo;
|
|
||||||
|
|
||||||
seekfd = job_m_in.ls_fd;
|
|
||||||
seekwhence = job_m_in.whence;
|
|
||||||
off_hi = job_m_in.offset_high;
|
|
||||||
off_lo = job_m_in.offset_lo;
|
|
||||||
|
|
||||||
/* Check to see if the file descriptor is valid. */
|
|
||||||
if ( (rfilp = get_filp(seekfd, VNODE_READ)) == NULL) return(err_code);
|
|
||||||
|
|
||||||
/* No lseek on pipes. */
|
|
||||||
if (S_ISFIFO(rfilp->filp_vno->v_mode)) {
|
|
||||||
unlock_filp(rfilp);
|
|
||||||
return(ESPIPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The value of 'whence' determines the start position to use. */
|
|
||||||
switch(seekwhence) {
|
|
||||||
case SEEK_SET: pos = cvu64(0); break;
|
|
||||||
case SEEK_CUR: pos = rfilp->filp_pos; break;
|
|
||||||
case SEEK_END: pos = cvul64(rfilp->filp_vno->v_size); break;
|
|
||||||
default: unlock_filp(rfilp); return(EINVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
newpos = add64(pos, make64(off_lo, off_hi));
|
|
||||||
|
|
||||||
/* Check for overflow. */
|
|
||||||
if ((off_hi > 0) && cmp64(newpos, pos) < 0)
|
|
||||||
r = EINVAL;
|
|
||||||
else if ((off_hi < 0) && cmp64(newpos, pos) > 0)
|
|
||||||
r = EINVAL;
|
|
||||||
else {
|
|
||||||
/* insert the new position into the output message */
|
|
||||||
m_out.reply_l1 = ex64lo(newpos);
|
|
||||||
m_out.reply_l2 = ex64hi(newpos);
|
|
||||||
|
|
||||||
if (cmp64(newpos, rfilp->filp_pos) != 0) {
|
|
||||||
rfilp->filp_pos = newpos;
|
|
||||||
|
|
||||||
/* Inhibit read ahead request */
|
|
||||||
r = req_inhibread(rfilp->filp_vno->v_fs_e,
|
|
||||||
rfilp->filp_vno->v_inode_nr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unlock_filp(rfilp);
|
|
||||||
return(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_close *
|
* do_close *
|
||||||
|
|
|
||||||
|
|
@ -615,12 +615,12 @@ char ename[NAME_MAX + 1];
|
||||||
{
|
{
|
||||||
#define DIR_ENTRIES 8
|
#define DIR_ENTRIES 8
|
||||||
#define DIR_ENTRY_SIZE (sizeof(struct dirent) + NAME_MAX)
|
#define DIR_ENTRY_SIZE (sizeof(struct dirent) + NAME_MAX)
|
||||||
u64_t pos, new_pos;
|
off_t pos, new_pos;
|
||||||
int r, consumed, totalbytes, name_len;
|
int r, consumed, totalbytes, name_len;
|
||||||
char buf[DIR_ENTRY_SIZE * DIR_ENTRIES];
|
char buf[DIR_ENTRY_SIZE * DIR_ENTRIES];
|
||||||
struct dirent *cur;
|
struct dirent *cur;
|
||||||
|
|
||||||
pos = make64(0, 0);
|
pos = 0;
|
||||||
|
|
||||||
if (!S_ISDIR(dirp->v_mode)) return(EBADF);
|
if (!S_ISDIR(dirp->v_mode)) return(EBADF);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ void dev_reply(struct dmap *dp);
|
||||||
int dev_close(dev_t dev, int filp_no);
|
int dev_close(dev_t dev, int filp_no);
|
||||||
int bdev_open(dev_t dev, int access);
|
int bdev_open(dev_t dev, int access);
|
||||||
int bdev_close(dev_t dev);
|
int bdev_close(dev_t dev);
|
||||||
int dev_io(int op, dev_t dev, endpoint_t proc_e, void *buf, u64_t pos,
|
int dev_io(int op, dev_t dev, endpoint_t proc_e, void *buf, off_t pos,
|
||||||
size_t bytes, int flags, int suspend_reopen);
|
size_t bytes, int flags, int suspend_reopen);
|
||||||
int gen_opcl(int op, dev_t dev, endpoint_t task_nr, int flags);
|
int gen_opcl(int op, dev_t dev, endpoint_t task_nr, int flags);
|
||||||
int gen_io(endpoint_t driver_e, message *mess_ptr);
|
int gen_io(endpoint_t driver_e, message *mess_ptr);
|
||||||
|
|
@ -218,9 +218,9 @@ int rw_pipe(int rw_flag, endpoint_t usr, struct filp *f, char *buf,
|
||||||
size_t req_size);
|
size_t req_size);
|
||||||
|
|
||||||
/* request.c */
|
/* request.c */
|
||||||
int req_breadwrite(endpoint_t fs_e, endpoint_t user_e, dev_t dev, u64_t pos,
|
int req_breadwrite(endpoint_t fs_e, endpoint_t user_e, dev_t dev, off_t pos,
|
||||||
unsigned int num_of_bytes, vir_bytes user_addr, int rw_flag,
|
unsigned int num_of_bytes, vir_bytes user_addr, int rw_flag,
|
||||||
u64_t *new_posp, unsigned int *cum_iop);
|
off_t *new_posp, unsigned int *cum_iop);
|
||||||
int req_chmod(endpoint_t fs_e, ino_t inode_nr, mode_t rmode,
|
int req_chmod(endpoint_t fs_e, ino_t inode_nr, mode_t rmode,
|
||||||
mode_t *new_modep);
|
mode_t *new_modep);
|
||||||
int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid,
|
int req_chown(endpoint_t fs_e, ino_t inode_nr, uid_t newuid, gid_t newgid,
|
||||||
|
|
@ -231,8 +231,8 @@ int req_flush(endpoint_t fs_e, dev_t dev);
|
||||||
int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf);
|
int req_fstatfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf);
|
||||||
int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf);
|
int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf);
|
||||||
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end);
|
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end);
|
||||||
int req_getdents(endpoint_t fs_e, ino_t inode_nr, u64_t pos, char *buf,
|
int req_getdents(endpoint_t fs_e, ino_t inode_nr, off_t pos, char *buf,
|
||||||
size_t size, u64_t *new_pos, int direct, int getdents_321);
|
size_t size, off_t *new_pos, int direct, int getdents_321);
|
||||||
int req_inhibread(endpoint_t fs_e, ino_t inode_nr);
|
int req_inhibread(endpoint_t fs_e, ino_t inode_nr);
|
||||||
int req_link(endpoint_t fs_e, ino_t link_parent, char *lastc,
|
int req_link(endpoint_t fs_e, ino_t link_parent, char *lastc,
|
||||||
ino_t linked_file);
|
ino_t linked_file);
|
||||||
|
|
@ -251,9 +251,9 @@ int req_rdlink(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e,
|
||||||
vir_bytes buf, size_t len, int direct);
|
vir_bytes buf, size_t len, int direct);
|
||||||
int req_readsuper(struct vmnt *vmp, char *driver_name, dev_t dev, int readonly,
|
int req_readsuper(struct vmnt *vmp, char *driver_name, dev_t dev, int readonly,
|
||||||
int isroot, struct node_details *res_nodep);
|
int isroot, struct node_details *res_nodep);
|
||||||
int req_readwrite(endpoint_t fs_e, ino_t inode_nr, u64_t pos, int rw_flag,
|
int req_readwrite(endpoint_t fs_e, ino_t inode_nr, off_t pos, int rw_flag,
|
||||||
endpoint_t user_e, vir_bytes user_addr, unsigned int num_of_bytes,
|
endpoint_t user_e, vir_bytes user_addr, unsigned int num_of_bytes,
|
||||||
u64_t *new_posp, unsigned int *cum_iop);
|
off_t *new_posp, unsigned int *cum_iop);
|
||||||
int req_rename(endpoint_t fs_e, ino_t old_dir, char *old_name, ino_t new_dir,
|
int req_rename(endpoint_t fs_e, ino_t old_dir, char *old_name, ino_t new_dir,
|
||||||
char *new_name);
|
char *new_name);
|
||||||
int req_rmdir(endpoint_t fs_e, ino_t inode_nr, char *lastc);
|
int req_rmdir(endpoint_t fs_e, ino_t inode_nr, char *lastc);
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
||||||
endpoint_t for_e)
|
endpoint_t for_e)
|
||||||
{
|
{
|
||||||
register struct vnode *vp;
|
register struct vnode *vp;
|
||||||
u64_t position, res_pos, new_pos;
|
off_t position, res_pos, new_pos;
|
||||||
unsigned int cum_io, cum_io_incr, res_cum_io;
|
unsigned int cum_io, cum_io_incr, res_cum_io;
|
||||||
int op, r;
|
int op, r;
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
||||||
suspend_reopen);
|
suspend_reopen);
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
cum_io = r;
|
cum_io = r;
|
||||||
position = add64ul(position, r);
|
position += cum_io;
|
||||||
r = OK;
|
r = OK;
|
||||||
}
|
}
|
||||||
} else if (S_ISBLK(vp->v_mode)) { /* Block special files. */
|
} else if (S_ISBLK(vp->v_mode)) { /* Block special files. */
|
||||||
|
|
@ -186,7 +186,7 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
||||||
} else { /* Regular files */
|
} else { /* Regular files */
|
||||||
if (rw_flag == WRITING) {
|
if (rw_flag == WRITING) {
|
||||||
/* Check for O_APPEND flag. */
|
/* Check for O_APPEND flag. */
|
||||||
if (f->filp_flags & O_APPEND) position = cvul64(vp->v_size);
|
if (f->filp_flags & O_APPEND) position = vp->v_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Issue request */
|
/* Issue request */
|
||||||
|
|
@ -194,9 +194,6 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
||||||
(vir_bytes) buf, size, &new_pos, &cum_io_incr);
|
(vir_bytes) buf, size, &new_pos, &cum_io_incr);
|
||||||
|
|
||||||
if (r >= 0) {
|
if (r >= 0) {
|
||||||
if (ex64hi(new_pos))
|
|
||||||
panic("read_write: bad new pos");
|
|
||||||
|
|
||||||
position = new_pos;
|
position = new_pos;
|
||||||
cum_io += cum_io_incr;
|
cum_io += cum_io_incr;
|
||||||
}
|
}
|
||||||
|
|
@ -205,11 +202,8 @@ int read_write(int rw_flag, struct filp *f, char *buf, size_t size,
|
||||||
/* On write, update file size and access time. */
|
/* On write, update file size and access time. */
|
||||||
if (rw_flag == WRITING) {
|
if (rw_flag == WRITING) {
|
||||||
if (S_ISREG(vp->v_mode) || S_ISDIR(vp->v_mode)) {
|
if (S_ISREG(vp->v_mode) || S_ISDIR(vp->v_mode)) {
|
||||||
if (cmp64ul(position, vp->v_size) > 0) {
|
if (position > vp->v_size) {
|
||||||
if (ex64hi(position) != 0) {
|
vp->v_size = position;
|
||||||
panic("read_write: file size too big ");
|
|
||||||
}
|
|
||||||
vp->v_size = ex64lo(position);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +232,7 @@ int do_getdents()
|
||||||
{
|
{
|
||||||
/* Perform the getdents(fd, buf, size) system call. */
|
/* Perform the getdents(fd, buf, size) system call. */
|
||||||
int r = OK, getdents_321 = 0;
|
int r = OK, getdents_321 = 0;
|
||||||
u64_t new_pos;
|
off_t new_pos;
|
||||||
register struct filp *rfilp;
|
register struct filp *rfilp;
|
||||||
|
|
||||||
if (job_call_nr == GETDENTS_321) getdents_321 = 1;
|
if (job_call_nr == GETDENTS_321) getdents_321 = 1;
|
||||||
|
|
@ -256,9 +250,6 @@ int do_getdents()
|
||||||
r = EBADF;
|
r = EBADF;
|
||||||
|
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
if (ex64hi(rfilp->filp_pos) != 0)
|
|
||||||
panic("do_getdents: can't handle large offsets");
|
|
||||||
|
|
||||||
r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr,
|
r = req_getdents(rfilp->filp_vno->v_fs_e, rfilp->filp_vno->v_inode_nr,
|
||||||
rfilp->filp_pos, scratch(fp).io.io_buffer,
|
rfilp->filp_pos, scratch(fp).io.io_buffer,
|
||||||
scratch(fp).io.io_nbytes, &new_pos, 0, getdents_321);
|
scratch(fp).io.io_nbytes, &new_pos, 0, getdents_321);
|
||||||
|
|
@ -284,7 +275,7 @@ size_t req_size;
|
||||||
int r, oflags, partial_pipe = 0;
|
int r, oflags, partial_pipe = 0;
|
||||||
size_t size, cum_io, cum_io_incr;
|
size_t size, cum_io, cum_io_incr;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
u64_t position, new_pos;
|
off_t position, new_pos;
|
||||||
|
|
||||||
/* Must make sure we're operating on locked filp and vnode */
|
/* Must make sure we're operating on locked filp and vnode */
|
||||||
assert(tll_locked_by_me(&f->filp_vno->v_lock));
|
assert(tll_locked_by_me(&f->filp_vno->v_lock));
|
||||||
|
|
@ -292,7 +283,7 @@ size_t req_size;
|
||||||
|
|
||||||
oflags = f->filp_flags;
|
oflags = f->filp_flags;
|
||||||
vp = f->filp_vno;
|
vp = f->filp_vno;
|
||||||
position = cvu64(0); /* Not actually used */
|
position = 0; /* Not actually used */
|
||||||
|
|
||||||
/* fp->fp_cum_io_partial is only nonzero when doing partial writes */
|
/* fp->fp_cum_io_partial is only nonzero when doing partial writes */
|
||||||
cum_io = fp->fp_cum_io_partial;
|
cum_io = fp->fp_cum_io_partial;
|
||||||
|
|
@ -321,14 +312,11 @@ size_t req_size;
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex64hi(new_pos))
|
|
||||||
panic("rw_pipe: bad new pos");
|
|
||||||
|
|
||||||
cum_io += cum_io_incr;
|
cum_io += cum_io_incr;
|
||||||
buf += cum_io_incr;
|
buf += cum_io_incr;
|
||||||
req_size -= cum_io_incr;
|
req_size -= cum_io_incr;
|
||||||
|
|
||||||
vp->v_size = ex64lo(new_pos);
|
vp->v_size = new_pos;
|
||||||
|
|
||||||
if (partial_pipe) {
|
if (partial_pipe) {
|
||||||
/* partial write on pipe with */
|
/* partial write on pipe with */
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@ int req_breadwrite(
|
||||||
endpoint_t fs_e,
|
endpoint_t fs_e,
|
||||||
endpoint_t user_e,
|
endpoint_t user_e,
|
||||||
dev_t dev,
|
dev_t dev,
|
||||||
u64_t pos,
|
off_t pos,
|
||||||
unsigned int num_of_bytes,
|
unsigned int num_of_bytes,
|
||||||
vir_bytes user_addr,
|
vir_bytes user_addr,
|
||||||
int rw_flag,
|
int rw_flag,
|
||||||
u64_t *new_posp,
|
off_t *new_pos,
|
||||||
unsigned int *cum_iop
|
unsigned int *cum_iop
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
@ -66,7 +66,7 @@ int req_breadwrite(
|
||||||
if (r != OK) return(r);
|
if (r != OK) return(r);
|
||||||
|
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
*new_posp = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
|
*new_pos = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
|
||||||
*cum_iop = m.RES_NBYTES;
|
*cum_iop = m.RES_NBYTES;
|
||||||
|
|
||||||
return(OK);
|
return(OK);
|
||||||
|
|
@ -148,9 +148,9 @@ int req_create(
|
||||||
cp_grant_id_t grant_id;
|
cp_grant_id_t grant_id;
|
||||||
size_t len;
|
size_t len;
|
||||||
message m;
|
message m;
|
||||||
|
struct vmnt *vmp;
|
||||||
|
|
||||||
if (path[0] == '/')
|
vmp = find_vmnt(fs_e);
|
||||||
panic("req_create: filename starts with '/'");
|
|
||||||
|
|
||||||
len = strlen(path) + 1;
|
len = strlen(path) + 1;
|
||||||
grant_id = cpf_grant_direct(fs_e, (vir_bytes) path, len, CPF_READ);
|
grant_id = cpf_grant_direct(fs_e, (vir_bytes) path, len, CPF_READ);
|
||||||
|
|
@ -175,7 +175,11 @@ int req_create(
|
||||||
res->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = (mode_t) m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
res->fsize = make64(m.RES_FILE_SIZE_LO, m.RES_FILE_SIZE_HI);
|
||||||
|
} else {
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
|
}
|
||||||
res->uid = (uid_t) m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid = (gid_t) m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
res->dev = NO_DEV;
|
res->dev = NO_DEV;
|
||||||
|
|
@ -258,14 +262,33 @@ int req_statvfs(endpoint_t fs_e, endpoint_t proc_e, vir_bytes buf)
|
||||||
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
|
int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
|
||||||
{
|
{
|
||||||
message m;
|
message m;
|
||||||
|
struct vmnt *vmp;
|
||||||
|
|
||||||
|
vmp = find_vmnt(fs_e);
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_FTRUNC;
|
m.m_type = REQ_FTRUNC;
|
||||||
m.REQ_INODE_NR = (pino_t) inode_nr;
|
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||||
m.REQ_TRC_START_LO = start;
|
|
||||||
m.REQ_TRC_START_HI = 0; /* Not used for now, so clear it. */
|
m.REQ_TRC_START_LO = ex64lo(start);
|
||||||
m.REQ_TRC_END_LO = end;
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
m.REQ_TRC_END_HI = 0; /* Not used for now, so clear it. */
|
m.REQ_TRC_START_HI = ex64hi(start);
|
||||||
|
} else if (start > INT_MAX) {
|
||||||
|
/* FS does not support 64-bit off_t and 32 bits is not enough */
|
||||||
|
return EINVAL;
|
||||||
|
} else {
|
||||||
|
m.REQ_TRC_START_HI = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m.REQ_TRC_END_LO = ex64lo(end);
|
||||||
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
m.REQ_TRC_END_HI = ex64hi(end);
|
||||||
|
} else if (end > INT_MAX) {
|
||||||
|
/* FS does not support 64-bit off_t and 32 bits is not enough */
|
||||||
|
return EINVAL;
|
||||||
|
} else {
|
||||||
|
m.REQ_TRC_END_HI = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
return fs_sendrec(fs_e, &m);
|
return fs_sendrec(fs_e, &m);
|
||||||
|
|
@ -278,10 +301,10 @@ int req_ftrunc(endpoint_t fs_e, ino_t inode_nr, off_t start, off_t end)
|
||||||
int req_getdents(
|
int req_getdents(
|
||||||
endpoint_t fs_e,
|
endpoint_t fs_e,
|
||||||
ino_t inode_nr,
|
ino_t inode_nr,
|
||||||
u64_t pos,
|
off_t pos,
|
||||||
char *buf,
|
char *buf,
|
||||||
size_t size,
|
size_t size,
|
||||||
u64_t *new_pos,
|
off_t *new_pos,
|
||||||
int direct,
|
int direct,
|
||||||
int getdents_321 /* Set to 1 if user land expects old format */
|
int getdents_321 /* Set to 1 if user land expects old format */
|
||||||
)
|
)
|
||||||
|
|
@ -352,7 +375,16 @@ int req_getdents(
|
||||||
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_LO = ex64lo(pos);
|
||||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
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 */
|
||||||
|
if (indir_buf_src != NULL) free(indir_buf_src);
|
||||||
|
if (indir_buf_dst != NULL) free(indir_buf_dst);
|
||||||
|
return EINVAL;
|
||||||
|
} else {
|
||||||
|
m.REQ_SEEK_POS_HI = 0;
|
||||||
|
}
|
||||||
|
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
cpf_revoke(grant_id);
|
cpf_revoke(grant_id);
|
||||||
|
|
@ -373,7 +405,11 @@ int req_getdents(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
*new_pos = cvul64(m.RES_SEEK_POS_LO);
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
*new_pos = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
|
||||||
|
} else {
|
||||||
|
*new_pos = m.RES_SEEK_POS_LO;
|
||||||
|
}
|
||||||
r = m.RES_NBYTES;
|
r = m.RES_NBYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -499,12 +535,14 @@ int req_lookup(
|
||||||
struct fproc *rfp
|
struct fproc *rfp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
size_t len;
|
|
||||||
cp_grant_id_t grant_id=0, grant_id2=0;
|
|
||||||
message m;
|
message m;
|
||||||
vfs_ucred_t credentials;
|
vfs_ucred_t credentials;
|
||||||
int flags;
|
int r, flags;
|
||||||
|
size_t len;
|
||||||
|
struct vmnt *vmp;
|
||||||
|
cp_grant_id_t grant_id=0, grant_id2=0;
|
||||||
|
|
||||||
|
vmp = find_vmnt(fs_e);
|
||||||
|
|
||||||
grant_id = cpf_grant_direct(fs_e, (vir_bytes) resolve->l_path, PATH_MAX,
|
grant_id = cpf_grant_direct(fs_e, (vir_bytes) resolve->l_path, PATH_MAX,
|
||||||
CPF_READ | CPF_WRITE);
|
CPF_READ | CPF_WRITE);
|
||||||
|
|
@ -561,7 +599,11 @@ int req_lookup(
|
||||||
case OK:
|
case OK:
|
||||||
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = (mode_t) m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
res->fsize = make64(m.RES_FILE_SIZE_LO, m.RES_FILE_SIZE_HI);
|
||||||
|
} else {
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
|
}
|
||||||
res->dev = m.RES_DEV;
|
res->dev = m.RES_DEV;
|
||||||
res->uid = (uid_t) m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid = (gid_t) m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
|
|
@ -695,9 +737,12 @@ int req_newnode(
|
||||||
struct node_details *res
|
struct node_details *res
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
struct vmnt *vmp;
|
||||||
int r;
|
int r;
|
||||||
message m;
|
message m;
|
||||||
|
|
||||||
|
vmp = find_vmnt(fs_e);
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_NEWNODE;
|
m.m_type = REQ_NEWNODE;
|
||||||
m.REQ_MODE = (pmode_t) dmode;
|
m.REQ_MODE = (pmode_t) dmode;
|
||||||
|
|
@ -711,7 +756,11 @@ int req_newnode(
|
||||||
res->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
res->fmode = (mode_t) m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
res->fsize = make64(m.RES_FILE_SIZE_LO, m.RES_FILE_SIZE_HI);
|
||||||
|
} else {
|
||||||
res->fsize = m.RES_FILE_SIZE_LO;
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
|
}
|
||||||
res->dev = m.RES_DEV;
|
res->dev = m.RES_DEV;
|
||||||
res->uid = (uid_t) m.RES_UID;
|
res->uid = (uid_t) m.RES_UID;
|
||||||
res->gid = (gid_t) m.RES_GID;
|
res->gid = (gid_t) m.RES_GID;
|
||||||
|
|
@ -823,7 +872,7 @@ int req_readsuper(
|
||||||
dev_t dev,
|
dev_t dev,
|
||||||
int readonly,
|
int readonly,
|
||||||
int isroot,
|
int isroot,
|
||||||
struct node_details *res_nodep
|
struct node_details *res
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
@ -857,13 +906,17 @@ int req_readsuper(
|
||||||
|
|
||||||
if(r == OK) {
|
if(r == OK) {
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
res_nodep->fs_e = m.m_source;
|
res->fs_e = m.m_source;
|
||||||
res_nodep->inode_nr = (ino_t) m.RES_INODE_NR;
|
res->inode_nr = (ino_t) m.RES_INODE_NR;
|
||||||
vmp->m_proto = m.RES_PROTO;
|
vmp->m_proto = m.RES_PROTO;
|
||||||
res_nodep->fmode = (mode_t) m.RES_MODE;
|
res->fmode = (mode_t) m.RES_MODE;
|
||||||
res_nodep->fsize = m.RES_FILE_SIZE_LO;
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
res_nodep->uid = (uid_t) m.RES_UID;
|
res->fsize = make64(m.RES_FILE_SIZE_LO, m.RES_FILE_SIZE_HI);
|
||||||
res_nodep->gid = (gid_t) m.RES_GID;
|
} else {
|
||||||
|
res->fsize = m.RES_FILE_SIZE_LO;
|
||||||
|
}
|
||||||
|
res->uid = (uid_t) m.RES_UID;
|
||||||
|
res->gid = (gid_t) m.RES_GID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|
@ -873,18 +926,18 @@ int req_readsuper(
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* req_readwrite *
|
* req_readwrite *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
int req_readwrite(fs_e, inode_nr, pos, rw_flag, user_e,
|
int req_readwrite(
|
||||||
user_addr, num_of_bytes, new_posp, cum_iop)
|
endpoint_t fs_e,
|
||||||
endpoint_t fs_e;
|
ino_t inode_nr,
|
||||||
ino_t inode_nr;
|
off_t pos,
|
||||||
u64_t pos;
|
int rw_flag,
|
||||||
int rw_flag;
|
endpoint_t user_e,
|
||||||
endpoint_t user_e;
|
vir_bytes user_addr,
|
||||||
vir_bytes user_addr;
|
unsigned int num_of_bytes,
|
||||||
unsigned int num_of_bytes;
|
off_t *new_posp,
|
||||||
u64_t *new_posp;
|
unsigned int *cum_iop)
|
||||||
unsigned int *cum_iop;
|
|
||||||
{
|
{
|
||||||
|
struct vmnt *vmp;
|
||||||
int r;
|
int r;
|
||||||
cp_grant_id_t grant_id = -1;
|
cp_grant_id_t grant_id = -1;
|
||||||
message m;
|
message m;
|
||||||
|
|
@ -897,9 +950,7 @@ unsigned int *cum_iop;
|
||||||
* PEEKING: do i/o in FS, just get the blocks into the cache, no copy
|
* PEEKING: do i/o in FS, just get the blocks into the cache, no copy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (ex64hi(pos) != 0)
|
vmp = find_vmnt(fs_e);
|
||||||
panic("req_readwrite: pos too large");
|
|
||||||
|
|
||||||
assert(rw_flag == READING || rw_flag == WRITING || rw_flag == PEEKING);
|
assert(rw_flag == READING || rw_flag == WRITING || rw_flag == PEEKING);
|
||||||
|
|
||||||
switch(rw_flag) {
|
switch(rw_flag) {
|
||||||
|
|
@ -926,7 +977,13 @@ unsigned int *cum_iop;
|
||||||
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_LO = ex64lo(pos);
|
||||||
m.REQ_SEEK_POS_HI = 0; /* Not used for now, so clear it. */
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
m.REQ_SEEK_POS_HI = ex64hi(pos);
|
||||||
|
} else if (pos > INT_MAX) {
|
||||||
|
return EINVAL;
|
||||||
|
} else {
|
||||||
|
m.REQ_SEEK_POS_HI = 0;
|
||||||
|
}
|
||||||
m.REQ_NBYTES = num_of_bytes;
|
m.REQ_NBYTES = num_of_bytes;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
|
|
@ -935,7 +992,11 @@ unsigned int *cum_iop;
|
||||||
|
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
/* Fill in response structure */
|
/* Fill in response structure */
|
||||||
*new_posp = cvul64(m.RES_SEEK_POS_LO);
|
if (VFS_FS_PROTO_BIGOFFT(vmp->m_proto)) {
|
||||||
|
*new_posp = make64(m.RES_SEEK_POS_LO, m.RES_SEEK_POS_HI);
|
||||||
|
} else {
|
||||||
|
*new_posp = m.RES_SEEK_POS_LO;
|
||||||
|
}
|
||||||
*cum_iop = m.RES_NBYTES;
|
*cum_iop = m.RES_NBYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -382,8 +382,7 @@ static int select_request_async(struct filp *f, int *ops, int block)
|
||||||
return(SUSPEND);
|
return(SUSPEND);
|
||||||
|
|
||||||
f->filp_select_flags &= ~FSF_UPDATE;
|
f->filp_select_flags &= ~FSF_UPDATE;
|
||||||
r = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL,
|
r = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL, 0, 0, 0, FALSE);
|
||||||
cvu64(0), 0, 0, FALSE);
|
|
||||||
if (r < 0 && r != SUSPEND)
|
if (r < 0 && r != SUSPEND)
|
||||||
return(r);
|
return(r);
|
||||||
|
|
||||||
|
|
@ -434,8 +433,7 @@ static int select_request_sync(struct filp *f, int *ops, int block)
|
||||||
|
|
||||||
rops = *ops;
|
rops = *ops;
|
||||||
if (block) rops |= SEL_NOTIFY;
|
if (block) rops |= SEL_NOTIFY;
|
||||||
*ops = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL,
|
*ops = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL, 0, 0, 0,FALSE);
|
||||||
cvu64(0), 0, 0, FALSE);
|
|
||||||
if (*ops < 0)
|
if (*ops < 0)
|
||||||
return(*ops);
|
return(*ops);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ int (*call_vec[])(void) = {
|
||||||
no_sys, /* 78 = (sysuname) */
|
no_sys, /* 78 = (sysuname) */
|
||||||
no_sys, /* 79 = unused */
|
no_sys, /* 79 = unused */
|
||||||
do_getdents, /* 80 = getdents_321 (to be phased out) */
|
do_getdents, /* 80 = getdents_321 (to be phased out) */
|
||||||
do_llseek, /* 81 = llseek */
|
do_lseek, /* 81 = llseek */
|
||||||
do_fstatfs, /* 82 = fstatfs */
|
do_fstatfs, /* 82 = fstatfs */
|
||||||
do_statvfs, /* 83 = fstatvfs */
|
do_statvfs, /* 83 = fstatvfs */
|
||||||
do_fstatvfs, /* 84 = statvfs */
|
do_fstatvfs, /* 84 = statvfs */
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ EXTERN struct vnode {
|
||||||
int v_ref_count; /* # times vnode used; 0 means slot is free */
|
int v_ref_count; /* # times vnode used; 0 means slot is free */
|
||||||
int v_fs_count; /* # reference at the underlying FS */
|
int v_fs_count; /* # reference at the underlying FS */
|
||||||
int v_mapfs_count; /* # reference at the underlying mapped FS */
|
int v_mapfs_count; /* # reference at the underlying mapped FS */
|
||||||
#if 0
|
|
||||||
int v_ref_check; /* for consistency checks */
|
|
||||||
#endif
|
|
||||||
endpoint_t v_bfs_e; /* endpoint number for the FS proces in case
|
endpoint_t v_bfs_e; /* endpoint number for the FS proces in case
|
||||||
of a block special file */
|
of a block special file */
|
||||||
dev_t v_dev; /* device number on which the corresponding
|
dev_t v_dev; /* device number on which the corresponding
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user