1 /* pfs.h: 2 * 3 **************************************************************** 4 * Copyright (C) 2003 Tom Lord 5 * 6 * See the file "COPYING" for further information about 7 * the copyright and warranty status of this work. 8 */ 9 10 #ifndef INCLUDE__LIBARCH__PFS_H 11 #define INCLUDE__LIBARCH__PFS_H 12 13 14 #include "hackerlab/machine/types.h" 15 #include "hackerlab/vu/vu.h" 16 #include "tla/libfsutils/dir-listing.h" 17 #include "tla/libawk/relational.h" 18 19 20 21 struct arch_pfs_session; 22 23 struct arch_pfs_vtable 24 { 25 int (*file_exists) (struct arch_pfs_session * p, const t_uchar * path); 26 int (*is_dir) (struct arch_pfs_session * p, const t_uchar * path); 27 28 t_uchar * (*file_contents) (struct arch_pfs_session * p, const t_uchar * path, int soft_errors); 29 int (*get_file) (struct arch_pfs_session * p, int out_fd, const t_uchar * path, int soft_errors); 30 rel_table (*directory_files) (struct arch_pfs_session * p, const t_uchar * path, int soft_errors); 31 32 int (*put_file) (struct arch_pfs_session * p, const t_uchar * path, mode_t perms, int in_fd, int soft_errors); 33 34 int (*mkdir) (struct arch_pfs_session * p, const t_uchar * path, mode_t mkdir, int soft_errors); 35 int (*rename) (struct arch_pfs_session * p, t_uchar ** errstr, const t_uchar * from, const t_uchar * to, int soft_errors); 36 37 int (*rmdir) (struct arch_pfs_session * p, const t_uchar * path, int soft_errors); 38 int (*rm) (struct arch_pfs_session * p, const t_uchar * path, int soft_errors); 39 }; 40 41 struct arch_pfs_session 42 { 43 struct arch_pfs_vtable * vtable; 44 }; 45 46 47 48 /* automatically generated __STDC__ prototypes */ 49 extern void arch_pfs_rmrf_file (struct arch_pfs_session * pfs, 50 const t_uchar * path); 51 extern void arch_pfs_pfs_make_archive (const t_uchar * name, 52 const t_uchar * uri, 53 const t_uchar * version, 54 const t_uchar *mirror_of, 55 int dot_listing_lossage, 56 int signed_archive); 57 extern int arch_valid_uri (const t_uchar * uri); 58 extern struct arch_pfs_session * arch_pfs_connect (const t_uchar * uri); 59 extern t_uchar * arch_pfs_file_contents (struct arch_pfs_session * pfs, 60 const t_uchar * path, 61 int soft_errors); 62 extern rel_table arch_pfs_directory_files (struct arch_pfs_session * pfs, 63 const t_uchar * path, 64 int soft_errors); 65 extern int arch_pfs_file_exists (struct arch_pfs_session * pfs, 66 const t_uchar * path); 67 extern int arch_pfs_get_file (struct arch_pfs_session * pfs, 68 int out_fd, 69 const t_uchar * path, 70 int soft_errors); 71 extern int arch_pfs_put_file (struct arch_pfs_session * pfs, 72 const t_uchar * path, 73 mode_t perms, 74 int in_fd, 75 int soft_errors); 76 extern int arch_pfs_put_atomic (struct arch_pfs_session * pfs, 77 t_uchar ** errstr, 78 const t_uchar * path, 79 mode_t perms, 80 int in_fd, 81 int replace, 82 int soft_errors); 83 extern int arch_pfs_mkdir (struct arch_pfs_session * pfs, 84 const t_uchar * path, 85 mode_t perms, 86 int soft_errors); 87 extern int arch_pfs_rename (struct arch_pfs_session * pfs, 88 t_uchar ** errstr, 89 const t_uchar * from, 90 const t_uchar * to, 91 int soft_errors); 92 extern int arch_pfs_is_dir (struct arch_pfs_session * pfs, 93 const t_uchar * path); 94 extern int arch_pfs_rmdir (struct arch_pfs_session * pfs, 95 const t_uchar * path, 96 int soft_errors); 97 extern int arch_pfs_rm (struct arch_pfs_session * pfs, 98 const t_uchar * path, 99 int soft_errors); 100 extern void arch_pfs_update_listing_file (struct arch_pfs_session * session, 101 const t_uchar * dir); 102 #endif /* INCLUDE__LIBARCH__PFS_H */ 103 104 105 /* tag: Tom Lord Sat Jan 5 15:26:10 2002 (pfs.h) 106 */ 107