You are not allowed to use auxillary functions in the macro, though you can still implement functions using preprocessors as wrappers.
You have pathname of /XXX/XXX this kind of things,
what you should do is handle each part between "/" one by one.
You can cut the first "/" out and use strcspn() to locate the remaining substring and use open_t recursively, in the way demonstrated below
#define macro(a,b,c) func(a,b,c)
int func(int fd, int inode, char *pathname)
{
/*code to find the dir from pathname*/
return macro(fd, next_inode, remaining_pathname);
}
int open_t(char *pathname)
{
/*some code to find current inode*/
return func(fd, 0, pathname)
}
Or you can simply use strtok() and update inode repeatedly
Declaration: I did not use recursive algorithm to handle it
Simple arithmetic on file_size(inode->i_size)
Please use 1kb test case to test multi data block reading
Usage: ./testcase [command]
Command:
official: official testcases
1: simple 1kb size data block testcase
4: simple 4kb size data block testcase
The HD generator is in /generator folder. You can create different virtual HD for this project using this program by changing parameters in superblock.csv and dir_tree.csv
This generator forms inode following ordering in csv file. So the parent must be declared prior to its children nodes.
32-bit linux only
Multiple direct block and indirect block for directory inode is not supported by this generator as this is an SFS HD generator.
Files too large will not be cut by this generator nor will it stop writing it in to the HD.
This generator will not stop writing even when data block limit is reached.
This is because the developer is lazy
This is to implement erroneous cases for testing call.c
You can remove any rows if you want to use the normal SFS HD definition of this project.
Or you can simply remove this csv if you are not going to specify any special parameters.
Best Abuse of the C Preprocessor 1993
Best Abuse of the C Preprocessor 1990
Best Abuse of the C Preprocessor 2001
Worst abuse of the C preprocessor 1986
Worst abuse of the C preprocessor 1992
Worst abuse of the C preprocessor 1995
Worst abuse of the C preprocessor 1996
Worst abuse of the C preprocessor 1985