fuse: read zero size files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I want to create a fuse file similar to the /proc/version file.
It's stat size is zero, but you can read from it.

However when I set st_size to zero, the kernel-read returns zero.
When st_size is not zero, the kernel-read returns no more than st_size
bytes.

Something seems to limit the amount of bytes to st_size.
How can I prevent this from happening to create a which behaves like
/proc/version?

strace st_size is zero:

open("fuse/dir/mysubdir/test.txt", O_RDONLY) =3D 3 fstat(3,
{st_mode=3DS_IFREG|0640, st_size=3D0, ...}) =3D 0
read(3, "", 32768)                      =3D 0
close(3)                                =3D 0

strace st_size is not zero:

open("fuse/dir/mysubdir/test.txt", O_RDONLY) =3D 3 fstat(3,
{st_mode=3DS_IFREG|0640, st_size=3D1000, ...}) =3D 0 read(3, =
"\0\1\2\3\4\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33
\=
34\35\36\37"..., 32768) =3D 1000
write(1, =
"\0\1\2\3\4\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33
\=
34\35\36\37"..., 1000) =3D 1000
read(3, "", 32768)                      =3D 0
close(3)                                =3D 0

uname -a for my system:

Linux hostname 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 02:39:34 UTC
= 2010 x86_64 GNU/Linux

Thanks in advance,

Tom


DISCLAIMER:
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux