--- kernel/iscsi.c.orig 2013-01-25 12:58:06.191784106 -0800 +++ kernel/iscsi.c 2013-01-25 12:58:45.785782759 -0800 @@ -1963,7 +1963,7 @@ return ctr_major; } #else - ietdev = make_dev(&iet_csw, 0, UID_ROOT, GID_WHEEL, 0550, ctr_name); + ietdev = make_dev(&iet_csw, 0, UID_ROOT, GID_WHEEL, 0550, "%s", ctr_name); #endif #ifdef LINUX --- kernel/block-io.c.orig 2013-01-25 12:58:06.194781035 -0800 +++ kernel/block-io.c 2013-01-25 12:58:45.786780433 -0800 @@ -260,7 +260,9 @@ int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE); int vaccess; int error; +#if defined(NDHASGIANT) int vfslocked; +#endif struct vnode *devvp = NULL; struct g_provider *pp; struct g_geom *gp; @@ -270,13 +272,19 @@ if (!bio_data->path) return -(ENOMEM); +#if defined(MPSAFE) NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, path, curthread); +#else + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, path, curthread); +#endif error = vn_open(&nd, &flags, 0, NULL); if (error) { eprintk("failed to open disk %s error %d\n", path, error); return -(error); } +#if defined(NDHASGIANT) vfslocked = NDHASGIANT(&nd); +#endif NDFREE(&nd, NDF_ONLY_PNBUF); devvp = nd.ni_vp; @@ -321,7 +329,9 @@ g_topology_unlock(); bio_data->bdev = devvp; VOP_UNLOCK(devvp, 0); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return 0; gcleanup: /* On geom errors */ @@ -331,7 +341,9 @@ failed: VOP_UNLOCK(devvp, 0); (void)vn_close(devvp, flags, curthread->td_ucred, curthread); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return -(error); } #endif @@ -439,11 +451,15 @@ } if (bio_data->bdev) { +#if defined(NDHASGIANT) int vfslocked; vfslocked = VFS_LOCK_GIANT(bio_data->bdev->v_mount); +#endif (void)vn_close(bio_data->bdev, flags, curthread->td_ucred, curthread); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif } if (bio_data->path) --- kernel/file-io.c.orig 2013-01-25 12:58:06.197782092 -0800 +++ kernel/file-io.c 2013-01-25 13:01:32.708794758 -0800 @@ -24,8 +24,15 @@ struct file *filp; #else struct vnode *vp; +#if defined(NDHASGIANT) int vfslocked; - int error, aresid; +#endif + int error; +#if ((__FreeBSD_version < 1000000 && __FreeBSD_version >= 900506) || (__FreeBSD_version >= 1000009)) + ssize_t aresid; +#else + int aresid; +#endif #endif struct fileio_data *p = lu->private; page_t *page; @@ -40,8 +47,10 @@ filp = p->filp; #else vp = p->filevp; +#if defined(NDHASGIANT) vfslocked = VFS_LOCK_GIANT(vp->v_mount); #endif +#endif size = tio->size; offset= tio->offset; @@ -87,8 +96,10 @@ } assert(!size); #ifdef FREEBSD +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); #endif +#endif return err; } @@ -149,12 +160,17 @@ static int fileio_sync(struct iet_volume *lu, struct tio *tio) { struct fileio_data *p = lu->private; - int vfslocked, error; +#if defined(NDHASGIANT) + int vfslocked; +#endif + int error; struct vnode *vp; struct mount *mp; vp = p->filevp; +#if defined(NDHASGIANT) vfslocked = VFS_LOCK_GIANT(vp->v_mount); +#endif if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) goto drop; @@ -163,7 +179,9 @@ VOP_UNLOCK(vp, 0); vn_finished_write(mp); drop: +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return error; } @@ -174,16 +192,25 @@ struct nameidata nd; struct vnode *filevp; struct vattr vattr; +#if defined(NDHASGIANT) int vfslocked; +#endif int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE); info->path = kstrdup(path, GFP_KERNEL); if (!info->path) return -ENOMEM; +#if defined(NDHASGIANT) NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, path, curthread); +#else + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, path, curthread); +#endif error = namei(&nd); +#if defined(NDHASGIANT) vfslocked = NDHASGIANT(&nd); +#else +#endif if (error) { eprintk("lookup failed for %s err %d\n", path, error); return -(error); @@ -193,7 +220,9 @@ if (filevp->v_type != VREG) { eprintk("path %s not a regular file\n", path); NDFREE(&nd, 0); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return -(EINVAL); } @@ -201,7 +230,9 @@ if (error != 0) { eprintk("failed to open path %s err %d\n", path, error); NDFREE(&nd, 0); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return -(error); } NDFREE(&nd, NDF_ONLY_PNBUF); @@ -212,7 +243,9 @@ VOP_UNLOCK(filevp, 0); (void)vn_close(filevp, flags, curthread->td_ucred, curthread); vrele(filevp); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif return -(error); } @@ -300,12 +333,16 @@ #else if (p->filevp) { int flags = FMODE_READ | (LUReadonly(lu) ? 0 : FMODE_WRITE); +#if defined(NDHASGIANT) int vfslocked; vfslocked = VFS_LOCK_GIANT(p->filevp->v_mount); +#endif vn_close(p->filevp, flags, curthread->td_ucred, curthread); vrele(p->filevp); +#if defined(NDHASGIANT) VFS_UNLOCK_GIANT(vfslocked); +#endif } #endif kfree(p); --- kernel/ietbsd.h.orig 2013-06-18 20:31:28.000000000 -0400 +++ kernel/ietbsd.h 2013-06-18 20:38:05.000000000 -0400 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include --- usr/bsddefs.h.orig 2013-06-18 20:39:09.000000000 -0400 +++ usr/bsddefs.h 2013-06-18 22:23:09.000000000 -0400 @@ -1,6 +1,8 @@ #ifndef BSDDEFS_H_ #define BSDDEFS_H_ 1 +#include + #define SOL_TCP IPPROTO_TCP #define TCP_CORK TCP_NOPUSH @@ -8,6 +10,7 @@ #define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr32 __u6_addr.__u6_addr32 +#if __FreeBSD_version < 1000028 static inline char * strchrnul (const char *s, int c_in) { @@ -17,5 +20,6 @@ return (char *) s; } +#endif #endif