From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 08/19] sfdisk: remove --unhide and related functions
Date: Sun, 2 Jun 2013 18:51:14 +0100 [thread overview]
Message-ID: <1370195485-27907-9-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1370195485-27907-1-git-send-email-kerolasa@iki.fi>
The --unhide was never implemented, and did not do anything.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
fdisks/sfdisk.c | 70 +--------------------------------------------------------
1 file changed, 1 insertion(+), 69 deletions(-)
diff --git a/fdisks/sfdisk.c b/fdisks/sfdisk.c
index 912b95d..2d430de 100644
--- a/fdisks/sfdisk.c
+++ b/fdisks/sfdisk.c
@@ -2405,7 +2405,6 @@ static void usage(FILE * out)
fputs(_(" -g, --show-geometry print the kernel's idea of the geometry\n"
" -G, --show-pt-geometry print geometry guessed from the partition table\n"), out);
fputs(_(" -A, --activate[=<device>] activate bootable flag\n"
- " -U, --unhide[=<dev>] set partition unhidden\n"
" -x, --show-extended also list extended partitions in the output,\n"
" or expect descriptors for them in the input\n"), out);
fputs(_(" --leave-last do not allocate the last cylinder\n"
@@ -2444,7 +2443,7 @@ activate_usage(void) {
exit(EXIT_FAILURE);
}
-static const char short_opts[] = "cdfghilnqsu:vx1A::C:DGH:I:LN:O:RS:TU::V";
+static const char short_opts[] = "cdfghilnqsu:vx1A::C:DGH:I:LN:O:RS:TV";
#define PRINT_ID 0400
#define CHANGE_ID 01000
@@ -2487,7 +2486,6 @@ static const struct option long_opts[] = {
{ "Linux", no_argument, NULL, 'L' },
{ "re-read", no_argument, NULL, 'R' },
{ "list-types", no_argument, NULL, 'T' },
- { "unhide", optional_argument, NULL, 'U' },
{ "no-reread", no_argument, NULL, OPT_NO_REREAD },
{ "IBM", no_argument, NULL, OPT_LEAVE_LAST },
{ "leave-last", no_argument, NULL, OPT_LEAVE_LAST },
@@ -2542,7 +2540,6 @@ static void do_pt_geom(char *dev, int silent);
static void do_fdisk(char *dev);
static void do_reread(char *dev);
static void do_change_id(char *dev, char *part, char *id);
-static void do_unhide(char **av, int ac, char *arg);
static void do_activate(char **av, int ac, char *arg);
unsigned long long total_size;
@@ -2557,9 +2554,7 @@ main(int argc, char **argv) {
int opt_reread = 0;
int activate = 0;
int do_id = 0;
- int unhide = 0;
char *activatearg = 0;
- char *unhidearg = 0;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -2570,10 +2565,6 @@ main(int argc, char **argv) {
errx(EXIT_FAILURE, _("no command?"));
if (!strcmp(program_invocation_short_name, "activate"))
activate = 1; /* equivalent to `sfdisk -A' */
-#if 0 /* not important enough to deserve a name */
- else if (!strcmp(program_invocation_short_name, "unhide"))
- unhide = 1; /* equivalent to `sfdisk -U' */
-#endif
while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL)) != -1) {
switch (c) {
@@ -2657,10 +2648,6 @@ main(int argc, char **argv) {
case 'T':
list_types();
return EXIT_SUCCESS;
- case 'U':
- unhidearg = optarg;
- unhide = 1;
- break;
case 'V':
verify = 1;
break;
@@ -2760,10 +2747,6 @@ main(int argc, char **argv) {
do_activate(argv + optind, argc - optind, activatearg);
return exit_status;
}
- if (unhide) {
- do_unhide(argv + optind, argc - optind, unhidearg);
- return exit_status;
- }
if (do_id) {
if ((do_id & PRINT_ID) != 0 && optind != argc - 2)
errx(EXIT_FAILURE, _("usage: sfdisk --print-id device partition-number"));
@@ -3020,57 +3003,6 @@ do_activate(char **av, int ac, char *arg) {
}
static void
-set_unhidden(struct disk_desc *z, char *pnam) {
- int pno;
- unsigned char id;
-
- pno = asc_to_index(pnam, z);
- id = z->partitions[pno].p.sys_type;
- if (id == 0x11 || id == 0x14 || id == 0x16 || id == 0x17)
- id -= 0x10;
- else
- errx(EXIT_FAILURE, _("partition %s has id %x and is not hidden"), pnam, id);
- z->partitions[pno].p.sys_type = id;
-}
-
-/*
- * maybe remove and make part of --change-id
- */
-static void
-do_unhide(char **av, int ac, char *arg) {
- char *dev = av[0];
- int fd, rw, i;
- struct disk_desc *z;
-
- z = &oldp;
-
- rw = !no_write;
- fd = my_open(dev, rw, 0);
-
- free_sectors();
- get_cylindersize(dev, fd, 1);
- get_partitions(dev, fd, z);
-
- /* unhide where desired */
- if (ac == 1)
- set_unhidden(z, arg);
- else
- for (i = 1; i < ac; i++)
- set_unhidden(z, av[i]);
-
- /* then write to disk */
- if (write_partitions(dev, fd, z))
- my_warn(_("Done\n\n"));
- else
- exit_status = 1;
-
- if (close_fd(fd) != 0) {
- my_warn(_("write failed"));
- exit_status = 1;
- }
-}
-
-static void
do_change_id(char *dev, char *pnam, char *id) {
int fd, rw, pno;
struct disk_desc *z;
--
1.8.3
next prev parent reply other threads:[~2013-06-02 17:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-02 17:51 [PATCH 00/19] pull: various clean ups and couple bug fixes Sami Kerola
2013-06-02 17:51 ` [PATCH 01/19] lib: remove unused code Sami Kerola
2013-06-02 17:51 ` [PATCH 02/19] lscpu: add max MHz value to make cpu governor effects more visible Sami Kerola
2013-06-02 17:51 ` [PATCH 03/19] docs: add lscpu max mhz to manual and bash completion Sami Kerola
2013-06-02 17:51 ` [PATCH 04/19] sfdisk: use libc error printing function, and symbolic exit values Sami Kerola
2013-06-07 10:20 ` Karel Zak
2013-06-02 17:51 ` [PATCH 05/19] sfdisk: clean up usage() functions Sami Kerola
2013-06-02 17:51 ` [PATCH 06/19] sfdisk: use program_invocation_short_name to determine program name Sami Kerola
2013-06-02 17:51 ` [PATCH 07/19] docs: correct sfdisk --activate instructions Sami Kerola
2013-06-02 17:51 ` Sami Kerola [this message]
2013-06-02 17:51 ` [PATCH 09/19] sfdisk: replace my_warn() with warnx() Sami Kerola
2013-06-02 17:51 ` [PATCH 10/19] rev: stop adding new line at the end when input does not have it Sami Kerola
2013-06-02 17:51 ` [PATCH 11/19] rev: simplify new line detection and impossible test Sami Kerola
2013-06-02 17:51 ` [PATCH 12/19] rev: reduce stream checking when closing read-only file descriptor Sami Kerola
2013-06-02 17:51 ` [PATCH 13/19] dmesg: make time format parsing to use enum bit field Sami Kerola
2013-06-03 8:45 ` Karel Zak
2013-06-02 17:51 ` [PATCH 14/19] dmesg: add --time-format option Sami Kerola
2013-06-02 17:51 ` [PATCH 15/19] dmesg: add iso-8601 time format Sami Kerola
2013-06-02 17:51 ` [PATCH 16/19] docs: add --time-format option and ISO-8601 format to manual Sami Kerola
2013-06-02 17:51 ` [PATCH 17/19] dmesg: make usage() a little bit shorter Sami Kerola
2013-06-03 8:56 ` Karel Zak
2013-06-02 17:51 ` [PATCH 18/19] dmesg: more deterministic boot time detection Sami Kerola
2013-06-03 9:35 ` Karel Zak
2013-06-02 17:51 ` [PATCH 19/19] cal: fix few type mismatches Sami Kerola
2013-06-07 10:28 ` [PATCH 00/19] pull: various clean ups and couple bug fixes Karel Zak
2013-06-07 15:45 ` Sami Kerola
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370195485-27907-9-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox