Merge pull request #154 from derfian/fix-disk-logging

Move logging code to after variable declarations
This commit is contained in:
Henrik Andersson 2017-10-05 07:19:55 +02:00 committed by GitHub
commit 0a3a6fbca8

30
disk.c
View File

@ -531,9 +531,10 @@ disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create
static RD_NTSTATUS static RD_NTSTATUS
disk_close(RD_NTHANDLE handle) disk_close(RD_NTHANDLE handle)
{ {
logger(Disk, Debug, "disk_close(handle=0x%x)", handle);
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
logger(Disk, Debug, "disk_close(handle=0x%x)", handle);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
if (pfinfo->accessmask & GENERIC_ALL || pfinfo->accessmask & GENERIC_WRITE) if (pfinfo->accessmask & GENERIC_ALL || pfinfo->accessmask & GENERIC_WRITE)
@ -650,12 +651,13 @@ disk_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint3
RD_NTSTATUS RD_NTSTATUS
disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
{ {
logger(Disk, Debug, "disk_query_information(handle=0x%x, info_class=0x%x)", handle,
info_class);
uint32 file_attributes, ft_high, ft_low; uint32 file_attributes, ft_high, ft_low;
struct stat filestat; struct stat filestat;
char *path, *filename; char *path, *filename;
logger(Disk, Debug, "disk_query_information(handle=0x%x, info_class=0x%x)", handle,
info_class);
path = g_fileinfo[handle].path; path = g_fileinfo[handle].path;
/* Get information about file */ /* Get information about file */
@ -737,8 +739,6 @@ disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
RD_NTSTATUS RD_NTSTATUS
disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out) disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
{ {
logger(Disk, Debug, "disk_set_information(handle=0x%x, info_class=0x%x, ...)", handle,
info_class);
uint32 length, file_attributes, ft_high, ft_low; uint32 length, file_attributes, ft_high, ft_low;
char *newname, fullpath[PATH_MAX]; char *newname, fullpath[PATH_MAX];
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
@ -748,6 +748,9 @@ disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM ou
struct utimbuf tvs; struct utimbuf tvs;
struct STATFS_T stat_fs; struct STATFS_T stat_fs;
logger(Disk, Debug, "disk_set_information(handle=0x%x, info_class=0x%x, ...)", handle,
info_class);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
g_notify_stamp = True; g_notify_stamp = True;
newname = NULL; newname = NULL;
@ -946,12 +949,12 @@ disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM ou
RD_NTSTATUS RD_NTSTATUS
disk_check_notify(RD_NTHANDLE handle) disk_check_notify(RD_NTHANDLE handle)
{ {
logger(Disk, Debug, "disk_check_notify(handle=0x%x)", handle);
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
RD_NTSTATUS status = RD_STATUS_PENDING; RD_NTSTATUS status = RD_STATUS_PENDING;
NOTIFY notify; NOTIFY notify;
logger(Disk, Debug, "disk_check_notify(handle=0x%x)", handle);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
if (!pfinfo->pdir) if (!pfinfo->pdir)
return RD_STATUS_INVALID_DEVICE_REQUEST; return RD_STATUS_INVALID_DEVICE_REQUEST;
@ -978,11 +981,10 @@ disk_check_notify(RD_NTHANDLE handle)
RD_NTSTATUS RD_NTSTATUS
disk_create_notify(RD_NTHANDLE handle, uint32 info_class) disk_create_notify(RD_NTHANDLE handle, uint32 info_class)
{ {
logger(Disk, Debug, "disk_create_notify(handle=0x%x, info_class=0x%x)", handle, info_class);
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
RD_NTSTATUS ret = RD_STATUS_PENDING; RD_NTSTATUS ret = RD_STATUS_PENDING;
/* printf("start disk_create_notify info_class %X\n", info_class); */ logger(Disk, Debug, "disk_create_notify(handle=0x%x, info_class=0x%x)", handle, info_class);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
pfinfo->info_class = info_class; pfinfo->info_class = info_class;
@ -1122,8 +1124,6 @@ FsVolumeInfo(char *fpath)
RD_NTSTATUS RD_NTSTATUS
disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
{ {
logger(Disk, Debug, "disk_query_volume_information(handle=0x%x, info_class=0x%x)", handle,
info_class);
struct STATFS_T stat_fs; struct STATFS_T stat_fs;
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
FsInfoType *fsinfo; FsInfoType *fsinfo;
@ -1132,6 +1132,9 @@ disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
memset(&stmp, 0, sizeof(stmp)); memset(&stmp, 0, sizeof(stmp));
s_realloc(&stmp, PATH_MAX * 4); s_realloc(&stmp, PATH_MAX * 4);
logger(Disk, Debug, "disk_query_volume_information(handle=0x%x, info_class=0x%x)", handle,
info_class);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
if (STATFS_FN(pfinfo->path, &stat_fs) != 0) if (STATFS_FN(pfinfo->path, &stat_fs) != 0)
@ -1210,8 +1213,6 @@ disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
RD_NTSTATUS RD_NTSTATUS
disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out) disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
{ {
logger(Disk, Debug, "disk_query_directory(handle=0x%x, info_class=0x%x, pattern=%s, ...)",
handle, info_class, pattern);
uint32 file_attributes, ft_low, ft_high; uint32 file_attributes, ft_low, ft_high;
char *dirname, fullpath[PATH_MAX]; char *dirname, fullpath[PATH_MAX];
DIR *pdir; DIR *pdir;
@ -1220,6 +1221,9 @@ disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREA
struct fileinfo *pfinfo; struct fileinfo *pfinfo;
struct stream stmp; struct stream stmp;
logger(Disk, Debug, "disk_query_directory(handle=0x%x, info_class=0x%x, pattern=%s, ...)",
handle, info_class, pattern);
pfinfo = &(g_fileinfo[handle]); pfinfo = &(g_fileinfo[handle]);
pdir = pfinfo->pdir; pdir = pfinfo->pdir;
dirname = pfinfo->path; dirname = pfinfo->path;