diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1998-01-11 20:39:12 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1998-01-11 20:39:12 +0000 |
commit | 487fe4efe824e828cdefbee41c1d03ef04a885f3 (patch) | |
tree | 49663eae55a517c8ad3c2220a6ede523fa5dc975 /sys/msdosfs/msdosfs_conv.c | |
parent | 6607731225347e583be10d914e5758d7a9726fc9 (diff) |
FAT32 support from NetBSD by Wolfgang Solfrank.
Diffstat (limited to 'sys/msdosfs/msdosfs_conv.c')
-rw-r--r-- | sys/msdosfs/msdosfs_conv.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sys/msdosfs/msdosfs_conv.c b/sys/msdosfs/msdosfs_conv.c index bb439feeeae..c2d0babdfbc 100644 --- a/sys/msdosfs/msdosfs_conv.c +++ b/sys/msdosfs/msdosfs_conv.c @@ -1,9 +1,9 @@ -/* $OpenBSD: msdosfs_conv.c,v 1.7 1997/10/04 19:08:11 deraadt Exp $ */ -/* $NetBSD: msdosfs_conv.c,v 1.17 1996/02/09 19:13:42 christos Exp $ */ +/* $OpenBSD: msdosfs_conv.c,v 1.8 1998/01/11 20:39:06 provos Exp $ */ +/* $NetBSD: msdosfs_conv.c,v 1.24 1997/10/17 11:23:54 ws Exp $ */ /*- - * Copyright (C) 1995 Wolfgang Solfrank. - * Copyright (C) 1995 TooLs GmbH. + * Copyright (C) 1995, 1997 Wolfgang Solfrank. + * Copyright (C) 1995, 1997 TooLs GmbH. * All rights reserved. * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below). * @@ -94,10 +94,11 @@ u_short lastdtime; * file timestamps. The passed in unix time is assumed to be in GMT. */ void -unix2dostime(tsp, ddp, dtp) +unix2dostime(tsp, ddp, dtp, dhp) struct timespec *tsp; u_int16_t *ddp; u_int16_t *dtp; + u_int8_t *dhp; { u_long t; u_long days; @@ -112,6 +113,7 @@ unix2dostime(tsp, ddp, dtp) */ t = tsp->tv_sec - (tz.tz_minuteswest * 60) /* +- daylight savings time correction */ ; + t &= ~1; if (lasttime != t) { lasttime = t; lastdtime = (((t / 2) % 30) << DT_2SECONDS_SHIFT) @@ -153,6 +155,9 @@ unix2dostime(tsp, ddp, dtp) if (dtp != NULL) *dtp = lastdtime; + if (dhp != NULL) + *dhp = (tsp->tv_sec & 1) * 100 + tsp->tv_nsec / 10000000; + *ddp = lastddate; } @@ -171,9 +176,10 @@ u_long lastseconds; * not be too efficient. */ void -dos2unixtime(dd, dt, tsp) +dos2unixtime(dd, dt, dh, tsp) u_int dd; u_int dt; + u_int dh; struct timespec *tsp; { u_long seconds; @@ -192,7 +198,8 @@ dos2unixtime(dd, dt, tsp) } seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) * 2 + ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60 - + ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600; + + ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600 + + dh / 100; /* * If the year, month, and day from the last conversion are the * same then use the saved value. @@ -221,7 +228,7 @@ dos2unixtime(dd, dt, tsp) } tsp->tv_sec = seconds + lastseconds + (tz.tz_minuteswest * 60) /* -+ daylight savings time correction */ ; - tsp->tv_nsec = 0; + tsp->tv_nsec = (dh % 100) * 10000000; } static u_char @@ -546,7 +553,7 @@ unix2dosfn(un, dn, unlen, gen) i = 8 - (gentext + sizeof(gentext) - cp + 1); dn[i++] = '~'; while (cp < gentext + sizeof(gentext)) - dn[i] = *cp++; + dn[i++] = *cp++; return 3; } |