diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-16 21:08:06 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-09-16 21:08:06 +0000 |
commit | 5fafdf24ef2c090c164d4dc89684b3f379dbdd87 (patch) | |
tree | c0654ee63b6dac76d98b427e92ef16850a90c652 /tap-win32.c | |
parent | bd494f4cbd4187dda8cc8f4739763f24a31a4c8b (diff) | |
download | qemu-5fafdf24ef2c090c164d4dc89684b3f379dbdd87.zip qemu-5fafdf24ef2c090c164d4dc89684b3f379dbdd87.tar.gz qemu-5fafdf24ef2c090c164d4dc89684b3f379dbdd87.tar.bz2 |
find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tap-win32.c')
-rw-r--r-- | tap-win32.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/tap-win32.c b/tap-win32.c index d84a622..8384952 100644 --- a/tap-win32.c +++ b/tap-win32.c @@ -110,7 +110,7 @@ typedef struct tap_win32_overlapped { static tap_win32_overlapped_t tap_overlapped; -static tun_buffer_t* get_buffer_from_free_list(tap_win32_overlapped_t* const overlapped) +static tun_buffer_t* get_buffer_from_free_list(tap_win32_overlapped_t* const overlapped) { tun_buffer_t* buffer = NULL; WaitForSingleObject(overlapped->free_list_semaphore, INFINITE); @@ -132,18 +132,18 @@ static void put_buffer_on_free_list(tap_win32_overlapped_t* const overlapped, tu ReleaseSemaphore(overlapped->free_list_semaphore, 1, NULL); } -static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const overlapped, const int block) +static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const overlapped, const int block) { tun_buffer_t* buffer = NULL; DWORD result, timeout = block ? INFINITE : 0L; // Non-blocking call - result = WaitForSingleObject(overlapped->output_queue_semaphore, timeout); + result = WaitForSingleObject(overlapped->output_queue_semaphore, timeout); - switch (result) - { + switch (result) + { // The semaphore object was signaled. - case WAIT_OBJECT_0: + case WAIT_OBJECT_0: EnterCriticalSection(&overlapped->output_queue_cs); buffer = overlapped->output_queue_front; @@ -154,18 +154,18 @@ static tun_buffer_t* get_buffer_from_output_queue(tap_win32_overlapped_t* const } LeaveCriticalSection(&overlapped->output_queue_cs); - break; + break; // Semaphore was nonsignaled, so a time-out occurred. - case WAIT_TIMEOUT: + case WAIT_TIMEOUT: // Cannot open another window. - break; + break; } return buffer; } -static tun_buffer_t* get_buffer_from_output_queue_immediate (tap_win32_overlapped_t* const overlapped) +static tun_buffer_t* get_buffer_from_output_queue_immediate (tap_win32_overlapped_t* const overlapped) { return get_buffer_from_output_queue(overlapped, 0); } @@ -332,7 +332,7 @@ static int get_device_guid( return -1; } - snprintf(connection_string, + snprintf(connection_string, sizeof(connection_string), "%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name); @@ -343,7 +343,7 @@ static int get_device_guid( 0, KEY_READ, &connection_key); - + if (status == ERROR_SUCCESS) { len = sizeof (name_data); status = RegQueryValueEx( @@ -416,7 +416,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped, InitializeCriticalSection(&overlapped->output_queue_cs); InitializeCriticalSection(&overlapped->free_list_cs); - overlapped->output_queue_semaphore = CreateSemaphore( + overlapped->output_queue_semaphore = CreateSemaphore( NULL, // default security attributes 0, // initial count TUN_MAX_BUFFER_COUNT, // maximum count @@ -426,7 +426,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped, fprintf(stderr, "error creating output queue semaphore!\n"); } - overlapped->free_list_semaphore = CreateSemaphore( + overlapped->free_list_semaphore = CreateSemaphore( NULL, // default security attributes TUN_MAX_BUFFER_COUNT, // initial count TUN_MAX_BUFFER_COUNT, // maximum count @@ -452,7 +452,7 @@ static void tap_win32_overlapped_init(tap_win32_overlapped_t* const overlapped, fprintf(stderr, "error creating tap_semaphore.\n"); } -static int tap_win32_write(tap_win32_overlapped_t *overlapped, +static int tap_win32_write(tap_win32_overlapped_t *overlapped, const void *buffer, unsigned long size) { unsigned long write_size; @@ -467,18 +467,18 @@ static int tap_win32_write(tap_win32_overlapped_t *overlapped, result = WriteFile(overlapped->handle, buffer, size, &write_size, &overlapped->write_overlapped); - - if (!result) { + + if (!result) { switch (error = GetLastError()) - { - case ERROR_IO_PENDING: + { + case ERROR_IO_PENDING: #ifndef TUN_ASYNCHRONOUS_WRITES WaitForSingleObject(overlapped->write_event, INFINITE); #endif break; default: return -1; - } + } } return 0; @@ -539,7 +539,7 @@ static DWORD WINAPI tap_win32_thread_entry(LPVOID param) return 0; } -static int tap_win32_read(tap_win32_overlapped_t *overlapped, +static int tap_win32_read(tap_win32_overlapped_t *overlapped, uint8_t **pbuf, int max_size) { int size = 0; @@ -557,14 +557,14 @@ static int tap_win32_read(tap_win32_overlapped_t *overlapped, return size; } -static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, - char* pbuf) +static void tap_win32_free_buffer(tap_win32_overlapped_t *overlapped, + char* pbuf) { tun_buffer_t* buffer = (tun_buffer_t*)pbuf; put_buffer_on_free_list(overlapped, buffer); } -static int tap_win32_open(tap_win32_overlapped_t **phandle, +static int tap_win32_open(tap_win32_overlapped_t **phandle, const char *prefered_name) { char device_path[256]; @@ -660,7 +660,7 @@ static void tap_win32_send(void *opaque) int tap_win32_init(VLANState *vlan, const char *ifname) { TAPState *s; - + s = qemu_mallocz(sizeof(TAPState)); if (!s) return -1; @@ -670,7 +670,7 @@ int tap_win32_init(VLANState *vlan, const char *ifname) } s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s); - + snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: ifname=%s", ifname); |