HEADS UP ON -DEVELOPMENT

Garance A Drosihn drosih at rpi.edu
Fri Aug 5 12:57:55 PDT 2005


At 9:23 AM -0700 8/5/05, Matthew Dillon wrote:
    Joerg and I have discussed the struct stat and struct dirent
    changes.  So far the stat work has been committed and the dirent
    work is still in progress.  This is work to increase ino_t from
    32 to 64 bits and nlink_t from 16 to 32 bits.
How about dev_t to 64 bits?  For "worldwide" distributed filesystems
(such as OpenAFS), this would be a very nice thing.
At 5:42 PM +0100 8/5/05, Hiten Pandya wrote:
What about time related fields, are they currently 64-bits wide?
    We are stuck with various time standards so there isn't much
    we can do with the time fields.  The standards idiots didn't
    fix the seconds  field when they changed the microseconds
    field to nanoseconds.
One thing I considered is coming up with a "struct_time_t" macro.
This could be used to at least *reserve* 64-bit areas in a struct
for any struct where a time_t value is used.  That way, if you
later want to have a 64-bit time_t, you'll have the room reserved
for it.  I'm hoping to get something like this together for
FreeBSD 7.x, when I'm in a particularly optimistic mood...
Something along the lines of:

#include <sys/cdefs.h>
#include <sys/types.h>
/* This uses specific sizes, and then some other include file
 * would set the real time_t to either time32_t or time64_t. */
typedef	int32_t	time32_t;
typedef	int64_t	time64_t;
#if _BYTE_ORDER == _LITTLE_ENDIAN
#define	STRUCT_TIME_T(vname) \
	union __aligned(8) { \
		time64_t	__CONCAT(vname,_64); \
		struct { \
			time32_t	vname; \
			int32_t		__CONCAT(vname,_h32); \
		}; \
	}
#elif _BYTE_ORDER == _BIG_ENDIAN
#define	STRUCT_TIME_T(vname) \
	union __aligned(8) { \
		time64_t	__CONCAT(vname,_64); \
		struct { \
			int32_t		__CONCAT(vname,_h32); \
			time32_t	vname; \
		}; \
	}
#endif
(which I have done some limited testing with, and it seems to do
what I want it to do).  You would use it like:
struct test_stat {
	...
	dev_t	  st_rdev;		/* device type */
	STRUCT_TIME_T(st_atime);	/* time of last access */
	long	  st_atimensec;		/* nsec of last access */
	STRUCT_TIME_T(st_mtime);	/* time of last data modification */
	long	  st_mtimensec;		/* nsec of last data modification */
	STRUCT_TIME_T(st_ctime);	/* time of last file status change */
	long	  st_ctimensec;		/* nsec of last file status change */
	char abyte;
};
--
Garance Alistair Drosehn            =   gad at xxxxxxxxxxxxxxxxxxxx
Senior Systems Programmer           or  gad at xxxxxxxxxxx
Rensselaer Polytechnic Institute    or  drosih at xxxxxxx




More information about the Users mailing list