* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
-static ioctl_fcn_t vnioctl_chr;
-static ioctl_fcn_t vnioctl_blk;
-static open_close_fcn_t vnopen;
-static open_close_fcn_t vnclose;
-static psize_fcn_t vnsize;
-static strategy_fcn_t vnstrategy;
-static read_write_fcn_t vnread;
-static read_write_fcn_t vnwrite;
+static ioctl_fcn_t vnioctl_chr;
+static ioctl_fcn_t vnioctl_blk;
+static open_close_fcn_t vnopen;
+static open_close_fcn_t vnclose;
+static psize_fcn_t vnsize;
+static strategy_fcn_t vnstrategy;
+static read_write_fcn_t vnread;
+static read_write_fcn_t vnwrite;
-static struct bdevsw vn_bdevsw = {
- /* open */ vnopen,
- /* close */ vnclose,
- /* strategy */ vnstrategy,
- /* ioctl */ vnioctl_blk,
- /* dump */ eno_dump,
- /* psize */ vnsize,
- /* flags */ D_DISK,
+static const struct bdevsw vn_bdevsw = {
+ .d_open = vnopen,
+ .d_close = vnclose,
+ .d_strategy = vnstrategy,
+ .d_ioctl = vnioctl_blk,
+ .d_dump = eno_dump,
+ .d_psize = vnsize,
+ .d_type = D_DISK,
-static struct cdevsw vn_cdevsw = {
- /* open */ vnopen,
- /* close */ vnclose,
- /* read */ vnread,
- /* write */ vnwrite,
- /* ioctl */ vnioctl_chr,
- /* stop */ eno_stop,
- /* reset */ eno_reset,
- /* ttys */ NULL,
- /* select */ eno_select,
- /* mmap */ eno_mmap,
- /* strategy */ eno_strat,
- /* getc */ eno_getc,
- /* putc */ eno_putc,
- /* flags */ D_DISK,
+static const struct cdevsw vn_cdevsw = {
+ .d_open = vnopen,
+ .d_close = vnclose,
+ .d_read = vnread,
+ .d_write = vnwrite,
+ .d_ioctl = vnioctl_chr,
+ .d_stop = eno_stop,
+ .d_reset = eno_reset,
+ .d_ttys = NULL,
+ .d_select = eno_select,
+ .d_mmap = eno_mmap,
+ .d_strategy = eno_strat,
+ .d_reserved_1 = eno_getc,
+ .d_reserved_2 = eno_putc,
+ .d_type = D_DISK,
- u_int64_t sc_fsize; /* file size in bytes */
- u_int64_t sc_size; /* size of vn, sc_secsize scale */
- int sc_flags; /* flags */
- u_int32_t sc_secsize; /* sector size */
- struct vnode *sc_vp; /* vnode if not NULL */
- uint32_t sc_vid;
- int sc_open_flags;
- struct vnode *sc_shadow_vp; /* shadow vnode if not NULL */
- uint32_t sc_shadow_vid;
- shadow_map_t * sc_shadow_map; /* shadow map if not NULL */
- kauth_cred_t sc_cred; /* credentials */
- u_int32_t sc_options; /* options */
- void * sc_bdev;
- void * sc_cdev;
+ u_int64_t sc_fsize; /* file size in bytes */
+ u_int64_t sc_size; /* size of vn, sc_secsize scale */
+ int sc_flags; /* flags */
+ u_int32_t sc_secsize; /* sector size */
+ struct vnode *sc_vp; /* vnode if not NULL */
+ uint32_t sc_vid;
+ int sc_open_flags;
+ struct vnode *sc_shadow_vp; /* shadow vnode if not NULL */
+ uint32_t sc_shadow_vid;
+ shadow_map_t * sc_shadow_map; /* shadow map if not NULL */
+ kauth_cred_t sc_cred; /* credentials */
+ u_int32_t sc_options; /* options */
+ void * sc_bdev;
+ void * sc_cdev;
-#define IFOPT(vn,opt) if (((vn)->sc_options|vn_options) & (opt))
-#define TESTOPT(vn,opt) (((vn)->sc_options|vn_options) & (opt))
+#define IFOPT(vn, opt) if (((vn)->sc_options|vn_options) & (opt))
+#define TESTOPT(vn, opt) (((vn)->sc_options|vn_options) & (opt))
-static int setcred(struct vnode * vp, kauth_cred_t cred);
-static void vnclear (struct vn_softc *vn, vfs_context_t ctx);
+static int setcred(struct vnode * vp, kauth_cred_t cred);
+static void vnclear(struct vn_softc *vn, vfs_context_t ctx);
static void vn_ioctl_to_64(struct vn_ioctl_32 *from, struct vn_ioctl_64 *to);
void vndevice_init(void);
int vndevice_root_image(char * path, char devname[], dev_t * dev_p);
static int
vniocattach_file(struct vn_softc *vn,
static void vn_ioctl_to_64(struct vn_ioctl_32 *from, struct vn_ioctl_64 *to);
void vndevice_init(void);
int vndevice_root_image(char * path, char devname[], dev_t * dev_p);
static int
vniocattach_file(struct vn_softc *vn,
-static int
-vnclose(__unused dev_t dev, __unused int flags,
- __unused int devtype, __unused proc_t p)
+static int
+vnclose(__unused dev_t dev, __unused int flags,
+ __unused int devtype, __unused proc_t p)
vnopen(dev_t dev, int flags, __unused int devtype, __unused proc_t p)
{
struct vn_softc *vn;
vnopen(dev_t dev, int flags, __unused int devtype, __unused proc_t p)
{
struct vn_softc *vn;
-file_io(struct vnode * vp, vfs_context_t ctx,
- enum uio_rw op, char * base, off_t offset, user_ssize_t count,
- user_ssize_t * resid)
+file_io(struct vnode * vp, vfs_context_t ctx,
+ enum uio_rw op, char * base, off_t offset, user_ssize_t count,
+ user_ssize_t * resid)
- uio_t auio;
- int error;
- char uio_buf[UIO_SIZEOF(1)];
-
- auio = uio_createwithbuffer(1, offset, UIO_SYSSPACE, op,
- &uio_buf[0], sizeof(uio_buf));
+ uio_t auio;
+ int error;
+ char uio_buf[UIO_SIZEOF(1)];
+
+ auio = uio_createwithbuffer(1, offset, UIO_SYSSPACE, op,
+ &uio_buf[0], sizeof(uio_buf));
error = VNOP_READ(vp, auio, IO_SYNC, ctx);
error = VNOP_READ(vp, auio, IO_SYNC, ctx);
error = VNOP_WRITE(vp, auio, IO_SYNC, ctx);
error = VNOP_WRITE(vp, auio, IO_SYNC, ctx);
-vnread_shadow(struct vn_softc * vn, struct uio *uio, int ioflag,
- vfs_context_t ctx)
+vnread_shadow(struct vn_softc * vn, struct uio *uio, int ioflag,
+ vfs_context_t ctx)
- u_int32_t remainder;
- u_int32_t this_block_number;
- u_int32_t this_block_count;
- off_t this_offset;
- user_ssize_t this_resid;
- struct vnode * vp;
+ u_int32_t remainder;
+ off_t this_block_number;
+ size_t this_block_count;
+ off_t this_offset;
+ user_ssize_t this_resid;
+ struct vnode * vp;
/* figure out which blocks to read */
remainder = block_remainder(offset, blocksize);
if (shadow_map_read(vn->sc_shadow_map,
/* figure out which blocks to read */
remainder = block_remainder(offset, blocksize);
if (shadow_map_read(vn->sc_shadow_map,
- block_truncate(offset, blocksize),
- block_round(resid + remainder, blocksize),
- &this_block_number, &this_block_count)) {
+ block_truncate(offset, blocksize),
+ block_round(resid + remainder, blocksize),
+ &this_block_number, &this_block_count)) {
uio_setoffset(uio, this_offset);
this_resid = this_block_count * blocksize - remainder;
if (this_resid > resid) {
uio_setoffset(uio, this_offset);
this_resid = this_block_count * blocksize - remainder;
if (this_resid > resid) {
}
uio_setresid(uio, resid);
uio_setoffset(uio, offset);
}
uio_setresid(uio, resid);
uio_setoffset(uio, offset);
}
/* read one block from file at file_block offset */
error = file_io(vn->sc_vp, ctx, UIO_READ,
}
/* read one block from file at file_block offset */
error = file_io(vn->sc_vp, ctx, UIO_READ,
if (error) {
goto done;
}
/* write one block to shadow file at shadow_block offset */
error = file_io(vn->sc_shadow_vp, ctx, UIO_WRITE,
if (error) {
goto done;
}
/* write one block to shadow file at shadow_block offset */
error = file_io(vn->sc_shadow_vp, ctx, UIO_WRITE,
-vnwrite_shadow(struct vn_softc * vn, struct uio *uio, int ioflag,
- vfs_context_t ctx)
+vnwrite_shadow(struct vn_softc * vn, struct uio *uio, int ioflag,
+ vfs_context_t ctx)
- int flags = 0;
- u_int32_t offset_block_number;
- u_int32_t remainder;
- u_int32_t resid_block_count;
- u_int32_t shadow_block_count;
- u_int32_t shadow_block_number;
- user_ssize_t this_resid;
+ int flags = 0;
+ off_t offset_block_number;
+ u_int32_t remainder;
+ size_t resid_block_count;
+ size_t shadow_block_count;
+ off_t shadow_block_number;
+ user_ssize_t this_resid;
/* figure out which blocks to write */
offset_block_number = block_truncate(offset, blocksize);
/* figure out which blocks to write */
offset_block_number = block_truncate(offset, blocksize);
/* figure out if the first or last blocks are partial writes */
if (remainder > 0
&& !shadow_map_is_written(vn->sc_shadow_map,
/* figure out if the first or last blocks are partial writes */
if (remainder > 0
&& !shadow_map_is_written(vn->sc_shadow_map,
/* the first block is a partial write */
flags |= FLAGS_FIRST_BLOCK_PARTIAL;
}
if (resid_block_count > 1
&& !shadow_map_is_written(vn->sc_shadow_map,
/* the first block is a partial write */
flags |= FLAGS_FIRST_BLOCK_PARTIAL;
}
if (resid_block_count > 1
&& !shadow_map_is_written(vn->sc_shadow_map,
&& block_remainder(offset + resid, blocksize) > 0) {
/* the last block is a partial write */
flags |= FLAGS_LAST_BLOCK_PARTIAL;
}
if (shadow_map_write(vn->sc_shadow_map,
&& block_remainder(offset + resid, blocksize) > 0) {
/* the last block is a partial write */
flags |= FLAGS_LAST_BLOCK_PARTIAL;
}
if (shadow_map_write(vn->sc_shadow_map,
- offset_block_number, resid_block_count,
- &shadow_block_number,
- &shadow_block_count)) {
+ offset_block_number, resid_block_count,
+ &shadow_block_number,
+ &shadow_block_count)) {
vnode_setsize(vn->sc_shadow_vp, size, IO_SYNC, ctx);
#endif
}
/* write the blocks (or parts thereof) */
vnode_setsize(vn->sc_shadow_vp, size, IO_SYNC, ctx);
#endif
}
/* write the blocks (or parts thereof) */
- uio_setoffset(uio, (off_t)
- shadow_block_number * blocksize + remainder);
- this_resid = (off_t)shadow_block_count * blocksize - remainder;
+ uio_setoffset(uio, shadow_block_number * blocksize + remainder);
+ this_resid = shadow_block_count * blocksize - remainder;
if (this_resid >= resid) {
this_resid = resid;
if ((flags & FLAGS_LAST_BLOCK_PARTIAL) != 0) {
/* copy the last block to the shadow */
if (this_resid >= resid) {
this_resid = resid;
if ((flags & FLAGS_LAST_BLOCK_PARTIAL) != 0) {
/* copy the last block to the shadow */
- s = offset_block_number
- + resid_block_count - 1;
- d = shadow_block_number
- + shadow_block_count - 1;
+ s = offset_block_number
+ + resid_block_count - 1;
+ d = shadow_block_number
+ + shadow_block_count - 1;
error = vncopy_block_to_shadow(vn, ctx, s, d);
if (error) {
printf("vnwrite_shadow: failed to copy"
error = vncopy_block_to_shadow(vn, ctx, s, d);
if (error) {
printf("vnwrite_shadow: failed to copy"
if ((flags & FLAGS_FIRST_BLOCK_PARTIAL) != 0) {
/* copy the first block to the shadow */
error = vncopy_block_to_shadow(vn, ctx,
if ((flags & FLAGS_FIRST_BLOCK_PARTIAL) != 0) {
/* copy the first block to the shadow */
error = vncopy_block_to_shadow(vn, ctx,
}
uio_setresid(uio, resid);
uio_setoffset(uio, offset);
}
uio_setresid(uio, resid);
uio_setoffset(uio, offset);
if (vn->sc_shadow_vp != NULL) {
error = vnode_getwithvid(vn->sc_shadow_vp,
if (vn->sc_shadow_vp != NULL) {
error = vnode_getwithvid(vn->sc_shadow_vp,
error = VNOP_READ(vn->sc_vp, uio, ioflag, &context);
}
vnode_put(vn->sc_vp);
error = VNOP_READ(vn->sc_vp, uio, ioflag, &context);
}
vnode_put(vn->sc_vp);
if (vn->sc_shadow_vp != NULL) {
error = vnode_getwithvid(vn->sc_shadow_vp,
if (vn->sc_shadow_vp != NULL) {
error = vnode_getwithvid(vn->sc_shadow_vp,
error = VNOP_WRITE(vn->sc_vp, uio, ioflag, &context);
}
vnode_put(vn->sc_vp);
error = VNOP_WRITE(vn->sc_vp, uio, ioflag, &context);
}
vnode_put(vn->sc_vp);
}
static int
shadow_read(struct vn_softc * vn, struct buf * bp, char * base,
}
static int
shadow_read(struct vn_softc * vn, struct buf * bp, char * base,
vp = vn->sc_vp;
}
error = file_io(vp, ctx, UIO_READ, base + start,
vp = vn->sc_vp;
}
error = file_io(vp, ctx, UIO_READ, base + start,
- (off_t)this_offset * blocksize,
- (user_ssize_t)this_resid * blocksize,
- &temp_resid);
+ this_offset * blocksize,
+ (user_ssize_t)this_resid * blocksize,
+ &temp_resid);
-shadow_write(struct vn_softc * vn, struct buf * bp, char * base,
- vfs_context_t ctx)
+shadow_write(struct vn_softc * vn, struct buf * bp, char * base,
+ vfs_context_t ctx)
- shadow_grew = shadow_map_write(vn->sc_shadow_map,
- offset, resid,
- &this_offset, &this_resid);
+ shadow_grew = shadow_map_write(vn->sc_shadow_map,
+ offset, resid,
+ &this_offset, &this_resid);
vnode_setsize(vn->sc_shadow_vp, size, IO_SYNC, ctx);
#endif
}
vnode_setsize(vn->sc_shadow_vp, size, IO_SYNC, ctx);
#endif
}
- error = file_io(vn->sc_shadow_vp, ctx, UIO_WRITE,
- base + start,
- (off_t)this_offset * blocksize,
- (user_ssize_t)this_resid * blocksize,
- &temp_resid);
+ error = file_io(vn->sc_shadow_vp, ctx, UIO_WRITE,
+ base + start,
+ this_offset * blocksize,
+ (user_ssize_t)this_resid * blocksize,
+ &temp_resid);
- if (buf_map(bp, &vaddr))
- panic("vn device: buf_map failed");
+ if (buf_map(bp, &vaddr)) {
+ panic("vn device: buf_map failed");
+ }
- buf_flags(bp) & B_READ ? UIO_READ : UIO_WRITE,
- iov_base,
- (off_t)buf_blkno(bp) * vn->sc_secsize,
- buf_resid(bp), &temp_resid);
- buf_setresid(bp, temp_resid);
- }
- else {
- if (buf_flags(bp) & B_READ)
+ buf_flags(bp) & B_READ ? UIO_READ : UIO_WRITE,
+ iov_base,
+ (off_t)buf_blkno(bp) * vn->sc_secsize,
+ buf_resid(bp), &temp_resid);
+ buf_setresid(bp, (uint32_t)temp_resid);
+ } else {
+ if (buf_flags(bp) & B_READ) {
error = shadow_read(vn, bp, iov_base, ctx);
error = shadow_read(vn, bp, iov_base, ctx);
error = shadow_write(vn, bp, iov_base, ctx);
error = shadow_write(vn, bp, iov_base, ctx);
- boolean_t funnel_state;
- struct vnode * shadow_vp = NULL;
- struct vnode * vp = NULL;
- struct vfs_context context;
+ struct vnode * shadow_vp = NULL;
+ struct vnode * vp = NULL;
+ struct vfs_context context;
* If the request crosses EOF, truncate the request.
*/
if ((blk_num + sz) > 0 && ((u_int64_t)(blk_num + sz)) > vn->sc_size) {
* If the request crosses EOF, truncate the request.
*/
if ((blk_num + sz) > 0 && ((u_int64_t)(blk_num + sz)) > vn->sc_size) {
shadow_vp = vn->sc_shadow_vp;
if (shadow_vp != NULL) {
error = vnode_getwithvid(shadow_vp,
shadow_vp = vn->sc_shadow_vp;
if (shadow_vp != NULL) {
error = vnode_getwithvid(shadow_vp,
vnioctl(dev_t dev, u_long cmd, caddr_t data,
vnioctl(dev_t dev, u_long cmd, caddr_t data,
vnioctl_chr(dev_t dev, u_long cmd, caddr_t data, int flag, proc_t p)
{
vnioctl_chr(dev_t dev, u_long cmd, caddr_t data, int flag, proc_t p)
{
- return (vnioctl(dev, cmd, data, flag, p, TRUE));
+ return vnioctl(dev, cmd, data, flag, p, TRUE);
vnioctl_blk(dev_t dev, u_long cmd, caddr_t data, int flag, proc_t p)
{
vnioctl_blk(dev_t dev, u_long cmd, caddr_t data, int flag, proc_t p)
{
- return (vnioctl(dev, cmd, data, flag, p, FALSE));
+ return vnioctl(dev, cmd, data, flag, p, FALSE);
if (in_kernel) {
NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE, vniop->vn_file, ctx);
if (in_kernel) {
NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE, vniop->vn_file, ctx);
- }
- else {
- NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
- (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
- vniop->vn_file, ctx);
+ } else {
+ NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
+ (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
+ vniop->vn_file, ctx);
}
/* vn_open gives both long- and short-term references */
error = vn_open(&nd, flags, 0);
if (error) {
if (error != EACCES && error != EPERM && error != EROFS) {
}
/* vn_open gives both long- and short-term references */
error = vn_open(&nd, flags, 0);
if (error) {
if (error != EACCES && error != EPERM && error != EROFS) {
- NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE,
- vniop->vn_file, ctx);
- }
- else {
- NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
- (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
- vniop->vn_file, ctx);
+ NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE,
+ vniop->vn_file, ctx);
+ } else {
+ NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
+ (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
+ vniop->vn_file, ctx);
error = vnode_size(nd.ni_vp, &file_size, ctx);
}
if (error != 0) {
(void) vn_close(nd.ni_vp, flags, ctx);
vnode_put(nd.ni_vp);
error = vnode_size(nd.ni_vp, &file_size, ctx);
}
if (error != 0) {
(void) vn_close(nd.ni_vp, flags, ctx);
vnode_put(nd.ni_vp);
vn->sc_cred = cred;
cdev = makedev(vndevice_cdev_major, minor(dev));
vn->sc_cdev = devfs_make_node(cdev, DEVFS_CHAR,
vn->sc_cred = cred;
cdev = makedev(vndevice_cdev_major, minor(dev));
vn->sc_cdev = devfs_make_node(cdev, DEVFS_CHAR,
-vniocattach_shadow(struct vn_softc *vn, struct vn_ioctl_64 *vniop,
- __unused dev_t dev, int in_kernel, proc_t p)
+vniocattach_shadow(struct vn_softc *vn, struct vn_ioctl_64 *vniop,
+ __unused dev_t dev, int in_kernel, proc_t p)
if (in_kernel) {
NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE, vniop->vn_file, ctx);
if (in_kernel) {
NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW, UIO_SYSSPACE, vniop->vn_file, ctx);
- }
- else {
- NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
- (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
- vniop->vn_file, ctx);
+ } else {
+ NDINIT(&nd, LOOKUP, OP_OPEN, FOLLOW,
+ (IS_64BIT_PROCESS(p) ? UIO_USERSPACE64 : UIO_USERSPACE32),
+ vniop->vn_file, ctx);
}
/* vn_open gives both long- and short-term references */
error = vn_open(&nd, flags, 0);
if (error) {
/* shadow MUST be writable! */
}
/* vn_open gives both long- and short-term references */
error = vn_open(&nd, flags, 0);
if (error) {
/* shadow MUST be writable! */
|| (error = vnode_size(nd.ni_vp, &file_size, ctx))) {
(void)vn_close(nd.ni_vp, flags, ctx);
vnode_put(nd.ni_vp);
|| (error = vnode_size(nd.ni_vp, &file_size, ctx))) {
(void)vn_close(nd.ni_vp, flags, ctx);
vnode_put(nd.ni_vp);
snprintf(devname, 16, "vn%d", ROOT_IMAGE_UNIT);
error = vniocattach_file(vn, &vnio, *dev_p, 1, current_proc());
snprintf(devname, 16, "vn%d", ROOT_IMAGE_UNIT);
error = vniocattach_file(vn, &vnio, *dev_p, 1, current_proc());
tmpbuf = _MALLOC(DEV_BSIZE, M_TEMP, M_WAITOK);
error = file_io(vp, &context, UIO_READ, tmpbuf, 0, DEV_BSIZE, NULL);
FREE(tmpbuf, M_TEMP);
tmpbuf = _MALLOC(DEV_BSIZE, M_TEMP, M_WAITOK);
error = file_io(vp, &context, UIO_READ, tmpbuf, 0, DEV_BSIZE, NULL);
FREE(tmpbuf, M_TEMP);
vndevice_bdev_major = bdevsw_add(BDEV_MAJOR, &vn_bdevsw);
if (vndevice_bdev_major < 0) {
printf("vndevice_init: bdevsw_add() returned %d\n",
vndevice_bdev_major = bdevsw_add(BDEV_MAJOR, &vn_bdevsw);
if (vndevice_bdev_major < 0) {
printf("vndevice_init: bdevsw_add() returned %d\n",
if (vndevice_cdev_major < 0) {
printf("vndevice_init: cdevsw_add() returned %d\n",
if (vndevice_cdev_major < 0) {
printf("vndevice_init: cdevsw_add() returned %d\n",
- UID_ROOT, GID_OPERATOR,
- 0600, "vn%d",
- i);
- if (vn_table[i].sc_bdev == NULL)
+ UID_ROOT, GID_OPERATOR,
+ 0600, "vn%d",
+ i);
+ if (vn_table[i].sc_bdev == NULL) {