aboutsummaryrefslogtreecommitdiffstats
path: root/src/kern-linux.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-11 16:13:45 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-11 16:13:45 +0100
commit50da9e696d7be359cdbeaf22bd643f3885827a55 (patch)
treec6fdbf869057e5f21155613c1dec2090c096b029 /src/kern-linux.c
parentmake: missed to add a variable needed at dist (diff)
downloadscrotty-50da9e696d7be359cdbeaf22bd643f3885827a55.tar.gz
scrotty-50da9e696d7be359cdbeaf22bd643f3885827a55.tar.bz2
scrotty-50da9e696d7be359cdbeaf22bd643f3885827a55.tar.xz
the kernel-specific functions can fetch and use additional data it may need
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--src/kern-linux.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/kern-linux.c b/src/kern-linux.c
index 00930f1..7e31d1b 100644
--- a/src/kern-linux.c
+++ b/src/kern-linux.c
@@ -71,10 +71,13 @@ get_fbpath (int altpath, int fbno)
* @param fbpath The path to the framebuffer device..
* @param width Output parameter for the width of the image.
* @param height Output parameter for the height of the image.
+ * @parma data Additional data to pass to `convert_fb_to_pnm`
+ * and `convert_fb_to_png`.
* @return Zero on success, -1 on error.
*/
int
-measure (int fbno, char *restrict fbpath, long *restrict width, long *restrict height)
+measure (int fbno, char *restrict fbpath, long *restrict width,
+ long *restrict height, void **restrict data)
{
static char buf[sizeof (SYSDIR "/class/graphics/fb/virtual_size") + 3 * sizeof(int)];
/* The string "/class/graphics/fb/virtual_size" is large enought for the call (*) "*/
@@ -126,11 +129,12 @@ measure (int fbno, char *restrict fbpath, long *restrict width, long *restrict h
* (a whole number of pixels where available,)
* otherwise, set to the number of bytes a
* pixel is encoded.
+ * @param data Data from `measure`.
* @return Zero on success, -1 on error.
*/
int
-convert_fb_to_pnm (FILE *restrict file, const char *restrict buf,
- size_t n, size_t *restrict adjustment)
+convert_fb_to_pnm (FILE *restrict file, const char *restrict buf, size_t n,
+ size_t *restrict adjustment, void *restrict data)
{
const uint32_t *restrict pixel;
int r, g, b;
@@ -169,10 +173,12 @@ convert_fb_to_pnm (FILE *restrict file, const char *restrict buf,
* pixel is encoded.
* @param state Use this to keep track of where in the you
* stopped. It will be 0 on the first call.
+ * @param data Data from `measure`.
* @return Zero on success, -1 on error.
*/
int convert_fb_to_png (png_struct *pngbuf, png_byte *restrict pixbuf, const char *restrict buf,
- size_t n, long width3, size_t *restrict adjustment, long *restrict state)
+ size_t n, long width3, size_t *restrict adjustment, long *restrict state,
+ void *restrict data)
{
const uint32_t *restrict pixel;
int r, g, b;