Commit a964aa5c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Update for weekly.2011-07-07.

parent 42f12e1c
...@@ -64,7 +64,7 @@ func main() { ...@@ -64,7 +64,7 @@ func main() {
func Analyze(times []float64) { func Analyze(times []float64) {
sorted := times sorted := times
sort.SortFloat64s(sorted) sort.Float64s(sorted)
tot := 0.0 tot := 0.0
for _, v := range times { for _, v := range times {
......
...@@ -96,6 +96,6 @@ func (me *LatencyMap) TopArgs(name string) []string { ...@@ -96,6 +96,6 @@ func (me *LatencyMap) TopArgs(name string) []string {
for k, v := range counts { for k, v := range counts {
results = append(results, fmt.Sprintf("% 9d %s", v, k)) results = append(results, fmt.Sprintf("% 9d %s", v, k))
} }
sort.SortStrings(results) sort.Strings(results)
return results return results
} }
...@@ -134,7 +134,7 @@ func getConnection(local *os.File) (f *os.File, err os.Error) { ...@@ -134,7 +134,7 @@ func getConnection(local *os.File) (f *os.File, err os.Error) {
} }
func init() { func init() {
for _, v := range strings.Split(os.Getenv("PATH"), ":", -1) { for _, v := range strings.Split(os.Getenv("PATH"), ":") {
tpath := path.Join(v, "fusermount") tpath := path.Join(v, "fusermount")
fi, err := os.Stat(tpath) fi, err := os.Stat(tpath)
if err == nil && (fi.Mode&0111) != 0 { if err == nil && (fi.Mode&0111) != 0 {
......
...@@ -261,7 +261,7 @@ func doFsyncDir(state *MountState, req *request) { ...@@ -261,7 +261,7 @@ func doFsyncDir(state *MountState, req *request) {
} }
func doSetXAttr(state *MountState, req *request) { func doSetXAttr(state *MountState, req *request) {
splits := bytes.Split(req.arg, []byte{0}, 2) splits := bytes.SplitN(req.arg, []byte{0}, 2)
req.status = state.fileSystem.SetXAttr(req.inHeader, (*SetXAttrIn)(req.inData), string(splits[0]), splits[1]) req.status = state.fileSystem.SetXAttr(req.inHeader, (*SetXAttrIn)(req.inData), string(splits[0]), splits[1])
} }
......
...@@ -54,7 +54,7 @@ func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, statu ...@@ -54,7 +54,7 @@ func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, statu
var SeparatorString = string([]byte{filepath.Separator}) var SeparatorString = string([]byte{filepath.Separator})
func (me *FileSystemDebug) getContent(path string) []byte { func (me *FileSystemDebug) getContent(path string) []byte {
comps := strings.Split(path, SeparatorString, -1) comps := strings.Split(path, SeparatorString)
if comps[0] == DebugDir { if comps[0] == DebugDir {
me.RWMutex.RLock() me.RWMutex.RLock()
defer me.RWMutex.RUnlock() defer me.RWMutex.RUnlock()
...@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) { ...@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if path == DebugDir { if path == DebugDir {
return &os.FileInfo{ return &os.FileInfo{
Mode: S_IFDIR | 0755, Mode: S_IFDIR | 0755,
},OK }, OK
} }
c := me.getContent(path) c := me.getContent(path)
if c != nil { if c != nil {
return &os.FileInfo{ return &os.FileInfo{
Mode: S_IFREG | 0644, Mode: S_IFREG | 0644,
Size: int64(len(c)), Size: int64(len(c)),
},OK }, OK
} }
return nil, ENOENT return nil, ENOENT
} }
...@@ -98,7 +98,7 @@ func FloatMapToBytes(m map[string]float64) []byte { ...@@ -98,7 +98,7 @@ func FloatMapToBytes(m map[string]float64) []byte {
keys = append(keys, k) keys = append(keys, k)
} }
sort.SortStrings(keys) sort.Strings(keys)
var r []string var r []string
for _, k := range keys { for _, k := range keys {
...@@ -114,7 +114,7 @@ func IntMapToBytes(m map[string]int) []byte { ...@@ -114,7 +114,7 @@ func IntMapToBytes(m map[string]int) []byte {
keys = append(keys, k) keys = append(keys, k)
} }
sort.SortStrings(keys) sort.Strings(keys)
var r []string var r []string
for _, k := range keys { for _, k := range keys {
......
...@@ -448,7 +448,7 @@ func (me *FileSystemConnector) unlinkUpdate(parent *inode, name string) { ...@@ -448,7 +448,7 @@ func (me *FileSystemConnector) unlinkUpdate(parent *inode, name string) {
// node not found. // node not found.
func (me *FileSystemConnector) findInode(fullPath string) *inode { func (me *FileSystemConnector) findInode(fullPath string) *inode {
fullPath = strings.TrimLeft(filepath.Clean(fullPath), "/") fullPath = strings.TrimLeft(filepath.Clean(fullPath), "/")
comps := strings.Split(fullPath, "/", -1) comps := strings.Split(fullPath, "/")
node := me.rootNode node := me.rootNode
for _, component := range comps { for _, component := range comps {
......
...@@ -110,7 +110,7 @@ func (me *request) parse() { ...@@ -110,7 +110,7 @@ func (me *request) parse() {
if count == 1 { if count == 1 {
me.filenames = []string{string(me.arg[:len(me.arg)-1])} me.filenames = []string{string(me.arg[:len(me.arg)-1])}
} else { } else {
names := bytes.Split(me.arg[:len(me.arg)-1], []byte{0}, count) names := bytes.SplitN(me.arg[:len(me.arg)-1], []byte{0}, count)
me.filenames = make([]string, len(names)) me.filenames = make([]string, len(names))
for i, n := range names { for i, n := range names {
me.filenames[i] = string(n) me.filenames[i] = string(n)
......
...@@ -65,7 +65,7 @@ func ListXAttr(path string) (attributes []string, errno int) { ...@@ -65,7 +65,7 @@ func ListXAttr(path string) (attributes []string, errno int) {
// -1 to drop the final empty slice. // -1 to drop the final empty slice.
dest = dest[:sz-1] dest = dest[:sz-1]
attributesBytes := bytes.Split(dest, []byte{0}, -1) attributesBytes := bytes.Split(dest, []byte{0})
attributes = make([]string, len(attributesBytes)) attributes = make([]string, len(attributesBytes))
for i, v := range attributesBytes { for i, v := range attributesBytes {
attributes[i] = string(v) attributes[i] = string(v)
......
...@@ -168,7 +168,7 @@ func (me *AutoUnionFs) updateKnownFses() { ...@@ -168,7 +168,7 @@ func (me *AutoUnionFs) updateKnownFses() {
} }
func (me *AutoUnionFs) Readlink(path string) (out string, code fuse.Status) { func (me *AutoUnionFs) Readlink(path string) (out string, code fuse.Status) {
comps := strings.Split(path, fuse.SeparatorString, -1) comps := strings.Split(path, fuse.SeparatorString)
if comps[0] == _STATUS && comps[1] == _ROOT { if comps[0] == _STATUS && comps[1] == _ROOT {
return me.root, fuse.OK return me.root, fuse.OK
} }
...@@ -194,7 +194,7 @@ func (me *AutoUnionFs) getUnionFs(name string) *UnionFs { ...@@ -194,7 +194,7 @@ func (me *AutoUnionFs) getUnionFs(name string) *UnionFs {
} }
func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status) { func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status) {
comps := strings.Split(linkName, "/", -1) comps := strings.Split(linkName, "/")
if len(comps) != 2 { if len(comps) != 2 {
return fuse.EPERM return fuse.EPERM
} }
...@@ -213,7 +213,7 @@ func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Sta ...@@ -213,7 +213,7 @@ func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Sta
func (me *AutoUnionFs) Unlink(path string) (code fuse.Status) { func (me *AutoUnionFs) Unlink(path string) (code fuse.Status) {
comps := strings.Split(path, "/", -1) comps := strings.Split(path, "/")
if len(comps) != 2 { if len(comps) != 2 {
return fuse.EPERM return fuse.EPERM
} }
...@@ -260,7 +260,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) { ...@@ -260,7 +260,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
} }
return a, fuse.OK return a, fuse.OK
} }
comps := strings.Split(path, fuse.SeparatorString, -1) comps := strings.Split(path, fuse.SeparatorString)
if len(comps) > 1 && comps[0] == _CONFIG { if len(comps) > 1 && comps[0] == _CONFIG {
fs := me.getUnionFs(comps[1]) fs := me.getUnionFs(comps[1])
......
...@@ -69,7 +69,7 @@ func getAttr(fs fuse.FileSystem, name string) *attrResponse { ...@@ -69,7 +69,7 @@ func getAttr(fs fuse.FileSystem, name string) *attrResponse {
} }
func getXAttr(fs fuse.FileSystem, nameAttr string) *xattrResponse { func getXAttr(fs fuse.FileSystem, nameAttr string) *xattrResponse {
ns := strings.Split(nameAttr, _XATTRSEP, 2) ns := strings.SplitN(nameAttr, _XATTRSEP, 2)
a, code := fs.GetXAttr(ns[0], ns[1]) a, code := fs.GetXAttr(ns[0], ns[1])
return &xattrResponse{ return &xattrResponse{
data: a, data: a,
...@@ -93,7 +93,7 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem { ...@@ -93,7 +93,7 @@ func NewCachingFileSystem(fs fuse.FileSystem, ttlNs int64) *CachingFileSystem {
c.links = NewTimedCache(func(n string) interface{} { return readLink(fs, n) }, ttlNs) c.links = NewTimedCache(func(n string) interface{} { return readLink(fs, n) }, ttlNs)
c.xattr = NewTimedCache(func(n string) interface{} { c.xattr = NewTimedCache(func(n string) interface{} {
return getXAttr(fs, n) return getXAttr(fs, n)
},ttlNs) }, ttlNs)
return c return c
} }
...@@ -107,7 +107,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) { ...@@ -107,7 +107,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) {
if name == _DROP_CACHE { if name == _DROP_CACHE {
return &os.FileInfo{ return &os.FileInfo{
Mode: fuse.S_IFREG | 0777, Mode: fuse.S_IFREG | 0777,
},fuse.OK }, fuse.OK
} }
r := me.attributes.Get(name).(*attrResponse) r := me.attributes.Get(name).(*attrResponse)
......
...@@ -46,7 +46,7 @@ func (me *MemTree) Lookup(name string) (*MemTree, MemFile) { ...@@ -46,7 +46,7 @@ func (me *MemTree) Lookup(name string) (*MemTree, MemFile) {
return me, nil return me, nil
} }
parent := me parent := me
comps := strings.Split(filepath.Clean(name), "/", -1) comps := strings.Split(filepath.Clean(name), "/")
for _, c := range comps[:len(comps)-1] { for _, c := range comps[:len(comps)-1] {
parent = parent.subdirs[c] parent = parent.subdirs[c]
if parent == nil { if parent == nil {
......
...@@ -74,7 +74,7 @@ func NewTarTree(r io.Reader) *MemTree { ...@@ -74,7 +74,7 @@ func NewTarTree(r io.Reader) *MemTree {
longName = nil longName = nil
} }
comps := strings.Split(filepath.Clean(hdr.Name), "/", -1) comps := strings.Split(filepath.Clean(hdr.Name), "/")
base := "" base := ""
if !strings.HasSuffix(hdr.Name, "/") { if !strings.HasSuffix(hdr.Name, "/") {
base = comps[len(comps)-1] base = comps[len(comps)-1]
......
...@@ -51,7 +51,7 @@ func zipFilesToTree(files []*zip.File) *MemTree { ...@@ -51,7 +51,7 @@ func zipFilesToTree(files []*zip.File) *MemTree {
t := NewMemTree() t := NewMemTree()
for _, f := range files { for _, f := range files {
parent := t parent := t
comps := strings.Split(filepath.Clean(f.Name), "/", -1) comps := strings.Split(filepath.Clean(f.Name), "/")
base := "" base := ""
// Ugh - zip files have directories separate. // Ugh - zip files have directories separate.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment