|
| 1 | +# Copyright 2026 syzkaller project authors. All rights reserved. |
| 2 | +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. |
| 3 | + |
| 4 | +include <uapi/linux/nilfs2_ondisk.h> |
| 5 | +include <uapi/linux/nilfs2_api.h> |
| 6 | + |
| 7 | +define NILFS_VDESC_SIZE sizeof(struct nilfs_vdesc) |
| 8 | +define NILFS_PERIOD_SIZE sizeof(struct nilfs_period) |
| 9 | +define NILFS_BDESC_SIZE sizeof(struct nilfs_bdesc) |
| 10 | +define NILFS_CPINFO_SIZE sizeof(struct nilfs_cpinfo) |
| 11 | +define NILFS_SUINFO_SIZE sizeof(struct nilfs_suinfo) |
| 12 | +define NILFS_SUINFO_UPDATE_SIZE sizeof(struct nilfs_suinfo_update) |
| 13 | +define NILFS_VINFO_SIZE sizeof(struct nilfs_vinfo) |
| 14 | + |
| 15 | +ioctl$NILFS_IOCTL_CHANGE_CPMODE(fd fd, cmd const[NILFS_IOCTL_CHANGE_CPMODE], arg ptr[in, nilfs_cpmode]) |
| 16 | +ioctl$NILFS_IOCTL_DELETE_CHECKPOINT(fd fd, cmd const[NILFS_IOCTL_DELETE_CHECKPOINT], arg ptr[in, int64]) |
| 17 | +ioctl$NILFS_IOCTL_GET_CPINFO(fd fd, cmd const[NILFS_IOCTL_GET_CPINFO], arg ptr[inout, nilfs_argv_cpinfo]) |
| 18 | +ioctl$NILFS_IOCTL_GET_CPSTAT(fd fd, cmd const[NILFS_IOCTL_GET_CPSTAT], arg ptr[out, nilfs_cpstat]) |
| 19 | +ioctl$NILFS_IOCTL_GET_SUINFO(fd fd, cmd const[NILFS_IOCTL_GET_SUINFO], arg ptr[inout, nilfs_argv_typed[nilfs_suinfo, inout, NILFS_SUINFO_SIZE]]) |
| 20 | +ioctl$NILFS_IOCTL_SET_SUINFO(fd fd, cmd const[NILFS_IOCTL_SET_SUINFO], arg ptr[in, nilfs_argv_typed[nilfs_suinfo_update, in, NILFS_SUINFO_UPDATE_SIZE]]) |
| 21 | +ioctl$NILFS_IOCTL_GET_SUSTAT(fd fd, cmd const[NILFS_IOCTL_GET_SUSTAT], arg ptr[out, nilfs_sustat]) |
| 22 | +ioctl$NILFS_IOCTL_GET_VINFO(fd fd, cmd const[NILFS_IOCTL_GET_VINFO], arg ptr[inout, nilfs_argv_typed[nilfs_vinfo, inout, NILFS_VINFO_SIZE]]) |
| 23 | +ioctl$NILFS_IOCTL_GET_BDESCS(fd fd, cmd const[NILFS_IOCTL_GET_BDESCS], arg ptr[inout, nilfs_argv_typed[nilfs_bdesc, inout, NILFS_BDESC_SIZE]]) |
| 24 | +ioctl$NILFS_IOCTL_CLEAN_SEGMENTS(fd fd, cmd const[NILFS_IOCTL_CLEAN_SEGMENTS], arg ptr[in, nilfs_ioctl_clean_segments_args]) |
| 25 | +ioctl$NILFS_IOCTL_SYNC(fd fd, cmd const[NILFS_IOCTL_SYNC], arg ptr[out, int64, opt]) |
| 26 | +ioctl$NILFS_IOCTL_RESIZE(fd fd, cmd const[NILFS_IOCTL_RESIZE], arg ptr[in, int64]) |
| 27 | +ioctl$NILFS_IOCTL_SET_ALLOC_RANGE(fd fd, cmd const[NILFS_IOCTL_SET_ALLOC_RANGE], arg ptr[in, array[int64, 2]]) |
| 28 | + |
| 29 | +nilfs_checkpoint_mode = NILFS_CHECKPOINT, NILFS_SNAPSHOT |
| 30 | +nilfs_suinfo_flags = NILFS_SUINFO_ACTIVE, NILFS_SUINFO_DIRTY, NILFS_SUINFO_ERROR |
| 31 | +nilfs_suinfo_update_flags = NILFS_SUINFO_UPDATE_LASTMOD, NILFS_SUINFO_UPDATE_NBLOCKS, NILFS_SUINFO_UPDATE_FLAGS |
| 32 | +nilfs_cpinfo_flags = NILFS_CPINFO_SNAPSHOT, NILFS_CPINFO_INVALID, NILFS_CPINFO_SKETCH, NILFS_CPINFO_MINOR |
| 33 | + |
| 34 | +nilfs_cpmode { |
| 35 | + cm_cno int64 |
| 36 | + cm_mode flags[nilfs_checkpoint_mode, int32] |
| 37 | + cm_pad const[0, int32] |
| 38 | +} |
| 39 | + |
| 40 | +nilfs_argv_cpinfo { |
| 41 | + v_base ptr[inout, array[nilfs_cpinfo]] |
| 42 | + v_nmembs len[v_base, int32] |
| 43 | + v_size const[NILFS_CPINFO_SIZE, int16] |
| 44 | + v_flags flags[nilfs_checkpoint_mode, int16] |
| 45 | + v_index int64 |
| 46 | +} |
| 47 | + |
| 48 | +nilfs_cpstat { |
| 49 | + cs_cno int64 |
| 50 | + cs_ncps int64 |
| 51 | + cs_nsss int64 |
| 52 | +} |
| 53 | + |
| 54 | +nilfs_suinfo { |
| 55 | + sui_lastmod int64 |
| 56 | + sui_nblocks int32 |
| 57 | + sui_flags flags[nilfs_suinfo_flags, int32] |
| 58 | +} |
| 59 | + |
| 60 | +nilfs_suinfo_update { |
| 61 | + sup_segnum int64 |
| 62 | + sup_flags flags[nilfs_suinfo_update_flags, int32] |
| 63 | + sup_reserved const[0, int32] |
| 64 | + sup_sui nilfs_suinfo |
| 65 | +} |
| 66 | + |
| 67 | +nilfs_sustat { |
| 68 | + ss_nsegs int64 |
| 69 | + ss_ncleansegs int64 |
| 70 | + ss_ndirtysegs int64 |
| 71 | + ss_ctime int64 |
| 72 | + ss_nongc_ctime int64 |
| 73 | + ss_prot_seq int64 |
| 74 | +} |
| 75 | + |
| 76 | +nilfs_vinfo { |
| 77 | + vi_vblocknr int64 |
| 78 | + vi_start int64 |
| 79 | + vi_end int64 |
| 80 | + vi_blocknr int64 |
| 81 | +} |
| 82 | + |
| 83 | +nilfs_bdesc { |
| 84 | + bd_ino int64 |
| 85 | + bd_oblocknr int64 |
| 86 | + bd_blocknr int64 |
| 87 | + bd_offset int64 |
| 88 | + bd_level int32 |
| 89 | + bd_pad const[0, int32] |
| 90 | +} |
| 91 | + |
| 92 | +nilfs_ioctl_clean_segments_args { |
| 93 | + argv0 nilfs_argv_typed[nilfs_vdesc, in, NILFS_VDESC_SIZE] |
| 94 | + argv1 nilfs_argv_typed[nilfs_period, in, NILFS_PERIOD_SIZE] |
| 95 | + argv2 nilfs_argv_typed[int64, in, 8] |
| 96 | + argv3 nilfs_argv_typed[nilfs_bdesc, in, NILFS_BDESC_SIZE] |
| 97 | + argv4 nilfs_argv_typed[int64, in, 8] |
| 98 | +} |
| 99 | + |
| 100 | +nilfs_vdesc { |
| 101 | + vd_ino int64 |
| 102 | + vd_cno int64 |
| 103 | + vd_vblocknr int64 |
| 104 | + vd_period nilfs_period |
| 105 | + vd_blocknr int64 |
| 106 | + vd_offset int64 |
| 107 | + vd_flags int32 |
| 108 | + vd_pad const[0, int32] |
| 109 | +} |
| 110 | + |
| 111 | +nilfs_period { |
| 112 | + p_start int64 |
| 113 | + p_end int64 |
| 114 | +} |
| 115 | + |
| 116 | +nilfs_cpinfo { |
| 117 | + ci_flags flags[nilfs_cpinfo_flags, int32] |
| 118 | + ci_pad const[0, int32] |
| 119 | + ci_cno int64 |
| 120 | + ci_create int64 |
| 121 | + ci_nblk_inc int64 |
| 122 | + ci_inodes_count int64 |
| 123 | + ci_blocks_count int64 |
| 124 | + ci_next int64 |
| 125 | +} |
| 126 | + |
| 127 | +type nilfs_argv_typed[T, DIR, SIZE] { |
| 128 | + v_base ptr[DIR, array[T]] |
| 129 | + v_nmembs len[v_base, int32] |
| 130 | + v_size const[SIZE, int16] |
| 131 | + v_flags int16 |
| 132 | + v_index int64 |
| 133 | +} |
0 commit comments