[Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2004-09-30 15:32:05
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21570 Modified Files: fs_native.c Log Message: make previous changes explicit in code instead of macros, for clarity Index: fs_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -w -b -B -p -r1.50 -r1.51 --- fs_native.c 29 Sep 2004 23:17:18 -0000 1.50 +++ fs_native.c 30 Sep 2004 15:31:55 -0000 1.51 @@ -181,18 +181,6 @@ do { #define __SYS_FDATASYNC SYS_fdatasync #endif -#if defined(USE_NATIVE_UTIME) -#define __SYS_UTIME SYS_utimes -#define __TIME_BUF(x) struct timeval x##[2] -#define __SET_AT(x,y) (x)[0].tv_sec = (y) -#define __SET_MT(x,y) (x)[1].tv_sec = (y) -#else -#define __SYS_UTIME SYS_utime -#define __TIME_BUF(x) struct utimbuf x -#define __SET_AT(x,y) (x).actime = (y) -#define __SET_MT(x,y) (x).modtime = (y) -#endif - /* * Native file identifiers format. */ @@ -799,18 +787,30 @@ native_inop_setattr(struct pnode *pno, if (err) mask &= ~SETATTR_MODE; else if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - __TIME_BUF(ut); - /* * Alter access and/or modify time attributes. */ - __SET_AT(ut, stat->st_atime); - __SET_MT(ut, stat->st_mtime); +#if defined(USE_NATIVE_UTIME) + struct timeval ut[2]; + + ut[0].tv_sec = stat->st_atime; + ut[1].tv_sec = stat->st_mtime; + if (mask & SETATTR_MTIME) + ut[1].tv_sec = stat->st_mtime; + if (mask & SETATTR_ATIME) + ut[0].tv_sec = stat->st_atime; + err = syscall(SYS_utimes, path, &ut); +#else + struct utimbuf ut; + + ut.actime = stat->st_atime; + ut.modtime = stat->st_mtime; if (mask & SETATTR_MTIME) - __SET_MT(ut, stat->st_mtime); + ut.modtime = stat->st_mtime; if (mask & SETATTR_ATIME) - __SET_AT(ut, stat->st_atime); - err = syscall(__SYS_UTIME, path, &ut); + ut.actime = stat->st_atime; + err = syscall(SYS_utime, path, &ut); +#endif if (err) err = -errno; } @@ -878,11 +878,19 @@ native_inop_setattr(struct pnode *pno, : (gid_t )-1)); } if (mask & (SETATTR_MTIME|SETATTR_ATIME)) { - __TIME_BUF(ut); +#if defined(USE_NATIVE_UTIME) + struct timeval ut[2]; + + ut[0].tv_sec = ino->i_stbuf.st_atime; + ut[1].tv_sec = ino->i_stbuf.st_mtime; + (void )syscall(SYS_utimes, path, &ut); +#else + struct utimbuf ut; - __SET_AT(ut, ino->i_stbuf.st_atime); - __SET_MT(ut, ino->i_stbuf.st_mtime); - (void )syscall(__SYS_UTIME, path, &ut); + ut.actime = ino->i_stbuf.st_atime; + ut.modtime = ino->i_stbuf.st_mtime; + (void )syscall(SYS_utime, path, &ut); +#endif } if (mask & SETATTR_MODE) { fd < 0 |