/***************************************************************************
*
* probe-storage.c : Probe for storage devices
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*
**************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/efi_partition.h>
#include <priv.h>
#include <libhal.h>
#include <cdutils.h>
#include <fsutils.h>
#include <logger.h>
/** Check if a filesystem on a special device file is mounted
*
* @return TRUE iff there is a filesystem system mounted
* on the special device file
*/
static dbus_bool_t
{
FILE *f;
return rc;
}
fclose (f);
return rc;
}
static int
{
switch (profile) {
case 0x09:
break;
case 0x0a:
break;
case 0x10:
break;
case 0x11:
break;
case 0x12:
break;
case 0x13:
break;
case 0x14:
break;
case 0x1a:
break;
case 0x1b:
break;
case 0x2b:
break;
case 0x40:
break;
case 0x41:
case 0x42:
break;
case 0x43:
break;
case 0x50:
break;
case 0x51:
break;
case 0x52:
break;
}
return CDUTIL_WALK_CONTINUE;
}
static void
{
int capabilities;
int n_wspeeds;
char **wspeeds;
char *wspeeds_mem;
int i;
/* XXX */
if (n_wspeeds <= 0) {
wspeeds_mem = NULL;
libhal_changeset_set_property_strlist (cs, "storage.cdrom.write_speeds", (const char **)&wspeeds_mem);
return;
}
return;
}
return;
}
for (i = 0; i < n_wspeeds; i++) {
}
}
free (wspeeds_mem);
}
/*
* Return a copy of a string without trailing spaces. If 'len' is non-zero,
* it specifies max length, otherwise the string must be null-terminated.
*/
char *
{
char *dst, *p;
if (len == 0) {
}
*p-- = '\0';
}
}
return (dst);
}
static void
{
int status;
char *s;
/* INQUIRY */
return;
}
free(s);
}
free(s);
}
free(s);
}
free(s);
}
}
/*
* returns TRUE if diskette is inserted.
* also returns write protection status.
*/
static dbus_bool_t
{
int chg;
return (TRUE);
} else {
return (FALSE);
}
}
void
{
/*
* Start with the 'basic' privilege set and then remove any
* of the 'basic' privileges that will not be needed.
*/
return;
}
/* Clear privileges we will not need from the 'basic' set */
/* for uscsi */
/* to open logindevperm'd devices */
/* Set the permitted privilege set. */
return;
}
/* Clear the limit set. */
return;
}
return;
}
}
int
{
char *udi;
char *device_file;
char *raw_device_file;
char *drive_type;
int rdonly;
int dos_cnt = 0;
goto out;
goto out;
goto out;
goto out;
drop_privileges ();
setup_logger ();
else
dbus_error_init (&error);
goto out;
HAL_DEBUG (("Cannot allocate changeset"));
goto out;
}
HAL_DEBUG (("Doing probe-storage for %s (drive_type %s) (udi=%s) (--only-check-for-media==%d)",
goto out;
}
if (!only_check_for_media) {
}
}
ret = 0;
if (is_cdrom) {
if (!got_media) {
goto out_cs;
}
/* XXX */
} else if (is_floppy) {
}
/* don't look for partitions on floppy */
goto out_cs;
} else {
if (!got_media) {
goto out_cs;
}
}
}
goto out_cs;
}
if (is_mbr) {
scheme = "mbr";
}
if (!vtoc_one_slice_entire_disk(&vtoc)) {
if (!is_mbr) {
/* smi within mbr partition is okay */
scheme = "smi";
}
vtoc_slices = TRUE;
}
/*
* Note: for some reason efi_read takes very long on cdroms.
* Needs more investigation, skip gpt on cdrom for now.
*/
scheme = "gpt";
}
/* XXX should only set for removable drives */
out:
}
if (fd >= 0) {
}
if (rfd >= 0) {
}
if (dbus_error_is_set(&error)) {
dbus_error_free (&error);
}
}
return ret;
}