From: Davidlohr Bueso Date: Sun, 17 Jun 2012 16:09:59 +0000 (+0200) Subject: fdisk: extend comments for fdisk_new_context() X-Git-Tag: v2.22-rc1~262 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=25b529fe9b74af927791049d82cedfe897b672ab;p=thirdparty%2Futil-linux.git fdisk: extend comments for fdisk_new_context() Signed-off-by: Davidlohr Bueso --- diff --git a/fdisk/utils.c b/fdisk/utils.c index 352a9346b1..5bb4984643 100644 --- a/fdisk/utils.c +++ b/fdisk/utils.c @@ -147,6 +147,12 @@ void fdisk_init_debug(int mask) /** * fdisk_new_context: + * @filename: path to the device to be handled + * @readonly: how to open the device + * + * If the @readonly flag is set to false, fdisk will attempt to open + * the device with read-write mode and will fallback to read-only if + * unsuccessful. * * Returns: newly allocated fdisk context */ @@ -155,10 +161,6 @@ struct fdisk_context *fdisk_new_context_from_filename(const char *fname, int rea int fd, errsv = 0; struct fdisk_context *cxt = NULL; - /* - * Attempt to open the device with r-w permissions - * by default, otherwise try read-only. - */ if (readonly == 1 || (fd = open(fname, O_RDWR)) < 0) { if ((fd = open(fname, O_RDONLY)) < 0) return NULL;