Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/kernel_object.h |
| diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.h b/native_client_sdk/src/libraries/nacl_io/kernel_object.h |
| index 70ffb2f54a13e80900067f0b1845e8348be2f591..29ab9fa8e9b5c5375249a6a46dc2aeb68740a471 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/kernel_object.h |
| +++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.h |
| @@ -30,11 +30,13 @@ namespace nacl_io { |
| class KernelObject { |
| public: |
| struct Descriptor_t { |
| - Descriptor_t() : flags(0) {} |
| - explicit Descriptor_t(const ScopedKernelHandle& h) : handle(h), flags(0) {} |
| + Descriptor_t() : flags(0), path() {} |
|
binji
2014/01/08 17:25:43
nit: path() is unnecessary, the default constructo
|
| + explicit Descriptor_t(const ScopedKernelHandle& h, const std::string& path_) |
| + : handle(h), flags(0), path(path_) {} |
|
Sam Clegg
2014/01/08 18:23:24
The _ suffix is used for member variables in the s
|
| ScopedKernelHandle handle; |
| int flags; |
| + std::string path; |
| }; |
| typedef std::vector<Descriptor_t> HandleMap_t; |
| typedef std::map<std::string, ScopedFilesystem> FsMap_t; |
| @@ -65,20 +67,26 @@ class KernelObject { |
| // Get FD-specific flags (currently only FD_CLOEXEC is supported). |
| Error GetFDFlags(int fd, int* out_flags); |
| + // Get path at which FD was opened, if available. |
| + std::string GetFDPath(int fd); |
|
binji
2014/01/08 17:25:43
remove GetFDPath
|
| // Set FD-specific flags (currently only FD_CLOEXEC is supported). |
| Error SetFDFlags(int fd, int flags); |
| // Convert from FD to KernelHandle, and acquire the handle. |
| // Assumes |out_handle| is non-NULL. |
| Error AcquireHandle(int fd, ScopedKernelHandle* out_handle); |
| + Error AcquireHandleAndPath(int fd, ScopedKernelHandle *out_handle, |
| + std::string& path); |
|
binji
2014/01/08 17:25:43
Our style guide says that out parameters must be p
|
| // Allocate a new fd and assign the handle to it, while |
| // ref counting the handle and associated filesystem. |
| // Assumes |handle| is non-NULL; |
| - int AllocateFD(const ScopedKernelHandle& handle); |
| + int AllocateFD(const ScopedKernelHandle& handle, |
| + const std::string& path = std::string()); |
|
Sam Clegg
2014/01/08 18:23:24
No spaces around the "=" sign for default params.
|
| // Assumes |handle| is non-NULL; |
| - void FreeAndReassignFD(int fd, const ScopedKernelHandle& handle); |
| + void FreeAndReassignFD(int fd, const ScopedKernelHandle& handle, |
| + const std::string& path); |
| void FreeFD(int fd); |
| // Returns or sets CWD |