1/* 2 * Copyright (c) 2000-2004 Anton Altaparmakov 3 * Copyright (c) 2002-2006 Szabolcs Szakacsits 4 * 5 * Copyright (c) 2006 Troeglazov Gerasim (3dEyes**) 6 * 7 * This program/include file is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or (at your 10 * option) any later version. 11 * 12 * This program/include file is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 15 * Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program (in the main directory of the Linux-NTFS distribution in the 19 * file COPYING); if not, write to the Free Software Foundation,Inc., 59 Temple 20 * Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22#ifndef NTFS_FS_FUNC_H 23#define NTFS_FS_FUNC_H 24 25 26#include <ctype.h> 27#include <dirent.h> 28#include <errno.h> 29#include <fcntl.h> 30#include <stdio.h> 31#include <stdlib.h> 32#include <string.h> 33#include <time.h> 34#include <unistd.h> 35#include <sys/stat.h> 36#include <KernelExport.h> 37 38#include "attributes.h" 39#include "lock.h" 40#include "ntfs.h" 41#include "volume_util.h" 42 43 44#define FS_DIR_MODE S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \ 45 S_IWGRP | S_IWOTH 46#define FS_FILE_MODE S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \ 47 S_IWGRP | S_IWOTH 48#define FS_SLNK_MODE S_IFLNK | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | \ 49 S_IWGRP | S_IWOTH 50 51 52extern fs_vnode_ops gNTFSVnodeOps; 53extern fs_volume_ops gNTFSVolumeOps; 54 55void fs_ntfs_update_times(fs_volume *vol, ntfs_inode *ni, 56 ntfs_time_update_flags mask); 57 58float fs_identify_partition(int fd, partition_data *partition, 59 void **_cookie); 60status_t fs_scan_partition(int fd, partition_data *partition, void *_cookie); 61void fs_free_identify_partition_cookie(partition_data *partition, 62 void *_cookie); 63 64status_t fs_mount(fs_volume *_vol, const char *device, ulong flags, 65 const char *args, ino_t *vnid); 66status_t fs_create_symlink(fs_volume *volume, fs_vnode *dir, const char *name, 67 const char *target, int mode); 68status_t fs_create(fs_volume *volume, fs_vnode *dir, const char *name, 69 int omode, int perms, void **_cookie, ino_t *_vnid); 70status_t fs_walk(fs_volume *_vol, fs_vnode *_dir, const char *file, 71 ino_t *vnid); 72status_t fs_get_vnode_name(fs_volume *volume, fs_vnode *vnode, char *buffer, 73 size_t bufferSize); 74status_t fs_unmount(fs_volume *_vol); 75status_t fs_rfsstat(fs_volume *_vol, struct fs_info *); 76status_t fs_wfsstat(fs_volume *_vol, const struct fs_info *fss, uint32 mask); 77status_t fs_sync(fs_volume *_vol); 78status_t fs_read_vnode(fs_volume *_vol, ino_t vnid, fs_vnode *_node, 79 int *_type, uint32 *_flags, bool reenter); 80status_t fs_write_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter); 81status_t fs_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter); 82status_t fs_access(fs_volume *volume, fs_vnode *vnode, int mode); 83status_t fs_rstat(fs_volume *volume, fs_vnode *vnode, struct stat *st); 84status_t fs_wstat(fs_volume *volume, fs_vnode *vnode, const struct stat *st, 85 uint32 mask); 86status_t fs_open(fs_volume *volume, fs_vnode *vnode, int omode, 87 void **cookie); 88status_t fs_close(fs_volume *volume, fs_vnode *vnode, void *cookie); 89status_t fs_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie); 90status_t fs_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, 91 void *buf, size_t *len); 92status_t fs_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, 93 const void *buf, size_t *len); 94status_t fs_mkdir(fs_volume *volume, fs_vnode *parent, const char *name, 95 int perms); 96status_t fs_rmdir(fs_volume *volume, fs_vnode *parent, const char *name); 97status_t fs_opendir(fs_volume *volume, fs_vnode *vnode, void** cookie); 98status_t fs_readdir(fs_volume *volume, fs_vnode *vnode, void *_cookie, 99 struct dirent *buf, size_t bufsize, uint32 *num); 100status_t fs_rewinddir(fs_volume *volume, fs_vnode *vnode, void *cookie); 101status_t fs_closedir(fs_volume *volume, fs_vnode *vnode, void *cookie); 102status_t fs_free_dircookie(fs_volume *volume, fs_vnode *vnode, void *cookie); 103status_t fs_readlink(fs_volume *volume, fs_vnode *link, char *buf, 104 size_t *bufsize); 105status_t fs_fsync(fs_volume *_vol, fs_vnode *_node); 106status_t fs_rename(fs_volume *volume, fs_vnode *fromDir, const char *fromName, 107 fs_vnode *toDir, const char *toName); 108status_t fs_unlink(fs_volume *volume, fs_vnode *dir, const char *name); 109status_t fs_initialize(int fd, partition_id partitionID, const char* name, 110 const char* parameterString, off_t partitionSize, disk_job_id job); 111uint32 fs_get_supported_operations(partition_data* partition, uint32 mask); 112 113#endif // NTFS_FS_FUNC_H 114 115