1 #ifndef MTOOLS_DIRENTRY_H 2 #define MTOOLS_DIRENTRY_H 3 /* Copyright 1998,2000-2002,2005,2008-2010 Alain Knaff. 4 * This file is part of mtools. 5 * 6 * Mtools is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Mtools is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Mtools. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 #include "sysincludes.h" 20 #include "vfat.h" 21 22 typedef struct direntry_t { 23 struct Stream_t *Dir; 24 /* struct direntry_t *parent; parent level */ 25 int entry; /* slot in parent directory (-3 if root) */ 26 struct directory dir; /* descriptor in parent directory (random if 27 * root)*/ 28 wchar_t name[MAX_VNAMELEN+1]; /* name in its parent directory, or 29 * NULL if root */ 30 int beginSlot; /* begin and end slot, for delete */ 31 int endSlot; 32 } direntry_t; 33 34 #include "stream.h" 35 36 int vfat_lookup(direntry_t *entry, const char *filename, int length, int flags, 37 char *shortname, size_t shortname_len, 38 char *longname, size_t longname_len); 39 40 struct directory *dir_read(direntry_t *entry, int *error); 41 42 void initializeDirentry(direntry_t *entry, struct Stream_t *Dir); 43 int isNotFound(direntry_t *entry); 44 direntry_t *getParent(direntry_t *entry); 45 void dir_write(direntry_t *entry); 46 void low_level_dir_write(direntry_t *entry); 47 void low_level_dir_write_end(Stream_t *Dir, int entry); 48 int fatFreeWithDirentry(direntry_t *entry); 49 int labelit(struct dos_name_t *dosname, 50 char *longname, 51 void *arg0, 52 direntry_t *entry); 53 int isSubdirOf(Stream_t *inside, Stream_t *outside); 54 char *getPwd(direntry_t *entry); 55 void fprintPwd(FILE *f, direntry_t *entry, int escape); 56 void fprintShortPwd(FILE *f, direntry_t *entry); 57 int write_vfat(Stream_t *, dos_name_t *, char *, int, direntry_t *); 58 59 void wipeEntry(struct direntry_t *entry); 60 61 void dosnameToDirentry(const struct dos_name_t *n, struct directory *dir); 62 63 int lookupForInsert(Stream_t *Dir, 64 direntry_t *direntry, 65 struct dos_name_t *dosname, 66 char *longname, 67 struct scan_state *ssp, 68 int ignore_entry, 69 int source_entry, 70 int pessimisticShortRename, 71 int use_longname); 72 #endif 73