1 /* 2 * Copyright 2021 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Augustin Cavalier, <waddlesplash> 7 */ 8 #ifndef NTFS_H 9 #define NTFS_H 10 11 12 #include <StorageDefs.h> 13 #include <lock.h> 14 #include <fs_volume.h> 15 16 extern "C" { 17 #include "libntfs/types.h" 18 #include "libntfs/volume.h" 19 20 #include "lowntfs.h" 21 } 22 23 24 extern fs_volume_ops gNtfsVolumeOps; 25 extern fs_vnode_ops gNtfsVnodeOps; 26 27 28 struct volume { 29 ~volume() 30 { 31 mutex_destroy(&lock); 32 free(lowntfs.abs_mnt_point); 33 } 34 35 mutex lock; 36 uint32 fs_info_flags; 37 38 ntfs_volume* ntfs; 39 lowntfs_context lowntfs; 40 }; 41 42 typedef struct vnode { 43 ~vnode() 44 { 45 free(name); 46 } 47 48 u64 inode; 49 u64 parent_inode; 50 51 mode_t mode; 52 uid_t uid; 53 gid_t gid; 54 s64 size; 55 56 int lowntfs_close_state = 0; 57 u64 lowntfs_ghost = 0; 58 59 char* name = NULL; 60 void* file_cache = NULL; 61 } vnode; 62 63 64 typedef struct file_cookie { 65 int open_mode; 66 67 s64 last_size = 0; 68 bigtime_t last_notification = 0; 69 #define INODE_NOTIFICATION_INTERVAL 1000000LL 70 } file_cookie; 71 72 typedef struct directory_cookie { 73 typedef struct entry { 74 entry* next; 75 76 u64 inode; 77 u32 name_length; 78 char name[1]; /* variable length! */ 79 } entry; 80 entry* first, *current; 81 } directory_cookie; 82 83 84 #endif // NTFS_H 85