Add the linux statfs64 call. This allows Tivoli backup to proceed a little

but further on -current (still not successful, but a step into the right
direction).

Sponsored by:	Google SoC 2006
Submitted by:	rdivacky
Tested by:	Paul Mather <paul@gromit.dlib.vt.edu>
This commit is contained in:
netchild 2006-08-27 08:56:54 +00:00
parent d7beaaec70
commit 33681b868d
5 changed files with 53 additions and 4 deletions

View File

@ -77,7 +77,6 @@ DUMMY(timer_settime);
DUMMY(timer_gettime);
DUMMY(timer_getoverrun);
DUMMY(timer_delete);
DUMMY(statfs64);
DUMMY(fstatfs64);
DUMMY(utimes);
DUMMY(fadvise64_64);

View File

@ -430,7 +430,7 @@
266 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \
struct l_timespec *rqtp, struct l_timespec *rmtp); }
268 AUE_NULL STD { int linux_statfs64(void); }
268 AUE_NULL STD { int linux_statfs64(char *path, struct l_statfs64_buf *buf); }
269 AUE_NULL STD { int linux_fstatfs64(void); }
270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); }
271 AUE_NULL STD { int linux_utimes(void); }

View File

@ -312,6 +312,19 @@ struct l_statfs {
l_int f_spare[6];
};
struct l_statfs64 {
l_int f_type;
l_int f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
l_fsid_t f_fsid;
l_int f_namelen;
l_int f_spare[6];
};
#define LINUX_CODA_SUPER_MAGIC 0x73757245L
#define LINUX_EXT2_SUPER_MAGIC 0xEF53L
#define LINUX_HPFS_SUPER_MAGIC 0xf995e849L
@ -387,6 +400,44 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
}
static void
bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
{
linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
linux_statfs->f_bsize = bsd_statfs->f_bsize;
linux_statfs->f_blocks = bsd_statfs->f_blocks;
linux_statfs->f_bfree = bsd_statfs->f_bfree;
linux_statfs->f_bavail = bsd_statfs->f_bavail;
linux_statfs->f_ffree = bsd_statfs->f_ffree;
linux_statfs->f_files = bsd_statfs->f_files;
linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
linux_statfs->f_namelen = MAXNAMLEN;
}
int
linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
{
struct l_statfs64 linux_statfs;
struct statfs bsd_statfs;
char *path;
int error;
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
if (ldebug(statfs64))
printf(ARGS(statfs64, "%s, *"), path);
#endif
error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
LFREEPATH(path);
if (error)
return (error);
bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
}
int
linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
{

View File

@ -73,7 +73,6 @@ DUMMY(epoll_create);
DUMMY(epoll_ctl);
DUMMY(epoll_wait);
DUMMY(remap_file_pages);
DUMMY(statfs64);
DUMMY(fstatfs64);
DUMMY(utimes);
DUMMY(fadvise64_64);

View File

@ -434,7 +434,7 @@
266 AUE_NULL STD { int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
267 AUE_NULL STD { int linux_clock_nanosleep(clockid_t which, int flags, \
struct l_timespec *rqtp, struct l_timespec *rmtp); }
268 AUE_NULL STD { int linux_statfs64(void); }
268 AUE_NULL STD { int linux_statfs64(char *path, struct l_statfs64_buf *buf); }
269 AUE_NULL STD { int linux_fstatfs64(void); }
270 AUE_NULL STD { int linux_tgkill(int tgid, int pid, int sig); }
271 AUE_NULL STD { int linux_utimes(void); }