comparison src/dired.c @ 93689:40434d3c3093

(Ffile_attributes): Support inode numbers wider than 32 bits. Remove ugly WINDOWSNT-specific kludge introduced on 2008-03-14 to force inode be positive.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 05 Apr 2008 14:31:42 +0000
parents 5bb79def24e1
children 3af508d0bd74
comparison
equal deleted inserted replaced
93688:3961ad1ac8f2 93689:40434d3c3093
917 7. Size in bytes. 917 7. Size in bytes.
918 This is a floating point number if the size is too large for an integer. 918 This is a floating point number if the size is too large for an integer.
919 8. File modes, as a string of ten letters or dashes as in ls -l. 919 8. File modes, as a string of ten letters or dashes as in ls -l.
920 9. t if file's gid would change if file were deleted and recreated. 920 9. t if file's gid would change if file were deleted and recreated.
921 10. inode number. If inode number is larger than the Emacs integer, 921 10. inode number. If inode number is larger than the Emacs integer,
922 this is a cons cell containing two integers: first the high part, 922 but still fits into a 32-bit number, this is a cons cell containing two
923 then the low 16 bits. 923 integers: first the high part, then the low 16 bits. If the inode number
924 is wider than 32 bits, this is a cons cell containing three integers:
925 first the high 24 bits, then middle 24 bits, and finally the low 16 bits.
924 11. Device number. If it is larger than the Emacs integer, this is 926 11. Device number. If it is larger than the Emacs integer, this is
925 a cons cell, similar to the inode number. */) 927 a cons cell, similar to the inode number. */)
926 (filename, id_format) 928 (filename, id_format)
927 Lisp_Object filename, id_format; 929 Lisp_Object filename, id_format;
928 { 930 {
1019 values[9] = Qt; 1021 values[9] = Qt;
1020 #else /* file gid will be egid */ 1022 #else /* file gid will be egid */
1021 values[9] = (gid != getegid ()) ? Qt : Qnil; 1023 values[9] = (gid != getegid ()) ? Qt : Qnil;
1022 #endif /* BSD4_2 (or BSD4_3) */ 1024 #endif /* BSD4_2 (or BSD4_3) */
1023 /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */ 1025 /* Shut up GCC warnings in FIXNUM_OVERFLOW_P below. */
1024 #ifdef WINDOWSNT 1026 if (sizeof (s.st_ino) > sizeof (ino))
1025 { 1027 ino = (EMACS_INT)(s.st_ino & 0xffffffff);
1026 /* The bit-shuffling we do in w32.c:stat can turn on the MSB, which 1028 else
1027 will produce negative inode numbers. People don't like that, so 1029 ino = s.st_ino;
1028 force a positive inode instead. */ 1030 if (!FIXNUM_OVERFLOW_P (ino)
1029 unsigned short tem = s.st_ino; 1031 && (sizeof (s.st_ino) <= sizeof (ino) || (s.st_ino & ~INTMASK) == 0))
1030 ino = tem; 1032 /* Keep the most common cases as integers. */
1031 } 1033 values[10] = make_number (ino);
1032 #else 1034 else if (sizeof (s.st_ino) <= sizeof (ino)
1033 ino = s.st_ino; 1035 || ((s.st_ino >> 16) & ~INTMASK) == 0)
1034 #endif
1035 if (FIXNUM_OVERFLOW_P (ino))
1036 /* To allow inode numbers larger than VALBITS, separate the bottom 1036 /* To allow inode numbers larger than VALBITS, separate the bottom
1037 16 bits. */ 1037 16 bits. */
1038 values[10] = Fcons (make_number (ino >> 16), 1038 values[10] = Fcons (make_number ((EMACS_INT)(s.st_ino >> 16)),
1039 make_number (ino & 0xffff)); 1039 make_number ((EMACS_INT)(s.st_ino & 0xffff)));
1040 else 1040 else
1041 /* But keep the most common cases as integers. */ 1041 {
1042 values[10] = make_number (ino); 1042 /* To allow inode numbers beyond 32 bits, separate into 2 24-bit
1043 high parts and a 16-bit bottom part. */
1044 EMACS_INT high_ino = s.st_ino >> 32;
1045 EMACS_INT low_ino = s.st_ino & 0xffffffff;
1046
1047 values[10] = Fcons (make_number (high_ino >> 8),
1048 Fcons (make_number (((high_ino & 0xff) << 16)
1049 + (low_ino >> 16)),
1050 make_number (low_ino & 0xffff)));
1051 }
1043 1052
1044 /* Likewise for device. */ 1053 /* Likewise for device. */
1045 if (FIXNUM_OVERFLOW_P (s.st_dev)) 1054 if (FIXNUM_OVERFLOW_P (s.st_dev))
1046 values[11] = Fcons (make_number (s.st_dev >> 16), 1055 values[11] = Fcons (make_number (s.st_dev >> 16),
1047 make_number (s.st_dev & 0xffff)); 1056 make_number (s.st_dev & 0xffff));