5 #if !defined(SCO_FLAVOR) || !defined(_SYS_SELECT_H)
6 # include <sys/time.h> /* alex: this redefines struct timeval */
7 #endif /* SCO_FLAVOR */
27 /* Our virtual file system layer */
34 void *(*open
)(char *fname
, int flags
, int mode
);
35 int (*close
)(void *vfs_info
);
36 int (*read
)(void *vfs_info
, char *buffer
, int count
);
37 int (*write
)(void *vfs_info
, char *buf
, int count
);
39 void *(*opendir
)(char *dirname
);
40 void *(*readdir
)(void *vfs_info
);
41 int (*closedir
)(void *vfs_info
);
43 int (*stat
)(char *path
, struct stat
*buf
);
44 int (*lstat
)(char *path
, struct stat
*buf
);
45 int (*fstat
)(void *vfs_info
, struct stat
*buf
);
47 int (*chmod
)(char *path
, int mode
);
48 int (*chown
)(char *path
, int owner
, int group
);
49 int (*utime
)(char *path
, struct utimbuf
*times
);
51 int (*readlink
)(char *path
, char *buf
, int size
);
52 int (*symlink
)(char *n1
, char *n2
);
53 int (*link
)(char *p1
, char *p2
);
54 int (*unlink
)(char *path
);
55 int (*rename
)(char *p1
, char *p2
);
56 int (*chdir
)(char *path
);
58 int (*lseek
)(void *vfs_info
, off_t offset
, int whence
);
59 int (*mknod
)(char *path
, int mode
, int dev
);
61 vfsid (*getid
)(char *path
, struct vfs_stamping
**parent
);
62 int (*nothingisopen
)(vfsid id
);
63 void (*free
)(vfsid id
);
65 char *(*getlocalcopy
)(char *filename
);
66 void (*ungetlocalcopy
)(char *filename
, char *local
, int has_changed
);
68 int (*mkdir
)(char *path
, mode_t mode
);
69 int (*rmdir
)(char *path
);
71 int (*ctl
)(void *vfs_info
, int ctlop
, int arg
);
72 int (*setctl
)(char *path
, int ctlop
, char *arg
);
73 void (*forget_about
)(char *path
);
75 caddr_t (*mmap
)(caddr_t addr
, size_t len
, int prot
, int flags
, void *vfs_info
, off_t offset
);
76 int (*munmap
)(caddr_t addr
, size_t len
, void *vfs_info
);
80 /* Other file systems */
81 extern vfs local_vfs_ops
;
82 extern vfs tarfs_vfs_ops
;
84 extern vfs ftpfs_vfs_ops
;
85 extern vfs mcfs_vfs_ops
;
87 extern vfs extfs_vfs_ops
;
89 extern vfs undelfs_vfs_ops
;
94 struct vfs_stamping
*parent
; /* At the moment applies to tarfs only */
95 struct vfs_stamping
*next
;
100 void vfs_shut (void);
102 extern int vfs_type_absolute
;
103 vfs
*vfs_type (char *path
);
104 vfsid
vfs_ncs_getid (vfs
*nvfs
, char *dir
, struct vfs_stamping
**par
);
105 void vfs_rm_parents (struct vfs_stamping
*stamp
);
106 char *vfs_path (char *path
);
107 char *vfs_canon (char *path
);
108 char *mc_get_current_wd (char *buffer
, int bufsize
);
109 int vfs_current_is_local (void);
110 int vfs_current_is_extfs (void);
111 int vfs_current_is_tarfs (void);
112 int vfs_file_is_local (char *name
);
113 int vfs_file_is_ftp (char *filename
);
114 char *vfs_get_current_dir (void);
116 void vfs_stamp (vfs
*, vfsid
);
117 void vfs_rmstamp (vfs
*, vfsid
, int);
118 void vfs_addstamp (vfs
*, vfsid
, struct vfs_stamping
*);
119 void vfs_add_noncurrent_stamps (vfs
*, vfsid
, struct vfs_stamping
*);
120 void vfs_add_current_stamps (void);
121 void vfs_free_resources(char *path
);
122 void vfs_timeout_handler ();
124 void vfs_force_expire (char *pathname
);
126 void vfs_fill_names (void (*)(char *));
128 /* Required for the vfs_canon routine */
129 char *tarfs_analysis (char *inname
, char **archive
, int is_dir
);
131 void ftpfs_init(void);
132 void ftpfs_done(void);
133 void ftpfs_set_debug (char *file
);
135 void ftpfs_hint_reread(int reread
);
136 void ftpfs_flushdir(void);
138 # define ftpfs_flushdir()
139 # define ftpfs_hint_reread(x)
141 /* They fill the file system names */
142 void mcfs_fill_names (void (*)(char *));
143 void ftpfs_fill_names (void (*)(char *));
144 void tarfs_fill_names (void (*)(char *));
146 char *ftpfs_gethome (char *);
147 char *mcfs_gethome (char *);
149 char *ftpfs_getupdir (char *);
150 char *mcfs_getupdir (char *);
152 /* Only the routines outside of the VFS module need the emulation macros */
154 int mc_open (char *file
, int flags
, ...);
155 int mc_close (int handle
);
156 int mc_read (int handle
, char *buffer
, int count
);
157 int mc_write (int hanlde
, char *buffer
, int count
);
158 off_t
mc_lseek (int fd
, off_t offset
, int whence
);
159 int mc_chdir (char *);
161 DIR *mc_opendir (char *dirname
);
162 struct dirent
*mc_readdir(DIR *dirp
);
163 int mc_closedir (DIR *dir
);
165 int mc_stat (char *path
, struct stat
*buf
);
166 int mc_lstat (char *path
, struct stat
*buf
);
167 int mc_fstat (int fd
, struct stat
*buf
);
169 int mc_chmod (char *path
, int mode
);
170 int mc_chown (char *path
, int owner
, int group
);
171 int mc_utime (char *path
, struct utimbuf
*times
);
172 int mc_readlink(char *path
, char *buf
, int bufsiz
);
173 int mc_unlink (char *path
);
174 int mc_symlink (char *name1
, char *name2
);
175 int mc_link (char *name1
, char *name2
);
176 int mc_mknod (char *, int, int);
177 int mc_rename (char *original
, char *target
);
178 int mc_write (int fd
, char *buf
, int nbyte
);
179 int mc_rmdir (char *path
);
180 int mc_mkdir (char *path
, mode_t mode
);
181 char *mc_getlocalcopy (char *filename
);
182 void mc_ungetlocalcopy (char *filename
, char *local
, int has_changed
);
183 char *mc_def_getlocalcopy (char *filename
);
184 void mc_def_ungetlocalcopy (char *filename
, char *local
, int has_changed
);
185 int mc_ctl (int fd
, int ctlop
, int arg
);
186 int mc_setctl (char *path
, int ctlop
, char *arg
);
188 caddr_t
mc_mmap (caddr_t
, size_t, int, int, int, off_t
);
189 int mc_unmap (caddr_t
, size_t);
190 int mc_munmap (caddr_t addr
, size_t len
);
191 #endif /* HAVE_MMAP */
199 # define vfs_fill_names(x)
200 # define vfs_add_current_stamps()
201 # define vfs_current_is_local() 1
202 # define vfs_file_is_local(x) 1
203 # define vfs_file_is_ftp(x) 0
204 # define vfs_current_is_tarfs() 0
205 # define vfs_current_is_extfs() 0
206 # define vfs_path(x) x
207 # define mc_close close
208 # define mc_read read
209 # define mc_write write
210 # define mc_lseek lseek
211 # define mc_opendir opendir
212 # define mc_readdir readdir
213 # define mc_closedir closedir
215 # define mc_get_current_wd(x,size) get_current_wd (x, size)
216 # define mc_fstat fstat
217 # define mc_lstat lstat
219 # define mc_readlink readlink
220 # define mc_symlink symlink
221 # define mc_rename rename
224 # define mc_open open
225 # define mc_utime utime
226 # define mc_chmod chmod
227 # define mc_chown chown
228 # define mc_chdir chdir
229 # define mc_unlink unlink
232 # define mc_mmap mmap
233 # define mc_munmap munmap
235 # define mc_ctl(a,b,c) 0
236 # define mc_setctl(a,b,c)
238 # define mc_stat stat
239 # define mc_mknod mknod
240 # define mc_link link
241 # define mc_mkdir mkdir
242 # define mc_rmdir rmdir
243 # define is_special_prefix(x) 0
244 # define vfs_type(x) (vfs *)(NULL)
245 # define vfs_setup_wd()
248 # define vfs_canon(p) strdup (canonicalize_pathname(p))
249 # define vfs_free_resources()
250 # define vfs_timeout_handler()
251 # define vfs_timeouts() 0
252 # define vfs_force_expire ()
256 # define mc_getlocalcopy(x) NULL
257 # define mc_ungetlocalcopy(x,y,z)
259 # define ftpfs_hint_reread(x)
260 # define ftpfs_flushdir()
269 # define mc_ctl(a,b,c) 0
272 # define mc_mkdir(a,b) mkdir(a)
278 #define mc_errno errno
280 #ifdef WANT_PARSE_LS_LGA
281 int parse_ls_lga (char *p
, struct stat
*s
, char **filename
, char **linkname
);
284 #define MCCTL_SETREMOTECOPY 0
285 #define MCCTL_ISREMOTECOPY 1
286 #define MCCTL_REMOTECOPYCHUNK 2
287 #define MCCTL_FINISHREMOTE 3
288 #define MCCTL_FLUSHDIR 4
290 /* Return codes from the ${fs}_ctl routine */
292 #define MCERR_TARGETOPEN -1
293 /* Can't open target file */
294 #define MCERR_READ -2
295 /* Read error on source file */
296 #define MCERR_WRITE -3
297 /* Write error on target file */
298 #define MCERR_FINISH -4
299 /* Finished transfer */
300 #define MCERR_DATA_ON_STDIN -5
301 /* Data waiting on stdin to be processed */