]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - repair/attr_repair.c
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / repair / attr_repair.c
index 11a8f03013c0fdc6e576c1052b8d8ec2f6c5690b..91831f4c54d06d0302314865dbb93a38d05e9749 100644 (file)
@@ -1,32 +1,32 @@
 /*
  * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
  * published by the Free Software Foundation.
- * 
+ *
  * This program is distributed in the hope that it would be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * 
+ *
  * Further, this software is distributed without any warranty that it is
  * free of the rightful claim of any third person regarding infringement
  * or the like.  Any license provided herein, whether implied or
  * otherwise, applies only to this software file.  Patent licenses, if
  * any, provided herein do not apply to combinations of this program with
  * other software, or any other product whatsoever.
- * 
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write the Free Software Foundation, Inc., 59
  * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- * 
+ *
  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  * Mountain View, CA  94043, or:
- * 
- * http://www.sgi.com 
- * 
- * For further information regarding this notice, see: 
- * 
+ *
+ * http://www.sgi.com
+ *
+ * For further information regarding this notice, see:
+ *
  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  */
 
@@ -46,12 +46,12 @@ static int xfs_mac_valid(xfs_mac_label_t *lp);
 
 
 /*
- * For attribute repair, there are 3 formats to worry about. First, is 
+ * For attribute repair, there are 3 formats to worry about. First, is
  * shortform attributes which reside in the inode. Second is the leaf
  * form, and lastly the btree. Much of this models after the directory
- * structure so code resembles the directory repair cases. 
+ * structure so code resembles the directory repair cases.
  * For shortform case, if an attribute looks corrupt, it is removed.
- * If that leaves the shortform down to 0 attributes, it's okay and 
+ * If that leaves the shortform down to 0 attributes, it's okay and
  * will appear to just have a null attribute fork. Some checks are done
  * for validity of the value field based on what the security needs are.
  * Calls will be made to xfs_mac_valid or xfs_acl_valid routines if the
@@ -60,7 +60,7 @@ static int xfs_mac_valid(xfs_mac_label_t *lp);
  * requirements, but may in the future.
  *
  * For leaf block attributes, it requires more processing. One sticky
- * point is that the attributes can be local (within the leaf) or 
+ * point is that the attributes can be local (within the leaf) or
  * remote (outside the leaf in other blocks). Thinking of local only
  * if you get a bad attribute, and want to delete just one, its a-okay
  * if it remains large enough to still be a leaf block attribute. Otherwise,
@@ -75,7 +75,7 @@ static int xfs_mac_valid(xfs_mac_label_t *lp);
  * attribute in the leaf block will make the entire attribute fork be
  * cleared. The simplest way to do that is to ignore the leaf format, and
  * call clear_dinode_attr to just make a shortform attribute fork with
- * zero entries. 
+ * zero entries.
  *
  * Another issue with handling repair on leaf attributes is the remote
  * blocks. To make sure that they look good and are not used multiple times
@@ -106,10 +106,10 @@ valuecheck(char *namevalue, char *value, int namelen, int valuelen)
        void *valuep;
        int clearit = 0;
 
-       if ((strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) || 
-                       (strncmp(namevalue, SGI_ACL_DEFAULT, 
+       if ((strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
+                       (strncmp(namevalue, SGI_ACL_DEFAULT,
                                SGI_ACL_DEFAULT_SIZE) == 0)) {
-               if (value == NULL) {    
+               if (value == NULL) {
                        bzero(&thisacl, sizeof(xfs_acl_t));
                        bcopy(namevalue+namelen, &thisacl, valuelen);
                        valuep = &thisacl;
@@ -118,19 +118,21 @@ valuecheck(char *namevalue, char *value, int namelen, int valuelen)
 
                if (xfs_acl_valid((xfs_acl_t *) valuep) != 0) { /* 0 is valid */
                        clearit = 1;
-                       do_warn("entry contains illegal value in attribute named SGI_ACL_FILE or SGI_ACL_DEFAULT\n");
+                       do_warn(
+       _("entry contains illegal value in attribute named SGI_ACL_FILE "
+         "or SGI_ACL_DEFAULT\n"));
                }
        } else if (strncmp(namevalue, SGI_MAC_FILE, SGI_MAC_FILE_SIZE) == 0) {
                if (value == NULL) {
                        bzero(&macl, sizeof(xfs_mac_label_t));
                        bcopy(namevalue+namelen, &macl, valuelen);
                        valuep = &macl;
-               } else 
+               } else
                        valuep = value;
 
                if (xfs_mac_valid((xfs_mac_label_t *)valuep) != 1) { /* 1 is valid */
                         /*
-                        *if sysconf says MAC enabled, 
+                        * if sysconf says MAC enabled,
                         *      temp = mac_from_text("msenhigh/mintlow", NULL)
                         *      copy it to value, update valuelen, totsize
                         *      This causes pushing up or down of all following
@@ -138,12 +140,14 @@ valuecheck(char *namevalue, char *value, int namelen, int valuelen)
                         * else clearit = 1;
                         */
                        clearit = 1;
-                       do_warn("entry contains illegal value in attribute named SGI_MAC_LABEL\n");
+                       do_warn(
+       _("entry contains illegal value in attribute named SGI_MAC_LABEL\n"));
                }
        } else if (strncmp(namevalue, SGI_CAP_FILE, SGI_CAP_FILE_SIZE) == 0) {
                if ( valuelen != sizeof(xfs_cap_set_t)) {
                        clearit = 1;
-                       do_warn("entry contains illegal value in attribute named SGI_CAP_FILE\n");
+                       do_warn(
+       _("entry contains illegal value in attribute named SGI_CAP_FILE\n"));
                }
        }
 
@@ -162,37 +166,41 @@ int
 process_shortform_attr(
        xfs_ino_t       ino,
        xfs_dinode_t    *dip,
-       int             *repair)        
+       int             *repair)
 {
        xfs_attr_shortform_t    *asf;
        xfs_attr_sf_entry_t     *currententry, *nextentry, *tempentry;
        int                     i, junkit;
        int                     currentsize, remainingspace;
-       
+
        *repair = 0;
 
        asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT);
 
        /* Assumption: hdr.totsize is less than a leaf block and was checked
-        * by lclinode for valid sizes. Check the count though. 
+        * by lclinode for valid sizes. Check the count though.
        */
-       if (INT_GET(asf->hdr.count, ARCH_CONVERT) == 0) 
+       if (INT_GET(asf->hdr.count, ARCH_CONVERT) == 0)
                /* then the total size should just be the header length */
                if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) != sizeof(xfs_attr_sf_hdr_t)) {
                        /* whoops there's a discrepancy. Clear the hdr */
                        if (!no_modify) {
-                               do_warn("there are no attributes in the fork for inode %llu \n", ino);
+                               do_warn(
+               _("there are no attributes in the fork for inode %llu\n"),
+                                       ino);
                                INT_SET(asf->hdr.totsize, ARCH_CONVERT,
                                                sizeof(xfs_attr_sf_hdr_t));
                                *repair = 1;
-                               return(1);      
+                               return(1);
                        } else {
-                               do_warn("would junk the attribute fork since the count is 0 for inode %llu\n",ino);
+                               do_warn(
+       _("would junk the attribute fork since count is 0 for inode %llu\n"),
+                                       ino);
                                return(1);
                        }
-                }
-               
-       currentsize = sizeof(xfs_attr_sf_hdr_t); 
+               }
+
+       currentsize = sizeof(xfs_attr_sf_hdr_t);
        remainingspace = INT_GET(asf->hdr.totsize, ARCH_CONVERT) - currentsize;
        nextentry = &asf->list[0];
        for (i = 0; i < INT_GET(asf->hdr.count, ARCH_CONVERT); i++)  {
@@ -200,19 +208,21 @@ process_shortform_attr(
                junkit = 0;
 
                /* don't go off the end if the hdr.count was off */
-               if ((currentsize + (sizeof(xfs_attr_sf_entry_t) - 1)) > 
+               if ((currentsize + (sizeof(xfs_attr_sf_entry_t) - 1)) >
                                INT_GET(asf->hdr.totsize, ARCH_CONVERT))
                        break; /* get out and reset count and totSize */
 
                /* if the namelen is 0, can't get to the rest of the entries */
                if (INT_GET(currententry->namelen, ARCH_CONVERT) == 0) {
-                       do_warn("zero length name entry in attribute fork, ");
+                       do_warn(_("zero length name entry in attribute fork,"));
                        if (!no_modify) {
-                               do_warn("truncating attributes for inode %llu to %d \n", ino, i);
+                               do_warn(
+               _(" truncating attributes for inode %llu to %d\n"), ino, i);
                                *repair = 1;
-                               break;  /* and then update hdr fields */
+                               break;  /* and then update hdr fields */
                        } else {
-                               do_warn("would truncate attributes for inode %llu to %d \n", ino, i);
+                               do_warn(
+               _(" would truncate attributes for inode %llu to %d\n"), ino, i);
                                break;
                        }
                } else {
@@ -220,47 +230,60 @@ process_shortform_attr(
                         * rough check to make sure we haven't gone outside of
                         * totsize.
                         */
-                       if ((remainingspace < INT_GET(currententry->namelen, ARCH_CONVERT)) ||
-                               ((remainingspace - INT_GET(currententry->namelen, ARCH_CONVERT))
-                                         < INT_GET(currententry->valuelen, ARCH_CONVERT))) {
-                               do_warn("name or value attribute lengths are too large, \n");
+                       if ((remainingspace <
+                               INT_GET(currententry->namelen, ARCH_CONVERT)) ||
+                          ((remainingspace -
+                               INT_GET(currententry->namelen, ARCH_CONVERT)) <
+                               INT_GET(currententry->valuelen, ARCH_CONVERT))) {
+                               do_warn(
+                       _("name or value attribute lengths are too large,\n"));
                                if (!no_modify) {
-                                       do_warn(" truncating attributes for inode %llu to %d \n", ino, i);
-                                       *repair = 1; 
+                                       do_warn(
+                       _(" truncating attributes for inode %llu to %d\n"),
+                                               ino, i);
+                                       *repair = 1;
                                        break; /* and then update hdr fields */
                                } else {
-                                       do_warn(" would truncate attributes for inode %llu to %d \n", ino, i);  
+                                       do_warn(
+                       _(" would truncate attributes for inode %llu to %d\n"),
+                                               ino, i);
                                        break;
-                               }       
+                               }
                        }
                }
-       
-               /* namecheck checks for / and null terminated for file names. 
+
+               /* namecheck checks for / and null terminated for file names.
                 * attributes names currently follow the same rules.
                */
-               if (namecheck((char *)&currententry->nameval[0], 
+               if (namecheck((char *)&currententry->nameval[0],
                                INT_GET(currententry->namelen, ARCH_CONVERT)))  {
-                       do_warn("entry contains illegal character in shortform attribute name\n");
+                       do_warn(
+       _("entry contains illegal character in shortform attribute name\n"));
                        junkit = 1;
                }
 
                if (INT_GET(currententry->flags, ARCH_CONVERT) & XFS_ATTR_INCOMPLETE) {
-                       do_warn("entry has INCOMPLETE flag on in shortform attribute\n");
+                       do_warn(
+       _("entry has INCOMPLETE flag on in shortform attribute\n"));
                        junkit = 1;
                }
 
                /* Only check values for root security attributes */
-               if (INT_GET(currententry->flags, ARCH_CONVERT) & XFS_ATTR_ROOT) 
-                      junkit = valuecheck((char *)&currententry->nameval[0], NULL, 
-                               INT_GET(currententry->namelen, ARCH_CONVERT), INT_GET(currententry->valuelen, ARCH_CONVERT));
+               if (INT_GET(currententry->flags, ARCH_CONVERT) & XFS_ATTR_ROOT)
+                      junkit = valuecheck((char *)&currententry->nameval[0],
+                               NULL,
+                               INT_GET(currententry->namelen, ARCH_CONVERT),
+                               INT_GET(currententry->valuelen, ARCH_CONVERT));
 
-               remainingspace = remainingspace - 
+               remainingspace = remainingspace -
                                XFS_ATTR_SF_ENTSIZE(currententry);
 
                if (junkit) {
                        if (!no_modify) {
                                /* get rid of only this entry */
-                               do_warn("removing attribute entry %d for inode %llu \n", i, ino);
+                               do_warn(
+                       _("removing attribute entry %d for inode %llu\n"),
+                                       i, ino);
                                tempentry = (xfs_attr_sf_entry_t *)
                                        ((__psint_t) currententry +
                                         XFS_ATTR_SF_ENTSIZE(currententry));
@@ -269,40 +292,47 @@ process_shortform_attr(
                                i--; /* no worries, it will wrap back to 0 */
                                *repair = 1;
                                continue; /* go back up now */
-                       } else { 
-                               do_warn("would remove attribute entry %d for inode %llu \n", i, ino);
-                        }
-                }
+                       } else {
+                               do_warn(
+                       _("would remove attribute entry %d for inode %llu\n"),
+                                       i, ino);
+                       }
+               }
 
                /* Let's get ready for the next entry... */
                nextentry = (xfs_attr_sf_entry_t *)
                         ((__psint_t) nextentry +
                         XFS_ATTR_SF_ENTSIZE(currententry));
                currentsize = currentsize + XFS_ATTR_SF_ENTSIZE(currententry);
-       
-               } /* end the loop */
 
-       
+       } /* end the loop */
+
        if (INT_GET(asf->hdr.count, ARCH_CONVERT) != i)  {
                if (no_modify)  {
-                       do_warn("would have corrected attribute entry count in inode %llu from %d to %d\n",
+                       do_warn(_("would have corrected attribute entry count "
+                                 "in inode %llu from %d to %d\n"),
                                ino, INT_GET(asf->hdr.count, ARCH_CONVERT), i);
                } else  {
-                       do_warn("corrected attribute entry count in inode %llu, was %d, now %d\n",
+                       do_warn(_("corrected attribute entry count in inode "
+                                 "%llu, was %d, now %d\n"),
                                ino, INT_GET(asf->hdr.count, ARCH_CONVERT), i);
                        INT_SET(asf->hdr.count, ARCH_CONVERT, i);
                        *repair = 1;
                }
        }
-       
+
        /* ASSUMPTION: currentsize <= totsize */
        if (INT_GET(asf->hdr.totsize, ARCH_CONVERT) != currentsize)  {
                if (no_modify)  {
-                       do_warn("would have corrected attribute totsize in inode %llu from %d to %d\n",
-                               ino, INT_GET(asf->hdr.totsize, ARCH_CONVERT), currentsize);
+                       do_warn(_("would have corrected attribute totsize in "
+                                 "inode %llu from %d to %d\n"),
+                               ino, INT_GET(asf->hdr.totsize, ARCH_CONVERT),
+                               currentsize);
                } else  {
-                       do_warn("corrected attribute entry totsize in inode %llu, was %d, now %d\n",
-                               ino, INT_GET(asf->hdr.totsize, ARCH_CONVERT), currentsize);
+                       do_warn(_("corrected attribute entry totsize in "
+                                 "inode %llu, was %d, now %d\n"),
+                               ino, INT_GET(asf->hdr.totsize, ARCH_CONVERT),
+                               currentsize);
                        INT_SET(asf->hdr.totsize, ARCH_CONVERT, currentsize);
                        *repair = 1;
                }
@@ -323,28 +353,28 @@ rmtval_get(xfs_mount_t *mp, xfs_ino_t ino, blkmap_t *blkmap,
        xfs_dfsbno_t    bno;
        xfs_buf_t       *bp;
        int             clearit = 0, i = 0, length = 0, amountdone = 0;
-       
+
        /* ASSUMPTION: valuelen is a valid number, so use it for looping */
-       /* Note that valuelen is not a multiple of blocksize */  
+       /* Note that valuelen is not a multiple of blocksize */
        while (amountdone < valuelen) {
                bno = blkmap_get(blkmap, blocknum + i);
                if (bno == NULLDFSBNO) {
-                       do_warn("remote block for attributes of inode %llu"
-                               " is missing\n", ino);
+                       do_warn(_("remote block for attributes of inode %llu"
+                                 " is missing\n"), ino);
                        clearit = 1;
                        break;
                }
                bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),
                                XFS_FSB_TO_BB(mp, 1), 0);
                if (!bp) {
-                       do_warn("can't read remote block for attributes"
-                               " of inode %llu\n", ino);
+                       do_warn(_("can't read remote block for attributes"
+                                 " of inode %llu\n"), ino);
                        clearit = 1;
                        break;
                }
                ASSERT(mp->m_sb.sb_blocksize == XFS_BUF_COUNT(bp));
                length = MIN(XFS_BUF_COUNT(bp), valuelen - amountdone);
-               bcopy(XFS_BUF_PTR(bp), value, length); 
+               bcopy(XFS_BUF_PTR(bp), value, length);
                amountdone += length;
                value += length;
                i++;
@@ -364,7 +394,7 @@ static da_freemap_t attr_freemap[DA_BMAP_SIZE];
  * If any problems occur the routine returns with non-zero. In
  * this case the next step is to clear the attribute fork, by
  * changing it to shortform and zeroing it out. Forkoff need not
- * be changed. 
+ * be changed.
  */
 
 int
@@ -376,7 +406,7 @@ process_leaf_attr_block(
        blkmap_t        *blkmap,
        xfs_dahash_t    last_hashval,
        xfs_dahash_t    *current_hashval,
-       int             *repair)        
+       int             *repair)
 {
        xfs_attr_leaf_entry_t *entry;
        xfs_attr_leaf_name_local_t *local;
@@ -385,7 +415,7 @@ process_leaf_attr_block(
 
        clearit = usedbs = 0;
        *repair = 0;
-       firstb = mp->m_sb.sb_blocksize; 
+       firstb = mp->m_sb.sb_blocksize;
        stop = sizeof(xfs_attr_leaf_hdr_t);
 
        /* does the count look sorta valid? */
@@ -393,98 +423,113 @@ process_leaf_attr_block(
                                * sizeof(xfs_attr_leaf_entry_t)
                                + sizeof(xfs_attr_leaf_hdr_t)
                                                        > XFS_LBSIZE(mp)) {
-               do_warn("bad attribute count %d in attr block %u, inode %llu\n",
+               do_warn(
+       _("bad attribute count %d in attr block %u, inode %llu\n"),
                        (int) INT_GET(leaf->hdr.count, ARCH_CONVERT),
                                                da_bno, ino);
                return (1);
        }
+
        init_da_freemap(attr_freemap);
        (void) set_da_freemap(mp, attr_freemap, 0, stop);
-       
+
        /* go thru each entry checking for problems */
-       for (i = 0, entry = &leaf->entries[0]; 
+       for (i = 0, entry = &leaf->entries[0];
                        i < INT_GET(leaf->hdr.count, ARCH_CONVERT);
                                                i++, entry++) {
-       
+
                /* check if index is within some boundary. */
                if (INT_GET(entry->nameidx, ARCH_CONVERT) > XFS_LBSIZE(mp)) {
-                       do_warn("bad attribute nameidx %d in attr block %u, inode %llu\n",
+                       do_warn(
+               _("bad attribute nameidx %d in attr block %u, inode %llu\n"),
                                (int)INT_GET(entry->nameidx, ARCH_CONVERT),
                                da_bno,ino);
                        clearit = 1;
                        break;
-                       }
+               }
 
                if (INT_GET(entry->flags, ARCH_CONVERT) & XFS_ATTR_INCOMPLETE) {
                        /* we are inconsistent state. get rid of us */
-                       do_warn("attribute entry #%d in attr block %u, inode %llu is INCOMPLETE\n",
+                       do_warn(
+       _("attribute entry #%d in attr block %u, inode %llu is INCOMPLETE\n"),
                                i, da_bno, ino);
                        clearit = 1;
                        break;
-                       }
+               }
 
                /* mark the entry used */
                start = (__psint_t)&leaf->entries[i] - (__psint_t)leaf;
                stop = start + sizeof(xfs_attr_leaf_entry_t);
                if (set_da_freemap(mp, attr_freemap, start, stop))  {
-                       do_warn("attribute entry %d in attr block %u, inode %llu claims already used space\n",
-                               i,da_bno,ino);
+                       do_warn(
+               _("attribute entry %d in attr block %u, inode %llu claims "
+                 "already used space\n"),
+                               i, da_bno, ino);
                        clearit = 1;
                        break;  /* got an overlap */
-                       }
+               }
 
                if (INT_GET(entry->flags, ARCH_CONVERT) & XFS_ATTR_LOCAL) {
 
-                       local = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i);      
-                       if ((INT_GET(local->namelen, ARCH_CONVERT) == 0) || 
-                                       (namecheck((char *)&local->nameval[0], 
-                                               INT_GET(local->namelen, ARCH_CONVERT)))) {
-                               do_warn("attribute entry %d in attr block %u, inode %llu has bad name (namelen = %d)\n",
-                                       i, da_bno, ino, (int) INT_GET(local->namelen, ARCH_CONVERT));
-
+                       local = XFS_ATTR_LEAF_NAME_LOCAL(leaf, i);
+                       if ((INT_GET(local->namelen, ARCH_CONVERT) == 0) ||
+                               (namecheck((char *)&local->nameval[0],
+                                   INT_GET(local->namelen, ARCH_CONVERT))))  {
+                               do_warn(
+                       _("attribute entry %d in attr block %u, inode %llu "
+                         "has bad name (namelen = %d)\n"),
+                                       i, da_bno, ino, (int)
+                                       INT_GET(local->namelen, ARCH_CONVERT));
                                clearit = 1;
                                break;
-                               };
-
-                       /* Check on the hash value. Checking ordering of hash values
-                        * is not necessary, since one wrong one clears the whole
-                        * fork. If the ordering's wrong, it's caught here or 
-                        * the kernel code has a bug with transaction logging
-                        * or attributes itself. For paranoia reasons, let's check
-                        * ordering anyway in case both the name value and the 
-                        * hashvalue were wrong but matched. Unlikely, however.
+                       }
+
+                       /* Check on the hash value. Checking order of values
+                        * is not necessary, since one wrong clears the whole
+                        * fork. If the ordering's wrong, it's caught here or
+                        * the kernel code has a bug with transaction logging
+                        * or attributes itself. Being paranoid, let's check
+                        * ordering anyway in case both the name value and the
+                        * hashvalue were wrong but matched. Unlikely, however.
                        */
-                       if (INT_GET(entry->hashval, ARCH_CONVERT) != 
+                       if (INT_GET(entry->hashval, ARCH_CONVERT) !=
                                libxfs_da_hashname((char *)&local->nameval[0],
-                                       INT_GET(local->namelen, ARCH_CONVERT)) ||
-                               (INT_GET(entry->hashval, ARCH_CONVERT)
-                                                       < last_hashval)) {
-                               do_warn("bad hashvalue for attribute entry %d in attr block %u, inode %llu\n",
+                                       INT_GET(local->namelen,
+                                               ARCH_CONVERT)) ||
+                          (INT_GET(entry->hashval, ARCH_CONVERT) <
+                                                       last_hashval)) {
+                               do_warn(
+                       _("bad hashvalue for attribute entry %d in "
+                         "attr block %u, inode %llu\n"),
                                        i, da_bno, ino);
                                clearit = 1;
                                break;
                        }
 
                        /* Only check values for root security attributes */
-                       if (INT_GET(entry->flags, ARCH_CONVERT) & XFS_ATTR_ROOT) 
+                       if (INT_GET(entry->flags, ARCH_CONVERT) & XFS_ATTR_ROOT)
                                if (valuecheck((char *)&local->nameval[0], NULL,
-                                           INT_GET(local->namelen, ARCH_CONVERT), INT_GET(local->valuelen, ARCH_CONVERT))) {
-                                       do_warn("bad security value for attribute entry %d in attr block %u, inode %llu\n",
-                                               i,da_bno,ino);
+                                   INT_GET(local->namelen, ARCH_CONVERT),
+                                   INT_GET(local->valuelen, ARCH_CONVERT)))  {
+                                       do_warn(
+                       _("bad security value for attribute entry %d in "
+                         "attr block %u, inode %llu\n"),
+                                               i, da_bno, ino);
                                        clearit = 1;
                                        break;
-                               };
+                               }
+
                        thissize = XFS_ATTR_LEAF_ENTSIZE_LOCAL(
-                                       INT_GET(local->namelen, ARCH_CONVERT), INT_GET(local->valuelen, ARCH_CONVERT));
+                                       INT_GET(local->namelen, ARCH_CONVERT),
+                                       INT_GET(local->valuelen, ARCH_CONVERT));
 
                } else {
                        /* do the remote case */
                        remotep = XFS_ATTR_LEAF_NAME_REMOTE(leaf, i);
                        thissize = XFS_ATTR_LEAF_ENTSIZE_REMOTE(
-                                       INT_GET(remotep->namelen, ARCH_CONVERT)); 
+                                       INT_GET(remotep->namelen, ARCH_CONVERT));
 
-                       if ((INT_GET(remotep->namelen, ARCH_CONVERT) == 0) || 
+                       if ((INT_GET(remotep->namelen, ARCH_CONVERT) == 0) ||
                                   (namecheck((char *)&remotep->name[0],
                                        INT_GET(remotep->namelen, ARCH_CONVERT))) ||
                                   (INT_GET(entry->hashval, ARCH_CONVERT)
@@ -494,30 +539,45 @@ process_leaf_attr_block(
                                   (INT_GET(entry->hashval, ARCH_CONVERT)
                                                < last_hashval) ||
                                   (INT_GET(remotep->valueblk, ARCH_CONVERT) == 0)) {
-                               do_warn("inconsistent remote attribute entry %d in attr block %u, ino %llu\n",
+                               do_warn(
+                       _("inconsistent remote attribute entry %d in "
+                         "attr block %u, ino %llu\n"),
                                        i, da_bno, ino);
                                clearit = 1;
                                break;
-                       };
+                       }
 
                        if (INT_GET(entry->flags, ARCH_CONVERT) & XFS_ATTR_ROOT) {
                                char*   value;
-                               if ((value = malloc(INT_GET(remotep->valuelen, ARCH_CONVERT)))==NULL){
-                                       do_warn("cannot malloc enough for remotevalue attribute for inode %llu\n",ino);
-                                       do_warn("SKIPPING this remote attribute\n");
+
+                               if ((value = malloc(INT_GET(remotep->valuelen,
+                                               ARCH_CONVERT))) == NULL) {
+                                       do_warn(
+       _("cannot malloc enough for remotevalue attribute for inode %llu\n"),
+                                               ino);
+                                       do_warn(
+                               _("SKIPPING this remote attribute\n"));
                                        continue;
                                }
                                if (rmtval_get(mp, ino, blkmap,
-                                               INT_GET(remotep->valueblk, ARCH_CONVERT),
-                                               INT_GET(remotep->valuelen, ARCH_CONVERT), value)) {
-                                       do_warn("remote attribute get failed for entry %d, inode %llu\n", i,ino);
+                                               INT_GET(remotep->valueblk,
+                                                       ARCH_CONVERT),
+                                               INT_GET(remotep->valuelen,
+                                                       ARCH_CONVERT), value)) {
+                                       do_warn(
+       _("remote attribute get failed for entry %d, inode %llu\n"), i, ino);
                                        clearit = 1;
                                        free(value);
                                        break;
                                }
                                if (valuecheck((char *)&remotep->name[0], value,
-                                           INT_GET(remotep->namelen, ARCH_CONVERT), INT_GET(remotep->valuelen, ARCH_CONVERT))){
-                                       do_warn("remote attribute value check  failed for entry %d, inode %llu\n", i, ino);
+                                               INT_GET(remotep->namelen,
+                                                       ARCH_CONVERT),
+                                               INT_GET(remotep->valuelen,
+                                                       ARCH_CONVERT))) {
+                                       do_warn(
+       _("remote attribute value check failed for entry %d, inode %llu\n"),
+                                               i, ino);
                                        clearit = 1;
                                        free(value);
                                        break;
@@ -526,18 +586,21 @@ process_leaf_attr_block(
                        }
                }
 
-               *current_hashval = last_hashval 
+               *current_hashval = last_hashval
                                 = INT_GET(entry->hashval, ARCH_CONVERT);
 
-               if (set_da_freemap(mp, attr_freemap, INT_GET(entry->nameidx, ARCH_CONVERT),
-                               INT_GET(entry->nameidx, ARCH_CONVERT) + thissize))  {
-                       do_warn("attribute entry %d in attr block %u, inode %llu claims used space\n",
+               if (set_da_freemap(mp, attr_freemap,
+                                       INT_GET(entry->nameidx, ARCH_CONVERT),
+                                       INT_GET(entry->nameidx, ARCH_CONVERT) +
+                                               thissize))  {
+                       do_warn(_("attribute entry %d in attr block %u, "
+                                 "inode %llu claims used space\n"),
                                i, da_bno, ino);
                        clearit = 1;
                        break;  /* got an overlap */
-               }                       
+               }
                usedbs += thissize;
-               if (INT_GET(entry->nameidx, ARCH_CONVERT) < firstb) 
+               if (INT_GET(entry->nameidx, ARCH_CONVERT) < firstb)
                        firstb = INT_GET(entry->nameidx, ARCH_CONVERT);
 
        } /* end the loop */
@@ -547,14 +610,16 @@ process_leaf_attr_block(
 
                /* if the holes flag is set, don't reset first_used unless it's
                 * pointing to used bytes.  we're being conservative here
-                * since the block will get compacted anyhow by the kernel. 
+                * since the block will get compacted anyhow by the kernel.
                 */
 
                if (  (INT_GET(leaf->hdr.holes, ARCH_CONVERT) == 0
                    && firstb != INT_GET(leaf->hdr.firstused, ARCH_CONVERT))
                    || INT_GET(leaf->hdr.firstused, ARCH_CONVERT) > firstb)  {
                        if (!no_modify)  {
-                               do_warn("- resetting first used heap value from %d to %d in block %u of attribute fork of inode %llu\n",
+                               do_warn(
+       _("- resetting first used heap value from %d to %d in "
+         "block %u of attribute fork of inode %llu\n"),
                                        (int)INT_GET(leaf->hdr.firstused,
                                                ARCH_CONVERT), firstb,
                                                da_bno, ino);
@@ -562,7 +627,9 @@ process_leaf_attr_block(
                                                ARCH_CONVERT, firstb);
                                *repair = 1;
                        } else  {
-                               do_warn("- would reset first used value from %d to %d in block %u of attribute fork of inode %llu\n",
+                               do_warn(
+       _("- would reset first used value from %d to %d in "
+         "block %u of attribute fork of inode %llu\n"),
                                        (int)INT_GET(leaf->hdr.firstused,
                                                ARCH_CONVERT), firstb,
                                                da_bno, ino);
@@ -571,14 +638,18 @@ process_leaf_attr_block(
 
                if (usedbs != INT_GET(leaf->hdr.usedbytes, ARCH_CONVERT))  {
                        if (!no_modify)  {
-                               do_warn("- resetting usedbytes cnt from %d to %d in block %u of attribute fork of inode %llu\n",
+                               do_warn(
+       _("- resetting usedbytes cnt from %d to %d in "
+         "block %u of attribute fork of inode %llu\n"),
                                        (int)INT_GET(leaf->hdr.usedbytes,
                                          ARCH_CONVERT), usedbs, da_bno, ino);
                                INT_SET(leaf->hdr.usedbytes,
                                                ARCH_CONVERT, usedbs);
                                *repair = 1;
                        } else  {
-                               do_warn("- would reset usedbytes cnt from %d to %d in block %u of attribute fork of %llu\n",
+                               do_warn(
+       _("- would reset usedbytes cnt from %d to %d in "
+         "block %u of attribute fork of %llu\n"),
                                        (int)INT_GET(leaf->hdr.usedbytes,
                                            ARCH_CONVERT), usedbs,da_bno,ino);
                        }
@@ -588,7 +659,7 @@ process_leaf_attr_block(
                * checking for holes and compacting if appropiate. I don't think
                * attributes need all that, so let's just leave the holes. If
                * we discover later that this is a good place to do compaction
-               * we can add it then. 
+               * we can add it then.
                */
        }
        return (clearit);  /* and repair */
@@ -626,16 +697,16 @@ process_leaf_attr_level(xfs_mount_t       *mp,
                ASSERT(da_bno != 0);
 
                if (dev_bno == NULLDFSBNO) {
-                       do_warn("can't map block %u for attribute fork "
-                               "for inode %llu\n", da_bno, ino);
-                       goto error_out; 
+                       do_warn(_("can't map block %u for attribute fork "
+                                 "for inode %llu\n"), da_bno, ino);
+                       goto error_out;
                }
 
                bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, dev_bno),
                                        XFS_FSB_TO_BB(mp, 1), 0);
                if (!bp) {
-                       do_warn("can't read file block %u (fsbno %llu) for"
-                               " attribute fork of inode %llu\n",
+                       do_warn(_("can't read file block %u (fsbno %llu) for"
+                               " attribute fork of inode %llu\n"),
                                da_bno, dev_bno, ino);
                        goto error_out;
                }
@@ -645,7 +716,8 @@ process_leaf_attr_level(xfs_mount_t *mp,
                /* check magic number for leaf directory btree block */
                if (INT_GET(leaf->hdr.info.magic, ARCH_CONVERT)
                                                != XFS_ATTR_LEAF_MAGIC) {
-                       do_warn("bad attribute leaf magic %#x for inode %llu\n",
+                       do_warn(_("bad attribute leaf magic %#x "
+                                 "for inode %llu\n"),
                                 leaf->hdr.info.magic, ino);
                        libxfs_putbuf(bp);
                        goto error_out;
@@ -673,11 +745,12 @@ process_leaf_attr_level(xfs_mount_t       *mp,
                da_cursor->level[0].bno = da_bno;
                da_cursor->level[0].index
                                = INT_GET(leaf->hdr.count, ARCH_CONVERT);
-               da_cursor->level[0].dirty = repair; 
+               da_cursor->level[0].dirty = repair;
 
                if (INT_GET(leaf->hdr.info.back, ARCH_CONVERT) != prev_bno)  {
-                       do_warn("bad sibling back pointer for block %u in "
-                               "attribute fork for inode %llu\n", da_bno, ino);
+                       do_warn(_("bad sibling back pointer for block %u in "
+                                 "attribute fork for inode %llu\n"),
+                               da_bno, ino);
                        libxfs_putbuf(bp);
                        goto error_out;
                }
@@ -704,7 +777,7 @@ process_leaf_attr_level(xfs_mount_t *mp,
                /*
                 * verify the final path up (right-hand-side) if still ok
                 */
-               do_warn("bad hash path in attribute fork for inode %llu\n",
+               do_warn(_("bad hash path in attribute fork for inode %llu\n"),
                        da_cursor->ino);
                goto error_out;
        }
@@ -726,9 +799,9 @@ error_out:
  * has more than just a block) btree.
  *
  * Note that if we run into any problems, we will trash the attribute fork.
- * 
+ *
  * returns 0 if things are ok, 1 if bad
- * Note this code has been based off process_node_dir. 
+ * Note this code has been based off process_node_dir.
  */
 int
 process_node_attr(
@@ -759,7 +832,7 @@ process_node_attr(
         * now process interior node. don't have any buffers held in this path.
         */
        error = traverse_int_dablock(mp, &da_cursor, &bno, XFS_ATTR_FORK);
-       if (error == 0) 
+       if (error == 0)
                return(1);  /* 0 means unsuccessful */
 
        /*
@@ -767,7 +840,7 @@ process_node_attr(
         * the leaf dir level routine checks the interior paths
         * up to the root including the final right-most path.
         */
-       
+
        return (process_leaf_attr_level(mp, &da_cursor));
 }
 
@@ -805,22 +878,22 @@ process_longform_attr(
                        /* it's okay the kernel can handle this state */
                        return(0);
                else    {
-                       do_warn("block 0 of inode %llu attribute fork"
-                               " is missing\n", ino);
+                       do_warn(_("block 0 of inode %llu attribute fork"
+                                 " is missing\n"), ino);
                        return(1);
                }
        }
        /* FIX FOR bug 653709 -- EKN */
        if (mp->m_sb.sb_agcount < XFS_FSB_TO_AGNO(mp, bno)) {
-               do_warn("agno of attribute fork of inode %llu out of "
-                       "regular partition\n", ino);
+               do_warn(_("agno of attribute fork of inode %llu out of "
+                         "regular partition\n"), ino);
                return(1);
        }
 
        bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, bno),
                                XFS_FSB_TO_BB(mp, 1), 0);
        if (!bp) {
-               do_warn("can't read block 0 of inode %llu attribute fork\n",
+               do_warn(_("can't read block 0 of inode %llu attribute fork\n"),
                        ino);
                return(1);
        }
@@ -834,14 +907,14 @@ process_longform_attr(
        if (   INT_GET(leaf->hdr.info.forw, ARCH_CONVERT) != 0
            || INT_GET(leaf->hdr.info.back, ARCH_CONVERT) != 0)  {
                if (!no_modify)  {
-                       do_warn("clearing forw/back pointers in block 0 "
-                               "for attributes in inode %llu\n", ino);
+                       do_warn(_("clearing forw/back pointers in block 0 "
+                                 "for attributes in inode %llu\n"), ino);
                        repairlinks = 1;
                        INT_SET(leaf->hdr.info.forw, ARCH_CONVERT, 0);
                        INT_SET(leaf->hdr.info.back, ARCH_CONVERT, 0);
                } else  {
-                       do_warn("would clear forw/back pointers in block 0 "
-                               "for attributes in inode %llu\n", ino);
+                       do_warn(_("would clear forw/back pointers in block 0 "
+                                 "for attributes in inode %llu\n"), ino);
                }
        }
 
@@ -856,9 +929,9 @@ process_longform_attr(
                                0, &next_hashval, repair)) {
                        /* the block is bad.  lose the attribute fork. */
                        libxfs_putbuf(bp);
-                       return(1); 
+                       return(1);
                }
-               *repair = *repair || repairlinks; 
+               *repair = *repair || repairlinks;
                break;
 
        case XFS_DA_NODE_MAGIC:         /* btree-form attribute */
@@ -866,17 +939,17 @@ process_longform_attr(
                if (repairlinks) {
                        *repair = 1;
                        libxfs_writebuf(bp, 0);
-               } else 
-                       libxfs_putbuf(bp);      
+               } else
+                       libxfs_putbuf(bp);
                return (process_node_attr(mp, ino, dip, blkmap)); /* + repair */
        default:
-               do_warn("bad attribute leaf magic # %#x for dir ino %llu\n", 
+               do_warn(_("bad attribute leaf magic # %#x for dir ino %llu\n"),
                        INT_GET(leaf->hdr.info.magic, ARCH_CONVERT), ino);
                libxfs_putbuf(bp);
                return(1);
        }
 
-       if (*repair && !no_modify) 
+       if (*repair && !no_modify)
                libxfs_writebuf(bp, 0);
        else
                libxfs_putbuf(bp);
@@ -901,7 +974,7 @@ xfs_acl_get_endian(xfs_acl_t *aclp)
 
 /*
  * returns 1 if attributes got cleared
- * and 0 if things are ok. 
+ * and 0 if things are ok.
  */
 int
 process_attributes(
@@ -920,7 +993,8 @@ process_attributes(
        asf = (xfs_attr_shortform_t *) XFS_DFORK_APTR_ARCH(dip, ARCH_CONVERT);
 
        if (dinoc->di_aformat == XFS_DINODE_FMT_LOCAL) {
-               ASSERT(INT_GET(asf->hdr.totsize, ARCH_CONVERT) <= XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT));
+               ASSERT(INT_GET(asf->hdr.totsize, ARCH_CONVERT) <=
+                       XFS_DFORK_ASIZE_ARCH(dip, mp, ARCH_CONVERT));
                err = process_shortform_attr(ino, dip, repair);
        } else if (dinoc->di_aformat == XFS_DINODE_FMT_EXTENTS ||
                   dinoc->di_aformat == XFS_DINODE_FMT_BTREE)  {
@@ -929,14 +1003,14 @@ process_attributes(
                        /* if err, convert this to shortform and clear it */
                        /* if repair and no error, it's taken care of */
        } else  {
-               do_warn("illegal attribute format %d, ino %llu\n",
+               do_warn(_("illegal attribute format %d, ino %llu\n"),
                        dinoc->di_aformat, ino);
-               err = 1; 
+               err = 1;
        }
        return (err);  /* and repair */
 }
 
-/* 
+/*
  * Validate an ACL
  */
 static int
@@ -1032,8 +1106,8 @@ xfs_mac_valid(xfs_mac_label_t *lp)
 
        /*
         * check whether the msentype value is valid, and do they have
-        * appropriate level, category association.
-         */
+        * appropriate level, category association.
+        */
        switch (lp->ml_msen_type) {
                case XFS_MSEN_ADMIN_LABEL:
                case XFS_MSEN_EQUAL_LABEL: