diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-22 16:40:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-22 16:40:47 -0400 |
| commit | 62429f434091586d54b37b8dd46076e7c08b27b9 (patch) | |
| tree | d8fd38000961eb30e37b90026efebb5ae946c1ad /fs/udf/udftime.c | |
| parent | 26defe34e48e18b058b773f60467729c64917490 (diff) | |
| parent | f845fced913b1437659bb5baf187698547697afe (diff) | |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6: (41 commits)
udf: use crc_itu_t from lib instead of udf_crc
udf: Fix compilation warnings when UDF debug is on
udf: Fix bug in VAT mapping code
udf: Add read-only support for 2.50 UDF media
udf: Fix handling of multisession media
udf: Mount filesystem read-only if it has pseudooverwrite partition
udf: Handle VAT packed inside inode properly
udf: Allow loading of VAT inode
udf: Fix detection of VAT version
udf: Silence warning about accesses beyond end of device
udf: Improve anchor block detection
udf: Cleanup anchor block detection.
udf: Move processing of virtual partitions
udf: Move filling of partition descriptor info into a separate function
udf: Improve error recovery on mount
udf: Cleanup volume descriptor sequence processing
udf: fix anchor point detection
udf: Remove declarations of arrays of size UDF_NAME_LEN (256 bytes)
udf: Remove checking of existence of filename in udf_add_entry()
udf: Mark udf_process_sequence() as noinline
...
Diffstat (limited to 'fs/udf/udftime.c')
| -rw-r--r-- | fs/udf/udftime.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c index ce595732ba6f..5f811655c9b5 100644 --- a/fs/udf/udftime.c +++ b/fs/udf/udftime.c | |||
| @@ -85,39 +85,38 @@ extern struct timezone sys_tz; | |||
| 85 | #define SECS_PER_HOUR (60 * 60) | 85 | #define SECS_PER_HOUR (60 * 60) |
| 86 | #define SECS_PER_DAY (SECS_PER_HOUR * 24) | 86 | #define SECS_PER_DAY (SECS_PER_HOUR * 24) |
| 87 | 87 | ||
| 88 | time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src) | 88 | struct timespec *udf_disk_stamp_to_time(struct timespec *dest, timestamp src) |
| 89 | { | 89 | { |
| 90 | int yday; | 90 | int yday; |
| 91 | uint8_t type = src.typeAndTimezone >> 12; | 91 | u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone); |
| 92 | u16 year = le16_to_cpu(src.year); | ||
| 93 | uint8_t type = typeAndTimezone >> 12; | ||
| 92 | int16_t offset; | 94 | int16_t offset; |
| 93 | 95 | ||
| 94 | if (type == 1) { | 96 | if (type == 1) { |
| 95 | offset = src.typeAndTimezone << 4; | 97 | offset = typeAndTimezone << 4; |
| 96 | /* sign extent offset */ | 98 | /* sign extent offset */ |
| 97 | offset = (offset >> 4); | 99 | offset = (offset >> 4); |
| 98 | if (offset == -2047) /* unspecified offset */ | 100 | if (offset == -2047) /* unspecified offset */ |
| 99 | offset = 0; | 101 | offset = 0; |
| 100 | } else { | 102 | } else |
| 101 | offset = 0; | 103 | offset = 0; |
| 102 | } | ||
| 103 | 104 | ||
| 104 | if ((src.year < EPOCH_YEAR) || | 105 | if ((year < EPOCH_YEAR) || |
| 105 | (src.year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) { | 106 | (year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) { |
| 106 | *dest = -1; | ||
| 107 | *dest_usec = -1; | ||
| 108 | return NULL; | 107 | return NULL; |
| 109 | } | 108 | } |
| 110 | *dest = year_seconds[src.year - EPOCH_YEAR]; | 109 | dest->tv_sec = year_seconds[year - EPOCH_YEAR]; |
| 111 | *dest -= offset * 60; | 110 | dest->tv_sec -= offset * 60; |
| 112 | 111 | ||
| 113 | yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1); | 112 | yday = ((__mon_yday[__isleap(year)][src.month - 1]) + src.day - 1); |
| 114 | *dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second; | 113 | dest->tv_sec += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second; |
| 115 | *dest_usec = src.centiseconds * 10000 + | 114 | dest->tv_nsec = 1000 * (src.centiseconds * 10000 + |
| 116 | src.hundredsOfMicroseconds * 100 + src.microseconds; | 115 | src.hundredsOfMicroseconds * 100 + src.microseconds); |
| 117 | return dest; | 116 | return dest; |
| 118 | } | 117 | } |
| 119 | 118 | ||
| 120 | kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) | 119 | timestamp *udf_time_to_disk_stamp(timestamp *dest, struct timespec ts) |
| 121 | { | 120 | { |
| 122 | long int days, rem, y; | 121 | long int days, rem, y; |
| 123 | const unsigned short int *ip; | 122 | const unsigned short int *ip; |
| @@ -128,7 +127,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) | |||
| 128 | if (!dest) | 127 | if (!dest) |
| 129 | return NULL; | 128 | return NULL; |
| 130 | 129 | ||
| 131 | dest->typeAndTimezone = 0x1000 | (offset & 0x0FFF); | 130 | dest->typeAndTimezone = cpu_to_le16(0x1000 | (offset & 0x0FFF)); |
| 132 | 131 | ||
| 133 | ts.tv_sec += offset * 60; | 132 | ts.tv_sec += offset * 60; |
| 134 | days = ts.tv_sec / SECS_PER_DAY; | 133 | days = ts.tv_sec / SECS_PER_DAY; |
| @@ -151,7 +150,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) | |||
| 151 | - LEAPS_THRU_END_OF(y - 1)); | 150 | - LEAPS_THRU_END_OF(y - 1)); |
| 152 | y = yg; | 151 | y = yg; |
| 153 | } | 152 | } |
| 154 | dest->year = y; | 153 | dest->year = cpu_to_le16(y); |
| 155 | ip = __mon_yday[__isleap(y)]; | 154 | ip = __mon_yday[__isleap(y)]; |
| 156 | for (y = 11; days < (long int)ip[y]; --y) | 155 | for (y = 11; days < (long int)ip[y]; --y) |
| 157 | continue; | 156 | continue; |
