drive: minor code formatting.

This commit is contained in:
Zhang Zhaolong 2014-02-12 11:34:33 +08:00
parent 0202e462f3
commit 5157555d5b
2 changed files with 33 additions and 33 deletions

View File

@ -177,9 +177,9 @@ static BOOL drive_file_init(DRIVE_FILE* file, UINT32 DesiredAccess, UINT32 Creat
struct STAT st;
BOOL exists;
#ifdef WIN32
const static int mode = _S_IREAD | _S_IWRITE ;
const static int mode = _S_IREAD | _S_IWRITE ;
#else
const static int mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
const static int mode = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH;
BOOL largeFile = FALSE;
#endif
int oflag = 0;
@ -265,7 +265,7 @@ static BOOL drive_file_init(DRIVE_FILE* file, UINT32 DesiredAccess, UINT32 Creat
#ifndef WIN32
if (largeFile)
{
oflag |= O_LARGEFILE;
oflag |= O_LARGEFILE;
}
#endif
file->fd = OPEN(file->fullpath, oflag, mode);
@ -426,7 +426,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input)
{
char* s = NULL;
mode_t m;
mode_t m;
UINT64 size;
int status;
char* fullpath;
@ -456,7 +456,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
tv[1].tv_sec = (LastWriteTime > 0 ? FILE_TIME_RDP_TO_SYSTEM(LastWriteTime) : st.st_mtime);
tv[1].tv_usec = 0;
#ifndef WIN32
/* TODO on win32 */
/* TODO on win32 */
#ifdef ANDROID
utimes(file->fullpath, tv);
#else
@ -474,7 +474,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
fchmod(file->fd, st.st_mode);
}
#endif
break;
break;
case FileEndOfFileInformation:
/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */
@ -510,7 +510,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
free(s);
/* TODO rename does not work on win32 */
if (rename(file->fullpath, fullpath) == 0)
if (rename(file->fullpath, fullpath) == 0)
{
drive_file_set_fullpath(file, fullpath);
}

View File

@ -576,29 +576,29 @@ static void drive_process_irp(DRIVE_DEVICE* drive, IRP* irp)
static void* drive_thread_func(void* arg)
{
IRP* irp;
wMessage message;
DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg;
IRP* irp;
wMessage message;
DRIVE_DEVICE* drive = (DRIVE_DEVICE*) arg;
while (1)
{
if (!MessageQueue_Wait(drive->IrpQueue))
break;
while (1)
{
if (!MessageQueue_Wait(drive->IrpQueue))
break;
if (!MessageQueue_Peek(drive->IrpQueue, &message, TRUE))
break;
if (!MessageQueue_Peek(drive->IrpQueue, &message, TRUE))
break;
if (message.id == WMQ_QUIT)
break;
if (message.id == WMQ_QUIT)
break;
irp = (IRP*) message.wParam;
irp = (IRP*) message.wParam;
if (irp)
drive_process_irp(drive, irp);
}
if (irp)
drive_process_irp(drive, irp);
}
ExitThread(0);
return NULL;
ExitThread(0);
return NULL;
}
static void drive_irp_request(DEVICE* device, IRP* irp)
@ -712,13 +712,13 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
drive->Path = _strdup("/");
}
drive_register_drive_path(pEntryPoints, drive->Name, drive->Path);
drive_register_drive_path(pEntryPoints, drive->Name, drive->Path);
#else
sys_code_page = GetACP();
/* Special case: path[0] == '*' -> export all drives */
/* Special case: path[0] == '*' -> export all drives */
/* Special case: path[0] == '%' -> user home dir */
if (strcmp(drive->Path, "%") == 0)
if (strcmp(drive->Path, "%") == 0)
{
_snprintf(buf, sizeof(buf), "%s\\", getenv("USERPROFILE"));
drive_register_drive_path(pEntryPoints, drive->Name, _strdup(buf));
@ -733,7 +733,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
for (dev = devlist, i = 0; *dev; dev += 4, i++)
{
if (*dev > 'B')
{
{
/* Suppress disk drives A and B to avoid pesty messages */
len = _snprintf(buf, sizeof(buf) - 4, "%s", drive->Name);
buf[len] = '_';
@ -744,11 +744,11 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
}
}
}
else
{
else
{
drive_register_drive_path(pEntryPoints, drive->Name, drive->Path);
}
#endif
return 0;
}
return 0;
}