aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/rjeczalik/notify/event_readdcw.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-10-29 01:05:01 +0800
committerFelix Lange <fjl@twurst.com>2016-10-29 01:05:01 +0800
commit289b30715d097edafd5562f66cb3567a70b2d330 (patch)
tree7eaaa6da97c84727469303b986e364606ece57ce /vendor/github.com/rjeczalik/notify/event_readdcw.go
parent77703045765343c489ded2f43e3ed0f332c5f148 (diff)
downloaddexon-289b30715d097edafd5562f66cb3567a70b2d330.tar
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.gz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.bz2
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.lz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.xz
dexon-289b30715d097edafd5562f66cb3567a70b2d330.tar.zst
dexon-289b30715d097edafd5562f66cb3567a70b2d330.zip
Godeps, vendor: convert dependency management to trash (#3198)
This commit converts the dependency management from Godeps to the vendor folder, also switching the tool from godep to trash. Since the upstream tool lacks a few features proposed via a few PRs, until those PRs are merged in (if), use github.com/karalabe/trash. You can update dependencies via trash --update. All dependencies have been updated to their latest version. Parts of the build system are reworked to drop old notions of Godeps and invocation of the go vet command so that it doesn't run against the vendor folder, as that will just blow up during vetting. The conversion drops OpenCL (and hence GPU mining support) from ethash and our codebase. The short reasoning is that there's noone to maintain and having opencl libs in our deps messes up builds as go install ./... tries to build them, failing with unsatisfied link errors for the C OpenCL deps. golang.org/x/net/context is not vendored in. We expect it to be fetched by the user (i.e. using go get). To keep ci.go builds reproducible the package is "vendored" in build/_vendor.
Diffstat (limited to 'vendor/github.com/rjeczalik/notify/event_readdcw.go')
-rw-r--r--vendor/github.com/rjeczalik/notify/event_readdcw.go108
1 files changed, 108 insertions, 0 deletions
diff --git a/vendor/github.com/rjeczalik/notify/event_readdcw.go b/vendor/github.com/rjeczalik/notify/event_readdcw.go
new file mode 100644
index 000000000..11ead9e29
--- /dev/null
+++ b/vendor/github.com/rjeczalik/notify/event_readdcw.go
@@ -0,0 +1,108 @@
+// Copyright (c) 2014-2015 The Notify Authors. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+// +build windows
+
+package notify
+
+import (
+ "os"
+ "path/filepath"
+ "syscall"
+)
+
+// Platform independent event values.
+const (
+ osSpecificCreate Event = 1 << (20 + iota)
+ osSpecificRemove
+ osSpecificWrite
+ osSpecificRename
+ // recursive is used to distinguish recursive eventsets from non-recursive ones
+ recursive
+ // omit is used for dispatching internal events; only those events are sent
+ // for which both the event and the watchpoint has omit in theirs event sets.
+ omit
+ // dirmarker TODO(pknap)
+ dirmarker
+)
+
+// ReadDirectoryChangesW filters.
+const (
+ FileNotifyChangeFileName = Event(syscall.FILE_NOTIFY_CHANGE_FILE_NAME)
+ FileNotifyChangeDirName = Event(syscall.FILE_NOTIFY_CHANGE_DIR_NAME)
+ FileNotifyChangeAttributes = Event(syscall.FILE_NOTIFY_CHANGE_ATTRIBUTES)
+ FileNotifyChangeSize = Event(syscall.FILE_NOTIFY_CHANGE_SIZE)
+ FileNotifyChangeLastWrite = Event(syscall.FILE_NOTIFY_CHANGE_LAST_WRITE)
+ FileNotifyChangeLastAccess = Event(syscall.FILE_NOTIFY_CHANGE_LAST_ACCESS)
+ FileNotifyChangeCreation = Event(syscall.FILE_NOTIFY_CHANGE_CREATION)
+ FileNotifyChangeSecurity = Event(syscallFileNotifyChangeSecurity)
+)
+
+const (
+ fileNotifyChangeAll = 0x17f // logical sum of all FileNotifyChange* events.
+ fileNotifyChangeModified = fileNotifyChangeAll &^ (FileNotifyChangeFileName | FileNotifyChangeDirName)
+)
+
+// according to: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365465(v=vs.85).aspx
+// this flag should be declared in: http://golang.org/src/pkg/syscall/ztypes_windows.go
+const syscallFileNotifyChangeSecurity = 0x00000100
+
+// ReadDirectoryChangesW actions.
+const (
+ FileActionAdded = Event(syscall.FILE_ACTION_ADDED) << 12
+ FileActionRemoved = Event(syscall.FILE_ACTION_REMOVED) << 12
+ FileActionModified = Event(syscall.FILE_ACTION_MODIFIED) << 14
+ FileActionRenamedOldName = Event(syscall.FILE_ACTION_RENAMED_OLD_NAME) << 15
+ FileActionRenamedNewName = Event(syscall.FILE_ACTION_RENAMED_NEW_NAME) << 16
+)
+
+const fileActionAll = 0x7f000 // logical sum of all FileAction* events.
+
+var osestr = map[Event]string{
+ FileNotifyChangeFileName: "notify.FileNotifyChangeFileName",
+ FileNotifyChangeDirName: "notify.FileNotifyChangeDirName",
+ FileNotifyChangeAttributes: "notify.FileNotifyChangeAttributes",
+ FileNotifyChangeSize: "notify.FileNotifyChangeSize",
+ FileNotifyChangeLastWrite: "notify.FileNotifyChangeLastWrite",
+ FileNotifyChangeLastAccess: "notify.FileNotifyChangeLastAccess",
+ FileNotifyChangeCreation: "notify.FileNotifyChangeCreation",
+ FileNotifyChangeSecurity: "notify.FileNotifyChangeSecurity",
+
+ FileActionAdded: "notify.FileActionAdded",
+ FileActionRemoved: "notify.FileActionRemoved",
+ FileActionModified: "notify.FileActionModified",
+ FileActionRenamedOldName: "notify.FileActionRenamedOldName",
+ FileActionRenamedNewName: "notify.FileActionRenamedNewName",
+}
+
+const (
+ fTypeUnknown uint8 = iota
+ fTypeFile
+ fTypeDirectory
+)
+
+// TODO(ppknap) : doc.
+type event struct {
+ pathw []uint16
+ name string
+ ftype uint8
+ action uint32
+ filter uint32
+ e Event
+}
+
+func (e *event) Event() Event { return e.e }
+func (e *event) Path() string { return filepath.Join(syscall.UTF16ToString(e.pathw), e.name) }
+func (e *event) Sys() interface{} { return e.ftype }
+
+func (e *event) isDir() (bool, error) {
+ if e.ftype != fTypeUnknown {
+ return e.ftype == fTypeDirectory, nil
+ }
+ fi, err := os.Stat(e.Path())
+ if err != nil {
+ return false, err
+ }
+ return fi.IsDir(), nil
+}