]> go.fuhry.dev Git - fsnotify.git/commitdiff
remove cookie from Event struct (unused)
authorNathan Youngman <git@nathany.com>
Fri, 20 Jun 2014 02:50:20 +0000 (20:50 -0600)
committerNathan Youngman <git@nathany.com>
Fri, 20 Jun 2014 02:50:20 +0000 (20:50 -0600)
CHANGELOG.md
fsnotify_linux.go
fsnotify_windows.go

index 02b1cd1450270fedb786eeb28d630792ac0073d2..6da0c9a166db13767af109e24da96d1692d60be5 100644 (file)
@@ -3,6 +3,7 @@
 ## v0.12.0 / 2014-06-19
 
 * use syscall.ERROR_MORE_DATA from ztypes_windows (Go 1.3+)
+* [internal] remove cookie from Event struct (unused)
 
 ## v0.11.0 / 2014-06-12
 
index ca607376902201eeb4e714abb885c70e1fd2ce90..f9be710017043e5b58310314ff5f9c1a2d5286cd 100644 (file)
@@ -57,13 +57,12 @@ const (
 )
 
 type Event struct {
-       Name   string // Relative path to the file/directory.
-       Op     Op     // Platform-independent mask.
-       cookie uint32 // Unique cookie associating related events (for rename(2))
+       Name string // Relative path to the file/directory.
+       Op   Op     // Platform-independent mask.
 }
 
-func newEvent(name string, mask uint32, cookie uint32) *Event {
-       e := &Event{Name: name, cookie: cookie}
+func newEvent(name string, mask uint32) *Event {
+       e := &Event{Name: name}
        if mask&sys_IN_CREATE == sys_IN_CREATE || mask&sys_IN_MOVED_TO == sys_IN_MOVED_TO {
                e.Op |= Create
        }
@@ -232,7 +231,6 @@ func (w *Watcher) readEvents() {
                        raw := (*syscall.InotifyEvent)(unsafe.Pointer(&buf[offset]))
 
                        mask := uint32(raw.Mask)
-                       cookie := uint32(raw.Cookie)
                        nameLen := uint32(raw.Len)
                        // If the event happened to the watched directory or the watched file, the kernel
                        // doesn't append the filename to the event, but we would like to always fill the
@@ -248,7 +246,7 @@ func (w *Watcher) readEvents() {
                                name += "/" + strings.TrimRight(string(bytes[0:nameLen]), "\000")
                        }
 
-                       event := newEvent(name, mask, cookie)
+                       event := newEvent(name, mask)
 
                        // Send the events that are not ignored on the events channel
                        if !event.ignoreLinux(mask) {
index 4068ea7681647b2856451b879b8b2c622a392eec..8896edf8c6588be0cb6f29f0d79235973dfa8d79 100644 (file)
@@ -44,9 +44,8 @@ const (
 // Event is the type of the notification messages
 // received on the watcher's Events channel.
 type Event struct {
-       Name   string // Relative path to the file/directory.
-       Op     Op     // Platform-independent bitmask.
-       cookie uint32 // Unique cookie associating related events (for rename)
+       Name string // Relative path to the file/directory.
+       Op   Op     // Platform-independent bitmask.
 }
 
 func newEvent(name string, mask uint32) *Event {
@@ -115,7 +114,6 @@ type Watcher struct {
        Errors   chan error     // Errors are sent on this channel
        isClosed bool           // Set to true when Close() is first called
        quit     chan chan<- error
-       cookie   uint32
 }
 
 // NewWatcher creates and returns a Watcher.
@@ -536,12 +534,6 @@ func (w *Watcher) sendEvent(name string, mask uint64) bool {
                return false
        }
        event := newEvent(name, uint32(mask))
-       if mask&sys_FS_MOVE != 0 {
-               if mask&sys_FS_MOVED_FROM != 0 {
-                       w.cookie++
-               }
-               event.cookie = w.cookie
-       }
        select {
        case ch := <-w.quit:
                w.quit <- ch