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() {
func Analyze(times []float64) {
sorted := times
sort.SortFloat64s(sorted)
sort.Float64s(sorted)
tot := 0.0
for _, v := range times {
......
......@@ -96,6 +96,6 @@ func (me *LatencyMap) TopArgs(name string) []string {
for k, v := range counts {
results = append(results, fmt.Sprintf("% 9d %s", v, k))
}
sort.SortStrings(results)
sort.Strings(results)
return results
}
......@@ -134,7 +134,7 @@ func getConnection(local *os.File) (f *os.File, err os.Error) {
}
func init() {
for _, v := range strings.Split(os.Getenv("PATH"), ":", -1) {
for _, v := range strings.Split(os.Getenv("PATH"), ":") {
tpath := path.Join(v, "fusermount")
fi, err := os.Stat(tpath)
if err == nil && (fi.Mode&0111) != 0 {
......
......@@ -261,7 +261,7 @@ func doFsyncDir(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])
}
......
......@@ -54,7 +54,7 @@ func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, statu
var SeparatorString = string([]byte{filepath.Separator})
func (me *FileSystemDebug) getContent(path string) []byte {
comps := strings.Split(path, SeparatorString, -1)
comps := strings.Split(path, SeparatorString)
if comps[0] == DebugDir {
me.RWMutex.RLock()
defer me.RWMutex.RUnlock()
......@@ -80,14 +80,14 @@ func (me *FileSystemDebug) GetAttr(path string) (*os.FileInfo, Status) {
if path == DebugDir {
return &os.FileInfo{
Mode: S_IFDIR | 0755,
},OK
}, OK
}
c := me.getContent(path)
if c != nil {
return &os.FileInfo{
Mode: S_IFREG | 0644,
Size: int64(len(c)),
},OK
}, OK
}
return nil, ENOENT
}
......@@ -98,7 +98,7 @@ func FloatMapToBytes(m map[string]float64) []byte {
keys = append(keys, k)
}
sort.SortStrings(keys)
sort.Strings(keys)
var r []string
for _, k := range keys {
......@@ -114,7 +114,7 @@ func IntMapToBytes(m map[string]int) []byte {
keys = append(keys, k)
}
sort.SortStrings(keys)
sort.Strings(keys)
var r []string
for _, k := range keys {
......
......@@ -448,7 +448,7 @@ func (me *FileSystemConnector) unlinkUpdate(parent *inode, name string) {
// node not found.
func (me *FileSystemConnector) findInode(fullPath string) *inode {
fullPath = strings.TrimLeft(filepath.Clean(fullPath), "/")
comps := strings.Split(fullPath, "/", -1)
comps := strings.Split(fullPath, "/")
node := me.rootNode
for _, component := range comps {
......
......@@ -110,7 +110,7 @@ func (me *request) parse() {
if count == 1 {
me.filenames = []string{string(me.arg[:len(me.arg)-1])}
} 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))
for i, n := range names {
me.filenames[i] = string(n)
......
......@@ -65,7 +65,7 @@ func ListXAttr(path string) (attributes []string, errno int) {
// -1 to drop the final empty slice.
dest = dest[:sz-1]
attributesBytes := bytes.Split(dest, []byte{0}, -1)
attributesBytes := bytes.Split(dest, []byte{0})
attributes = make([]string, len(attributesBytes))
for i, v := range attributesBytes {
attributes[i] = string(v)
......
......@@ -168,7 +168,7 @@ func (me *AutoUnionFs) updateKnownFses() {
}
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 {
return me.root, fuse.OK
}
......@@ -194,7 +194,7 @@ func (me *AutoUnionFs) getUnionFs(name string) *UnionFs {
}
func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Status) {
comps := strings.Split(linkName, "/", -1)
comps := strings.Split(linkName, "/")
if len(comps) != 2 {
return fuse.EPERM
}
......@@ -213,7 +213,7 @@ func (me *AutoUnionFs) Symlink(pointedTo string, linkName string) (code fuse.Sta
func (me *AutoUnionFs) Unlink(path string) (code fuse.Status) {
comps := strings.Split(path, "/", -1)
comps := strings.Split(path, "/")
if len(comps) != 2 {
return fuse.EPERM
}
......@@ -260,7 +260,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
}
return a, fuse.OK
}
comps := strings.Split(path, fuse.SeparatorString, -1)
comps := strings.Split(path, fuse.SeparatorString)
if len(comps) > 1 && comps[0] == _CONFIG {
fs := me.getUnionFs(comps[1])
......
......@@ -69,7 +69,7 @@ func getAttr(fs fuse.FileSystem, name string) *attrResponse {
}
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])
return &xattrResponse{
data: a,
......@@ -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.xattr = NewTimedCache(func(n string) interface{} {
return getXAttr(fs, n)
},ttlNs)
}, ttlNs)
return c
}
......@@ -107,7 +107,7 @@ func (me *CachingFileSystem) GetAttr(name string) (*os.FileInfo, fuse.Status) {
if name == _DROP_CACHE {
return &os.FileInfo{
Mode: fuse.S_IFREG | 0777,
},fuse.OK
}, fuse.OK
}
r := me.attributes.Get(name).(*attrResponse)
......
......@@ -46,7 +46,7 @@ func (me *MemTree) Lookup(name string) (*MemTree, MemFile) {
return me, nil
}
parent := me
comps := strings.Split(filepath.Clean(name), "/", -1)
comps := strings.Split(filepath.Clean(name), "/")
for _, c := range comps[:len(comps)-1] {
parent = parent.subdirs[c]
if parent == nil {
......
......@@ -74,7 +74,7 @@ func NewTarTree(r io.Reader) *MemTree {
longName = nil
}
comps := strings.Split(filepath.Clean(hdr.Name), "/", -1)
comps := strings.Split(filepath.Clean(hdr.Name), "/")
base := ""
if !strings.HasSuffix(hdr.Name, "/") {
base = comps[len(comps)-1]
......
......@@ -51,7 +51,7 @@ func zipFilesToTree(files []*zip.File) *MemTree {
t := NewMemTree()
for _, f := range files {
parent := t
comps := strings.Split(filepath.Clean(f.Name), "/", -1)
comps := strings.Split(filepath.Clean(f.Name), "/")
base := ""
// 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