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
)
95 return telldir( *(DIR **) data
);
97 #warning "Native telldir() not available, emulation not implemented"
99 return 0; /* for dumb compilers */
100 #endif /* !HAVE_TELLDIR */
104 local_seekdir (void *data
, int offset
)
107 seekdir( *(DIR **) data
, offset
);
109 #warning "Native seekdir() not available, emulation not implemented"
111 #endif /* !HAVE_SEEKDIR */
115 local_readdir (void *data
)
117 return readdir (*(DIR **) data
);
121 local_closedir (void *data
)
125 i
= closedir (* (DIR **) data
);
132 local_stat (vfs
*me
, char *path
, struct stat
*buf
)
134 return stat (path
, buf
);
138 local_lstat (vfs
*me
, char *path
, struct stat
*buf
)
140 #ifndef HAVE_STATLSTAT
141 return lstat (path
,buf
);
143 return statlstat (path
, buf
);
148 local_fstat (void *data
, struct stat
*buf
)
150 return fstat (*((int *) data
), buf
);
154 local_chmod (vfs
*me
, char *path
, int mode
)
156 return chmod (path
, mode
);
160 local_chown (vfs
*me
, char *path
, int owner
, int group
)
162 return chown (path
, owner
, group
);
166 local_utime (vfs
*me
, char *path
, struct utimbuf
*times
)
168 return utime (path
, times
);
172 local_readlink (vfs
*me
, char *path
, char *buf
, int size
)
174 return readlink (path
, buf
, size
);
178 local_unlink (vfs
*me
, char *path
)
180 return unlink (path
);
184 local_symlink (vfs
*me
, char *n1
, char *n2
)
186 return symlink (n1
, n2
);
190 local_write (void *data
, char *buf
, int nbyte
)
199 while ((n
= write (fd
, buf
, nbyte
)) == -1){
201 if (errno
== EAGAIN
) continue;
204 if (errno
== EINTR
) continue;
212 local_rename (vfs
*me
, char *a
, char *b
)
214 return rename (a
, b
);
218 local_chdir (vfs
*me
, char *path
)
224 local_lseek (void *data
, off_t offset
, int whence
)
226 int fd
= * (int *) data
;
228 return lseek (fd
, offset
, whence
);
232 local_mknod (vfs
*me
, char *path
, int mode
, int dev
)
234 return mknod (path
, mode
, dev
);
238 local_link (vfs
*me
, char *p1
, char *p2
)
240 return link (p1
, p2
);
244 local_mkdir (vfs
*me
, char *path
, mode_t mode
)
246 return mkdir (path
, mode
);
250 local_rmdir (vfs
*me
, char *path
)
256 local_getid (vfs
*me
, char *path
, struct vfs_stamping
**parent
)
259 return (vfsid
) -1; /* We do not free local fs stuff at all */
263 local_nothingisopen (vfsid id
)
269 local_free (vfsid id
)
274 local_getlocalcopy (vfs
*me
, char *path
)
276 return g_strdup (path
);
280 local_ungetlocalcopy (vfs
*me
, char *path
, char *local
, int has_changed
)
287 local_mmap (vfs
*me
, caddr_t addr
, size_t len
, int prot
, int flags
, void *data
, off_t offset
)
289 int fd
= * (int *)data
;
291 return mmap (addr
, len
, prot
, flags
, fd
, offset
);
295 local_munmap (vfs
*me
, caddr_t addr
, size_t len
, void *data
)
297 return munmap (addr
, len
);
302 local_which (vfs
*me
, char *path
)
304 return 0; /* Every path which other systems do not like is expected to be ours */
307 vfs vfs_local_ops
= {
308 NULL
, /* This is place of next pointer */
354 local_ungetlocalcopy
,
368 NULL
, /* This is place of next pointer */