Skip to content

Commit

Permalink
Merge pull request #9 from well-typed/dcoutts/issue-7
Browse files Browse the repository at this point in the history
Support liburing >= 2.0 && < 2.7
  • Loading branch information
jorisdral authored Mar 20, 2024
2 parents a4b63e0 + 2220ca1 commit 233aba9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,21 @@ jobs:
matrix:
ghc: ["9.2.8", "9.4.8", "9.6.4", "9.8.2"]
cabal: ["3.10.2.1"]
os: [ubuntu-latest]
os: [ubuntu-latest] # ubuntu-latest = ubuntu-22.04
liburing: ["liburing-2.5"]
include:
- ghc: "9.6.4"
cabal: "3.10.2.1"
os: ubuntu-20.04
liburing: "liburing-2.1"
- ghc: "9.6.4"
cabal: "3.10.2.1"
os: ubuntu-20.04
liburing: "liburing-2.5"
- ghc: "9.6.4"
cabal: "3.10.2.1"
os: ubuntu-22.04
liburing: "liburing-2.1"

steps:
- name: Checkout repository
Expand All @@ -48,7 +62,7 @@ jobs:
cd tmp
git clone https://github.com/axboe/liburing.git
cd liburing
git checkout liburing-2.5
git checkout ${{ matrix.liburing }}
./configure --cc=gcc --cxx=g++
make -j$(nproc)
sudo make install
Expand All @@ -73,11 +87,10 @@ jobs:
cache-name: cache-cabal-build
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.liburing }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.liburing }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.liburing }}-${{ env.cache-name }}-
- name: Install cabal dependencies
id: build-dependencies
Expand Down
6 changes: 6 additions & 0 deletions System/IO/BlockIO/URingFFI.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ data {-# CTYPE "liburing.h" "struct io_uring_sqe" #-} URingSQE
foreign import capi unsafe "liburing.h io_uring_get_sqe"
io_uring_get_sqe :: Ptr URing -> IO (Ptr URingSQE)

#ifdef LIBURING_HAVE_DATA64
foreign import capi unsafe "liburing.h io_uring_sqe_set_data64"
io_uring_sqe_set_data :: Ptr URingSQE -> CULong -> IO ()
#else
io_uring_sqe_set_data :: Ptr URingSQE -> CULong -> IO ()
io_uring_sqe_set_data p user_data =
do #{poke struct io_uring_cqe, user_data} p user_data
#endif

foreign import capi unsafe "liburing.h io_uring_prep_read"
io_uring_prep_read :: Ptr URingSQE -> Fd -> Ptr Word8 -> CUInt -> CULong -> IO ()
Expand Down
2 changes: 1 addition & 1 deletion blockio-uring.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ library
, primitive ^>=0.9
, unix ^>=2.8

pkgconfig-depends: liburing
pkgconfig-depends: liburing >= 2.0 && < 2.7
default-language: Haskell2010
ghc-options: -Wall

Expand Down

0 comments on commit 233aba9

Please sign in to comment.