" -zX[,Y] X=compressor (Y=compression level, optional)\n"
" -C# specify the size of compress physical cluster in bytes\n"
" -EX[,...] X=extended options\n"
+ " -L volume-label set the volume label (maximum 16)\n"
" -T# set a fixed UNIX timestamp # to all files\n"
#ifdef HAVE_LIBUUID
" -UX use a given filesystem UUID\n"
int opt, i;
bool quiet = false;
- while ((opt = getopt_long(argc, argv, "C:E:T:U:d:x:z:",
+ while ((opt = getopt_long(argc, argv, "C:E:L:T:U:d:x:z:",
long_options, NULL)) != -1) {
switch (opt) {
case 'z':
if (opt)
return opt;
break;
+
+ case 'L':
+ if (optarg == NULL ||
+ strlen(optarg) > sizeof(sbi.volume_name)) {
+ erofs_err("invalid volume label");
+ return -EINVAL;
+ }
+ strncpy(sbi.volume_name, optarg,
+ sizeof(sbi.volume_name));
+ break;
+
case 'T':
cfg.c_unix_timestamp = strtoull(optarg, &endptr, 0);
if (cfg.c_unix_timestamp == -1 || *endptr != '\0') {
sb.root_nid = cpu_to_le16(root_nid);
sb.packed_nid = cpu_to_le64(packed_nid);
memcpy(sb.uuid, sbi.uuid, sizeof(sb.uuid));
+ memcpy(sb.volume_name, sbi.volume_name, sizeof(sb.volume_name));
if (erofs_sb_has_compr_cfgs())
sb.u1.available_compr_algs = sbi.available_compr_algs;