14 /* Note: Some of this functions are not static. This has rather good
15 * reason: exactly same functions would have to appear in sfs.c. This
16 * saves both computer's memory and my work. <pavel@ucw.cz>
20 local_open (vfs
*me
, char *file
, int flags
, int mode
)
25 fd
= open (file
, NO_LINEAR(flags
), mode
);
29 local_info
= g_new (int, 1);
36 local_read (void *data
, char *buffer
, int count
)
43 while ((n
= read (*((int *) data
), buffer
, count
)) == -1){
45 if (errno
== EAGAIN
) continue;
48 if (errno
== EINTR
) continue;
56 local_close (void *data
)
75 local_opendir (vfs
*me
, char *dirname
)
80 dir
= opendir (dirname
);
84 local_info
= (DIR **) g_new (DIR *, 1);
91 local_telldir (void *data
)
94 return telldir( *(DIR **) data
);
96 #warning "Native telldir() not available, emulation not implemented"
98 return 0; /* for dumb compilers */
99 #endif /* !HAVE_TELLDIR */
103 local_seekdir (void *data
, int offset
)
106 seekdir( *(DIR **) data
, offset
);
108 #warning "Native seekdir() not available, emulation not implemented"
110 #endif /* !HAVE_SEEKDIR */
114 local_readdir (void *data
)
116 return readdir (*(DIR **) data
);
120 local_closedir (void *data
)
124 i
= closedir (* (DIR **) data
);
131 local_stat (vfs
*me
, char *path
, struct stat
*buf
)
133 return stat (path
, buf
);
137 local_lstat (vfs
*me
, char *path
, struct stat
*buf
)
139 #ifndef HAVE_STATLSTAT
140 return lstat (path
,buf
);
142 return statlstat (path
, buf
);
147 local_fstat (void *data
, struct stat
*buf
)
149 return fstat (*((int *) data
), buf
);
153 local_chmod (vfs
*me
, char *path
, int mode
)
155 return chmod (path
, mode
);
159 local_chown (vfs
*me
, char *path
, int owner
, int group
)
161 return chown (path
, owner
, group
);
165 local_utime (vfs
*me
, char *path
, struct utimbuf
*times
)
167 return utime (path
, times
);
171 local_readlink (vfs
*me
, char *path
, char *buf
, int size
)
173 return readlink (path
, buf
, size
);
177 local_unlink (vfs
*me
, char *path
)
179 return unlink (path
);
183 local_symlink (vfs
*me
, char *n1
, char *n2
)
185 return symlink (n1
, n2
);
189 local_write (void *data
, char *buf
, int nbyte
)
198 while ((n
= write (fd
, buf
, nbyte
)) == -1){
200 if (errno
== EAGAIN
) continue;
203 if (errno
== EINTR
) continue;
211 local_rename (vfs
*me
, char *a
, char *b
)
213 return rename (a
, b
);
217 local_chdir (vfs
*me
, char *path
)
223 local_lseek (void *data
, off_t offset
, int whence
)
225 int fd
= * (int *) data
;
227 return lseek (fd
, offset
, whence
);
231 local_mknod (vfs
*me
, char *path
, int mode
, int dev
)
233 return mknod (path
, mode
, dev
);
237 local_link (vfs
*me
, char *p1
, char *p2
)
239 return link (p1
, p2
);
243 local_mkdir (vfs
*me
, char *path
, mode_t mode
)
245 return mkdir (path
, mode
);
249 local_rmdir (vfs
*me
, char *path
)
255 local_getid (vfs
*me
, char *path
, struct vfs_stamping
**parent
)
258 return (vfsid
) -1; /* We do not free local fs stuff at all */
262 local_nothingisopen (vfsid id
)
268 local_free (vfsid id
)
273 local_getlocalcopy (vfs
*me
, char *path
)
275 return g_strdup (path
);
279 local_ungetlocalcopy (vfs
*me
, char *path
, char *local
, int has_changed
)
286 local_mmap (vfs
*me
, caddr_t addr
, size_t len
, int prot
, int flags
, void *data
, off_t offset
)
288 int fd
= * (int *)data
;
290 return mmap (addr
, len
, prot
, flags
, fd
, offset
);
294 local_munmap (vfs
*me
, caddr_t addr
, size_t len
, void *data
)
296 return munmap (addr
, len
);
301 local_which (vfs
*me
, char *path
)
303 return 0; /* Every path which other systems do not like is expected to be ours */
306 vfs vfs_local_ops
= {
307 NULL
, /* This is place of next pointer */
353 local_ungetlocalcopy
,
367 NULL
, /* This is place of next pointer */