// Device reading functions // +build darwin dragonfly freebsd linux netbsd openbsd solaris package local import ( "os" "syscall" "github.com/ncw/rclone/fs" ) var ( oneFileSystem = fs.BoolP("one-file-system", "x", false, "Don't cross filesystem boundaries.") ) // readDevice turns a valid os.FileInfo into a device number, // returning devUnset if it fails. func readDevice(fi os.FileInfo) uint64 { if !*oneFileSystem { return devUnset } statT, ok := fi.Sys().(*syscall.Stat_t) if !ok { fs.Debug(fi.Name(), "Type assertion fi.Sys().(*syscall.Stat_t) failed from: %#v", fi.Sys()) return devUnset } return uint64(statT.Dev) }
testModeHeader = "X-Bz-Test-Mode" retryAfterHeader = "Retry-After" minSleep = 10 * time.Millisecond maxSleep = 5 * time.Minute decayConstant = 1 // bigger for slower decay, exponential maxParts = 10000 maxVersions = 100 // maximum number of versions we search in --b2-versions mode ) // Globals var ( minChunkSize = fs.SizeSuffix(100E6) chunkSize = fs.SizeSuffix(96 * 1024 * 1024) uploadCutoff = fs.SizeSuffix(200E6) b2TestMode = fs.StringP("b2-test-mode", "", "", "A flag string for X-Bz-Test-Mode header.") b2Versions = fs.BoolP("b2-versions", "", false, "Include old versions in directory listings.") errNotWithVersions = errors.New("can't modify or delete files in --b2-versions mode") ) // Register with Fs func init() { fs.Register(&fs.RegInfo{ Name: "b2", Description: "Backblaze B2", NewFs: NewFs, Options: []fs.Option{{ Name: "account", Help: "Account ID", }, { Name: "key", Help: "Application Key",
// Constants const ( rcloneClientID = "202264815644.apps.googleusercontent.com" rcloneEncryptedClientSecret = "eX8GpZTVx3vxMWVkuuBdDWmAUE6rGhTwVrvG9GhllYccSdj2-mvHVg" driveFolderType = "application/vnd.google-apps.folder" timeFormatIn = time.RFC3339 timeFormatOut = "2006-01-02T15:04:05.000000000Z07:00" minSleep = 10 * time.Millisecond defaultExtensions = "docx,xlsx,pptx,svg" ) // Globals var ( // Flags driveFullList = fs.BoolP("drive-full-list", "", false, "Use a full listing for directory list. More data but usually quicker. (obsolete)") driveAuthOwnerOnly = fs.BoolP("drive-auth-owner-only", "", false, "Only consider files owned by the authenticated user. Requires drive-full-list.") driveUseTrash = fs.BoolP("drive-use-trash", "", false, "Send files to the trash instead of deleting permanently.") driveExtensions = fs.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.") // chunkSize is the size of the chunks created during a resumable upload and should be a power of two. // 1<<18 is the minimum size supported by the Google uploader, and there is no maximum. chunkSize = fs.SizeSuffix(8 * 1024 * 1024) driveUploadCutoff = chunkSize // Description of how to auth for this app driveConfig = &oauth2.Config{ Scopes: []string{"https://www.googleapis.com/auth/drive"}, Endpoint: google.Endpoint, ClientID: rcloneClientID, ClientSecret: fs.MustReveal(rcloneEncryptedClientSecret), RedirectURL: oauthutil.TitleBarRedirectURL, }