3232#include <stdint.h>
3333#include <sys/sysmacros.h>
3434
35- #ifdef ENABLE_UUID
3635#include <dirent.h>
3736#include <sys/ioctl.h>
3837#include <sys/stat.h>
@@ -91,7 +90,6 @@ int parse_uuid(char *uuid_buf /* 16 bytes */, const char *string_representation)
9190
9291 return 0 ;
9392}
94- #endif /* defined(ENABLE_UUID) */
9593
9694void wait_for_device (char * real_device_name , int * timeout , const char * device , int delay )
9795{
@@ -117,12 +115,9 @@ void wait_for_device(char *real_device_name, int *timeout, const char *device, i
117115 /* Our timeout starts *after* the rootdelay. */
118116 start = time (NULL );
119117
120- #ifdef ENABLE_UUID
121118 if (type != WANT_NAME ) {
122119 have_device = scan_devices (real_device_name , type , major , minor , uuid , serial );
123- } else
124- #endif
125- {
120+ } else {
126121 set_buf (real_device_name , MAX_PATH_LEN , device , NULL );
127122 have_device = access (device , F_OK ) != 0 ;
128123 }
@@ -143,11 +138,9 @@ void wait_for_device(char *real_device_name, int *timeout, const char *device, i
143138 struct timespec rem ;
144139 (void )nanosleep (& req , & rem );
145140
146- #ifdef ENABLE_UUID
147141 if (type != WANT_NAME )
148142 have_device = scan_devices (real_device_name , type , major , minor , uuid , serial );
149143 else
150- #endif
151144 have_device = access (device , F_OK ) != 0 ;
152145 }
153146
@@ -163,18 +156,11 @@ void wait_for_device(char *real_device_name, int *timeout, const char *device, i
163156
164157int is_valid_device_name (const char * device_name , int * type , unsigned int * major , unsigned int * minor , char * uuid , char * serial )
165158{
166- #ifdef ENABLE_UUID
167159 int r ;
168160 char * endptr ;
169161 char uuid_buf [32 + 4 + 1 ] = { 0 };
170162 char uuid_temp [16 ];
171163 unsigned long x ;
172- #else
173- (void )major ;
174- (void )minor ;
175- (void )uuid ;
176- (void )serial ;
177- #endif
178164
179165 if (!device_name )
180166 return 0 ;
@@ -201,7 +187,6 @@ int is_valid_device_name(const char *device_name, int *type, unsigned int* major
201187 return 1 ;
202188 }
203189
204- #ifdef ENABLE_UUID
205190 /* 0x803 or so for 8:3 */
206191 if (device_name [0 ] == '0' && device_name [1 ] == 'x' ) {
207192 x = strtoul (device_name + 2 , & endptr , 16 );
@@ -240,12 +225,10 @@ int is_valid_device_name(const char *device_name, int *type, unsigned int* major
240225 * type = WANT_UUID ;
241226 return r ;
242227 }
243- #endif
244228
245229 return 0 ;
246230}
247231
248- #ifdef ENABLE_UUID
249232/* Which data types for this structure is available is wildly
250233 * incompatible between libc implementations, so we just use the
251234 * stdint.h types. */
@@ -501,5 +484,3 @@ int is_fs_with_serial(const char *device_name, const char *serial)
501484
502485 return strncmp (serial , device_serial , VIRTIO_BLK_ID_BYTES ) == 0 ;
503486}
504-
505- #endif /* defined(ENABLE_UUID) */
0 commit comments