@@ -105,18 +105,18 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path)
105105 }
106106 sysattr = alloc_attribute ();
107107 if (!sysattr ) {
108- dprintf ("Error allocating attribute at %s\n" , path );
108+ dbg_printf ("Error allocating attribute at %s\n" , path );
109109 return NULL ;
110110 }
111111 if (sysfs_get_name_from_path (path , sysattr -> name ,
112112 SYSFS_NAME_LEN ) != 0 ) {
113- dprintf ("Error retrieving attrib name from path: %s\n" , path );
113+ dbg_printf ("Error retrieving attrib name from path: %s\n" , path );
114114 sysfs_close_attribute (sysattr );
115115 return NULL ;
116116 }
117117 safestrcpy (sysattr -> path , path );
118118 if ((stat (sysattr -> path , & fileinfo )) != 0 ) {
119- dprintf ("Stat failed: No such attribute?\n" );
119+ dbg_printf ("Stat failed: No such attribute?\n" );
120120 sysattr -> method = 0 ;
121121 free (sysattr );
122122 sysattr = NULL ;
@@ -148,25 +148,25 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr)
148148 return -1 ;
149149 }
150150 if (!(sysattr -> method & SYSFS_METHOD_SHOW )) {
151- dprintf ("Show method not supported for attribute %s\n" ,
151+ dbg_printf ("Show method not supported for attribute %s\n" ,
152152 sysattr -> path );
153153 errno = EACCES ;
154154 return -1 ;
155155 }
156156 pgsize = getpagesize ();
157157 fbuf = (char * )calloc (1 , pgsize + 1 );
158158 if (!fbuf ) {
159- dprintf ("calloc failed\n" );
159+ dbg_printf ("calloc failed\n" );
160160 return -1 ;
161161 }
162162 if ((fd = open (sysattr -> path , O_RDONLY )) < 0 ) {
163- dprintf ("Error reading attribute %s\n" , sysattr -> path );
163+ dbg_printf ("Error reading attribute %s\n" , sysattr -> path );
164164 free (fbuf );
165165 return -1 ;
166166 }
167167 length = read (fd , fbuf , pgsize );
168168 if (length < 0 ) {
169- dprintf ("Error reading from attribute %s\n" , sysattr -> path );
169+ dbg_printf ("Error reading from attribute %s\n" , sysattr -> path );
170170 close (fd );
171171 free (fbuf );
172172 return -1 ;
@@ -184,7 +184,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr)
184184 close (fd );
185185 vbuf = (char * )realloc (fbuf , length + 1 );
186186 if (!vbuf ) {
187- dprintf ("realloc failed\n" );
187+ dbg_printf ("realloc failed\n" );
188188 free (fbuf );
189189 return -1 ;
190190 }
@@ -212,7 +212,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr,
212212 }
213213
214214 if (!(sysattr -> method & SYSFS_METHOD_STORE )) {
215- dprintf ("Store method not supported for attribute %s\n" ,
215+ dbg_printf ("Store method not supported for attribute %s\n" ,
216216 sysattr -> path );
217217 errno = EACCES ;
218218 return -1 ;
@@ -222,12 +222,12 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr,
222222 * read attribute again to see if we can get an updated value
223223 */
224224 if ((sysfs_read_attribute (sysattr ))) {
225- dprintf ("Error reading attribute\n" );
225+ dbg_printf ("Error reading attribute\n" );
226226 return -1 ;
227227 }
228228 if ((strncmp (sysattr -> value , new_value , sysattr -> len )) == 0 &&
229229 (len == sysattr -> len )) {
230- dprintf ("Attr %s already has the requested value %s\n" ,
230+ dbg_printf ("Attr %s already has the requested value %s\n" ,
231231 sysattr -> name , new_value );
232232 return 0 ;
233233 }
@@ -237,18 +237,18 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr,
237237 * "write" permission
238238 */
239239 if ((fd = open (sysattr -> path , O_WRONLY )) < 0 ) {
240- dprintf ("Error reading attribute %s\n" , sysattr -> path );
240+ dbg_printf ("Error reading attribute %s\n" , sysattr -> path );
241241 return -1 ;
242242 }
243243
244244 length = write (fd , new_value , len );
245245 if (length < 0 ) {
246- dprintf ("Error writing to the attribute %s - invalid value?\n" ,
246+ dbg_printf ("Error writing to the attribute %s - invalid value?\n" ,
247247 sysattr -> name );
248248 close (fd );
249249 return -1 ;
250250 } else if ((unsigned int )length != len ) {
251- dprintf ("Could not write %zd bytes to attribute %s\n" ,
251+ dbg_printf ("Could not write %zd bytes to attribute %s\n" ,
252252 len , sysattr -> name );
253253 /*
254254 * since we could not write user supplied number of bytes,
@@ -295,12 +295,12 @@ static struct sysfs_attribute *add_attribute_to_list(struct dlist *alist,
295295
296296 attr = sysfs_open_attribute (path );
297297 if (!attr ) {
298- dprintf ("Error opening attribute %s\n" , path );
298+ dbg_printf ("Error opening attribute %s\n" , path );
299299 return NULL ;
300300 }
301301 if (attr -> method & SYSFS_METHOD_SHOW ) {
302302 if (sysfs_read_attribute (attr )) {
303- dprintf ("Error reading attribute %s\n" , path );
303+ dbg_printf ("Error reading attribute %s\n" , path );
304304 sysfs_close_attribute (attr );
305305 return NULL ;
306306 }
@@ -326,12 +326,12 @@ static struct sysfs_attribute *add_attribute(void *dev, const char *path)
326326
327327 attr = sysfs_open_attribute (path );
328328 if (!attr ) {
329- dprintf ("Error opening attribute %s\n" , path );
329+ dbg_printf ("Error opening attribute %s\n" , path );
330330 return NULL ;
331331 }
332332 if (attr -> method & SYSFS_METHOD_SHOW ) {
333333 if (sysfs_read_attribute (attr )) {
334- dprintf ("Error reading attribute %s\n" , path );
334+ dbg_printf ("Error reading attribute %s\n" , path );
335335 sysfs_close_attribute (attr );
336336 return NULL ;
337337 }
@@ -397,7 +397,7 @@ struct dlist *read_dir_links(const char *path)
397397 }
398398 dir = opendir (path );
399399 if (!dir ) {
400- dprintf ("Error opening directory %s\n" , path );
400+ dbg_printf ("Error opening directory %s\n" , path );
401401 return NULL ;
402402 }
403403 while ((dirent = readdir (dir )) != NULL ) {
@@ -414,7 +414,7 @@ struct dlist *read_dir_links(const char *path)
414414 linklist = dlist_new_with_delete
415415 (SYSFS_NAME_LEN , sysfs_del_name );
416416 if (!linklist ) {
417- dprintf ("Error creating list\n" );
417+ dbg_printf ("Error creating list\n" );
418418 return NULL ;
419419 }
420420 }
@@ -469,7 +469,7 @@ struct sysfs_device *sysfs_read_dir_subdirs(const char *path)
469469
470470 dir = opendir (path );
471471 if (!dir ) {
472- dprintf ("Error opening directory %s\n" , path );
472+ dbg_printf ("Error opening directory %s\n" , path );
473473 return NULL ;
474474 }
475475 while ((dirent = readdir (dir )) != NULL ) {
@@ -506,7 +506,7 @@ struct dlist *read_dir_subdirs(const char *path)
506506 }
507507 dir = opendir (path );
508508 if (!dir ) {
509- dprintf ("Error opening directory %s\n" , path );
509+ dbg_printf ("Error opening directory %s\n" , path );
510510 return NULL ;
511511 }
512512 while ((dirent = readdir (dir )) != NULL ) {
@@ -523,7 +523,7 @@ struct dlist *read_dir_subdirs(const char *path)
523523 dirlist = dlist_new_with_delete
524524 (SYSFS_NAME_LEN , sysfs_del_name );
525525 if (!dirlist ) {
526- dprintf ("Error creating list\n" );
526+ dbg_printf ("Error creating list\n" );
527527 return NULL ;
528528 }
529529 }
@@ -554,7 +554,7 @@ struct dlist *get_attributes_list(struct dlist *alist, const char *path)
554554
555555 dir = opendir (path );
556556 if (!dir ) {
557- dprintf ("Error opening directory %s\n" , path );
557+ dbg_printf ("Error opening directory %s\n" , path );
558558 return NULL ;
559559 }
560560 while ((dirent = readdir (dir )) != NULL ) {
@@ -572,7 +572,7 @@ struct dlist *get_attributes_list(struct dlist *alist, const char *path)
572572 (sizeof (struct sysfs_attribute ),
573573 sysfs_del_attribute );
574574 if (!alist ) {
575- dprintf ("Error creating list\n" );
575+ dbg_printf ("Error creating list\n" );
576576 return NULL ;
577577 }
578578 }
@@ -603,7 +603,7 @@ struct dlist *get_dev_attributes_list(void *dev)
603603 safestrcpy (path , ((struct sysfs_device * )dev )-> path );
604604 dir = opendir (path );
605605 if (!dir ) {
606- dprintf ("Error opening directory %s\n" , path );
606+ dbg_printf ("Error opening directory %s\n" , path );
607607 return NULL ;
608608 }
609609 while ((dirent = readdir (dir )) != NULL ) {
0 commit comments