commit latest changes
This commit is contained in:
parent
bd9d3e1df3
commit
57dc545fad
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* ident
|
||||||
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Ignore all generated files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.cmd
|
||||||
|
*.a
|
||||||
|
*.d
|
||||||
|
*.mod
|
||||||
|
*.mod.c
|
||||||
|
*.order
|
||||||
|
*.so*
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Generated demo executables
|
||||||
|
examples/console-read
|
||||||
|
examples/drums
|
||||||
|
examples/drums2
|
||||||
|
examples/drums3
|
||||||
|
examples/echo
|
||||||
|
examples/helloworld
|
||||||
|
examples/ioctl
|
||||||
|
examples/logring
|
||||||
|
examples/pager
|
||||||
|
examples/uid-filter
|
||||||
6
Makefile
6
Makefile
@ -6,10 +6,10 @@ PREFIX = /usr/local
|
|||||||
LIBDIR = $(PREFIX)/lib
|
LIBDIR = $(PREFIX)/lib
|
||||||
INCDIR = $(PREFIX)/include
|
INCDIR = $(PREFIX)/include
|
||||||
|
|
||||||
CC = gcc
|
CC = $(CROSS_COMPILE)gcc
|
||||||
LD = gcc
|
LD = $(CROSS_COMPILE)gcc
|
||||||
INSTALL = install
|
INSTALL = install
|
||||||
STRIP = strip
|
STRIP = $(CROSS_COMPILE)strip
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
ETCDIR = /etc/$(TARGET)
|
ETCDIR = /etc/$(TARGET)
|
||||||
|
|||||||
@ -88,7 +88,7 @@ struct fusd_transaction
|
|||||||
struct fusd_dev_t_s;
|
struct fusd_dev_t_s;
|
||||||
typedef struct fusd_dev_t_s fusd_dev_t;
|
typedef struct fusd_dev_t_s fusd_dev_t;
|
||||||
struct CLASS;
|
struct CLASS;
|
||||||
struct class_device;
|
struct device;
|
||||||
|
|
||||||
/* state kept per opened file (i.e., an instance of a device) */
|
/* state kept per opened file (i.e., an instance of a device) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -125,7 +125,7 @@ struct fusd_dev_t_s {
|
|||||||
char *dev_name;
|
char *dev_name;
|
||||||
struct CLASS *clazz;
|
struct CLASS *clazz;
|
||||||
int owns_class;
|
int owns_class;
|
||||||
struct class_device *class_device;
|
struct device *device;
|
||||||
|
|
||||||
void *private_data; /* User's private data */
|
void *private_data; /* User's private data */
|
||||||
struct cdev* handle;
|
struct cdev* handle;
|
||||||
|
|||||||
4440
kfusd/kfusd.c
4440
kfusd/kfusd.c
File diff suppressed because it is too large
Load Diff
@ -328,8 +328,6 @@ void fusd_fdset_add(fd_set *set, int *max)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fusd_dispatch_fdset: given an fd_set full of descriptors, call
|
* fusd_dispatch_fdset: given an fd_set full of descriptors, call
|
||||||
* fusd_dispatch on every descriptor in the set which is a valid FUSD
|
* fusd_dispatch on every descriptor in the set which is a valid FUSD
|
||||||
@ -410,16 +408,21 @@ static int fusd_dispatch_one(int fd, fusd_file_operations_t *fops)
|
|||||||
|
|
||||||
/* dispatch on operation type */
|
/* dispatch on operation type */
|
||||||
user_retval = -ENOSYS;
|
user_retval = -ENOSYS;
|
||||||
|
printf("dispatch_one: subcmd: %d - ", msg->subcmd);
|
||||||
|
|
||||||
switch (msg->subcmd) {
|
switch (msg->subcmd) {
|
||||||
case FUSD_OPEN:
|
case FUSD_OPEN:
|
||||||
|
printf("FUSD_OPEN\n");
|
||||||
if (fops && fops->open)
|
if (fops && fops->open)
|
||||||
user_retval = fops->open(file);
|
user_retval = fops->open(file);
|
||||||
break;
|
break;
|
||||||
case FUSD_CLOSE:
|
case FUSD_CLOSE:
|
||||||
|
printf("FUSD_CLOSE\n");
|
||||||
if (fops && fops->close)
|
if (fops && fops->close)
|
||||||
user_retval = fops->close(file);
|
user_retval = fops->close(file);
|
||||||
break;
|
break;
|
||||||
case FUSD_READ:
|
case FUSD_READ:
|
||||||
|
printf("FUSD_READ\n");
|
||||||
/* allocate a buffer and make the call */
|
/* allocate a buffer and make the call */
|
||||||
if (fops && fops->read) {
|
if (fops && fops->read) {
|
||||||
if ((msg->data = malloc(msg->parm.fops_msg.length)) == NULL) {
|
if ((msg->data = malloc(msg->parm.fops_msg.length)) == NULL) {
|
||||||
@ -433,11 +436,13 @@ static int fusd_dispatch_one(int fd, fusd_file_operations_t *fops)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FUSD_WRITE:
|
case FUSD_WRITE:
|
||||||
|
printf("FUSD_WRITE\n");
|
||||||
if (fops && fops->write)
|
if (fops && fops->write)
|
||||||
user_retval = fops->write(file, msg->data, msg->datalen,
|
user_retval = fops->write(file, msg->data, msg->datalen,
|
||||||
&msg->parm.fops_msg.offset);
|
&msg->parm.fops_msg.offset);
|
||||||
break;
|
break;
|
||||||
case FUSD_MMAP:
|
case FUSD_MMAP:
|
||||||
|
printf("FUSD_MMAP\n");
|
||||||
if (fops && fops->mmap)
|
if (fops && fops->mmap)
|
||||||
{
|
{
|
||||||
user_retval = fops->mmap(file, msg->parm.fops_msg.offset, msg->parm.fops_msg.length, msg->parm.fops_msg.flags,
|
user_retval = fops->mmap(file, msg->parm.fops_msg.offset, msg->parm.fops_msg.length, msg->parm.fops_msg.flags,
|
||||||
@ -445,6 +450,7 @@ static int fusd_dispatch_one(int fd, fusd_file_operations_t *fops)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FUSD_IOCTL:
|
case FUSD_IOCTL:
|
||||||
|
printf("FUSD_IOCTL\n");
|
||||||
if (fops && fops->ioctl) {
|
if (fops && fops->ioctl) {
|
||||||
/* in the case of an ioctl read, allocate a buffer for the
|
/* in the case of an ioctl read, allocate a buffer for the
|
||||||
* driver to write to, IF there isn't already a buffer. (there
|
* driver to write to, IF there isn't already a buffer. (there
|
||||||
@ -466,6 +472,7 @@ static int fusd_dispatch_one(int fd, fusd_file_operations_t *fops)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FUSD_POLL_DIFF:
|
case FUSD_POLL_DIFF:
|
||||||
|
printf("FUSD_POLL_DIFF\n");
|
||||||
/* This callback requests notification when an event occurs on a file,
|
/* This callback requests notification when an event occurs on a file,
|
||||||
* e.g. becoming readable or writable */
|
* e.g. becoming readable or writable */
|
||||||
if (fops && fops->poll_diff)
|
if (fops && fops->poll_diff)
|
||||||
@ -473,6 +480,7 @@ static int fusd_dispatch_one(int fd, fusd_file_operations_t *fops)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FUSD_UNBLOCK:
|
case FUSD_UNBLOCK:
|
||||||
|
printf("FUSD_UNBLOCK\n");
|
||||||
/* This callback is called when a system call is interrupted */
|
/* This callback is called when a system call is interrupted */
|
||||||
if (fops && fops->unblock)
|
if (fops && fops->unblock)
|
||||||
user_retval = fops->unblock(file);
|
user_retval = fops->unblock(file);
|
||||||
@ -533,6 +541,7 @@ void fusd_dispatch(int fd)
|
|||||||
if (!FUSD_FD_VALID(fd)) {
|
if (!FUSD_FD_VALID(fd)) {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
fprintf(stderr, "libfusd: not a valid FUSD FD\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
fops = FUSD_GET_FOPS(fd);
|
fops = FUSD_GET_FOPS(fd);
|
||||||
@ -555,7 +564,7 @@ void fusd_dispatch(int fd)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if (retval < 0 && errno != EPIPE)
|
if (retval < 0 && errno != EPIPE)
|
||||||
fprintf(stderr, "libfusd: fusd_dispatch error on fd %d: %m\n", fd);
|
fprintf(stderr, "libfusd: fusd_dispatch error on fd %d: [%d] %m \n", fd, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -648,11 +657,16 @@ int fusd_return(fusd_file_info_t *file, ssize_t retval)
|
|||||||
|
|
||||||
/* send message to kernel */
|
/* send message to kernel */
|
||||||
if (msg->datalen && msg->data != NULL) {
|
if (msg->datalen && msg->data != NULL) {
|
||||||
|
printf("(msg->datalen [%d] && msg->data != NULL [%p]", msg->datalen, msg->data);
|
||||||
iov[0].iov_base = msg;
|
iov[0].iov_base = msg;
|
||||||
iov[0].iov_len = sizeof(fusd_msg_t);
|
iov[0].iov_len = sizeof(fusd_msg_t);
|
||||||
iov[1].iov_base = msg->data;
|
iov[1].iov_base = msg->data;
|
||||||
iov[1].iov_len = msg->datalen;
|
iov[1].iov_len = msg->datalen;
|
||||||
|
#if 0
|
||||||
driver_retval = writev(fd, iov, 2);
|
driver_retval = writev(fd, iov, 2);
|
||||||
|
#else
|
||||||
|
driver_retval = ioctl(fd, 0xb16b00b5, iov);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
driver_retval = write(fd, msg, sizeof(fusd_msg_t));
|
driver_retval = write(fd, msg, sizeof(fusd_msg_t));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user