1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 // BEGIN android-note 19 // address length was changed from long to int for performance reasons. 20 // END android-note 21 22 package org.apache.harmony.luni.platform; 23 24 import java.io.FileDescriptor; 25 import java.io.FileNotFoundException; 26 import java.io.IOException; 27 28 /** 29 * TODO Type description 30 * 31 */ 32 public interface IFileSystem { 33 34 public final int SHARED_LOCK_TYPE = 1; 35 36 public final int EXCLUSIVE_LOCK_TYPE = 2; 37 38 public final int SEEK_SET = 1; 39 40 public final int SEEK_CUR = 2; 41 42 public final int SEEK_END = 4; 43 44 public final int O_RDONLY = 0x00000000; 45 46 public final int O_WRONLY = 0x00000001; 47 48 public final int O_RDWR = 0x00000010; 49 50 public final int O_RDWRSYNC = 0x00000020; 51 52 public final int O_APPEND = 0x00000100; 53 54 public final int O_CREAT = 0x00001000; 55 56 public final int O_EXCL = 0x00010000; 57 58 public final int O_NOCTTY = 0x00100000; 59 60 public final int O_NONBLOCK = 0x01000000; 61 62 public final int O_TRUNC = 0x10000000; 63 64 public long read(int fileDescriptor, byte[] bytes, int offset, int length) 65 throws IOException; 66 67 public long write(int fileDescriptor, byte[] bytes, int offset, int length) 68 throws IOException; 69 70 public long readv(int fileDescriptor, int[] addresses, int[] offsets, 71 int[] lengths, int size) throws IOException; 72 73 public long writev(int fileDescriptor, int[] addresses, int[] offsets, 74 int[] lengths, int size) throws IOException; 75 76 // Required to support direct byte buffers 77 public long readDirect(int fileDescriptor, int address, int offset, 78 int length) throws IOException; 79 80 public long writeDirect(int fileDescriptor, int address, int offset, 81 int length) throws IOException; 82 83 public long length(int fd); 84 85 public boolean lock(int fileDescriptor, long start, long length, int type, 86 boolean waitFlag) throws IOException; 87 88 public void unlock(int fileDescriptor, long start, long length) 89 throws IOException; 90 91 public long seek(int fileDescriptor, long offset, int whence) 92 throws IOException; 93 94 public void fsync(int fileDescriptor, boolean metadata) throws IOException; 95 96 public void truncate(int fileDescriptor, long size) throws IOException; 97 98 /** 99 * Returns the granularity for virtual memory allocation. 100 */ 101 public int getAllocGranularity() throws IOException; 102 103 public int open(String path, int mode) throws FileNotFoundException; 104 105 public long transfer(int fileHandler, FileDescriptor socketDescriptor, 106 long offset, long count) throws IOException; 107 108 // BEGIN android-deleted 109 // public long ttyAvailable() throws IOException; 110 // public long ttyRead(byte[] bytes, int offset, int length) throws IOException; 111 // END android-deleted 112 113 // BEGIN android-added 114 public int ioctlAvailable(FileDescriptor fileDescriptor) throws IOException; 115 // END android-added 116 117 } 118