Skip to contentSkip to conversation

fdisk: extend comments for fdisk_new_context()

PATCH In review Davidlohr Bueso 2 participants 2 messages Jun 17, 2012 – Jun 21, 2012 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 fdisk: extend comments for fdisk_new_context()

From: Davidlohr Bueso <[email protected]>

---
 fdisk/utils.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
fdisk/utils.c +6 -4
index 352a934..5bb4984 100644
@@ -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;
Signature · 1 line
1.7.4.1
maintainer
#1 lore raw
Quoted 1 line · Davidlohr Bueso
 fdisk/utils.c |   10 ++++++----

All (9) patches applied. Thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com