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