Commit Graph

29 Commits

Author SHA1 Message Date
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
9050affe7c Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.

* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 01:59:08 +00:00
7ac5286986 btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t
* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
5615c15036 btrfs: change address argument type from unsigned long to kernel_ureg_t
* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
from unsigned long to kernel_ureg_t.
2016-12-23 19:26:57 +00:00
8afd294eb3 btrfs: cast pointers to kernel_ureg_t instead of unsigned long
* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
cabcca717a btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
* block.c (btrfs_ioctl): Print size and transid fields
of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.
2016-12-19 19:58:16 +00:00
cce5aaef1e Use tprints instead of tprintf in a few more places
* btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search,
btrfs_ioctl): Replace tprintf with tprints for printing strings without
format specifiers.
* net.c (print_group_req): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* term.c (decode_termios, decode_termio): Likewise.
* userfaultfd.c (uffdio_ioctl): Likewise.
2016-10-02 19:19:28 +00:00
e7d3d645ae btrfs: mpersify struct btrfs_ioctl_vol_args_v2
This complements commit v4.11-719-gfb0c609.

* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
struct_btrfs_ioctl_vol_args_v2.
2016-08-29 15:30:45 +00:00
de5b0092a6 Fix one more code pattern that might break gcc strict aliasing rules
* btrfs.c (btrfs_ioctl): Add one more expicit cast to "void *",
to avoid breaking strict-aliasing rules reported by some gcc compilers.
* syscall.c (decode_socket_subcall): Likewise.
* util.c (next_set_bit): Likewise.
* tests/btrfs.c (btrfs_test_send_ioctl): Likewise.
2016-07-26 16:14:50 +00:00
b759d276d5 Unabuse struct tcb.auxstr
As we've got a proper mechanism that parsers can use for storing private
data between entering and exiting stages, all cases of struct tcb.auxstr
abuse should go.

* btrfs.c (btrfs_ioctl): Use set_tcb_priv_ulong and get_tcb_priv_ulong
instead of abusing tcp->auxstr.
* file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise.
* msghdr.c (SYS_FUNC(recvmsg)): Likewise.
* net.c (decode_sockname, SYS_FUNC(recvfrom)): Likewise.
* v4l2.c (print_v4l2_queryctrl): Likewise.
2016-07-18 22:12:45 +00:00
d4bdff69fc btrfs: fix build with fresh linux/btrfs.h
Fix build with fresh <linux/btrfs.h> that provides a slightly different
definition of struct btrfs_ioctl_defrag_range_args.

* btrfs.c (btrfs_ioctl): Cast "len" member of
struct btrfs_ioctl_defrag_range_args to uint64_t.
* tests/btrfs.c (btrfs_print_defrag_range_args): Cast "start" and "len"
members of struct btrfs_ioctl_defrag_range_args to uint64_t.
2016-06-17 01:06:55 +00:00
fe7a451e5a btrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*
<linux/btrfs.h> was introduced in linux v3.9-rc1 while some
of btrfs ioctls were added later, e.g. BTRFS_IOC_QUOTA_RESCAN
and BTRFS_IOC_QUOTA_RESCAN_STATUS in v3.10-rc2,
or BTRFS_IOC_QUOTA_RESCAN_WAIT in v3.11-rc1.

* btrfs.c [!BTRFS_IOC_QUOTA_RESCAN]
(struct btrfs_ioctl_quota_rescan_args): New structure.
(BTRFS_IOC_QUOTA_RESCAN, BTRFS_IOC_QUOTA_RESCAN_STATUS): New macros.
[!BTRFS_IOC_QUOTA_RESCAN_WAIT] (BTRFS_IOC_QUOTA_RESCAN_WAIT): New macro.
* tests/btrfs.c: Likewise.

Reported-by: Li Er <phoooyb@gmail.com>
2016-06-17 01:06:55 +00:00
Jeff Mahoney
d32d95a87f btrfs.c: don't use print_array in btrfs_print_tree_search
* btrfs.c (btrfs_print_tree_search): Don't use print_array.  The buffer
represents a series of variable sized records, not an array.
2016-05-27 08:53:44 +00:00
Jeff Mahoney
2060d97382 btrfs.c: fix print_array usage in btrfs_print_logical_ino_container
* btrfs.c: (btrfs_print_logical_ino_container) Fix the element count
to reflect the number of records rather than the number of items.
2016-05-27 08:53:30 +00:00
ea516df85e btrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME
* btrfs.c (btrfs_ioctl): Skip BTRFS_IOC_FILE_EXTENT_SAME case
if this constant is not defined.
* tests/btrfs.c (btrfs_test_extent_same_ioctl): Skip this part
of the test if BTRFS_IOC_FILE_EXTENT_SAME is not defined.
2016-05-24 14:52:27 +00:00
6ce6d3be10 btrfs.c: print file descriptors using printfd
* btrfs.c (btrfs_ioctl): Print struct btrfs_ioctl_send_args.send_fd,
struct btrfs_ioctl_vol_args.fd, and struct btrfs_ioctl_vol_args_v2.fd
using printfd.
* tests/btrfs.c (btrfs_print_vol_args_v2, btrfs_test_subvol_ioctls,
btrfs_test_device_ioctls, btrfs_test_clone_ioctls,
btrfs_test_send_ioctl): Update.
2016-05-24 14:52:27 +00:00
fb0c6095f3 Mpersify btrfs.c
* btrfs.c: Mpersify 3 arch-specific structures
and corresponding ioctl numbers.
(btrfs_ioctl): Mpersify.
* defs.h (btrfs_ioctl): Remove.
2016-05-24 14:52:27 +00:00
d57cc26bf0 btrfs.c: use print_array
* btrfs.c (print_btrfs_data_container_logical_ino,
print_btrfs_data_container_ino_path, print_uint64,
print_btrfs_ioctl_search_header, print_objectid_callback,
print_btrfs_ioctl_space_info): New functions.
(btrfs_print_logical_ino_container, btrfs_print_ino_path_container):
Rewrite printers of struct btrfs_data_container.val array
using print_array.
(btrfs_print_qgroup_inherit): Rewrite printer of
struct btrfs_qgroup_inherit.qgroups array using print_array.
(btrfs_print_tree_search): Rewrite printer of
struct btrfs_ioctl_search_header array using print_array.
(btrfs_ioctl): Rewrite printer of
struct btrfs_ioctl_send_args.clone_sources and
struct btrfs_ioctl_space_args.spaces using print_array.
2016-05-24 14:52:27 +00:00
82b9e34e7c btrfs.c: simplify BTRFS_IOC_GET_FSLABEL parser
* btrfs.c (btrfs_ioctl): Share code of parser of BTRFS_IOC_SET_FSLABEL
with parser of BTRFS_IOC_GET_FSLABEL only on BTRFS_IOC_GET_FSLABEL's
entering.
2016-05-24 14:52:27 +00:00
d67b2173a1 btrfs.c: fix BTRFS_IOC_TREE_SEARCH_V2 output
* btrfs.c (btrfs_ioctl): Fix BTRFS_IOC_TREE_SEARCH_V2 output
in case of EOVERFLOW and failed umove.
2016-05-24 14:52:27 +00:00
6638a5d132 btrfs.c: cleanup use of tcp->auxstr
* btrfs.c (btrfs_ioctl): Reset tcp->auxstr only if it is set.
2016-05-24 14:52:27 +00:00
92b90621cc btrfs.c: cleanup struct btrfs_ioctl_get_dev_stats.nr_items check
* btrfs.c (btrfs_ioctl): Cleanup check of iterator of
btrfs_ioctl_get_dev_stats.values array.
2016-05-24 14:52:27 +00:00
0cd7ea0552 btrfs.c: do not use BTRFS_SUBVOL_NAME_MAX
* btrfs.c [BTRFS_SUBVOL_NAME_MAX]: Remove.
(btrfs_ioctl): Use sizeof(struct btrfs_ioctl_vol_args_v2.name)
instead of BTRFS_SUBVOL_NAME_MAX + 1.
2016-05-24 14:52:27 +00:00
b85d09f316 btrfs.c: mark some function arguments as const
* btrfs.c (btrfs_print_balance_args, btrfs_print_features,
btrfs_print_qgroup_limit, btrfs_print_data_container_header,
btrfs_print_logical_ino_container, btrfs_print_ino_path_container,
btrfs_print_qgroup_inherit): Mark some function arguments as const.
2016-05-24 14:52:27 +00:00
90ffbc79b0 btrfs.c: use umove instead of umoven
* btrfs.c: Use umove instead of umoven and umove_or_printaddr
instead of umoven_or_printaddr.
2016-05-24 14:52:27 +00:00
3ce2dfcebb btrfs.c: remove unused variable
* btrfs.c (btrfs_ioctl): Remove "ret" variable.
2016-05-24 14:52:27 +00:00
95577cf9d3 btrfs.c: use printxval/printxval64 instead of printxvals
* btrfs.c (btrfs_ioctl): Do not call printxvals directly,
use printxval/printxval64 wrappers that do the right thing.
2016-05-24 14:52:27 +00:00
2be39ec201 btrfs.c: fix indentation
* btrfs.c: Fix indentation of preprocessor directives and print formats.
2016-05-24 14:52:27 +00:00
Jeff Mahoney
8cc6962216 ioctl: add decoding support for btrfs ioctls
* btrfs.c: New file.
* file_ioctl.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h.
(AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags,
struct btrfs_ioctl_fs_info_args.nodesize,
struct btrfs_ioctl_defrag_range_args.start,
and struct btrfs_ioctl_search_args_v2.buf_size.
(AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums.
* defs.h (btrfs_ioctl, file_ioctl): New prototypes.
* ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl.
* xlat/btrfs_balance_args.in: New file.
* xlat/btrfs_balance_ctl_cmds.in: Likewise.
* xlat/btrfs_balance_flags.in: Likewise.
* xlat/btrfs_balance_state.in: Likewise.
* xlat/btrfs_compress_types.in: Likewise.
* xlat/btrfs_defrag_flags.in: Likewise.
* xlat/btrfs_dev_replace_cmds.in: Likewise.
* xlat/btrfs_dev_replace_results.in: Likewise.
* xlat/btrfs_dev_replace_state.in: Likewise.
* xlat/btrfs_dev_stats_flags.in: Likewise.
* xlat/btrfs_dev_stats_values.in: Likewise.
* xlat/btrfs_features_compat.in: Likewise.
* xlat/btrfs_features_compat_ro.in: Likewise.
* xlat/btrfs_features_incompat.in: Likewise.
* xlat/btrfs_key_types.in: Likewise.
* xlat/btrfs_qgroup_ctl_cmds.in: Likewise.
* xlat/btrfs_qgroup_inherit_flags.in: Likewise.
* xlat/btrfs_qgroup_limit_flags.in: Likewise.
* xlat/btrfs_qgroup_status_flags.in: Likewise.
* xlat/btrfs_scrub_flags.in: Likewise.
* xlat/btrfs_send_flags.in: Likewise.
* xlat/btrfs_snap_flags_v2.in: Likewise.
* xlat/btrfs_space_info_flags.in: Likewise.
* xlat/btrfs_tree_objectids.in: Likewise.
2016-05-24 14:52:27 +00:00