From: Nathan Youngman Date: Fri, 20 Jun 2014 02:50:20 +0000 (-0600) Subject: remove cookie from Event struct (unused) X-Git-Tag: v1.7.2~311^2~2 X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=5bfa0575169e0daa251bd03a9e933cb42f5dd504;p=fsnotify.git remove cookie from Event struct (unused) --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 02b1cd1..6da0c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/fsnotify_linux.go b/fsnotify_linux.go index ca60737..f9be710 100644 --- a/fsnotify_linux.go +++ b/fsnotify_linux.go @@ -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) { diff --git a/fsnotify_windows.go b/fsnotify_windows.go index 4068ea7..8896edf 100644 --- a/fsnotify_windows.go +++ b/fsnotify_windows.go @@ -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