-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.c
60 lines (46 loc) · 1.2 KB
/
client.c
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
#include <stdio.h>
#include <string.h>
#include "mfs.h"
#define BUFFER_SIZE (1000)
typedef struct mssg {
int tag;
int type;
int size;
int pinum;
int inum;
int block;
char name[24];
char buffer[MFS_BLOCK_SIZE];
} mssg;
// client code
int main(int argc, char *argv[]) {
int r;
r = MFS_Init("localhost", 11113);
printf("%d\n",r);
//r = MFS_Lookup(1, "a");
//printf("%d\n",r);
//MFS_Stat_t m;
//r = MFS_Stat(1,&m);
//printf("%d\n",r);
//char message[MFS_BLOCK_SIZE];
//char buf1[MFS_BLOCK_SIZE];
r = MFS_Creat(0,0,"test");
printf("%d\n",r);
r = MFS_Lookup(0, "test");
printf("%d\n", r);
r = MFS_Unlink(0, "test");
printf("%d\n",r);
r = MFS_Lookup(0, "test");
printf("inum%d\n", r);
//r = MFS_Read(1, buf1, 0);
//printf("%d\n",r);
//printf("OUTPUT FROM READ: _%s_ _%s_\n", message, buf1);
//r = MFS_Unlink(1,"a");
//printf("%d\n",r);
r = MFS_Shutdown();
printf("%d\n",r);
// memcpy(&msg, (mssg*) message, sizeof(mssg));
// printf("client:: got reply [contents:(%d %d %d %d %d %s %s)\n", msg.tag, msg.type, msg.pinum, msg.block, msg.inum, msg.name, msg.buffer);
//
return 0;
}