コード例 #1
0
ファイル: iconv.c プロジェクト: 1x23/unifi-gpl
static int iconv_read(const char *path, char *buf, size_t size, off_t offset,
		      struct fuse_file_info *fi)
{
	struct iconv *ic = iconv_get();
	char *newpath;
	int err = iconv_convpath(ic, path, &newpath, 0);
	if (!err) {
		err = fuse_fs_read(ic->next, newpath, buf, size, offset, fi);
		free(newpath);
	}
	return err;
}
コード例 #2
0
ファイル: volicon.c プロジェクト: matthewdooler/FDT
static int
volicon_read(const char *path, char *buf, size_t size, off_t off,
             struct fuse_file_info *fi)
{
    int res = 0;

    if (volicon_is_icon_magic_file(path)) {
        size_t a_size = size;
        if (off < volicon_get()->volicon_size) {
            if ((off + size) > volicon_get()->volicon_size) {
                a_size = volicon_get()->volicon_size - off;
            }
            memcpy(buf, (char *)(volicon_get()->volicon_data) + off, a_size);
            res = a_size;
        }
    } else {
        res = fuse_fs_read(volicon_get()->next, path, buf, size, off, fi);
    }

    return res;
}