From: Karel Zak Date: Thu, 6 Dec 2012 14:17:53 +0000 (+0100) Subject: libfdisk: add context functions X-Git-Tag: v2.23-rc1~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f4be9e2b99f96cb2250535bd5b1e322d6c0ea234;p=thirdparty%2Futil-linux.git libfdisk: add context functions Signed-off-by: Karel Zak --- diff --git a/fdisks/Makemodule.am b/fdisks/Makemodule.am index 6944535429..442d4bf0c6 100644 --- a/fdisks/Makemodule.am +++ b/fdisks/Makemodule.am @@ -22,7 +22,6 @@ fdisk_SOURCES = \ fdisks/gpt.c \ fdisks/gpt.h \ fdisks/partname.c \ - fdisks/utils.c \ fdisks/common.h fdisk_LDADD = $(LDADD) libcommon.la libfdisk.la diff --git a/fdisks/fdisk.h b/fdisks/fdisk.h index c8d5aab914..ec20837df2 100644 --- a/fdisks/fdisk.h +++ b/fdisks/fdisk.h @@ -63,8 +63,6 @@ enum failure { /* * labels */ -extern struct fdisk_context *fdisk_new_context_from_filename(const char *fname, int readonly); -extern void fdisk_free_context(struct fdisk_context *cxt); extern struct fdisk_parttype *fdisk_get_partition_type(struct fdisk_context *cxt, int partnum); extern int fdisk_set_partition_type(struct fdisk_context *cxt, int partnum, struct fdisk_parttype *t); diff --git a/libfdisk/src/Makemodule.am b/libfdisk/src/Makemodule.am index 639a3d2f00..4f9048e90a 100644 --- a/libfdisk/src/Makemodule.am +++ b/libfdisk/src/Makemodule.am @@ -12,6 +12,7 @@ libfdisk_la_SOURCES = \ libfdisk/src/alignment.c \ libfdisk/src/label.c \ libfdisk/src/utils.c \ + libfdisk/src/context.c \ libfdisk/src/parttype.c diff --git a/fdisks/utils.c b/libfdisk/src/context.c similarity index 60% rename from fdisks/utils.c rename to libfdisk/src/context.c index 3a6332f2ea..302020590d 100644 --- a/fdisks/utils.c +++ b/libfdisk/src/context.c @@ -1,39 +1,5 @@ -/* - * Copyright (C) 2012 Davidlohr Bueso - * - * 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 -#include -#include -#include -#include -#ifdef HAVE_LIBBLKID -#include -#endif -#include "nls.h" -#include "blkdev.h" -#include "common.h" -#include "fdisk.h" - -#include "fdiskdoslabel.h" -#include "fdisksunlabel.h" - -int fdisk_debug_mask; +#include "fdiskP.h" /** * fdisk_new_context: @@ -110,6 +76,3 @@ void fdisk_free_context(struct fdisk_context *cxt) free(cxt->firstsector); free(cxt); } - - - diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h index 08df05bed4..276f79b83e 100644 --- a/libfdisk/src/libfdisk.h +++ b/libfdisk/src/libfdisk.h @@ -45,6 +45,11 @@ enum fdisk_labeltype { /* init.c */ extern void fdisk_init_debug(int mask); +/* context.h */ +extern struct fdisk_context *fdisk_new_context_from_filename( + const char *fname, int readonly); +extern void fdisk_free_context(struct fdisk_context *cxt); + /* parttype.c */ extern struct fdisk_parttype *fdisk_get_parttype_from_code(struct fdisk_context *cxt, unsigned int code);