From owner-cvs-src@FreeBSD.ORG Sun Oct 22 18:19:13 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6EEC16A47C; Sun, 22 Oct 2006 18:19:13 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E966543D6A; Sun, 22 Oct 2006 18:19:08 +0000 (GMT) (envelope-from phk@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9MIJ8Ea032685; Sun, 22 Oct 2006 18:19:08 GMT (envelope-from phk@repoman.freebsd.org) Received: (from phk@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9MIJ8ii032684; Sun, 22 Oct 2006 18:19:08 GMT (envelope-from phk) Message-Id: <200610221819.k9MIJ8ii032684@repoman.freebsd.org> From: Poul-Henning Kamp Date: Sun, 22 Oct 2006 18:19:08 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/kern subr_fattime.c src/sys/conf files src/sys/sys clock.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2006 18:19:14 -0000 phk 2006-10-22 18:19:08 UTC FreeBSD src repository Modified files: sys/conf files sys/sys clock.h Added files: sys/kern subr_fattime.c Log: Add two new functions to convert FAT filesystem format timestamps to and from struct timespec, to replace the crummy conversion function which have been copy&pasted into three different filesystems already. Apart from general crummyness as indicated by code like: for (year = 1970;; year++) { inc = year & 0x03 ? 365 : 366; if (days < inc) break; days -= inc; } They also contain specialized crummyness which tries to compensate for the general crummyness by caching recent conversion results, with no regard for locking or consistency. These replacement functions are smaller, O(1) and handle the Y2.1K leap-year correctly. Ideally, these functions should live in a module of their own, which the three offending filesystems would depend on, but the size is 877 bytes of code (on i386), so that would be false economy. Revision Changes Path 1.1153 +1 -0 src/sys/conf/files 1.1 +304 -0 src/sys/kern/subr_fattime.c (new) 1.6 +3 -0 src/sys/sys/clock.h