1# SPDX-License-Identifier: GPL-2.0 2# Copyright (c) 2026: Mauro Carvalho Chehab <mchehab@kernel.org> 3 4# Test cases for the dynamic tests. 5# Useful to test if kernel-doc classes are doing what it is expected. 6# 7 8tests: 9- name: func1 10 fname: mock_functions.c 11 description: "Simplest function test: do nothing, just rst output" 12 13 source: | 14 /** 15 * func1 - Not exported function 16 * @arg1: @arg1 does nothing 17 * 18 * Does nothing 19 * 20 * return: 21 * always return 0. 22 */ 23 int func1(char *arg1) { return 0; }; 24 25 expected: 26 - rst: | 27 .. c:function:: int func1 (char *arg1) 28 29 Not exported function 30 31 .. container:: kernelindent 32 33 **Parameters** 34 35 ``char *arg1`` 36 **arg1** does nothing 37 38 **Description** 39 40 Does nothing 41 42 **Return** 43 44 always return 0. 45 46 # TODO: how to handle timestamps at .TH? 47 man: | 48 .TH "func1" 9 "February 2026" "" "Kernel API Manual" 49 .SH NAME 50 func1 \- Not exported function 51 .SH SYNOPSIS 52 .B "int" func1 53 .BI "(char *arg1 " ");" 54 .SH ARGUMENTS 55 .IP "arg1" 12 56 \fIarg1\fP does nothing 57 .SH "DESCRIPTION" 58 Does nothing 59 .SH "RETURN" 60 always return 0. 61 .SH "SEE ALSO" 62 .PP 63 Kernel file \fBmock_functions.c\fR 64 65- name: func2 66 fname: func2.c 67 description: Simple test with exports 68 69 source: | 70 /** 71 * func2() - Exported function 72 * @arg1: @arg1 does nothing 73 * 74 * Does nothing 75 * 76 * return: 77 * always return 0. 78 */ 79 int func2(char *arg1) { return 0; }; 80 EXPORT_SYMBOL(func2); 81 82 exports: func2 83 expected: 84 - kdoc_item: 85 name: func2 86 type: function 87 declaration_start_line: 1 88 89 sections: 90 Description: | 91 Does nothing 92 93 Return: | 94 always return 0. 95 96 sections_start_lines: 97 Description: 3 98 Return: 6 99 100 parameterdescs: 101 arg1: | 102 @arg1 does nothing 103 parameterlist: 104 - arg1 105 parameterdesc_start_lines: 106 arg1: 2 107 parametertypes: 108 arg1: char *arg1 109 110 other_stuff: 111 func_macro: false 112 functiontype: int 113 purpose: "Exported function" 114 typedef: false 115 116 rst: | 117 .. c:function:: int func2 (char *arg1) 118 119 Exported function 120 121 .. container:: kernelindent 122 123 **Parameters** 124 125 ``char *arg1`` 126 **arg1** does nothing 127 128 **Description** 129 130 Does nothing 131 132 **Return** 133 134 always return 0. 135 136 man: | 137 .TH "func2" 9 "February 2026" "" "Kernel API Manual" 138 .SH NAME 139 func2 \- Exported function 140 .SH SYNOPSIS 141 .B "int" func2 142 .BI "(char *arg1 " ");" 143 .SH ARGUMENTS 144 .IP "arg1" 12 145 \fIarg1\fP does nothing 146 .SH "DESCRIPTION" 147 Does nothing 148 .SH "RETURN" 149 always return 0. 150 .SH "SEE ALSO" 151 .PP 152 Kernel file \fBfunc2.c\fR 153 154- name: doc_with_complex_table 155 description: Test if complex tables are handled 156 fname: mock.c 157 source: | 158 /** 159 * DOC: Supported input formats and encodings 160 * 161 * Depending on the Hardware configuration of the Controller IP, it supports 162 * a subset of the following input formats and encodings on its internal 163 * 48bit bus. 164 * 165 * +----------------------+----------------------------------+------------------------------+ 166 * | Format Name | Format Code | Encodings | 167 * +======================+==================================+==============================+ 168 * | RGB 4:4:4 8bit | ``MEDIA_BUS_FMT_RGB888_1X24`` | ``V4L2_YCBCR_ENC_DEFAULT`` | 169 * +----------------------+----------------------------------+------------------------------+ 170 * | RGB 4:4:4 10bits | ``MEDIA_BUS_FMT_RGB101010_1X30`` | ``V4L2_YCBCR_ENC_DEFAULT`` | 171 * +----------------------+----------------------------------+------------------------------+ 172 */ 173 expected: 174 - man: | 175 .TH "Supported input formats and encodings" 9 "March 2026" "" "Kernel API Manual" 176 .SH "Supported input formats and encodings" 177 Depending on the Hardware configuration of the Controller IP, it supports 178 a subset of the following input formats and encodings on its internal 179 48bit bus. 180 .PP 181 182 183 .TS 184 box; 185 l l l. 186 \fBFormat Name\fP \fBFormat Code\fP \fBEncodings\fP 187 _ 188 RGB 4:4:4 8bit ``MEDIA_BUS_FMT_RGB888_1X24 V4L2_YCBCR_ENC_DEFAULT 189 RGB 4:4:4 10bits MEDIA_BUS_FMT_RGB101010_1X30 V4L2_YCBCR_ENC_DEFAULT`` 190 .TE 191 .SH "SEE ALSO" 192 .PP 193 Kernel file \fBmock.c\fR 194 195 rst: |- 196 .. _Supported input formats and encodings: 197 **Supported input formats and encodings** 198 Depending on the Hardware configuration of the Controller IP, it supports 199 a subset of the following input formats and encodings on its internal 200 48bit bus. 201 +----------------------+----------------------------------+------------------------------+ 202 | Format Name | Format Code | Encodings | 203 +======================+==================================+==============================+ 204 | RGB 4:4:4 8bit | ``MEDIA_BUS_FMT_RGB888_1X24`` | ``V4L2_YCBCR_ENC_DEFAULT`` | 205 +----------------------+----------------------------------+------------------------------+ 206 | RGB 4:4:4 10bits | ``MEDIA_BUS_FMT_RGB101010_1X30`` | ``V4L2_YCBCR_ENC_DEFAULT`` | 207 +----------------------+----------------------------------+------------------------------+ 208- name: func_with_ascii_artwork 209 description: Test if ascii artwork is properly output 210 fname: mock.c 211 source: | 212 /** 213 * add_cxl_resources() - reflect CXL fixed memory windows in iomem_resource 214 * @cxl_res: A standalone resource tree where each CXL window is a sibling 215 * 216 * Walk each CXL window in @cxl_res and add it to iomem_resource potentially 217 * expanding its boundaries to ensure that any conflicting resources become 218 * children. If a window is expanded it may then conflict with a another window 219 * entry and require the window to be truncated or trimmed. Consider this 220 * situation:: 221 * 222 * |-- "CXL Window 0" --||----- "CXL Window 1" -----| 223 * |--------------- "System RAM" -------------| 224 * 225 * ...where platform firmware has established as System RAM resource across 2 226 * windows, but has left some portion of window 1 for dynamic CXL region 227 * provisioning. In this case "Window 0" will span the entirety of the "System 228 * RAM" span, and "CXL Window 1" is truncated to the remaining tail past the end 229 * of that "System RAM" resource. 230 */ 231 static int add_cxl_resources(struct resource *cxl_res); 232 expected: 233 - man: |- 234 .TH "add_cxl_resources" 9 "March 2026" "" "Kernel API Manual" 235 .SH NAME 236 add_cxl_resources \- reflect CXL fixed memory windows in iomem_resource 237 .SH SYNOPSIS 238 .B "int" add_cxl_resources 239 .BI "(struct resource *cxl_res " ");" 240 .SH ARGUMENTS 241 .IP "cxl_res" 12 242 A standalone resource tree where each CXL window is a sibling 243 .SH "DESCRIPTION" 244 Walk each CXL window in \fIcxl_res\fP and add it to iomem_resource potentially 245 expanding its boundaries to ensure that any conflicting resources become 246 children. If a window is expanded it may then conflict with a another window 247 entry and require the window to be truncated or trimmed. Consider this 248 situation: 249 .nf 250 251 |-- "CXL Window 0" --||----- "CXL Window 1" -----| 252 |--------------- "System RAM" -------------| 253 254 255 .fi 256 .PP 257 258 \&...where platform firmware has established as System RAM resource across 2 259 windows, but has left some portion of window 1 for dynamic CXL region 260 provisioning. In this case "Window 0" will span the entirety of the "System 261 RAM" span, and "CXL Window 1" is truncated to the remaining tail past the end 262 of that "System RAM" resource. 263 .SH "SEE ALSO" 264 .PP 265 Kernel file \fBmock.c\fR 266 rst: | 267 .. c:function:: int add_cxl_resources (struct resource *cxl_res) 268 269 reflect CXL fixed memory windows in iomem_resource 270 271 .. container:: kernelindent 272 273 **Parameters** 274 275 ``struct resource *cxl_res`` 276 A standalone resource tree where each CXL window is a sibling 277 278 **Description** 279 280 Walk each CXL window in **cxl_res** and add it to iomem_resource potentially 281 expanding its boundaries to ensure that any conflicting resources become 282 children. If a window is expanded it may then conflict with a another window 283 entry and require the window to be truncated or trimmed. Consider this 284 situation:: 285 286 |-- "CXL Window 0" --||----- "CXL Window 1" -----| 287 |--------------- "System RAM" -------------| 288 289 ...where platform firmware has established as System RAM resource across 2 290 windows, but has left some portion of window 1 for dynamic CXL region 291 provisioning. In this case "Window 0" will span the entirety of the "System 292 RAM" span, and "CXL Window 1" is truncated to the remaining tail past the end 293 of that "System RAM" resource. 294 295- name: simple_tables 296 description: Test formatting two simple tables 297 fname: mock.c 298 source: | 299 /** 300 * bitmap_onto - translate one bitmap relative to another 301 * @dst: resulting translated bitmap 302 * @orig: original untranslated bitmap 303 * @relmap: bitmap relative to which translated 304 * @bits: number of bits in each of these bitmaps 305 * 306 * =============== ============== ================= 307 * @orig tmp @dst 308 * 0 0 40 309 * 1 1 41 310 * =============== ============== ================= 311 * 312 * And: 313 * 314 * =============== ============== ================= 315 * @orig tmp @dst 316 * =============== ============== ================= 317 * 9 9 95 318 * 10 0 40 [#f1]_ 319 * =============== ============== ================= 320 */ 321 void bitmap_onto(unsigned long *dst, const unsigned long *orig, 322 const unsigned long *relmap, unsigned int bits); 323 expected: 324 - man: | 325 .TH "bitmap_onto" 9 "March 2026" "" "Kernel API Manual" 326 .SH NAME 327 bitmap_onto \- translate one bitmap relative to another 328 .SH SYNOPSIS 329 .B "void" bitmap_onto 330 .BI "(unsigned long *dst " "," 331 .BI "const unsigned long *orig " "," 332 .BI "const unsigned long *relmap " "," 333 .BI "unsigned int bits " ");" 334 .SH ARGUMENTS 335 .IP "dst" 12 336 resulting translated bitmap 337 .IP "orig" 12 338 original untranslated bitmap 339 .IP "relmap" 12 340 bitmap relative to which translated 341 .IP "bits" 12 342 number of bits in each of these bitmaps 343 .SH "DESCRIPTION" 344 345 .TS 346 box; 347 l l l. 348 \fIorig\fP tmp \fIdst\fP 349 0 0 40 350 1 1 41 351 .TE 352 .PP 353 354 And: 355 .PP 356 357 358 .TS 359 box; 360 l l l. 361 \fIorig\fP tmp \fIdst\fP 362 .TE 363 9 9 95 364 10 0 40 [#f1]_ 365 .SH "SEE ALSO" 366 .PP 367 Kernel file \fBmock.c\fR 368 369 rst: | 370 .. c:function:: void bitmap_onto (unsigned long *dst, const unsigned long *orig, const unsigned long *relmap, unsigned int bits) 371 372 translate one bitmap relative to another 373 374 .. container:: kernelindent 375 376 **Parameters** 377 378 ``unsigned long *dst`` 379 resulting translated bitmap 380 381 ``const unsigned long *orig`` 382 original untranslated bitmap 383 384 ``const unsigned long *relmap`` 385 bitmap relative to which translated 386 387 ``unsigned int bits`` 388 number of bits in each of these bitmaps 389 390 **Description** 391 392 =============== ============== ================= 393 **orig** tmp **dst** 394 0 0 40 395 1 1 41 396 =============== ============== ================= 397 398 And: 399 400 =============== ============== ================= 401 **orig** tmp **dst** 402 =============== ============== ================= 403 9 9 95 404 10 0 40 [#f1]_ 405 =============== ============== ================= 406 407# 408# Variable tests from Randy Dunlap's testset 409# 410- name: unsigned_long_var_on_uppercase 411 description: Test an unsigned long varaible in uppercase 412 fname: mock-vars.c 413 source: | 414 /** 415 * var ROOT_DEV - system root device 416 * 417 * @ROOT_DEV is either the successful root device or the root device 418 * that failed boot in the boot failure message. 419 */ 420 unsigned long ROOT_DEV; 421 expected: 422 - man: | 423 .TH "var ROOT_DEV" 9 "February 2026" "" "Kernel API Manual" 424 .SH NAME 425 ROOT_DEV \- system root device 426 .SH SYNOPSIS 427 unsigned long ROOT_DEV; 428 .SH "Description" 429 \fIROOT_DEV\fP is either the successful root device or the root device 430 that failed boot in the boot failure message. 431 .SH "SEE ALSO" 432 .PP 433 Kernel file \fBmock-vars.c\fR 434 rst: | 435 .. c:macro:: ROOT_DEV 436 437 ``unsigned long ROOT_DEV;`` 438 439 system root device 440 441 **Description** 442 443 **ROOT_DEV** is either the successful root device or the root device 444 that failed boot in the boot failure message. 445- name: enum_var 446 description: Test an enum var with __read_mostly 447 fname: mock-vars.c 448 source: | 449 /** 450 * var system_state - system state used during boot or suspend/hibernate/resume 451 * 452 * @system_state can be used during boot to determine if it is safe to 453 * make certain calls to other parts of the kernel. It can also be used 454 * during suspend/hibernate or resume to determine the order of actions 455 * that need to be executed. The numerical values of system_state are 456 * sometimes used in numerical ordering tests, so the relative values 457 * must not be altered. 458 */ 459 enum system_states system_state __read_mostly; 460 expected: 461 - man: | 462 .TH "var system_state" 9 "February 2026" "" "Kernel API Manual" 463 .SH NAME 464 system_state \- system state used during boot or suspend/hibernate/resume 465 .SH SYNOPSIS 466 enum system_states system_state __read_mostly; 467 .SH "Description" 468 \fIsystem_state\fP can be used during boot to determine if it is safe to 469 make certain calls to other parts of the kernel. It can also be used 470 during suspend/hibernate or resume to determine the order of actions 471 that need to be executed. The numerical values of system_state are 472 sometimes used in numerical ordering tests, so the relative values 473 must not be altered. 474 .SH "SEE ALSO" 475 .PP 476 Kernel file \fBmock-vars.c\fR 477 rst: | 478 .. c:macro:: system_state 479 480 ``enum system_states system_state __read_mostly;`` 481 482 system state used during boot or suspend/hibernate/resume 483 484 **Description** 485 486 **system_state** can be used during boot to determine if it is safe to 487 make certain calls to other parts of the kernel. It can also be used 488 during suspend/hibernate or resume to determine the order of actions 489 that need to be executed. The numerical values of system_state are 490 sometimes used in numerical ordering tests, so the relative values 491 must not be altered. 492- name: char_pointer_var 493 description: Test char * var with __ro_after_init 494 fname: mock-vars.c 495 source: | 496 /** 497 * var saved_command_line - kernel's command line, saved from use at 498 * any later time in the kernel. 499 */ 500 char *saved_command_line __ro_after_init; 501 expected: 502 - man: | 503 .TH "var saved_command_line" 9 "February 2026" "" "Kernel API Manual" 504 .SH NAME 505 saved_command_line \- kernel's command line, saved from use at any later time in the kernel. 506 .SH SYNOPSIS 507 char *saved_command_line __ro_after_init; 508 .SH "SEE ALSO" 509 .PP 510 Kernel file \fBmock-vars.c\fR 511 rst: | 512 .. c:macro:: saved_command_line 513 514 ``char *saved_command_line __ro_after_init;`` 515 516 kernel's command line, saved from use at any later time in the kernel. 517- name: unsigned_long_with_default 518 description: Test an unsigned long var that is set to a default value 519 fname: mock-vars.c 520 source: | 521 /** 522 * var loop_per_jiffy - calculated loop count needed to consume one jiffy 523 * of time 524 */ 525 unsigned long loops_per_jiffy = (1<<12); 526 expected: 527 - man: | 528 .TH "var loops_per_jiffy" 9 "February 2026" "" "Kernel API Manual" 529 .SH NAME 530 loops_per_jiffy \- calculated loop count needed to consume one jiffy of time 531 .SH SYNOPSIS 532 unsigned long loops_per_jiffy = (1<<12); 533 .SH "Initialization" 534 default: (1<<12) 535 .SH "SEE ALSO" 536 .PP 537 Kernel file \fBmock-vars.c\fR 538 rst: | 539 .. c:macro:: loops_per_jiffy 540 541 ``unsigned long loops_per_jiffy = (1<<12);`` 542 543 calculated loop count needed to consume one jiffy of time 544 545 **Initialization** 546 547 default: ``(1<<12)`` 548- name: unsigned_long 549 description: test a simple unsigned long variable. 550 fname: mock-vars.c 551 source: | 552 /** 553 * var preset_lpj - lpj (loops per jiffy) value set from kernel 554 * command line using "lpj=VALUE" 555 * 556 * See Documentation/admin-guide/kernel-parameters.txt ("lpj=") for details. 557 */ 558 unsigned long preset_lpj; 559 expected: 560 - man: | 561 .TH "var preset_lpj" 9 "February 2026" "" "Kernel API Manual" 562 .SH NAME 563 preset_lpj \- lpj (loops per jiffy) value set from kernel command line using "lpj=VALUE" 564 .SH SYNOPSIS 565 unsigned long preset_lpj; 566 .SH "Description" 567 See Documentation/admin-guide/kernel-parameters.txt ("lpj=") for details. 568 .SH "SEE ALSO" 569 .PP 570 Kernel file \fBmock-vars.c\fR 571 rst: | 572 .. c:macro:: preset_lpj 573 574 ``unsigned long preset_lpj;`` 575 576 lpj (loops per jiffy) value set from kernel command line using "lpj=VALUE" 577 578 **Description** 579 580 See Documentation/admin-guide/kernel-parameters.txt ("lpj=") for details. 581- name: char_array 582 description: test a char array variable 583 fname: mock-vars.c 584 source: | 585 /** 586 * var linux_proc_banner - text used from /proc/version file 587 * 588 * * first %s is sysname (e.g., "Linux") 589 * * second %s is release 590 * * third %s is version 591 */ 592 char linux_proc_banner[]; 593 expected: 594 - man: | 595 .TH "var linux_proc_banner" 9 "February 2026" "" "Kernel API Manual" 596 .SH NAME 597 linux_proc_banner \- text used from /proc/version file 598 .SH SYNOPSIS 599 char linux_proc_banner[]; 600 .SH "Description" 601 .IP \[bu] 602 first s is sysname (e.g., "Linux") 603 .IP \[bu] 604 second s is release 605 .IP \[bu] 606 third s is version 607 .SH "SEE ALSO" 608 .PP 609 Kernel file \fBmock-vars.c\fR 610 rst: | 611 .. c:macro:: linux_proc_banner 612 613 ``char linux_proc_banner[];`` 614 615 text used from /proc/version file 616 617 **Description** 618 619 * first ``s`` is sysname (e.g., "Linux") 620 * second ``s`` is release 621 * third ``s`` is version 622- name: const_char_array 623 description: test a const char array variable 624 fname: mock-vars.c 625 source: | 626 /** 627 * var linux_banner - Linux boot banner, usually printed at boot time 628 */ 629 const char linux_banner[]; 630 expected: 631 - man: | 632 .TH "var linux_banner" 9 "February 2026" "" "Kernel API Manual" 633 .SH NAME 634 linux_banner \- Linux boot banner, usually printed at boot time 635 .SH SYNOPSIS 636 const char linux_banner[]; 637 .SH "SEE ALSO" 638 .PP 639 Kernel file \fBmock-vars.c\fR 640 rst: | 641 .. c:macro:: linux_banner 642 643 ``const char linux_banner[];`` 644 645 Linux boot banner, usually printed at boot time 646- name: static_atomic64_t_var 647 description: test a static atomi64_t variable 648 fname: mock-vars.c 649 source: | 650 /** 651 * var diskseq - unique sequence number for block device instances 652 * 653 * Allows userspace to associate uevents to the lifetime of a device 654 */ 655 static atomic64_t diskseq; 656 expected: 657 - man: | 658 .TH "var diskseq" 9 "February 2026" "" "Kernel API Manual" 659 .SH NAME 660 diskseq \- unique sequence number for block device instances 661 .SH SYNOPSIS 662 static atomic64_t diskseq; 663 .SH "Description" 664 Allows userspace to associate uevents to the lifetime of a device 665 .SH "SEE ALSO" 666 .PP 667 Kernel file \fBmock-vars.c\fR 668 rst: | 669 .. c:macro:: diskseq 670 671 ``static atomic64_t diskseq;`` 672 673 unique sequence number for block device instances 674 675 **Description** 676 677 Allows userspace to associate uevents to the lifetime of a device 678- name: unsigned_long_on_init 679 description: test an unsigned long var at "init" with a different timestamp. 680 fname: init/mock-vars.c 681 source: | 682 /** 683 * var rtnl_mutex - historical global lock for networking control operations. 684 * 685 * @rtnl_mutex is used to serialize rtnetlink requests 686 * and protect all kernel internal data structures related to networking. 687 * 688 * See Documentation/networking/netdevices.rst for details. 689 * Often known as the rtnl_lock, although rtnl_lock is a kernel function. 690 */ 691 unsigned long rtnl_mutex; 692 expected: 693 - man: | 694 .TH "var rtnl_mutex" 9 "February 2026" "init" "Kernel API Manual" 695 .SH NAME 696 rtnl_mutex \- historical global lock for networking control operations. 697 .SH SYNOPSIS 698 unsigned long rtnl_mutex; 699 .SH "Description" 700 \fIrtnl_mutex\fP is used to serialize rtnetlink requests 701 and protect all kernel internal data structures related to networking. 702 .PP 703 704 See Documentation/networking/netdevices.rst for details. 705 Often known as the rtnl_lock, although rtnl_lock is a kernel function. 706 .SH "SEE ALSO" 707 .PP 708 Kernel file \fBinit/mock-vars.c\fR 709 rst: | 710 .. c:macro:: rtnl_mutex 711 712 ``unsigned long rtnl_mutex;`` 713 714 historical global lock for networking control operations. 715 716 **Description** 717 718 **rtnl_mutex** is used to serialize rtnetlink requests 719 and protect all kernel internal data structures related to networking. 720 721 See Documentation/networking/netdevices.rst for details. 722 Often known as the rtnl_lock, although rtnl_lock is a kernel function. 723 724 725- name: struct_kcov 726 fname: mock_tests/kdoc-drop-ctx-lock.c 727 source: | 728 /** 729 * struct kcov - kcov descriptor (one per opened debugfs file). 730 * State transitions of the descriptor: 731 * 732 * - initial state after open() 733 * - then there must be a single ioctl(KCOV_INIT_TRACE) call 734 * - then, mmap() call (several calls are allowed but not useful) 735 * - then, ioctl(KCOV_ENABLE, arg), where arg is 736 * KCOV_TRACE_PC - to trace only the PCs 737 * or 738 * KCOV_TRACE_CMP - to trace only the comparison operands 739 * - then, ioctl(KCOV_DISABLE) to disable the task. 740 * 741 * Enabling/disabling ioctls can be repeated (only one task a time allowed). 742 */ 743 struct kcov { 744 /** 745 * @refcount: Reference counter. We keep one for: 746 * - opened file descriptor 747 * - task with enabled coverage (we can't unwire it from another task) 748 * - each code section for remote coverage collection 749 */ 750 refcount_t refcount; 751 /** 752 * @lock: The lock protects mode, size, area and t. 753 */ 754 spinlock_t lock; 755 /** 756 * @mode: the kcov_mode 757 */ 758 enum kcov_mode mode __guarded_by(&lock); 759 /** 760 * @size: Size of arena (in long's). 761 */ 762 unsigned int size __guarded_by(&lock); 763 /** 764 * @area: Coverage buffer shared with user space. 765 */ 766 void *area __guarded_by(&lock); 767 /** 768 * @t: Task for which we collect coverage, or NULL. 769 */ 770 struct task_struct *t __guarded_by(&lock); 771 /** 772 * @remote: Collecting coverage from remote (background) threads. 773 */ 774 bool remote; 775 /** 776 * @remote_size: Size of remote area (in long's). 777 */ 778 unsigned int remote_size; 779 /** 780 * @sequence: Sequence is incremented each time kcov is reenabled, 781 * used by kcov_remote_stop(), see the comment there. 782 */ 783 int sequence; 784 }; 785 expected: 786 - man: | 787 .TH "struct kcov" 9 "February 2026" "mock_tests" "Kernel API Manual" 788 .SH NAME 789 struct kcov \- kcov descriptor (one per opened debugfs file). State transitions of the descriptor: 790 .SH SYNOPSIS 791 struct kcov { 792 .br 793 .BI " refcount_t refcount;" 794 .br 795 .BI " spinlock_t lock;" 796 .br 797 .BI " enum kcov_mode mode;" 798 .br 799 .BI " unsigned int size;" 800 .br 801 .BI " void *area;" 802 .br 803 .BI " struct task_struct *t;" 804 .br 805 .BI " bool remote;" 806 .br 807 .BI " unsigned int remote_size;" 808 .br 809 .BI " int sequence;" 810 .br 811 .BI " 812 }; 813 .br 814 815 .SH Members 816 .IP "refcount" 12 817 Reference counter. We keep one for: 818 .IP \[bu] 819 opened file descriptor 820 .IP \[bu] 821 task with enabled coverage (we can't unwire it from another task) 822 .IP \[bu] 823 each code section for remote coverage collection 824 .IP "lock" 12 825 The lock protects mode, size, area and t. 826 .IP "mode" 12 827 the kcov_mode 828 .IP "size" 12 829 Size of arena (in long's). 830 .IP "area" 12 831 Coverage buffer shared with user space. 832 .IP "t" 12 833 Task for which we collect coverage, or NULL. 834 .IP "remote" 12 835 Collecting coverage from remote (background) threads. 836 .IP "remote_size" 12 837 Size of remote area (in long's). 838 .IP "sequence" 12 839 Sequence is incremented each time kcov is reenabled, 840 used by \fBkcov_remote_stop\fP, see the comment there. 841 .SH "Description" 842 .IP \[bu] 843 initial state after \fBopen\fP 844 .IP \[bu] 845 then there must be a single ioctl(KCOV_INIT_TRACE) call 846 .IP \[bu] 847 then, \fBmmap\fP call (several calls are allowed but not useful) 848 .IP \[bu] 849 then, ioctl(KCOV_ENABLE, arg), where arg is 850 KCOV_TRACE_PC - to trace only the PCs 851 or 852 KCOV_TRACE_CMP - to trace only the comparison operands 853 .IP \[bu] 854 then, ioctl(KCOV_DISABLE) to disable the task. 855 .PP 856 857 Enabling/disabling ioctls can be repeated (only one task a time allowed). 858 .SH "SEE ALSO" 859 .PP 860 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 861 rst: | 862 .. c:struct:: kcov 863 864 kcov descriptor (one per opened debugfs file). State transitions of the descriptor: 865 866 .. container:: kernelindent 867 868 **Definition**:: 869 870 struct kcov { 871 refcount_t refcount; 872 spinlock_t lock; 873 enum kcov_mode mode; 874 unsigned int size; 875 void *area; 876 struct task_struct *t; 877 bool remote; 878 unsigned int remote_size; 879 int sequence; 880 }; 881 882 **Members** 883 884 ``refcount`` 885 Reference counter. We keep one for: 886 - opened file descriptor 887 - task with enabled coverage (we can't unwire it from another task) 888 - each code section for remote coverage collection 889 890 ``lock`` 891 The lock protects mode, size, area and t. 892 893 ``mode`` 894 the kcov_mode 895 896 ``size`` 897 Size of arena (in long's). 898 899 ``area`` 900 Coverage buffer shared with user space. 901 902 ``t`` 903 Task for which we collect coverage, or NULL. 904 905 ``remote`` 906 Collecting coverage from remote (background) threads. 907 908 ``remote_size`` 909 Size of remote area (in long's). 910 911 ``sequence`` 912 Sequence is incremented each time kcov is reenabled, 913 used by kcov_remote_stop(), see the comment there. 914 915 916 **Description** 917 918 - initial state after open() 919 - then there must be a single ioctl(KCOV_INIT_TRACE) call 920 - then, mmap() call (several calls are allowed but not useful) 921 - then, ioctl(KCOV_ENABLE, arg), where arg is 922 KCOV_TRACE_PC - to trace only the PCs 923 or 924 KCOV_TRACE_CMP - to trace only the comparison operands 925 - then, ioctl(KCOV_DISABLE) to disable the task. 926 927 Enabling/disabling ioctls can be repeated (only one task a time allowed). 928 929- name: pool_offset 930 description: mock_tests/kdoc-drop-ctx-lock.c line 83 931 fname: mock_tests/kdoc-drop-ctx-lock.c 932 source: | 933 /** 934 * var pool_offset - Offset to the unused space in the currently used pool. 935 * 936 */ 937 size_t pool_offset __guarded_by(&pool_lock) = DEPOT_POOL_SIZE; 938 expected: 939 - man: | 940 .TH "var pool_offset" 9 "February 2026" "mock_tests" "Kernel API Manual" 941 .SH NAME 942 pool_offset \- Offset to the unused space in the currently used pool. 943 .SH SYNOPSIS 944 size_t pool_offset __guarded_by(&pool_lock) = DEPOT_POOL_SIZE; 945 .SH "Initialization" 946 default: DEPOT_POOL_SIZE 947 .SH "SEE ALSO" 948 .PP 949 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 950 rst: | 951 .. c:macro:: pool_offset 952 953 ``size_t pool_offset __guarded_by(&pool_lock) = DEPOT_POOL_SIZE;`` 954 955 Offset to the unused space in the currently used pool. 956 957 **Initialization** 958 959 default: ``DEPOT_POOL_SIZE`` 960- name: free_stacks 961 description: mock_tests/kdoc-drop-ctx-lock.c line 88 962 fname: mock_tests/kdoc-drop-ctx-lock.c 963 source: | 964 /** 965 * var free_stacks - Freelist of stack records within stack_pools. 966 * 967 */ 968 __guarded_by(&pool_lock) LIST_HEAD(free_stacks); 969 expected: 970 - man: | 971 .TH "var free_stacks" 9 "February 2026" "mock_tests" "Kernel API Manual" 972 .SH NAME 973 free_stacks \- Freelist of stack records within stack_pools. 974 .SH SYNOPSIS 975 __guarded_by(&pool_lock) LIST_HEAD(free_stacks); 976 .SH "SEE ALSO" 977 .PP 978 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 979 rst: | 980 .. c:macro:: free_stacks 981 982 ``__guarded_by(&pool_lock) LIST_HEAD(free_stacks);`` 983 984 Freelist of stack records within stack_pools. 985- name: stack_pools 986 description: mock_tests/kdoc-drop-ctx-lock.c line 94 987 fname: mock_tests/kdoc-drop-ctx-lock.c 988 source: | 989 /** 990 * var stack_pools - Array of memory regions that store stack records. 991 * 992 */ 993 void **stack_pools __pt_guarded_by(&pool_lock); 994 expected: 995 - man: | 996 .TH "var stack_pools" 9 "February 2026" "mock_tests" "Kernel API Manual" 997 .SH NAME 998 stack_pools \- Array of memory regions that store stack records. 999 .SH SYNOPSIS 1000 void **stack_pools __pt_guarded_by(&pool_lock); 1001 .SH "SEE ALSO" 1002 .PP 1003 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1004 rst: | 1005 .. c:macro:: stack_pools 1006 1007 ``void **stack_pools __pt_guarded_by(&pool_lock);`` 1008 1009 Array of memory regions that store stack records. 1010- name: prepare_report_consumer 1011 description: mock_tests/kdoc-drop-ctx-lock.c line 103 1012 fname: mock_tests/kdoc-drop-ctx-lock.c 1013 source: | 1014 /** 1015 * prepare_report_consumer - prepare the report consumer 1016 * @flags: flags 1017 * @ai: not that AI 1018 * @other_info: yes that 1019 */ 1020 bool prepare_report_consumer(unsigned long *flags, 1021 const struct access_info *ai, 1022 struct other_info *other_info) 1023 __cond_acquires(true, &report_lock) 1024 { 1025 expected: 1026 - man: | 1027 .TH "prepare_report_consumer" 9 "February 2026" "mock_tests" "Kernel API Manual" 1028 .SH NAME 1029 prepare_report_consumer \- prepare the report consumer 1030 .SH SYNOPSIS 1031 .B "bool" prepare_report_consumer 1032 .BI "(unsigned long *flags " "," 1033 .BI "const struct access_info *ai " "," 1034 .BI "struct other_info *other_info " ");" 1035 .SH ARGUMENTS 1036 .IP "flags" 12 1037 flags 1038 .IP "ai" 12 1039 not that AI 1040 .IP "other_info" 12 1041 yes that 1042 .SH "SEE ALSO" 1043 .PP 1044 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1045 rst: | 1046 .. c:function:: bool prepare_report_consumer (unsigned long *flags, const struct access_info *ai, struct other_info *other_info) 1047 1048 prepare the report consumer 1049 1050 .. container:: kernelindent 1051 1052 **Parameters** 1053 1054 ``unsigned long *flags`` 1055 flags 1056 1057 ``const struct access_info *ai`` 1058 not that AI 1059 1060 ``struct other_info *other_info`` 1061 yes that 1062- name: tcp_sigpool_start 1063 description: mock_tests/kdoc-drop-ctx-lock.c line 117 1064 fname: mock_tests/kdoc-drop-ctx-lock.c 1065 source: | 1066 /** 1067 * tcp_sigpool_start - start a tcp message of @id, using @c 1068 * @id: TCP message ID 1069 * @c: the &tcp_sigpool to use 1070 */ 1071 int tcp_sigpool_start(unsigned int id, struct tcp_sigpool *c) __cond_acquires(0, RCU_BH) 1072 { 1073 expected: 1074 - man: | 1075 .TH "tcp_sigpool_start" 9 "February 2026" "mock_tests" "Kernel API Manual" 1076 .SH NAME 1077 tcp_sigpool_start \- start a tcp message of @id, using @c 1078 .SH SYNOPSIS 1079 .B "int" tcp_sigpool_start 1080 .BI "(unsigned int id " "," 1081 .BI "struct tcp_sigpool *c " ");" 1082 .SH ARGUMENTS 1083 .IP "id" 12 1084 TCP message ID 1085 .IP "c" 12 1086 the \fItcp_sigpool\fP to use 1087 .SH "SEE ALSO" 1088 .PP 1089 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1090 rst: | 1091 .. c:function:: int tcp_sigpool_start (unsigned int id, struct tcp_sigpool *c) 1092 1093 start a tcp message of **id**, using **c** 1094 1095 .. container:: kernelindent 1096 1097 **Parameters** 1098 1099 ``unsigned int id`` 1100 TCP message ID 1101 1102 ``struct tcp_sigpool *c`` 1103 the :c:type:`tcp_sigpool` to use 1104- name: undo_report_consumer 1105 description: mock_tests/kdoc-drop-ctx-lock.c line 129 1106 fname: mock_tests/kdoc-drop-ctx-lock.c 1107 source: | 1108 /** 1109 * undo_report_consumer - teardown a report consumer 1110 * @flags: those flags 1111 * @ai: not that AI 1112 * @other_info: yes that 1113 */ 1114 bool undo_report_consumer(unsigned long *flags, 1115 const struct access_info *ai, 1116 struct other_info *other_info) 1117 __cond_releases(true, &report_lock) 1118 { 1119 expected: 1120 - man: | 1121 .TH "undo_report_consumer" 9 "February 2026" "mock_tests" "Kernel API Manual" 1122 .SH NAME 1123 undo_report_consumer \- teardown a report consumer 1124 .SH SYNOPSIS 1125 .B "bool" undo_report_consumer 1126 .BI "(unsigned long *flags " "," 1127 .BI "const struct access_info *ai " "," 1128 .BI "struct other_info *other_info " ");" 1129 .SH ARGUMENTS 1130 .IP "flags" 12 1131 those flags 1132 .IP "ai" 12 1133 not that AI 1134 .IP "other_info" 12 1135 yes that 1136 .SH "SEE ALSO" 1137 .PP 1138 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1139 rst: | 1140 .. c:function:: bool undo_report_consumer (unsigned long *flags, const struct access_info *ai, struct other_info *other_info) 1141 1142 teardown a report consumer 1143 1144 .. container:: kernelindent 1145 1146 **Parameters** 1147 1148 ``unsigned long *flags`` 1149 those flags 1150 1151 ``const struct access_info *ai`` 1152 not that AI 1153 1154 ``struct other_info *other_info`` 1155 yes that 1156- name: debugfs_enter_cancellation 1157 description: mock_tests/kdoc-drop-ctx-lock.c line 143 1158 fname: mock_tests/kdoc-drop-ctx-lock.c 1159 source: | 1160 /** 1161 * debugfs_enter_cancellation - begin a cancellation operation on @file 1162 * @file: the target file 1163 * @cancellation: the operation to execute 1164 */ 1165 void debugfs_enter_cancellation(struct file *file, 1166 struct debugfs_cancellation *cancellation) __acquires(cancellation) 1167 { } 1168 expected: 1169 - man: | 1170 .TH "debugfs_enter_cancellation" 9 "February 2026" "mock_tests" "Kernel API Manual" 1171 .SH NAME 1172 debugfs_enter_cancellation \- begin a cancellation operation on @file 1173 .SH SYNOPSIS 1174 .B "void" debugfs_enter_cancellation 1175 .BI "(struct file *file " "," 1176 .BI "struct debugfs_cancellation *cancellation " ");" 1177 .SH ARGUMENTS 1178 .IP "file" 12 1179 the target file 1180 .IP "cancellation" 12 1181 the operation to execute 1182 .SH "SEE ALSO" 1183 .PP 1184 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1185 rst: | 1186 .. c:function:: void debugfs_enter_cancellation (struct file *file, struct debugfs_cancellation *cancellation) 1187 1188 begin a cancellation operation on **file** 1189 1190 .. container:: kernelindent 1191 1192 **Parameters** 1193 1194 ``struct file *file`` 1195 the target file 1196 1197 ``struct debugfs_cancellation *cancellation`` 1198 the operation to execute 1199- name: debugfs_leave_cancellation 1200 description: mock_tests/kdoc-drop-ctx-lock.c line 152 1201 fname: mock_tests/kdoc-drop-ctx-lock.c 1202 source: | 1203 /** 1204 * debugfs_leave_cancellation - wrapup the cancellation operation on @file 1205 * @file: the target file 1206 * @cancellation: the operation to wrapup 1207 */ 1208 void debugfs_leave_cancellation(struct file *file, 1209 struct debugfs_cancellation *cancellation) __releases(cancellation) 1210 { } 1211 expected: 1212 - man: | 1213 .TH "debugfs_leave_cancellation" 9 "February 2026" "mock_tests" "Kernel API Manual" 1214 .SH NAME 1215 debugfs_leave_cancellation \- wrapup the cancellation operation on @file 1216 .SH SYNOPSIS 1217 .B "void" debugfs_leave_cancellation 1218 .BI "(struct file *file " "," 1219 .BI "struct debugfs_cancellation *cancellation " ");" 1220 .SH ARGUMENTS 1221 .IP "file" 12 1222 the target file 1223 .IP "cancellation" 12 1224 the operation to wrapup 1225 .SH "SEE ALSO" 1226 .PP 1227 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1228 rst: | 1229 .. c:function:: void debugfs_leave_cancellation (struct file *file, struct debugfs_cancellation *cancellation) 1230 1231 wrapup the cancellation operation on **file** 1232 1233 .. container:: kernelindent 1234 1235 **Parameters** 1236 1237 ``struct file *file`` 1238 the target file 1239 1240 ``struct debugfs_cancellation *cancellation`` 1241 the operation to wrapup 1242- name: acpi_os_acquire_lock 1243 description: mock_tests/kdoc-drop-ctx-lock.c line 161 1244 fname: mock_tests/kdoc-drop-ctx-lock.c 1245 source: | 1246 /** 1247 * acpi_os_acquire_lock - Acquire a spinlock. 1248 * @lockp: pointer to the spinlock_t. 1249 */ 1250 acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp) 1251 __acquires(lockp) 1252 { 1253 expected: 1254 - man: | 1255 .TH "acpi_os_acquire_lock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1256 .SH NAME 1257 acpi_os_acquire_lock \- Acquire a spinlock. 1258 .SH SYNOPSIS 1259 .B "acpi_cpu_flags" acpi_os_acquire_lock 1260 .BI "(acpi_spinlock lockp " ");" 1261 .SH ARGUMENTS 1262 .IP "lockp" 12 1263 pointer to the spinlock_t. 1264 .SH "SEE ALSO" 1265 .PP 1266 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1267 rst: | 1268 .. c:function:: acpi_cpu_flags acpi_os_acquire_lock (acpi_spinlock lockp) 1269 1270 Acquire a spinlock. 1271 1272 .. container:: kernelindent 1273 1274 **Parameters** 1275 1276 ``acpi_spinlock lockp`` 1277 pointer to the spinlock_t. 1278- name: acpi_os_release_lock 1279 description: mock_tests/kdoc-drop-ctx-lock.c line 172 1280 fname: mock_tests/kdoc-drop-ctx-lock.c 1281 source: | 1282 /** 1283 * acpi_os_release_lock - Release a spinlock. 1284 * @lockp: pointer to the spinlock_t. 1285 * @not_used: these flags are not used. 1286 */ 1287 void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags not_used) 1288 __releases(lockp) 1289 { 1290 expected: 1291 - man: | 1292 .TH "acpi_os_release_lock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1293 .SH NAME 1294 acpi_os_release_lock \- Release a spinlock. 1295 .SH SYNOPSIS 1296 .B "void" acpi_os_release_lock 1297 .BI "(acpi_spinlock lockp " "," 1298 .BI "acpi_cpu_flags not_used " ");" 1299 .SH ARGUMENTS 1300 .IP "lockp" 12 1301 pointer to the spinlock_t. 1302 .IP "not_used" 12 1303 these flags are not used. 1304 .SH "SEE ALSO" 1305 .PP 1306 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1307 rst: | 1308 .. c:function:: void acpi_os_release_lock (acpi_spinlock lockp, acpi_cpu_flags not_used) 1309 1310 Release a spinlock. 1311 1312 .. container:: kernelindent 1313 1314 **Parameters** 1315 1316 ``acpi_spinlock lockp`` 1317 pointer to the spinlock_t. 1318 1319 ``acpi_cpu_flags not_used`` 1320 these flags are not used. 1321- name: tx 1322 description: mock_tests/kdoc-drop-ctx-lock.c line 183 1323 fname: mock_tests/kdoc-drop-ctx-lock.c 1324 source: | 1325 /** 1326 * tx - transmit message ID @id 1327 * @id: message ID to transmit 1328 */ 1329 int tx(int id) __must_hold(&txlock) 1330 { 1331 expected: 1332 - man: | 1333 .TH "tx" 9 "February 2026" "mock_tests" "Kernel API Manual" 1334 .SH NAME 1335 tx \- transmit message ID @id 1336 .SH SYNOPSIS 1337 .B "int" tx 1338 .BI "(int id " ");" 1339 .SH ARGUMENTS 1340 .IP "id" 12 1341 message ID to transmit 1342 .SH "SEE ALSO" 1343 .PP 1344 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1345 rst: | 1346 .. c:function:: int tx (int id) 1347 1348 transmit message ID **id** 1349 1350 .. container:: kernelindent 1351 1352 **Parameters** 1353 1354 ``int id`` 1355 message ID to transmit 1356- name: contend_for_bm 1357 description: mock_tests/kdoc-drop-ctx-lock.c line 192 1358 fname: mock_tests/kdoc-drop-ctx-lock.c 1359 source: | 1360 /** 1361 * contend_for_bm - try to become the bus master 1362 * @card: the &fw_card (describes the bus) 1363 */ 1364 enum bm_contention_outcome contend_for_bm(struct fw_card *card) 1365 __must_hold(&card->lock) 1366 { 1367 expected: 1368 - man: | 1369 .TH "contend_for_bm" 9 "February 2026" "mock_tests" "Kernel API Manual" 1370 .SH NAME 1371 contend_for_bm \- try to become the bus master 1372 .SH SYNOPSIS 1373 .B "enum bm_contention_outcome" contend_for_bm 1374 .BI "(struct fw_card *card " ");" 1375 .SH ARGUMENTS 1376 .IP "card" 12 1377 the \fIfw_card\fP (describes the bus) 1378 .SH "SEE ALSO" 1379 .PP 1380 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1381 rst: | 1382 .. c:function:: enum bm_contention_outcome contend_for_bm (struct fw_card *card) 1383 1384 try to become the bus master 1385 1386 .. container:: kernelindent 1387 1388 **Parameters** 1389 1390 ``struct fw_card *card`` 1391 the :c:type:`fw_card` (describes the bus) 1392- name: prepare_report_producer 1393 description: mock_tests/kdoc-drop-ctx-lock.c line 202 1394 fname: mock_tests/kdoc-drop-ctx-lock.c 1395 source: | 1396 /** 1397 * prepare_report_producer - prepare the report producer 1398 * @flags: still flags 1399 * @ai: some AI 1400 * @other_info: Populate @other_info; requires that the provided 1401 * @other_info not in use. 1402 */ 1403 void prepare_report_producer(unsigned long *flags, 1404 const struct access_info *ai, 1405 struct other_info *other_info) 1406 __must_not_hold(&report_lock) 1407 { } 1408 expected: 1409 - man: | 1410 .TH "prepare_report_producer" 9 "February 2026" "mock_tests" "Kernel API Manual" 1411 .SH NAME 1412 prepare_report_producer \- prepare the report producer 1413 .SH SYNOPSIS 1414 .B "void" prepare_report_producer 1415 .BI "(unsigned long *flags " "," 1416 .BI "const struct access_info *ai " "," 1417 .BI "struct other_info *other_info " ");" 1418 .SH ARGUMENTS 1419 .IP "flags" 12 1420 still flags 1421 .IP "ai" 12 1422 some AI 1423 .IP "other_info" 12 1424 Populate \fIother_info\fP; requires that the provided 1425 \fIother_info\fP not in use. 1426 .SH "SEE ALSO" 1427 .PP 1428 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1429 rst: | 1430 .. c:function:: void prepare_report_producer (unsigned long *flags, const struct access_info *ai, struct other_info *other_info) 1431 1432 prepare the report producer 1433 1434 .. container:: kernelindent 1435 1436 **Parameters** 1437 1438 ``unsigned long *flags`` 1439 still flags 1440 1441 ``const struct access_info *ai`` 1442 some AI 1443 1444 ``struct other_info *other_info`` 1445 Populate **other_info**; requires that the provided 1446 **other_info** not in use. 1447- name: crypto_alg_lookup 1448 description: mock_tests/kdoc-drop-ctx-lock.c line 215 1449 fname: mock_tests/kdoc-drop-ctx-lock.c 1450 source: | 1451 /** 1452 * __crypto_alg_lookup() - lookup the algorithm by name/type/mask 1453 * @name: name to search for 1454 * @type: type to search for 1455 * @mask: mask to match 1456 */ 1457 struct crypto_alg *__crypto_alg_lookup(const char *name, u32 type, 1458 u32 mask) 1459 __must_hold_shared(&crypto_alg_sem) 1460 { 1461 expected: 1462 - man: | 1463 .TH "__crypto_alg_lookup" 9 "February 2026" "mock_tests" "Kernel API Manual" 1464 .SH NAME 1465 __crypto_alg_lookup \- lookup the algorithm by name/type/mask 1466 .SH SYNOPSIS 1467 .B "struct crypto_alg *" __crypto_alg_lookup 1468 .BI "(const char *name " "," 1469 .BI "u32 type " "," 1470 .BI "u32 mask " ");" 1471 .SH ARGUMENTS 1472 .IP "name" 12 1473 name to search for 1474 .IP "type" 12 1475 type to search for 1476 .IP "mask" 12 1477 mask to match 1478 .SH "SEE ALSO" 1479 .PP 1480 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1481 rst: | 1482 .. c:function:: struct crypto_alg * __crypto_alg_lookup (const char *name, u32 type, u32 mask) 1483 1484 lookup the algorithm by name/type/mask 1485 1486 .. container:: kernelindent 1487 1488 **Parameters** 1489 1490 ``const char *name`` 1491 name to search for 1492 1493 ``u32 type`` 1494 type to search for 1495 1496 ``u32 mask`` 1497 mask to match 1498- name: down_read_trylock 1499 description: mock_tests/kdoc-drop-ctx-lock.c line 228 1500 fname: mock_tests/kdoc-drop-ctx-lock.c 1501 source: | 1502 /** 1503 * down_read_trylock - trylock for reading 1504 * @sem: the semaphore to try to lock 1505 * 1506 * Returns: 1 if successful, 0 if contention 1507 */ 1508 extern int down_read_trylock(struct rw_semaphore *sem) __cond_acquires_shared(true, sem); 1509 expected: 1510 - man: | 1511 .TH "down_read_trylock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1512 .SH NAME 1513 down_read_trylock \- trylock for reading 1514 .SH SYNOPSIS 1515 .B "int" down_read_trylock 1516 .BI "(struct rw_semaphore *sem " ");" 1517 .SH ARGUMENTS 1518 .IP "sem" 12 1519 the semaphore to try to lock 1520 .SH "RETURN" 1521 1 if successful, 0 if contention 1522 .SH "SEE ALSO" 1523 .PP 1524 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1525 rst: | 1526 .. c:function:: int down_read_trylock (struct rw_semaphore *sem) 1527 1528 trylock for reading 1529 1530 .. container:: kernelindent 1531 1532 **Parameters** 1533 1534 ``struct rw_semaphore *sem`` 1535 the semaphore to try to lock 1536 1537 **Return** 1538 1539 1 if successful, 0 if contention 1540- name: tomoyo_read_lock 1541 description: mock_tests/kdoc-drop-ctx-lock.c line 236 1542 fname: mock_tests/kdoc-drop-ctx-lock.c 1543 source: | 1544 /** 1545 * tomoyo_read_lock - Take lock for protecting policy. 1546 * 1547 * Returns: index number for tomoyo_read_unlock(). 1548 */ 1549 int tomoyo_read_lock(void) 1550 __acquires_shared(&tomoyo_ss) 1551 { 1552 expected: 1553 - man: | 1554 .TH "tomoyo_read_lock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1555 .SH NAME 1556 tomoyo_read_lock \- Take lock for protecting policy. 1557 .SH SYNOPSIS 1558 .B "int" tomoyo_read_lock 1559 .BI "(void " ");" 1560 .SH ARGUMENTS 1561 .IP "void" 12 1562 no arguments 1563 .SH "RETURN" 1564 index number for \fBtomoyo_read_unlock\fP. 1565 .SH "SEE ALSO" 1566 .PP 1567 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1568 rst: | 1569 .. c:function:: int tomoyo_read_lock (void) 1570 1571 Take lock for protecting policy. 1572 1573 .. container:: kernelindent 1574 1575 **Parameters** 1576 1577 ``void`` 1578 no arguments 1579 1580 **Return** 1581 1582 index number for tomoyo_read_unlock(). 1583- name: tomoyo_read_unlock 1584 description: mock_tests/kdoc-drop-ctx-lock.c line 247 1585 fname: mock_tests/kdoc-drop-ctx-lock.c 1586 source: | 1587 /** 1588 * tomoyo_read_unlock - Release lock for protecting policy. 1589 * 1590 * @idx: Index number returned by tomoyo_read_lock(). 1591 */ 1592 void tomoyo_read_unlock(int idx) 1593 __releases_shared(&tomoyo_ss) 1594 { } 1595 expected: 1596 - man: | 1597 .TH "tomoyo_read_unlock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1598 .SH NAME 1599 tomoyo_read_unlock \- Release lock for protecting policy. 1600 .SH SYNOPSIS 1601 .B "void" tomoyo_read_unlock 1602 .BI "(int idx " ");" 1603 .SH ARGUMENTS 1604 .IP "idx" 12 1605 Index number returned by \fBtomoyo_read_lock\fP. 1606 .SH "SEE ALSO" 1607 .PP 1608 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1609 rst: | 1610 .. c:function:: void tomoyo_read_unlock (int idx) 1611 1612 Release lock for protecting policy. 1613 1614 .. container:: kernelindent 1615 1616 **Parameters** 1617 1618 ``int idx`` 1619 Index number returned by tomoyo_read_lock(). 1620- name: c_stop 1621 description: mock_tests/kdoc-drop-ctx-lock.c line 256 1622 fname: mock_tests/kdoc-drop-ctx-lock.c 1623 source: | 1624 /** 1625 * c_stop - stop the seq_file iteration 1626 * @m: the &struct seq_file 1627 * @p: handle 1628 */ 1629 void c_stop(struct seq_file *m, void *p) 1630 __releases_shared(&crypto_alg_sem) 1631 { } 1632 expected: 1633 - man: | 1634 .TH "c_stop" 9 "February 2026" "mock_tests" "Kernel API Manual" 1635 .SH NAME 1636 c_stop \- stop the seq_file iteration 1637 .SH SYNOPSIS 1638 .B "void" c_stop 1639 .BI "(struct seq_file *m " "," 1640 .BI "void *p " ");" 1641 .SH ARGUMENTS 1642 .IP "m" 12 1643 the \fIstruct seq_file\fP 1644 .IP "p" 12 1645 handle 1646 .SH "SEE ALSO" 1647 .PP 1648 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1649 rst: | 1650 .. c:function:: void c_stop (struct seq_file *m, void *p) 1651 1652 stop the seq_file iteration 1653 1654 .. container:: kernelindent 1655 1656 **Parameters** 1657 1658 ``struct seq_file *m`` 1659 the :c:type:`struct seq_file <seq_file>` 1660 1661 ``void *p`` 1662 handle 1663- name: spin_lock 1664 description: mock_tests/kdoc-drop-ctx-lock.c line 265 1665 fname: mock_tests/kdoc-drop-ctx-lock.c 1666 source: | 1667 /** 1668 * spin_lock - spin until the @lock is acquired 1669 * @lock: the spinlock 1670 */ 1671 void spin_lock(spinlock_t *lock) 1672 __acquires(lock) __no_context_analysis 1673 { } 1674 expected: 1675 - man: | 1676 .TH "spin_lock" 9 "February 2026" "mock_tests" "Kernel API Manual" 1677 .SH NAME 1678 spin_lock \- spin until the @lock is acquired 1679 .SH SYNOPSIS 1680 .B "void" spin_lock 1681 .BI "(spinlock_t *lock " ");" 1682 .SH ARGUMENTS 1683 .IP "lock" 12 1684 the spinlock 1685 .SH "SEE ALSO" 1686 .PP 1687 Kernel file \fBmock_tests/kdoc-drop-ctx-lock.c\fR 1688 rst: | 1689 .. c:function:: void spin_lock (spinlock_t *lock) 1690 1691 spin until the **lock** is acquired 1692 1693 .. container:: kernelindent 1694 1695 **Parameters** 1696 1697 ``spinlock_t *lock`` 1698 the spinlock 1699