fixing timestamps for cygwin
This commit is contained in:
parent
e51ba46d8b
commit
f61bd10560
1 changed files with 18 additions and 4 deletions
|
|
@ -85,8 +85,9 @@ typedef struct _nfs3_attrs {
|
||||||
DWORD specdata2;
|
DWORD specdata2;
|
||||||
} rdev;
|
} rdev;
|
||||||
LONGLONG fsid, fileid;
|
LONGLONG fsid, fileid;
|
||||||
LARGE_INTEGER atime, mtime, ctime;
|
LONGLONG atime, mtime, ctime;
|
||||||
} nfs3_attrs;
|
} nfs3_attrs;
|
||||||
|
LARGE_INTEGER unix_time_diff; //needed to convert windows time to unix
|
||||||
|
|
||||||
enum ftype3 {
|
enum ftype3 {
|
||||||
NF3REG = 1,
|
NF3REG = 1,
|
||||||
|
|
@ -3285,6 +3286,16 @@ void print_nfs3_attrs(nfs3_attrs *attrs)
|
||||||
attrs->type, attrs->mode, attrs->nlink, attrs->size, attrs->atime,
|
attrs->type, attrs->mode, attrs->nlink, attrs->size, attrs->atime,
|
||||||
attrs->mtime, attrs->ctime);
|
attrs->mtime, attrs->ctime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void file_time_to_nfs_time(
|
||||||
|
IN const PLARGE_INTEGER file_time,
|
||||||
|
OUT LONGLONG *nfs_time)
|
||||||
|
{
|
||||||
|
LARGE_INTEGER diff = unix_time_diff;
|
||||||
|
diff.QuadPart = file_time->QuadPart - diff.QuadPart;
|
||||||
|
*nfs_time = diff.QuadPart / 10000000;
|
||||||
|
}
|
||||||
|
|
||||||
void create_nfs3_attrs(nfs3_attrs *attrs, PNFS41_FCB nfs41_fcb)
|
void create_nfs3_attrs(nfs3_attrs *attrs, PNFS41_FCB nfs41_fcb)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(attrs, sizeof(nfs3_attrs));
|
RtlZeroMemory(attrs, sizeof(nfs3_attrs));
|
||||||
|
|
@ -3298,9 +3309,9 @@ void create_nfs3_attrs(nfs3_attrs *attrs, PNFS41_FCB nfs41_fcb)
|
||||||
attrs->nlink = nfs41_fcb->StandardInfo.NumberOfLinks;
|
attrs->nlink = nfs41_fcb->StandardInfo.NumberOfLinks;
|
||||||
attrs->size.QuadPart = attrs->used.QuadPart =
|
attrs->size.QuadPart = attrs->used.QuadPart =
|
||||||
nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
|
nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
|
||||||
attrs->atime.QuadPart = nfs41_fcb->BasicInfo.LastAccessTime.QuadPart;
|
file_time_to_nfs_time(&nfs41_fcb->BasicInfo.LastAccessTime, &attrs->atime);
|
||||||
attrs->mtime.QuadPart = nfs41_fcb->BasicInfo.ChangeTime.QuadPart;
|
file_time_to_nfs_time(&nfs41_fcb->BasicInfo.ChangeTime, &attrs->mtime);
|
||||||
attrs->ctime.QuadPart = nfs41_fcb->BasicInfo.CreationTime.QuadPart;
|
file_time_to_nfs_time(&nfs41_fcb->BasicInfo.CreationTime, &attrs->ctime);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS nfs41_QueryEaInformation (
|
NTSTATUS nfs41_QueryEaInformation (
|
||||||
|
|
@ -4634,6 +4645,7 @@ NTSTATUS DriverEntry(IN PDRIVER_OBJECT drv, IN PUNICODE_STRING path)
|
||||||
ULONG flags = 0, i;
|
ULONG flags = 0, i;
|
||||||
UNICODE_STRING dev_name, user_dev_name;
|
UNICODE_STRING dev_name, user_dev_name;
|
||||||
PNFS41_DEVICE_EXTENSION dev_exts;
|
PNFS41_DEVICE_EXTENSION dev_exts;
|
||||||
|
TIME_FIELDS jan_1_1970 = {1970, 1, 4, 1, 0, 0, 0, 0};
|
||||||
|
|
||||||
DbgEn();
|
DbgEn();
|
||||||
|
|
||||||
|
|
@ -4699,6 +4711,8 @@ NTSTATUS DriverEntry(IN PDRIVER_OBJECT drv, IN PUNICODE_STRING path)
|
||||||
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||||
drv->MajorFunction[i] = (PDRIVER_DISPATCH)nfs41_FsdDispatch;
|
drv->MajorFunction[i] = (PDRIVER_DISPATCH)nfs41_FsdDispatch;
|
||||||
|
|
||||||
|
RtlTimeFieldsToTime(&jan_1_1970, &unix_time_diff);
|
||||||
|
|
||||||
out_unregister:
|
out_unregister:
|
||||||
if (status != STATUS_SUCCESS)
|
if (status != STATUS_SUCCESS)
|
||||||
RxUnregisterMinirdr(nfs41_dev);
|
RxUnregisterMinirdr(nfs41_dev);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue