183 error = ddi_copyout(kbuf, (void *)(uintptr_t)zr->zr_buf,
184 zr->zr_buflen, iflag);
185
186 zutr_done:
187 kmem_free(kbuf, zr->zr_buflen);
188 rc = ddi_copyout(zr, (void *)arg, sizeof (zut_readdir_t), iflag);
189 if (error == 0)
190 error = rc;
191
192 zutr_bail:
193 kmem_free(zr, sizeof (zut_readdir_t));
194 if (rvalp)
195 *rvalp = error;
196 return (error);
197 }
198
199 static int
200 zut_stat64(vnode_t *vp, struct stat64 *sb, uint64_t *xvs, int flag, cred_t *cr)
201 {
202 xoptattr_t *xoap = NULL;
203 xvattr_t xv = { 0 };
204 int error;
205
206 xva_init(&xv);
207
208 XVA_SET_REQ(&xv, XAT_ARCHIVE);
209 XVA_SET_REQ(&xv, XAT_SYSTEM);
210 XVA_SET_REQ(&xv, XAT_READONLY);
211 XVA_SET_REQ(&xv, XAT_HIDDEN);
212 XVA_SET_REQ(&xv, XAT_NOUNLINK);
213 XVA_SET_REQ(&xv, XAT_IMMUTABLE);
214 XVA_SET_REQ(&xv, XAT_APPENDONLY);
215 XVA_SET_REQ(&xv, XAT_NODUMP);
216 XVA_SET_REQ(&xv, XAT_OPAQUE);
217 XVA_SET_REQ(&xv, XAT_AV_QUARANTINED);
218 XVA_SET_REQ(&xv, XAT_AV_MODIFIED);
219 XVA_SET_REQ(&xv, XAT_REPARSE);
220 XVA_SET_REQ(&xv, XAT_OFFLINE);
221 XVA_SET_REQ(&xv, XAT_SPARSE);
222
223 xv.xva_vattr.va_mask |= AT_STAT | AT_NBLOCKS | AT_BLKSIZE | AT_SIZE;
501 static struct dev_ops zut_dev_ops = {
502 DEVO_REV, /* version */
503 0, /* refcnt */
504 zut_info, /* info */
505 nulldev, /* identify */
506 nulldev, /* probe */
507 zut_attach, /* attach */
508 zut_detach, /* detach */
509 nodev, /* reset */
510 &zut_cb_ops, /* driver operations */
511 NULL /* no bus operations */
512 };
513
514 static struct modldrv zut_modldrv = {
515 &mod_driverops, "ZFS unit test " ZUT_VERSION_STRING,
516 &zut_dev_ops
517 };
518
519 static struct modlinkage modlinkage = {
520 MODREV_1,
521 (void *)&zut_modldrv,
522 NULL
523 };
524
525 int
526 _init(void)
527 {
528 int error;
529
530 if ((error = mod_install(&modlinkage)) != 0) {
531 return (error);
532 }
533
534 error = ldi_ident_from_mod(&modlinkage, &zut_li);
535 ASSERT(error == 0);
536
537 return (0);
538 }
539
540 int
541 _fini(void)
542 {
|
183 error = ddi_copyout(kbuf, (void *)(uintptr_t)zr->zr_buf,
184 zr->zr_buflen, iflag);
185
186 zutr_done:
187 kmem_free(kbuf, zr->zr_buflen);
188 rc = ddi_copyout(zr, (void *)arg, sizeof (zut_readdir_t), iflag);
189 if (error == 0)
190 error = rc;
191
192 zutr_bail:
193 kmem_free(zr, sizeof (zut_readdir_t));
194 if (rvalp)
195 *rvalp = error;
196 return (error);
197 }
198
199 static int
200 zut_stat64(vnode_t *vp, struct stat64 *sb, uint64_t *xvs, int flag, cred_t *cr)
201 {
202 xoptattr_t *xoap = NULL;
203 xvattr_t xv = {{ 0 }};
204 int error;
205
206 xva_init(&xv);
207
208 XVA_SET_REQ(&xv, XAT_ARCHIVE);
209 XVA_SET_REQ(&xv, XAT_SYSTEM);
210 XVA_SET_REQ(&xv, XAT_READONLY);
211 XVA_SET_REQ(&xv, XAT_HIDDEN);
212 XVA_SET_REQ(&xv, XAT_NOUNLINK);
213 XVA_SET_REQ(&xv, XAT_IMMUTABLE);
214 XVA_SET_REQ(&xv, XAT_APPENDONLY);
215 XVA_SET_REQ(&xv, XAT_NODUMP);
216 XVA_SET_REQ(&xv, XAT_OPAQUE);
217 XVA_SET_REQ(&xv, XAT_AV_QUARANTINED);
218 XVA_SET_REQ(&xv, XAT_AV_MODIFIED);
219 XVA_SET_REQ(&xv, XAT_REPARSE);
220 XVA_SET_REQ(&xv, XAT_OFFLINE);
221 XVA_SET_REQ(&xv, XAT_SPARSE);
222
223 xv.xva_vattr.va_mask |= AT_STAT | AT_NBLOCKS | AT_BLKSIZE | AT_SIZE;
501 static struct dev_ops zut_dev_ops = {
502 DEVO_REV, /* version */
503 0, /* refcnt */
504 zut_info, /* info */
505 nulldev, /* identify */
506 nulldev, /* probe */
507 zut_attach, /* attach */
508 zut_detach, /* detach */
509 nodev, /* reset */
510 &zut_cb_ops, /* driver operations */
511 NULL /* no bus operations */
512 };
513
514 static struct modldrv zut_modldrv = {
515 &mod_driverops, "ZFS unit test " ZUT_VERSION_STRING,
516 &zut_dev_ops
517 };
518
519 static struct modlinkage modlinkage = {
520 MODREV_1,
521 { (void *)&zut_modldrv,
522 NULL }
523 };
524
525 int
526 _init(void)
527 {
528 int error;
529
530 if ((error = mod_install(&modlinkage)) != 0) {
531 return (error);
532 }
533
534 error = ldi_ident_from_mod(&modlinkage, &zut_li);
535 ASSERT(error == 0);
536
537 return (0);
538 }
539
540 int
541 _fini(void)
542 {
|