scsi_id.c revision b43d1d01eabe2cbbf393e8f56b76e182c6069c4c
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Copyright (C) IBM Corp. 2003
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Copyright (C) SUSE Linux Products GmbH, 2006
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * This program is free software: you can redistribute it and/or modify
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * it under the terms of the GNU General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * the Free Software Foundation, either version 2 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * This program is distributed in the hope that it will be useful,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * but WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * GNU General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * You should have received a copy of the GNU General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * along with this program. If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "device", required_argument, NULL, 'd' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "config", required_argument, NULL, 'f' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "page", required_argument, NULL, 'p' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "blacklisted", no_argument, NULL, 'b' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "whitelisted", no_argument, NULL, 'g' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "replace-whitespace", no_argument, NULL, 'u' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering { "sg-version", required_argument, NULL, 's' },
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic const char short_options[] = "d:f:ghip:uvVx";
322345fdb9865ef2477fba8e4bdde0e1183ef505Lennart Poetteringstatic const char dev_short_options[] = "bgp:";
a407657425a3e47fd2b559cd3bc800f791303f63Lennart Poetteringstatic char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config";
f9ebb22ab4758bc5bbaaf8eeead74b5b4f81d5c3Lennart Poetteringstatic void log_fn(struct udev *udev, int priority,
f9ebb22ab4758bc5bbaaf8eeead74b5b4f81d5c3Lennart Poettering const char *file, int line, const char *fn,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void set_type(const char *from, char *to, size_t len)
char *val;
const char *end;
(*buffer)++;
(*buffer)++;
(*buffer)++;
return val;
char *buffer;
char *buf;
char *str1;
int lineno;
int retval = 0;
if (!buffer) {
return log_oom();
lineno = 0;
lineno++;
buf++;
if (!str1) {
if (!str1) {
if (!str1) {
if (retval == 0) {
if (!*newargv) {
*argc = c;
if (retval != 0)
return retval;
char *maj_min_dev)
int option;
switch (option) {
all_good = 0;
exit(0);
debug++;
exit(0);
int retval;
int newargc;
int option;
while (retval == 0) {
switch (option) {
*good_bad = 0;
if (newargv) {
return retval;
int retval;
if (retval)
return retval;
int good_dev;
int page_code;
int retval = 0;
goto out;
if (!good_dev) {
goto out;
if (export) {
goto out;
goto out;
if (reformat_serial) {
goto out;
out:
return retval;
int retval = 0;
int newargc;
char **newargv;
goto exit;
log_open();
if (retval < 0) {
goto exit;
goto exit;
if (!dev_specified) {
goto exit;
exit:
log_close();
return retval;