15 /* Note: Some of this functions are not static. This has rather good
16 * reason: exactly same functions would have to appear in sfs.c. This
17 * saves both computer's memory and my work. <pavel@ucw.cz>
21 local_open (vfs
*me
, char *file
, int flags
, int mode
)
26 fd
= open (file
, NO_LINEAR(flags
), mode
);
30 local_info
= g_new (int, 1);
37 local_read (void *data
, char *buffer
, int count
)
44 while ((n
= read (*((int *) data
), buffer
, count
)) == -1){
46 if (errno
== EAGAIN
) continue;
49 if (errno
== EINTR
) continue;
57 local_close (void *data
)
76 local_opendir (vfs
*me
, char *dirname
)
81 dir
= opendir (dirname
);
85 local_info
= (DIR **) g_new (DIR *, 1);
92 local_telldir (void *data
)
94 return telldir( *(DIR **) data
);
98 local_seekdir (void *data
, int offset
)
100 seekdir( *(DIR **) data
, offset
);
104 local_readdir (void *data
)
106 return readdir (*(DIR **) data
);
110 local_closedir (void *data
)
114 i
= closedir (* (DIR **) data
);
121 local_stat (vfs
*me
, char *path
, struct stat
*buf
)
123 return stat (path
, buf
);
127 local_lstat (vfs
*me
, char *path
, struct stat
*buf
)
129 #ifndef HAVE_STATLSTAT
130 return lstat (path
,buf
);
132 return statlstat (path
, buf
);
137 local_fstat (void *data
, struct stat
*buf
)
139 return fstat (*((int *) data
), buf
);
143 local_chmod (vfs
*me
, char *path
, int mode
)
145 return chmod (path
, mode
);
149 local_chown (vfs
*me
, char *path
, int owner
, int group
)
151 return chown (path
, owner
, group
);
155 local_utime (vfs
*me
, char *path
, struct utimbuf
*times
)
157 return utime (path
, times
);
161 local_readlink (vfs
*me
, char *path
, char *buf
, int size
)
163 return readlink (path
, buf
, size
);
167 local_unlink (vfs
*me
, char *path
)
169 return unlink (path
);
173 local_symlink (vfs
*me
, char *n1
, char *n2
)
175 return symlink (n1
, n2
);
179 local_write (void *data
, char *buf
, int nbyte
)
188 while ((n
= write (fd
, buf
, nbyte
)) == -1){
190 if (errno
== EAGAIN
) continue;
193 if (errno
== EINTR
) continue;
201 local_rename (vfs
*me
, char *a
, char *b
)
203 return rename (a
, b
);
207 local_chdir (vfs
*me
, char *path
)
213 local_lseek (void *data
, off_t offset
, int whence
)
215 int fd
= * (int *) data
;
217 return lseek (fd
, offset
, whence
);
221 local_mknod (vfs
*me
, char *path
, int mode
, int dev
)
223 return mknod (path
, mode
, dev
);
227 local_link (vfs
*me
, char *p1
, char *p2
)
229 return link (p1
, p2
);
233 local_mkdir (vfs
*me
, char *path
, mode_t mode
)
235 return mkdir (path
, mode
);
239 local_rmdir (vfs
*me
, char *path
)
245 local_getid (vfs
*me
, char *path
, struct vfs_stamping
**parent
)
248 return (vfsid
) -1; /* We do not free local fs stuff at all */
252 local_nothingisopen (vfsid id
)
258 local_free (vfsid id
)
263 local_getlocalcopy (vfs
*me
, char *path
)
265 return g_strdup (path
);
269 local_ungetlocalcopy (vfs
*me
, char *path
, char *local
, int has_changed
)
275 local_mmap (vfs
*me
, caddr_t addr
, size_t len
, int prot
, int flags
, void *data
, off_t offset
)
277 int fd
= * (int *)data
;
279 return mmap (addr
, len
, prot
, flags
, fd
, offset
);
283 local_munmap (vfs
*me
, caddr_t addr
, size_t len
, void *data
)
285 return munmap (addr
, len
);
290 local_which (vfs
*me
, char *path
)
292 return 0; /* Every path which other systems do not like is expected to be ours */
295 vfs vfs_local_ops
= {
296 NULL
, /* This is place of next pointer */
342 local_ungetlocalcopy
,