Sha256: 27773ec23de7df4f58d9bb30111567c2f812c02b9c3f694e4f1b86c2f2dc7672

Contents?: true

Size: 881 Bytes

Versions: 3

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

require 'ffi'

module FFI
  # Calculate major/minor device numbers for use with mknod etc..
  # @see makedev(3)
  module Device
    extend FFI::Library
    ffi_lib FFI::Library::LIBC

    prefix = FFI::Platform::IS_GNU ? 'gnu_dev_' : ''

    # @!method makedev(major,minor)
    #  @param [Integer] major
    #  @param [Integer] minor
    #  @return [Integer] combined major/minor to a single value to pass to mknod etc
    attach_function :makedev, "#{prefix}makedev".to_sym, %i[int int], :int

    # @!method major(dev)
    #  @param [Integer] dev
    #  @return [Integer] the major component of dev
    attach_function :major, "#{prefix}major".to_sym, [:int], :int

    # @!method minor(dev)
    #  @param [Integer] dev
    #  @return [Integer] the minor component of dev
    attach_function :minor, "#{prefix}minor".to_sym, [:int], :int
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffi-libfuse-0.0.1.rctest12 lib/ffi/devt.rb
ffi-libfuse-0.0.1.rctest11 lib/ffi/devt.rb
ffi-libfuse-0.0.1.pre lib/ffi/devt.rb