scsi_id.c | scsi_id.c | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <stdbool.h> | #include <stdbool.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <signal.h> | #include <signal.h> | |||
#include <fcntl.h> | #include <fcntl.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <string.h> | #include <string.h> | |||
#include <syslog.h> | ||||
#include <ctype.h> | #include <ctype.h> | |||
#include <getopt.h> | #include <getopt.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include "libudev.h" | #include "libudev.h" | |||
#include "libudev-private.h" | #include "libudev-private.h" | |||
#include "scsi_id.h" | #include "scsi_id.h" | |||
#include "udev-util.h" | #include "udev-util.h" | |||
static const struct option options[] = { | static const struct option options[] = { | |||
skipping to change at line 58 | skipping to change at line 57 | |||
{ "export", no_argument, NULL, 'x' }, | { "export", no_argument, NULL, 'x' }, | |||
{ "help", no_argument, NULL, 'h' }, | { "help", no_argument, NULL, 'h' }, | |||
{} | {} | |||
}; | }; | |||
static bool all_good = false; | static bool all_good = false; | |||
static bool dev_specified = false; | static bool dev_specified = false; | |||
static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config"; | static char config_file[MAX_PATH_LEN] = "/etc/scsi_id.config"; | |||
static enum page_code default_page_code = PAGE_UNSPECIFIED; | static enum page_code default_page_code = PAGE_UNSPECIFIED; | |||
static int sg_version = 4; | static int sg_version = 4; | |||
static int debug = 0; | ||||
static bool reformat_serial = false; | static bool reformat_serial = false; | |||
static bool export = false; | static bool export = false; | |||
static char vendor_str[64]; | static char vendor_str[64]; | |||
static char model_str[64]; | static char model_str[64]; | |||
static char vendor_enc_str[256]; | static char vendor_enc_str[256]; | |||
static char model_enc_str[256]; | static char model_enc_str[256]; | |||
static char revision_str[16]; | static char revision_str[16]; | |||
static char type_str[16]; | static char type_str[16]; | |||
_printf_(6,0) | _printf_(6,0) | |||
static void log_fn(struct udev *udev, int priority, | static void log_fn(struct udev *udev, int priority, | |||
const char *file, int line, const char *fn, | const char *file, int line, const char *fn, | |||
const char *format, va_list args) | const char *format, va_list args) | |||
{ | { | |||
vsyslog(priority, format, args); | log_metav(priority, file, line, fn, format, args); | |||
} | } | |||
static void set_type(const char *from, char *to, size_t len) | static void set_type(const char *from, char *to, size_t len) | |||
{ | { | |||
int type_num; | int type_num; | |||
char *eptr; | char *eptr; | |||
const char *type = "generic"; | const char *type = "generic"; | |||
type_num = strtoul(from, &eptr, 0); | type_num = strtoul(from, &eptr, 0); | |||
if (eptr != from) { | if (eptr != from) { | |||
skipping to change at line 393 | skipping to change at line 391 | |||
log_error("Unknown SG version '%s'", optarg ); | log_error("Unknown SG version '%s'", optarg ); | |||
return -1; | return -1; | |||
} | } | |||
break; | break; | |||
case 'u': | case 'u': | |||
reformat_serial = true; | reformat_serial = true; | |||
break; | break; | |||
case 'v': | case 'v': | |||
debug++; | log_set_target(LOG_TARGET_CONSOLE); | |||
log_set_max_level(LOG_DEBUG); | ||||
udev_set_log_priority(udev, LOG_DEBUG); | ||||
log_open(); | ||||
break; | break; | |||
case 'V': | case 'V': | |||
printf("%s\n", VERSION); | printf("%s\n", VERSION); | |||
exit(0); | exit(0); | |||
case 'x': | case 'x': | |||
export = true; | export = true; | |||
break; | break; | |||
skipping to change at line 586 | skipping to change at line 587 | |||
} | } | |||
int main(int argc, char **argv) | int main(int argc, char **argv) | |||
{ | { | |||
_cleanup_udev_unref_ struct udev *udev; | _cleanup_udev_unref_ struct udev *udev; | |||
int retval = 0; | int retval = 0; | |||
char maj_min_dev[MAX_PATH_LEN]; | char maj_min_dev[MAX_PATH_LEN]; | |||
int newargc; | int newargc; | |||
char **newargv = NULL; | char **newargv = NULL; | |||
log_parse_environment(); | ||||
log_open(); | ||||
udev = udev_new(); | udev = udev_new(); | |||
if (udev == NULL) | if (udev == NULL) | |||
goto exit; | goto exit; | |||
log_open(); | ||||
udev_set_log_fn(udev, log_fn); | udev_set_log_fn(udev, log_fn); | |||
/* | /* | |||
* Get config file options. | * Get config file options. | |||
*/ | */ | |||
retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); | retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); | |||
if (retval < 0) { | if (retval < 0) { | |||
retval = 1; | retval = 1; | |||
goto exit; | goto exit; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |