goduf-byinode_fallback.go
author Mikael Berthe <mikael@lilotux.net>
Sun, 29 Jun 2014 17:47:31 +0200
changeset 17 7e73bb91665e
parent 11 47e45453b705
child 18 5219596f5c71
permissions -rw-r--r--
Add copyright notices to the arch-specific files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     1
/*
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     2
 * Copyright (C) 2014 Mikael Berthe <mikael@lilotux.net>
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     3
 *
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     4
 * This program is free software; you can redistribute it and/or modify
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     5
 * it under the terms of the GNU General Public License as published by
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     6
 * the Free Software Foundation; either version 2 of the License, or (at
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     7
 * your option) any later version.
7e73bb91665e Add copyright notices to the arch-specific files
Mikael Berthe <mikael@lilotux.net>
parents: 11
diff changeset
     8
 */
0
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
// +build plan9 windows
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
package main
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
import "os"
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
// ByInode is a FileObjList type with a sort interface
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
type ByInode FileObjList
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
func (a ByInode) Len() int      { return len(a) }
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
func (a ByInode) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
func (a ByInode) Less(i, j int) bool {
11
47e45453b705 Sort files by path when sorting by inode number is not supported
Mikael Berthe <mikael@lilotux.net>
parents: 3
diff changeset
    22
	return a[i].FilePath < a[j].FilePath
0
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
}
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
3
d08d45871171 Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents: 0
diff changeset
    25
// OSHasInodes returns true iff the O.S. uses inodes for its filesystems.
0
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
func OSHasInodes() bool {
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    27
	return false
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
}
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    29
3
d08d45871171 Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents: 0
diff changeset
    30
// GetDevIno returns the device and inode IDs of a given file.
d08d45871171 Add descriptions to exported functions
Mikael Berthe <mikael@lilotux.net>
parents: 0
diff changeset
    31
// This is not supported on Windows and Plan9.
0
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    32
func GetDevIno(fi os.FileInfo) (uint64, uint64) {
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    33
	return 0, 0 // Not supported
a5642cd03cef Goduf - initial version-controlled revision
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    34
}