Exemplo n.º 1
0
func (fs *DeviceFs) newFolder(obj mtp.ObjectInfo, h uint32) *folderNode {
	obj.AssociationType = mtp.OFC_Association
	return &folderNode{
		mtpNodeImpl: mtpNodeImpl{
			handle: h,
			obj:    &obj,
			fs:     fs,
		},
	}
}
Exemplo n.º 2
0
func (fs *deviceFS) newFolder(obj mtp.ObjectInfo, h uint32) *folderNode {
	obj.AssociationType = mtp.OFC_Association
	return &folderNode{
		mtpNodeImpl: mtpNodeImpl{
			Node:   nodefs.NewDefaultNode(),
			handle: h,
			obj:    &obj,
			fs:     fs,
		},
	}
}
Exemplo n.º 3
0
func (n *folderNode) Mkdir(name string, mode uint32, context *fuse.Context) (*nodefs.Inode, fuse.Status) {
	if !n.fetch() {
		return nil, fuse.EIO
	}

	obj := mtp.ObjectInfo{
		Filename:         name,
		ObjectFormat:     mtp.OFC_Association,
		ModificationDate: time.Now(),
		ParentObject:     n.Handle(),
		StorageID:        n.StorageID(),
	}
	if n.fs.mungeVfat[n.StorageID()] {
		obj.Filename = SanitizeDosName(obj.Filename)
	}
	_, _, newId, err := n.fs.dev.SendObjectInfo(n.StorageID(), n.Handle(), &obj)
	if err != nil {
		log.Printf("CreateFolder failed: %v", err)
		return nil, fuse.EIO
	}

	f := n.fs.newFolder(obj, newId)
	return n.Inode().NewChild(name, true, f), fuse.OK
}
Exemplo n.º 4
0
func (fs *DeviceFs) newFolder(obj mtp.ObjectInfo, id uint32, storage uint32) *folderNode {
	obj.AssociationType = mtp.OFC_Association
	return &folderNode{
		fileNode: fs.newFile(obj, 0, id, storage),
	}
}