1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "nacl_io/filesystem.h"
13 #include "nacl_io/dir_node.h"
14 #include "nacl_io/log.h"
15 #include "nacl_io/node.h"
16 #include "nacl_io/osstat.h"
17 #include "nacl_io/path.h"
18 #include "sdk_util/auto_lock.h"
19 #include "sdk_util/ref_object.h"
27 Filesystem::Filesystem() : dev_(0) {
30 Filesystem::~Filesystem() {
33 Error
Filesystem::Init(const FsInitArgs
& args
) {
39 void Filesystem::Destroy() {
42 Error
Filesystem::OpenResource(const Path
& path
, ScopedNode
* out_node
) {
43 out_node
->reset(NULL
);
44 LOG_TRACE("Can't open resource: %s", path
.Join().c_str());
48 void Filesystem::OnNodeCreated(Node
* node
) {
49 node
->stat_
.st_ino
= inode_pool_
.Acquire();
50 node
->stat_
.st_dev
= dev_
;
53 void Filesystem::OnNodeDestroyed(Node
* node
) {
54 if (node
->stat_
.st_ino
)
55 inode_pool_
.Release(node
->stat_
.st_ino
);
58 Error
Filesystem::Filesystem_VIoctl(int request
, va_list args
) {
59 LOG_ERROR("Unsupported ioctl: %#x", request
);
63 Error
Filesystem::Filesystem_Ioctl(int request
, ...) {
65 va_start(args
, request
);
66 Error error
= Filesystem_VIoctl(request
, args
);
71 } // namespace nacl_io