rethtool 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4db6e4f08553fb426f053a306cb165aaa72bdd4b
4
- data.tar.gz: 91cc79990c7f9b4c2e74e36ca66886f7c9d8c1a0
2
+ SHA256:
3
+ metadata.gz: 7c47e7aabb6cba38c95f794a38efa55219bb47498be9af9704b4f5094deafb29
4
+ data.tar.gz: f93529f9a47f384d7c627c75f1229bf8c681dc33516d0211f997d0fa8e8b59db
5
5
  SHA512:
6
- metadata.gz: f15308539e56008091de3c06b2f0b54a6fe6d9defdb817249668b6f5b3414fbe4faa1243878994303fcb27c5dfab0c13075d3e6fd5e1b47c75afe735d8e130bc
7
- data.tar.gz: 8a7775619bcaaa5075df7cb4757b8d2f5a314b2bd96e1a831154b45115611b0c9fc863c8249674a1f547db9930fa7afb2263309ea669c0a3943ed40f7bfb508c
6
+ metadata.gz: e9db1ae33db6e52e63e5ccde81734e98fdd56e4121149dd04eb6c438281822b6067bf1bd2d059f293ae5921b1071747441fa2717b7e1850f6d7a5c251f5e28de
7
+ data.tar.gz: 67583a9ba405c0fc5b8b63db961a1760060aadc76b74f81abf4786e774dac7defee1f884af21079cb22890c94e40bac55f54d0050ca8d184596e5d183639424e
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /pkg
2
+ Gemfile.lock
3
+ /.bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'rake/testtask'
15
+ Rake::TestTask.new(:test) do |test|
16
+ test.libs << 'lib' << 'test'
17
+ test.pattern = 'test/**/test_*.rb'
18
+ test.verbose = true
19
+ end
20
+
21
+ Bundler::GemHelper.install_tasks
22
+
23
+ task :default => :test
24
+
25
+ require 'rdoc/task'
26
+ Rake::RDocTask.new do |rdoc|
27
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
28
+
29
+ rdoc.rdoc_dir = 'rdoc'
30
+ rdoc.title = "rethtool #{version}"
31
+ rdoc.rdoc_files.include('README*')
32
+ rdoc.rdoc_files.include('lib/**/*.rb')
33
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.8
@@ -0,0 +1,36 @@
1
+ require 'rethtool'
2
+ require 'rethtool/ethtool_cmd'
3
+
4
+ # Driver settings of a network interface.
5
+ #
6
+ # Create an instance of this class with the interface name as the only
7
+ # parameter, then use the available instance methods to get the info you
8
+ # seek:
9
+ #
10
+ # if = Rethtool::DriverSettings.new("eth0")
11
+ # puts "Bus info is #{if.bus_info}"
12
+ #
13
+ class Rethtool::DriverSettings
14
+
15
+ # Create a new DriverSettings object. Simply pass it the name of the
16
+ # interface you want to get the settings for.
17
+ def initialize(interface)
18
+ cmd_driver = Rethtool::EthtoolCmdDriver.new
19
+ cmd_driver.cmd = Rethtool::ETHTOOL_CMD_GDRVINFO
20
+ @driver_data = Rethtool.ioctl(interface, cmd_driver)
21
+ end
22
+
23
+ # Returns a string with the value of the interface driver (kernel module).
24
+ def driver
25
+ as_str(@driver_data.driver)
26
+ end
27
+
28
+ # Returns a string with the bus information of the interface.
29
+ def bus_info
30
+ as_str(@driver_data.bus_info)
31
+ end
32
+
33
+ def as_str(str)
34
+ str.pack('c*').delete("\000")
35
+ end
36
+ end
@@ -0,0 +1,69 @@
1
+ require 'rethtool'
2
+ require 'rethtool/ethtool_cmd'
3
+
4
+ class Rethtool::RingSettings
5
+ def initialize(interface)
6
+ @interface = interface
7
+ cmd = Rethtool::EthtoolCmdRing.new
8
+ cmd.cmd = Rethtool::ETHTOOL_CMD_GRINGPARAM
9
+ @data = Rethtool.ioctl(interface, cmd)
10
+ end
11
+
12
+ def rx_max_pending
13
+ @data.rx_max_pending
14
+ end
15
+
16
+ def rx_mini_max_pending
17
+ @data.rx_mini_max_pending
18
+ end
19
+
20
+ def rx_jumbo_max_pending
21
+ @data.rx_jumbo_max_pending
22
+ end
23
+
24
+ def tx_max_pending
25
+ @data.tx_max_pending
26
+ end
27
+
28
+ def rx_pending
29
+ @data.rx_pending
30
+ end
31
+
32
+ def rx_mini_pending
33
+ @data.rx_mini_pending
34
+ end
35
+
36
+ def rx_jumbo_pending
37
+ @data.rx_jumbo_pending
38
+ end
39
+
40
+ def tx_pending
41
+ @data.tx_pending
42
+ end
43
+
44
+ def rx_pending=(value)
45
+ set(:rx_pending, value)
46
+ end
47
+
48
+ def rx_mini_pending=(value)
49
+ set(:rx_mini_pending, value)
50
+ end
51
+
52
+ def rx_jumbo_pending=(value)
53
+ set(:rx_jumbo_pending, value)
54
+ end
55
+
56
+ def tx_pending=(value)
57
+ set(:tx_pending, value)
58
+ end
59
+
60
+ private
61
+
62
+ def set(what, value)
63
+ return if @data.send(what) == value
64
+ cmd = @data.clone
65
+ cmd.cmd = Rethtool::ETHTOOL_CMD_SRINGPARAM
66
+ cmd.send(:"#{what}=", value)
67
+ @data = Rethtool.ioctl(@interface, cmd)
68
+ end
69
+ end
data/rethtool.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "rethtool"
3
+ s.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Matt Palmer"]
7
+ s.date = "2014-01-16"
8
+ s.email = "theshed+rethtool@hezmatt.org"
9
+ s.extra_rdoc_files = [
10
+ "COPYING",
11
+ "README.rdoc"
12
+ ]
13
+ s.files = `git ls-files`.split("\n")
14
+ s.homepage = "https://github.com/mpalmer/rethtool"
15
+ s.licenses = ["GPLv3"]
16
+ s.require_paths = ["lib"]
17
+ s.summary = "Partial Ruby wrapper around the SIOCETHTOOL ioctl"
18
+
19
+ s.add_runtime_dependency(%q<cstruct>, [">= 0"])
20
+ s.add_development_dependency(%q<rake>, ["~> 10.0"])
21
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
22
+ s.add_development_dependency(%q<rdoc>, ["~> 2.4"])
23
+ end
24
+
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'rethtool'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestRethtool < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rethtool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
@@ -74,15 +74,24 @@ extra_rdoc_files:
74
74
  - COPYING
75
75
  - README.rdoc
76
76
  files:
77
+ - ".document"
78
+ - ".gitignore"
77
79
  - COPYING
80
+ - Gemfile
78
81
  - README.rdoc
82
+ - Rakefile
79
83
  - VERSION
80
84
  - lib/rethtool.rb
85
+ - lib/rethtool/driver_settings.rb
81
86
  - lib/rethtool/ethtool_cmd.rb
82
87
  - lib/rethtool/ethtool_value.rb
83
88
  - lib/rethtool/interface_settings.rb
84
89
  - lib/rethtool/link_status.rb
85
- homepage: http://theshed.hezmatt.org/rethtool
90
+ - lib/rethtool/ring_settings.rb
91
+ - rethtool.gemspec
92
+ - test/helper.rb
93
+ - test/test_rethtool.rb
94
+ homepage: https://github.com/mpalmer/rethtool
86
95
  licenses:
87
96
  - GPLv3
88
97
  metadata: {}
@@ -101,9 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
110
  - !ruby/object:Gem::Version
102
111
  version: '0'
103
112
  requirements: []
104
- rubyforge_project:
105
- rubygems_version: 2.2.2
113
+ rubygems_version: 3.2.5
106
114
  signing_key:
107
- specification_version: 3
115
+ specification_version: 4
108
116
  summary: Partial Ruby wrapper around the SIOCETHTOOL ioctl
109
117
  test_files: []