16,6 → 16,7 |
#include "../fs/fs.h" |
#include "../share/shared_proto.h" |
#include "../console/console.h" |
#include "../fs/stat.h" |
|
#define CON_FS_ATTEMPTS 1000 |
|
53,7 → 54,7 |
printf("Connecting the task to FS..."); |
retval = async_req_2(fs_phone, FS_NEW_CONSUMER, task_get_id(), 0, NULL, NULL); |
if (retval < 0) { |
printf("FS_NEW_CONSUMER error: %d\n", retval); |
printf("%d\n", retval); |
return -1; |
} |
printf("OK\n"); |
220,6 → 221,7 |
} |
printf("OK\n"); |
|
/* |
printf("Request for closing file %s once more...", fname); |
retval = send_request(fs_phone, FS_CLOSE, params, share); |
if (retval < 0) { |
227,7 → 229,75 |
return -1; |
} |
printf("OK\n"); |
*/ |
|
printf("Request for dropping the connection to the FS..."); |
retval = send_request(fs_phone, FS_DROP_CONSUMER, params, share); |
if (retval < 0) { |
printf("%d\n", retval); |
return -1; |
} |
printf("OK\n"); |
|
|
/* Unmapping share area. */ |
printf("Unmapping share area..."); |
retval = munmap(share, size); |
if (retval < 0) { |
printf("%d\n", retval); |
return -1; |
} |
printf("OK\n"); |
|
printf("Creating address space area..."); |
size = ALIGN_UP(BLOCK_SIZE * sizeof(char), PAGE_SIZE); |
share = mmap(share, size, AS_AREA_READ | AS_AREA_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
if ((int)share < 0){ |
printf("As_area_create error: %d\n", (int)share); |
return -1; |
} |
printf("OK\n"); |
|
/* Next connection to the FS. */ |
printf("Connecting the task to FS..."); |
retval = async_req_2(fs_phone, FS_NEW_CONSUMER, task_get_id(), 0, NULL, NULL); |
if (retval < 0) { |
printf("FS_NEW_CONSUMER error: %d\n", retval); |
return -1; |
} |
printf("OK\n"); |
|
printf("Sending memory to FS_SERVICE..."); |
flags = 0; |
flags = AS_AREA_READ | AS_AREA_WRITE; |
retval = async_req_3(fs_phone, IPC_M_AS_AREA_SEND, (uintptr_t)share, size, flags, NULL, NULL, NULL); |
if (retval < 0) { |
printf("%d\n", retval); |
return -1; |
} |
printf("OK\n"); |
|
/* We want to work with specified file. */ |
memcpy(fname, "/kernel/arch", 20); |
memcpy(params->fname, fname, 20); |
|
printf("Request for getting info about file %s[STAT called]...", fname); |
retval = send_request(fs_phone, FS_STAT, params, share); |
if (retval < 0) { |
printf("%d\n", retval); |
return -1; |
} |
printf("OK\n"); |
|
stat_t file_info; |
memcpy((void *)(&file_info), share, sizeof(stat_t)); |
|
printf("Info about file: %s\n", fname); |
printf("Inode number: %d\n", file_info.st_ino); |
printf("Mode: %d\n", file_info.st_mode); |
printf("Links: %d\n", file_info.st_nlink); |
printf("Size: %d\n", file_info.st_size); |
|
return 0; |
} |
|