chiark / gitweb /
[PATCH] klibc_fixups: remove unneeded stuff
[elogind.git] / libsysfs / sysfs.h
index eb2a00295821b9c70c3902c521f7aebdedeecded..838427797dda5570cc567cefe89a560c117d0377 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Internal Header Definitions for libsysfs
  *
- * Copyright (C) 2003 International Business Machines, Inc.
+ * Copyright (C) IBM Corp. 2003
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <mntent.h>
+#include <ctype.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
 
-/* external library functions */
-extern int lstat(const char *file_name, struct stat *buf);
-extern int readlink(const char *path, char *buf, size_t bufsize);
-extern int getpagesize(void);
-extern int isascii(int c);
+#define safestrcpy(to, from)   strncpy(to, from, sizeof(to)-1)
+#define safestrcat(to, from)   strncat(to, from, sizeof(to) - strlen(to)-1)
+
+#define safestrcpymax(to, from, max) \
+do { \
+       to[max-1] = '\0'; \
+       strncpy(to, from, max-1); \
+} while (0)
+
+#define safestrcatmax(to, from, max) \
+do { \
+       to[max-1] = '\0'; \
+       strncat(to, from, max - strlen(to)-1); \
+} while (0)
+
+extern struct sysfs_attribute *get_attribute(void *dev, const char *name);
+extern struct dlist *read_dir_subdirs(const char *path);
+extern struct dlist *read_dir_links(const char *path);
+extern struct dlist *get_attributes_list(void *dev);
 
 /* Debugging */
 #ifdef DEBUG
-#define dprintf(format, arg...) fprintf(stderr, format, ## arg)
+#include "../logging.h"
+#define dprintf(format, arg...) dbg(format, ## arg)
 #else
 #define dprintf(format, arg...) do { } while (0)
 #endif