문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top