SyncFS will force a filesystem sync for the filesystem backing the provided path.
(path string)
| 149 | |
| 150 | // SyncFS will force a filesystem sync for the filesystem backing the provided path. |
| 151 | func SyncFS(path string) error { |
| 152 | // Get us a file descriptor. |
| 153 | fsFile, err := os.Open(path) |
| 154 | if err != nil { |
| 155 | return err |
| 156 | } |
| 157 | |
| 158 | defer logger.WarnOnError(fsFile.Close, "Failed to close file") |
| 159 | |
| 160 | // Call SyncFS. |
| 161 | return unix.Syncfs(int(fsFile.Fd())) |
| 162 | } |
| 163 | |
| 164 | // PathNameEncode encodes a path string to be used as part of a file name. |
| 165 | // The encoding scheme replaces "-" with "--" and then "/" with "-". |
no test coverage detected
searching dependent graphs…