Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fsconfig.c 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2019 Dmitry V. Levin <ldv@altlinux.org>
  3. * All rights reserved.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. */
  7. #include "defs.h"
  8. #ifdef HAVE_LINUX_MOUNT_H
  9. # include <linux/mount.h>
  10. #endif
  11. #include "xlat/fsconfig_cmds.h"
  12. SYS_FUNC(fsconfig)
  13. {
  14. const int fs_fd = tcp->u_arg[0];
  15. const unsigned int cmd = tcp->u_arg[1];
  16. const kernel_ulong_t key = tcp->u_arg[2];
  17. const kernel_ulong_t value = tcp->u_arg[3];
  18. const int aux = tcp->u_arg[4];
  19. printfd(tcp, fs_fd);
  20. tprints(", ");
  21. printxval(fsconfig_cmds, cmd, "FSCONFIG_???");
  22. tprints(", ");
  23. switch (cmd) {
  24. case FSCONFIG_SET_FLAG:
  25. case FSCONFIG_SET_STRING:
  26. case FSCONFIG_SET_BINARY:
  27. case FSCONFIG_SET_PATH:
  28. case FSCONFIG_SET_PATH_EMPTY:
  29. case FSCONFIG_SET_FD:
  30. printstr_ex(tcp, key, 256, QUOTE_0_TERMINATED);
  31. break;
  32. case FSCONFIG_CMD_CREATE:
  33. case FSCONFIG_CMD_RECONFIGURE:
  34. default:
  35. printaddr(key);
  36. break;
  37. }
  38. tprints(", ");
  39. switch (cmd) {
  40. case FSCONFIG_SET_STRING:
  41. printstr_ex(tcp, value, 256, QUOTE_0_TERMINATED);
  42. break;
  43. case FSCONFIG_SET_PATH:
  44. case FSCONFIG_SET_PATH_EMPTY:
  45. printpath(tcp, value);
  46. break;
  47. case FSCONFIG_SET_BINARY:
  48. if (aux >= 0 && aux <= 1024 * 1024) {
  49. printstr_ex(tcp, value, aux, QUOTE_FORCE_HEX);
  50. break;
  51. }
  52. ATTRIBUTE_FALLTHROUGH;
  53. case FSCONFIG_SET_FLAG:
  54. case FSCONFIG_SET_FD:
  55. case FSCONFIG_CMD_CREATE:
  56. case FSCONFIG_CMD_RECONFIGURE:
  57. default:
  58. printaddr(value);
  59. break;
  60. }
  61. tprints(", ");
  62. switch (cmd) {
  63. case FSCONFIG_SET_PATH:
  64. case FSCONFIG_SET_PATH_EMPTY:
  65. print_dirfd(tcp, aux);
  66. break;
  67. case FSCONFIG_SET_FD:
  68. printfd(tcp, aux);
  69. break;
  70. case FSCONFIG_SET_FLAG:
  71. case FSCONFIG_SET_STRING:
  72. case FSCONFIG_SET_BINARY:
  73. case FSCONFIG_CMD_CREATE:
  74. case FSCONFIG_CMD_RECONFIGURE:
  75. default:
  76. tprintf("%d", aux);
  77. break;
  78. }
  79. return RVAL_DECODED;
  80. }