lib: Align unix_timespec_to_nt_time with nt_time_to_unix_timespec
authorVolker Lendecke <vl@samba.org>
Wed, 18 Jun 2014 12:21:06 +0000 (12:21 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 30 Jun 2014 20:28:14 +0000 (22:28 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/time.c
lib/util/time.h
source3/client/client.c
source3/lib/time.c
source3/smbd/dosmode.c
source3/smbd/smb2_create.c

index 993a55af21e56f0c1ca1a994f3a5107be7bd046a..0c30264ffb18fbac15465e016624082f6f74a56a 100644 (file)
@@ -940,21 +940,18 @@ void round_timespec_to_usec(struct timespec *ts)
  Put a 8 byte filetime from a struct timespec. Uses GMT.
 ****************************************************************************/
 
-_PUBLIC_ void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
+_PUBLIC_ NTTIME unix_timespec_to_nt_time(struct timespec ts)
 {
        uint64_t d;
 
        if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
-               *nt = 0;
-               return;
+               return 0;
        }
        if (ts.tv_sec == TIME_T_MAX) {
-               *nt = 0x7fffffffffffffffLL;
-               return;
+               return 0x7fffffffffffffffLL;
        }
        if (ts.tv_sec == (time_t)-1) {
-               *nt = (uint64_t)-1;
-               return;
+               return (uint64_t)-1;
        }
 
        d = ts.tv_sec;
@@ -963,5 +960,5 @@ _PUBLIC_ void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
        /* d is now in 100ns units. */
        d += (ts.tv_nsec / 100);
 
-       *nt = d;
+       return d;
 }
index bab82811aa984b31f5358aebed0f812ceee4c77a..f3ed29b3015832e4eb4cd0fd8cf1e981622ac9d3 100644 (file)
@@ -314,6 +314,6 @@ struct timespec timespec_min(const struct timespec *ts1,
 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
 void round_timespec_to_sec(struct timespec *ts);
 void round_timespec_to_usec(struct timespec *ts);
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
+NTTIME unix_timespec_to_nt_time(struct timespec ts);
 
 #endif /* _SAMBA_TIME_H_ */
index 17985b9d2b8e7c8e3326311d29553bf3c449ee12..c90c450447379564d13fe571124f13a0dbe61a8d 100644 (file)
@@ -1725,16 +1725,16 @@ static int do_allinfo(const char *name)
                return false;
        }
 
-       unix_timespec_to_nt_time(&tmp, b_time);
+       tmp = unix_timespec_to_nt_time(b_time);
        d_printf("create_time:    %s\n", nt_time_string(talloc_tos(), tmp));
 
-       unix_timespec_to_nt_time(&tmp, a_time);
+       tmp = unix_timespec_to_nt_time(a_time);
        d_printf("access_time:    %s\n", nt_time_string(talloc_tos(), tmp));
 
-       unix_timespec_to_nt_time(&tmp, m_time);
+       tmp = unix_timespec_to_nt_time(m_time);
        d_printf("write_time:     %s\n", nt_time_string(talloc_tos(), tmp));
 
-       unix_timespec_to_nt_time(&tmp, c_time);
+       tmp = unix_timespec_to_nt_time(c_time);
        d_printf("change_time:    %s\n", nt_time_string(talloc_tos(), tmp));
 
        d_printf("attributes: %s (%x)\n", attr_str(talloc_tos(), mode), mode);
@@ -1804,13 +1804,13 @@ static int do_allinfo(const char *name)
                        TALLOC_FREE(snap_name);
                        continue;
                }
-               unix_timespec_to_nt_time(&tmp, b_time);
+               tmp = unix_timespec_to_nt_time(b_time);
                d_printf("create_time:    %s\n", nt_time_string(talloc_tos(), tmp));
-               unix_timespec_to_nt_time(&tmp, a_time);
+               tmp = unix_timespec_to_nt_time(a_time);
                d_printf("access_time:    %s\n", nt_time_string(talloc_tos(), tmp));
-               unix_timespec_to_nt_time(&tmp, m_time);
+               tmp =unix_timespec_to_nt_time(m_time);
                d_printf("write_time:     %s\n", nt_time_string(talloc_tos(), tmp));
-               unix_timespec_to_nt_time(&tmp, c_time);
+               tmp = unix_timespec_to_nt_time(c_time);
                d_printf("change_time:    %s\n", nt_time_string(talloc_tos(), tmp));
                d_printf("size: %d\n", (int)size);
        }
index dab9b3167a4706c21c7e9ac69e5d1e8b0539b4b7..98ab0c78d44134493a31eb5d8e274dee9b75f9b9 100644 (file)
@@ -172,7 +172,7 @@ void put_long_date_timespec(enum timestamp_set_resolution res, char *p, struct t
 {
        NTTIME nt;
        round_timespec(res, &ts);
-       unix_timespec_to_nt_time(&nt, ts);
+       nt = unix_timespec_to_nt_time(ts);
        SBVAL(p, 0, nt);
 }
 
index 6a6f673750bf43881e44135851077821d6d39694..b31b472e904de767b8c708d152ce1bcb7c816b23 100644 (file)
@@ -399,7 +399,7 @@ static bool set_ea_dos_attribute(connection_struct *conn,
        dosattrib.info.info3.valid_flags = XATTR_DOSINFO_ATTRIB|
                                        XATTR_DOSINFO_CREATE_TIME;
        dosattrib.info.info3.attrib = dosmode;
-       unix_timespec_to_nt_time(&dosattrib.info.info3.create_time,
+       dosattrib.info.info3.create_time = unix_timespec_to_nt_time(
                                smb_fname->st.st_ex_btime);
 
        DEBUG(10,("set_ea_dos_attributes: set attribute 0x%x, btime = %s on file %s\n",
index 976e81a33a156bba15b569422e2012cf5f8d4da3..d22df4da34d5810c01945358d74f295810f50f0c 100644 (file)
@@ -974,7 +974,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                if (mxac) {
                        NTTIME last_write_time;
 
-                       unix_timespec_to_nt_time(&last_write_time,
+                       last_write_time = unix_timespec_to_nt_time(
                                                 result->fsp_name->st.st_ex_mtime);
                        if (last_write_time != max_access_time) {
                                uint8_t p[8];