In FreeBSD,

- cv_timedwait() takes delta instead of absolute time,
- we need ioctl() for mediasize.

Reviewed by: pjd
This commit is contained in:
Hidetoshi Shimokawa 2007-04-14 14:39:38 +00:00
parent b79aefd3e9
commit 01498c0b83
4 changed files with 12 additions and 4 deletions

View File

@ -291,7 +291,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
ASSERT(abstime > 0);
top:
delta = abstime - lbolt;
delta = abstime;
if (delta <= 0)
return (-1);
@ -413,7 +413,10 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
*vpp = vp = umem_zalloc(sizeof (vnode_t), UMEM_NOFAIL);
vp->v_fd = fd;
vp->v_size = st.st_size;
if (S_ISCHR(st.st_mode))
ioctl(fd, DIOCGMEDIASIZE, &vp->v_size);
else
vp->v_size = st.st_size;
vp->v_path = spa_strdup(path);
return (0);

View File

@ -80,6 +80,7 @@ extern "C" {
#include <sys/sdt.h>
#include <sys/kstat.h>
#include <sys/kernel.h>
#include <sys/disk.h>
#include <machine/atomic.h>
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"

View File

@ -291,7 +291,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime)
ASSERT(abstime > 0);
top:
delta = abstime - lbolt;
delta = abstime;
if (delta <= 0)
return (-1);
@ -413,7 +413,10 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
*vpp = vp = umem_zalloc(sizeof (vnode_t), UMEM_NOFAIL);
vp->v_fd = fd;
vp->v_size = st.st_size;
if (S_ISCHR(st.st_mode))
ioctl(fd, DIOCGMEDIASIZE, &vp->v_size);
else
vp->v_size = st.st_size;
vp->v_path = spa_strdup(path);
return (0);

View File

@ -80,6 +80,7 @@ extern "C" {
#include <sys/sdt.h>
#include <sys/kstat.h>
#include <sys/kernel.h>
#include <sys/disk.h>
#include <machine/atomic.h>
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"