Writing own VFS module (return values and errno)
David.Collier-Brown at Sun.COM
Mon Jan 30 13:54:28 GMT 2006
Timo Neuvonen wrote:
> When the actual rename function is working ok (returns 0), but the
> additional code I've put into the VFS module thereafter fails, does it
> really make any _practical_ difference which value I give to 'errno'? I
> mean, should it be possible to at least try to control what kind of error
> message is displayed to the workstation user?
Yes, you should try to return the values which are
in the POSIX man page for rename, which is often
a subset of the values returnable on Linux.
EACCES A component of either path prefix denies search permission;
EBUSY The new argument is the mount point for a mounted file system.
EDQUOT The user's quota has been exhausted.
EEXIST The link named by new is a directory containing entries
other than `.' (the directory itself) and `..'
EFAULT Either old or new references an invalid address.
EINVAL The new argument directory pathname contains
a path prefix that names the old directory,
or an attempt was made to rename a regular
file to an extended attribute
EISDIR The new argument points to a directory but
old points to a file that is not a directory.
ELOOP Too many symbolic links were encountered
ENAMETOOLONG The length of old or new exceeds PATH_MAX
EMLINK The file named by old is a directory, and
the link count of the parent directory of
new would exceed LINK_MAX.
ENOENT The link named by old does not exist, or
either old or new points to an empty string.
ENOSPC The directory that would contain new cannot be extended.
ENOTDIR A component of either path prefix is not a
directory, or old names a directory and new
names a nondirectory file
EROFS The requested operation requires writing in
a directory on a read-only file system.
EXDEV The links named by old and new are on different file systems.
EIO An I/O error occurred while making or updating a directory
> There is propably a problem of missing documentation of Microsoft when it
> comes to Windows workstations, but is Nautilus file browser with Samba
> client for example supposed to try to show different error messages
> depending on the errno value returned by low-level Samba functions? What
> I've tried so far (Nautilus 2.10.0 on FC4 Linux + Samba 3.0.14a), the error
> message seems always be the same "You do not have the permissions necessary
> to rename xx" (*. This happens with the correct errno value EACCESS that
> Samba returns due to lack of permissions, and at least with values ENOSYS
> and ECANCELED I've tried by now.
Most GUIs use the messages in errno.h, rather than the more
specific ones in the man pages.
> Is there some errno value I could use in rename function of my own, that is
> at least _expected_ to appear to the user like something else, maybe like
> "unknown error" or "rename operation failed with unpredictable results". I
> understand that the final verbal message may be produced by some completely
> different software but Samba, but are these different error codes passed at
> all to the user's client software, or are they effectively only for internal
> use of Samba?
I'd reccomend EIO, which sounds like something you should
David Collier-Brown, | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at canada.sun.com | -- Mark Twain
(416) 263-5733 (x65733) |
More information about the samba-technical