Changeset 3232 in MondoRescue for branches/3.2/mindi-busybox/util-linux/losetup.c
- Timestamp:
- Jan 1, 2014, 12:47:38 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mindi-busybox/util-linux/losetup.c
r2725 r3232 7 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 10 //usage:#define losetup_trivial_usage 11 //usage: "[-r] [-o OFS] LOOPDEV FILE - associate loop devices\n" 12 //usage: " losetup -d LOOPDEV - disassociate\n" 13 //usage: " losetup [-f] - show" 14 //usage:#define losetup_full_usage "\n\n" 15 //usage: " -o OFS Start OFS bytes into FILE" 16 //usage: "\n -r Read-only" 17 //usage: "\n -f Show first free loop device" 18 //usage: 19 //usage:#define losetup_notes_usage 20 //usage: "No arguments will display all current associations.\n" 21 //usage: "One argument (losetup /dev/loop1) will display the current association\n" 22 //usage: "(if any), or disassociate it (with -d). The display shows the offset\n" 23 //usage: "and filename of the file the loop device is currently bound to.\n\n" 24 //usage: "Two arguments (losetup /dev/loop1 file.img) create a new association,\n" 25 //usage: "with an optional offset (-o 12345). Encryption is not yet supported.\n" 26 //usage: "losetup -f will show the first loop free loop device\n\n" 9 27 10 28 #include "libbb.h" … … 21 39 OPT_o = (1 << 1), 22 40 OPT_f = (1 << 2), 41 OPT_r = (1 << 3), /* must be last */ 23 42 }; 24 43 25 /* max 2 args, allopts are mutually exclusive */44 /* max 2 args, -d,-o,-f opts are mutually exclusive */ 26 45 opt_complementary = "?2:d--of:o--df:f--do"; 27 opt = getopt32(argv, "do:f ", &opt_o);46 opt = getopt32(argv, "do:fr", &opt_o); 28 47 argv += optind; 29 48 … … 47 66 48 67 if (argv[1]) { 49 /* [- o OFS] BLOCKDEV FILE */50 if (set_loop(&argv[0], argv[1], offset ) < 0)68 /* [-r] [-o OFS] BLOCKDEV FILE */ 69 if (set_loop(&argv[0], argv[1], offset, (opt / OPT_r)) < 0) 51 70 bb_simple_perror_msg_and_die(argv[0]); 52 71 return EXIT_SUCCESS; 53 72 } 54 /* [- o OFS] BLOCKDEV */73 /* [-r] [-o OFS] BLOCKDEV */ 55 74 s = query_loop(argv[0]); 56 75 if (!s) … … 62 81 } 63 82 64 /* [- o OFS|-f] with no params */83 /* [-r] [-o OFS|-f] with no params */ 65 84 n = 0; 66 85 while (1) {
Note:
See TracChangeset
for help on using the changeset viewer.