summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fdformat.c54
-rw-r--r--util-linux/fdisk.c4
-rw-r--r--util-linux/mdev.c2
3 files changed, 29 insertions, 31 deletions
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index efbdcc8..1441b92 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -47,7 +47,7 @@ struct format_descr {
static void xioctl(int fd, int request, void *argp, const char *string)
{
- if (ioctl (fd, request, argp) < 0) {
+ if (ioctl(fd, request, argp) < 0) {
bb_perror_msg_and_die(string);
}
}
@@ -67,17 +67,16 @@ int fdformat_main(int argc,char **argv)
argv += optind;
/* R_OK is needed for verifying */
- if (stat(*argv,&st) < 0 || access(*argv,W_OK | R_OK ) < 0) {
- bb_perror_msg_and_die("%s",*argv);
+ if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) {
+ bb_perror_msg_and_die("%s", *argv);
}
if (!S_ISBLK(st.st_mode)) {
- bb_error_msg_and_die("%s: not a block device",*argv);
+ bb_error_msg_and_die("%s: not a block device", *argv);
/* do not test major - perhaps this was an USB floppy */
}
-
/* O_RDWR for formatting and verifying */
- fd = xopen(*argv,O_RDWR );
+ fd = xopen(*argv, O_RDWR);
xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */
@@ -86,44 +85,45 @@ int fdformat_main(int argc,char **argv)
param.track, param.sect, param.size >> 1);
/* FORMAT */
- printf("Formatting ... ");
- xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG");
+ printf("Formatting... ");
+ xioctl(fd, FDFMTBEG, NULL, "FDFMTBEG");
/* n == track */
- for (n = 0; n < param.track; n++)
- {
- descr.head = 0;
- descr.track = n;
- xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
- printf("%3d\b\b\b", n);
- if (param.head == 2) {
- descr.head = 1;
- xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
- }
+ for (n = 0; n < param.track; n++) {
+ descr.head = 0;
+ descr.track = n;
+ xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK");
+ printf("%3d\b\b\b", n);
+ if (param.head == 2) {
+ descr.head = 1;
+ xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK");
+ }
}
- xioctl(fd,FDFMTEND,NULL,"FDFMTEND");
+ xioctl(fd, FDFMTEND, NULL, "FDFMTEND");
printf("done\n");
/* VERIFY */
- if(verify) {
+ if (verify) {
/* n == cyl_size */
n = param.sect*param.head*512;
data = xmalloc(n);
- printf("Verifying ... ");
+ printf("Verifying... ");
for (cyl = 0; cyl < param.track; cyl++) {
printf("%3d\b\b\b", cyl);
- if((read_bytes = safe_read(fd,data,n))!= n ) {
- if(read_bytes < 0) {
+ read_bytes = safe_read(fd, data, n);
+ if (read_bytes != n) {
+ if (read_bytes < 0) {
bb_perror_msg(bb_msg_read_error);
}
- bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes);
+ bb_error_msg_and_die("problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes);
+ // FIXME: maybe better seek & continue??
}
/* Check backwards so we don't need a counter */
- while(--read_bytes>=0) {
- if( data[read_bytes] != FD_FILL_BYTE) {
- printf("bad data in cyl %d\nContinuing ... ",cyl);
+ while (--read_bytes >= 0) {
+ if (data[read_bytes] != FD_FILL_BYTE) {
+ printf("bad data in cyl %d\nContinuing... ",cyl);
}
}
}
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 55f7166..85acaa4 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -4506,8 +4506,7 @@ change_sysid(void)
label_sun != current_label_type && !get_nr_sects(p))
{
printf(_("Partition %d does not exist yet!\n"), i + 1);
- }else{
- while (1) {
+ } else while (1) {
sys = read_hex (get_sys_types());
if (!sys && label_sgi != current_label_type &&
@@ -4573,7 +4572,6 @@ change_sysid(void)
dos_changed = 1;
break;
}
- }
}
}
#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index b292e14..f433936 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -250,7 +250,7 @@ int mdev_main(int argc, char *argv[])
} else {
action = getenv("ACTION");
env_path = getenv("DEVPATH");
- if (!action || !env_path)
+ if (!action || !env_path)
bb_show_usage();
sprintf(temp, "/sys%s", env_path);