We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code should mimic the following sequence:
int main() { int ret_value; char* filename = "/home/kmehta/plfs/trunk/mount_point/test.out"; char write_buf1[] = "Testing"; char write_buf2[] = "PLFSRW"; char *read_buf = (char *) malloc(sizeof(write_buf1)+sizeof(write_buf2));
Plfs_fd * pfd = NULL;
if(0>(plfs_open(&pfd, filename, O_CREAT|O_TRUNC|O_RDWR, 99, 0666, NULL))) { perror("Error opening file"); exit(-1); }
if(6 != (ret_value = plfs_write(pfd, write_buf1, 6, 0, 99))) //6 bytes at offset 0 { perror("Error in first write"); printf("ret_value: %d\n", ret_value); exit(-1); }
if(5 != (ret_value = plfs_write(pfd, write_buf2, 5, 6, 99))) //5 bytes at offset 6 { perror("Error in first write"); printf("ret_value: %d\n", ret_value); exit(-1); }
if(0>(plfs_close(pfd, 99, 99, O_CREAT|O_TRUNC|O_RDWR, NULL))) { perror("Error closing file"); exit(-1); }
pfd = NULL; if(0>(plfs_open(&pfd, filename, O_RDWR, 99, 0666, NULL))) { perror("Error during re-open"); exit(-1); }
if(11 != (ret_value = plfs_read(pfd, read_buf, 11, 0))) { perror("Error during read"); printf("ret_value: %d\n", ret_value); }
if(0>(plfs_close(pfd, 99, 1, O_RDWR, NULL))) { perror("Error re-closing file"); exit(-1); }
free(read_buf); return 0;
}
The text was updated successfully, but these errors were encountered:
atorrez
No branches or pull requests
The code should mimic the following sequence:
include
include
include "plfs.h"
include
include
include
int main()
{
int ret_value;
char* filename = "/home/kmehta/plfs/trunk/mount_point/test.out";
char write_buf1[] = "Testing";
char write_buf2[] = "PLFSRW";
char *read_buf = (char *) malloc(sizeof(write_buf1)+sizeof(write_buf2));
Plfs_fd * pfd = NULL;
if(0>(plfs_open(&pfd, filename, O_CREAT|O_TRUNC|O_RDWR, 99, 0666, NULL)))
{
perror("Error opening file");
exit(-1);
}
if(6 != (ret_value = plfs_write(pfd, write_buf1, 6, 0, 99))) //6 bytes at offset 0
{
perror("Error in first write");
printf("ret_value: %d\n", ret_value);
exit(-1);
}
if(5 != (ret_value = plfs_write(pfd, write_buf2, 5, 6, 99))) //5 bytes at offset 6
{
perror("Error in first write");
printf("ret_value: %d\n", ret_value);
exit(-1);
}
if(0>(plfs_close(pfd, 99, 99, O_CREAT|O_TRUNC|O_RDWR, NULL)))
{
perror("Error closing file");
exit(-1);
}
pfd = NULL;
if(0>(plfs_open(&pfd, filename, O_RDWR, 99, 0666, NULL)))
{
perror("Error during re-open");
exit(-1);
}
if(11 != (ret_value = plfs_read(pfd, read_buf, 11, 0)))
{
perror("Error during read");
printf("ret_value: %d\n", ret_value);
}
if(0>(plfs_close(pfd, 99, 1, O_RDWR, NULL)))
{
perror("Error re-closing file");
exit(-1);
}
free(read_buf);
return 0;
}
The text was updated successfully, but these errors were encountered: