#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

#include "exprecium.h"

#define EXP_DIR "/dev/exp" 
#define MAX_PATH 20


int 
init_exp(int n) 
{
    char path[MAX_PATH];
    int fd;
    
    path[MAX_PATH - 1] = '\0';
    snprintf(path, MAX_PATH - 1, "%s/%d", EXP_DIR, n);
    
    fd = open(path, O_RDWR);
    if(fd < 0) { 
	printf("%s\n", path);
	perror("");
	fprintf(stderr, "Make sure that exp module is inserted into kernel space\n");
    }
    
    return fd;
}


int 
close_exp(int fd)
{
    close(fd);
    return 0;
}

