filesystem: rename getMountInfo() to loadMountInfo()
Make it clearer that this function loads data into global data
structures, and doesn't return anything.
Eric Biggers
4 years ago
56 | 56 | uuidDirectory = "/dev/disk/by-uuid" |
57 | 57 | ) |
58 | 58 | |
59 | // getMountInfo populates the Mount mappings by parsing the filesystem | |
59 | // loadMountInfo populates the Mount mappings by parsing the filesystem | |
60 | 60 | // description file using the getmntent functions. Returns ErrBadLoad if the |
61 | 61 | // Mount mappings cannot be populated. |
62 | func getMountInfo() error { | |
62 | func loadMountInfo() error { | |
63 | 63 | if mountsInitialized { |
64 | 64 | return nil |
65 | 65 | } |
121 | 121 | func AllFilesystems() ([]*Mount, error) { |
122 | 122 | mountMutex.Lock() |
123 | 123 | defer mountMutex.Unlock() |
124 | if err := getMountInfo(); err != nil { | |
124 | if err := loadMountInfo(); err != nil { | |
125 | 125 | return nil, err |
126 | 126 | } |
127 | 127 | |
140 | 140 | mountMutex.Lock() |
141 | 141 | defer mountMutex.Unlock() |
142 | 142 | mountsInitialized = false |
143 | return getMountInfo() | |
143 | return loadMountInfo() | |
144 | 144 | } |
145 | 145 | |
146 | 146 | // FindMount returns the corresponding Mount object for some path in a |
157 | 157 | |
158 | 158 | mountMutex.Lock() |
159 | 159 | defer mountMutex.Unlock() |
160 | if err = getMountInfo(); err != nil { | |
160 | if err = loadMountInfo(); err != nil { | |
161 | 161 | return nil, err |
162 | 162 | } |
163 | 163 | |
188 | 188 | |
189 | 189 | mountMutex.Lock() |
190 | 190 | defer mountMutex.Unlock() |
191 | if err = getMountInfo(); err != nil { | |
191 | if err = loadMountInfo(); err != nil { | |
192 | 192 | return nil, err |
193 | 193 | } |
194 | 194 | |
231 | 231 | // Lookup mountpoints for device in global store |
232 | 232 | mountMutex.Lock() |
233 | 233 | defer mountMutex.Unlock() |
234 | if err := getMountInfo(); err != nil { | |
234 | if err := loadMountInfo(); err != nil { | |
235 | 235 | return nil, err |
236 | 236 | } |
237 | 237 | mnts, ok := mountsByDevice[devicePath] |