From 2b5f4b0aafa1c2b39c03cb4b39d26e085e61c940 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 18 Apr 2014 16:27:58 +0200 Subject: [PATCH] file system: Exception for non-permitted symlinks Until now, there was not exception type for the condition where a symlink was created on a file system w/o supporting symlinks, e.g., FAT. The corresponding file-system server (ffat_fs) used to return a negative handle as a work around. I added 'Permission_denied' to the list of exceptions thrown by 'File_system::Session::symlink' to handle this case in a clean way. --- libports/src/server/ffat_fs/main.cc | 2 +- os/include/file_system_session/file_system_session.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libports/src/server/ffat_fs/main.cc b/libports/src/server/ffat_fs/main.cc index b6de6ca91..2ccad3ef3 100644 --- a/libports/src/server/ffat_fs/main.cc +++ b/libports/src/server/ffat_fs/main.cc @@ -290,7 +290,7 @@ namespace File_system { Symlink_handle symlink(Dir_handle, Name const &name, bool create) { /* not supported */ - return Symlink_handle(-1); + throw Permission_denied(); } Dir_handle dir(Path const &path, bool create) diff --git a/os/include/file_system_session/file_system_session.h b/os/include/file_system_session/file_system_session.h index fd647ec87..9b8647a8c 100644 --- a/os/include/file_system_session/file_system_session.h +++ b/os/include/file_system_session/file_system_session.h @@ -302,7 +302,7 @@ namespace File_system { Dir_handle, Name const &, Mode, bool); GENODE_RPC_THROW(Rpc_symlink, Symlink_handle, symlink, GENODE_TYPE_LIST(Invalid_handle, Node_already_exists, - Invalid_name, Lookup_failed), + Invalid_name, Lookup_failed, Permission_denied), Dir_handle, Name const &, bool); GENODE_RPC_THROW(Rpc_dir, Dir_handle, dir, GENODE_TYPE_LIST(Permission_denied, Node_already_exists,