Commit 4c504db8 authored by Ivan Krasin's avatar Ivan Krasin

Fixed GetAttr: it need to look at NodeId, not Fh. Also, tested that 0755 mode works

parent 38bf7a6f
......@@ -179,7 +179,7 @@ func getAttr(fs FileSystem, h *InHeader, ing interface{}, c *managerClient) (int
in := ing.(*GetAttrIn)
fmt.Printf("FUSE_GETATTR: %v, Fh: %d\n", in, in.Fh)
out := new(AttrOut)
resp := c.getPath(in.Fh)
resp := c.getPath(h.NodeId)
if resp.status != OK {
return nil, resp.status
}
......@@ -359,6 +359,7 @@ func startManager(fs FileSystem, requests chan *managerRequest) {
m.client = &managerClient{requests}
m.dirHandles = make(map[uint64]*dirHandle)
m.nodes = make(map[uint64]string)
m.nodes[0] = ""
m.nodes[1] = "" // Root
m.nodeMax = 1
m.nodesByPath = make(map[string]uint64)
......@@ -391,8 +392,8 @@ func (c *managerClient) getDirReader(nodeId, fh uint64) (resp *managerResponse)
return c.makeManagerRequest(nodeId, fh, getHandleOp, "")
}
func (c *managerClient) getPath(fh uint64) (resp *managerResponse) {
return c.makeManagerRequest(0, fh, getPathOp, "")
func (c *managerClient) getPath(nodeId uint64) (resp *managerResponse) {
return c.makeManagerRequest(nodeId, 0, getPathOp, "")
}
func (c *managerClient) closeDir(nodeId, fh uint64) (resp *managerResponse) {
......@@ -490,12 +491,7 @@ func (m *manager) lookup(req *managerRequest) (resp *managerResponse) {
func (m *manager) getPath(req *managerRequest) (resp *managerResponse) {
resp = new(managerResponse)
h, ok := m.dirHandles[req.fh]
if !ok {
resp.status = ENOENT
return
}
path, ok := m.nodes[h.nodeId]
path, ok := m.nodes[req.nodeId]
if !ok {
resp.status = ENOENT
return
......
......@@ -19,7 +19,7 @@ var (
type testFuse struct{}
func (fs *testFuse) GetAttr(path string) (out Attr, code Status) {
out.Mode = S_IFDIR
out.Mode = S_IFDIR + 0755
out.Mtime = uint64(time.Seconds())
return
}
......@@ -41,12 +41,6 @@ func errorHandler(errors chan os.Error) {
func TestMount(t *testing.T) {
fs := new(testFuse)
// toW := make(chan [][]byte, 100)
// errors := make(chan os.Error, 100)
// in_data := []byte { 56, 0, 0, 0, 26, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 13, 0, 0, 0, 0, 0, 2, 0, 123, 0, 0, 0, }
// handle(fs, in_data, toW, errors)
// return
err := os.Mkdir(tempMountDir, 0777)
if err != nil {
......
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