diff options
author | Miles Bader <miles@gnu.org> | 1995-10-01 20:37:24 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1995-10-01 20:37:24 +0000 |
commit | 044db96f4ece0e56746bb74b15a064f0d512c5cd (patch) | |
tree | e57219c226f81cfa7b060ec56257075c1adf0434 /devio | |
parent | c208e71dc949e6e750450edade5f45fafb00dc4e (diff) |
(trivfs_S_file_get_storage_info): New function.
Diffstat (limited to 'devio')
-rw-r--r-- | devio/io.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -330,3 +330,45 @@ trivfs_S_file_syncfs (struct trivfs_protid *cred, int wait, int dochildren) return dev_sync(((struct open *)cred->po->hook)->dev, wait); } } + +/* ---------------------------------------------------------------- */ + +typedef int run_elem_t; + +error_t +trivfs_S_file_get_storage_info (struct trivfs_protid *cred, int *class, + run_elem_t **runs, unsigned *runs_len, + char *dev_name, mach_port_t *dev_port, + mach_msg_type_name_t *dev_port_type, + char **misc, unsigned *misc_len) +{ + error_t err; + if (!cred) + err = EOPNOTSUPP; + else + { + struct dev *dev = ((struct open *)cred->po->hook)->dev; + + err = vm_allocate (mach_task_self (), + (vm_address_t *)runs, 2 * sizeof (run_elem_t), 1); + if (!err) + { + *class = STORAGE_DEVICE; + + (*runs)[0] = 0; + (*runs)[1] = dev->size / dev->dev_block_size; + *runs_len = 2; + + strcpy (dev_name, dev->name); + + if (cred->isroot) + *dev_port = dev->port; + else + *dev_port = MACH_PORT_NULL; + *dev_port_type = MACH_MSG_TYPE_COPY_SEND; + + *misc_len = 0; + } + } + return err; +} |