| Kelvin Zhang | 1bd2e5b | 2022-10-03 12:02:34 -0700 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2022 The Android Open Source Project | 
|  | 3 | // | 
|  | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | // you may not use this file except in compliance with the License. | 
|  | 6 | // You may obtain a copy of the License at | 
|  | 7 | // | 
|  | 8 | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | // | 
|  | 10 | // Unless required by applicable law or agreed to in writing, software | 
|  | 11 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | // See the License for the specific language governing permissions and | 
|  | 14 | // limitations under the License. | 
|  | 15 | // | 
|  | 16 |  | 
|  | 17 | #include <liburing_cpp/IoUringSQE.h> | 
|  | 18 |  | 
|  | 19 | #include <cstdint> | 
|  | 20 |  | 
|  | 21 | #include "liburing.h" | 
|  | 22 |  | 
|  | 23 | namespace io_uring_cpp { | 
|  | 24 |  | 
|  | 25 | IoUringSQE &IoUringSQE::SetFlags(unsigned int flags) { | 
|  | 26 | if (IsOk()) { | 
|  | 27 | ::io_uring_sqe_set_flags(static_cast<struct io_uring_sqe *>(sqe), flags); | 
|  | 28 | } | 
|  | 29 | return *this; | 
|  | 30 | } | 
|  | 31 |  | 
|  | 32 | IoUringSQE &IoUringSQE::SetData(uint64_t data) { | 
|  | 33 | if (IsOk()) { | 
|  | 34 | ::io_uring_sqe_set_data(static_cast<struct io_uring_sqe *>(sqe), | 
|  | 35 | reinterpret_cast<void *>(data)); | 
|  | 36 | } | 
|  | 37 | return *this; | 
|  | 38 | } | 
|  | 39 |  | 
|  | 40 | }  // namespace io_uring_cpp |