lol

xfsdump: fix build against xfsprogs 5.18.0

Closes #177779

lunik1 b0e82c68 72f17cca

+328 -1
+6 -1
pkgs/tools/filesystems/xfsdump/default.nix
··· 33 33 ncurses 34 34 ]; 35 35 36 - patchPhase = '' 36 + # fixes build against xfsprogs >= 5.18 37 + # taken from https://lore.kernel.org/linux-xfs/20220203174540.GT8313@magnolia/ 38 + # should be included upsteam next release 39 + patches = [ ./remove-dmapapi.patch ]; 40 + 41 + postPatch = '' 37 42 substituteInPlace Makefile \ 38 43 --replace "cp include/install-sh ." "cp -f include/install-sh ." 39 44 '';
+322
pkgs/tools/filesystems/xfsdump/remove-dmapapi.patch
··· 1 + diff --git a/doc/xfsdump.html b/doc/xfsdump.html 2 + index d4d157f..2c9324b 100644 3 + --- a/doc/xfsdump.html 4 + +++ b/doc/xfsdump.html 5 + @@ -1092,7 +1092,6 @@ the size of the hash table. 6 + bool_t p_ownerpr - whether to restore directory owner/group attributes 7 + bool_t p_fullpr - whether restoring a full level 0 non-resumed dump 8 + bool_t p_ignoreorphpr - set if positive subtree or interactive 9 + - bool_t p_restoredmpr - restore DMI event settings 10 + </pre> 11 + <p> 12 + The hash table maps the inode number to the tree node. It is a 13 + diff --git a/po/de.po b/po/de.po 14 + index 62face8..bdf47d1 100644 15 + --- a/po/de.po 16 + +++ b/po/de.po 17 + @@ -3972,11 +3972,6 @@ msgstr "" 18 + msgid "no additional media objects needed\n" 19 + msgstr "keine zusätzlichen Mediendateien benötigt\n" 20 + 21 + -#: .././restore/content.c:9547 22 + -#, c-format 23 + -msgid "fssetdm_by_handle of %s failed %s\n" 24 + -msgstr "fssetdm_by_handle von %s fehlgeschlagen %s\n" 25 + - 26 + #: .././restore/content.c:9566 27 + #, c-format 28 + msgid "%s quota information written to '%s'\n" 29 + diff --git a/po/pl.po b/po/pl.po 30 + index 3cba8d6..ba25420 100644 31 + --- a/po/pl.po 32 + +++ b/po/pl.po 33 + @@ -3455,11 +3455,6 @@ msgstr "nie są potrzebne dodatkowe obiekty nośnika\n" 34 + msgid "path_to_handle of %s failed:%s\n" 35 + msgstr "path_to_handle na %s nie powiodło się: %s\n" 36 + 37 + -#: .././restore/content.c:9723 38 + -#, c-format 39 + -msgid "fssetdm_by_handle of %s failed %s\n" 40 + -msgstr "fssetdm_by_handle na %s nie powiodło się: %s\n" 41 + - 42 + #: .././restore/content.c:9742 43 + #, c-format 44 + msgid "%s quota information written to '%s'\n" 45 + diff --git a/restore/content.c b/restore/content.c 46 + index 6b22965..e9b0a07 100644 47 + --- a/restore/content.c 48 + +++ b/restore/content.c 49 + @@ -477,9 +477,6 @@ struct pers { 50 + /* how many pages following the header page are reserved 51 + * for the subtree descriptors 52 + */ 53 + - bool_t restoredmpr; 54 + - /* restore DMAPI event settings 55 + - */ 56 + bool_t restoreextattrpr; 57 + /* restore extended attributes 58 + */ 59 + @@ -858,7 +855,6 @@ static void partial_reg(ix_t d_index, xfs_ino_t ino, off64_t fsize, 60 + off64_t offset, off64_t sz); 61 + static bool_t partial_check (xfs_ino_t ino, off64_t fsize); 62 + static bool_t partial_check2 (partial_rest_t *isptr, off64_t fsize); 63 + -static int do_fssetdm_by_handle(char *path, fsdmidata_t *fdmp); 64 + static int quotafilecheck(char *type, char *dstdir, char *quotafile); 65 + 66 + /* definition of locally defined global variables ****************************/ 67 + @@ -894,7 +890,6 @@ content_init(int argc, char *argv[], size64_t vmsz) 68 + bool_t changepr;/* cmd line overwrite inhibit specification */ 69 + bool_t interpr; /* cmd line interactive mode requested */ 70 + bool_t ownerpr; /* cmd line chown/chmod requested */ 71 + - bool_t restoredmpr; /* cmd line restore dm api attrs specification */ 72 + bool_t restoreextattrpr; /* cmd line restore extended attr spec */ 73 + bool_t sesscpltpr; /* force completion of prev interrupted session */ 74 + ix_t stcnt; /* cmd line number of subtrees requested */ 75 + @@ -956,7 +951,6 @@ content_init(int argc, char *argv[], size64_t vmsz) 76 + newerpr = BOOL_FALSE; 77 + changepr = BOOL_FALSE; 78 + ownerpr = BOOL_FALSE; 79 + - restoredmpr = BOOL_FALSE; 80 + restoreextattrpr = BOOL_TRUE; 81 + sesscpltpr = BOOL_FALSE; 82 + stcnt = 0; 83 + @@ -1162,8 +1156,11 @@ content_init(int argc, char *argv[], size64_t vmsz) 84 + tranp->t_noinvupdatepr = BOOL_TRUE; 85 + break; 86 + case GETOPT_SETDM: 87 + - restoredmpr = BOOL_TRUE; 88 + - break; 89 + + mlog(MLOG_NORMAL | MLOG_ERROR, _( 90 + + "-%c option no longer supported\n"), 91 + + GETOPT_SETDM); 92 + + usage(); 93 + + return BOOL_FALSE; 94 + case GETOPT_ALERTPROG: 95 + if (!optarg || optarg[0] == '-') { 96 + mlog(MLOG_NORMAL | MLOG_ERROR, _( 97 + @@ -1574,12 +1571,6 @@ content_init(int argc, char *argv[], size64_t vmsz) 98 + } 99 + 100 + if (persp->a.valpr) { 101 + - if (restoredmpr && persp->a.restoredmpr != restoredmpr) { 102 + - mlog(MLOG_NORMAL | MLOG_ERROR, _( 103 + - "-%c cannot reset flag from previous restore\n"), 104 + - GETOPT_SETDM); 105 + - return BOOL_FALSE; 106 + - } 107 + if (!restoreextattrpr && 108 + persp->a.restoreextattrpr != restoreextattrpr) { 109 + mlog(MLOG_NORMAL | MLOG_ERROR, _( 110 + @@ -1734,7 +1725,6 @@ content_init(int argc, char *argv[], size64_t vmsz) 111 + persp->a.newerpr = newerpr; 112 + persp->a.newertime = newertime; 113 + } 114 + - persp->a.restoredmpr = restoredmpr; 115 + if (!persp->a.dstdirisxfspr) { 116 + restoreextattrpr = BOOL_FALSE; 117 + } 118 + @@ -2365,7 +2355,6 @@ content_stream_restore(ix_t thrdix) 119 + scrhdrp->cih_inomap_nondircnt, 120 + tranp->t_vmsz, 121 + fullpr, 122 + - persp->a.restoredmpr, 123 + persp->a.dstdirisxfspr, 124 + grhdrp->gh_version, 125 + tranp->t_truncategenpr); 126 + @@ -7549,12 +7538,6 @@ restore_reg(drive_t *drivep, 127 + } 128 + } 129 + 130 + - if (persp->a.dstdirisxfspr && persp->a.restoredmpr) { 131 + - HsmBeginRestoreFile(bstatp, 132 + - *fdp, 133 + - &strctxp->sc_hsmflags); 134 + - } 135 + - 136 + return BOOL_TRUE; 137 + } 138 + 139 + @@ -7726,26 +7709,6 @@ restore_complete_reg(stream_context_t *strcxtp) 140 + strerror(errno)); 141 + } 142 + 143 + - if (persp->a.dstdirisxfspr && persp->a.restoredmpr) { 144 + - fsdmidata_t fssetdm; 145 + - 146 + - /* Set the DMAPI Fields. */ 147 + - fssetdm.fsd_dmevmask = bstatp->bs_dmevmask; 148 + - fssetdm.fsd_padding = 0; 149 + - fssetdm.fsd_dmstate = bstatp->bs_dmstate; 150 + - 151 + - rval = ioctl(fd, XFS_IOC_FSSETDM, (void *)&fssetdm); 152 + - if (rval) { 153 + - mlog(MLOG_NORMAL | MLOG_WARNING, 154 + - _("attempt to set DMI attributes of %s " 155 + - "failed: %s\n"), 156 + - path, 157 + - strerror(errno)); 158 + - } 159 + - 160 + - HsmEndRestoreFile(path, fd, &strcxtp->sc_hsmflags); 161 + - } 162 + - 163 + /* set any extended inode flags that couldn't be set 164 + * prior to restoring the data. 165 + */ 166 + @@ -8064,17 +8027,6 @@ restore_symlink(drive_t *drivep, 167 + strerror(errno)); 168 + } 169 + } 170 + - 171 + - if (persp->a.restoredmpr) { 172 + - fsdmidata_t fssetdm; 173 + - 174 + - /* Restore DMAPI fields. */ 175 + - 176 + - fssetdm.fsd_dmevmask = bstatp->bs_dmevmask; 177 + - fssetdm.fsd_padding = 0; 178 + - fssetdm.fsd_dmstate = bstatp->bs_dmstate; 179 + - rval = do_fssetdm_by_handle(path, &fssetdm); 180 + - } 181 + } 182 + 183 + return BOOL_TRUE; 184 + @@ -8777,7 +8729,7 @@ restore_extattr(drive_t *drivep, 185 + } 186 + assert(nread == (int)(recsz - EXTATTRHDR_SZ)); 187 + 188 + - if (!persp->a.restoreextattrpr && !persp->a.restoredmpr) { 189 + + if (!persp->a.restoreextattrpr) { 190 + continue; 191 + } 192 + 193 + @@ -8796,19 +8748,6 @@ restore_extattr(drive_t *drivep, 194 + } 195 + } else if (isfilerestored && path[0] != '\0') { 196 + setextattr(path, ahdrp); 197 + - 198 + - if (persp->a.dstdirisxfspr && persp->a.restoredmpr) { 199 + - int flag = 0; 200 + - char *attrname = (char *)&ahdrp[1]; 201 + - if (ahdrp->ah_flags & EXTATTRHDR_FLAGS_ROOT) 202 + - flag = ATTR_ROOT; 203 + - else if (ahdrp->ah_flags & EXTATTRHDR_FLAGS_SECURE) 204 + - flag = ATTR_SECURE; 205 + - 206 + - HsmRestoreAttribute(flag, 207 + - attrname, 208 + - &strctxp->sc_hsmflags); 209 + - } 210 + } 211 + } 212 + /* NOTREACHED */ 213 + @@ -9709,32 +9648,6 @@ display_needed_objects(purp_t purp, 214 + } 215 + } 216 + 217 + -static int 218 + -do_fssetdm_by_handle( 219 + - char *path, 220 + - fsdmidata_t *fdmp) 221 + -{ 222 + - void *hanp; 223 + - size_t hlen=0; 224 + - int rc; 225 + - 226 + - if (path_to_handle(path, &hanp, &hlen)) { 227 + - mlog(MLOG_NORMAL | MLOG_WARNING, _( 228 + - "path_to_handle of %s failed:%s\n"), 229 + - path, strerror(errno)); 230 + - return -1; 231 + - } 232 + - 233 + - rc = fssetdm_by_handle(hanp, hlen, fdmp); 234 + - free_handle(hanp, hlen); 235 + - if (rc) { 236 + - mlog(MLOG_NORMAL | MLOG_WARNING, _( 237 + - "fssetdm_by_handle of %s failed %s\n"), 238 + - path, strerror(errno)); 239 + - } 240 + - return rc; 241 + -} 242 + - 243 + static int 244 + quotafilecheck(char *type, char *dstdir, char *quotafile) 245 + { 246 + diff --git a/restore/tree.c b/restore/tree.c 247 + index 0670318..5429b74 100644 248 + --- a/restore/tree.c 249 + +++ b/restore/tree.c 250 + @@ -108,9 +108,6 @@ struct treePersStorage { 251 + bool_t p_ignoreorphpr; 252 + /* set if positive subtree or interactive 253 + */ 254 + - bool_t p_restoredmpr; 255 + - /* restore DMI event settings 256 + - */ 257 + bool_t p_truncategenpr; 258 + /* truncate inode generation number (for compatibility 259 + * with xfsdump format 2 and earlier) 260 + @@ -348,7 +345,6 @@ tree_init(char *hkdir, 261 + size64_t nondircnt, 262 + size64_t vmsz, 263 + bool_t fullpr, 264 + - bool_t restoredmpr, 265 + bool_t dstdirisxfspr, 266 + uint32_t dumpformat, 267 + bool_t truncategenpr) 268 + @@ -508,10 +504,6 @@ tree_init(char *hkdir, 269 + */ 270 + persp->p_fullpr = fullpr; 271 + 272 + - /* record if DMI event settings should be restored 273 + - */ 274 + - persp->p_restoredmpr = restoredmpr; 275 + - 276 + /* record if truncated generation numbers are required 277 + */ 278 + if (dumpformat < GLOBAL_HDR_VERSION_3) { 279 + @@ -2550,31 +2542,6 @@ setdirattr(dah_t dah, char *path) 280 + } 281 + } 282 + 283 + - if (tranp->t_dstdirisxfspr && persp->p_restoredmpr) { 284 + - fsdmidata_t fssetdm; 285 + - 286 + - fssetdm.fsd_dmevmask = dirattr_get_dmevmask(dah); 287 + - fssetdm.fsd_padding = 0; /* not used */ 288 + - fssetdm.fsd_dmstate = (uint16_t)dirattr_get_dmstate(dah); 289 + - 290 + - /* restore DMAPI event settings etc. 291 + - */ 292 + - rval = ioctl(fd, 293 + - XFS_IOC_FSSETDM, 294 + - (void *)&fssetdm); 295 + - if (rval) { 296 + - mlog(errno == EINVAL 297 + - ? 298 + - (MLOG_NITTY + 1) | MLOG_TREE 299 + - : 300 + - MLOG_NITTY | MLOG_TREE, 301 + - "set DMI attributes" 302 + - " of %s failed: %s\n", 303 + - path, 304 + - strerror(errno)); 305 + - } 306 + - } 307 + - 308 + utimbuf.actime = dirattr_get_atime(dah); 309 + utimbuf.modtime = dirattr_get_mtime(dah); 310 + rval = utime(path, &utimbuf); 311 + diff --git a/restore/tree.h b/restore/tree.h 312 + index 4f9ffe8..bf66e3d 100644 313 + --- a/restore/tree.h 314 + +++ b/restore/tree.h 315 + @@ -31,7 +31,6 @@ extern bool_t tree_init(char *hkdir, 316 + size64_t nondircnt, 317 + size64_t vmsz, 318 + bool_t fullpr, 319 + - bool_t restoredmpr, 320 + bool_t dstdirisxfspr, 321 + uint32_t dumpformat, 322 + bool_t truncategenpr);