Posts

Post not yet marked as solved
1 Replies
117 Views
I want to figure out whether a file (for which I have the absolute path) is a local file (on a disk device connected to my machine) or a remote file (connected over network). For the same what I have done is, I opened the file and then did a fstat on it (I know, I could have done without opening the file using stat, but that is okay). Now from fstat, I am looking at dev_t     st_dev;     /* ID of device containing file */   and figuring the major and minor version of the st_dev.   Now, what information which I have on Linux, about the different possible values of major version / minor version are present in devices.txt https://www.kernel.org/doc/Documentation/admin-guide/devices.txt   And the values match also (on Linux), for example for a local file (whether on hard disk/external hard disk or pen drive), I am getting major Version as 8.   What I want to know is, does Mac has similar devices.txt file? If yes, please provide the link/path.   If not, then what values can I assume right now, which will mean, file is remote?
Posted Last updated
.
Post not yet marked as solved
0 Replies
342 Views
As expressed in this thread, the intention of F_NOCACHE is to disable caching for accesses via a particular file descriptor and the intention of F_GLOBAL_NOCACHE is to disable caching for accesses via all file descriptors. In the thread it is mentioned that F_NOCACHE, then, had an effect similar to F_GLOBAL_NOCACHE and it is intended to be implemented correctly in future systems. Can I get an insight on how the current implementation works? If the current implementation of F_NOCACHE is per file descriptor, does that mean, caching due to access via other file descriptors does not affect this file descriptor and will the access be made directly from disk? What happens when I set F_NOCACHE 1 for a file descriptor and later someone sets F_GLOBAL_NOCACHE as 0? If something is already in cache, read is said to happen via cache even if F_NOCACHE is set to 1. For writing, is the same applicable or is it always write-through?
Posted Last updated
.