| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/files/c/lib/util.h" | 5 #include "services/files/c/lib/util.h" |
| 6 | 6 |
| 7 #include <assert.h> |
| 7 #include <errno.h> | 8 #include <errno.h> |
| 8 | 9 |
| 9 namespace mojio { | 10 namespace mojio { |
| 10 | 11 |
| 11 int ErrorToErrno(mojo::files::Error error) { | 12 int ErrorToErrno(mojo::files::Error error) { |
| 12 switch (error) { | 13 switch (error) { |
| 13 // TODO(vtl): Real errno encodings.... | 14 // TODO(vtl): Real errno encodings.... |
| 14 case mojo::files::ERROR_OK: | 15 case mojo::files::ERROR_OK: |
| 15 return 0; | 16 return 0; |
| 16 case mojo::files::ERROR_UNKNOWN: | 17 case mojo::files::ERROR_UNKNOWN: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 29 return ENOSYS; | 30 return ENOSYS; |
| 30 case mojo::files::ERROR_CLOSED: | 31 case mojo::files::ERROR_CLOSED: |
| 31 return EBADF; | 32 return EBADF; |
| 32 case mojo::files::ERROR_UNAVAILABLE: | 33 case mojo::files::ERROR_UNAVAILABLE: |
| 33 // TODO(vtl): May sometimes be EAGAIN? | 34 // TODO(vtl): May sometimes be EAGAIN? |
| 34 return EACCES; | 35 return EACCES; |
| 35 case mojo::files::ERROR_INTERNAL: | 36 case mojo::files::ERROR_INTERNAL: |
| 36 // TODO(vtl): Something better? | 37 // TODO(vtl): Something better? |
| 37 return EIO; | 38 return EIO; |
| 38 } | 39 } |
| 40 assert(false); |
| 41 // TODO(vtl): Something better? |
| 42 return EIO; |
| 39 } | 43 } |
| 40 | 44 |
| 41 } // namespace mojio | 45 } // namespace mojio |
| OLD | NEW |