11f5762e646bed2290934280464832782766ee68eMathias Agopian/* 21f5762e646bed2290934280464832782766ee68eMathias Agopian * Copyright (C) 2005 The Android Open Source Project 31f5762e646bed2290934280464832782766ee68eMathias Agopian * 41f5762e646bed2290934280464832782766ee68eMathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 51f5762e646bed2290934280464832782766ee68eMathias Agopian * you may not use this file except in compliance with the License. 61f5762e646bed2290934280464832782766ee68eMathias Agopian * You may obtain a copy of the License at 71f5762e646bed2290934280464832782766ee68eMathias Agopian * 81f5762e646bed2290934280464832782766ee68eMathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 91f5762e646bed2290934280464832782766ee68eMathias Agopian * 101f5762e646bed2290934280464832782766ee68eMathias Agopian * Unless required by applicable law or agreed to in writing, software 111f5762e646bed2290934280464832782766ee68eMathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 121f5762e646bed2290934280464832782766ee68eMathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131f5762e646bed2290934280464832782766ee68eMathias Agopian * See the License for the specific language governing permissions and 141f5762e646bed2290934280464832782766ee68eMathias Agopian * limitations under the License. 151f5762e646bed2290934280464832782766ee68eMathias Agopian */ 161f5762e646bed2290934280464832782766ee68eMathias Agopian 171f5762e646bed2290934280464832782766ee68eMathias Agopian#include <sys/types.h> 181f5762e646bed2290934280464832782766ee68eMathias Agopian 191f5762e646bed2290934280464832782766ee68eMathias Agopian// 201f5762e646bed2290934280464832782766ee68eMathias Agopian// Handy utility functions and portability code. 211f5762e646bed2290934280464832782766ee68eMathias Agopian// 221f5762e646bed2290934280464832782766ee68eMathias Agopian#ifndef _LIBS_ANDROID_FW_MISC_H 231f5762e646bed2290934280464832782766ee68eMathias Agopian#define _LIBS_ANDROID_FW_MISC_H 241f5762e646bed2290934280464832782766ee68eMathias Agopian 251f5762e646bed2290934280464832782766ee68eMathias Agopiannamespace android { 261f5762e646bed2290934280464832782766ee68eMathias Agopian 271f5762e646bed2290934280464832782766ee68eMathias Agopian/* 281f5762e646bed2290934280464832782766ee68eMathias Agopian * Some utility functions for working with files. These could be made 291f5762e646bed2290934280464832782766ee68eMathias Agopian * part of a "File" class. 301f5762e646bed2290934280464832782766ee68eMathias Agopian */ 311f5762e646bed2290934280464832782766ee68eMathias Agopiantypedef enum FileType { 321f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeUnknown = 0, 331f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeNonexistent, // i.e. ENOENT 341f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeRegular, 351f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeDirectory, 361f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeCharDev, 371f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeBlockDev, 381f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeFifo, 391f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeSymlink, 401f5762e646bed2290934280464832782766ee68eMathias Agopian kFileTypeSocket, 411f5762e646bed2290934280464832782766ee68eMathias Agopian} FileType; 421f5762e646bed2290934280464832782766ee68eMathias Agopian/* get the file's type; follows symlinks */ 431f5762e646bed2290934280464832782766ee68eMathias AgopianFileType getFileType(const char* fileName); 441f5762e646bed2290934280464832782766ee68eMathias Agopian/* get the file's modification date; returns -1 w/errno set on failure */ 451f5762e646bed2290934280464832782766ee68eMathias Agopiantime_t getFileModDate(const char* fileName); 461f5762e646bed2290934280464832782766ee68eMathias Agopian 471f5762e646bed2290934280464832782766ee68eMathias Agopian}; // namespace android 481f5762e646bed2290934280464832782766ee68eMathias Agopian 491f5762e646bed2290934280464832782766ee68eMathias Agopian#endif // _LIBS_ANDROID_FW_MISC_H 50