Hi,
On Wednesday 08 July 2015 11:07:48 Chen Hanxiao wrote:
int
+ext_set_label (const char *device, const char *label)
+{
+ int r;
+ CLEANUP_FREE char *err = NULL;
+
+ if (strlen (label) > EXT2_LABEL_MAX) {
+ reply_with_error ("%s: ext2 labels are limited to %d bytes",
+ label, EXT2_LABEL_MAX);
+ return -1;
+ }
+
+ r = command (NULL, &err, str_e2label, device, label, NULL);
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ return -1;
+ }
+
+ return 0;
+}
I'd say you can just put all the implementation ...
+int
do_set_e2label (const char *device, const char *label)
{
- const mountable_t mountable = {
- .type = MOUNTABLE_DEVICE,
- .device = /* not really ... */ (char *) device,
- .volume = NULL,
- };
- return do_set_label (&mountable, label);
+ return ext_set_label (device, label);
}
... directly here, and just call do_set_e2label in do_set_label.
Thanks,
--
Pino Toscano