summaryrefslogtreecommitdiffstats
path: root/sys/fs/nwfs
diff options
context:
space:
mode:
authorbp <bp@FreeBSD.org>2000-04-05 10:44:04 +0000
committerbp <bp@FreeBSD.org>2000-04-05 10:44:04 +0000
commit8ba252e4e1282bc7512da73cc01ec710a64f9759 (patch)
tree3b311ecbe4cd970eccd6758e923960f24f131e98 /sys/fs/nwfs
parentc41aef9448b8ca86cc10997777a6e5a89bdb21a2 (diff)
downloadFreeBSD-src-8ba252e4e1282bc7512da73cc01ec710a64f9759.zip
FreeBSD-src-8ba252e4e1282bc7512da73cc01ec710a64f9759.tar.gz
Try to obtain timezone offset from an environment of mount program.
This helps in cases where CMOS clock set to UTC time.
Diffstat (limited to 'sys/fs/nwfs')
-rw-r--r--sys/fs/nwfs/nwfs_mount.h1
-rw-r--r--sys/fs/nwfs/nwfs_node.c4
-rw-r--r--sys/fs/nwfs/nwfs_subr.c20
-rw-r--r--sys/fs/nwfs/nwfs_subr.h6
4 files changed, 16 insertions, 15 deletions
diff --git a/sys/fs/nwfs/nwfs_mount.h b/sys/fs/nwfs/nwfs_mount.h
index 613e685..23274a7 100644
--- a/sys/fs/nwfs/nwfs_mount.h
+++ b/sys/fs/nwfs/nwfs_mount.h
@@ -68,6 +68,7 @@ struct nwfs_args {
mode_t file_mode;
mode_t dir_mode;
struct ncp_nlstables nls;
+ int tz;
};
#ifdef _KERNEL
diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c
index 223143e..25d9225 100644
--- a/sys/fs/nwfs/nwfs_node.c
+++ b/sys/fs/nwfs/nwfs_node.c
@@ -284,9 +284,9 @@ nwfs_attr_cacheenter(struct vnode *vp, struct nw_entry_info *fi) {
va->va_fileid = NWFS_ROOT_INO;
va->va_blocksize=nmp->connh->nh_conn->buffer_size;/* blocksize preferred for i/o */
/* time of last modification */
- ncp_dos2unixtime(fi->modifyDate, fi->modifyTime, 0, &va->va_mtime);
+ ncp_dos2unixtime(fi->modifyDate, fi->modifyTime, 0, nmp->m.tz, &va->va_mtime);
/* time of last access */
- ncp_dos2unixtime(fi->lastAccessDate, 0, 0, &va->va_atime);
+ ncp_dos2unixtime(fi->lastAccessDate, 0, 0, nmp->m.tz, &va->va_atime);
va->va_ctime = va->va_mtime; /* time file changed */
va->va_gen = VNOVAL; /* generation number of file */
va->va_flags = 0; /* flags defined for file */
diff --git a/sys/fs/nwfs/nwfs_subr.c b/sys/fs/nwfs/nwfs_subr.c
index 9ba8b31..f83213f 100644
--- a/sys/fs/nwfs/nwfs_subr.c
+++ b/sys/fs/nwfs/nwfs_subr.c
@@ -384,11 +384,11 @@ ncp_setattr(vp, vap, cred, procp)
if (vap->va_mtime.tv_sec != VNOVAL) {
info_mask |= (DM_MODIFY_TIME | DM_MODIFY_DATE);
- ncp_unix2dostime(&vap->va_mtime, &info.modifyDate, &info.modifyTime, NULL);
+ ncp_unix2dostime(&vap->va_mtime, nmp->m.tz, &info.modifyDate, &info.modifyTime, NULL);
}
if (vap->va_atime.tv_sec != VNOVAL) {
info_mask |= (DM_LAST_ACCESS_DATE);
- ncp_unix2dostime(&vap->va_atime, &info.lastAccessDate,NULL,NULL);
+ ncp_unix2dostime(&vap->va_atime, nmp->m.tz, &info.lastAccessDate, NULL, NULL);
}
if (info_mask) {
error = ncp_modify_file_or_subdir_dos_info(nmp, vp, info_mask, &info,procp,cred);
@@ -532,8 +532,9 @@ static u_short lastdtime;
* file timestamps. The passed in unix time is assumed to be in GMT.
*/
void
-ncp_unix2dostime(tsp, ddp, dtp, dhp)
+ncp_unix2dostime(tsp, tzoff, ddp, dtp, dhp)
struct timespec *tsp;
+ int tzoff;
u_int16_t *ddp;
u_int16_t *dtp;
u_int8_t *dhp;
@@ -549,9 +550,8 @@ ncp_unix2dostime(tsp, ddp, dtp, dhp)
* If the time from the last conversion is the same as now, then
* skip the computations and use the saved result.
*/
- t = tsp->tv_sec - (tz.tz_minuteswest * 60)
- - (wall_cmos_clock ? adjkerntz : 0);
- /* - daylight savings time correction */
+ t = tsp->tv_sec - tzoff * 60 - tz.tz_minuteswest * 60 -
+ (wall_cmos_clock ? adjkerntz : 0);
t &= ~1;
if (lasttime != t) {
lasttime = t;
@@ -613,10 +613,11 @@ static u_long lastseconds;
* not be too efficient.
*/
void
-ncp_dos2unixtime(dd, dt, dh, tsp)
+ncp_dos2unixtime(dd, dt, dh, tzoff, tsp)
u_int dd;
u_int dt;
u_int dh;
+ int tzoff;
struct timespec *tsp;
{
u_long seconds;
@@ -659,8 +660,7 @@ ncp_dos2unixtime(dd, dt, dh, tsp)
days += ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT) - 1;
lastseconds = (days * 24 * 60 * 60) + SECONDSTO1980;
}
- tsp->tv_sec = seconds + lastseconds + (tz.tz_minuteswest * 60)
- + adjkerntz;
- /* + daylight savings time correction */
+ tsp->tv_sec = seconds + lastseconds + tz.tz_minuteswest * 60 +
+ tzoff * 60 + (wall_cmos_clock ? adjkerntz : 0);
tsp->tv_nsec = (dh % 100) * 10000000;
}
diff --git a/sys/fs/nwfs/nwfs_subr.h b/sys/fs/nwfs/nwfs_subr.h
index acec92c..b603c76 100644
--- a/sys/fs/nwfs/nwfs_subr.h
+++ b/sys/fs/nwfs/nwfs_subr.h
@@ -89,8 +89,8 @@ int ncp_get_volume_info_with_number(struct ncp_conn *conn,
int n, struct ncp_volume_info *target,
struct proc *p,struct ucred *cred);
-void ncp_unix2dostime __P((struct timespec *tsp, u_int16_t *ddp,
- u_int16_t *dtp, u_int8_t *dhp));
-void ncp_dos2unixtime __P((u_int dd, u_int dt, u_int dh, struct timespec *tsp));
+void ncp_unix2dostime (struct timespec *tsp, int tz, u_int16_t *ddp,
+ u_int16_t *dtp, u_int8_t *dhp);
+void ncp_dos2unixtime (u_int dd, u_int dt, u_int dh, int tz, struct timespec *tsp);
#endif /* !_NWFS_SUBR_H_ */
OpenPOWER on IntegriCloud