In Linux we have 'mode' for each file/folder
if we do:
struct stat buf;
Then fstat function will fill the buf with lots of info including st_mode;
As I know this st_mode contains information about permission and the file type(tells if it is a file or a folder)
So I want to know If I have to generate/make/cook an st_mode from scratch, how can I make sure that it will tell it's
a file and some other time it will tell that it is a folder? That type I will know by doing: S_ISDIR(buf.st_mode)
mode_t my_file_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
but that only tells about permission.
I want to make it to tell the file type also.
Also I have to fill other members of: struct stat
So what data I can assign to st_dev and st_ino etc any idea?
Actually the file does not exist on disk, I will be reading the objects from cloud, and I will tell the caller if its a file or a folder along with other info.