[Libsysio-commit] RedStorm: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-09-27 20:20:55
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1:/tmp/cvs-serv15049/drivers/native Modified Files: Tag: RedStorm fs_native.c Log Message: Updated with recent changes in HEAD branch. Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.11.4.7 retrieving revision 1.11.4.8 diff -u -w -b -B -p -r1.11.4.7 -r1.11.4.8 --- fs_native.c 26 Sep 2003 21:28:34 -0000 1.11.4.7 +++ fs_native.c 27 Sep 2003 20:20:40 -0000 1.11.4.8 @@ -136,12 +136,12 @@ do { #endif #if defined(USE_NATIVE_STAT) -#define __SYS_STAT SYS_stat +#define __SYS_STAT SYS_lstat #define __SYS_FSTAT SYS_fstat #define __SYS_TRUNCATE SYS_truncate #define __SYS_FTRUNCATE SYS_ftruncate #else -#define __SYS_STAT SYS_stat64 +#define __SYS_STAT SYS_lstat64 #define __SYS_FSTAT SYS_fstat64 #define __SYS_TRUNCATE SYS_truncate64 #define __SYS_FTRUNCATE SYS_ftruncate64 @@ -206,7 +206,9 @@ static int native_inop_symlink(struct pn static int native_inop_readlink(struct pnode *pno, char *buf, size_t bufsiz); static int native_inop_open(struct pnode *pno, int flags, mode_t mode); static int native_inop_close(struct inode *ino); +static int native_inop_link(struct pnode *old, struct pnode *new); static int native_inop_unlink(struct pnode *pno); +static int native_inop_rename(struct pnode *old, struct pnode *new); static int native_inop_ipreadv(struct inode *ino, struct io_arguments *ioargs, struct ioctx **ioctxp); @@ -239,7 +241,9 @@ static struct inode_ops native_i_ops = { native_inop_readlink, native_inop_open, native_inop_close, + native_inop_link, native_inop_unlink, + native_inop_rename, native_inop_ipreadv, native_inop_ipwritev, native_inop_iodone, @@ -1070,6 +1074,32 @@ native_inop_close(struct inode *ino) } static int +native_inop_link(struct pnode *old, struct pnode *new) +{ + int err; + char *opath, *npath; + + err = 0; + + opath = _sysio_pb_path(old->p_base, '/'); + npath = _sysio_pb_path(new->p_base, '/'); + if (!(opath && npath)) { + err = -ENOMEM; + goto out; + } + + err = syscall(SYS_link, opath, npath); + +out: + if (opath) + free(opath); + if (npath) + free(npath); + + return err; +} + +static int native_inop_unlink(struct pnode *pno) { char *path; @@ -1185,6 +1215,30 @@ _readv(int fd, const struct iovec *vecto { return syscall(SYS_readv, fd, vector, count); +} + +static int +native_inop_rename(struct pnode *old, struct pnode *new) +{ + int err; + char *opath, *npath; + + opath = _sysio_pb_path(old->p_base, '/'); + npath = _sysio_pb_path(new->p_base, '/'); + if (!(opath && npath)) { + err = -ENOMEM; + goto out; + } + + err = syscall(SYS_rename, opath, npath); + +out: + if (opath) + free(opath); + if (npath) + free(npath); + + return err; } static int |