rethtool 0.0.1 → 0.0.2

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
@@ -13,12 +13,12 @@ At present, Rethtool only supports a couple of things:
13
13
 
14
14
  Adding extra SIOCETHTOOL features is relatively straightforward, thanks to
15
15
  cstruct and the base infrastructure already in place, so feel free to have a
16
- hack and pass the results back up.
16
+ hack and send me a patch.
17
17
 
18
18
 
19
19
  == Contributing to rethtool
20
20
 
21
- Send me patches via e-mail, please (mpalmer@hezmatt.org). I might
21
+ Send me patches via e-mail, please (theshed+rethtool@hezmatt.org). I might
22
22
  eventually notice a pull request on github, but e-mail goes straight to my
23
23
  frontal lobe.
24
24
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,3 +1,4 @@
1
+ require 'rethtool'
1
2
  require 'cstruct'
2
3
 
3
4
  class Rethtool::EthtoolCmd < CStruct
@@ -1,6 +1,7 @@
1
+ require 'rethtool'
1
2
  require 'cstruct'
2
3
 
3
4
  class Rethtool::EthtoolValue < CStruct
4
5
  uint32 :cmd
5
- uint32 :data
6
+ uint32 :value
6
7
  end
@@ -1,3 +1,4 @@
1
+ require 'rethtool'
1
2
  require 'rethtool/ethtool_cmd'
2
3
 
3
4
  # All of the settings of a network interface. Ridiculous amounts of
@@ -5,7 +6,11 @@ require 'rethtool/ethtool_cmd'
5
6
  #
6
7
  # Create an instance of this class with the interface name as the only
7
8
  # parameter, then use the available instance methods to get the info you
8
- # seek.
9
+ # seek:
10
+ #
11
+ # if = Rethtool::InterfaceSettings.new("eth0")
12
+ # puts "Current link mode is #{if.current_mode}"
13
+ #
9
14
  class Rethtool::InterfaceSettings
10
15
  Mode = Struct.new(:speed, :duplex, :media)
11
16
 
@@ -31,10 +36,10 @@ class Rethtool::InterfaceSettings
31
36
  # Create a new InterfaceSettings object. Simply pass it the name of the
32
37
  # interface you want to get the settings for.
33
38
  def initialize(interface)
34
- cmd = EthtoolCmd.new
35
- cmd.cmd = REthtool::ETHTOOL_CMD_GSET
39
+ cmd = Rethtool::EthtoolCmd.new
40
+ cmd.cmd = Rethtool::ETHTOOL_CMD_GSET
36
41
 
37
- @data = REthtool.ioctl(interface, cmd)
42
+ @data = Rethtool.ioctl(interface, cmd)
38
43
  end
39
44
 
40
45
  # Return an array of the modes supported by the interface. Returns an
@@ -1,3 +1,4 @@
1
+ require 'rethtool'
1
2
  require 'rethtool/ethtool_value'
2
3
 
3
4
  # Retrieve the current link status of an interface.
@@ -12,17 +13,17 @@ require 'rethtool/ethtool_value'
12
13
  #
13
14
  class Rethtool::LinkStatus
14
15
  def initialize(interface)
15
- cmd = EthtoolValue.new
16
+ cmd = Rethtool::EthtoolValue.new
16
17
  cmd.cmd = Rethtool::ETHTOOL_CMD_GSET
17
18
 
18
- @data = Rethtool.ioctl(interface, cmd).data
19
+ @status = Rethtool.ioctl(interface, cmd).value
19
20
  end
20
21
 
21
- def up?
22
- @data == 1
22
+ def down?
23
+ @status == 0
23
24
  end
24
25
 
25
- def down?
26
- !up?
26
+ def up?
27
+ !down?
27
28
  end
28
29
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rethtool"
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Palmer"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rethtool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Palmer