smbd/nmbd: Remove HAVE_LONGLONG
authorVolker Lendecke <vl@samba.org>
Tue, 15 Jul 2014 09:48:16 +0000 (15 09:48 +0000)
committerStefan Metzmacher <metze@samba.org>
Tue, 22 Jul 2014 13:32:39 +0000 (22 15:32 +0200)
We always have 64-bit variables available by now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
buildtools/wafsamba/samba_patterns.py
source3/nmbd/nmbd_winsserver.c
source3/smbd/reply.c
source3/smbd/trans2.c
source3/wscript

index 1e2df90..9c0f653 100644 (file)
@@ -139,9 +139,7 @@ def write_build_options_footer(fp):
     fp.write("       output(screen, \"   sizeof(char):         %lu\\n\",(unsigned long)sizeof(char));\n")
     fp.write("       output(screen, \"   sizeof(int):          %lu\\n\",(unsigned long)sizeof(int));\n")
     fp.write("       output(screen, \"   sizeof(long):         %lu\\n\",(unsigned long)sizeof(long));\n")
-    fp.write("#if HAVE_LONGLONG\n")
     fp.write("       output(screen, \"   sizeof(long long):    %lu\\n\",(unsigned long)sizeof(long long));\n")
-    fp.write("#endif\n")
     fp.write("       output(screen, \"   sizeof(uint8):        %lu\\n\",(unsigned long)sizeof(uint8));\n")
     fp.write("       output(screen, \"   sizeof(uint16):       %lu\\n\",(unsigned long)sizeof(uint16));\n")
     fp.write("       output(screen, \"   sizeof(uint32):       %lu\\n\",(unsigned long)sizeof(uint32));\n")
index 6524284..e09d1a0 100644 (file)
@@ -146,9 +146,7 @@ static struct name_record *wins_record_to_name_record(TDB_DATA key, TDB_DATA dat
        namerec->data.death_time = (time_t)death_time;
        namerec->data.refresh_time = (time_t)refresh_time;
        namerec->data.id = id_low;
-#if defined(HAVE_LONGLONG)
        namerec->data.id |= ((uint64_t)id_high << 32);
-#endif
        namerec->data.wins_ip.s_addr = saddr;
        namerec->data.wins_flags = wins_flags,
        namerec->data.num_ips = num_ips;
@@ -170,11 +168,7 @@ static TDB_DATA name_record_to_wins_record(const struct name_record *namerec)
        size_t len = 0;
        int i;
        uint32 id_low = (namerec->data.id & 0xFFFFFFFF);
-#if defined(HAVE_LONGLONG)
        uint32 id_high = (namerec->data.id >> 32) & 0xFFFFFFFF;
-#else
-       uint32 id_high = 0;
-#endif
 
        ZERO_STRUCT(data);
 
index ac2facf..8f9c921 100644 (file)
@@ -7580,67 +7580,13 @@ uint64_t get_lock_count(const uint8_t *data, int data_offset,
        if(!large_file_format) {
                count = (uint64_t)IVAL(data,SMB_LKLEN_OFFSET(data_offset));
        } else {
-
-#if defined(HAVE_LONGLONG)
                count = (((uint64_t) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset))) << 32) |
                        ((uint64_t) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset)));
-#else /* HAVE_LONGLONG */
-
-               /*
-                * NT4.x seems to be broken in that it sends large file (64 bit)
-                * lockingX calls even if the CAP_LARGE_FILES was *not*
-                * negotiated. For boxes without large unsigned ints truncate the
-                * lock count by dropping the top 32 bits.
-                */
-
-               if(IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset)) != 0) {
-                       DEBUG(3,("get_lock_count: truncating lock count (high)0x%x (low)0x%x to just low count.\n",
-                               (unsigned int)IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset)),
-                               (unsigned int)IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset)) ));
-                               SIVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset),0);
-               }
-
-               count = (uint64_t)IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset));
-#endif /* HAVE_LONGLONG */
        }
 
        return count;
 }
 
-#if !defined(HAVE_LONGLONG)
-/****************************************************************************
- Pathetically try and map a 64 bit lock offset into 31 bits. I hate Windows :-).
-****************************************************************************/
-
-static uint32 map_lock_offset(uint32 high, uint32 low)
-{
-       unsigned int i;
-       uint32 mask = 0;
-       uint32 highcopy = high;
-
-       /*
-        * Try and find out how many significant bits there are in high.
-        */
-
-       for(i = 0; highcopy; i++)
-               highcopy >>= 1;
-
-       /*
-        * We use 31 bits not 32 here as POSIX
-        * lock offsets may not be negative.
-        */
-
-       mask = (~0) << (31 - i);
-
-       if(low & mask)
-               return 0; /* Fail. */
-
-       high <<= (31 - i);
-
-       return (high|low);
-}
-#endif /* !defined(HAVE_LONGLONG) */
-
 /****************************************************************************
  Get a lock offset, dealing with large offset requests.
 ****************************************************************************/
@@ -7655,37 +7601,8 @@ uint64_t get_lock_offset(const uint8_t *data, int data_offset,
        if(!large_file_format) {
                offset = (uint64_t)IVAL(data,SMB_LKOFF_OFFSET(data_offset));
        } else {
-
-#if defined(HAVE_LONGLONG)
                offset = (((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset))) << 32) |
                                ((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)));
-#else /* HAVE_LONGLONG */
-
-               /*
-                * NT4.x seems to be broken in that it sends large file (64 bit)
-                * lockingX calls even if the CAP_LARGE_FILES was *not*
-                * negotiated. For boxes without large unsigned ints mangle the
-                * lock offset by mapping the top 32 bits onto the lower 32.
-                */
-
-               if(IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset)) != 0) {
-                       uint32 low = IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset));
-                       uint32 high = IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset));
-                       uint32 new_low = 0;
-
-                       if((new_low = map_lock_offset(high, low)) == 0) {
-                               *err = True;
-                               return (uint64_t)-1;
-                       }
-
-                       DEBUG(3,("get_lock_offset: truncating lock offset (high)0x%x (low)0x%x to offset 0x%x.\n",
-                               (unsigned int)high, (unsigned int)low, (unsigned int)new_low ));
-                       SIVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset),0);
-                       SIVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset),new_low);
-               }
-
-               offset = (uint64_t)IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset));
-#endif /* HAVE_LONGLONG */
        }
 
        return offset;
index 9003cc4..5304052 100644 (file)
@@ -5166,13 +5166,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                        }
 
                        smblctx = (uint64_t)IVAL(pdata, POSIX_LOCK_PID_OFFSET);
-#if defined(HAVE_LONGLONG)
                        offset = BVAL(pdata,POSIX_LOCK_START_OFFSET);
                        count = BVAL(pdata,POSIX_LOCK_LEN_OFFSET);
-#else /* HAVE_LONGLONG */
-                       offset = (uint64_t)IVAL(pdata,POSIX_LOCK_START_OFFSET);
-                       count = (uint64_t)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
-#endif /* HAVE_LONGLONG */
 
                        status = query_lock(fsp,
                                        &smblctx,
@@ -5188,13 +5183,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                                SSVAL(pdata, POSIX_LOCK_TYPE_OFFSET, lock_type);
                                SSVAL(pdata, POSIX_LOCK_FLAGS_OFFSET, 0);
                                SIVAL(pdata, POSIX_LOCK_PID_OFFSET, (uint32_t)smblctx);
-#if defined(HAVE_LONGLONG)
                                SBVAL(pdata, POSIX_LOCK_START_OFFSET, offset);
                                SBVAL(pdata, POSIX_LOCK_LEN_OFFSET, count);
-#else /* HAVE_LONGLONG */
-                               SIVAL(pdata, POSIX_LOCK_START_OFFSET, offset);
-                               SIVAL(pdata, POSIX_LOCK_LEN_OFFSET, count);
-#endif /* HAVE_LONGLONG */
 
                        } else if (NT_STATUS_IS_OK(status)) {
                                /* For success we just return a copy of what we sent
@@ -6657,15 +6647,10 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
        }
 
        smblctx = (uint64_t)IVAL(pdata, POSIX_LOCK_PID_OFFSET);
-#if defined(HAVE_LONGLONG)
        offset = (((uint64_t) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
                        ((uint64_t) IVAL(pdata,POSIX_LOCK_START_OFFSET));
        count = (((uint64_t) IVAL(pdata,(POSIX_LOCK_LEN_OFFSET+4))) << 32) |
                        ((uint64_t) IVAL(pdata,POSIX_LOCK_LEN_OFFSET));
-#else /* HAVE_LONGLONG */
-       offset = (uint64_t)IVAL(pdata,POSIX_LOCK_START_OFFSET);
-       count = (uint64_t)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
-#endif /* HAVE_LONGLONG */
 
        DEBUG(10,("smb_set_posix_lock: file %s, lock_type = %u,"
                        "smblctx = %llu, count = %.0f, offset = %.0f\n",
index 6bf2d3b..18c3c7d 100644 (file)
@@ -109,9 +109,6 @@ def configure(conf):
     conf.CHECK_DECLS('fdatasync', reverse=True)
     conf.CHECK_DECLS('readahead', reverse=True, headers='fcntl.h')
 
-    if conf.CONFIG_SET('HAVE_LONG_LONG'):
-        conf.DEFINE('HAVE_LONGLONG', 1)
-
     if conf.CHECK_CODE('''
 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>