path_id.c revision 185ea6a76d3f3a9e9708239d2302bd98e00460fa
/*
* compose persisistent device path
*
* Copyright (C) 2009 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <getopt.h>
#include <libudev.h>
int debug;
{
if (debug) {
} else {
}
}
{
char *old;
char *pre;
int err;
if (err < 0)
return err;
if (err < 0)
return err;
} else {
}
return 0;
}
{
const char *subsystem;
break;
}
return dev;
}
/* find smallest number of instances of <syspath>/<name><number> */
{
char *base;
char *pos;
int number = -1;
goto out;
goto out;
pos[0] = '\0';
goto out;
char *rest;
int i;
continue;
continue;
continue;
if (rest[0] != '\0')
continue;
number = i;
}
out:
return number;
}
{
const char *devtype;
struct udev_device *hostdev;
const char *name;
int base;
return dev;
return dev;
return dev;
/* rebase host offset to get the local relative number */
if (base < 0)
return dev;
return dev;
}
{
const char *name;
}
{
const char *devtype;
const char *str;
const char *port;
return dev;
return dev;
port++;
return dev;
}
static struct udev_device *handle_firewire(struct udev_device *parent, struct udev_device *dev, char **path)
{
struct udev_device *scsi_dev;
const char *id;
}
return parent;
}
static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path)
{
struct udev_device *scsi_dev;
const char *wwpn;
const char *lun;
const char *hba_id;
goto out;
}
}
out:
return parent;
}
{
{}
};
struct udev_device *dev;
struct udev_device *parent;
char syspath[UTIL_PATH_SIZE];
const char *devpath;
char *path;
char *path_suffix;
int rc = 1;
goto exit;
logging_init("usb_id");
while (1) {
int option;
if (option == -1)
break;
switch (option) {
case 'd':
debug = 1;
break;
case 'h':
printf("Usage: path_id [--debug] [--help] <devpath>\n"
" --debug print debug information\n"
" --help print this help text\n\n");
default:
rc = 1;
goto exit;
}
}
rc = 2;
goto exit;
}
rc = 3;
goto exit;
}
path_suffix = NULL;
const char *subsys;
;
; //handle_fc();
; //handle_sas();
; //handle_iscsi()
; //handle_cciss();
}
}
if (path_suffix != NULL) {
} else {
}
rc = 0;
}
exit:
return rc;
}