4 * \brief Header: VFS implemntation (?)
12 #include <sys/types.h>
17 #include "../src/fs.h" /* MC_MAXPATHLEN */
22 /* Flags of VFS classes */
23 #define VFSF_LOCAL 1 /* Class is local (not virtual) filesystem */
24 #define VFSF_NOLINKS 2 /* Hard links not supported */
27 * This is the type of callback function passed to vfs_fill_names.
28 * It gets the name of the virtual file system as its first argument.
32 typedef void (*fill_names_f
) (const char *);
35 struct vfs_class
*next
;
36 const char *name
; /* "FIles over SHell" */
38 const char *prefix
; /* "fish:" */
39 void *data
; /* this is for filesystem's own use */
40 int verrno
; /* can't use errno because glibc2 might define errno as function */
42 int (*init
) (struct vfs_class
*me
);
43 void (*done
) (struct vfs_class
*me
);
46 * The fill_names method shall call the callback function for every
47 * filesystem name that this vfs module supports.
49 void (*fill_names
) (struct vfs_class
*me
, fill_names_f
);
52 * The which() method shall return the index of the vfs subsystem
53 * or -1 if this vfs cannot handle the given pathname.
55 int (*which
) (struct vfs_class
*me
, const char *path
);
57 void *(*open
) (struct vfs_class
*me
, const char *fname
, int flags
,
59 int (*close
) (void *vfs_info
);
60 ssize_t (*read
) (void *vfs_info
, char *buffer
, int count
);
61 ssize_t (*write
) (void *vfs_info
, const char *buf
, int count
);
63 void *(*opendir
) (struct vfs_class
*me
, const char *dirname
);
64 void *(*readdir
) (void *vfs_info
);
65 int (*closedir
) (void *vfs_info
);
67 int (*stat
) (struct vfs_class
*me
, const char *path
, struct stat
* buf
);
68 int (*lstat
) (struct vfs_class
*me
, const char *path
, struct stat
* buf
);
69 int (*fstat
) (void *vfs_info
, struct stat
* buf
);
71 int (*chmod
) (struct vfs_class
*me
, const char *path
, int mode
);
72 int (*chown
) (struct vfs_class
*me
, const char *path
, int owner
, int group
);
73 int (*utime
) (struct vfs_class
*me
, const char *path
,
74 struct utimbuf
* times
);
76 int (*readlink
) (struct vfs_class
*me
, const char *path
, char *buf
,
78 int (*symlink
) (struct vfs_class
*me
, const char *n1
, const char *n2
);
79 int (*link
) (struct vfs_class
*me
, const char *p1
, const char *p2
);
80 int (*unlink
) (struct vfs_class
*me
, const char *path
);
81 int (*rename
) (struct vfs_class
*me
, const char *p1
, const char *p2
);
82 int (*chdir
) (struct vfs_class
*me
, const char *path
);
83 int (*ferrno
) (struct vfs_class
*me
);
84 off_t (*lseek
) (void *vfs_info
, off_t offset
, int whence
);
85 int (*mknod
) (struct vfs_class
*me
, const char *path
, int mode
, int dev
);
87 vfsid (*getid
) (struct vfs_class
*me
, const char *path
);
89 int (*nothingisopen
) (vfsid id
);
90 void (*free
) (vfsid id
);
92 char *(*getlocalcopy
) (struct vfs_class
*me
, const char *filename
);
93 int (*ungetlocalcopy
) (struct vfs_class
*me
, const char *filename
,
94 const char *local
, int has_changed
);
96 int (*mkdir
) (struct vfs_class
*me
, const char *path
, mode_t mode
);
97 int (*rmdir
) (struct vfs_class
*me
, const char *path
);
99 int (*ctl
) (void *vfs_info
, int ctlop
, void *arg
);
100 int (*setctl
) (struct vfs_class
*me
, const char *path
, int ctlop
,
105 * This union is used to ensure that there is enough space for the
106 * filename (d_name) when the dirent structure is created.
110 char _extra_buffer
[offsetof(struct dirent
, d_name
) + MC_MAXPATHLEN
+ 1];
113 /* Register a file system class */
114 int vfs_register_class (struct vfs_class
*vfs
);
117 /* Interface for requesting SMB credentials. */
118 struct smb_authinfo
{
126 struct smb_authinfo
*vfs_smb_get_authinfo (const char *host
,
130 #endif /* WITH_SMBFS */
132 struct vfs_class
*vfs_get_class (const char *path
);
133 struct vfs_class
*vfs_split (char *path
, char **inpath
, char **op
);
134 char *vfs_path (const char *path
);
135 int vfs_file_class_flags (const char *filename
);
137 void vfs_fill_names (fill_names_f
);
139 /* vfs/direntry.c: */
140 void *vfs_s_open (struct vfs_class
*, const char *, int, int);
143 extern int use_netrc
;
146 void init_cpiofs (void);
147 void init_extfs (void);
148 void init_fish (void);
149 void init_sfs (void);
150 void init_tarfs (void);
151 void init_undelfs (void);
155 #endif /* MC_VFS_IMPL_H */