Pass off_t over the hypercall interface as int64_t to avoid potential

problems in setups where off_t doesn't want to be 64bit.

I'm already excitedly waiting for 128bit off_t and _LARGE_LARGE_FILES
This commit is contained in:
pooka 2013-05-15 14:58:24 +00:00
parent 15dc8bf975
commit 601de6b09f
4 changed files with 17 additions and 15 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rumpuser.3,v 1.11 2013/05/15 14:52:49 pooka Exp $
.\" $NetBSD: rumpuser.3,v 1.12 2013/05/15 14:58:24 pooka Exp $
.\"
.\" Copyright (c) 2013 Antti Kantee. All rights reserved.
.\"
@ -197,7 +197,7 @@ respectively.
.Pp
.Ft void
.Fo rumpuser_bio
.Fa "int fd" "int op" "void *data" "size_t dlen" "off_t off"
.Fa "int fd" "int op" "void *data" "size_t dlen" "int64_t off"
.Fa "rump_biodone_fn biodone" "void *donearg"
.Fc
.Pp
@ -238,13 +238,13 @@ opaque arg that must be passed to
.Ft int
.Fo rumpuser_iovread
.Fa "int fd" "struct rumpuser_iovec *ruiov" "size_t iovlen"
.Fa "off_t off" "size_t *retv"
.Fa "int64_t off" "size_t *retv"
.Fc
.Pp
.Ft int
.Fo rumpuser_iovwrite
.Fa "int fd" "struct rumpuser_iovec *ruiov" "size_t iovlen"
.Fa "off_t off" "size_t *retv"
.Fa "int64_t off" "size_t *retv"
.Fc
.Pp
These routines perform scatter-gather I/O which is not

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.c,v 1.51 2013/05/15 14:52:49 pooka Exp $ */
/* $NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
__RCSID("$NetBSD: rumpuser.c,v 1.51 2013/05/15 14:52:49 pooka Exp $");
__RCSID("$NetBSD: rumpuser.c,v 1.52 2013/05/15 14:58:24 pooka Exp $");
#endif /* !lint */
#include <sys/ioctl.h>
@ -332,9 +332,10 @@ rumpuser_close(int fd)
*/
int
rumpuser_iovread(int fd, struct rumpuser_iovec *ruiov, size_t iovlen,
off_t off, size_t *retp)
int64_t roff, size_t *retp)
{
struct iovec *iov = (struct iovec *)ruiov;
off_t off = (off_t)roff;
ssize_t nn;
int rv;
@ -364,9 +365,10 @@ rumpuser_iovread(int fd, struct rumpuser_iovec *ruiov, size_t iovlen,
int
rumpuser_iovwrite(int fd, const struct rumpuser_iovec *ruiov, size_t iovlen,
off_t off, size_t *retp)
int64_t roff, size_t *retp)
{
const struct iovec *iov = (const struct iovec *)ruiov;
off_t off = (off_t)roff;
ssize_t nn;
int rv;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser_bio.c,v 1.6 2013/05/07 15:18:35 pooka Exp $ */
/* $NetBSD: rumpuser_bio.c,v 1.7 2013/05/15 14:58:24 pooka Exp $ */
/*-
* Copyright (c) 2013 Antti Kantee. All Rights Reserved.
@ -127,7 +127,7 @@ biothread(void *arg)
}
void
rumpuser_bio(int fd, int op, void *data, size_t dlen, off_t doff,
rumpuser_bio(int fd, int op, void *data, size_t dlen, int64_t doff,
rump_biodone_fn biodone, void *bioarg)
{
struct rumpuser_bio bio;
@ -163,7 +163,7 @@ rumpuser_bio(int fd, int op, void *data, size_t dlen, off_t doff,
bio.bio_op = op;
bio.bio_data = data;
bio.bio_dlen = dlen;
bio.bio_off = doff;
bio.bio_off = (off_t)doff;
bio.bio_done = biodone;
bio.bio_donearg = bioarg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.h,v 1.105 2013/05/15 14:52:49 pooka Exp $ */
/* $NetBSD: rumpuser.h,v 1.106 2013/05/15 14:58:24 pooka Exp $ */
/*
* Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved.
@ -97,7 +97,7 @@ int rumpuser_getfileinfo(const char *, uint64_t *, int *);
#define RUMPUSER_BIO_WRITE 0x02
#define RUMPUSER_BIO_SYNC 0x04
typedef void (*rump_biodone_fn)(void *, size_t, int);
void rumpuser_bio(int, int, void *, size_t, off_t, rump_biodone_fn, void *);
void rumpuser_bio(int, int, void *, size_t, int64_t, rump_biodone_fn, void *);
/* this one "accidentally" matches the NetBSD kernel ... */
struct rumpuser_iovec {
@ -105,9 +105,9 @@ struct rumpuser_iovec {
size_t iov_len;
};
#define RUMPUSER_IOV_NOSEEK -1
int rumpuser_iovread(int, struct rumpuser_iovec *, size_t, off_t, size_t *);
int rumpuser_iovread(int, struct rumpuser_iovec *, size_t, int64_t, size_t *);
int rumpuser_iovwrite(int, const struct rumpuser_iovec *, size_t,
off_t, size_t *);
int64_t, size_t *);
/*
* clock and zzz