mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Make btrfs call same interface as others
Most storage drivers call graphdriver.GetFSMagic(home), it is more clean to easy to maintain. So btrfs need to adopt such change. Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
This commit is contained in:
parent
40ce2574b4
commit
feda5d7684
1 changed files with 3 additions and 4 deletions
|
@ -31,14 +31,13 @@ func init() {
|
||||||
// Init returns a new BTRFS driver.
|
// Init returns a new BTRFS driver.
|
||||||
// An error is returned if BTRFS is not supported.
|
// An error is returned if BTRFS is not supported.
|
||||||
func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
|
func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
|
||||||
rootdir := path.Dir(home)
|
|
||||||
|
|
||||||
var buf syscall.Statfs_t
|
fsMagic, err := graphdriver.GetFSMagic(home)
|
||||||
if err := syscall.Statfs(rootdir, &buf); err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if graphdriver.FsMagic(buf.Type) != graphdriver.FsMagicBtrfs {
|
if fsMagic != graphdriver.FsMagicBtrfs {
|
||||||
return nil, graphdriver.ErrPrerequisites
|
return nil, graphdriver.ErrPrerequisites
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue