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