> > So if the filesystem implements the create() method, it should
> > implement with the semantics of open(), where the open flags
> > always contain O_CREAT, and NOT like creat().
> I did not understand this sentence: creat() is equal an open() with
> the O_CREAT (and the O_TRUNC) flag. So here is a new question:
> in the future, should the implementation change so that create()
> will be called when the file already exists, what will happen in
> this case? Will the file be truncated?
Only if 'flags' contains O_TRUNC.
> If it will, we'll be able to use creat() (which is open() with
> O_CREAT and O_TRUNC), otherwise we'll have to use open() with
> O_CREAT and without O_TRUNC.
Neither. The simple rule is to perform the equivalent of
open(path, flags, mode)
in the create() method, and flags will always contain O_CREAT and may
contain O_TRUNC and/or O_EXCL.
And the open method should do the equivalent of
where flags will never conain O_CREAT, O_TRUNC or O_EXCL.
So the create() method has nothing to do with the creat() system call
and it's implied flags.