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.

nbd_ioctl.c 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2018 The strace developers.
  3. * All rights reserved.
  4. *
  5. * SPDX-License-Identifier: LGPL-2.1-or-later
  6. */
  7. #include "defs.h"
  8. #include "print_fields.h"
  9. #include <linux/ioctl.h>
  10. #include <linux/types.h>
  11. #include <linux/nbd.h>
  12. #define XLAT_MACROS_ONLY
  13. #include "xlat/nbd_ioctl_cmds.h"
  14. #undef XLAT_MACROS_ONLY
  15. #include "xlat/nbd_ioctl_flags.h"
  16. int
  17. nbd_ioctl(struct tcb *const tcp, const unsigned int code,
  18. const kernel_ulong_t arg)
  19. {
  20. switch (code) {
  21. case NBD_DISCONNECT:
  22. case NBD_CLEAR_SOCK:
  23. case NBD_DO_IT:
  24. case NBD_CLEAR_QUE:
  25. case NBD_PRINT_DEBUG:
  26. return RVAL_IOCTL_DECODED;
  27. case NBD_SET_SOCK:
  28. tprints(", ");
  29. printfd(tcp, arg);
  30. return RVAL_IOCTL_DECODED;
  31. case NBD_SET_BLKSIZE:
  32. case NBD_SET_SIZE:
  33. case NBD_SET_SIZE_BLOCKS:
  34. case NBD_SET_TIMEOUT:
  35. tprints(", ");
  36. tprintf("%" PRI_klu, arg);
  37. return RVAL_IOCTL_DECODED;
  38. case NBD_SET_FLAGS:
  39. tprints(", ");
  40. printflags(nbd_ioctl_flags, arg, "NBD_IOC_FLAG_???");
  41. return RVAL_IOCTL_DECODED;
  42. default:
  43. return RVAL_DECODED;
  44. }
  45. }