diff options
-rw-r--r-- | libdiskfs/io-async-icky.c | 27 | ||||
-rw-r--r-- | libdiskfs/io-async.c | 30 | ||||
-rw-r--r-- | libdiskfs/io-duplicate.c | 35 | ||||
-rw-r--r-- | libdiskfs/io-get-conch.c | 44 | ||||
-rw-r--r-- | libdiskfs/io-interrupt.c | 28 | ||||
-rw-r--r-- | libdiskfs/io-map-cntl.c | 48 | ||||
-rw-r--r-- | libdiskfs/io-map.c | 35 | ||||
-rw-r--r-- | libdiskfs/io-modes-get.c | 33 | ||||
-rw-r--r-- | libdiskfs/io-modes-off.c | 34 | ||||
-rw-r--r-- | libdiskfs/io-modes-on.c | 34 | ||||
-rw-r--r-- | libdiskfs/io-modes-set.c | 32 | ||||
-rw-r--r-- | libdiskfs/io-owner-mod.c | 35 | ||||
-rw-r--r-- | libdiskfs/io-reauthenticate.c | 71 | ||||
-rw-r--r-- | libdiskfs/io-rel-conch.c | 44 | ||||
-rw-r--r-- | libdiskfs/io-restrict-auth.c | 63 | ||||
-rw-r--r-- | libdiskfs/io-select.c | 35 | ||||
-rw-r--r-- | libdiskfs/io-stat.c | 40 |
17 files changed, 668 insertions, 0 deletions
diff --git a/libdiskfs/io-async-icky.c b/libdiskfs/io-async-icky.c new file mode 100644 index 00000000..4ad80e89 --- /dev/null +++ b/libdiskfs/io-async-icky.c @@ -0,0 +1,27 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_get_icky_async_id as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_get_icky_async_id (struct protid *cred, + mach_port_t *idport) +{ + *idport = MACH_PORT_NULL; + return 0; +} diff --git a/libdiskfs/io-async.c b/libdiskfs/io-async.c new file mode 100644 index 00000000..7c50e75b --- /dev/null +++ b/libdiskfs/io-async.c @@ -0,0 +1,30 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_async as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_async (struct protid *cred, + mach_port_t notify, + mach_port_t *idport) +{ + mach_port_deallocate (mach_task_self (), notify); + *idport = MACH_PORT_NULL; + return EOPNOTSUPP; +} + diff --git a/libdiskfs/io-duplicate.c b/libdiskfs/io-duplicate.c new file mode 100644 index 00000000..88f0b381 --- /dev/null +++ b/libdiskfs/io-duplicate.c @@ -0,0 +1,35 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_duplicate as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_duplicate (struct protid *cred, + mach_port_t *port, + mach_msg_type_name_t *portpoly) +{ + if (!cred) + return EOPNOTSUPP; + + mutex_lock (&cred->po->np->lock); + *port = (make_protid (cred->po, cred->uids, cred->nuids, cred->gids, + cred->ngids))->fspt.pi.port; + *portpoly = MACH_MSG_TYPE_MAKE_SEND; + mutex_unlock (&cred->po->np->lock); + return 0; +} diff --git a/libdiskfs/io-get-conch.c b/libdiskfs/io-get-conch.c new file mode 100644 index 00000000..68558952 --- /dev/null +++ b/libdiskfs/io-get-conch.c @@ -0,0 +1,44 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_get_conch as described in <hurd/io.defs>. */ +error_t +S_io_get_conch (struct protid *cred) +{ + struct node *np; + int error = 0; + + if (!cred) + return EOPNOTSUPP; + + np = cred->po->np; + + mutex_lock (&np->lock); + + if (!cred->mapped) + { + mutex_unlock (&np->lock); + return EINVAL; + } + + error = ioserver_handle_io_get_conch (&np->conch, cred, cred->mapped); + + mutex_unlock (&np->lock); + return error; +} diff --git a/libdiskfs/io-interrupt.c b/libdiskfs/io-interrupt.c new file mode 100644 index 00000000..1348a2a2 --- /dev/null +++ b/libdiskfs/io-interrupt.c @@ -0,0 +1,28 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_interrupt as described in <hurd/io.defs>. */ +error_t +S_io_interrupt (struct protid *cred) +{ + if (!cred) + return EOPNOTSUPP; + + return 0; +} diff --git a/libdiskfs/io-map-cntl.c b/libdiskfs/io-map-cntl.c new file mode 100644 index 00000000..5c3aadd9 --- /dev/null +++ b/libdiskfs/io-map-cntl.c @@ -0,0 +1,48 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_map_cntl as described in <hurd/io.defs>. */ +error_t +S_io_map_cntl (struct protid *cred, + memory_object_t *ctlobj) +{ + if (!cred) + return EOPNOTSUPP; + + assert (__vm_page_size >= sizeof (struct shared_io)); + mutex_lock (&cred->po->np->lock); + if (!cred->mapped) + { + default_pager_object_create (default_pager, &cred->shared_object, + __vm_page_size); + vm_map (mach_task_self (), (u_int *)&cred->mapped, __vm_page_size, 0, 1, + cred->shared_object, 0, 0, VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, 0); + cred->mapped->conch_status = USER_HAS_NOT_CONCH; + spin_lock_init (&cred->mapped->lock); + *ctlobj = cred->shared_object; + mutex_unlock (&cred->po->np->lock); + return 0; + } + else + { + mutex_unlock (&cred->po->np->lock); + return EBUSY; + } +} diff --git a/libdiskfs/io-map.c b/libdiskfs/io-map.c new file mode 100644 index 00000000..2e8a6b6d --- /dev/null +++ b/libdiskfs/io-map.c @@ -0,0 +1,35 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_map as described in <hurd/io.defs>. */ +error_t +S_io_map (struct protid *cred, + memory_object_t *rdobj, + mach_msg_type_name_t *rdtype, + memory_object_t *wrobj, + mach_msg_type_name_t *wrtype) +{ + if (!cred) + return EOPNOTSUPP; + + *rdobj = diskfs_get_filemap (cred->po->np); + *rdtype = *wrtype = MACH_MSG_TYPE_MAKE_SEND; + *wrobj = *rdobj; + return 0; +} diff --git a/libdiskfs/io-modes-get.c b/libdiskfs/io-modes-get.c new file mode 100644 index 00000000..a9f20630 --- /dev/null +++ b/libdiskfs/io-modes-get.c @@ -0,0 +1,33 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_get_all_openmodes as described in <hurd/io.defs>. */ +error_t +S_io_get_all_openmodes (struct protid *cred, + int *bits) +{ + if (!cred) + return EOPNOTSUPP; + + mutex_lock (&cred->po->ip->lock); + *bits = cred->po->openstat; + mutex_unlock (&cred->po->ip->lock); + return err; +} +v diff --git a/libdiskfs/io-modes-off.c b/libdiskfs/io-modes-off.c new file mode 100644 index 00000000..074da839 --- /dev/null +++ b/libdiskfs/io-modes-off.c @@ -0,0 +1,34 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_clear_some_openmodes as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_clear_some_openmodes (struct protid *cred, + int offbits) +{ + if (!cred) + return EOPNOTSUPP; + + mutex_lock (&cred->po->ip->lock); + ioserver_get_conch (&np->conch); + if (!err) + cred->po->openstat &= ~(modes & HONORED_STATE_MODES); + mutex_unlock (&cred->po->ip->lock); + return err; +} diff --git a/libdiskfs/io-modes-on.c b/libdiskfs/io-modes-on.c new file mode 100644 index 00000000..a2004fa6 --- /dev/null +++ b/libdiskfs/io-modes-on.c @@ -0,0 +1,34 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_set_some_openmodes as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_set_some_openmodes (struct protid *cred, + int newbits) +{ + if (!cred) + return EOPNOTSUPP; + + mutex_lock (&cred->po->ip->lock); + ioserver_get_conch (&np->conch); + if (!err) + cred->po->openstat |= (modes & HONORED_STATE_MODES); + mutex_unlock (&cred->po->ip->lock); + return err; +} diff --git a/libdiskfs/io-modes-set.c b/libdiskfs/io-modes-set.c new file mode 100644 index 00000000..4159b0ac --- /dev/null +++ b/libdiskfs/io-modes-set.c @@ -0,0 +1,32 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +/* Implement io_set_all_openmodes as described in <hurd/io.defs>. */ +error_t +S_io_set_all_openmodes (struct protid *cred, + int newbits) +{ + if (!cred) + return EOPNOTSUPP; + + mutex_lock (&cred->po->ip->lock); + err = ioserver_get_conch (&np->conch); + if (!err) + cred->po->openstat = (modes & HONORED_STATE_MODES); + mutex_unlock (&cred->po->ip->lock); + return err; +} diff --git a/libdiskfs/io-owner-mod.c b/libdiskfs/io-owner-mod.c new file mode 100644 index 00000000..c700ad32 --- /dev/null +++ b/libdiskfs/io-owner-mod.c @@ -0,0 +1,35 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_mod_owner as described in <hurd/io.defs>. */ +error_t +S_io_mod_owner (struct protid *cred, + pid_t owner) +{ + struct node *np; + + if (!cred) + return EOPNOTSUPP; + np = cred->po->np; + + mutex_lock (&np->lock); + np->owner = owner; + mutex_unlock (&np->lock); + return 0; +} diff --git a/libdiskfs/io-reauthenticate.c b/libdiskfs/io-reauthenticate.c new file mode 100644 index 00000000..aa14c0f9 --- /dev/null +++ b/libdiskfs/io-reauthenticate.c @@ -0,0 +1,71 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_reathenticate as described in <hurd/io.defs>. */ +error_t +S_io_reauthenticate (struct protid *cred, + int rend_int) +{ + struct protid *newcred; + uid_t *gen_uids = alloca (sizeof (uid_t) * 20); + uid_t *gen_gids = alloca (sizeof (uid_t) * 20); + uid_t *aux_uids = alloca (sizeof (uid_t) * 20); + uid_t *aux_gids = alloca (sizeof (uid_t) * 20); + u_int genuidlen, gengidlen, auxuidlen, auxgidlen; + uid_t *gubuf, *ggbuf, *aubuf, *agbuf; + error_t err; + + if (cred == 0) + return EOPNOTSUPP; + + genuidlen = gengidlen = auxuidlen = auxgidlen = 20; + gubuf = gen_uids; ggbuf = gen_gids; + aubuf = aux_uids; agbuf = aux_gids; + + mutex_lock (&cred->po->np->lock); + newcred = start_making_protid (cred->po); + err = auth_server_authenticate (auth_server_port, + cred->fspt.pi.port, + MACH_MSG_TYPE_MAKE_SEND, + rend_int, + newcred->fspt.pi.port, + MACH_MSG_TYPE_MAKE_SEND, + &gen_uids, &genuidlen, + &aux_uids, &auxuidlen, + &gen_gids, &gengidlen, + &aux_gids, &auxgidlen); + assert (!err); /* XXX */ + + finish_protid (newcred, gen_uids, genuidlen, gen_gids, gengidlen); + + if (gubuf != gen_uids) + vm_deallocate (mach_task_self (), (u_int) gen_uids, + genuidlen * sizeof (uid_t)); + if (ggbuf != gen_gids) + vm_deallocate (mach_task_self (), (u_int) gen_gids, + gengidlen * sizeof (uid_t)); + if (aubuf != aux_uids) + vm_deallocate (mach_task_self (), (u_int) aux_uids, + auxuidlen * sizeof (uid_t)); + if (agbuf != aux_gids) + vm_deallocate (mach_task_self (), (u_int) aux_gids, + auxgidlen * sizeof (uid_t)); + + return 0; +} diff --git a/libdiskfs/io-rel-conch.c b/libdiskfs/io-rel-conch.c new file mode 100644 index 00000000..6c9ee879 --- /dev/null +++ b/libdiskfs/io-rel-conch.c @@ -0,0 +1,44 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_release_conch as described in <hurd/io.defs>. */ +error_t +S_io_release_conch (struct protid *cred) +{ + struct node *np; + int error = 0; + + if (!cred) + return EOPNOTSUPP; + + np = cred->po->np; + mutex_lock (&np->lock); + if (!cred->mapped) + { + mutex_unlock (&np->lock); + return EINVAL; + } + + np = cred->po->np; + + ioserver_handle_io_release_conch (&ip->i_conch, cred); + + mutex_unlock (&ip->i_toplock); + return 0; +} diff --git a/libdiskfs/io-restrict-auth.c b/libdiskfs/io-restrict-auth.c new file mode 100644 index 00000000..88797c42 --- /dev/null +++ b/libdiskfs/io-restrict-auth.c @@ -0,0 +1,63 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Tell if the array LIST (of size N) contains a member equal to QUERY. */ +static inline int +listmember (int *list, int query, int n) +{ + int i; + for (i = 0; i < n; i++) + if (list[i] == query) + return 1; + return 0; +} + +/* Implement io_restrict_auth as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_restrict_auth (struct protid *cred, + mach_port_t *newport, + mach_msg_type_name_t *newportpoly, + uid_t *uids, + u_int nuids, + gid_t *gids, + u_int ngids) +{ + uid_t *newuids, *newgids; + int i, newnuids, newngids; + + if (!cred) + return EOPNOTSUPP; + + newuids = alloca (sizeof (uid_t) * cred->nuids); + newgids = alloca (sizeof (uid_t) * cred->ngids); + + for (i = newnuids = 0; i < cred->nuids; i++) + if (listmember (uids, cred->uids[i], nuids)) + newuids[newnuids++] = cred->uids[i]; + for (i = newngids = 0; i < cred->ngids; i++) + if (listmember (gids, cred->gids[i], ngids)) + newgids[newngids++] = cred->gids[i]; + + mutex_lock (&cred->po->ip->i_toplock); + *newport = (make_protid (cred->po, newuids, newnuids, newgids, + newngids))->fspt.pi.port; + mutex_unlock (&cred->po->ip->i_toplock); + *newportpoly = MACH_MSG_TYPE_MAKE_SEND; + return 0; +} diff --git a/libdiskfs/io-select.c b/libdiskfs/io-select.c new file mode 100644 index 00000000..62c0a280 --- /dev/null +++ b/libdiskfs/io-select.c @@ -0,0 +1,35 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_select as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_select (struct protid *cred, + int type, + mach_port_t port, + int tag, + int *possible) +{ + if (!cred) + return EOPNOTSUPP; + + /* Select is always possible */ + mach_port_deallocate (mach_task_self (), port); + *possible = type; + return 0; +} diff --git a/libdiskfs/io-stat.c b/libdiskfs/io-stat.c new file mode 100644 index 00000000..4e504b3a --- /dev/null +++ b/libdiskfs/io-stat.c @@ -0,0 +1,40 @@ +/* + Copyright (C) 1994 Free Software Foundation + + 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, 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. */ + +#include "priv.h" + +/* Implement io_stat as described in <hurd/io.defs>. */ +error_t +diskfs_S_io_stat (struct protid *cred, + io_statbuf_t *statbuf) +{ + struct node *np; + error_t error; + + if (!cred) + return EOPNOTSUPP; + + np = cred->po->np; + mutex_lock (&ip->lock); + error = ioserver_get_conch (&ip->i_conch); + if (!error) + bcopy (np->dn_stat, statbuf, sizeof (struct stat)); + + out: + mutex_unlock (&ip->i_toplock); + return error; +} |