2014-04-19 04:55:06 +00:00
|
|
|
package fs
|
|
|
|
|
|
|
|
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-22 20:50:51 +00:00
|
|
|
func (s *devicesGroup) Stats(d *data) (map[string]int64, error) {
|
2014-04-20 19:02:39 +00:00
|
|
|
return nil, ErrNotSupportStat
|
|
|
|
}
|