'Store all the local filesystems in the client.'

@flow.StateHandler()
def EnumerateFilesystems(self, responses):

    if (responses.success and len(responses)):
        filesystems = aff4_grr.VFSGRRClient.SchemaCls.FILESYSTEM()
        for response in responses:
            filesystems.Append(response)
            if (response.type == 'partition'):
                (device, offset) = response.device.rsplit(':', 1)
                offset = int(offset)
                pathspec = rdf_paths.PathSpec(path=device, pathtype=rdf_paths.PathSpec.PathType.OS, offset=offset)
                pathspec.Append(path='/', pathtype=rdf_paths.PathSpec.PathType.TSK)
                urn = pathspec.AFF4Path(self.client_id)
                fd = aff4.FACTORY.Create(urn, standard.VFSDirectory, token=self.token)
                fd.Set(fd.Schema.PATHSPEC(pathspec))
                fd.Close()
                continue
            if response.device:
                pathspec = rdf_paths.PathSpec(path=response.device, pathtype=rdf_paths.PathSpec.PathType.OS)
                pathspec.Append(path='/', pathtype=rdf_paths.PathSpec.PathType.TSK)
                urn = pathspec.AFF4Path(self.client_id)
                fd = aff4.FACTORY.Create(urn, standard.VFSDirectory, token=self.token)
                fd.Set(fd.Schema.PATHSPEC(pathspec))
                fd.Close()
            if response.mount_point:
                pathspec = rdf_paths.PathSpec(path=response.mount_point, pathtype=rdf_paths.PathSpec.PathType.OS)
                urn = pathspec.AFF4Path(self.client_id)
                with aff4.FACTORY.Create(urn, standard.VFSDirectory, token=self.token) as fd:
                    fd.Set(fd.Schema.PATHSPEC(pathspec))
        with self._CreateClient() as client:
            client.Set(client.Schema.FILESYSTEM, filesystems)
    else:
        self.Log('Could    not    enumerate    file    systems.')
