1 /* 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 2022 Tomohiro Kusumi <tkusumi@netbsd.org> 5 * Copyright (c) 2011-2022 The DragonFly Project. All rights reserved. 6 * 7 * This code is derived from software contributed to The DragonFly Project 8 * by Matthew Dillon <dillon@dragonflybsd.org> 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in 18 * the documentation and/or other materials provided with the 19 * distribution. 20 * 3. Neither the name of The DragonFly Project nor the names of its 21 * contributors may be used to endorse or promote products derived 22 * from this software without specific, prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 28 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 29 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 34 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 */ 37 38 #ifndef _HAMMER2_HAMMER2_COMPAT_H 39 #define _HAMMER2_HAMMER2_COMPAT_H 40 41 #include <sys/statvfs.h> 42 #include <sys/spinlock.h> 43 #include <sys/uio.h> /* struct iovec */ 44 45 #include <stdio.h> 46 #include <stdlib.h> 47 #include <string.h> 48 #include <util.h> /* ecalloc */ 49 #include <assert.h> 50 #include <err.h> 51 52 #include "ffs/buf.h" 53 54 #define INVARIANTS 55 56 #define MALLOC_DECLARE(type) struct __hack 57 #define MALLOC_DEFINE(type, shortdesc, longdesc) struct __hack 58 59 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) struct __hack 60 #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) struct __hack 61 #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) struct __hack 62 63 #define VFS_SET(vfsops, fsname, flags) struct __hack 64 65 #define MODULE_VERSION(module, version) struct __hack 66 67 #define VOP_FSYNC(vp, waitfor, flags) (0) 68 69 #define kprintf(s, ...) printf(s, ## __VA_ARGS__) 70 #define krateprintf(r, X, ...) kprintf(X, ## __VA_ARGS__) 71 #define ksnprintf(s, n, ...) snprintf(s, n, ## __VA_ARGS__) 72 #define kstrdup(str, type) strdup(str) 73 74 #define kmalloc_create(typep, descr) do{}while(0) 75 #define kmalloc_destroy(typep) do{}while(0) 76 #define kmalloc(size, type, flags) ecalloc(1, size) 77 #define kfree(addr, type) free(addr) 78 79 #define kmalloc_create_obj(typep, descr, objsize) do{}while(0) 80 #define kmalloc_destroy_obj(type) do{}while(0) 81 #define kmalloc_obj(size, type, flags) ecalloc(1, size) 82 #define kfree_obj(addr, type) free(addr) 83 84 #define kmalloc_raise_limit(typep, bytes) do{}while(0) 85 86 #define KASSERT(exp, msg) do { if (!(exp)) panic msg; } while(0) 87 //#define KASSERT(exp, msg) assert(exp) 88 #define KKASSERT(exp) assert(exp) 89 90 #define __debugvar 91 92 #define panic(s, ...) errx(1, s, ## __VA_ARGS__) 93 94 #define ERESTART (-1) 95 96 #define LK_SHARED 0x00000001 97 #define LK_EXCLUSIVE 0x00000002 98 #define LK_RELEASE 0x00000006 99 #define LK_NOWAIT 0x00000010 100 #define LK_RETRY 0x00020000 101 #define LK_PCATCH 0x04000000 102 103 #define MTX_EXCLUSIVE 0x80000000 104 #define MTX_MASK 0x0FFFFFFF 105 106 #define IO_APPEND 0x0002 107 #define IO_SYNC 0x0004 108 #define IO_ASYNC 0x0080 109 #define IO_DIRECT 0x0100 110 #define IO_RECURSE 0x0200 111 112 #define IO_SEQMAX 0x7F 113 #define IO_SEQSHIFT 16 114 115 #define VROOT 0x00000001 116 #define VKVABIO 0x00000040 117 #define VLASTWRITETS 0x00080000 118 119 #define VNOVAL (-1) 120 121 #define FORCECLOSE 0x0002 122 123 #define GETBLK_BHEAVY 0x0002 124 #define GETBLK_KVABIO 0x0010 125 126 #define NOOFFSET (-1LL) 127 128 #define KNOTE(list, hint) 129 130 #define NOTE_DELETE 0x0001 131 #define NOTE_WRITE 0x0002 132 #define NOTE_EXTEND 0x0004 133 #define NOTE_LINK 0x0010 134 135 extern int hz; 136 extern int ticks; 137 extern int64_t vnode_count; 138 139 struct thread { 140 void *td_proc; 141 }; 142 143 typedef struct thread *thread_t; 144 extern struct thread *curthread; 145 146 struct lwkt_token { 147 }; 148 149 typedef struct lwkt_token *lwkt_token_t; 150 151 struct mount { 152 int mnt_flag; 153 int mnt_kern_flag; 154 struct statfs mnt_stat; 155 struct statvfs mnt_vstat; 156 qaddr_t mnt_data; 157 unsigned int mnt_iosize_max; 158 }; 159 160 struct bio { 161 struct m_buf *bio_buf; 162 off_t bio_offset; 163 }; 164 165 struct bio_track { 166 }; 167 168 struct namecache { 169 u_char nc_nlen; 170 char *nc_name; 171 }; 172 173 struct nchandle { 174 struct namecache *ncp; 175 }; 176 177 struct vop_generic_args { 178 int a_reserved[4]; 179 }; 180 181 struct vop_open_args { 182 struct m_vnode *a_vp; 183 int a_mode; 184 struct ucred *a_cred; 185 struct file **a_fpp; 186 }; 187 188 struct vop_close_args { 189 struct m_vnode *a_vp; 190 int a_fflag; 191 struct file *a_fp; 192 }; 193 194 struct vop_access_args { 195 struct m_vnode *a_vp; 196 int a_mode; 197 int a_flags; 198 struct ucred *a_cred; 199 }; 200 201 struct vop_getattr_args { 202 struct m_vnode *a_vp; 203 struct vattr *a_vap; 204 }; 205 206 struct vop_getattr_lite_args { 207 struct m_vnode *a_vp; 208 struct vattr_lite *a_lvap; 209 }; 210 211 struct vop_setattr_args { 212 struct m_vnode *a_vp; 213 struct vattr *a_vap; 214 struct ucred *a_cred; 215 }; 216 217 struct vop_read_args { 218 struct m_vnode *a_vp; 219 struct uio *a_uio; 220 int a_ioflag; 221 struct ucred *a_cred; 222 }; 223 224 struct vop_write_args { 225 struct m_vnode *a_vp; 226 struct uio *a_uio; 227 int a_ioflag; 228 struct ucred *a_cred; 229 }; 230 231 struct vop_ioctl_args { 232 struct m_vnode *a_vp; 233 u_long a_command; 234 caddr_t a_data; 235 int a_fflag; 236 struct ucred *a_cred; 237 struct sysmsg *a_sysmsg; 238 }; 239 240 struct vop_kqfilter_args { 241 struct m_vnode *a_vp; 242 struct knote *a_kn; 243 }; 244 245 struct vop_fsync_args { 246 struct m_vnode *a_vp; 247 int a_waitfor; 248 int a_flags; 249 }; 250 251 struct vop_readdir_args { 252 struct m_vnode *a_vp; 253 struct uio *a_uio; 254 struct ucred *a_cred; 255 int *a_eofflag; 256 int *a_ncookies; 257 off_t **a_cookies; 258 }; 259 260 struct vop_readlink_args { 261 struct m_vnode *a_vp; 262 struct uio *a_uio; 263 struct ucred *a_cred; 264 }; 265 266 struct vop_inactive_args { 267 struct m_vnode *a_vp; 268 }; 269 270 struct vop_reclaim_args { 271 struct m_vnode *a_vp; 272 }; 273 274 struct vop_bmap_args { 275 struct m_vnode *a_vp; 276 off_t a_loffset; 277 off_t *a_doffsetp; 278 int *a_runp; 279 int *a_runb; 280 buf_cmd_t a_cmd; 281 }; 282 283 struct vop_strategy_args { 284 struct m_vnode *a_vp; 285 struct bio *a_bio; 286 }; 287 288 struct vop_advlock_args { 289 struct m_vnode *a_vp; 290 caddr_t a_id; 291 int a_op; 292 struct flock *a_fl; 293 int a_flags; 294 }; 295 296 struct vop_getpages_args { 297 struct m_vnode *a_vp; 298 int a_count; 299 int a_reqpage; 300 //vm_ooffset_t a_offset; 301 int a_seqaccess; 302 }; 303 304 struct vop_putpages_args { 305 struct m_vnode *a_vp; 306 int a_count; 307 int a_flags; 308 int *a_rtvals; 309 //vm_ooffset_t a_offset; 310 }; 311 312 struct vop_mountctl_args { 313 int a_op; 314 struct file *a_fp; 315 const void *a_ctl; 316 int a_ctllen; 317 void *a_buf; 318 int a_buflen; 319 int *a_res; 320 struct m_vnode *a_vp; 321 }; 322 323 struct vop_markatime_args { 324 int a_op; 325 struct m_vnode *a_vp; 326 struct ucred *a_cred; 327 }; 328 329 struct vop_nresolve_args { 330 struct nchandle *a_nch; 331 struct m_vnode *a_dvp; 332 struct ucred *a_cred; 333 struct m_vnode **a_vpp; /* makefs */ 334 }; 335 336 struct vop_nlookupdotdot_args { 337 struct m_vnode *a_dvp; 338 struct m_vnode **a_vpp; 339 struct ucred *a_cred; 340 char **a_fakename; 341 }; 342 343 struct vop_ncreate_args { 344 struct nchandle *a_nch; 345 struct m_vnode *a_dvp; 346 struct m_vnode **a_vpp; 347 struct ucred *a_cred; 348 struct vattr *a_vap; 349 }; 350 351 struct vop_nmkdir_args { 352 struct nchandle *a_nch; 353 struct m_vnode *a_dvp; 354 struct m_vnode **a_vpp; 355 struct ucred *a_cred; 356 struct vattr *a_vap; 357 }; 358 359 struct vop_nmknod_args { 360 struct nchandle *a_nch; 361 struct m_vnode *a_dvp; 362 struct m_vnode **a_vpp; 363 struct ucred *a_cred; 364 struct vattr *a_vap; 365 }; 366 367 struct vop_nlink_args { 368 struct nchandle *a_nch; 369 struct m_vnode *a_dvp; 370 struct m_vnode *a_vp; 371 struct ucred *a_cred; 372 }; 373 374 struct vop_nsymlink_args { 375 struct nchandle *a_nch; 376 struct m_vnode *a_dvp; 377 struct m_vnode **a_vpp; 378 struct ucred *a_cred; 379 struct vattr *a_vap; 380 char *a_target; 381 }; 382 383 struct vop_nremove_args { 384 struct nchandle *a_nch; 385 struct m_vnode *a_dvp; 386 struct ucred *a_cred; 387 }; 388 389 struct vop_nrmdir_args { 390 struct nchandle *a_nch; 391 struct m_vnode *a_dvp; 392 struct ucred *a_cred; 393 }; 394 395 struct vop_nrename_args { 396 struct nchandle *a_fnch; 397 struct nchandle *a_tnch; 398 struct m_vnode *a_fdvp; 399 struct m_vnode *a_tdvp; 400 struct ucred *a_cred; 401 }; 402 403 #define vop_defaultop NULL 404 #define vop_stdgetpages NULL 405 #define vop_stdputpages NULL 406 #define vop_stdnoread NULL 407 #define vop_stdnowrite NULL 408 #define fifo_vnoperate NULL 409 410 struct vop_ops { 411 int (*vop_default)(struct vop_generic_args *); 412 int (*vop_open)(struct vop_open_args *); 413 int (*vop_close)(struct vop_close_args *); 414 int (*vop_access)(struct vop_access_args *); 415 int (*vop_getattr)(struct vop_getattr_args *); 416 int (*vop_getattr_lite)(struct vop_getattr_lite_args *); 417 int (*vop_setattr)(struct vop_setattr_args *); 418 int (*vop_read)(struct vop_read_args *); 419 int (*vop_write)(struct vop_write_args *); 420 int (*vop_ioctl)(struct vop_ioctl_args *); 421 int (*vop_kqfilter)(struct vop_kqfilter_args *); 422 int (*vop_fsync)(struct vop_fsync_args *); 423 int (*vop_readdir)(struct vop_readdir_args *); 424 int (*vop_readlink)(struct vop_readlink_args *); 425 int (*vop_inactive)(struct vop_inactive_args *); 426 int (*vop_reclaim)(struct vop_reclaim_args *); 427 int (*vop_bmap)(struct vop_bmap_args *); 428 int (*vop_strategy)(struct vop_strategy_args *); 429 int (*vop_advlock)(struct vop_advlock_args *); 430 int (*vop_getpages)(struct vop_getpages_args *); 431 int (*vop_putpages)(struct vop_putpages_args *); 432 int (*vop_mountctl)(struct vop_mountctl_args *); 433 int (*vop_markatime)(struct vop_markatime_args *); 434 int (*vop_nresolve)(struct vop_nresolve_args *); 435 int (*vop_nlookupdotdot)(struct vop_nlookupdotdot_args *); 436 int (*vop_ncreate)(struct vop_ncreate_args *); 437 int (*vop_nmkdir)(struct vop_nmkdir_args *); 438 int (*vop_nmknod)(struct vop_nmknod_args *); 439 int (*vop_nlink)(struct vop_nlink_args *); 440 int (*vop_nsymlink)(struct vop_nsymlink_args *); 441 int (*vop_nremove)(struct vop_nremove_args *); 442 int (*vop_nrmdir)(struct vop_nrmdir_args *); 443 int (*vop_nrename)(struct vop_nrename_args *); 444 }; 445 446 enum uio_seg { 447 UIO_USERSPACE, 448 UIO_SYSSPACE, 449 UIO_NOCOPY, 450 }; 451 452 enum uio_rw { 453 UIO_READ, 454 UIO_WRITE 455 }; 456 457 struct uio { 458 struct iovec *uio_iov; 459 int uio_iovcnt; 460 off_t uio_offset; 461 size_t uio_resid; 462 enum uio_seg uio_segflg; 463 enum uio_rw uio_rw; 464 struct thread *uio_td; 465 }; 466 467 /* 468 * Since makefs(8) is a single thread program, there should never be any 469 * lock contention. Therefore, lock(9)/mutex(9)/spinlock(9) emulation always 470 * succeed. Similarly, tsleep(9) should never be called. 471 */ 472 struct lock { 473 int reserved; 474 }; 475 476 typedef struct { 477 unsigned int mtx_lock; 478 } mtx_t; 479 480 typedef mtx_t hammer2_mtx_t; 481 482 typedef u_int mtx_state_t; 483 typedef mtx_state_t hammer2_mtx_state_t; 484 485 typedef struct spinlock hammer2_spin_t; 486 487 static __inline 488 void 489 cpu_pause(void) 490 { 491 } 492 493 static __inline 494 void 495 cpu_mfence(void) 496 { 497 } 498 499 static __inline 500 void 501 cpu_lfence(void) 502 { 503 } 504 505 static __inline 506 void 507 cpu_sfence(void) 508 { 509 } 510 511 static __inline 512 void 513 cpu_ccfence(void) 514 { 515 } 516 517 static __inline 518 void 519 trigger_syncer(struct mount *mp) 520 { 521 } 522 523 static __inline 524 int 525 vfs_mountedon(struct m_vnode *vp) 526 { 527 return (0); 528 } 529 530 static __inline 531 uid_t 532 vop_helper_create_uid(struct mount *mp, mode_t dmode, uid_t duid, 533 struct ucred *cred, mode_t *modep) 534 { 535 return (getuid()); 536 } 537 538 static __inline 539 int 540 vinitvmio(struct m_vnode *vp, off_t filesize, int blksize, int boff) 541 { 542 return (0); 543 } 544 545 static __inline 546 int 547 getnewvnode(enum vtagtype tag, struct mount *mp, struct m_vnode **vpp, 548 int lktimeout, int lkflags) 549 { 550 struct m_vnode *vp; 551 552 vp = ecalloc(1, sizeof(*vp)); 553 vp->v_logical = 1; 554 vp->v_malloced = 1; 555 *vpp = vp; 556 557 vnode_count++; 558 559 return (0); 560 } 561 562 /* not freesomevnodes() */ 563 static __inline 564 void 565 freevnode(struct m_vnode *vp) 566 { 567 assert(vp->v_malloced); 568 free(vp); 569 570 vnode_count--; 571 } 572 573 static __inline 574 int 575 vn_lock(struct m_vnode *vp, int flags) 576 { 577 return (0); 578 } 579 580 static __inline 581 void 582 vn_unlock(struct m_vnode *vp) 583 { 584 } 585 586 static __inline 587 int 588 vget(struct m_vnode *vp, int flags) 589 { 590 return (0); 591 } 592 593 static __inline 594 void 595 vput(struct m_vnode *vp) 596 { 597 } 598 599 static __inline 600 void 601 vrele(struct m_vnode *vp) 602 { 603 } 604 605 static __inline 606 void 607 vhold(struct m_vnode *vp) 608 { 609 } 610 611 static __inline 612 void 613 vdrop(struct m_vnode *vp) 614 { 615 } 616 617 static __inline 618 void 619 vx_put(struct m_vnode *vp) 620 { 621 } 622 623 static __inline 624 void 625 vx_downgrade(struct m_vnode *vp) 626 { 627 } 628 629 static __inline 630 void 631 vfinalize(struct m_vnode *vp) 632 { 633 } 634 635 static __inline 636 void 637 vsetflags(struct m_vnode *vp, int flags) 638 { 639 } 640 641 static __inline 642 void 643 vclrflags(struct m_vnode *vp, int flags) 644 { 645 } 646 647 static __inline 648 void 649 vsetisdirty(struct m_vnode *vp) 650 { 651 } 652 653 static __inline 654 void 655 vclrisdirty(struct m_vnode *vp) 656 { 657 } 658 659 static __inline 660 int 661 vfsync(struct m_vnode *vp, int waitfor, int passes, 662 int (*checkdef)(struct m_buf *), 663 int (*waitoutput)(struct m_vnode *, struct thread *)) 664 { 665 return (0); 666 } 667 668 static __inline 669 int 670 nvtruncbuf(struct m_vnode *vp, off_t length, int blksize, int boff, int flags) 671 { 672 return (0); 673 } 674 675 static __inline 676 int 677 nvextendbuf(struct m_vnode *vp, off_t olength, off_t nlength, int oblksize, 678 int nblksize, int oboff, int nboff, int flags) 679 { 680 return (0); 681 } 682 683 static __inline 684 void 685 addaliasu(struct m_vnode *vp, int x, int y) 686 { 687 } 688 689 static __inline 690 void 691 bheavy(struct m_buf *bp) 692 { 693 } 694 695 static __inline 696 void 697 bkvasync(struct m_buf *bp) 698 { 699 } 700 701 static __inline 702 void 703 bwillwrite(int bytes) 704 { 705 } 706 707 static __inline 708 void 709 BUF_KERNPROC(struct m_buf *bp) 710 { 711 } 712 713 static __inline 714 int 715 bio_track_wait(struct bio_track *track, int slp_flags, int slp_timo) 716 { 717 return (0); 718 } 719 720 static __inline 721 void 722 cache_setvp(struct nchandle *nch, struct m_vnode *vp) 723 { 724 } 725 726 static __inline 727 void 728 cache_setunresolved(struct nchandle *nch) 729 { 730 } 731 732 static __inline 733 void 734 lockinit(struct lock *lkp, const char *wmesg, int timo, int flags) 735 { 736 } 737 738 static __inline 739 int 740 lockmgr(struct lock *lkp, uint32_t flags) 741 { 742 return (0); 743 } 744 745 static __inline 746 int 747 hammer2_mtx_ex(hammer2_mtx_t *mtx) 748 { 749 mtx->mtx_lock |= MTX_EXCLUSIVE; 750 mtx->mtx_lock++; 751 return (0); 752 } 753 754 static __inline 755 int 756 hammer2_mtx_ex_try(hammer2_mtx_t *mtx) 757 { 758 mtx->mtx_lock |= MTX_EXCLUSIVE; 759 mtx->mtx_lock++; 760 return (0); 761 } 762 763 static __inline 764 int 765 hammer2_mtx_sh(hammer2_mtx_t *mtx) 766 { 767 mtx->mtx_lock |= MTX_EXCLUSIVE; 768 mtx->mtx_lock++; 769 return (0); 770 } 771 772 static __inline 773 void 774 hammer2_mtx_sh_again(hammer2_mtx_t *mtx) 775 { 776 mtx->mtx_lock |= MTX_EXCLUSIVE; 777 mtx->mtx_lock++; 778 } 779 780 static __inline 781 int 782 hammer2_mtx_sh_try(hammer2_mtx_t *mtx) 783 { 784 mtx->mtx_lock |= MTX_EXCLUSIVE; 785 mtx->mtx_lock++; 786 return (0); 787 } 788 789 static __inline 790 void 791 hammer2_mtx_unlock(hammer2_mtx_t *mtx) 792 { 793 mtx->mtx_lock &= ~MTX_EXCLUSIVE; 794 mtx->mtx_lock--; 795 } 796 797 static __inline 798 int 799 hammer2_mtx_upgrade_try(hammer2_mtx_t *mtx) 800 { 801 return (0); 802 } 803 804 static __inline 805 int 806 hammer2_mtx_downgrade(hammer2_mtx_t *mtx) 807 { 808 return (0); 809 } 810 811 static __inline 812 int 813 hammer2_mtx_owned(hammer2_mtx_t *mtx) 814 { 815 return (1); /* XXX for asserts */ 816 } 817 818 static __inline 819 void 820 hammer2_mtx_init(hammer2_mtx_t *mtx, const char *ident) 821 { 822 mtx->mtx_lock = 0; 823 } 824 825 static __inline 826 hammer2_mtx_state_t 827 hammer2_mtx_temp_release(hammer2_mtx_t *mtx) 828 { 829 return (0); 830 } 831 832 static __inline 833 void 834 hammer2_mtx_temp_restore(hammer2_mtx_t *mtx, hammer2_mtx_state_t state) 835 { 836 } 837 838 static __inline 839 int 840 hammer2_mtx_refs(hammer2_mtx_t *mtx) 841 { 842 return (mtx->mtx_lock & MTX_MASK); 843 } 844 845 static __inline 846 void 847 hammer2_spin_init(hammer2_spin_t *mtx, const char *ident) 848 { 849 mtx->lock = 0; 850 } 851 852 static __inline 853 void 854 hammer2_spin_sh(hammer2_spin_t *mtx) 855 { 856 mtx->lock++; 857 } 858 859 static __inline 860 void 861 hammer2_spin_ex(hammer2_spin_t *mtx) 862 { 863 mtx->lock++; 864 } 865 866 static __inline 867 void 868 hammer2_spin_unsh(hammer2_spin_t *mtx) 869 { 870 mtx->lock--; 871 } 872 873 static __inline 874 void 875 hammer2_spin_unex(hammer2_spin_t *mtx) 876 { 877 mtx->lock--; 878 } 879 880 static __inline 881 void 882 lwkt_gettoken(lwkt_token_t tok) 883 { 884 } 885 886 static __inline 887 void 888 lwkt_reltoken(lwkt_token_t tok) 889 { 890 } 891 892 static __inline 893 void 894 lwkt_yield(void) 895 { 896 } 897 898 static __inline 899 int 900 tsleep(const volatile void *ident, int flags, const char *wmesg, int timo) 901 { 902 assert(0); 903 } 904 905 static __inline 906 void 907 tsleep_interlock(const volatile void *ident, int flags) 908 { 909 assert(0); 910 } 911 912 static __inline 913 void 914 wakeup(const volatile void *ident) 915 { 916 assert(0); 917 } 918 919 static __inline 920 void 921 print_backtrace(int count) 922 { 923 } 924 925 static __inline 926 void 927 Debugger(const char *msg) 928 { 929 panic("%s: %s", __func__, msg); 930 } 931 932 #endif /* _HAMMER2_HAMMER2_COMPAT_H */ 933