Submit fgetxattr request. */
| 61 | |
| 62 | /* Submit fgetxattr request. */ |
| 63 | static int io_uring_fgetxattr(struct io_uring *ring, int fd, const char *name, |
| 64 | void *value, size_t size) |
| 65 | { |
| 66 | struct io_uring_sqe *sqe; |
| 67 | struct io_uring_cqe *cqe; |
| 68 | int ret; |
| 69 | |
| 70 | sqe = io_uring_get_sqe(ring); |
| 71 | if (!sqe) { |
| 72 | fprintf(stderr, "Error cannot get sqe\n"); |
| 73 | return -1; |
| 74 | } |
| 75 | |
| 76 | io_uring_prep_fgetxattr(sqe, fd, name, value, size); |
| 77 | |
| 78 | ret = io_uring_submit(ring); |
| 79 | if (ret != 1) { |
| 80 | fprintf(stderr, "Error io_uring_submit_and_wait: ret=%d\n", ret); |
| 81 | return -1; |
| 82 | } |
| 83 | |
| 84 | ret = io_uring_wait_cqe(ring, &cqe); |
| 85 | if (ret) { |
| 86 | fprintf(stderr, "Error io_uring_wait_cqe: ret=%d\n", ret); |
| 87 | return -1; |
| 88 | } |
| 89 | |
| 90 | ret = cqe->res; |
| 91 | if (ret == -1) { |
| 92 | fprintf(stderr, "Error couldn'tget value\n"); |
| 93 | return -1; |
| 94 | } |
| 95 | |
| 96 | io_uring_cqe_seen(ring, cqe); |
| 97 | return ret; |
| 98 | } |
| 99 | |
| 100 | /* Call setxattr. */ |
| 101 | static int io_uring_setxattr(struct io_uring *ring, const char *path, |