[lkml]   [2005]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Fw: [CIFS] Add support for updating Windows NT times/dates (part 1)

> > ChangeSet 1.1966.1.22, 2005/01/26 17:30:51-06:00,
> > +/* The following three structures are needed only for
> > + setting time to NT4 and some older servers via
> > + the primitive DOS time format */
> > typedef struct {
> > - __u16 CreationDate;
> > - __u16 CreationTime;
> > - __u16 LastAccessDate;
> > - __u16 LastAccessTime;
> > - __u16 LastWriteDate;
> > - __u16 LastWriteTime;
> > - __u32 DataSize; /* File Size (EOF) */
> > - __u32 AllocationSize;
> > - __u16 Attributes; /* verify not u32 */
> > - __u32 EASize;
> > + __u16 Day:5;
> > + __u16 Month:4;
> > + __u16 Year:7;
> > +} SMB_DATE;
> > +
> if this is an on the wire format (and it looks like one) then you want
> this one packed I suspect,

Yes - the whole cifspdu.h is pragma pack(1) (including this struct)
On the wire fields for cifs are packed. These two fields would not be
put on the wire directly (they would be part of a larger struct,
in particular FILE_INFO_STANDARD transact2 which follows). Fortunately
there is an easier way to set time fields to NT4 servers (which were the
only common server which I was running into which did take the common
SetPathInfo level for setting date/time stamps). To set the time stamps
using that legacy format ie FILE_INFO_STANDARD (which code had been
started in the currently unused CIFSSetTimesLegacy function) would
require time zone conversions as well as the conversion from
100nanosecond (CIFS time aka "DCE TIME") to the primitive 2 second (dos,
os2 time) format. Rather than do that, a much better solution was found
using transac2 SetFileInfo (instead of SetPathInfo) - which allows using
the 100nanosecond time stamps and much simplifies the conversion.

> and also I wonder if it needs to be byte
> order specific...

Old style SMB_DATE and SMB_TIME would be little endian when on the wire,
but it is easier to convert the SMB_DATE and SMB_TIME fields while in
cpu byte order (since they are bit fields). The SMB_DATE and SMB_TIME
fields would get cpu_to_le16 when converted in CIFSSetTimesLegacy to the
on the wire format FILE_INFO_STANDARD. Fortunately this will probably
turn out to be moot. Unless WindowsME or Windows9x servers force the
addition of this DOS style time stamp support, I may be able to remove

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:11    [W:0.034 / U:7.532 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site