]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: extend comments for fdisk_new_context()
authorDavidlohr Bueso <dave@gnu.org>
Sun, 17 Jun 2012 16:09:59 +0000 (18:09 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 21 Jun 2012 06:04:06 +0000 (08:04 +0200)
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
fdisk/utils.c

index 352a9346b1d1eeb7e17707acd45a0b27ae445c62..5bb498464374945cadec504ee252c9c2a72a1760 100644 (file)
@@ -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;