Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon: Move gdisk function to a new file
After subsequent commits, this will be the only remaining use of gdisk, so put it in its own file now.
- Loading branch information
Showing
3 changed files
with
49 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,7 @@ guestfsd_SOURCES = \ | |
fs-min-size.c \ | ||
fsck.c \ | ||
fstrim.c \ | ||
gdisk.c \ | ||
glob.c \ | ||
grep.c \ | ||
grub.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* libguestfs - the guestfsd daemon | ||
* Copyright (C) 2009-2024 Red Hat Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#include <config.h> | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "daemon.h" | ||
#include "actions.h" | ||
#include "optgroups.h" | ||
|
||
int | ||
optgroup_gdisk_available (void) | ||
{ | ||
return prog_exists ("sgdisk"); | ||
} | ||
|
||
int | ||
do_part_expand_gpt(const char *device) | ||
{ | ||
CLEANUP_FREE char *err = NULL; | ||
|
||
int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, | ||
"sgdisk", "-e", device, NULL); | ||
|
||
if (r == -1) { | ||
reply_with_error ("%s -e %s: %s", "sgdisk", device, err); | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters