Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(119)

Issue 5448079: code review 5448079: os: turn FileStat.Sys into a method on FileInfo (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by niemeyer
Modified:
13 years, 3 months ago
Reviewers:
CC:
cw, bradfitz, rsc, golang-dev
Visibility:
Public.

Description

os: turn FileStat.Sys into a method on FileInfo This reduces the overhead necessary to work with OS-specific file details, hides the implementation of FileStat, and preserves the implementation-specific nature of Sys. Expressions such as: stat.(*os.FileInfo).Sys.(*syscall.Stat_t).Uid fi1.(*os.FileStat).SameFile(fi2.(*os.FileStat)) Are now spelled as:: stat.Sys().(*syscall.Stat_t).Uid os.SameFile(fi1, fi2)

Patch Set 1 #

Patch Set 2 : code review 5448079: os: replace interface{} by *Stat_t in FileInfo.Sys #

Patch Set 3 : code review 5448079: os: replace interface{} by *Stat_t in FileInfo.Sys #

Patch Set 4 : diff -r b83e1a8c4d73 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r b83e1a8c4d73 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r b83e1a8c4d73 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 7 : code review 5448079: os: turn FileStat.Sys into a method on FileInfo #

Patch Set 8 : diff -r 64f5d54408cc https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 64f5d54408cc https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 10 : diff -r 64f5d54408cc https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 11 : diff -r 64f5d54408cc https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r 1850ba379b84 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -75 lines) Patch
M src/cmd/godoc/httpzip.go View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M src/cmd/godoc/zip.go View 1 2 3 4 5 7 1 chunk +4 lines, -0 lines 0 comments Download
M src/pkg/archive/zip/struct.go View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/archive/zip/zip_test.go View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M src/pkg/net/http/fs_test.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/os/file_unix.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
src/pkg/os/getwd.go View 1 2 3 4 5 6 7 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/os/os_test.go View 1 2 3 4 5 6 7 4 chunks +4 lines, -4 lines 0 comments Download
M src/pkg/os/os_unix_test.go View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/os/stat_darwin.go View 1 2 3 4 5 6 7 2 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/os/stat_freebsd.go View 1 2 3 4 5 6 7 2 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/os/stat_linux.go View 1 2 3 4 5 6 7 2 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/os/stat_netbsd.go View 1 2 3 4 5 6 7 2 chunks +6 lines, -6 lines 0 comments Download
M src/pkg/os/stat_openbsd.go View 1 2 3 4 5 6 7 2 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/os/stat_plan9.go View 1 2 3 4 5 6 7 2 chunks +6 lines, -6 lines 0 comments Download
src/pkg/os/stat_windows.go View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +8 lines, -8 lines 0 comments Download
src/pkg/os/types.go View 1 2 3 4 5 6 7 8 9 10 2 chunks +20 lines, -14 lines 0 comments Download
M src/pkg/path/filepath/path_test.go View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 30
niemeyer
Hello rsc@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 5 months ago (2011-12-01 21:05:40 UTC) #1
rsc
This fails on systems without a Stat_t, sorry.
13 years, 5 months ago (2011-12-01 21:06:55 UTC) #2
rsc
On Thu, Dec 1, 2011 at 16:06, Russ Cox <rsc@golang.org> wrote: > This fails on ...
13 years, 5 months ago (2011-12-01 21:09:19 UTC) #3
niemeyer
> This fails on systems without a Stat_t, sorry. These may easily define it as ...
13 years, 5 months ago (2011-12-01 21:20:27 UTC) #4
rsc
On Thu, Dec 1, 2011 at 16:20, Gustavo Niemeyer <n13m3y3r@gmail.com> wrote:>> This fails on systems ...
13 years, 5 months ago (2011-12-01 21:26:23 UTC) #5
rsc
On Thu, Dec 1, 2011 at 16:26, Russ Cox <rsc@golang.org> wrote: > On Thu, Dec ...
13 years, 5 months ago (2011-12-01 21:26:48 UTC) #6
gustavo_niemeyer.net
What about introducing in syscall: func Stat(s Iface) *Stat_t where Iface is defined as: type ...
13 years, 5 months ago (2011-12-01 21:43:01 UTC) #7
niemeyer
> I understand and appreciate that. However, it is worth pointing > out that you ...
13 years, 5 months ago (2011-12-01 22:32:47 UTC) #8
gustavo_niemeyer.net
> What about introducing in syscall: I've experimented a bit with this idea and, to ...
13 years, 5 months ago (2011-12-01 22:44:44 UTC) #9
niemeyer
> stat.Sys().(*syscall.Stat_t) I have updated the CL to implement this approach, in case someone is ...
13 years, 5 months ago (2011-12-01 23:45:21 UTC) #10
cw
For posix-like systems might we not just have something like pstat := os.PosixStat(someFileInfo) then pstat.Dev ...
13 years, 5 months ago (2011-12-02 18:50:56 UTC) #11
rsc
I've been thinking about this for a few months, and the zip change pushed me ...
13 years, 3 months ago (2012-01-31 16:27:54 UTC) #12
bradfitz
Could you elaborate why you like this? It feels like a regression to me. If ...
13 years, 3 months ago (2012-01-31 16:32:18 UTC) #13
rsc
On Tue, Jan 31, 2012 at 11:32, Brad Fitzpatrick <bradfitz@golang.org> wrote: > If we care ...
13 years, 3 months ago (2012-01-31 16:45:59 UTC) #14
bradfitz
On Tue, Jan 31, 2012 at 8:45 AM, Russ Cox <rsc@golang.org> wrote: > On Tue, ...
13 years, 3 months ago (2012-01-31 16:49:02 UTC) #15
rsc
On Tue, Jan 31, 2012 at 11:49, Brad Fitzpatrick <bradfitz@golang.org> wrote: > I would prefer ...
13 years, 3 months ago (2012-01-31 16:52:05 UTC) #16
gustavo_niemeyer.net
On Tue, Jan 31, 2012 at 14:27, <rsc@golang.org> wrote: > I've been thinking about this ...
13 years, 3 months ago (2012-01-31 17:16:30 UTC) #17
niemeyer
Hello rsc@golang.org, gustavo@niemeyer.net, cw@f00f.org, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2012-02-01 01:28:51 UTC) #18
rsc
http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go File src/pkg/os/types.go (right): http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go#newcode115 src/pkg/os/types.go:115: // the decision may be based on the path ...
13 years, 3 months ago (2012-02-02 18:36:02 UTC) #19
niemeyer
Hello cw@f00f.org, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2012-02-02 19:29:46 UTC) #20
niemeyer
PTAL http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go File src/pkg/os/types.go (right): http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go#newcode115 src/pkg/os/types.go:115: // the decision may be based on the ...
13 years, 3 months ago (2012-02-02 19:29:52 UTC) #21
bradfitz
http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go File src/pkg/os/types.go (right): http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go#newcode22 src/pkg/os/types.go:22: Sys() interface{} // underlying data source can this say ...
13 years, 3 months ago (2012-02-02 19:33:19 UTC) #22
cw
http://codereview.appspot.com/5448079/diff/23001/src/cmd/godoc/zip.go File src/cmd/godoc/zip.go (right): http://codereview.appspot.com/5448079/diff/23001/src/cmd/godoc/zip.go#newcode71 src/cmd/godoc/zip.go:71: How common is it that providers will want a ...
13 years, 3 months ago (2012-02-02 19:40:14 UTC) #23
bradfitz
On Thu, Feb 2, 2012 at 11:40 AM, <cw@f00f.org> wrote: > > http://codereview.appspot.com/**5448079/diff/23001/src/cmd/**godoc/zip.go<http://codereview.appspot.com/5448079/diff/23001/src/cmd/godoc/zip.go> > File ...
13 years, 3 months ago (2012-02-02 19:50:17 UTC) #24
rsc
http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go File src/pkg/os/types.go (right): http://codereview.appspot.com/5448079/diff/18001/src/pkg/os/types.go#newcode22 src/pkg/os/types.go:22: Sys() interface{} // underlying data source // underlying data ...
13 years, 3 months ago (2012-02-02 19:50:28 UTC) #25
cw
> I want it clear that this isn't a required part of the otherwise > ...
13 years, 3 months ago (2012-02-02 20:15:43 UTC) #26
rsc
On Thu, Feb 2, 2012 at 15:15, Chris Wedgwood <cw@f00f.org> wrote: > in which case ...
13 years, 3 months ago (2012-02-02 20:38:12 UTC) #27
niemeyer
Hello cw@f00f.org, bradfitz@golang.org, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 3 months ago (2012-02-02 20:53:47 UTC) #28
rsc
LGTM
13 years, 3 months ago (2012-02-02 22:49:01 UTC) #29
niemeyer
13 years, 3 months ago (2012-02-03 02:16:28 UTC) #30
*** Submitted as http://code.google.com/p/go/source/detail?r=6d670400d46a ***

os: turn FileStat.Sys into a method on FileInfo

This reduces the overhead necessary to work with OS-specific
file details, hides the implementation of FileStat, and
preserves the implementation-specific nature of Sys.

Expressions such as:

  stat.(*os.FileInfo).Sys.(*syscall.Stat_t).Uid
  fi1.(*os.FileStat).SameFile(fi2.(*os.FileStat))

Are now spelled as::

  stat.Sys().(*syscall.Stat_t).Uid
  os.SameFile(fi1, fi2)

R=cw, bradfitz, rsc
CC=golang-dev
http://codereview.appspot.com/5448079
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b