1998-02-27 07:54:42 +03:00
|
|
|
#ifndef __VFS_H
|
|
|
|
#define __VFS_H
|
|
|
|
|
1998-11-21 22:36:01 +03:00
|
|
|
#include <config.h>
|
1999-01-10 11:55:35 +03:00
|
|
|
#include <sys/types.h>
|
1998-11-21 22:36:01 +03:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
|
1999-01-11 22:12:57 +03:00
|
|
|
#if !defined(SCO_FLAVOR) || !defined(_SYS_SELECT_H) || defined(IS_AIX)
|
1998-02-27 07:54:42 +03:00
|
|
|
# include <sys/time.h> /* alex: this redefines struct timeval */
|
|
|
|
#endif /* SCO_FLAVOR */
|
1998-03-31 21:27:11 +04:00
|
|
|
|
|
|
|
#ifdef HAVE_UTIME_H
|
|
|
|
# include <utime.h>
|
|
|
|
#else
|
|
|
|
struct utimbuf {
|
|
|
|
time_t actime;
|
|
|
|
time_t modtime;
|
|
|
|
};
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#ifdef USE_VFS
|
|
|
|
#ifdef HAVE_MMAP
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#endif
|
|
|
|
|
1998-09-27 23:27:58 +04:00
|
|
|
#ifdef VFS_STANDALONE
|
|
|
|
#undef USE_EXT2FSLIB
|
|
|
|
#else
|
1998-10-06 17:37:12 +04:00
|
|
|
#undef BROKEN_PATHS
|
1998-09-27 23:27:58 +04:00
|
|
|
/*
|
1998-10-06 17:37:12 +04:00
|
|
|
* Define this to allow /any/path/#ftp/ to access ftp tree. Broken, yes.
|
1998-09-27 23:27:58 +04:00
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Our virtual file system layer */
|
1999-01-18 10:52:24 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
typedef void * vfsid;
|
|
|
|
|
|
|
|
struct vfs_stamping;
|
1998-10-13 14:45:02 +04:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
/*
|
|
|
|
* Notice: Andrej Borsenkow <borsenkow.msk@sni.de> reports system
|
|
|
|
* (RelianUNIX), where it is bad idea to define struct vfs. That system
|
1998-10-23 12:26:25 +04:00
|
|
|
* has include called <sys/vfs.h>, which contains things like vfs_t.
|
1998-10-13 14:45:02 +04:00
|
|
|
*/
|
1998-10-14 06:56:18 +04:00
|
|
|
|
|
|
|
typedef struct _vfs vfs;
|
|
|
|
|
|
|
|
struct _vfs {
|
|
|
|
vfs *next;
|
1998-09-27 23:27:58 +04:00
|
|
|
char *name; /* "FIles over SHell" */
|
|
|
|
int flags;
|
|
|
|
#define F_EXEC 1
|
|
|
|
#define F_NET 2
|
1998-10-23 12:26:25 +04:00
|
|
|
char *prefix; /* "fish:" */
|
1998-09-27 23:27:58 +04:00
|
|
|
void *data; /* this is for filesystem's own use */
|
1998-09-29 00:41:28 +04:00
|
|
|
int verrno; /* can't use errno because glibc2 might define errno as function */
|
1998-10-14 06:56:18 +04:00
|
|
|
|
|
|
|
int (*init) (vfs *me);
|
|
|
|
void (*done) (vfs *me);
|
|
|
|
void (*fill_names) (vfs *me, void (*)(char *));
|
|
|
|
|
|
|
|
int (*which) (vfs *me, char *path);
|
|
|
|
|
|
|
|
void *(*open) (vfs *me, char *fname, int flags, int mode);
|
|
|
|
int (*close) (void *vfs_info);
|
|
|
|
int (*read) (void *vfs_info, char *buffer, int count);
|
|
|
|
int (*write) (void *vfs_info, char *buf, int count);
|
|
|
|
|
|
|
|
void *(*opendir) (vfs *me, char *dirname);
|
|
|
|
void *(*readdir) (void *vfs_info);
|
|
|
|
int (*closedir) (void *vfs_info);
|
|
|
|
int (*telldir) (void *vfs_info);
|
|
|
|
void (*seekdir) (void *vfs_info, int offset);
|
|
|
|
|
|
|
|
int (*stat) (vfs *me, char *path, struct stat *buf);
|
|
|
|
int (*lstat) (vfs *me, char *path, struct stat *buf);
|
|
|
|
int (*fstat) (void *vfs_info, struct stat *buf);
|
|
|
|
|
|
|
|
int (*chmod) (vfs *me, char *path, int mode);
|
|
|
|
int (*chown) (vfs *me, char *path, int owner, int group);
|
|
|
|
int (*utime) (vfs *me, char *path, struct utimbuf *times);
|
|
|
|
|
|
|
|
int (*readlink) (vfs *me, char *path, char *buf, int size);
|
|
|
|
int (*symlink) (vfs *me, char *n1, char *n2);
|
|
|
|
int (*link) (vfs *me, char *p1, char *p2);
|
|
|
|
int (*unlink) (vfs *me, char *path);
|
|
|
|
int (*rename) (vfs *me, char *p1, char *p2);
|
|
|
|
int (*chdir) (vfs *me, char *path);
|
|
|
|
int (*ferrno) (vfs *me);
|
|
|
|
int (*lseek) (void *vfs_info, off_t offset, int whence);
|
|
|
|
int (*mknod) (vfs *me, char *path, int mode, int dev);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
vfsid (*getid) (vfs *me, char *path, struct vfs_stamping **
|
|
|
|
parent);
|
|
|
|
|
|
|
|
int (*nothingisopen) (vfsid id);
|
|
|
|
void (*free) (vfsid id);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
char *(*getlocalcopy) (vfs *me, char *filename);
|
|
|
|
void (*ungetlocalcopy) (vfs *me, char *filename, char *local,
|
|
|
|
int has_changed);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
int (*mkdir) (vfs *me, char *path, mode_t mode);
|
|
|
|
int (*rmdir) (vfs *me, char *path);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
int (*ctl) (void *vfs_info, int ctlop, int arg);
|
|
|
|
int (*setctl) (vfs *me, char *path, int ctlop, char *arg);
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifdef HAVE_MMAP
|
1998-10-14 06:56:18 +04:00
|
|
|
caddr_t (*mmap) (vfs *me, caddr_t addr, size_t len, int prot,
|
|
|
|
int flags, void *vfs_info, off_t offset);
|
|
|
|
int (*munmap) (vfs *me, caddr_t addr, size_t len,
|
|
|
|
void *vfs_info);
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
1998-10-14 06:56:18 +04:00
|
|
|
};
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
/* Other file systems */
|
1998-10-13 02:07:53 +04:00
|
|
|
extern vfs vfs_local_ops;
|
|
|
|
extern vfs vfs_tarfs_ops;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-13 02:07:53 +04:00
|
|
|
extern vfs vfs_ftpfs_ops;
|
|
|
|
extern vfs vfs_fish_ops;
|
|
|
|
extern vfs vfs_mcfs_ops;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-13 02:07:53 +04:00
|
|
|
extern vfs vfs_extfs_ops;
|
|
|
|
extern vfs vfs_sfs_ops;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-13 02:07:53 +04:00
|
|
|
extern vfs vfs_undelfs_ops;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
struct vfs_stamping {
|
|
|
|
vfs *v;
|
|
|
|
vfsid id;
|
|
|
|
struct vfs_stamping *parent; /* At the moment applies to tarfs only */
|
|
|
|
struct vfs_stamping *next;
|
|
|
|
struct timeval time;
|
|
|
|
};
|
|
|
|
|
|
|
|
void vfs_init (void);
|
|
|
|
void vfs_shut (void);
|
|
|
|
|
|
|
|
extern int vfs_type_absolute;
|
|
|
|
vfs *vfs_type (char *path);
|
1998-09-15 00:50:11 +04:00
|
|
|
vfs *vfs_split (char *path, char **inpath, char **op);
|
1998-02-27 07:54:42 +03:00
|
|
|
vfsid vfs_ncs_getid (vfs *nvfs, char *dir, struct vfs_stamping **par);
|
|
|
|
void vfs_rm_parents (struct vfs_stamping *stamp);
|
|
|
|
char *vfs_path (char *path);
|
1998-12-16 09:16:13 +03:00
|
|
|
char *vfs_strip_suffix_from_filename (char *filename);
|
1998-02-27 07:54:42 +03:00
|
|
|
char *vfs_canon (char *path);
|
|
|
|
char *mc_get_current_wd (char *buffer, int bufsize);
|
|
|
|
int vfs_current_is_local (void);
|
1998-10-13 02:07:53 +04:00
|
|
|
#if 0
|
1998-02-27 07:54:42 +03:00
|
|
|
int vfs_current_is_extfs (void);
|
|
|
|
int vfs_current_is_tarfs (void);
|
1998-10-13 02:07:53 +04:00
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
int vfs_file_is_local (char *name);
|
|
|
|
int vfs_file_is_ftp (char *filename);
|
|
|
|
char *vfs_get_current_dir (void);
|
|
|
|
|
|
|
|
void vfs_stamp (vfs *, vfsid);
|
|
|
|
void vfs_rmstamp (vfs *, vfsid, int);
|
|
|
|
void vfs_addstamp (vfs *, vfsid, struct vfs_stamping *);
|
|
|
|
void vfs_add_noncurrent_stamps (vfs *, vfsid, struct vfs_stamping *);
|
|
|
|
void vfs_add_current_stamps (void);
|
|
|
|
void vfs_free_resources(char *path);
|
|
|
|
void vfs_timeout_handler ();
|
|
|
|
int vfs_timeouts ();
|
|
|
|
|
|
|
|
void vfs_fill_names (void (*)(char *));
|
1998-10-13 02:07:53 +04:00
|
|
|
char *vfs_translate_url (char *);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
void ftpfs_set_debug (char *file);
|
|
|
|
#ifdef USE_NETCODE
|
|
|
|
void ftpfs_hint_reread(int reread);
|
|
|
|
void ftpfs_flushdir(void);
|
|
|
|
#else
|
|
|
|
# define ftpfs_flushdir()
|
|
|
|
# define ftpfs_hint_reread(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Only the routines outside of the VFS module need the emulation macros */
|
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
int mc_open (char *file, int flags, ...);
|
|
|
|
int mc_close (int handle);
|
|
|
|
int mc_read (int handle, char *buffer, int count);
|
|
|
|
int mc_write (int hanlde, char *buffer, int count);
|
1998-02-27 07:54:42 +03:00
|
|
|
off_t mc_lseek (int fd, off_t offset, int whence);
|
1998-10-14 06:56:18 +04:00
|
|
|
int mc_chdir (char *);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
DIR *mc_opendir (char *dirname);
|
1998-02-27 07:54:42 +03:00
|
|
|
struct dirent *mc_readdir(DIR *dirp);
|
|
|
|
int mc_closedir (DIR *dir);
|
1998-05-26 04:53:24 +04:00
|
|
|
int mc_telldir (DIR *dir);
|
|
|
|
void mc_seekdir (DIR *dir, int offset);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
int mc_stat (char *path, struct stat *buf);
|
1998-02-27 07:54:42 +03:00
|
|
|
int mc_lstat (char *path, struct stat *buf);
|
|
|
|
int mc_fstat (int fd, struct stat *buf);
|
|
|
|
|
1998-10-14 06:56:18 +04:00
|
|
|
int mc_chmod (char *path, int mode);
|
|
|
|
int mc_chown (char *path, int owner, int group);
|
|
|
|
int mc_utime (char *path, struct utimbuf *times);
|
|
|
|
int mc_readlink (char *path, char *buf, int bufsiz);
|
|
|
|
int mc_unlink (char *path);
|
|
|
|
int mc_symlink (char *name1, char *name2);
|
|
|
|
int mc_link (char *name1, char *name2);
|
|
|
|
int mc_mknod (char *, int, int);
|
|
|
|
int mc_rename (char *original, char *target);
|
|
|
|
int mc_write (int fd, char *buf, int nbyte);
|
|
|
|
int mc_rmdir (char *path);
|
|
|
|
int mc_mkdir (char *path, mode_t mode);
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
char *mc_getlocalcopy (char *filename);
|
|
|
|
void mc_ungetlocalcopy (char *filename, char *local, int has_changed);
|
1998-09-27 23:27:58 +04:00
|
|
|
char *mc_def_getlocalcopy (vfs *vfs, char *filename);
|
|
|
|
void mc_def_ungetlocalcopy (vfs *vfs, char *filename, char *local, int has_changed);
|
1998-02-27 07:54:42 +03:00
|
|
|
int mc_ctl (int fd, int ctlop, int arg);
|
|
|
|
int mc_setctl (char *path, int ctlop, char *arg);
|
|
|
|
#ifdef HAVE_MMAP
|
|
|
|
caddr_t mc_mmap (caddr_t, size_t, int, int, int, off_t);
|
|
|
|
int mc_unmap (caddr_t, size_t);
|
|
|
|
int mc_munmap (caddr_t addr, size_t len);
|
|
|
|
#endif /* HAVE_MMAP */
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifdef USE_NETCODE
|
|
|
|
# undef USE_NETCODE
|
|
|
|
#endif
|
|
|
|
|
1998-05-26 04:53:24 +04:00
|
|
|
# undef USE_NETCODE
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
# define vfs_fill_names(x)
|
|
|
|
# define vfs_add_current_stamps()
|
|
|
|
# define vfs_current_is_local() 1
|
|
|
|
# define vfs_file_is_local(x) 1
|
|
|
|
# define vfs_file_is_ftp(x) 0
|
|
|
|
# define vfs_current_is_tarfs() 0
|
|
|
|
# define vfs_current_is_extfs() 0
|
|
|
|
# define vfs_path(x) x
|
1999-01-21 01:01:11 +03:00
|
|
|
# define vfs_strip_suffix_from_filename(x) g_strdup(x)
|
1998-02-27 07:54:42 +03:00
|
|
|
# define mc_close close
|
|
|
|
# define mc_read read
|
|
|
|
# define mc_write write
|
|
|
|
# define mc_lseek lseek
|
|
|
|
# define mc_opendir opendir
|
|
|
|
# define mc_readdir readdir
|
|
|
|
# define mc_closedir closedir
|
1998-05-26 04:53:24 +04:00
|
|
|
# define mc_telldir telldir
|
|
|
|
# define mc_seekdir seekdir
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
# define mc_get_current_wd(x,size) get_current_wd (x, size)
|
|
|
|
# define mc_fstat fstat
|
|
|
|
# define mc_lstat lstat
|
|
|
|
|
|
|
|
# define mc_readlink readlink
|
|
|
|
# define mc_symlink symlink
|
|
|
|
# define mc_rename rename
|
|
|
|
|
|
|
|
#ifndef __os2__
|
|
|
|
# define mc_open open
|
|
|
|
# define mc_utime utime
|
|
|
|
# define mc_chmod chmod
|
|
|
|
# define mc_chown chown
|
|
|
|
# define mc_chdir chdir
|
|
|
|
# define mc_unlink unlink
|
|
|
|
#endif
|
|
|
|
|
|
|
|
# define mc_mmap mmap
|
|
|
|
# define mc_munmap munmap
|
|
|
|
|
|
|
|
# define mc_ctl(a,b,c) 0
|
1999-01-08 23:38:27 +03:00
|
|
|
# define mc_setctl(a,b,c) 0
|
1999-01-21 01:01:11 +03:00
|
|
|
# define vfs_translate_url g_strdup(s)
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
# define mc_stat stat
|
|
|
|
# define mc_mknod mknod
|
|
|
|
# define mc_link link
|
|
|
|
# define mc_mkdir mkdir
|
|
|
|
# define mc_rmdir rmdir
|
|
|
|
# define is_special_prefix(x) 0
|
|
|
|
# define vfs_type(x) (vfs *)(NULL)
|
|
|
|
# define vfs_init()
|
|
|
|
# define vfs_shut()
|
1999-01-21 01:01:11 +03:00
|
|
|
# define vfs_canon(p) g_strdup (canonicalize_pathname(p))
|
1998-02-27 07:54:42 +03:00
|
|
|
# define vfs_free_resources()
|
|
|
|
# define vfs_timeout_handler()
|
|
|
|
# define vfs_timeouts() 0
|
1998-10-01 21:42:05 +04:00
|
|
|
# define vfs_force_expire()
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
typedef int vfs;
|
|
|
|
|
|
|
|
# define mc_getlocalcopy(x) NULL
|
|
|
|
# define mc_ungetlocalcopy(x,y,z)
|
|
|
|
|
|
|
|
# define ftpfs_hint_reread(x)
|
|
|
|
# define ftpfs_flushdir()
|
|
|
|
|
|
|
|
#ifdef _OS_NT
|
|
|
|
# undef mc_rmdir
|
1998-03-07 23:27:44 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef OS2_NT
|
1998-02-27 07:54:42 +03:00
|
|
|
# undef mc_ctl
|
|
|
|
# undef mc_unlink
|
|
|
|
# define mc_ctl(a,b,c) 0
|
1998-03-07 23:27:44 +03:00
|
|
|
# ifndef __EMX__
|
|
|
|
# undef mc_mkdir
|
|
|
|
# define mc_mkdir(a,b) mkdir(a)
|
|
|
|
# endif
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* USE_VFS */
|
|
|
|
|
|
|
|
#define mc_errno errno
|
|
|
|
|
1998-10-13 02:07:53 +04:00
|
|
|
/* These functions are meant for use by vfs modules */
|
|
|
|
|
|
|
|
extern int vfs_parse_ls_lga (char *p, struct stat *s, char **filename, char **linkname);
|
|
|
|
extern int vfs_split_text (char *p);
|
|
|
|
extern int vfs_parse_filetype (char c);
|
|
|
|
extern int vfs_parse_filemode (char *p);
|
|
|
|
extern int vfs_parse_filedate(int idx, time_t *t);
|
|
|
|
|
1998-05-26 04:53:24 +04:00
|
|
|
extern void vfs_die (char *msg);
|
|
|
|
extern char *vfs_get_password (char *msg);
|
1998-11-21 22:36:01 +03:00
|
|
|
extern char *vfs_split_url (char *path, char **host, char **user, int *port, char **pass,
|
|
|
|
int default_port, int flags);
|
|
|
|
#define URL_DEFAULTANON 1
|
|
|
|
#define URL_NOSLASH 2
|
1998-10-13 02:07:53 +04:00
|
|
|
extern void vfs_print_stats (char *fs_name, char *action, char *file_name, int have, int need);
|
1998-09-27 23:27:58 +04:00
|
|
|
|
1998-11-21 22:36:01 +03:00
|
|
|
/* Dont use values 0..4 for a while -- 10/98, pavel@ucw.cz */
|
1998-05-26 04:53:24 +04:00
|
|
|
#define MCCTL_REMOVELOCALCOPY 5
|
1998-09-18 15:02:04 +04:00
|
|
|
#define MCCTL_IS_NOTREADY 6
|
1998-09-27 23:27:58 +04:00
|
|
|
#define MCCTL_FORGET_ABOUT 7
|
1998-10-13 02:07:53 +04:00
|
|
|
#define MCCTL_EXTFS_RUN 8
|
1998-11-21 22:36:01 +03:00
|
|
|
/* These two make vfs layer give out potentially incorrect data, but
|
|
|
|
they also make some operation 100 times faster. Use with caution. */
|
1998-11-03 20:24:33 +03:00
|
|
|
#define MCCTL_WANT_STALE_DATA 9
|
1998-11-21 22:36:01 +03:00
|
|
|
#define MCCTL_NO_STALE_DATA 10
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-08-25 20:00:16 +04:00
|
|
|
extern int vfs_flags;
|
|
|
|
extern uid_t vfs_uid;
|
|
|
|
extern gid_t vfs_gid;
|
|
|
|
|
|
|
|
#define FL_ALWAYS_MAGIC 1
|
|
|
|
#define FL_NO_MCFS 2
|
|
|
|
#define FL_NO_FTPFS 4
|
|
|
|
#define FL_NO_UNDELFS 8
|
|
|
|
#define FL_NO_TARFS 16
|
|
|
|
#define FL_NO_EXTFS 32
|
|
|
|
#define FL_NO_SFS 64
|
1998-09-13 14:40:43 +04:00
|
|
|
#define FL_NO_FISH 128
|
|
|
|
|
|
|
|
#define FL_NO_CWDSETUP 0x40000000
|
|
|
|
|
|
|
|
#ifdef VFS_STANDALONE
|
|
|
|
extern void mc_vfs_init( void );
|
|
|
|
extern void mc_vfs_done( void );
|
|
|
|
#endif
|
1998-08-25 20:00:16 +04:00
|
|
|
|
1998-09-18 15:02:04 +04:00
|
|
|
#define O_ALL (O_CREAT | O_EXCL | O_NOCTTY | O_NDELAY | O_SYNC | O_WRONLY | O_RDWR | O_RDONLY)
|
|
|
|
/* Midnight commander code should _not_ use other flags than those
|
|
|
|
listed above and O_APPEND */
|
|
|
|
|
|
|
|
#if (O_ALL & O_APPEND)
|
|
|
|
#warning Unexpected problem with flags, O_LINEAR disabled, contact pavel@ucw.cz
|
|
|
|
#define O_LINEAR 0
|
|
|
|
#define IS_LINEAR(a) 0
|
|
|
|
#define NO_LINEAR(a) a
|
|
|
|
#else
|
|
|
|
#define O_LINEAR O_APPEND
|
1998-10-13 02:07:53 +04:00
|
|
|
#define IS_LINEAR(a) ((a) == (O_RDONLY | O_LINEAR)) /* Return only 0 and 1 ! */
|
1998-09-18 15:02:04 +04:00
|
|
|
#define NO_LINEAR(a) (((a) == (O_RDONLY | O_LINEAR)) ? O_RDONLY : (a))
|
|
|
|
#endif
|
1998-02-27 07:54:42 +03:00
|
|
|
|
1998-09-21 13:52:07 +04:00
|
|
|
/* O_LINEAR is strange beast, be carefull. If you open file asserting
|
|
|
|
* O_RDONLY | O_LINEAR, you promise:
|
|
|
|
*
|
|
|
|
* a) to read file linearily from beggining to the end
|
|
|
|
* b) not to open another file before you close this one
|
|
|
|
* (this will likely go away in future)
|
1998-10-13 02:07:53 +04:00
|
|
|
* as a special gift, you may
|
|
|
|
* c) lseek() immediately after open(), giving ftpfs chance to
|
|
|
|
* reget. Be warned that this lseek() can fail, and you _have_
|
|
|
|
* to handle that gratefully.
|
1998-09-21 13:52:07 +04:00
|
|
|
*
|
|
|
|
* O_LINEAR allows filesystems not to create temporary file in some
|
|
|
|
* cases (ftp transfer). -- pavel@ucw.cz
|
|
|
|
*/
|
|
|
|
|
1998-09-27 23:27:58 +04:00
|
|
|
#ifdef HAVE_MMAP
|
|
|
|
#define MMAPNULL , NULL, NULL
|
|
|
|
#else
|
|
|
|
#define MMAPNULL
|
1998-09-24 01:24:15 +04:00
|
|
|
#endif
|
1998-09-21 13:52:07 +04:00
|
|
|
|
1998-11-21 22:36:01 +03:00
|
|
|
/* And now some defines for our errors. */
|
|
|
|
|
1998-11-29 02:56:59 +03:00
|
|
|
#ifdef ENOSYS
|
1998-11-21 22:36:01 +03:00
|
|
|
#define E_NOTSUPP ENOSYS /* for use in vfs when module does not provide function */
|
1998-11-29 02:56:59 +03:00
|
|
|
#else
|
1998-12-09 23:22:53 +03:00
|
|
|
#define E_NOTSUPP EFAULT /* Does this happen? */
|
1998-11-29 02:56:59 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENOMSG
|
1998-11-21 22:36:01 +03:00
|
|
|
#define E_UNKNOWN ENOMSG /* if we do not know what error happened */
|
1998-11-29 02:56:59 +03:00
|
|
|
#else
|
1998-12-09 23:22:53 +03:00
|
|
|
#define E_UNKNOWN EIO /* if we do not know what error happened */
|
1998-11-29 02:56:59 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef EREMOTEIO
|
1998-11-21 22:36:01 +03:00
|
|
|
#define E_REMOTE EREMOTEIO /* if other side of ftp/fish reports error */
|
1998-11-29 02:56:59 +03:00
|
|
|
#else
|
1998-12-09 23:22:53 +03:00
|
|
|
#define E_REMOTE ENETUNREACH /* :-( there's no EREMOTEIO on some systems */
|
1998-11-29 02:56:59 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef EPROTO
|
1998-11-21 22:36:01 +03:00
|
|
|
#define E_PROTO EPROTO /* if other side fails to follow protocol */
|
1998-11-29 02:56:59 +03:00
|
|
|
#else
|
1998-12-09 23:22:53 +03:00
|
|
|
#define E_PROTO EIO
|
1998-11-29 02:56:59 +03:00
|
|
|
#endif
|
1998-11-21 22:36:01 +03:00
|
|
|
|
1998-09-18 15:02:04 +04:00
|
|
|
#endif /* __VFS_H */
|