summaryrefslogtreecommitdiff
path: root/ubi-utils/src/libubiold_sysfs.h
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-03-21 11:45:07 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-03-29 17:17:10 +0300
commitdb0fa8cfb0fae8c07c4c88f73bbc71176df36d7c (patch)
treed976f5970cb33858c482cad11a8dc90ad311da4e /ubi-utils/src/libubiold_sysfs.h
parenta8389fa276651f708a9da7d1feb6d5f25afc6704 (diff)
UBI-Utils: Rename old ubi library
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'ubi-utils/src/libubiold_sysfs.h')
-rw-r--r--ubi-utils/src/libubiold_sysfs.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/ubi-utils/src/libubiold_sysfs.h b/ubi-utils/src/libubiold_sysfs.h
new file mode 100644
index 0000000..2fb6072
--- /dev/null
+++ b/ubi-utils/src/libubiold_sysfs.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) International Business Machines Corp., 2006
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * UBI (Unsorted Block Images) library.
+ *
+ * Author: Artem B. Bityutskiy
+ */
+
+/**
+ * sysfs_read_data - read data from a sysfs file.
+ *
+ * @file path to the file to read from
+ * @buf furrer where to store read data
+ * @len length of provided buffer @buf
+ *
+ * This function returns the number of read bytes or -1 in case of error.
+ */
+int sysfs_read_data(const char *file, void *buf, int len);
+
+/**
+ * sysfs_read_data_subst - form path to a sysfs file and read data from it.
+ *
+ * @patt path to the file to read from
+ * @buf furrer where to store read data
+ * @len length of provided buffer @buf
+ * @n number of parameters to substitute to @patt
+ *
+ * This function forms path to a sysfs file by means of substituting parameters
+ * to @patt and then reads @len bytes from this file and stores the read data
+ * to @buf. This function returns the number of read bytes or -1 in case of
+ * error.
+ */
+int sysfs_read_data_subst(const char *patt, void *buf, int len, int n, ...);
+
+/**
+ * sysfs_read_dev - read major and minor number from a sysfs file.
+ *
+ * @file path to the file to read from
+ * @major major number is returned here
+ * @minor minor number is returned here
+ */
+int sysfs_read_dev(const char *file, unsigned int *major,
+ unsigned int *minor);
+/**
+ * sysfs_read_dev_subst - for path to a file and read major and minor number
+ * from it.
+ *
+ * @patt pattern of the path to the file to read from
+ * @major major number is returned here
+ * @minor minor number is returned here
+ * @n number of arguments to substitute
+ *
+ * This function substitures arguments to the @patt file path pattern and reads
+ * major and minor numbers from the resulting file.
+ */
+int sysfs_read_dev_subst(const char *patt, unsigned int *major,
+ unsigned int *minor, int n, ...);
+
+/**
+ * sysfs_read_ull_subst - form path to a sysfs file and read an unsigned long
+ * long value from there.
+ *
+ * @patt pattern of file path
+ * @num the read value is returned here
+ * @n number of parameters to substitute
+ *
+ *
+ * This function first forms the path to a sysfs file by means of substituting
+ * passed parameters to the @patt string, and then read an 'unsigned long long'
+ * value from this file.
+ */
+int sysfs_read_ull_subst(const char *patt, unsigned long long *num,
+ int n, ...);
+
+/**
+ * sysfs_read_uint_subst - the same as 'sysfs_read_uint_subst()' but reads an
+ * unsigned int value.
+ */
+int sysfs_read_uint_subst(const char *patt, unsigned int *num,
+ int n, ...);
+
+/**
+ * sysfs_read_ll - read a long long integer from an UBI sysfs file.
+ *
+ * @file file name from where to read
+ * @num the result is returned here
+ */
+int sysfs_read_ll(const char *file, long long *num);
+
+/**
+ * sysfs_read_int - the same as 'sysfs_read_ll()' but reads an 'int' value.
+ */
+int sysfs_read_int(const char *file, int *num);