Skip to content

read big file will case fuse disconnected #2

@leonardzhou

Description

@leonardzhou

hi,

I'm not familar with C, so I cannot figure it out now on how to fix the fuse disconnected problem when I pass a video(over 100+MB) to fuse.

>>>  fuse: bad mount point `/tmp/fs': Transport endpoint is not connected

I found maxdatalen isn't used in read_from_erlang procudure. if this means it may introduce error when erlang pass data greater than BUFFER_SIZE?

thanks anyway, your works introduce a lot of fun of playing on elixir interacting with os.

best regards,
leonard zhou

`int read_from_erlang(unsigned char * buf, int maxdatalen) {

uint32_t datalen;

int readlen;
if ((readlen = read(3, (unsigned char *) &datalen, 4)) != 4) {
	syslog(LOG_WARNING, "efuse[%d]: read: port error reading data header (read %d)",
			getpid(), readlen);
	return -1;
}
datalen = ntohl(datalen);

uint32_t magiccookie1;
if ((readlen = read(3, (unsigned char *) &magiccookie1, 4)) != 4) {
	syslog(LOG_CRIT, "efuse[%d]: read: port error reading data header (read %d)",
		getpid(), readlen);
	exit(1);
}
magiccookie1 = ntohl(magiccookie1);
if (magiccookie1 != EFUSE_MAGICCOOKIE) {
	syslog(LOG_CRIT, "efuse[%d]: read: port read invalid magic cookie %u",
			getpid(), magiccookie1);
	exit(1);
}
datalen -= sizeof(uint32_t);

uint32_t readtotal = 0;
while (readtotal < datalen) {
	readlen = read(3, buf+readtotal, datalen-readtotal);
	if (readlen < 0) {
		syslog(LOG_ERR, "efuse[%d]: read: port read %d (expected %d)",
				getpid(), readtotal, datalen);
		return -1;
	}
	readtotal += readlen;
	if (readtotal < datalen)
		syslog(LOG_WARNING, "efuse[%d]: read: port short read (%d of %d)",
				getpid(), readtotal, datalen);
}

return datalen;

}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions