)
const (
- Version = "0.1.0"
+ Version = "0.2.0"
SectorSize = 1 << 12 // 4 KiB sector size
BufSize = 1 << 17 // ZFS default 128 KiB recordsize
actionS = flag.String("action", "", "print, ns, symlink, hardlink")
minSize = flag.Int64("minsize", 1, "minimal file size")
chmod = flag.String("chmod", "", "chmod files")
- nsPath = flag.String("ns", "", "link targets from netstring file")
+ doNS = flag.Bool("ns", false, "link targets from netstring read from stdin")
fsync = flag.Bool("fsync", false, "fsync directories?")
version = flag.Bool("version", false, "Print version information")
warranty = flag.Bool("warranty", false, "Print warranty information")
[-chmod XXX] [-minsize XXX] [-fsync]
Two pass mode:
%s -basedir DIR -dupdir DIR -action ns [-chmod XXX] [-minsize XXX] > state
- %s -action {print,symlink,hardlink} [-fsync] -ns state
+ %s -action {print,symlink,hardlink} [-fsync] -ns < state
Options:
`, os.Args[0], os.Args[0], os.Args[0])
log.Fatalln("invalid action")
}
- if *nsPath != "" {
+ if *doNS {
if action == ActNS {
log.Fatalln("\"-action ns\" has no meaning with -ns")
}
- fd, err := os.Open(*nsPath)
- if err != nil {
- log.Fatal(err)
- }
- nsR := netstring.NewReader(bufio.NewReaderSize(fd, BufSize))
+ nsR := netstring.NewReader(bufio.NewReaderSize(os.Stdin, BufSize))
pathDup := make([]byte, 1<<10)
pathOrig := make([]byte, 1<<10)
+ var err error
var pathDupLen, pathOrigLen uint64
files := 0
fullSize := int64(0)