Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
btrfsprogs
0102-Add-the-force-option.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0102-Add-the-force-option.patch of Package btrfsprogs
From 8456dc84b0c7548ca4f83c4e58e8e9dd443b7686 Mon Sep 17 00:00:00 2001 From: Goffredo Baroncelli <kreijack@inwind.it> Date: Mon, 3 Jan 2011 19:51:46 +0100 Subject: [PATCH 03/35] Add the --force option. Add the --force option to not check if a device is already mounted. --- mkfs.c | 46 ++++++++++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 18 deletions(-) diff --git a/mkfs.c b/mkfs.c index e3ced19..be236d0 100644 --- a/mkfs.c +++ b/mkfs.c @@ -303,6 +303,7 @@ static void print_usage(void) fprintf(stderr, "\t -A --alloc-start the offset to start the FS\n"); fprintf(stderr, "\t -b --byte-count total number of bytes in the FS\n"); fprintf(stderr, "\t -d --data data profile, raid0, raid1, raid10 or single\n"); + fprintf(stderr, "\t -f --force don't check if a device is already mounted\n"); fprintf(stderr, "\t -l --leafsize size of btree leaves\n"); fprintf(stderr, "\t -L --label set a label\n"); fprintf(stderr, "\t -m --metadata metadata profile, values like data profile\n"); @@ -368,6 +369,7 @@ static struct option long_options[] = { { "data", 1, NULL, 'd' }, { "version", 0, NULL, 'V' }, { "rootdir", 1, NULL, 'r' }, + { "force", 0, NULL, 'f' }, { 0, 0, 0, 0} }; @@ -1191,10 +1193,11 @@ int main(int ac, char **av) u64 size_of_data = 0; u64 source_dir_size = 0; char *pretty_buf; + int force=0; while(1) { int c; - c = getopt_long(ac, av, "A:b:l:n:s:m:d:L:r:VM", long_options, + c = getopt_long(ac, av, "A:b:l:n:s:m:d:L:r:VMf", long_options, &option_index); if (c < 0) break; @@ -1240,6 +1243,8 @@ int main(int ac, char **av) case 'r': source_dir = optarg; source_dir_set = 1; + case 'f': + force=1; break; default: print_usage(); @@ -1263,14 +1268,17 @@ int main(int ac, char **av) if (source_dir == 0) { file = av[optind++]; - ret = check_mounted(file); - if (ret < 0) { - fprintf(stderr, "error checking %s mount status\n", file); - exit(1); - } - if (ret == 1) { - fprintf(stderr, "%s is mounted\n", file); - exit(1); + if(!force){ + ret = check_mounted(file); + if (ret < 0) { + fprintf(stderr, + "error checking %s mount status\n", file); + exit(1); + } + if (ret == 1) { + fprintf(stderr, "%s is mounted\n", file); + exit(1); + } } ac--; fd = open(file, O_RDWR); @@ -1353,15 +1361,17 @@ int main(int ac, char **av) int old_mixed = mixed; file = av[optind++]; - ret = check_mounted(file); - if (ret < 0) { - fprintf(stderr, "error checking %s mount status\n", - file); - exit(1); - } - if (ret == 1) { - fprintf(stderr, "%s is mounted\n", file); - exit(1); + if(!force){ + ret = check_mounted(file); + if (ret < 0) { + fprintf(stderr, "error checking %s" + " mount status\n",file); + exit(1); + } + if (ret == 1) { + fprintf(stderr, "%s is mounted\n", file); + exit(1); + } } fd = open(file, O_RDWR); if (fd < 0) { -- 1.7.6.233.gd79bc
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor