Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_handle.h

Issue 16232016: [NaCl SDK] nacl_io: big refactor to return error value (errno). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge master, fix windows Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 #ifndef LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ 5 #ifndef LIBRARIES_NACL_IO_KERNEL_HANDLE_H_
6 #define LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ 6 #define LIBRARIES_NACL_IO_KERNEL_HANDLE_H_
7 7
8 #include <pthread.h> 8 #include <pthread.h>
9 9
10 #include "nacl_io/error.h"
10 #include "nacl_io/ostypes.h" 11 #include "nacl_io/ostypes.h"
11 #include "sdk_util/macros.h" 12 #include "sdk_util/macros.h"
12 #include "sdk_util/ref_object.h" 13 #include "sdk_util/ref_object.h"
13 14
14 class Mount; 15 class Mount;
15 class MountNode; 16 class MountNode;
16 17
17 // KernelHandle provides a reference counted container for the open 18 // KernelHandle provides a reference counted container for the open
18 // file information, such as it's mount, node, access type and offset. 19 // file information, such as it's mount, node, access type and offset.
19 // KernelHandle can only be referenced when the KernelProxy lock is held. 20 // KernelHandle can only be referenced when the KernelProxy lock is held.
20 class KernelHandle : public RefObject { 21 class KernelHandle : public RefObject {
21 public: 22 public:
22 KernelHandle(Mount* mnt, MountNode* node, int oflags); 23 // Assumes |mnt| and |node| are non-NULL.
24 KernelHandle(Mount* mnt, MountNode* node);
23 25
24 off_t Seek(off_t offset, int whence); 26 Error Init(int open_flags);
27 // Assumes |out_offset| is non-NULL.
28 Error Seek(off_t offset, int whence, off_t* out_offset);
25 29
26 Mount* mount_; 30 Mount* mount_;
27 MountNode* node_; 31 MountNode* node_;
28 int mode_;
29 size_t offs_; 32 size_t offs_;
30 33
31 private: 34 private:
32 // May only be called by the KernelProxy when the Kernel's 35 // May only be called by the KernelProxy when the Kernel's
33 // lock is held. 36 // lock is held.
34 friend class KernelObject; 37 friend class KernelObject;
35 friend class KernelProxy; 38 friend class KernelProxy;
36 void Acquire() { RefObject::Acquire(); } 39 void Acquire() { RefObject::Acquire(); }
37 bool Release() { return RefObject::Release(); } 40 bool Release() { return RefObject::Release(); }
38 DISALLOW_COPY_AND_ASSIGN(KernelHandle); 41 DISALLOW_COPY_AND_ASSIGN(KernelHandle);
39 }; 42 };
40 43
41 #endif // LIBRARIES_NACL_IO_KERNEL_HANDLE_H_ 44 #endif // LIBRARIES_NACL_IO_KERNEL_HANDLE_H_
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/error.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698