2014-04-19 04:55:06 +00:00
|
|
|
package fs
|
|
|
|
|
2014-05-28 00:01:08 +00:00
|
|
|
import "github.com/dotcloud/docker/pkg/libcontainer/cgroups"
|
|
|
|
|
2014-04-19 04:55:06 +00:00
|
|
|
type devicesGroup struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *devicesGroup) Set(d *data) error {
|
|
|
|
dir, err := d.join("devices")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2014-02-17 23:14:30 +00:00
|
|
|
if !d.c.AllowAllDevices {
|
2014-04-19 04:55:06 +00:00
|
|
|
if err := writeFile(dir, "devices.deny", "a"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2014-02-17 23:14:30 +00:00
|
|
|
for _, dev := range d.c.AllowedDevices {
|
|
|
|
if err := writeFile(dir, "devices.allow", dev.GetCgroupAllowString()); err != nil {
|
2014-04-19 04:55:06 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2014-04-19 05:17:31 +00:00
|
|
|
|
|
|
|
func (s *devicesGroup) Remove(d *data) error {
|
|
|
|
return removePath(d.path("devices"))
|
|
|
|
}
|
2014-04-20 19:02:39 +00:00
|
|
|
|
2014-05-28 00:01:08 +00:00
|
|
|
func (s *devicesGroup) GetStats(d *data, stats *cgroups.Stats) error {
|
|
|
|
return nil
|
2014-04-20 19:02:39 +00:00
|
|
|
}
|