[PATCH 0/3 v2] Add btrfs ioctl support

Jeff Mahoney jeffm at suse.com
Thu Apr 28 15:28:53 UTC 2016


On 4/28/16 11:26 AM, Jeff Mahoney wrote:
> Hi all -

Bad $SUBJECT.  This is v3.

-Jeff

> This short series adds support for the btrfs ioctls.  Its structures
> make heavy use of __u64 so rather than cast every single member, I added
> new PRI* macros to print them properly.  It also uses 64-bit flags and
> defines values that are larger than can be described by a 32-bit
> variable, so I've converted xlat to use a 64-bit val field internally
> and added 64-bit versions to API functions as needed.
> 
> Thanks, Dmitry, for the review.
> 
> Changes since v2:
> - Use print_quoted_string to print strings from the user
> - Many corrections of output text
> - Load elements in user-sized arrays individually to avoid arbitrary
>   user-specified memory allocations
> - Don't print arrays with user defined lengths in abbrev mode
> - Only print max_strlen elements in arrays in verbose mode
> - Added new ioctls added in the Linux 4.6 cycle
> - Added file_ioctl.c to contain generic file ioctls
>   - BTRFS_IOC_CLONE -> FICLONE
>   - BTRFS_IOC_CLONE_RANGE -> FICLONERANGE
>   - BTRFS_IOC_FILE_EXTENT_SAME -> FIDEDUPERANGE
> - Proper printing of flags when none are set
> - Broke out complex printing into separate routines
> - Use "UINT64_MAX" instead of "-1" to print -1ULL for objectids
> 
> Changes since v1:
> - Change addflags, printflags, and sprintflags to use unsigned int vals.
> - Introduce 64-bit variants for all three.
> - Convert all three to wrappers around the 64-bit versions
> - Use pointers to uint64_ts instead of casting ints for bsearch
> - Use SIZEOF_LONG instead of BITS_PER_LONG
> - Fix missing comma for ioctls that return a signed int value
> - Don't test for exiting(tcp) if we've already returned a nonzero value
>   in entering mode
> - Use stdint types when defining structs
> - Don't define separate macros for testing structs
> - Add UUID_STRING_SIZE macro
> - Don't test for error if umove* will be called immediately afterward
> - Various style fixes
> - Don't assume btrfs.h will be available
> 
> Thanks,
> 
> -Jeff
> 
> Jeff Mahoney (3):
>   util: change type of struct xlat.val to uint64_t
>   defs: define PRI__[uxs]64 to print __[su]64 values
>   Add btrfs ioctl support.
> 
>  Makefile.am                        |    1 +
>  btrfs.c                            | 1219 ++++++++++++++++++++++++++++++++++++
>  configure.ac                       |    8 +
>  defs.h                             |   38 +-
>  ioctl.c                            |    4 +
>  util.c                             |   46 +-
>  xlat/btrfs_balance_flags.in        |   12 +
>  xlat/btrfs_defrag_flags.in         |    2 +
>  xlat/btrfs_dev_replace_cmds.in     |    3 +
>  xlat/btrfs_dev_replace_results.in  |    4 +
>  xlat/btrfs_dev_replace_state.in    |    5 +
>  xlat/btrfs_dev_stats_flags.in      |    1 +
>  xlat/btrfs_dev_stats_values.in     |   11 +
>  xlat/btrfs_features_compat.in      |    0
>  xlat/btrfs_features_compat_ro.in   |    1 +
>  xlat/btrfs_features_incompat.in    |   10 +
>  xlat/btrfs_key_types.in            |   40 ++
>  xlat/btrfs_qgroup_ctl_cmds.in      |    3 +
>  xlat/btrfs_qgroup_inherit_flags.in |    1 +
>  xlat/btrfs_qgroup_limit_flags.in   |    6 +
>  xlat/btrfs_qgroup_status_flags.in  |    2 +
>  xlat/btrfs_scrub_flags.in          |    1 +
>  xlat/btrfs_snap_flags_v2.in        |    3 +
>  xlat/btrfs_space_info_flags.in     |   11 +
>  xlat/btrfs_tree_objectids.in       |   12 +
>  25 files changed, 1423 insertions(+), 21 deletions(-)
>  create mode 100644 btrfs.c
>  create mode 100644 xlat/btrfs_balance_flags.in
>  create mode 100644 xlat/btrfs_defrag_flags.in
>  create mode 100644 xlat/btrfs_dev_replace_cmds.in
>  create mode 100644 xlat/btrfs_dev_replace_results.in
>  create mode 100644 xlat/btrfs_dev_replace_state.in
>  create mode 100644 xlat/btrfs_dev_stats_flags.in
>  create mode 100644 xlat/btrfs_dev_stats_values.in
>  create mode 100644 xlat/btrfs_features_compat.in
>  create mode 100644 xlat/btrfs_features_compat_ro.in
>  create mode 100644 xlat/btrfs_features_incompat.in
>  create mode 100644 xlat/btrfs_key_types.in
>  create mode 100644 xlat/btrfs_qgroup_ctl_cmds.in
>  create mode 100644 xlat/btrfs_qgroup_inherit_flags.in
>  create mode 100644 xlat/btrfs_qgroup_limit_flags.in
>  create mode 100644 xlat/btrfs_qgroup_status_flags.in
>  create mode 100644 xlat/btrfs_scrub_flags.in
>  create mode 100644 xlat/btrfs_snap_flags_v2.in
>  create mode 100644 xlat/btrfs_space_info_flags.in
>  create mode 100644 xlat/btrfs_tree_objectids.in
> 


-- 
Jeff Mahoney
SUSE Labs

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: OpenPGP digital signature
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160428/06ee95c2/attachment.bin>


More information about the Strace-devel mailing list