2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-23 03:18:55 +00:00

O_NOATIME on Linux

This commit is contained in:
Florian Weingarten 2015-04-25 00:36:54 +00:00
parent 8be6dc0265
commit 262e5a8b4a
4 changed files with 13 additions and 1 deletions

View File

@ -169,7 +169,7 @@ func (arch *Archiver) SaveTreeJSON(item interface{}) (Blob, error) {
// SaveFile stores the content of the file on the backend as a Blob by calling
// Save for each chunk.
func (arch *Archiver) SaveFile(p *Progress, node *Node) (Blobs, error) {
file, err := os.Open(node.path)
file, err := node.OpenForReading()
defer file.Close()
if err != nil {
return nil, err

View File

@ -11,6 +11,10 @@ import (
"github.com/restic/restic/debug"
)
func (node *Node) OpenForReading() (*os.File, error) {
return os.Open(n.path)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) (err error) {
stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok {

View File

@ -11,6 +11,10 @@ import (
"github.com/restic/restic/debug"
)
func (node *Node) OpenForReading() (*os.File, error) {
return os.OpenFile(node.path, os.O_RDONLY|syscall.O_NOATIME, 0)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
stat, ok := fi.Sys().(*syscall.Stat_t)
if !ok {

View File

@ -2,6 +2,10 @@ package restic
import "os"
func (node *Node) OpenForReading() (*os.File, error) {
return os.Open(n.path)
}
func (node *Node) fill_extra(path string, fi os.FileInfo) error {
return nil
}