[SCM] Samba Shared Repository - branch master updated

Björn Jacke bjacke at samba.org
Wed Jan 6 16:53:30 MST 2010


The branch, master has been updated
       via  f5729db... s3:lib/time: remove TIME_T_MIN/MAX defines
       via  571ee54... lib/util: move TIME_T_MIN/MAX defines into header file
       via  b3e065e... Ñ•3:lib/time: replace make_dos_ and put_dos_ functions with those from lib/util/
       via  c5f24c3... s3:lib/time: remoce null_mtime() - use null_time()
       via  c1c7b6c... s3:lib/time: remove unused nt_time_equals
      from  d5995ee... Second part of the fix for bug #7020 - smbd using 2G memory.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f5729dbb6e720cb6076ea053f1ad0680259e6b39
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Jan 7 00:41:50 2010 +0100

    s3:lib/time: remove TIME_T_MIN/MAX defines
    
    we already get them from lib/util/time.h

commit 571ee54b791b93ad46e09ed563ef4a5582dcf0c8
Author: Björn Jacke <bj at sernet.de>
Date:   Thu Jan 7 00:40:09 2010 +0100

    lib/util: move TIME_T_MIN/MAX defines into header file

commit b3e065e0c672426a473d13c14f43f557c98d9909
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jan 6 23:24:48 2010 +0100

    Ñ•3:lib/time: replace make_dos_ and put_dos_ functions with those from lib/util/

commit c5f24c3eacf8892270702eeb0e1e037a0a1b4dde
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jan 6 21:32:35 2010 +0100

    s3:lib/time: remoce null_mtime() - use null_time()

commit c1c7b6cecb848c35c2cead332483ce117552d6bc
Author: Björn Jacke <bj at sernet.de>
Date:   Wed Jan 6 19:31:41 2010 +0100

    s3:lib/time: remove unused nt_time_equals
    
    we have nt_time_equal doing the same in lib/util/

-----------------------------------------------------------------------

Summary of changes:
 lib/util/time.c         |   14 -----
 lib/util/time.h         |   14 +++++
 source3/include/proto.h |    2 -
 source3/lib/time.c      |  124 +++--------------------------------------------
 4 files changed, 21 insertions(+), 133 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/time.c b/lib/util/time.c
index eadafe4..571219b 100644
--- a/lib/util/time.c
+++ b/lib/util/time.c
@@ -27,11 +27,6 @@
  * @brief time handling functions
  */
 
-#ifndef TIME_T_MIN
-/* we use 0 here, because (time_t)-1 means error */
-#define TIME_T_MIN 0
-#endif
-
 #if (SIZEOF_LONG == 8)
 #define TIME_FIXUP_CONSTANT_INT 11644473600L
 #elif (SIZEOF_LONG_LONG == 8)
@@ -40,15 +35,6 @@
 
 
 
-/*
- * we use the INT32_MAX here as on 64 bit systems,
- * gmtime() fails with INT64_MAX
- */
-
-#ifndef TIME_T_MAX
-#define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t))
-#endif
-
 /**
  External access to time_t_min and time_t_max.
 **/
diff --git a/lib/util/time.h b/lib/util/time.h
index e40de2d..cf6dc1c 100644
--- a/lib/util/time.h
+++ b/lib/util/time.h
@@ -23,6 +23,20 @@
 #define _PUBLIC_
 #endif
 
+#ifndef TIME_T_MIN
+/* we use 0 here, because (time_t)-1 means error */
+#define TIME_T_MIN 0
+#endif
+
+/*
+ * we use the INT32_MAX here as on 64 bit systems,
+ * gmtime() fails with INT64_MAX
+ */
+#ifndef TIME_T_MAX
+#define TIME_T_MAX MIN(INT32_MAX,_TYPE_MAXIMUM(time_t))
+#endif
+
+
 /* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30, 4 byte aligned */
 typedef uint64_t NTTIME;
 
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d956ede..5b16120 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1059,14 +1059,12 @@ void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unix
 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
-bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
 void TimeInit(void);
 void get_process_uptime(struct timeval *ret_time);
 time_t nt_time_to_unix_abs(const NTTIME *nt);
 time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
 void unix_to_nt_time_abs(NTTIME *nt, time_t t);
-bool null_mtime(time_t mtime);
 const char *time_to_asc(const time_t t);
 const char *display_time(NTTIME nttime);
 bool nt_time_is_set(const NTTIME *nt);
diff --git a/source3/lib/time.c b/source3/lib/time.c
index a418c42..5286af3 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -28,14 +28,6 @@
  */
 
 
-#ifndef TIME_T_MIN
-#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \
-		    : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
-#endif
-#ifndef TIME_T_MAX
-#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
-#endif
-
 #define NTTIME_INFINITY (NTTIME)0x8000000000000000LL
 
 #if (SIZEOF_LONG == 8)
@@ -44,53 +36,6 @@
 #define TIME_FIXUP_CONSTANT_INT 11644473600LL
 #endif
 
-/*******************************************************************
-  create a 16 bit dos packed date
-********************************************************************/
-static uint16_t make_dos_date1(struct tm *t)
-{
-	uint16_t ret=0;
-	ret = (((unsigned int)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
-	ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
-	return ret;
-}
-
-/*******************************************************************
-  create a 16 bit dos packed time
-********************************************************************/
-static uint16_t make_dos_time1(struct tm *t)
-{
-	uint16_t ret=0;
-	ret = ((((unsigned int)t->tm_min >> 3)&0x7) | (((unsigned int)t->tm_hour) << 3));
-	ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
-	return ret;
-}
-
-/*******************************************************************
-  create a 32 bit dos packed date/time from some parameters
-  This takes a GMT time and returns a packed localtime structure
-********************************************************************/
-static uint32_t make_dos_date(time_t unixdate, int zone_offset)
-{
-	struct tm *t;
-	uint32_t ret=0;
-
-	if (unixdate == 0) {
-		return 0;
-	}
-
-	unixdate -= zone_offset;
-
-	t = gmtime(&unixdate);
-	if (!t) {
-		return 0xFFFFFFFF;
-	}
-
-	ret = make_dos_date1(t);
-	ret = ((ret&0xFFFF)<<16) | make_dos_time1(t);
-
-	return ret;
-}
 
 /**
   parse a nttime as a large integer in a string and return a NTTIME
@@ -245,42 +190,6 @@ char *current_timestring(TALLOC_CTX *ctx, bool hires)
 	return timeval_string(ctx, &tv, hires);
 }
 
-/*******************************************************************
- Put a dos date into a buffer (time/date format).
- This takes GMT time and puts local time in the buffer.
-********************************************************************/
-
-static void put_dos_date(char *buf,int offset,time_t unixdate, int zone_offset)
-{
-	uint32_t x = make_dos_date(unixdate, zone_offset);
-	SIVAL(buf,offset,x);
-}
-
-/*******************************************************************
- Put a dos date into a buffer (date/time format).
- This takes GMT time and puts local time in the buffer.
-********************************************************************/
-
-static void put_dos_date2(char *buf,int offset,time_t unixdate, int zone_offset)
-{
-	uint32_t x = make_dos_date(unixdate, zone_offset);
-	x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
-	SIVAL(buf,offset,x);
-}
-
-/*******************************************************************
- Put a dos 32 bit "unix like" date into a buffer. This routine takes
- GMT and converts it to LOCAL time before putting it (most SMBs assume
- localtime for this sort of date)
-********************************************************************/
-
-static void put_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
-{
-	if (!null_mtime(unixdate)) {
-		unixdate -= zone_offset;
-	}
-	SIVAL(buf,offset,unixdate);
-}
 
 
 /***************************************************************************
@@ -289,17 +198,17 @@ static void put_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
 
 void srv_put_dos_date(char *buf,int offset,time_t unixdate)
 {
-	put_dos_date(buf, offset, unixdate, server_zone_offset);
+	push_dos_date(buf, offset, unixdate, server_zone_offset);
 }
 
 void srv_put_dos_date2(char *buf,int offset, time_t unixdate)
 {
-	put_dos_date2(buf, offset, unixdate, server_zone_offset);
+	push_dos_date2(buf, offset, unixdate, server_zone_offset);
 }
 
 void srv_put_dos_date3(char *buf,int offset,time_t unixdate)
 {
-	put_dos_date3(buf, offset, unixdate, server_zone_offset);
+	push_dos_date3(buf, offset, unixdate, server_zone_offset);
 }
 
 void round_timespec(enum timestamp_set_resolution res, struct timespec *ts)
@@ -396,7 +305,7 @@ time_t make_unix_date2(const void *date_ptr, int zone_offset)
 time_t make_unix_date3(const void *date_ptr, int zone_offset)
 {
 	time_t t = (time_t)IVAL(date_ptr,0);
-	if (!null_mtime(t)) {
+	if (!null_time(t)) {
 		t += zone_offset;
 	}
 	return(t);
@@ -530,17 +439,17 @@ struct timespec interpret_long_date(const char *p)
 
 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate)
 {
-	put_dos_date(buf, offset, unixdate, cli->serverzone);
+	push_dos_date(buf, offset, unixdate, cli->serverzone);
 }
 
 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate)
 {
-	put_dos_date2(buf, offset, unixdate, cli->serverzone);
+	push_dos_date2(buf, offset, unixdate, cli->serverzone);
 }
 
 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate)
 {
-	put_dos_date3(buf, offset, unixdate, cli->serverzone);
+	push_dos_date3(buf, offset, unixdate, cli->serverzone);
 }
 
 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr)
@@ -558,14 +467,6 @@ time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr)
 	return make_unix_date3(date_ptr, cli->serverzone);
 }
 
-/****************************************************************************
- Check if two NTTIMEs are the same.
-****************************************************************************/
-
-bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2)
-{
-	return (*nt1 == *nt2);
-}
 
 /*******************************************************************
  Re-read the smb serverzone value.
@@ -747,17 +648,6 @@ void unix_to_nt_time_abs(NTTIME *nt, time_t t)
 
 
 /****************************************************************************
- Check if it's a null mtime.
-****************************************************************************/
-
-bool null_mtime(time_t mtime)
-{
-	if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1)
-		return true;
-	return false;
-}
-
-/****************************************************************************
  Utility function that always returns a const string even if localtime
  and asctime fail.
 ****************************************************************************/


-- 
Samba Shared Repository


More information about the samba-cvs mailing list