Domanda

I'm implementing a FUSE-based filesystem (osxfuse, actually, since it's on Mac), and I noticed that before create or mkdir call getattr is always called, and if a node already exists, create/mkdir does not get called. The question is, can I rely on this behavior and not check for existence in create/mkdir?

È stato utile?

Soluzione

I would better check for file existence anyway cause (a) OS behavior can change in future (i.e. your simplification would play a low-down trick later), and (b) there's often a chance that the file is created outside of your FS on your backend storage. In the latter case you rely on the state which is not more valid.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top