Home | History | Annotate | Download | only in nacl_io
      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
      3 // found in the LICENSE file.
      4 
      5 #include "nacl_io/mount.h"
      6 
      7 #include <errno.h>
      8 #include <fcntl.h>
      9 #include <string>
     10 
     11 #include "nacl_io/mount_node.h"
     12 #include "nacl_io/mount_node_dir.h"
     13 #include "nacl_io/mount_node_mem.h"
     14 #include "nacl_io/osstat.h"
     15 #include "nacl_io/path.h"
     16 #include "sdk_util/auto_lock.h"
     17 #include "sdk_util/ref_object.h"
     18 
     19 #if defined(WIN32)
     20 #include <windows.h>
     21 #endif
     22 
     23 namespace nacl_io {
     24 
     25 Mount::Mount() : dev_(0) {}
     26 
     27 Mount::~Mount() {}
     28 
     29 Error Mount::Init(const MountInitArgs& args) {
     30   dev_ = args.dev;
     31   ppapi_ = args.ppapi;
     32   return 0;
     33 }
     34 
     35 void Mount::Destroy() {}
     36 
     37 Error Mount::OpenResource(const Path& path, ScopedMountNode* out_node) {
     38   out_node->reset(NULL);
     39   return EINVAL;
     40 }
     41 
     42 void Mount::OnNodeCreated(MountNode* node) {
     43   node->stat_.st_ino = inode_pool_.Acquire();
     44   node->stat_.st_dev = dev_;
     45 }
     46 
     47 void Mount::OnNodeDestroyed(MountNode* node) {
     48   if (node->stat_.st_ino)
     49     inode_pool_.Release(node->stat_.st_ino);
     50 }
     51 
     52 }  // namespace nacl_io
     53 
     54