LCOV - code coverage report
Current view: top level - xpcom/io - nsLocalFileUnix.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 3 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : /*
       8             :  * Implementation of nsIFile for ``Unixy'' systems.
       9             :  */
      10             : 
      11             : #ifndef _nsLocalFileUNIX_H_
      12             : #define _nsLocalFileUNIX_H_
      13             : 
      14             : #include <sys/stat.h>
      15             : #include <sys/types.h>
      16             : #include <unistd.h>
      17             : 
      18             : #include "nscore.h"
      19             : #include "nsString.h"
      20             : #include "nsReadableUtils.h"
      21             : #include "nsIHashable.h"
      22             : #include "nsIClassInfoImpl.h"
      23             : #include "mozilla/Attributes.h"
      24             : #ifdef MOZ_WIDGET_COCOA
      25             : #include "nsILocalFileMac.h"
      26             : #endif
      27             : 
      28             : /**
      29             :  *  we need these for statfs()
      30             :  */
      31             : #ifdef HAVE_SYS_STATVFS_H
      32             :   #if defined(__osf__) && defined(__DECCXX)
      33             :     extern "C" int statvfs(const char *, struct statvfs *);
      34             :   #endif
      35             :   #include <sys/statvfs.h>
      36             : #endif
      37             : 
      38             : #ifdef HAVE_SYS_STATFS_H
      39             :   #include <sys/statfs.h>
      40             : #endif
      41             : 
      42             : #ifdef HAVE_SYS_VFS_H
      43             :   #include <sys/vfs.h>
      44             : #endif
      45             : 
      46             : #ifdef HAVE_SYS_MOUNT_H
      47             :   #include <sys/param.h>
      48             :   #include <sys/mount.h>
      49             : #endif
      50             : 
      51             : #if defined(HAVE_STATVFS64) && (!defined(LINUX) && !defined(__osf__))
      52             :   #define STATFS statvfs64
      53             :   #define F_BSIZE f_frsize
      54             : #elif defined(HAVE_STATVFS) && (!defined(LINUX) && !defined(__osf__))
      55             :   #define STATFS statvfs
      56             :   #define F_BSIZE f_frsize
      57             : #elif defined(HAVE_STATFS64)
      58             :   #define STATFS statfs64
      59             :   #define F_BSIZE f_bsize
      60             : #elif defined(HAVE_STATFS)
      61             :   #define STATFS statfs
      62             :   #define F_BSIZE f_bsize
      63             : #endif
      64             : 
      65             : // stat64 and lstat64 are deprecated on OS X. Normal stat and lstat are
      66             : // 64-bit by default on OS X 10.6+.
      67             : #if defined(HAVE_STAT64) && defined(HAVE_LSTAT64) && !defined(XP_DARWIN)
      68             :   #if defined (AIX)
      69             :     #if defined STAT
      70             :       #undef STAT
      71             :     #endif
      72             :   #endif
      73             :   #define STAT stat64
      74             :   #define LSTAT lstat64
      75             :   #define HAVE_STATS64 1
      76             : #else
      77             :   #define STAT stat
      78             :   #define LSTAT lstat
      79             : #endif
      80             : 
      81             : 
      82             : class nsLocalFile final
      83             : #ifdef MOZ_WIDGET_COCOA
      84             :   : public nsILocalFileMac
      85             : #else
      86             :   : public nsILocalFile
      87             : #endif
      88             :   , public nsIHashable
      89             : {
      90             : public:
      91             :   NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
      92             : 
      93             :   nsLocalFile();
      94             : 
      95             :   static nsresult nsLocalFileConstructor(nsISupports* aOuter,
      96             :                                          const nsIID& aIID,
      97             :                                          void** aInstancePtr);
      98             : 
      99             :   NS_DECL_THREADSAFE_ISUPPORTS
     100             :   NS_DECL_NSIFILE
     101             :   NS_DECL_NSILOCALFILE
     102             : #ifdef MOZ_WIDGET_COCOA
     103             :   NS_DECL_NSILOCALFILEMAC
     104             : #endif
     105             :   NS_DECL_NSIHASHABLE
     106             : 
     107             : public:
     108             :   static void GlobalInit();
     109             :   static void GlobalShutdown();
     110             : 
     111             : private:
     112             :   nsLocalFile(const nsLocalFile& aOther);
     113        9928 :   ~nsLocalFile()
     114        9928 :   {
     115        9928 :   }
     116             : 
     117             : protected:
     118             :   // This stat cache holds the *last stat* - it does not invalidate.
     119             :   // Call "FillStatCache" whenever you want to stat our file.
     120             :   struct STAT  mCachedStat;
     121             :   nsCString    mPath;
     122             : 
     123             :   void LocateNativeLeafName(nsACString::const_iterator&,
     124             :                             nsACString::const_iterator&);
     125             : 
     126             :   nsresult CopyDirectoryTo(nsIFile* aNewParent);
     127             :   nsresult CreateAllAncestors(uint32_t aPermissions);
     128             :   nsresult GetNativeTargetPathName(nsIFile* aNewParent,
     129             :                                    const nsACString& aNewName,
     130             :                                    nsACString& aResult);
     131             : 
     132             :   bool FillStatCache();
     133             : 
     134             :   nsresult CreateAndKeepOpen(uint32_t aType, int aFlags,
     135             :                              uint32_t aPermissions, PRFileDesc** aResult);
     136             : };
     137             : 
     138             : #endif /* _nsLocalFileUNIX_H_ */

Generated by: LCOV version 1.13