Skip to content

Instantly share code, notes, and snippets.

@aramperes
Created July 11, 2018 23:45
Show Gist options
  • Save aramperes/b793a05f65f65bd23395c51e853c0137 to your computer and use it in GitHub Desktop.
Save aramperes/b793a05f65f65bd23395c51e853c0137 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <sys/mount.h>
extern char * ffmount(char *path)
{
int rc;
char *mountpoint;
mountpoint = mkdtemp(path);
if (!mountpoint) {
return NULL;
}
rc = mount("tmpfs", mountpoint, "tmpfs", 0, "");
if (rc != 0) {
rmdir(mountpoint);
return NULL;
}
return strdup(mountpoint);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment