summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs.h
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2005-02-23 12:21:39 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 23:36:13 -0700
commitf385ff6512012a75b8381938dd3f55f991b53e9a (patch)
treedc244352cda7c9b52f86917d1b311c386fc9e71c /libsysfs/sysfs.h
parent8d1b4df2192915dc94442c1ef3327a28a57b3615 (diff)
[PATCH] big libsysfs diet (pre 2.0 version)
Diffstat (limited to 'libsysfs/sysfs.h')
-rw-r--r--libsysfs/sysfs.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h
index 1e58e8abb4..30bd9b4089 100644
--- a/libsysfs/sysfs.h
+++ b/libsysfs/sysfs.h
@@ -27,19 +27,37 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <ctype.h>
#include <mntent.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-/* external library functions */
-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
#include "../logging.h"
-#define dprintf(format, arg...) dbg(format, ##arg)
+#define dprintf(format, arg...) dbg(format, ## arg)
#else
#define dprintf(format, arg...) do { } while (0)
#endif