aboutsummaryrefslogtreecommitdiff
path: root/src/fuse/read.c
blob: 0abe00505351be22dfa5bbea4262a39eb5344aaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * read.c - FUSE read function
 *
 *  Created on: Mar 14, 2012
 *      Author: mg
 *

		 Read data from an open file
 *
 * Read should return exactly the number of bytes requested except
 * on EOF or error, otherwise the rest of the data will be
 * substituted with zeroes.	 An exception to this is when the
 * 'direct_io' mount option is specified, in which case the return
 * value of the read system call will reflect the return value of
 * this operation.
 *
 * Changed in version 2.2
 */

//#include <string.h>
//#include <errno.h>
#include <unistd.h>
#include <fuse.h>
#include <gnunet-fuse.h>




int gn_read(const char *path, char *buf, size_t size, off_t offset,
		struct fuse_file_info *fi)
{
/*	(void) fi;
	size_t len;

//until now read-function isn't used....

if(strcmp(path, "/") == 0)
{
	len = strlen("/");
	if (offset < len)
	  {
	  if (offset + size > len)
            size = len - offset;
	  memcpy(buf, "/" + offset, size);
	}
	else
	  size = 0;

	return size;
 }


if (strcmp(path, "/home/mg/gnunet-fuse2/gnunet-fuse/fuse/src/ext/monti/prueba") == 0)
	{

	len = strlen("test");

		if (offset < len)
		{
			if (offset + size > len)
				size = len - offset;
				memcpy(buf, "test" + offset, size);
		}
		else
			size = 0;

	return size;
	}



else return -ENOENT;
*/
}